Skip to content

Repository files navigation

Multitarget Tracker

Build Ubuntu Build MacOS Build Ubuntu CodeQL

Latest Features

  • VSR (video super-resolution) + closed-set classifier track post-processing: refine classes and filter false positives after ByteTrack (demo pipeline, -DUSE_VSR=ON, see the section below)
  • Add geographiclib for vehicles speed estimation geographiclib/geographiclib
  • Add YOLOE detection support THU-MIG/yoloe
  • Add new SOTA: YOLOv26, YOLOv26-obb and YOLOv26-seg models from ultralytics/ultralytics
  • Add RT-DETRv4 (API similar D-FINE) detection model RT-DETRs/RT-DETRv4
  • Add D-FINE seg detection model ArgoHA/D-FINE-seg
  • Add ByteTrack MOT algorithm based on Vertical-Beach/ByteTrack-cpp
  • Big code cleanup from old style algorithms and detectors: some bgfg detectors, some VOT trackes, Face and Pedestrin detectors, Darknet based backend for old YOLO etc
  • YOLOv13 detector works with TensorRT! Export pre-trained PyTorch models here (iMoonLab/yolov13) to ONNX format and run Multitarget-tracker with -e=3 example
  • Instance segmentation model from RF-DETR detector works with TensorRT! Export pre-trained PyTorch models here (roboflow/rf-detr) to ONNX format and run Multitarget-tracker with -e=3 example
  • New linear assignment algorithm - Jonker-Volgenant / LAPJV algorithm used in scipy as alternative for Hungarian allgorithm
  • D-FINE detector works with TensorRT! Export pre-trained PyTorch models here (Peterande/D-FINE) to ONNX format and run Multitarget-tracker with -e=3 example
  • RF-DETR detector works with TensorRT! Export pre-trained PyTorch models here (roboflow/rf-detr) to ONNX format and run Multitarget-tracker with -e=3 example
  • YOLOv12 detector works with TensorRT! Export pre-trained PyTorch models here (sunsmarterjie/yolov12) to ONNX format and run Multitarget-tracker with -e=3 example

ReID benchmark

A/B on MOT20 train (4 sequences, 8931 frames) and VisDrone-MOT2019 val (7 sequences, 2846 frames). Both runs use the same TensorRT detector and the same UniversalTracker; only ReID settings differ. ByteTrack does not use ReID, so it is not part of this A/B. MOT20 uses the person OSNet model; VisDrone uses person OSNet + vehicle ResNet50.

Metrics are from mot_eval (CLEAR MOT + ID measures); timing includes frame reading, detection, tracking, ReID and result writing. Hardware: RTX 4070 Laptop, TensorRT 10.16, OpenCV 4.14 CUDA FP16.

Dataset ReID config MOTA IDF1 IDSW FP FN Recall ms/frame
MOT20 off (IoU only) 0.181 0.266 4786 110005 814420 0.282 33.6
MOT20 0.5 IoU / 0.5 ReID, gallery 15 0.111 0.136 10329 50597 947346 0.165 78.4
MOT20 0.8 IoU / 0.2 ReID, gallery 5 0.188 0.274 4493 96435 820714 0.277 76.4
VisDrone off (IoU only) -1.913 0.196 4758 288279 39376 0.655 57.8
VisDrone 0.5 IoU / 0.5 ReID, gallery 15 -0.583 0.300 2432 130698 47545 0.583 427.6

How to read it. On MOT20 the aggressive 0.5/0.5 ReID setting is harmful: it cuts FP but also cuts recall and more than doubles IDSW. Lowering the ReID weight to 0.2 and reducing the gallery to 5 (min_quality=0.5) recovers a small gain over IoU-only. On VisDrone ReID reduces FP/IDSW and improves MOTA/IDF1, but recall drops and the run is about 7x slower. VisDrone MOTA is negative because the detector finds many objects that are not annotated in the GT; compare IDF1/IDSW/FP/FN rather than MOTA alone.

ReID is disabled by default. The detailed settings, model preprocessing and interpretation are in docs/reid.md.

Demo Videos

Detection & Tracking

Multi-Camera Traffic Monitoring and Real-Time Emissions Estimation WALDO30 YOLOv8l model for UAV Traffic monitoring Satellite planes detection and tracking with YOLOv11-obb 4-in-1 latest SOTA detectors YOLOv8-obb detection with rotated boxes Very fast and small objects tracking

Documentation

Core Components

1. Object Detectors

Available through CreateDetector function with different detectorType:

  1. Background Subtraction:
    • Built-in: VIBE (tracking::Motion_VIBE), SuBSENSE (tracking::Motion_SuBSENSE), LOBSTER (tracking::Motion_LOBSTER)
    • OpenCV: MOG2 (tracking::Motion_MOG2)
    • OpenCV Contrib: MOG (tracking::Motion_MOG), GMG (tracking::Motion_GMG), CNT (tracking::Motion_CNT)
    • Foreground segmentation uses OpenCV contours producing cv::RotatedRect
  2. Deep Learning Models:
    • OpenCV DNN module (tracking::DNN_OCV)
    • TensorRT-accelerated YOLO (tracking::Yolo_TensorRT)

