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


Python ops.reframe_box_masks_to_image_masks方法代码示例

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


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

示例1: testZeroImageOnEmptyMask

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import reframe_box_masks_to_image_masks [as 别名]
def testZeroImageOnEmptyMask(self):
    box_masks = tf.constant([[[0, 0],
                              [0, 0]]], dtype=tf.float32)
    boxes = tf.constant([[0.0, 0.0, 1.0, 1.0]], dtype=tf.float32)
    image_masks = ops.reframe_box_masks_to_image_masks(box_masks, boxes,
                                                       image_height=4,
                                                       image_width=4)
    np_expected_image_masks = np.array([[[0, 0, 0, 0],
                                         [0, 0, 0, 0],
                                         [0, 0, 0, 0],
                                         [0, 0, 0, 0]]], dtype=np.float32)
    with self.test_session() as sess:
      np_image_masks = sess.run(image_masks)
      self.assertAllClose(np_image_masks, np_expected_image_masks) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:16,代码来源:ops_test.py

示例2: testMaskIsCenteredInImageWhenBoxIsCentered

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import reframe_box_masks_to_image_masks [as 别名]
def testMaskIsCenteredInImageWhenBoxIsCentered(self):
    box_masks = tf.constant([[[1, 1],
                              [1, 1]]], dtype=tf.float32)
    boxes = tf.constant([[0.25, 0.25, 0.75, 0.75]], dtype=tf.float32)
    image_masks = ops.reframe_box_masks_to_image_masks(box_masks, boxes,
                                                       image_height=4,
                                                       image_width=4)
    np_expected_image_masks = np.array([[[0, 0, 0, 0],
                                         [0, 1, 1, 0],
                                         [0, 1, 1, 0],
                                         [0, 0, 0, 0]]], dtype=np.float32)
    with self.test_session() as sess:
      np_image_masks = sess.run(image_masks)
      self.assertAllClose(np_image_masks, np_expected_image_masks) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:16,代码来源:ops_test.py

示例3: testMaskOffCenterRemainsOffCenterInImage

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import reframe_box_masks_to_image_masks [as 别名]
def testMaskOffCenterRemainsOffCenterInImage(self):
    box_masks = tf.constant([[[1, 0],
                              [0, 1]]], dtype=tf.float32)
    boxes = tf.constant([[0.25, 0.5, 0.75, 1.0]], dtype=tf.float32)
    image_masks = ops.reframe_box_masks_to_image_masks(box_masks, boxes,
                                                       image_height=4,
                                                       image_width=4)
    np_expected_image_masks = np.array([[[0, 0, 0, 0],
                                         [0, 0, 0.6111111, 0.16666669],
                                         [0, 0, 0.3888889, 0.83333337],
                                         [0, 0, 0, 0]]], dtype=np.float32)
    with self.test_session() as sess:
      np_image_masks = sess.run(image_masks)
      self.assertAllClose(np_image_masks, np_expected_image_masks) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:16,代码来源:ops_test.py

示例4: _resize_detection_masks

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import reframe_box_masks_to_image_masks [as 别名]
def _resize_detection_masks(args):
  detection_boxes, detection_masks, image_shape = args
  detection_masks_reframed = ops.reframe_box_masks_to_image_masks(
      detection_masks, detection_boxes, image_shape[0], image_shape[1])
  return tf.cast(tf.greater(detection_masks_reframed, 0.5), tf.uint8) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:7,代码来源:eval_util.py

示例5: testZeroBoxMasks

# 需要导入模块: from object_detection.utils import ops [as 别名]
# 或者: from object_detection.utils.ops import reframe_box_masks_to_image_masks [as 别名]
def testZeroBoxMasks(self):
    box_masks = tf.zeros([0, 3, 3], dtype=tf.float32)
    boxes = tf.zeros([0, 4], dtype=tf.float32)
    image_masks = ops.reframe_box_masks_to_image_masks(box_masks, boxes,
                                                       image_height=4,
                                                       image_width=4)
    with self.test_session() as sess:
      np_image_masks = sess.run(image_masks)
      self.assertAllEqual(np_image_masks.shape, np.array([0, 4, 4])) 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:11,代码来源:ops_test.py


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