Modern C++ Multi-Object Tracking — 10 SOTA algorithms, production-ready, 10–100× faster than Python
Features · Benchmarks · Installation · Quick Start · Trackers · Documentation · Citation
motcpp is a high-performance C++ library for multi-object tracking (MOT). It implements 10 state-of-the-art algorithms with a unified, modern C++17 API — covering everything from the lightweight SORT baseline to the current BoostTrack SOTA — all ready to drop into production.
Inspired by BoxMOT, motcpp brings the same algorithmic breadth to C++ with a clean CMake integration, ONNX Runtime ReID backend, and built-in MOT benchmark tooling.
- 10 SOTA trackers — SORT, ByteTrack, OC-SORT, DeepOC-SORT, StrongSORT, BoT-SORT, BoostTrack, HybridSORT, UCMCTrack, OracleTrack
- 10–100× faster than Python — optimized C++ hot paths, zero-copy Eigen matrices
- Unified API — one
update(dets, img)call across all trackers - ONNX ReID backend — plug in any appearance model as an
.onnxfile - Camera motion compensation — ORB/ECC/SoF CMC built-in
- MOT benchmark tooling — evaluate on MOT17/MOT20 out of the box
- >90% test coverage — GoogleTest suite across all components
- Cross-platform — Linux, macOS, Windows (CI-verified)
- Modern CMake —
find_package,FetchContent, and vcpkg ready
Evaluated on the second half of the MOT17 training set using YOLOX detections and FastReID embeddings. Pre-generated data available in releases. FPS on Intel i9-13900K, single thread.
| Tracker | Type | HOTA ↑ | MOTA ↑ | IDF1 ↑ | FPS ↑ |
|---|---|---|---|---|---|
| SORT | Motion | 62.4 | 75.2 | 69.2 | 1250 |
| ByteTrack | Motion | 66.5 | 76.4 | 77.6 | 1100 |
| OC-SORT | Motion | 64.6 | 73.9 | 74.4 | 850 |
| UCMCTrack | Motion | 64.0 | 75.6 | 73.9 | 980 |
| OracleTrack | Motion | 66.9 | 77.3 | 79.7 | 449 |
| DeepOC-SORT | ReID | 65.8 | 75.1 | 76.2 | 120 |
| StrongSORT | ReID | 66.2 | 75.8 | 77.1 | 95 |
| BoT-SORT | ReID | 66.8 | 76.2 | 78.3 | 85 |
| HybridSORT | ReID | 66.4 | 76.0 | 77.8 | 90 |
| BoostTrack | ReID | 67.5 | 77.1 | 79.2 | 75 |
| Tracker | C++ (FPS) | Python (FPS) | Speedup |
|---|---|---|---|
| ByteTrack | 1100 | 45 | 24× |
| OC-SORT | 850 | 32 | 27× |
| StrongSORT | 95 | 8 | 12× |
| Dependency | Version | Required |
|---|---|---|
| C++ compiler (GCC / Clang / MSVC) | C++17 | ✅ |
| CMake | 3.20+ | ✅ |
| OpenCV | 4.x | ✅ |
| Eigen3 | 3.3+ | ✅ |
| yaml-cpp | any | ✅ |
| ONNX Runtime | 1.16+ | ReID only |
Ubuntu / Debian
sudo apt-get update && sudo apt-get install -y \
build-essential cmake \
libeigen3-dev libopencv-dev libyaml-cpp-devmacOS
brew install cmake eigen opencv yaml-cppWindows (vcpkg)
vcpkg install eigen3:x64-windows opencv4:x64-windows yaml-cpp:x64-windowsgit clone https://github.com/Geekgineer/motcpp.git
cd motcpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
sudo cmake --install buildfind_package(motcpp REQUIRED)
target_link_libraries(your_target PRIVATE motcpp::motcpp)include(FetchContent)
FetchContent_Declare(
motcpp
GIT_REPOSITORY https://github.com/Geekgineer/motcpp.git
GIT_TAG v1.0.0
)
FetchContent_MakeAvailable(motcpp)
target_link_libraries(your_target PRIVATE motcpp::motcpp)| Option | Default | Description |
|---|---|---|
MOTCPP_BUILD_TESTS |
ON |
GoogleTest unit tests |
MOTCPP_BUILD_EXAMPLES |
ON |
Example binaries |
MOTCPP_BUILD_TOOLS |
ON |
motcpp_eval CLI |
MOTCPP_ENABLE_ONNX |
ON |
ONNX Runtime ReID backend |
MOTCPP_COVERAGE |
OFF |
gcov/lcov coverage |
BUILD_SHARED_LIBS |
OFF |
Build as shared library |
#include <motcpp/trackers/bytetrack.hpp>
#include <opencv2/opencv.hpp>
int main() {
motcpp::trackers::ByteTrack tracker;
cv::VideoCapture cap("video.mp4");
cv::Mat frame;
while (cap.read(frame)) {
// Detector output: [x1, y1, x2, y2, confidence, class_id]
Eigen::MatrixXf dets = your_detector(frame);
// Update — returns [x1, y1, x2, y2, track_id, conf, class_id, det_idx]
Eigen::MatrixXf tracks = tracker.update(dets, frame);
for (int i = 0; i < tracks.rows(); ++i) {
int id = static_cast<int>(tracks(i, 4));
cv::Rect box(tracks(i, 0), tracks(i, 1),
tracks(i, 2) - tracks(i, 0),
tracks(i, 3) - tracks(i, 1));
cv::rectangle(frame, box, motcpp::BaseTracker::id_to_color(id), 2);
cv::putText(frame, "ID " + std::to_string(id),
box.tl(), cv::FONT_HERSHEY_SIMPLEX, 0.6,
motcpp::BaseTracker::id_to_color(id), 2);
}
cv::imshow("Tracking", frame);
if (cv::waitKey(1) == 27) break;
}
}#include <motcpp/trackers/boosttrack.hpp>
// Point to a ReID ONNX model (see docs/guides/trackers.md for download)
motcpp::trackers::BoostTrackTracker tracker("osnet_x1_0.onnx");
while (cap.read(frame)) {
Eigen::MatrixXf dets = detector(frame);
Eigen::MatrixXf tracks = tracker.update(dets, frame);
// ...
}motcpp::trackers::ByteTrack tracker(
0.3f, // det_thresh
30, // max_age
50, // max_obs
3, // min_hits
0.3f, // iou_threshold
true, // per_class — track each class independently
80 // nr_classes
);tracker.reset(); // clears all track state and ID counterNeed maximum throughput (>500 FPS)?
└─ SORT or ByteTrack
General purpose, great accuracy/speed balance?
└─ ByteTrack · OC-SORT · OracleTrack
Heavy occlusion or non-linear motion?
└─ OC-SORT · UCMCTrack · OracleTrack
Moving or drone camera?
└─ UCMCTrack · BoT-SORT · OracleTrack
Have a ReID model and need best accuracy?
└─ BoostTrack · StrongSORT · BoT-SORT
| Tracker | Type | State Space | Key Innovation | Paper |
|---|---|---|---|---|
| SORT | Motion | XYSR | IoU + Kalman baseline | ICASSP 2016 |
| ByteTrack | Motion | XYAH | Two-stage low-conf association | ECCV 2022 |
| OC-SORT | Motion | XYSR | Observation-centric momentum | CVPR 2023 |
| UCMCTrack | Motion | Ground plane | Uniform camera motion compensation | AAAI 2024 |
| OracleTrack | Motion | XYAH | CMC + cascaded matching + OC recovery | — |
| DeepOC-SORT | ReID | XYSR | OC-SORT + appearance embeddings | arXiv 2023 |
| StrongSORT | ReID | XYAH | NSA Kalman + EMA appearance | TMM 2023 |
| BoT-SORT | ReID | XYSR | GMC camera compensation + ReID | arXiv 2022 |
| HybridSORT | ReID | XYSR | Hybrid IoU + height-modulated IoU | AAAI 2024 |
| BoostTrack | ReID | XYSR | Boosted similarity + detection confidence | MVA 2024 |
Full parameter reference and per-tracker code snippets: docs/guides/trackers.md
# Download OSNet x1.0 (recommended — good accuracy/size balance)
./scripts/auto_benchmark.sh --download-reid
# Or directly:
wget https://github.com/Geekgineer/motcpp/releases/download/reid-models-v1.0.0/osnet_x1_0.onnxcmake -B build -DMOTCPP_BUILD_TESTS=ON
cmake --build build -j$(nproc)
cd build && ctest --output-on-failure
# Single test suite
./build/tests/motcpp_tests --gtest_filter=ByteTrackTest.*| Resource | Description |
|---|---|
| Getting Started | Install, build, and run your first tracker |
| Tracker Guide | Full parameter docs for all 10 algorithms |
| Architecture | Kalman filters, association, ReID internals |
| Benchmarking | Reproduce MOT17/20 results |
| API Reference | Full C++ API |
| Tutorials | Step-by-step examples |
Contributions are welcome — bug fixes, new trackers, documentation, benchmarks. See CONTRIBUTING.md for the workflow.
If you use motcpp in your research, please cite:
@software{motcpp2026,
author = {motcpp contributors},
title = {motcpp: Modern C++ Multi-Object Tracking Library},
year = {2026},
url = {https://github.com/Geekgineer/motcpp},
license = {AGPL-3.0}
}Please also cite the original algorithm papers. See Acknowledgments below.
Licensed under the GNU Affero General Public License v3.0. See LICENSE.
| Algorithm | Reference |
|---|---|
| SORT | Bewley et al., Simple Online and Realtime Tracking, ICASSP 2016 |
| ByteTrack | Zhang et al., ByteTrack: Multi-Object Tracking by Associating Every Detection Box, ECCV 2022 |
| OC-SORT | Cao et al., Observation-Centric SORT, CVPR 2023 |
| DeepOC-SORT | Maggiolino et al., Deep OC-SORT, 2023 |
| StrongSORT | Du et al., StrongSORT: Make DeepSORT Great Again, TMM 2023 |
| BoT-SORT | Aharon et al., BoT-SORT: Robust Associations Multi-Pedestrian Tracking, 2022 |
| UCMCTrack | Yi et al., UCMCTrack: Multi-Object Tracking with Uniform Camera Motion Compensation, AAAI 2024 |
| HybridSORT | Yang et al., Hybrid-SORT: Weak Cues Matter for Online Multi-Object Tracking, AAAI 2024 |
| BoostTrack | Stanojevic et al., BoostTrack: Boosting the Similarity Measure and Detection Confidence, MVA 2024 |
| Resource | Citation |
|---|---|
| MOT17 Dataset | Milan et al., MOT16: A Benchmark for Multi-Object Tracking, 2016 |
| YOLOX Detections | Ge et al., YOLOX: Exceeding YOLO Series in 2021, 2021 |
| FastReID Embeddings | He et al., FastReID: A Pytorch Toolbox for General Instance Re-identification, 2020 |
motcpp follows the architecture and algorithmic patterns of BoxMOT by Mikel Broström — the Python multi-object tracking library that inspired this C++ port.
Made with ❤️ by the motcpp community