2. Matching Algorithms

For solving assignment problems:

  • Hungarian Algorithm (tracking::MatchHungrian) - O(N³) complexity
  • LAPJV (tracking::MatchLAPJV) - O(M*N²) complexity
  • Distance Metrics:
    • Center distance (tracking::DistCenters)
    • Bounding box distance (tracking::DistRects)
    • Jaccard/IoU similarity (tracking::DistJaccard)

3. Trajectory Smoothing

  • Kalman filters: Linear (tracking::KalmanLinear), Unscented (tracking::KalmanUnscented) and augmented Unscented (tracking::KalmanAugmentedUnscented)
  • State models: Constant velocity and constant acceleration (for all tracking modes)
  • Tracking modes: Position-only (tracking::FilterCenter), position+size (tracking::FilterRect) and rotated rectangle (tracking::FilterRRect)
  • Velocity: TrackingObject::m_velocity is the displacement per filter step (delta_time), not pixels/sec; m_speedMps is the metric speed in m/s (when local coordinates are available)
  • Specialized features: Abandoned object detection, line intersection counting

4. Visual Search

When targets disappear:

  • KCF (tracking::TrackKCF)
  • CSRT (tracking::TrackCSRT)
  • DaSiamRPN (tracking::TrackDaSiamRPN)
  • Vit (tracking::TrackVit)
  • Nano (tracking::TrackNano)

Processing Pipelines

  1. Synchronous (SyncProcess): Single-threaded processing
  2. Asynchronous (2 threads) (AsyncProcess): Decouples detection and tracking
  3. Fully Asynchronous (4 threads): For low-FPS deep learning detectors

Installation & Building

git clone https://github.com/Smorodov/Multitarget-tracker.git
cd Multitarget-tracker
mkdir build && cd build
cmake . .. \
  -DUSE_OCV_BGFG=ON \
  -DUSE_OCV_KCF=ON \
  -DUSE_OCV_UKF=ON \
  -DBUILD_ONNX_TENSORRT=ON \
  -DBUILD_ASYNC_DETECTOR=ON \
  -DBUILD_CARS_COUNTING=ON
make -j

Optional: RuCLIP classification

RuCLIP is not built here — it is a standalone CMake package (ruclip::ruclip) that supports LibTorch, TensorRT and OpenCV DNN backends. Build and install it once, then point CMake at the installed package:

# in the RuCLIP checkout (TensorRT backend; see its README for the precise paths)
cmake -S RuCLIP -B build -DRUCLIP_WITH_TORCH=OFF -DRUCLIP_WITH_TRT=ON \
      -DRUCLIP_BUILD_CLI=OFF -DCMAKE_INSTALL_PREFIX=<prefix>
cmake --build build --config Release && cmake --install build --config Release

# in Multitarget-tracker
cmake . .. -DUSE_CLIP=ON -DruCLIP_DIR=<prefix>/lib/cmake/ruCLIP

The motion example (-e=1) uses the TensorRT backend with FP16 (--fp16 engine, clip_*.fp16.gpu<N>.b<B>.engine), so the model directory must contain the exported ONNX files (clip_visual.onnx, clip_textual.onnx). At runtime the app needs the TensorRT/CUDA/cuDNN and OpenCV DLL directories on PATH.

Classification parameters live in the [clip] section of the settings ini file (see data/settings_motion_clip.ini): model directory, prompts, backend, FP16, a catch-all reject_label, a confidence threshold and the per-track recheck_interval. Pass it with --settings=../data/settings_motion_clip.ini; without model_dir/labels the classification stays disabled even when built with USE_CLIP=ON.

Optional: VSR + classifier track post-processing

A demo post-processor that runs after ByteTrack and re-scores each track with a closed-set classifier (yolo11s-cls) on the detector crop — either the raw crop (variant=0) or the crop restored by a K-frame video-super-resolution (VSR) engine (variant=1) — then drops tracks whose max-softmax confidence is below an OOD threshold. It can refine classes and remove false positives from the output; the tracker itself is left untouched.

Build with -DUSE_VSR=ON. It links the external vsr_inference package (vsr::vsr_inference) and needs TensorRT/CUDA:

cmake . .. -DUSE_VSR=ON \
  -DVSR_INFERENCE_DIR=<vsr_inference install prefix> \
  -DTRT_INCLUDE_DIR=<TensorRT include dir> -DCUDA_INCLUDE_DIR=<CUDA include dir>

Settings live in the [postprocess] section of the ini file (see data/settings_visdrone_yolo11s.ini): variant, cls_engine/cls_names/cls_size, vsr_engine/vsr_k/vsr_lr_size/ vsr_target_frame, msp_threshold, recheck_interval, min_object_side, dump. enable = 0 keeps the plain detector + ByteTrack baseline.

