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


Python bipartite_matcher.GreedyBipartiteMatcher方法代码示例

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


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

示例1: test_raises_error_on_invalid_groundtruth_labels

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_raises_error_on_invalid_groundtruth_labels(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder()
    unmatched_cls_target = tf.constant([[0, 0], [0, 0], [0, 0]], tf.float32)
    target_assigner = targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        unmatched_cls_target=unmatched_cls_target)

    prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5]])
    prior_stddevs = tf.constant([[1.0, 1.0, 1.0, 1.0]])
    priors = box_list.BoxList(prior_means)
    priors.add_field('stddev', prior_stddevs)

    box_corners = [[0.0, 0.0, 0.5, 0.5],
                   [0.5, 0.5, 0.9, 0.9],
                   [.75, 0, .95, .27]]
    boxes = box_list.BoxList(tf.constant(box_corners))

    groundtruth_labels = tf.constant([[[0, 1], [1, 0]]], tf.float32)

    with self.assertRaises(ValueError):
      target_assigner.assign(priors, boxes, groundtruth_labels,
                             num_valid_rows=3) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:26,代码来源:target_assigner_test.py

示例2: test_raises_error_on_invalid_groundtruth_labels

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_raises_error_on_invalid_groundtruth_labels(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder(stddev=1.0)
    unmatched_class_label = tf.constant([[0, 0], [0, 0], [0, 0]], tf.float32)
    target_assigner = targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder)

    prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5]])
    priors = box_list.BoxList(prior_means)

    box_corners = [[0.0, 0.0, 0.5, 0.5],
                   [0.5, 0.5, 0.9, 0.9],
                   [.75, 0, .95, .27]]
    boxes = box_list.BoxList(tf.constant(box_corners))
    groundtruth_labels = tf.constant([[[0, 1], [1, 0]]], tf.float32)

    with self.assertRaises(ValueError):
      target_assigner.assign(
          priors,
          boxes,
          groundtruth_labels,
          unmatched_class_label=unmatched_class_label) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:25,代码来源:target_assigner_test.py

示例3: test_raises_error_on_invalid_groundtruth_labels

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_raises_error_on_invalid_groundtruth_labels(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder()
    unmatched_cls_target = tf.constant([[0, 0], [0, 0], [0, 0]], tf.float32)
    target_assigner = targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        unmatched_cls_target=unmatched_cls_target)

    prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5]])
    prior_stddevs = tf.constant([[1.0, 1.0, 1.0, 1.0]])
    priors = box_list.BoxList(prior_means)
    priors.add_field('stddev', prior_stddevs)

    box_corners = [[0.0, 0.0, 0.5, 0.5],
                   [0.5, 0.5, 0.9, 0.9],
                   [.75, 0, .95, .27]]
    boxes = box_list.BoxList(tf.constant(box_corners))
    groundtruth_labels = tf.constant([[[0, 1], [1, 0]]], tf.float32)

    with self.assertRaises(ValueError):
      target_assigner.assign(priors, boxes, groundtruth_labels,
                             num_valid_rows=3) 
开发者ID:cagbal,项目名称:ros_people_object_detection_tensorflow,代码行数:25,代码来源:target_assigner_test.py

示例4: test_raises_error_on_invalid_groundtruth_labels

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_raises_error_on_invalid_groundtruth_labels(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder(stddev=1.0)
    unmatched_cls_target = tf.constant([[0, 0], [0, 0], [0, 0]], tf.float32)
    target_assigner = targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        unmatched_cls_target=unmatched_cls_target)

    prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5]])
    priors = box_list.BoxList(prior_means)

    box_corners = [[0.0, 0.0, 0.5, 0.5],
                   [0.5, 0.5, 0.9, 0.9],
                   [.75, 0, .95, .27]]
    boxes = box_list.BoxList(tf.constant(box_corners))
    groundtruth_labels = tf.constant([[[0, 1], [1, 0]]], tf.float32)

    with self.assertRaises(ValueError):
      target_assigner.assign(priors, boxes, groundtruth_labels,
                             num_valid_rows=3) 
开发者ID:ambakick,项目名称:Person-Detection-and-Tracking,代码行数:23,代码来源:target_assigner_test.py

