theAIGuysCode / yolov4-deepsort

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

Model works fine when detecting using 'darknet.py detector test....', but fails to detect custom classes with object_tracker.py #115

Open LukeRl opened 2 years ago

LukeRl commented 2 years ago

Hi, thanks in advance to anyone who takes the time to have a look at this, I've hit a wall with trying to fix it and I need to get it done in the next week or so.

So I've trained a custom yolov4 model to detect people (from pre-trained) as well as a new custom class, frisbees (specifically Frisbees in motion which often look like a blur of pixels). When I calculate the MAP of my model I get about 90% with 85% for frisbees and 94% for people. When I use this model with darknet to detect a single frame from the video I will be tracking, it detects all of the people and the frisbee perfectly, even with difficult frames. However, when I run the object_tracker.py with the same weights on the video that I took a frame from, it never detects any frisbees, even if I set the IOU and score thresholds to 0.01.

I have changed the allowed classes in object_tracker.py, and added my custom.names file to the classes folder and pointed the "__C.YOLO.CLASSES" variable to this file in the config.py

How can I get it detecting the frisbee class in this deepsort object_tracker with the same accuracy as in darknet's detector? Any help would be highly appreciated.

Thanks

LukeRl commented 2 years ago

I believe it may be because the feature detector fails to identify the frisbee as the same object since it's trained on the MOT dataset targeting people. Since there will only ever be one instance of the frisbee, can I somehow disable the feature tracking and just tell it that any detection of the frisbee is always the same object?