This repo contains a collections of pluggable state-of-the-art multi-object trackers for object detectors.
Supported tracking methods
| Trackers | HOTA↑ | MOTA↑ | IDF1↑ |
|---|---|---|---|
| OCSORT | |||
| ByteTrack | |||
| DeepOCSORT | |||
| BoTSORT | |||
| StrongSORT |
Everything is designed with simplicity and flexibility in mind. We don't hyperfocus on results on a single dataset, we prioritize real-world results. If you don't get good tracking results on your custom dataset with the out-of-the-box tracker configurations, use the examples/evolve.py script for tracker hyperparameter tuning.
Start with Python>=3.8 environment.
If you want to run the YOLOv8, YOLO-NAS or YOLOX examples:
git clone https://github.com/jayvaghasiya/ObjectTracking-NAS.git
pip install -v -e .
but if you only want to import the tracking modules you can simply:
pip install boxmot
Tracking
Yolo models
$ python examples/track.py --yolo-model yolov8n # bboxes only
python examples/track.py --yolo-model yolo_nas_s # bboxes only
python examples/track.py --yolo-model yolox_n # bboxes only
yolov8n-seg # bboxes + segmentation masks
yolov8n-pose # bboxes + pose estimation
Tracking methods
$ python examples/track.py --tracking-method deepocsort
strongsort
ocsort
bytetrack
botsortTracking sources
Tracking can be run on most video formats
$ python examples/track.py --source 0 # webcam
img.jpg # image
vid.mp4 # video
path/ # directory
path/*.jpg # glob
'https://youtu.be/Zgi9g1ksQHc' # YouTube
'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP streamSelect ReID model
Some tracking methods combine appearance description and motion in the process of tracking. For those which use appearance, you can choose a ReID model based on your needs from this ReID model zoo. These model can be further optimized for you needs by the reid_export.py script
$ python examples/track.py --source 0 --reid-model lmbn_n_cuhk03_d.pt # lightweight
osnet_x0_25_market1501.pt
mobilenetv2_x1_4_msmt17.engine
resnet50_msmt17.onnx
osnet_x1_0_msmt17.pt
clip_market1501.pt # heavy
clip_vehicleid.pt
...Filter tracked classes
By default the tracker tracks all MS COCO classes.
If you want to track a subset of the classes that you model predicts, add their corresponding index after the classes flag,
python examples/track.py --source 0 --yolo-model yolov8s.pt --classes 16 17 # COCO yolov8 model. Track cats and dogs, onlyHere is a list of all the possible objects that a Yolov8 model trained on MS COCO can detect. Notice that the indexing for the classes in this repo starts at zero
you need to pass two command line argumenst:
pass these argument ::
Exact name of the yolo model(Ex: yolo_nas_s,yolo_nas_l,yolo_nas_m):
--yolo-model yolo_nas_s
Path of the checkpoint :
--chekpoint_path ../tyre_model.pth
Enter the classes you want to trak with your custom model (In original sequence):
--custom_classes tyre parcel dummy
$ python examples/track.py --yolo-model yolo_nas_s --checkpoint_path ../tyre_model.pth --custom_classes tyre parcel car person