theAIGuysCode / yolov4-deepsort

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

How do you train to improve tracking accuracy? #100

Open 3BBUAE opened 2 years ago

3BBUAE commented 2 years ago

I Have tried fine-tuning a pre-trained yolov4 model, by using a custom dataset that has vehicles from different angles. Once the training finished I converted the model from darknet format to TensorFlow format, however when I run the object_tracker.py using the fine tuned model it fails to detect and track objects at all.

I trained the model to include only 5 classes since these are the classes I'm most interested in, should I retrain it to include all the classes in "coco.names"?

Should I also train the DeepSort Algorithm using the Cosine Metric Learning method?

The reason why I need to improve the accuracy is because: 1- I suspect that the yolov4 model is not used to the camera angle I have provided. 2- The tracker sometimes changes the ID of the tracked object as it gets closer to the camera. 3- Sometimes the tracker uses multiple labels on 1 Object (i.e car-22, car 34 on the same car).

For the 2nd and 3rd reasons I have tried tuning the tracker.py n_init and max_age parameters.

I also have one more question, is it possible that once a certain time has elapsed, the tracker can stop using a specific ID? for example car-9 was detected, and I don't want it to use the car-9 ID after 10 seconds have passed.

maryam95hallal commented 2 years ago

hey friend, you must train the weight file in other platforms then add the weight file to the project. you must train the yolo network separately and add your new weight file to the data directory. I suggest that you use the following github repository to create your custom weight file or to further trained weight file: https://github.com/AlexeyAB/darknet after training you must add new flag to the save_model.py and object_tracker.py that allow you to select your custom trained weight file.

maryam95hallal commented 2 years ago

the new flag is to allow deepsort to use your custom trained weight file. just make sure to use the same image size in the training process and in when testing in using deepsort. you can pass the image size as an argument in the deepsort project.

sekisek commented 2 years ago

I am confused. new flag ??? don't you just suppose to change the "weights flag" in the save_model.py to the new weight file name??

maryam95hallal commented 2 years ago

Sorry for the delay, the Flags is used to tell the tracker which settings to use. since you want to add a custom version of weights you should point the tracker to the new settings. so you need to add new flag and to link the flag and the settings.

3BBUAE commented 2 years ago

Sorry for the delay, the Flags is used to tell the tracker which settings to use. since you want to add a custom version of weights you should point the tracker to the new settings. so you need to add new flag and to link the flag and the settings.

Hi thanks for the reply, I managed to run the tracker on custom weights, and I have noticed improvements in the tracking. However there is still a problem where the tracked object bounding box keeps "jumping" between different objects. I was wondering should I train the tracker itself using cosine metric learning.

maryam95hallal commented 2 years ago

job well done! concerning the new problem my friend I believe that is the limit of that tracker. If you need a best tracker check out papers with code and benchmarks test for the best trackers and install them. I did that research and the current best tracker If you have good GPU is STARK. The second best and could need less resources are LTDSE and LTMU. LTMU tracker can be installed over other trackers and will increase their performance. I have a personal request if you can provide the updated source code so I can employ on my data. the more comments and instructions you share the better. Stark: https://github.com/researchmm/Stark LTDSE: https://github.com/Daikenan/LT_DSE LTMU: https://github.com/Daikenan/LTMU good luck and best regards.

On Tue, Oct 12, 2021 at 10:29 AM 3BBUAE @.***> wrote:

Sorry for the delay, the Flags is used to tell the tracker which settings to use. since you want to add a custom version of weights you should point the tracker to the new settings. so you need to add new flag and to link the flag and the settings.

Hi thanks for the reply, I managed to run the tracker on custom weights, and I have noticed improvements in the tracking. However there is still a problem where the tracked object bounding box keeps "jumping" between different objects. I was wondering should I train the tracker itself using cosine metric learning.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/theAIGuysCode/yolov4-deepsort/issues/100#issuecomment-940741064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVSQ5URNDGBGMCDYYF2HN6LUGPPVHANCNFSM5DDTBKKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.