mikel-brostrom / boxmot

BoxMOT: pluggable SOTA tracking modules for segmentation, object detection and pose estimation models
GNU Affero General Public License v3.0
6.71k stars 1.71k forks source link

Many losses during tracking #115

Closed elise58 closed 3 years ago

elise58 commented 3 years ago

Hello, I'm working on a bee tracking but the objects are very often lost when the bees change direction and therefore shape. Maybe I should put more weight on the distance than on the appearance between the 2 objects I want to process from one image to the other but I don't know how to do it. Could someone help me?

mikel-brostrom commented 3 years ago

The appearance descriptor is of little help for your use case, as all the bees will have very similar features visually. Moreover, I assume that the motion uncertainty is very high as the bees can change direction suddenly which makes it hard for the Kalman filtering framework to provides a suitable estimate of the bees' location. You have a difficult task at hand :smile:

You can start by increasing max_dist here:

https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch/blob/790f02f78ed54fef97d3c58d42a2d601cda12652/deep_sort_pytorch/deep_sort/deep_sort.py#L14

This will increase the distance that is considered for matches.

elise58 commented 3 years ago

Thank you for taking the time to respond. Indeed what I am trying to do looks complicated! I will try to increase the distance as you advise. Do you think that it could be useful to change other parameters? I have lowered the confidence level to 0.1 which makes the tracking better but I would like to improve it further if it's possible.

elise58 commented 3 years ago

Another question : I use my own model created by yolov5 : last.pt like this : "--yolo_weights /content/gdrive/MyDrive/entraining_data_aug/last.pt " in the tracking command line. I don't know if there is a problem with the ckpt.t7 that I import into the project. Does the ckpt.t7 need to be trained as well or is it not used when I use my last.pt template?

mikel-brostrom commented 3 years ago

The problem of lowering the confidence to such a low value is that you probably get many false positives. You maybe want to play with the n_init value to counter that. By increasing the n_init value you increase the number of consecutive detections before a single bee is added to deepsort as a track.

https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch/blob/6c306e48377082a91a9315842e89da1bc816a2a5/deep_sort_pytorch/deep_sort/sort/tracker.py#L20

Let me know if the results get better!

mikel-brostrom commented 3 years ago

I don't know if there is a problem with the ckpt.t7 that I import into the project. Does the ckpt.t7 need to be trained as well or is it not used when I use my last.pt template?

The model in charge of extracting the visual descriptor has been trained on a person Re-ID dataset and it is loaded automatically when you run track.py. This means that it is best suited for tracking persons. However, the bees look the same visually so I am not sure there is much to win training the appearance descriptor on a bee Re-ID dataset.

elise58 commented 3 years ago

Thank you for all the advice. I'll let you know in a few days if the results I get are better.

elise58 commented 3 years ago

Hello, thanks to your help by playing on the parameters you have indicated I have a more efficient result. I hope I can improve it further but I think I'm on the right track! Thank you for your work Sincerely Elise

mikel-brostrom commented 3 years ago

You could also try to improve your results by choosing a bigger model and training it on the full image resolution :smile: Good luck with your research!

abdulwajid725 commented 3 years ago

Hi, My Task is to detect clothes in a video of people walking around. When I set the max_age value to 10, then after occlusion, tracker forgets the apparel tracked. When I increase the max_age to larger value, then after the tracked object gets out of the frame, it transfers the same id to other apparels which have just come in the frame. What should I do. I will try the "max_dist" thing suggested above but it would be great if I got more suggestions.

Thanks