Reputation: 51
I'm using tensorflow and object detection api. I want to print bounding box location of object in test image. And this line show you vis_util.visualize_boxes_and_labels_on_image_array :
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8)
I want to look inside 'boxes' because I guess 'boxes' maybe is store bounding box location. So, I convert 'boxes' to list but when I print it on cmd, it's too complex.
Any ideas for this ?
Upvotes: 1
Views: 1554
Reputation: 11
I found the sollution.
1) After the line of code you quoted, write print(boxes).
2) It will return a [N,4] array, where N is the number of objects that was detected, so every row is a detected objected with a unique detection score.
3) Each row has 4 columns which represent normalized [ymin, xmin, ymax, xmax] in the descending order of detection score, that is.
4) To get the exact co-ordinate, multiply xmax and xmin with the upper limit of the x axis of your image and multiply ymax and ymin with the same of y axis.
Upvotes: 1