首页 > 解决方案 > 如何获取坐标?(tensorflow标签模型物体检测)

问题描述

大家好,有人可以帮帮我吗?

我想知道矩形坐标

(左上右下)我参考了这个https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/blob/master/Object_detection_webcam.py

是否需要使用“盒子”?以及如何让 tensorflow 知道哪个是矩形坐标?

以下是对的吗?它需要是int吗?x_left = 1280*(np.squeeze(boxes[0,0,1]))

y_left = 640 *(np.squeeze(boxes[0,0,0]))

x_right = 1280*(np.squeeze(boxes[0,0,3]))

y_right = 640 *(np.squeeze(boxes[0,0,2])) ------------------------------- -----------------------------------是否需要为int?

x_left = int(round(x_left))

y_left = int(round(y_left))

x_right = int(圆形(x_right))

y_right = #int(圆形(y_right))

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

标签: pythontensorflowobject-detection

解决方案


boxes是归一化坐标的数组。数组的长度boxes等于检测的数量。对于索引i

boxes[i]=[x_left, y_left, x_right, y_right],

其中x_left, y_left, x_right,y_right在区间 [0,1] 内。

如果输入模型的图像是高度H和宽度W的,那么盒子的坐标是

x_left = int(W*x_left)
y_left = int(H*y_left)
x_right = int(W*x_right)
y_right = int(H*y_right).

推荐阅读