Note: the vsr_inference header documents the crop layout as HWC, but the TensorRT graph is exported as [1,K,3,H,W] -> [1,K,3,4H,4W] (planar CHW per frame); TrackPostProcessor packs/reads CHW accordingly.

Usage Guide

Basic command syntax:

./MultitargetTracker <video_path> [--example=<num>] [--start_frame=<num>] 
                     [--end_frame=<num>] [--end_delay=<ms>] [--out=<filename>]
                     [--show_logs] [--gpu] [--async] [--res=<filename>]
                     [--settings=<filename>] [--batch_size=<num>]

Example:

./MultitargetTracker ../data/atrium.avi -e=1 -o=../data/atrium_motion.avi

Keyboard Controls:

  • m: Toggle play/pause
  • Any key: Step forward when paused
  • Esc: Exit

Integration as Library

#include <mtracking/BaseTracker.h>

std::unique_ptr<BaseTracker> m_tracker;
TrackerSettings settings;
settings.SetDistance(tracking::DistJaccard);
m_tracker = BaseTracker::CreateTracker(settings);

Third-party Dependencies

License

Apache 2.0 License

Project citations

  1. Jeroen PROVOOST "Camera gebaseerde analysevan de verkeersstromen aaneen kruispunt", 2014 ( https://iiw.kuleuven.be/onderzoek/eavise/mastertheses/provoost.pdf )
  2. Roberto Ciano, Dimitrij Klesev "Autonome Roboterschwarme in geschlossenen Raumen", 2015 ( https://www.hs-furtwangen.de/fileadmin/user_upload/fak_IN/Dokumente/Forschung_InformatikJournal/informatikJournal_2016.pdf#page=18 )
  3. Wenda Qin, Tian Zhang, Junhe Chen "Traffic Monitoring By Video: Vehicles Tracking and Vehicle Data Analysing", 2016 ( http://cs-people.bu.edu/wdqin/FinalProject/CS585%20FinalProjectReport.html )
  4. Ipek BARIS "CLASSIFICATION AND TRACKING OF VEHICLES WITH HYBRID CAMERA SYSTEMS", 2016 ( http://cvrg.iyte.edu.tr/publications/IpekBaris_MScThesis.pdf )
  5. Cheng-Ta Lee, Albert Y. Chen, Cheng-Yi Chang "In-building Coverage of Automated External Defibrillators Considering Pedestrian Flow", 2016 ( http://www.see.eng.osaka-u.ac.jp/seeit/icccbe2016/Proceedings/Full_Papers/092-132.pdf )
  6. Roberto Ciano, Dimitrij Klesev "Autonome Roboterschwarme in geschlossenen Raumen" in "informatikJournal 2016/17", 2017 ( https://docplayer.org/124538994-2016-17-informatikjournal-2016-17-aktuelle-berichte-aus-forschung-und-lehre-der-fakultaet-informatik.html )
  7. Omid Noorshams "Automated systems to assess weights and activity in grouphoused mice", 2017 ( https://pdfs.semanticscholar.org/e5ff/f04b4200c149fb39d56f171ba7056ab798d3.pdf )
  8. RADEK VOPÁLENSKÝ "DETECTION,TRACKING AND CLASSIFICATION OF VEHICLES", 2018 ( https://www.vutbr.cz/www_base/zav_prace_soubor_verejne.php?file_id=181063 )
  9. Márk Rátosi, Gyula Simon "Real-Time Localization and Tracking using Visible Light Communication", 2018 ( https://ieeexplore.ieee.org/abstract/document/8533800 )
  10. Thi Nha Ngo, Kung-Chin Wu, En-Cheng Yang, Ta-Te Lin "A real-time imaging system for multiple honey bee tracking and activity monitoring", 2019 ( https://www.sciencedirect.com/science/article/pii/S0168169919301498 )
  11. Tiago Miguel, Rodrigues de Almeida "Multi-Camera and Multi-Algorithm Architecture for VisualPerception onboard the ATLASCAR2", 2019 ( http://lars.mec.ua.pt/public/LAR%20Projects/Vision/2019_TiagoAlmeida/Thesis_Tiago_AlmeidaVF_26Jul2019.pdf )
  12. ROS, http://docs.ros.org/lunar/api/costmap_converter/html/Ctracker_8cpp_source.html
  13. Sangeeth Kochanthara, Yanja Dajsuren, Loek Cleophas, Mark van den Brand "Painting the Landscape of Automotive Software in GitHub", 2022 ( https://arxiv.org/abs/2203.08936 )
  14. Fesus, A., Kovari, B., Becsi, T., Leginusz, L. "Dynamic Prompt-Based Approach for Open Vocabulary Multi-Object Tracking", 2025 ( https://link.springer.com/chapter/10.1007/978-3-031-81799-1_25 )

Releases

Packages

Used by

Contributors

Languages