本文整理匯總了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