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


Python box_list_ops.area方法代码示例

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


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

示例1: test_sort_by_field_invalid_inputs

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import area [as 别名]
def test_sort_by_field_invalid_inputs(self):
    corners = tf.constant([4 * [0.0], 4 * [0.5], 4 * [1.0], 4 * [2.0], 4 *
                           [3.0], 4 * [4.0]])
    misc = tf.constant([[.95, .9], [.5, .3]], tf.float32)
    weights = tf.constant([.1, .2], tf.float32)
    boxes = box_list.BoxList(corners)
    boxes.add_field('misc', misc)
    boxes.add_field('weights', weights)

    with self.test_session() as sess:
      with self.assertRaises(ValueError):
        box_list_ops.sort_by_field(boxes, 'area')

      with self.assertRaises(ValueError):
        box_list_ops.sort_by_field(boxes, 'misc')

      with self.assertRaisesWithPredicateMatch(errors.InvalidArgumentError,
                                               'Incorrect field size'):
        sess.run(box_list_ops.sort_by_field(boxes, 'weights').get()) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:21,代码来源:box_list_ops_test.py

示例2: test_sort_by_field_invalid_inputs

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import area [as 别名]
def test_sort_by_field_invalid_inputs(self):
    corners = tf.constant([4 * [0.0], 4 * [0.5], 4 * [1.0], 4 * [2.0], 4 *
                           [3.0], 4 * [4.0]])
    misc = tf.constant([[.95, .9], [.5, .3]], tf.float32)
    weights = tf.constant([.1, .2], tf.float32)
    boxes = box_list.BoxList(corners)
    boxes.add_field('misc', misc)
    boxes.add_field('weights', weights)

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'area')

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'misc')

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'weights') 
开发者ID:ahmetozlu,项目名称:vehicle_counting_tensorflow,代码行数:19,代码来源:box_list_ops_test.py

示例3: test_sort_by_field_invalid_inputs

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import area [as 别名]
def test_sort_by_field_invalid_inputs(self):
    corners = tf.constant([4 * [0.0], 4 * [0.5], 4 * [1.0], 4 * [2.0], 4 *
                           [3.0], 4 * [4.0]])
    misc = tf.constant([[.95, .9], [.5, .3]], tf.float32)
    weights = tf.constant([.1, .2], tf.float32)
    boxes = box_list.BoxList(corners)
    boxes.add_field('misc', misc)
    boxes.add_field('weights', weights)

    with self.test_session() as sess:
      with self.assertRaises(ValueError):
        box_list_ops.sort_by_field(boxes, 'area')

      with self.assertRaises(ValueError):
        box_list_ops.sort_by_field(boxes, 'misc')

      if ops._USE_C_API:
        with self.assertRaises(ValueError):
          box_list_ops.sort_by_field(boxes, 'weights')
      else:
        with self.assertRaisesWithPredicateMatch(errors.InvalidArgumentError,
                                                 'Incorrect field size'):
          sess.run(box_list_ops.sort_by_field(boxes, 'weights').get()) 
开发者ID:ambakick,项目名称:Person-Detection-and-Tracking,代码行数:25,代码来源:box_list_ops_test.py

示例4: test_sort_by_field_invalid_inputs

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import area [as 别名]
def test_sort_by_field_invalid_inputs(self):
    corners = tf.constant([4 * [0.0], 4 * [0.5], 4 * [1.0], 4 * [2.0], 4 *
                           [3.0], 4 * [4.0]])
    misc = tf.constant([[.95, .9], [.5, .3]], tf.float32)
    weights = tf.constant([[.1, .2]], tf.float32)
    boxes = box_list.BoxList(corners)
    boxes.add_field('misc', misc)
    boxes.add_field('weights', weights)

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'area')

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'misc')

    with self.assertRaises(ValueError):
      box_list_ops.sort_by_field(boxes, 'weights') 
开发者ID:tensorflow,项目名称:models,代码行数:19,代码来源:box_list_ops_test.py

示例5: assign_boxes_to_layers

# 需要导入模块: from object_detection.core import box_list_ops [as 别名]
# 或者: from object_detection.core.box_list_ops import area [as 别名]
def assign_boxes_to_layers(self, absolute_boxes):
    """Assigns boxes to feature pyramid layers.

    Args:
      absolute_boxes: A float32 tensor with shape [batch_size,
        num_proposals, box_code_size] containing boxes in
        absolute coordinates.

    Returns:
      layer_indices: A int32 tensor of shape [N],
        ranging from lowest resolution (0) to highest (num_resolutions - 1)
    """
    def log2(x):
      numerator = tf.log(x)
      denominator = tf.log(tf.constant(2, dtype=numerator.dtype))
      return numerator / denominator

    min_scale = self._base_anchor_size[0] * min(self._pyramid_scales)
    box_scales = tf.sqrt(box_list_ops.area(box_list.BoxList(absolute_boxes)))

    max_k = len(self._pyramid_scales) - 1
    k = tf.round(log2(box_scales / min_scale))
    k = tf.minimum(tf.maximum(k, 0), max_k)

    return max_k - tf.to_int32(k) 
开发者ID:simonmeister,项目名称:motion-rcnn,代码行数:27,代码来源:multiple_grid_anchor_generator.py


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