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


Python post_processing.multiclass_non_max_suppression方法代码示例

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


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

示例1: test_with_invalid_scores_size

# 需要导入模块: from object_detection.core import post_processing [as 别名]
# 或者: from object_detection.core.post_processing import multiclass_non_max_suppression [as 别名]
def test_with_invalid_scores_size(self):
    boxes = tf.constant([[[0, 0, 1, 1]],
                         [[0, 0.1, 1, 1.1]],
                         [[0, -0.1, 1, 0.9]],
                         [[0, 10, 1, 11]],
                         [[0, 10.1, 1, 11.1]],
                         [[0, 100, 1, 101]]], tf.float32)
    scores = tf.constant([[.9], [.75], [.6], [.95], [.5]])
    iou_thresh = .5
    score_thresh = 0.6
    max_output_size = 3
    nms = post_processing.multiclass_non_max_suppression(
        boxes, scores, score_thresh, iou_thresh, max_output_size)
    with self.test_session() as sess:
      with self.assertRaisesWithPredicateMatch(
          tf.errors.InvalidArgumentError, 'Incorrect scores field length'):
        sess.run(nms.get()) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:19,代码来源:post_processing_test.py

示例2: test_multiclass_nms_select_with_clip_window

# 需要导入模块: from object_detection.core import post_processing [as 别名]
# 或者: from object_detection.core.post_processing import multiclass_non_max_suppression [as 别名]
def test_multiclass_nms_select_with_clip_window(self):
    boxes = tf.constant([[[0, 0, 10, 10]],
                         [[1, 1, 11, 11]]], tf.float32)
    scores = tf.constant([[.9], [.75]])
    clip_window = tf.constant([5, 4, 8, 7], tf.float32)
    score_thresh = 0.0
    iou_thresh = 0.5
    max_output_size = 100

    exp_nms_corners = [[5, 4, 8, 7]]
    exp_nms_scores = [.9]
    exp_nms_classes = [0]

    nms = post_processing.multiclass_non_max_suppression(
        boxes, scores, score_thresh, iou_thresh, max_output_size,
        clip_window=clip_window)
    with self.test_session() as sess:
      nms_corners_output, nms_scores_output, nms_classes_output = sess.run(
          [nms.get(), nms.get_field(fields.BoxListFields.scores),
           nms.get_field(fields.BoxListFields.classes)])
      self.assertAllClose(nms_corners_output, exp_nms_corners)
      self.assertAllClose(nms_scores_output, exp_nms_scores)
      self.assertAllClose(nms_classes_output, exp_nms_classes) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:25,代码来源:post_processing_test.py

示例3: test_multiclass_nms_select_with_clip_window_change_coordinate_frame

# 需要导入模块: from object_detection.core import post_processing [as 别名]
# 或者: from object_detection.core.post_processing import multiclass_non_max_suppression [as 别名]
def test_multiclass_nms_select_with_clip_window_change_coordinate_frame(self):
    boxes = tf.constant([[[0, 0, 10, 10]],
                         [[1, 1, 11, 11]]], tf.float32)
    scores = tf.constant([[.9], [.75]])
    clip_window = tf.constant([5, 4, 8, 7], tf.float32)
    score_thresh = 0.0
    iou_thresh = 0.5
    max_output_size = 100

    exp_nms_corners = [[0, 0, 1, 1]]
    exp_nms_scores = [.9]
    exp_nms_classes = [0]

    nms = post_processing.multiclass_non_max_suppression(
        boxes, scores, score_thresh, iou_thresh, max_output_size,
        clip_window=clip_window, change_coordinate_frame=True)
    with self.test_session() as sess:
      nms_corners_output, nms_scores_output, nms_classes_output = sess.run(
          [nms.get(), nms.get_field(fields.BoxListFields.scores),
           nms.get_field(fields.BoxListFields.classes)])
      self.assertAllClose(nms_corners_output, exp_nms_corners)
      self.assertAllClose(nms_scores_output, exp_nms_scores)
      self.assertAllClose(nms_classes_output, exp_nms_classes) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:25,代码来源:post_processing_test.py

示例4: test_multiclass_nms_threshold_then_select_with_shared_boxes

# 需要导入模块: from object_detection.core import post_processing [as 别名]
# 或者: from object_detection.core.post_processing import multiclass_non_max_suppression [as 别名]
def test_multiclass_nms_threshold_then_select_with_shared_boxes(self):
    boxes = tf.constant([[[0, 0, 1, 1]],
                         [[0, 0.1, 1, 1.1]],
                         [[0, -0.1, 1, 0.9]],
                         [[0, 10, 1, 11]],
                         [[0, 10.1, 1, 11.1]],
                         [[0, 100, 1, 101]],
                         [[0, 1000, 1, 1002]],
                         [[0, 1000, 1, 1002.1]]], tf.float32)
    scores = tf.constant([[.9], [.75], [.6], [.95], [.5], [.3], [.01], [.01]])
    score_thresh = 0.1
    iou_thresh = .5
    max_output_size = 3

    exp_nms = [[0, 10, 1, 11],
               [0, 0, 1, 1],
               [0, 100, 1, 101]]
    nms = post_processing.multiclass_non_max_suppression(
        boxes, scores, score_thresh, iou_thresh, max_output_size)
    with self.test_session() as sess:
      nms_output = sess.run(nms.get())
      self.assertAllClose(nms_output, exp_nms) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:24,代码来源:post_processing_test.py

示例5: test_multiclass_nms_threshold_then_select_with_shared_boxes

# 需要导入模块: from object_detection.core import post_processing [as 别名]
# 或者: from object_detection.core.post_processing import multiclass_non_max_suppression [as 别名]
def test_multiclass_nms_threshold_then_select_with_shared_boxes(self):
    boxes = tf.constant([[[0, 0, 1, 1]],
                         [[0, 0.1, 1, 1.1]],
                         [[0, -0.1, 1, 0.9]],
                         [[0, 10, 1, 11]],
                         [[0, 10.1, 1, 11.1]],
                         [[0, 100, 1, 101]],
                         [[0, 1000, 1, 1002]],
                         [[0, 1000, 1, 1002.1]]], tf.float32)
    scores = tf.constant([[.9], [.75], [.6], [.95], [.5], [.3], [.01], [.01]])
    score_thresh = 0.1
    iou_thresh = .5
    max_output_size = 3

    exp_nms = [[0, 10, 1, 11],
               [0, 0, 1, 1],
               [0, 100, 1, 101]]
    nms, _ = post_processing.multiclass_non_max_suppression(
        boxes, scores, score_thresh, iou_thresh, max_output_size)
    with self.test_session() as sess:
      nms_output = sess.run(nms.get())
      self.assertAllClose(nms_output, exp_nms) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:24,代码来源:post_processing_test.py


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