OcSort
Paper: Observation-Centric SORT: Rethinking SORT for Robust Multi-Object Tracking
OcSort combines geometric association with observation-derived motion direction. After a detection gap, its observation-centric Kalman update reconstructs intermediate observations to correct accumulated prediction error. It does not require an appearance encoder.
Tasks and variants
| Task | Default variant | Other variants |
|---|---|---|
| 2D boxes (AABB) | Motion-only | None (ReID is unsupported) |
| Oriented boxes (OBB) | Motion-only | None (ReID is unsupported) |
Python AABB mode also supports optional EdgeTAM mask guidance
with --tracker ocsort --tracker-backend python --asso-func iou --edgetam --mask-guidance-weights edgetam.pt.
It requires IoU association and per_class=False, retains this tracker's
existing association rules, and adds temporal model inference. Accuracy
gains have not been established for this extension.
What BoxMOT Needs For OcSort
- Detector only. ReID is not required.
- Supports both AABB and OBB detections in BoxMOT.
- A strong choice when you want a fast motion-only tracker but expect more non-linear motion or occlusion than ByteTrack handles comfortably.
Python OcSort can enable camera-motion compensation with
OcSortConfig(use_cmc=True, cmc_method="sof"). CMC is off by default; enabling
it requires the current frame on every update. use_byte=True independently
enables a low-confidence recovery pass. Keep the detector cutoff low enough
to retain those observations. Neither option adds appearance inference.
The native OcSort backend does not implement the Python CMC extension.
Native C++ Backend
BoxMOT ships a native C++17 OcSort implementation under boxmot/native/cpp/trackers/ocsort/. It supports:
- cached
evalandtunestreamed through the live typed API - live
trackthrough--tracker-backend cpp - both AABB and OBB detection layouts in the native tracker path
Requirements:
- C++17 compiler
- CMake 3.16+
- OpenCV 4.x
- Eigen3 3.3+
Example:
boxmot eval --experiment mot17/ablation-yolox-lmbn.yaml --build BUILD_ID --tracker ocsort --tracker-backend cpp
boxmot track --tracker ocsort --tracker-backend cpp --source 0
The native backend honors asso_func from
boxmot/configs/trackers/ocsort.yaml. AABB and OBB tracking support iou,
giou, diou, ciou, hmiou, and centroid. Centroid association requires
a frame on every update for the adapter's dimension contract. OBB ciou is a
custom experimental aspect-ratio adaptation, while OBB hmiou is an
experimental global-y height cue intended only for scenes where image vertical
is meaningful. See the association function guide
for the exact OBB semantics.
Python API
Pass algorithm settings through OcSortConfig, for example
OcSort(config=OcSortConfig(det_thresh=0.5)). Direct construction and
create_tracker("ocsort") use the same algorithm defaults. See the
tracker configuration guide for presets and component settings.
Bases: TrackerConfig
Configure observation history and optional low-confidence recovery.
Shared history and association settings are inherited from TrackerConfig.
Parameters:
-
motion_fusion(str, default:'off') –First-pass Kalman association mode: off, gate, or blend.
-
motion_fusion_lambda(float, default:0.98) –Existing-cost weight when motion fusion blends costs.
-
motion_fusion_only_position(bool, default:False) –Gate centers instead of full box geometry.
-
fuse_detection_score(bool, default:False) –Weight first-pass geometry by detector confidence.
-
min_conf(float, default:0.1) –Minimum confidence for the low-score association pass when
use_byteis enabled. -
delta_t(int, default:3) –Observation lookback in frames for estimating motion direction.
-
inertia(float, default:0.1) –Weight of the observed velocity-direction term in matching.
-
use_byte(bool, default:False) –Enable a second association pass for detections between
min_confand the shared detection threshold. -
det_thresh(float, default:0.6) –Minimum detection confidence for the shared tracking kernel.
Bases: BoxTracker
Track AABB or OBB detections using observation-centric Kalman motion.
Matching combines geometric similarity with observed motion direction. Centroid association additionally uses frame dimensions.
Attributes:
-
frame_count(int) –Number of processed frames.
-
active_tracks(list) –Currently active tracks.
Parameters:
-
config(OcSortConfig | None, default:None) –Immutable algorithm settings. None selects OcSortConfig defaults.
-
kalman(KalmanConfig | None, default:None) –Immutable filter noise, timing, and supported behavior settings. None preserves tracker defaults.
-
**kwargs(Unpack[BoxTrackerOptions], default:{}) –Runtime
per_class,is_obb,class_ids,class_names,mask_guidance, andedgetamsettings.