當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。