【发布时间】:2018-08-17 09:56:08
【问题描述】:
您好,我是 tensorflow 对象检测 api 的新手,我正在尝试查找图像中对象的边界框坐标。我写了以下代码,但它不起作用。
def find_bounding_boxes(image, graph):
with graph.as_default():
with tf.Session() as sess:
width, height = image.size
boxes = graph.get_tensor_by_name('detection_boxes:0')
np.squeeze(boxes)
ymin = boxes[0][1][0]*height
xmin = boxes[0][1][1]*width
ymax = boxes[0][1][2]*height
xmax = boxes[0][1][3]*width
print ('Top left')
print (xmin,ymin,)
print ('Bottom right')
print (xmax,ymax)
我得到以下输出:
Top left
Tensor("mul_3:0", dtype=float32) Tensor("mul_2:0", dtype=float32)
Bottom right
Tensor("mul_5:0", dtype=float32) Tensor("mul_4:0", dtype=float32)
Top left
Tensor("mul_7:0", dtype=float32) Tensor("mul_6:0", dtype=float32)
Bottom right
Tensor("mul_9:0", dtype=float32) Tensor("mul_8:0", dtype=float32)
Top left
Tensor("mul_11:0", dtype=float32) Tensor("mul_10:0", dtype=float32)
Bottom right
Tensor("mul_13:0", dtype=float32) Tensor("mul_12:0", dtype=float32)
【问题讨论】:
标签: tensorflow object-detection bounding-box