示例5: test_get_expected_matches_when_all_rows_are_valid

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_expected_matches_when_all_rows_are_valid(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    num_valid_rows = 2
    expected_match_results = [-1, 1, 0]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:bipartite_matcher_test.py

示例6: test_get_expected_matches_with_valid_rows_set_to_minus_one

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_expected_matches_with_valid_rows_set_to_minus_one(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    num_valid_rows = -1
    expected_match_results = [-1, 1, 0]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:bipartite_matcher_test.py

示例7: test_get_no_matches_with_zero_valid_rows

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_no_matches_with_zero_valid_rows(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    num_valid_rows = 0
    expected_match_results = [-1, -1, -1]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:bipartite_matcher_test.py

示例8: test_get_expected_matches_with_only_one_valid_row

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_expected_matches_with_only_one_valid_row(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    num_valid_rows = 1
    expected_match_results = [-1, -1, 0]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix, num_valid_rows=num_valid_rows)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:bipartite_matcher_test.py

示例9: test_assign_multiclass_unequal_class_weights

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_assign_multiclass_unequal_class_weights(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder()
    unmatched_cls_target = tf.constant([1, 0, 0, 0, 0, 0, 0], tf.float32)
    target_assigner = targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        positive_class_weight=1.0, negative_class_weight=0.5,
        unmatched_cls_target=unmatched_cls_target)

    prior_means = tf.constant([[0.0, 0.0, 0.5, 0.5],
                               [0.5, 0.5, 1.0, 0.8],
                               [0, 0.5, .5, 1.0],
                               [.75, 0, 1.0, .25]])
    prior_stddevs = tf.constant(4 * [4 * [.1]])
    priors = box_list.BoxList(prior_means)
    priors.add_field('stddev', prior_stddevs)

    box_corners = [[0.0, 0.0, 0.5, 0.5],
                   [0.5, 0.5, 0.9, 0.9],
                   [.75, 0, .95, .27]]
    boxes = box_list.BoxList(tf.constant(box_corners))

    groundtruth_labels = tf.constant([[0, 1, 0, 0, 0, 0, 0],
                                      [0, 0, 0, 0, 0, 1, 0],
                                      [0, 0, 0, 1, 0, 0, 0]], tf.float32)

    exp_cls_weights = [1, 1, .5, 1]
    result = target_assigner.assign(priors, boxes, groundtruth_labels,
                                    num_valid_rows=3)
    (_, cls_weights, _, _, _) = result
    with self.test_session() as sess:
      cls_weights_out = sess.run(cls_weights)
      self.assertAllClose(cls_weights_out, exp_cls_weights) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:36,代码来源:target_assigner_test.py

示例10: _get_agnostic_target_assigner

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def _get_agnostic_target_assigner(self):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder()
    return targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        positive_class_weight=1.0,
        negative_class_weight=1.0,
        unmatched_cls_target=None) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:11,代码来源:target_assigner_test.py

示例11: _get_multi_dimensional_target_assigner

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def _get_multi_dimensional_target_assigner(self, target_dimensions):
    similarity_calc = region_similarity_calculator.NegSqDistSimilarity()
    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    box_coder = mean_stddev_box_coder.MeanStddevBoxCoder()
    unmatched_cls_target = tf.constant(np.zeros(target_dimensions),
                                       tf.float32)
    return targetassigner.TargetAssigner(
        similarity_calc, matcher, box_coder,
        positive_class_weight=1.0,
        negative_class_weight=1.0,
        unmatched_cls_target=unmatched_cls_target) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:13,代码来源:target_assigner_test.py

示例12: test_build_bipartite_matcher

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_build_bipartite_matcher(self):
    matcher_text_proto = """
      bipartite_matcher {
      }
    """
    matcher_proto = matcher_pb2.Matcher()
    text_format.Merge(matcher_text_proto, matcher_proto)
    matcher_object = matcher_builder.build(matcher_proto)
    self.assertTrue(
        isinstance(matcher_object, bipartite_matcher.GreedyBipartiteMatcher)) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:matcher_builder_test.py

示例13: build

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def build(matcher_config):
  """Builds a matcher object based on the matcher config.

  Args:
    matcher_config: A matcher.proto object containing the config for the desired
      Matcher.

  Returns:
    Matcher based on the config.

  Raises:
    ValueError: On empty matcher proto.
  """
  if not isinstance(matcher_config, matcher_pb2.Matcher):
    raise ValueError('matcher_config not of type matcher_pb2.Matcher.')
  if matcher_config.WhichOneof('matcher_oneof') == 'argmax_matcher':
    matcher = matcher_config.argmax_matcher
    matched_threshold = unmatched_threshold = None
    if not matcher.ignore_thresholds:
      matched_threshold = matcher.matched_threshold
      unmatched_threshold = matcher.unmatched_threshold
    return argmax_matcher.ArgMaxMatcher(
        matched_threshold=matched_threshold,
        unmatched_threshold=unmatched_threshold,
        negatives_lower_than_unmatched=matcher.negatives_lower_than_unmatched,
        force_match_for_each_row=matcher.force_match_for_each_row)
  if matcher_config.WhichOneof('matcher_oneof') == 'bipartite_matcher':
    return bipartite_matcher.GreedyBipartiteMatcher()
  raise ValueError('Empty matcher.') 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:31,代码来源:matcher_builder.py

示例14: test_get_expected_matches_when_all_rows_are_valid

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_expected_matches_when_all_rows_are_valid(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    valid_rows = tf.ones([2], dtype=tf.bool)
    expected_match_results = [-1, 1, 0]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix, valid_rows=valid_rows)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:12,代码来源:bipartite_matcher_test.py

示例15: test_get_expected_matches_with_all_rows_be_default

# 需要导入模块: from object_detection.matchers import bipartite_matcher [as 别名]
# 或者: from object_detection.matchers.bipartite_matcher import GreedyBipartiteMatcher [as 别名]
def test_get_expected_matches_with_all_rows_be_default(self):
    similarity_matrix = tf.constant([[0.50, 0.1, 0.8], [0.15, 0.2, 0.3]])
    expected_match_results = [-1, 1, 0]

    matcher = bipartite_matcher.GreedyBipartiteMatcher()
    match = matcher.match(similarity_matrix)
    with self.test_session() as sess:
      match_results_out = sess.run(match._match_results)
      self.assertAllEqual(match_results_out, expected_match_results) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:11,代码来源:bipartite_matcher_test.py


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