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


Python anchor_generator_pb2.AnchorGenerator方法代码示例

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


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

示例1: test_build_grid_anchor_generator_with_defaults

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_grid_anchor_generator_with_defaults(self):
    anchor_generator_text_proto = """
      grid_anchor_generator {
      }
     """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               grid_anchor_generator.GridAnchorGenerator))
    self.assertListEqual(anchor_generator_object._scales, [])
    self.assertListEqual(anchor_generator_object._aspect_ratios, [])
    with self.test_session() as sess:
      base_anchor_size, anchor_offset, anchor_stride = sess.run(
          [anchor_generator_object._base_anchor_size,
           anchor_generator_object._anchor_offset,
           anchor_generator_object._anchor_stride])
    self.assertAllEqual(anchor_offset, [0, 0])
    self.assertAllEqual(anchor_stride, [16, 16])
    self.assertAllEqual(base_anchor_size, [256, 256]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:23,代码来源:anchor_generator_builder_test.py

示例2: test_build_ssd_anchor_generator_with_custom_scales

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_ssd_anchor_generator_with_custom_scales(self):
    anchor_generator_text_proto = """
      ssd_anchor_generator {
        aspect_ratios: [1.0]
        scales: [0.1, 0.15, 0.2, 0.4, 0.6, 0.8]
        reduce_boxes_in_lowest_layer: false
      }
    """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               multiple_grid_anchor_generator.
                               MultipleGridAnchorGenerator))
    for actual_scales, expected_scales in zip(
        list(anchor_generator_object._scales),
        [(0.1, math.sqrt(0.1 * 0.15)),
         (0.15, math.sqrt(0.15 * 0.2)),
         (0.2, math.sqrt(0.2 * 0.4)),
         (0.4, math.sqrt(0.4 * 0.6)),
         (0.6, math.sqrt(0.6 * 0.8)),
         (0.8, math.sqrt(0.8 * 1.0))]):
      self.assert_almost_list_equal(expected_scales, actual_scales, delta=1e-2) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:26,代码来源:anchor_generator_builder_test.py

示例3: test_build_ssd_anchor_generator_with_custom_interpolated_scale

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_ssd_anchor_generator_with_custom_interpolated_scale(self):
    anchor_generator_text_proto = """
      ssd_anchor_generator {
        aspect_ratios: [0.5]
        interpolated_scale_aspect_ratio: 0.5
        reduce_boxes_in_lowest_layer: false
      }
    """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               multiple_grid_anchor_generator.
                               MultipleGridAnchorGenerator))
    for actual_aspect_ratio, expected_aspect_ratio in zip(
        list(anchor_generator_object._aspect_ratios),
        6 * [(0.5, 0.5)]):
      self.assert_almost_list_equal(expected_aspect_ratio, actual_aspect_ratio) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:21,代码来源:anchor_generator_builder_test.py

示例4: test_build_multiscale_anchor_generator_custom_aspect_ratios

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_multiscale_anchor_generator_custom_aspect_ratios(self):
    anchor_generator_text_proto = """
      multiscale_anchor_generator {
        aspect_ratios: [1.0]
      }
    """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               multiscale_grid_anchor_generator.
                               MultiscaleGridAnchorGenerator))
    for level, anchor_grid_info in zip(
        range(3, 8), anchor_generator_object._anchor_grid_info):
      self.assertEqual(set(anchor_grid_info.keys()), set(['level', 'info']))
      self.assertTrue(level, anchor_grid_info['level'])
      self.assertEqual(len(anchor_grid_info['info']), 4)
      self.assertAllClose(anchor_grid_info['info'][0], [2**0, 2**0.5])
      self.assertTrue(anchor_grid_info['info'][1], 1.0)
      self.assertAllClose(anchor_grid_info['info'][2],
                          [4.0 * 2**level, 4.0 * 2**level])
      self.assertAllClose(anchor_grid_info['info'][3], [2**level, 2**level])
      self.assertTrue(anchor_generator_object._normalize_coordinates) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:26,代码来源:anchor_generator_builder_test.py

示例5: test_build_multiscale_anchor_generator_with_anchors_in_pixel_coordinates

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_multiscale_anchor_generator_with_anchors_in_pixel_coordinates(
      self):
    anchor_generator_text_proto = """
      multiscale_anchor_generator {
        aspect_ratios: [1.0]
        normalize_coordinates: false
      }
    """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               multiscale_grid_anchor_generator.
                               MultiscaleGridAnchorGenerator))
    self.assertFalse(anchor_generator_object._normalize_coordinates) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:18,代码来源:anchor_generator_builder_test.py

示例6: test_build_multiscale_anchor_generator_custom_aspect_ratios

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_multiscale_anchor_generator_custom_aspect_ratios(self):
    anchor_generator_text_proto = """
      multiscale_anchor_generator {
        aspect_ratios: [1.0]
      }
    """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               multiscale_grid_anchor_generator.
                               MultiscaleGridAnchorGenerator))
    print anchor_generator_object._anchor_grid_info
    for level, anchor_grid_info in zip(
        range(3, 8), anchor_generator_object._anchor_grid_info):
      self.assertEqual(set(anchor_grid_info.keys()), set(['level', 'info']))
      self.assertTrue(level, anchor_grid_info['level'])
      self.assertEqual(len(anchor_grid_info['info']), 4)
      self.assertAllClose(anchor_grid_info['info'][0], [2**0, 2**0.5])
      self.assertTrue(anchor_grid_info['info'][1], 1.0)
      self.assertAllClose(anchor_grid_info['info'][2],
                          [4.0 * 2**level, 4.0 * 2**level])
      self.assertAllClose(anchor_grid_info['info'][3], [2**level, 2**level]) 
开发者ID:ShreyAmbesh,项目名称:Traffic-Rule-Violation-Detection-System,代码行数:26,代码来源:anchor_generator_builder_test.py

示例7: test_build_grid_anchor_generator_with_non_default_parameters

# 需要导入模块: from object_detection.protos import anchor_generator_pb2 [as 别名]
# 或者: from object_detection.protos.anchor_generator_pb2 import AnchorGenerator [as 别名]
def test_build_grid_anchor_generator_with_non_default_parameters(self):
    anchor_generator_text_proto = """
      grid_anchor_generator {
        height: 128
        width: 512
        height_stride: 10
        width_stride: 20
        height_offset: 30
        width_offset: 40
        scales: [0.4, 2.2]
        aspect_ratios: [0.3, 4.5]
      }
     """
    anchor_generator_proto = anchor_generator_pb2.AnchorGenerator()
    text_format.Merge(anchor_generator_text_proto, anchor_generator_proto)
    anchor_generator_object = anchor_generator_builder.build(
        anchor_generator_proto)
    self.assertTrue(isinstance(anchor_generator_object,
                               grid_anchor_generator.GridAnchorGenerator))
    self.assert_almost_list_equal(anchor_generator_object._scales,
                                  [0.4, 2.2])
    self.assert_almost_list_equal(anchor_generator_object._aspect_ratios,
                                  [0.3, 4.5])
    with self.test_session() as sess:
      base_anchor_size, anchor_offset, anchor_stride = sess.run(
          [anchor_generator_object._base_anchor_size,
           anchor_generator_object._anchor_offset,
           anchor_generator_object._anchor_stride])
    self.assertAllEqual(anchor_offset, [30, 40])
    self.assertAllEqual(anchor_stride, [10, 20])
    self.assertAllEqual(base_anchor_size, [128, 512]) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:33,代码来源:anchor_generator_builder_test.py


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