如何在 Tensorflow 中检测图像中的对象位置 [英] How to detect object position in image in Tensorflow
本文介绍了如何在 Tensorflow 中检测图像中的对象位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 Tensorflow 的新手,正在寻找示例对象检测代码.其中之一是 那个
I'm a newbie in Tensorflow, and looking to the sample object detection codes. One of these is that
我只是不知道如何获得此示例代码的图像中检测到的数组的确切坐标(位置).
I just don't know how can I get the exact coordinates(position) of detected array in image for this sample codes.
谢谢
推荐答案
确切答案:获取TensorFlow中的边界框坐标对象检测API教程
之后:
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)
职位是:
im_height, im_width = image.shape[:2]
position = boxes[0][0]
(xmin, xmax, ymin, ymax) = (position[1]*im_width, position[3]*im_width, position[0]*im_height, position[2]*im_height)
roi = image2[int(ymin):int(ymax), int(xmin):int(xmax)]
这篇关于如何在 Tensorflow 中检测图像中的对象位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文