本文整理汇总了Python中object_detection.protos.post_processing_pb2.PostProcessing方法的典型用法代码示例。如果您正苦于以下问题:Python post_processing_pb2.PostProcessing方法的具体用法?Python post_processing_pb2.PostProcessing怎么用?Python post_processing_pb2.PostProcessing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object_detection.protos.post_processing_pb2
的用法示例。
在下文中一共展示了post_processing_pb2.PostProcessing方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_build_non_max_suppressor_with_correct_parameters
# 需要导入模块: from object_detection.protos import post_processing_pb2 [as 别名]
# 或者: from object_detection.protos.post_processing_pb2 import PostProcessing [as 别名]
def test_build_non_max_suppressor_with_correct_parameters(self):
post_processing_text_proto = """
batch_non_max_suppression {
score_threshold: 0.7
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
"""
post_processing_config = post_processing_pb2.PostProcessing()
text_format.Merge(post_processing_text_proto, post_processing_config)
non_max_suppressor, _ = post_processing_builder.build(
post_processing_config)
self.assertEqual(non_max_suppressor.keywords['max_size_per_class'], 100)
self.assertEqual(non_max_suppressor.keywords['max_total_size'], 300)
self.assertAlmostEqual(non_max_suppressor.keywords['score_thresh'], 0.7)
self.assertAlmostEqual(non_max_suppressor.keywords['iou_thresh'], 0.6)
示例2: _build_score_converter
# 需要导入模块: from object_detection.protos import post_processing_pb2 [as 别名]
# 或者: from object_detection.protos.post_processing_pb2 import PostProcessing [as 别名]
def _build_score_converter(score_converter_config):
"""Builds score converter based on the config.
Builds one of [tf.identity, tf.sigmoid, tf.softmax] score converters based on
the config.
Args:
score_converter_config: post_processing_pb2.PostProcessing.score_converter.
Returns:
Callable score converter op.
Raises:
ValueError: On unknown score converter.
"""
if score_converter_config == post_processing_pb2.PostProcessing.IDENTITY:
return tf.identity
if score_converter_config == post_processing_pb2.PostProcessing.SIGMOID:
return tf.sigmoid
if score_converter_config == post_processing_pb2.PostProcessing.SOFTMAX:
return tf.nn.softmax
raise ValueError('Unknown score converter.')
示例3: test_build_identity_score_converter_with_logit_scale
# 需要导入模块: from object_detection.protos import post_processing_pb2 [as 别名]
# 或者: from object_detection.protos.post_processing_pb2 import PostProcessing [as 别名]
def test_build_identity_score_converter_with_logit_scale(self):
post_processing_text_proto = """
score_converter: IDENTITY
logit_scale: 2.0
"""
post_processing_config = post_processing_pb2.PostProcessing()
text_format.Merge(post_processing_text_proto, post_processing_config)
_, score_converter = post_processing_builder.build(post_processing_config)
self.assertEqual(score_converter.__name__, 'identity_with_logit_scale')
inputs = tf.constant([1, 1], tf.float32)
outputs = score_converter(inputs)
with self.test_session() as sess:
converted_scores = sess.run(outputs)
expected_converted_scores = sess.run(tf.constant([.5, .5], tf.float32))
self.assertAllClose(converted_scores, expected_converted_scores)
示例4: _build_score_converter
# 需要导入模块: from object_detection.protos import post_processing_pb2 [as 别名]
# 或者: from object_detection.protos.post_processing_pb2 import PostProcessing [as 别名]
def _build_score_converter(score_converter_config, logit_scale):
"""Builds score converter based on the config.
Builds one of [tf.identity, tf.sigmoid, tf.softmax] score converters based on
the config.
Args:
score_converter_config: post_processing_pb2.PostProcessing.score_converter.
logit_scale: temperature to use for SOFTMAX score_converter.
Returns:
Callable score converter op.
Raises:
ValueError: On unknown score converter.
"""
if score_converter_config == post_processing_pb2.PostProcessing.IDENTITY:
return _score_converter_fn_with_logit_scale(tf.identity, logit_scale)
if score_converter_config == post_processing_pb2.PostProcessing.SIGMOID:
return _score_converter_fn_with_logit_scale(tf.sigmoid, logit_scale)
if score_converter_config == post_processing_pb2.PostProcessing.SOFTMAX:
return _score_converter_fn_with_logit_scale(tf.nn.softmax, logit_scale)
raise ValueError('Unknown score converter.')
示例5: test_build_identity_score_converter
# 需要导入模块: from object_detection.protos import post_processing_pb2 [as 别名]
# 或者: from object_detection.protos.post_processing_pb2 import PostProcessing [as 别名]
def test_build_identity_score_converter(self):
post_processing_text_proto = """
score_converter: IDENTITY
"""
post_processing_config = post_processing_pb2.PostProcessing()
text_format.Merge(post_processing_text_proto, post_processing_config)
_, score_converter = post_processing_builder.build(post_processing_config)
self.assertEqual(score_converter, tf.identity)