kcg2015 / Vehicle-Detection-and-Tracking

Computer vision based vehicle detection and tracking using Tensorflow Object Detection API and Kalman-filtering
533 stars 191 forks source link

Using this for person tracking on different videos #24

Closed zubairahmed-ai closed 4 years ago

zubairahmed-ai commented 4 years ago

Hi,

First of all, thanks for sharing this great work!

I am using this on other videos of people walking and I figured the following code needs to change a bit to accommodate bigger detections/bounding boxes in addition to changing the ID to 1 (person) instead of 3 (car)

in detector.py I changed # if ((ratio < 0.8) and (box_h>10)): to be if ((ratio < 2) and (box_h>20) and (box_w>20)):

but I am still not seeing tracker properly working on this by following the detected object along like in your sample video

wondering what's going on?

kcg2015 commented 4 years ago

Hi, @zubairahmed-ai ,

Do you have any scree captures?
I suggest you first test if the detector outputs are reasonably accurate (without any restrictions on bounding boxes), i.e., the locations as well as the sizes of the bounding boxes. You can use capture_frame.py to isolated the frames that give you trouble. Hope this will help.

zubairahmed-ai commented 4 years ago

I managed to take a screen shot Tracking

you see the big bounding box, how do I get rid of this? I think its due to this reason that none of my trackers actually work

zubairahmed-ai commented 4 years ago

You can see that in the final video as well also note that the tracking is not consistent meaning it disappears and unable to follow an object from start to end, any way to improve this?

zubairahmed-ai commented 4 years ago

Ok I managed to figure this out the result is much better now

I changed the track_id_list to have more items

track_id_list= deque(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A1', 'B1', 'C1', 'D1', 'E1', 'F1', 'G1', 'H1', 'I1', 'J1', 'K1','L1','M1','N1','O1','P1','Q1','R1','S1','T1','U1','V1','W1','X1','Y1','Z1'])

also in the detector I changed to this to get the above result

if ((ratio < 3) and (box_h>10) and (box_w>10) and (box_h<250) and (box_w<250)):

do you have any suggestion for me to improve this even further?

kcg2015 commented 4 years ago

@zubairahmed-ai, the video looks awesome! Multi-object tracking is always not easy. I suggest you try a different object detector (YOLO, RCNN, etc.) to see if there are any visible improvement. The SSD MobileNet detector in this repo is a general purpose one (not optimized specifically for people detection) that trained on color images. You video is in gray scale. This could affect the detection accuracy.

zubairahmed-ai commented 4 years ago

@kcg2015 Makes sense, let me try another sample to see, unfortunately RCNN based detectors are slow so I'm not looking to use them but YOLO I may check

kcg2015 commented 4 years ago

@zubairahmed-ai , awesome, keep me posted for the YOLO results. Let me close this issue for now.