如何在十进制图像中检测目标位置

2024-04-25 22:50:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我是Tensorflow的新手,正在寻找样本对象检测代码。{a1}是其中之一

我只是不知道如何才能得到图像中被检测到的数组的精确坐标(位置)。在

谢谢


Tags: 对象代码图像tensorflowa1数组样本新手
2条回答

确切的答案是: Get the bounding box coordinates in the TensorFlow object detection API tutorial

在此之后:

out = vis_util.visualize_boxes_and_labels_on_image_array(
image,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=1,
min_score_thresh=0.80)

职位是:

^{pr2}$

谢谢rootkitchao

# Run the model
    out = sess.run([sess.graph.get_tensor_by_name('num_detections:0'),
                    sess.graph.get_tensor_by_name('detection_scores:0'),
                    sess.graph.get_tensor_by_name('detection_boxes:0'),
                    sess.graph.get_tensor_by_name('detection_classes:0')],
                   feed_dict={'image_tensor:0': inp.reshape(1, inp.shape[0], inp.shape[1], 3)})

     # Visualize detected bounding boxes.
    num_detections = int(out[0][0])
    for i in range(num_detections):
        classId = int(out[3][0][i])
        score = float(out[1][0][i])
        bbox = [float(v) for v in out[2][0][i]]

相关问题 更多 >