【发布时间】:2021-01-05 06:57:49
【问题描述】:
我正在尝试从 person 类中获取边界框的像素坐标(标记为: mscoco_label_map.pbtxt
item {
name: "/m/01g317"
id: 1
display_name: "person"
}
目前我正在通过
将边界框和标签添加到图像上input_tensor = tf.convert_to_tensor(np.expand_dims(image_np, 0), dtype=tf.float32)
detections, predictions_dict, shapes = detect_fn(input_tensor)
label_id_offset = 1
image_np_with_detections = image_np.copy()
viz_utils.visualize_boxes_and_labels_on_image_array(
image_np_with_detections,
detections['detection_boxes'][0].numpy(),
(detections['detection_classes'][0].numpy() + label_id_offset).astype(int),
detections['detection_scores'][0].numpy(),
category_index,
use_normalized_coordinates=True,
max_boxes_to_draw=3,
min_score_thresh=.30,
agnostic_mode=False)
(所有代码都在while循环中)
但是当我打印出 detections['detection_boxes'] 时,我得到了很多标准化坐标,我不知道如何将这些坐标排序到特定的框,例如。人标签。
那么如何在 detections['detection_boxes'] 中获取特定边界框的像素坐标?
StackOverflow 的新手,非常感谢任何提示。
【问题讨论】:
-
所以你想从标准化坐标转换为像素坐标?
-
是的,特别是人物边界框的坐标。
标签: python python-3.x tensorflow object-detection object-detection-api