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


Python preprocessor.scale_boxes_to_pixel_coordinates方法代码示例

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


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

示例1: testScaleBoxesToPixelCoordinates

# 需要导入模块: from object_detection.core import preprocessor [as 别名]
# 或者: from object_detection.core.preprocessor import scale_boxes_to_pixel_coordinates [as 别名]
def testScaleBoxesToPixelCoordinates(self):
    """Tests box scaling, checking scaled values."""
    in_shape = [60, 40, 3]
    in_boxes = [[0.1, 0.2, 0.4, 0.6],
                [0.5, 0.3, 0.9, 0.7]]

    expected_boxes = [[6., 8., 24., 24.],
                      [30., 12., 54., 28.]]

    in_image = tf.random_uniform(in_shape)
    in_boxes = tf.constant(in_boxes)
    _, out_boxes = preprocessor.scale_boxes_to_pixel_coordinates(
        in_image, boxes=in_boxes)
    with self.test_session() as sess:
      out_boxes = sess.run(out_boxes)
      self.assertAllClose(out_boxes, expected_boxes) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:18,代码来源:preprocessor_test.py

示例2: testScaleBoxesToPixelCoordinatesWithKeypoints

# 需要导入模块: from object_detection.core import preprocessor [as 别名]
# 或者: from object_detection.core.preprocessor import scale_boxes_to_pixel_coordinates [as 别名]
def testScaleBoxesToPixelCoordinatesWithKeypoints(self):
    """Tests box and keypoint scaling, checking scaled values."""
    in_shape = [60, 40, 3]
    in_boxes = self.createTestBoxes()
    in_keypoints = self.createTestKeypoints()

    expected_boxes = [[0., 10., 45., 40.],
                      [15., 20., 45., 40.]]
    expected_keypoints = [
        [[6., 4.], [12., 8.], [18., 12.]],
        [[24., 16.], [30., 20.], [36., 24.]],
    ]

    in_image = tf.random_uniform(in_shape)
    _, out_boxes, out_keypoints = preprocessor.scale_boxes_to_pixel_coordinates(
        in_image, boxes=in_boxes, keypoints=in_keypoints)
    with self.test_session() as sess:
      out_boxes_, out_keypoints_ = sess.run([out_boxes, out_keypoints])
      self.assertAllClose(out_boxes_, expected_boxes)
      self.assertAllClose(out_keypoints_, expected_keypoints) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:22,代码来源:preprocessor_test.py


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