{"id":13443698,"url":"https://github.com/mikel-brostrom/boxmot","last_synced_at":"2025-12-24T13:45:19.734Z","repository":{"id":37340782,"uuid":"275118967","full_name":"mikel-brostrom/boxmot","owner":"mikel-brostrom","description":"BoxMOT: pluggable SOTA tracking modules for segmentation, object detection and pose estimation models","archived":false,"fork":false,"pushed_at":"2025-05-03T02:35:31.000Z","size":130810,"stargazers_count":7266,"open_issues_count":11,"forks_count":1779,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-05-03T18:57:13.826Z","etag":null,"topics":["boosttrack","botsort","bytetrack","clip","deep-learning","deepocsort","improvedassociation","machine-learning","mot","mots","multi-object-tracking","multi-object-tracking-segmentation","ocsort","oriented-bounding-box-tracking","osnet","segmentation","strongsort","tensorrt","tracking-by-detection","yolo"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikel-brostrom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"mikel.brostrom","thanks_dev":null,"custom":null}},"created_at":"2020-06-26T09:26:23.000Z","updated_at":"2025-05-03T17:44:48.000Z","dependencies_parsed_at":"2024-01-16T19:02:53.847Z","dependency_job_id":"88706f0a-dd0c-4dbf-b862-e7d4891f7183","html_url":"https://github.com/mikel-brostrom/boxmot","commit_stats":{"total_commits":2791,"total_committers":40,"mean_commits":69.775,"dds":"0.31386599785023284","last_synced_commit":"20363a40db08b1b0effbe427e398809e4c607969"},"previous_names":["mikel-brostrom/yolov8_tracking","mikel-brostrom/yolov5_deepsort_pytorch","mikel-brostrom/yolov5_strongsort_osnet","mikel-brostrom/boxmot"],"tags_count":106,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikel-brostrom%2Fboxmot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikel-brostrom%2Fboxmot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikel-brostrom%2Fboxmot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikel-brostrom%2Fboxmot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikel-brostrom","download_url":"https://codeload.github.com/mikel-brostrom/boxmot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590528,"owners_count":21772935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boosttrack","botsort","bytetrack","clip","deep-learning","deepocsort","improvedassociation","machine-learning","mot","mots","multi-object-tracking","multi-object-tracking-segmentation","ocsort","oriented-bounding-box-tracking","osnet","segmentation","strongsort","tensorrt","tracking-by-detection","yolo"],"created_at":"2024-07-31T03:02:07.429Z","updated_at":"2025-12-24T13:45:19.728Z","avatar_url":"https://github.com/mikel-brostrom.png","language":"Python","funding_links":["https://buymeacoffee.com/mikel.brostrom"],"categories":["Python","对象检测、分割"],"sub_categories":["网络服务_其他"],"readme":"# **BoxMOT**: Pluggable SOTA multi-object tracking modules for segmentation, object detection and pose estimation models\n\n\u003cdiv align=\"center\" markdown=\"1\"\u003e\n\n  \u003cimg width=\"640\"\n       src=\"https://github.com/mikel-brostrom/boxmot/releases/download/v12.0.0/output_640.gif\"\n       alt=\"BoxMot demo\"\u003e\n  \u003cbr\u003e \u003c!-- one blank line --\u003e\n\n  \u003ca href=\"https://trendshift.io/repositories/13239\" target=\"_blank\"\u003e\u003cimg src=\"https://trendshift.io/api/badge/repositories/13239\" alt=\"mikel-brostrom%2Fboxmot | Trendshift\" style=\"width: 250px; height: 55px;\" width=\"250\" height=\"55\"/\u003e\u003c/a\u003e\n\n  [![CI](https://github.com/mikel-brostrom/yolov8_tracking/actions/workflows/ci.yml/badge.svg)](https://github.com/mikel-brostrom/yolov8_tracking/actions/workflows/ci.yml)\n  [![PyPI version](https://badge.fury.io/py/boxmot.svg)](https://badge.fury.io/py/boxmot)\n  [![downloads](https://static.pepy.tech/badge/boxmot)](https://pepy.tech/project/boxmot)\n  [![license](https://img.shields.io/badge/license-AGPL%203.0-blue)](https://github.com/mikel-brostrom/boxmot/blob/master/LICENSE)\n  [![python-version](https://img.shields.io/pypi/pyversions/boxmot)](https://badge.fury.io/py/boxmot)\n  [![colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/18nIqkBr68TkK8dHdarxTco6svHUJGggY?usp=sharing)\n  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8132989.svg)](https://doi.org/10.5281/zenodo.8132989)\n  [![docker pulls](https://img.shields.io/docker/pulls/boxmot/boxmot?logo=docker)](https://hub.docker.com/r/boxmot/boxmot)\n  [![discord](https://img.shields.io/discord/1377565354326495283?logo=discord\u0026label=discord\u0026labelColor=fff\u0026color=5865f2)](https://discord.gg/tUmFEcYU4q)\n  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mikel-brostrom/boxmot)\n\n\u003c/div\u003e\n\n\n## 🚀 Key Features\n\n- **Pluggable Architecture**  \n  Easily swap in/out SOTA multi-object trackers.\n\n- **Universal Model Support**  \n  Integrate with any segmentation, object-detection and pose-estimation models that outputs bounding boxes\n\n- **Benchmark-Ready**  \n  Local evaluation pipelines for MOT17, MOT20, and DanceTrack ablation datasets with \"official\" ablation detectors\n\n- **Performance Modes**\n  - **Motion-only**: for lightweight, CPU-efficient, high-FPS performance \n  - **Motion + Appearance**: Combines motion cues with appearance embeddings ([CLIPReID](https://arxiv.org/pdf/2211.13977.pdf), [LightMBN](https://arxiv.org/pdf/2101.10774.pdf), [OSNet](https://arxiv.org/pdf/1905.00953.pdf)) to maximize identity consistency and accuracy at a higher computational cost\n\n- **Reusable Detections \u0026 Embeddings**  \n  Save once, run evaluations with no redundant preprocessing lightning fast.\n\n\n## 📊 Benchmark Results (MOT17 ablation split)\n\n\u003cdiv align=\"center\" markdown=\"1\"\u003e\n\n\u003c!-- START TRACKER TABLE --\u003e\n| Tracker | Status  | HOTA↑ | MOTA↑ | IDF1↑ | FPS |\n| :-----: | :-----: | :---: | :---: | :---: | :---: |\n| [botsort](https://arxiv.org/abs/2206.14651) | ✅ | 69.418 | 78.232 | 81.812 | 46 |\n| [boosttrack](https://arxiv.org/abs/2408.13003) | ✅ | 69.254 | 75.921 | 83.205 | 25 |\n| [strongsort](https://arxiv.org/abs/2202.13514) | ✅ | 68.05 | 76.185 | 80.763 | 17 |\n| [deepocsort](https://arxiv.org/abs/2302.11813) | ✅ | 67.796 | 75.868 | 80.514 | 12 |\n| [bytetrack](https://arxiv.org/abs/2110.06864) | ✅ | 67.68 | 78.039 | 79.157 | 1265 |\n| [hybridsort](https://arxiv.org/abs/2308.00783) | ✅ | 67.39 | 74.127 | 79.105 | 25 |\n| [ocsort](https://arxiv.org/abs/2203.14360) | ✅ | 66.441 | 74.548 | 77.899 | 1483 |\n\n\u003c!-- END TRACKER TABLE --\u003e\n\n\u003csub\u003e NOTES: Evaluation was conducted on the second half of the MOT17 training set, as the validation set is not publicly available and the ablation detector was trained on the first half. We employed [pre-generated detections and embeddings](https://github.com/mikel-brostrom/boxmot/releases/download/v11.0.9/runs2.zip). Each tracker was configured using the default parameters from their official repositories. \u003c/sub\u003e\n\n\u003c/div\u003e\n\n\u003c/details\u003e\n\n\n## 🔧 Installation\n\nInstall the `boxmot` package, including all requirements, in a Python\u003e=3.9 environment:\n\n```bash\npip install boxmot\n```\n\nIf you want to contribute to this package check how to contribute [here](https://github.com/mikel-brostrom/boxmot/blob/master/CONTRIBUTING.md)\n\n## 💻 CLI\n\nBoxMOT provides a unified CLI with a simple syntax:\n\n```bash\nboxmot MODE DETECTOR REID TRACKER ARGS\n\nWhere:\n  MODE      (required) one of [track, eval, tune, generate, export]\n  DETECTOR  (optional) YOLO model like yolov8n, yolov9c, yolo11m, yolox_x\n  REID      (optional) ReID model like osnet_x0_25_msmt17, mobilenetv2_x1_4\n  TRACKER   (optional) one of [deepocsort, botsort, bytetrack, strongsort, ocsort, hybridsort, boosttrack]\n  ARGS      (optional) 'arg=value' pairs that override defaults\n```\n\n**Quick Examples:**\n```bash\n# Track with webcam, save results, show basic results\nboxmot track yolov8n osnet_x0_25_msmt17 deepocsort --source 0 --show --save\n\n# Track a video file, save results, show trajectories + lost tracks\nboxmot track yolov8n osnet_x0_25_msmt17 botsort --source video.mp4 --save --show-trajectories --show-lost\n\n# Evaluate on MOT dataset\nboxmot eval yolox_x_MOT17_ablation lmbn_n_duke botsort --source MOT17-ablation\n\n# Tune ocsort's hyperparameters for dancetrack\nboxmot tune yolox_x_dancetrack_ablation lmbn_n_duke ocsort --source dancetrack-ablation --n-trials 10\n\n# Export ReID model with dynamic sized input\nboxmot export --weights osnet_x0_25_msmt17.pt --include onnx --include engine dynamic\n```\n\n## 🐍 PYTHON\n\nSeamlessly integrate BoxMOT directly into your Python MOT applications with your custom model.\n\n```python\nimport cv2\nimport torch\nimport numpy as np\nfrom pathlib import Path\nfrom boxmot import BoostTrack\nfrom torchvision.models.detection import (\n    fasterrcnn_resnet50_fpn_v2,\n    FasterRCNN_ResNet50_FPN_V2_Weights as Weights\n)\n\n# Set device\ndevice = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n\n# Load detector with pretrained weights and preprocessing transforms\nweights = Weights.DEFAULT\ndetector = fasterrcnn_resnet50_fpn_v2(weights=weights, box_score_thresh=0.5)\ndetector.to(device).eval()\ntransform = weights.transforms()\n\n# Initialize tracker\ntracker = BoostTrack(reid_weights=Path('osnet_x0_25_msmt17.pt'), device=device, half=False)\n\n# Start video capture\ncap = cv2.VideoCapture(0)\n\nwith torch.inference_mode():\n    while True:\n        success, frame = cap.read()\n        if not success:\n            break\n\n        # Convert frame to RGB and prepare for detector\n        rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)\n        tensor = torch.from_numpy(rgb).permute(2, 0, 1).to(torch.uint8)\n        input_tensor = transform(tensor).to(device)\n\n        # Run detection\n        output = detector([input_tensor])[0]\n        scores = output['scores'].cpu().numpy()\n        keep = scores \u003e= 0.5\n\n        # Prepare detections for tracking\n        boxes = output['boxes'][keep].cpu().numpy()\n        labels = output['labels'][keep].cpu().numpy()\n        filtered_scores = scores[keep]\n        detections = np.concatenate([boxes, filtered_scores[:, None], labels[:, None]], axis=1)\n\n        # Update tracker and draw results\n        #   INPUT:  M X (x, y, x, y, conf, cls)\n        #   OUTPUT: M X (x, y, x, y, id, conf, cls, ind)\n        res = tracker.update(detections, frame)\n        tracker.plot_results(frame, show_trajectories=True)\n\n        # Show output\n        cv2.imshow('BoXMOT + Torchvision', frame)\n        if cv2.waitKey(1) \u0026 0xFF == ord('q'):\n            break\n\n# Clean up\ncap.release()\ncv2.destroyAllWindows()\n```\n\n\n## 📝 Code Examples \u0026 Tutorials\n\n\u003cdetails\u003e\n\u003csummary\u003eTracking\u003c/summary\u003e\n\n```bash\n# Different detector models\nboxmot track rf-detr-base                        # RF-DETR\nboxmot track yolox_s                             # YOLOX  \nboxmot track yolo12n                             # YOLO12\nboxmot track yolo11n                             # YOLO11\nboxmot track yolov10n                            # YOLOv10\nboxmot track yolov9c                             # YOLOv9\nboxmot track yolov8n                             # YOLOv8 bboxes only\nboxmot track yolov8n-seg                         # YOLOv8 + segmentation masks\nboxmot track yolov8n-pose                        # YOLOv8 + pose estimation\n```\n\n  \u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eTracking methods\u003c/summary\u003e\n\n```bash\nboxmot track yolov8n osnet_x0_25_msmt17 deepocsort\nboxmot track yolov8n osnet_x0_25_msmt17 strongsort\nboxmot track yolov8n osnet_x0_25_msmt17 ocsort\nboxmot track yolov8n osnet_x0_25_msmt17 bytetrack\nboxmot track yolov8n osnet_x0_25_msmt17 botsort\nboxmot track yolov8n osnet_x0_25_msmt17 boosttrack\nboxmot track yolov8n osnet_x0_25_msmt17 hybridsort\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eTracking sources\u003c/summary\u003e\n\nTracking can be run on most video formats\n\n```bash\nboxmot track yolov8n --source 0                               # webcam\nboxmot track yolov8n --source img.jpg                         # image\nboxmot track yolov8n --source vid.mp4                         # video\nboxmot track yolov8n --source path/                           # directory\nboxmot track yolov8n --source path/*.jpg                      # glob\nboxmot track yolov8n --source 'https://youtu.be/Zgi9g1ksQHc'  # YouTube\nboxmot track yolov8n --source 'rtsp://example.com/media.mp4'  # RTSP, RTMP, HTTP stream\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSelect ReID model\u003c/summary\u003e\n\nSome 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](https://kaiyangzhou.github.io/deep-person-reid/MODEL_ZOO). These models can be further optimized for your needs by the export command.\n\n```bash\nboxmot track yolov8n lmbn_n_cuhk03_d botsort --source 0           # lightweight\nboxmot track yolov8n osnet_x0_25_market1501 botsort --source 0\nboxmot track yolov8n mobilenetv2_x1_4_msmt17 botsort --source 0\nboxmot track yolov8n resnet50_msmt17 botsort --source 0\nboxmot track yolov8n osnet_x1_0_msmt17 botsort --source 0\nboxmot track yolov8n clip_market1501 botsort --source 0           # heavy\nboxmot track yolov8n clip_vehicleid botsort --source 0\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eFilter tracked classes\u003c/summary\u003e\n\nBy default the tracker tracks all MS COCO classes.\n\nIf you want to track a subset of the classes that your model predicts, add their corresponding index after the classes flag:\n\n```bash\nboxmot track yolov8s --source 0 --classes 16 17  # Track cats and dogs only\n```\n\n[Here](https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/) 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\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eEvaluation\u003c/summary\u003e\n\nEvaluate a combination of detector, tracking method and ReID model on standard MOT dataset or your custom one:\n\n```bash\n# reproduce MOT17 README results\nboxmot eval yolox_x_MOT17_ablation lmbn_n_duke boosttrack --source MOT17-ablation --verbose \n# MOT20 results\nboxmot eval yolox_x_MOT20_ablation lmbn_n_duke boosttrack --source MOT20-ablation --verbose \n# DanceTrack results\nboxmot eval yolox_x_dancetrack_ablation lmbn_n_duke boosttrack --source dancetrack-ablation --verbose \n# metrics on custom dataset\nboxmot eval yolov8n osnet_x0_25_msmt17 deepocsort --source ./assets/MOT17-mini/train --verbose\n```\n\nAdd `--gsi` to your command for postprocessing the MOT results by Gaussian smoothed interpolation. Detections and embeddings are stored for the selected YOLO and ReID model respectively. They can then be loaded into any tracking algorithm, avoiding the overhead of repeatedly generating this data.\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003eHyperparameter Tuning\u003c/summary\u003e\n\nWe use a fast and elitist multiobjective genetic algorithm for tracker hyperparameter tuning. By default the objectives are: HOTA, MOTA, IDF1.\n\n```bash\n# Generate detections and embeddings (saves under ./runs/dets_n_embs)\nboxmot generate yolov8n osnet_x0_25_msmt17 --source ./assets/MOT17-mini/train\n\n# Tune parameters for specified tracking method\nboxmot tune --yolo-model yolov8n.pt --reid-model osnet_x0_25_msmt17.pt --n-trials 9 --tracking-method botsort --source ./assets/MOT17-mini/train\n```\n\nThe set of hyperparameters leading to the best HOTA result are written to the tracker's config file.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eExport\u003c/summary\u003e\n\nWe support ReID model export to ONNX, OpenVINO, TorchScript and TensorRT:\n\n```bash\n# export to ONNX\nboxmot export --weights osnet_x0_25_msmt17.pt --include onnx --device cpu\n# export to OpenVINO\nboxmot export --weights osnet_x0_25_msmt17.pt --include openvino --device cpu\n# export to TensorRT with dynamic input\nboxmot export --weights osnet_x0_25_msmt17.pt --include engine --device 0 --dynamic\n```\n\n\u003c/details\u003e\n\n\n\u003cdiv align=\"center\" markdown=\"1\"\u003e\n\n| Example Description | Notebook |\n|---------------------|----------|\n| Torchvision bounding box tracking with BoxMOT | [![Notebook](https://img.shields.io/badge/Notebook-torchvision_det_boxmot.ipynb-blue)](examples/det/torchvision_boxmot.ipynb) |\n| Torchvision pose tracking with BoxMOT | [![Notebook](https://img.shields.io/badge/Notebook-torchvision_pose_boxmot.ipynb-blue)](examples/pose/torchvision_boxmot.ipynb) |\n| Torchvision segmentation tracking with BoxMOT | [![Notebook](https://img.shields.io/badge/Notebook-torchvision_seg_boxmot.ipynb-blue)](examples/seg/torchvision_boxmot.ipynb) |\n\n\u003c/div\u003e\n\n## Contributors\n\n\u003ca href=\"https://github.com/mikel-brostrom/boxmot/graphs/contributors \"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=mikel-brostrom/boxmot\" /\u003e\n\u003c/a\u003e\n\n## Contact\n\nFor BoxMOT bugs and feature requests please visit [GitHub Issues](https://github.com/mikel-brostrom/boxmot/issues).\nFor business inquiries or professional support requests please send an email to: box-mot@outlook.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikel-brostrom%2Fboxmot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikel-brostrom%2Fboxmot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikel-brostrom%2Fboxmot/lists"}