theAIGuysCode / yolov4-deepsort

Object tracking implemented with YOLOv4, DeepSort, and TensorFlow.
GNU General Public License v3.0
1.33k stars 752 forks source link

How to get bounding box coordinates and person's ID? #30

Closed kazuki-can closed 3 years ago

kazuki-can commented 4 years ago

Hi, I'm new to Deep sort. It's interesting. How can I get the bounding box coordinates of all objects and person's ID? I would need to cut photo to that object. So for instance, for each person, it would be 4 values for the rectangle: (top left x,top left y,width,height) and person-ID.

jmudy commented 4 years ago

If you use the --info flag you can print the bounding box coordinates. Example: python object_tracker.py --video ./data/video/test.mp4 --output ./outputs/demo.avi --model yolov4 --info

kazuki-can commented 4 years ago

Thank you for replying. I also want to know what is the name of function to print the bounding box coordinates?

jmudy commented 4 years ago

In object_tracker.py you change the current position in bounding box format using the function track.to_tlbr() in the line 207

https://github.com/theAIGuysCode/yolov4-deepsort/blob/9e745bfb3ea5e7c7505cb11a8e8654f5b1319ad9/object_tracker.py#L207

This function is defined in track.py

https://github.com/theAIGuysCode/yolov4-deepsort/blob/9e745bfb3ea5e7c7505cb11a8e8654f5b1319ad9/deep_sort/track.py#L99-L111

And then in the line 219 you print the BBox Coords when you use FLAGS.info https://github.com/theAIGuysCode/yolov4-deepsort/blob/9e745bfb3ea5e7c7505cb11a8e8654f5b1319ad9/object_tracker.py#L218-L219