如何获取坐标?(tensorflow标签模型对象检测)

时间:2020-04-27 03:55:31

标签: python tensorflow object-detection

嗨,有人可以帮我吗?

我想知道矩形坐标

(左右方向) 我引用了这个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])) -------------------------------------------------- ----------------是否需要为整数?

x_left = int(round(x_left))

y_left = int(round(y_left))

x_right = int(舍入(x_right))

y_right = #int(舍入(y_right))

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

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

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

其中x_lefty_leftx_righty_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).