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


Python grid_anchor_generator.GridAnchorGenerator方法代码示例

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


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

示例1: test_construct_single_anchor

# 需要导入模块: from object_detection.anchor_generators import grid_anchor_generator [as 别名]
# 或者: from object_detection.anchor_generators.grid_anchor_generator import GridAnchorGenerator [as 别名]
def test_construct_single_anchor(self):
    """Builds a 1x1 anchor grid to test the size of the output boxes."""
    scales = [0.5, 1.0, 2.0]
    aspect_ratios = [0.25, 1.0, 4.0]
    anchor_offset = [7, -3]
    exp_anchor_corners = [[-121, -35, 135, 29], [-249, -67, 263, 61],
                          [-505, -131, 519, 125], [-57, -67, 71, 61],
                          [-121, -131, 135, 125], [-249, -259, 263, 253],
                          [-25, -131, 39, 125], [-57, -259, 71, 253],
                          [-121, -515, 135, 509]]

    anchor_generator = grid_anchor_generator.GridAnchorGenerator(
        scales, aspect_ratios,
        anchor_offset=anchor_offset)
    anchors = anchor_generator.generate(feature_map_shape_list=[(1, 1)])
    anchor_corners = anchors.get()

    with self.test_session():
      anchor_corners_out = anchor_corners.eval()
      self.assertAllClose(anchor_corners_out, exp_anchor_corners) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:22,代码来源:grid_anchor_generator_test.py

示例2: test_build_grid_anchor_generator_with_defaults

# 需要导入模块: from object_detection.anchor_generators import grid_anchor_generator [as 别名]
# 或者: from object_detection.anchor_generators.grid_anchor_generator import GridAnchorGenerator [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

示例3: test_construct_single_anchor

# 需要导入模块: from object_detection.anchor_generators import grid_anchor_generator [as 别名]
# 或者: from object_detection.anchor_generators.grid_anchor_generator import GridAnchorGenerator [as 别名]
def test_construct_single_anchor(self):
    """Builds a 1x1 anchor grid to test the size of the output boxes."""
    def graph_fn():
      scales = [0.5, 1.0, 2.0]
      aspect_ratios = [0.25, 1.0, 4.0]
      anchor_offset = [7, -3]
      anchor_generator = grid_anchor_generator.GridAnchorGenerator(
          scales, aspect_ratios, anchor_offset=anchor_offset)
      anchors_list = anchor_generator.generate(feature_map_shape_list=[(1, 1)])
      anchor_corners = anchors_list[0].get()
      return (anchor_corners,)
    exp_anchor_corners = [[-121, -35, 135, 29], [-249, -67, 263, 61],
                          [-505, -131, 519, 125], [-57, -67, 71, 61],
                          [-121, -131, 135, 125], [-249, -259, 263, 253],
                          [-25, -131, 39, 125], [-57, -259, 71, 253],
                          [-121, -515, 135, 509]]
    anchor_corners_out = self.execute(graph_fn, [])
    self.assertAllClose(anchor_corners_out, exp_anchor_corners) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:20,代码来源:grid_anchor_generator_test.py

示例4: test_construct_single_anchor

# 需要导入模块: from object_detection.anchor_generators import grid_anchor_generator [as 别名]
# 或者: from object_detection.anchor_generators.grid_anchor_generator import GridAnchorGenerator [as 别名]
def test_construct_single_anchor(self):
    """Builds a 1x1 anchor grid to test the size of the output boxes."""
    def graph_fn():
      scales = [0.5, 1.0, 2.0]
      aspect_ratios = [0.25, 1.0, 4.0]
      anchor_offset = [7, -3]
      anchor_generator = grid_anchor_generator.GridAnchorGenerator(
          scales, aspect_ratios, anchor_offset=anchor_offset)
      anchors = anchor_generator.generate(feature_map_shape_list=[(1, 1)])
      anchor_corners = anchors.get()
      return (anchor_corners,)
    exp_anchor_corners = [[-121, -35, 135, 29], [-249, -67, 263, 61],
                          [-505, -131, 519, 125], [-57, -67, 71, 61],
                          [-121, -131, 135, 125], [-249, -259, 263, 253],
                          [-25, -131, 39, 125], [-57, -259, 71, 253],
                          [-121, -515, 135, 509]]
    anchor_corners_out = self.execute(graph_fn, [])
    self.assertAllClose(anchor_corners_out, exp_anchor_corners) 
开发者ID:ShreyAmbesh,项目名称:Traffic-Rule-Violation-Detection-System,代码行数:20,代码来源:grid_anchor_generator_test.py


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