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


Python box_list_ops.box_voting方法代码示例

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


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

示例1: test_box_voting

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import box_voting [as 别名]
def test_box_voting(self):
    candidates = box_list.BoxList(
        tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32))
    candidates.add_field('ExtraField', tf.constant([1, 2]))
    pool = box_list.BoxList(
        tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5],
                     [0.6, 0.6, 0.8, 0.8]], tf.float32))
    pool.add_field('scores', tf.constant([0.75, 0.25, 0.3]))
    averaged_boxes = box_list_ops.box_voting(candidates, pool)
    expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]]
    expected_scores = [0.5, 0.3]
    with self.test_session() as sess:
      boxes_out, scores_out, extra_field_out = sess.run(
          [averaged_boxes.get(), averaged_boxes.get_field('scores'),
           averaged_boxes.get_field('ExtraField')])

      self.assertAllClose(expected_boxes, boxes_out)
      self.assertAllClose(expected_scores, scores_out)
      self.assertAllEqual(extra_field_out, [1, 2]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:21,代码来源:box_list_ops_test.py

示例2: test_box_voting

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import box_voting [as 别名]
def test_box_voting(self):
    def graph_fn():
      candidates = box_list.BoxList(
          tf.constant([[0.1, 0.1, 0.4, 0.4], [0.6, 0.6, 0.8, 0.8]], tf.float32))
      candidates.add_field('ExtraField', tf.constant([1, 2]))
      pool = box_list.BoxList(
          tf.constant([[0.1, 0.1, 0.4, 0.4], [0.1, 0.1, 0.5, 0.5],
                       [0.6, 0.6, 0.8, 0.8]], tf.float32))
      pool.add_field('scores', tf.constant([0.75, 0.25, 0.3]))
      averaged_boxes = box_list_ops.box_voting(candidates, pool)
      return (averaged_boxes.get(), averaged_boxes.get_field('scores'),
              averaged_boxes.get_field('ExtraField'))

    expected_boxes = [[0.1, 0.1, 0.425, 0.425], [0.6, 0.6, 0.8, 0.8]]
    expected_scores = [0.5, 0.3]
    boxes_out, scores_out, extra_field_out = self.execute(graph_fn, [])
    self.assertAllClose(expected_boxes, boxes_out)
    self.assertAllClose(expected_scores, scores_out)
    self.assertAllEqual(extra_field_out, [1, 2]) 
开发者ID:tensorflow,项目名称:models,代码行数:21,代码来源:box_list_ops_test.py

示例3: test_box_voting_fails_with_negative_scores

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import box_voting [as 别名]
def test_box_voting_fails_with_negative_scores(self):
    candidates = box_list.BoxList(
        tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32))
    pool = box_list.BoxList(tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32))
    pool.add_field('scores', tf.constant([-0.2]))
    averaged_boxes = box_list_ops.box_voting(candidates, pool)

    with self.test_session() as sess:
      with self.assertRaisesOpError('Scores must be non negative'):
        sess.run([averaged_boxes.get()]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:box_list_ops_test.py

示例4: test_box_voting_fails_when_unmatched

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import box_voting [as 别名]
def test_box_voting_fails_when_unmatched(self):
    candidates = box_list.BoxList(
        tf.constant([[0.1, 0.1, 0.4, 0.4]], tf.float32))
    pool = box_list.BoxList(tf.constant([[0.6, 0.6, 0.8, 0.8]], tf.float32))
    pool.add_field('scores', tf.constant([0.2]))
    averaged_boxes = box_list_ops.box_voting(candidates, pool)

    with self.test_session() as sess:
      with self.assertRaisesOpError('Each box in selected_boxes must match '
                                    'with at least one box in pool_boxes.'):
        sess.run([averaged_boxes.get()]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:13,代码来源:box_list_ops_test.py


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