Expand description
§Deep OC-SORT: Observation-Centric SORT with appearance
This module implements the Deep OC-SORT algorithm.
Deep OC-SORT: Multi-Pedestrian Tracking by Adaptive Re-Identification Gerard Maggiolino, Adnan Ahmad, Jinkun Cao, Kris Kitani arXiv:2302.11813
§Algorithm overview
Deep OC-SORT extends OC-SORT by adding an appearance term to the association:
- OCM adds a velocity direction-consistency bonus to the IoU before matching.
- ORU replays interpolated observations to correct the Kalman filter after a track is re-associated following a gap.
- Appearance association blends a cosine distance to each track’s feature gallery
with the motion cost. The appearance weight scales with detector confidence (dynamic
appearance) and is gated by
max_cosine_distance. Withappearance_weight = 0the association reduces to plain OC-SORT. - Camera motion compensation (CMC) warps track predictions by a caller-supplied
affine transform before association, for moving-camera footage. The transform is
shared
common::cmcinfrastructure reused by other trackers.
This is a clean-room implementation. The tracker applies a camera-motion transform but does not estimate it: the caller supplies the affine (for example from image registration), keeping the core free of heavy computer-vision dependencies.
§Builds on
utils::kalman- the shared 8-dimensional Kalman filterutils::geometry-iou_batch,tlwh_to_xyah,xyah_to_tlwhutils::assignment-greedy_matchtrackers::common-KalmanTrack,TrackState, andCameraMotion(CMC)trackers::deepsort-NearestNeighborDistanceMetricfor the cosine feature gallery
§Parameters
| Parameter | Default | Description |
|---|---|---|
max_age | 30 | Frames a lost track survives before deletion |
min_hits | 3 | Consecutive matches required to confirm a track |
iou_threshold | 0.3 | Minimum IoU to associate a detection with a track |
delta_t | 3 | Observation window (frames) used to compute velocity (OCM) |
inertia | 0.2 | Weight of the direction-consistency cost bonus (OCM) |
appearance_weight | 0.5 | Blend weight of the appearance cost, scaled by det. score |
max_cosine_distance | 0.2 | Maximum cosine distance for the appearance term to apply |
nn_budget | 100 | Maximum appearance features stored per track |
§Rust API
ⓘ
use trackforge::trackers::deep_ocsort::DeepOcSort;
// `extractor` implements the AppearanceExtractor trait (plug in any Re-ID model).
let mut tracker = DeepOcSort::new(extractor, 30, 3, 0.3, 3, 0.2, 0.5, 0.2, 100);
let tracks = tracker.update(&image, detections)?;
for t in tracks {
println!("ID: {}, Box: {:?}", t.track_id, t.tlwh);
}§Python API
from trackforge import DEEPOCSORT
tracker = DEEPOCSORT(
max_age=30,
min_hits=3,
iou_threshold=0.3,
delta_t=3,
inertia=0.2,
appearance_weight=0.5,
max_cosine_distance=0.2,
nn_budget=100,
)
detections = [([100.0, 100.0, 50.0, 100.0], 0.9, 0)]
embeddings = [[0.1, 0.2, 0.3]] # one appearance vector per detection
tracks = tracker.update(detections, embeddings)
# Moving camera: pass a [a, b, tx, c, d, ty] affine mapping the previous frame
# to the current one (estimate it however you like, e.g. with OpenCV).
camera_motion = [1.0, 0.0, 12.0, 0.0, 1.0, -4.0]
tracks = tracker.update(detections, embeddings, camera_motion)
for track_id, tlwh, score, class_id, det_ind in tracks:
print(f"ID: {track_id}, Box: {tlwh}")§Credit
Clean-room Rust implementation of the algorithm described in the paper above. Original reference implementation: GerardMaggiolino/Deep-OC-SORT.
§Citation
@inproceedings{maggiolino2023deepocsort,
title={Deep OC-SORT: Multi-Pedestrian Tracking by Adaptive Re-Identification},
author={Maggiolino, Gerard and Ahmad, Adnan and Cao, Jinkun and Kitani, Kris},
booktitle={IEEE International Conference on Image Processing (ICIP)},
year={2023}
}Re-exports§
pub use crate::trackers::common::ObsTrack as DeepOcSortTrack;
Structs§
- Deep
OcSort Params - Settings for
DeepOcSort. - Deep
OcSort Tracker - Deep OC-SORT tracker core.