当前位置: 首页>>代码示例>>Python>>正文


Python box_list_ops.prune_completely_outside_window方法代码示例

本文整理汇总了Python中object_detection.core.box_list_ops.prune_completely_outside_window方法的典型用法代码示例。如果您正苦于以下问题:Python box_list_ops.prune_completely_outside_window方法的具体用法?Python box_list_ops.prune_completely_outside_window怎么用?Python box_list_ops.prune_completely_outside_window使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在object_detection.core.box_list_ops的用法示例。


在下文中一共展示了box_list_ops.prune_completely_outside_window方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_prune_completely_outside_window

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import prune_completely_outside_window [as 别名]
def test_prune_completely_outside_window(self):
    window = tf.constant([0, 0, 9, 14], tf.float32)
    corners = tf.constant([[5.0, 5.0, 6.0, 6.0],
                           [-1.0, -2.0, 4.0, 5.0],
                           [2.0, 3.0, 5.0, 9.0],
                           [0.0, 0.0, 9.0, 14.0],
                           [-10.0, -10.0, -9.0, -9.0],
                           [-100.0, -100.0, 300.0, 600.0]])
    boxes = box_list.BoxList(corners)
    boxes.add_field('extra_data', tf.constant([[1], [2], [3], [4], [5], [6]]))
    exp_output = [[5.0, 5.0, 6.0, 6.0],
                  [-1.0, -2.0, 4.0, 5.0],
                  [2.0, 3.0, 5.0, 9.0],
                  [0.0, 0.0, 9.0, 14.0],
                  [-100.0, -100.0, 300.0, 600.0]]
    pruned, keep_indices = box_list_ops.prune_completely_outside_window(boxes,
                                                                        window)
    with self.test_session() as sess:
      pruned_output = sess.run(pruned.get())
      self.assertAllClose(pruned_output, exp_output)
      keep_indices_out = sess.run(keep_indices)
      self.assertAllEqual(keep_indices_out, [0, 1, 2, 3, 5])
      extra_data_out = sess.run(pruned.get_field('extra_data'))
      self.assertAllEqual(extra_data_out, [[1], [2], [3], [4], [6]]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:26,代码来源:box_list_ops_test.py

示例2: test_prune_completely_outside_window_with_empty_boxlist

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import prune_completely_outside_window [as 别名]
def test_prune_completely_outside_window_with_empty_boxlist(self):
    window = tf.constant([0, 0, 9, 14], tf.float32)
    corners = tf.zeros(shape=[0, 4], dtype=tf.float32)
    boxes = box_list.BoxList(corners)
    boxes.add_field('extra_data', tf.zeros(shape=[0], dtype=tf.int32))
    pruned, keep_indices = box_list_ops.prune_completely_outside_window(boxes,
                                                                        window)
    pruned_boxes = pruned.get()
    extra = pruned.get_field('extra_data')

    exp_pruned_boxes = np.zeros(shape=[0, 4], dtype=np.float32)
    exp_extra = np.zeros(shape=[0], dtype=np.int32)
    with self.test_session() as sess:
      pruned_boxes_out, keep_indices_out, extra_out = sess.run(
          [pruned_boxes, keep_indices, extra])
      self.assertAllClose(exp_pruned_boxes, pruned_boxes_out)
      self.assertAllEqual([], keep_indices_out)
      self.assertAllEqual(exp_extra, extra_out) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:20,代码来源:box_list_ops_test.py


注:本文中的object_detection.core.box_list_ops.prune_completely_outside_window方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。