Skip to content

OcSort

Paper: Observation-Centric SORT: Rethinking SORT for Robust Multi-Object Tracking

OC-SORT focuses on a specific failure mode in Kalman-filter trackers: error accumulation during occlusion and non-linear motion. The paper replaces a purely prediction-centric view with an observation-centric one, using detector observations to reconstruct a more reliable virtual trajectory across missed frames. That makes the tracker much more robust than vanilla SORT in crowded scenes while keeping the same simple online structure.

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.

Native C++ Backend

BoxMOT ships a native C++17 OcSort implementation under boxmot/native/cpp/trackers/ocsort/. It supports:

  • cached eval and tune streamed through the live typed API
  • live track through --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 uses the first live image to initialize and cache the frame dimensions. 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_byte is 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_conf and 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, and edgetam settings.