Hello I'm new to tensorflow object detection api I'm trying to find the bounding box coordinates of objects in my image. I wrote the following code but it is not working.
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)
I'm getting the following output:
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)