简体   繁体   中英

Is Tensorflows object detection API producing incorrect ymin and ymax bounding box coordinates?

I'm running the API over a series of video frames to track objects through a scene and I'm extracting the bounding box coordinates for each object in order to calculate the centre of each bounding box. It would appear, however, that there is an offset in the ymin and ymax coordinates.

The scene is of a person walking the field of view with the bottom of the frame matched up to the persons feet (which would infer a very small value for ymin and a ymax value that would not extend to the stop of the frame. However the API gives the following normalised box coordinates [452.26962089538574, 197.93473720550537, 1073.7505388259888, 639.3438720703125] . The absolute coordinates are [0.41876816749572754, 0.10309100896120071, 0.9942134618759155, 0.3329916000366211] For reference the video is 1920 x 1080.

The same frame put into MATLABs video labler app (when translated into [ymin xmin ymax xmax] ) returns [8.396575927734375, 57.50376892089844, 722.7988586425781, 431.51695251464844] . I'm aware they won't exactly match because I've manually drawn in the box as ground truth (this is especially true for the x coordinates), however the ymin and ymax should be pretty close and these results seem much more realistic.

Has anyone come across this before? The bounding boxes are drawn correctly onto the image when the API runs the inference, so I'm at bit of a loss as to what's happening. As I'm taking data directly from boxes = detection_graph.get_tensor_by_name('detection_boxes:0') and storing it on each iteration.

It turns out I'd over looked the fact that python's coordinate system has 0,0 in the top left and the API accounts for this by making top = ymin and bottom = ymax within visualization_utils.py. So a ymax = 1073 would indeed be near the bottom of the frame.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM