本文整理汇总了Python中object_detection.utils.np_box_list_ops.scale方法的典型用法代码示例。如果您正苦于以下问题:Python np_box_list_ops.scale方法的具体用法?Python np_box_list_ops.scale怎么用?Python np_box_list_ops.scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object_detection.utils.np_box_list_ops
的用法示例。
在下文中一共展示了np_box_list_ops.scale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scale
# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import scale [as 别名]
def test_scale(self):
boxlist = np_box_list.BoxList(
np.array(
[[0.25, 0.25, 0.75, 0.75], [0.0, 0.0, 0.5, 0.75]], dtype=
np.float32))
boxlist_scaled = np_box_list_ops.scale(boxlist, 2.0, 3.0)
expected_boxlist_scaled = np_box_list.BoxList(
np.array(
[[0.5, 0.75, 1.5, 2.25], [0.0, 0.0, 1.0, 2.25]], dtype=np.float32))
self.assertAllClose(expected_boxlist_scaled.get(), boxlist_scaled.get())
示例2: _extract_groundtruth_tensors
# 需要导入模块: from object_detection.utils import np_box_list_ops [as 别名]
# 或者: from object_detection.utils.np_box_list_ops import scale [as 别名]
def _extract_groundtruth_tensors(create_input_dict_fn):
input_dict = create_input_dict_fn()
prefetch_queue = prefetcher.prefetch(input_dict, capacity=500)
input_dict = prefetch_queue.dequeue()
original_image = tf.expand_dims(input_dict[fields.InputDataFields.image], 0)
tensor_dict = {
'image_id': input_dict[fields.InputDataFields.source_id]
}
normalized_gt_boxlist = box_list.BoxList(
input_dict[fields.InputDataFields.groundtruth_boxes])
gt_boxlist = box_list_ops.scale(normalized_gt_boxlist,
tf.shape(original_image)[1],
tf.shape(original_image)[2])
groundtruth_boxes = gt_boxlist.get()
groundtruth_classes = input_dict[fields.InputDataFields.groundtruth_classes]
tensor_dict['groundtruth_boxes'] = groundtruth_boxes
tensor_dict['groundtruth_classes'] = groundtruth_classes
tensor_dict['area'] = input_dict[fields.InputDataFields.groundtruth_area]
tensor_dict['difficult'] = input_dict[
fields.InputDataFields.groundtruth_difficult]
# subset annotations
if fields.InputDataFields.groundtruth_subset in input_dict:
tensor_dict['groundtruth_subset'] \
= input_dict[fields.InputDataFields.groundtruth_subset]
return tensor_dict