Skip to content
Advertisement

Get the bounding box coordinates in the TensorFlow object detection API tutorial

I am new to both Python and Tensorflow. I am trying to run the object detection tutorial file from the Tensorflow Object Detection API, but I cannot find where I can get the coordinates of the bounding boxes when objects are detected.

Relevant code:

JavaScript

The place where I assume bounding boxes are drawn is like this:

JavaScript

I tried printing output_dict['detection_boxes'] but I am not sure what the numbers mean. There are a lot.

JavaScript

I found answers for similar questions, but I don’t have a variable called boxes as they do. How can I get the coordinates?

Advertisement

Answer

I tried printing output_dict[‘detection_boxes’] but I am not sure what the numbers mean

You can check out the code for yourself. visualize_boxes_and_labels_on_image_array is defined here.

Note that you are passing use_normalized_coordinates=True. If you trace the function calls, you will see your numbers [ 0.56213236, 0.2780568 , 0.91445708, 0.69120586] etc. are the values [ymin, xmin, ymax, xmax] where the image coordinates:

JavaScript

are computed by the function:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement