Skip to content

SFSORT

Paper: SFSORT: Scene Features-based Simple Online Real-Time Tracker

SFSORT associates boxes without a Kalman filter or an appearance encoder. Its two matching stages use box similarity, while image regions distinguish the retention of tracks lost near the boundary from those lost centrally.

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 sfsort --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 SFSORT

  • Detector only. ReID is not required.
  • Supports both AABB and OBB detections in BoxMOT.
  • Best when throughput matters most and you want a very lightweight online tracker.

SFSORT also needs image dimensions for its scene regions. Supply a Frame or NumPy image on every update, or set both positive frame_width and frame_height in SFSORTConfig. For example, SFSORT(config=SFSORTConfig(frame_width=1920, frame_height=1080)) can process detections without a frame when mask guidance is disabled. The ordinary tracker uses dimensions, not image pixels. Both Python and native SFSORT use fixed steps and reject variable timing and Kalman settings. Capture timestamps remain metadata; AABB association uses observed boxes, OBB angle smoothing runs per update, and region timeouts count updates.

marginal_timeout and central_timeout count updates and both default to zero. Increase them explicitly if tracks lost near image edges or in the central region should remain available for recovery. dynamic_tuning is off by default.

Native C++ Backend

BoxMOT also ships a native C++17 SFSORT implementation under boxmot/native/cpp/trackers/sfsort/. 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 sfsort --tracker-backend cpp
boxmot track --tracker sfsort --tracker-backend cpp --source 0

Python API

Pass algorithm settings through SFSORTConfig, for example SFSORT(config=SFSORTConfig(high_th=0.6)). Direct construction and create_tracker("sfsort") use the same algorithm defaults. See the tracker configuration guide for presets and component settings.

Bases: TrackerConfig

Configure confidence stages, density adjustments, and image regions.

Shared history and association settings are inherited from TrackerConfig. Match thresholds and their dynamic adjustment apply to overlap metrics. Centroid matching uses centroid_max_distance; box cues still rank pairs.

Parameters:

  • high_th (float | None, default: 0.6 ) –

    Confidence threshold for first-pass detections.

  • match_th_first (float | None, default: 0.67 ) –

    Maximum geometric cost for the first association pass; smaller values require closer matches.

  • new_track_th (float | None, default: 0.7 ) –

    Minimum confidence for creating a new track.

  • low_th (float | None, default: 0.1 ) –

    Minimum confidence for second-pass detections.

  • match_th_second (float | None, default: 0.3 ) –

    Maximum geometric cost for the second association pass.

  • fuse_detection_score (bool, default: False ) –

    Weight high-confidence association similarity by detection confidence before applying mask and centroid gates.

  • dynamic_tuning (bool, default: False ) –

    Adjust thresholds using the current detection count.

  • cth (float | None, default: 0.5 ) –

    Confidence cutoff for detections counted by dynamic tuning.

  • high_th_m (float | None, default: 0.0 ) –

    Scale for decreasing high_th during dynamic tuning.

  • new_track_th_m (float | None, default: 0.0 ) –

    Scale for increasing new_track_th during dynamic tuning.

  • match_th_first_m (float | None, default: 0.0 ) –

    Scale for decreasing match_th_first during dynamic tuning.

  • obb_theta_damping (float, default: 0.8 ) –

    Previous angular-update weight in OBB smoothing; larger values reduce the influence of the latest angle change.

  • marginal_timeout (int | None, default: 0 ) –

    Frames to retain tracks lost near an image edge.

  • central_timeout (int | None, default: 0 ) –

    Frames to retain tracks lost inside the central region.

  • frame_width (int | None, default: None ) –

    Optional width in pixels; configure together with frame_height, or supply frame dimensions during updates.

  • frame_height (int | None, default: None ) –

    Optional height in pixels, paired with frame_width.

  • horizontal_margin (int | None, default: 0 ) –

    Left and right margin size in pixels.

  • vertical_margin (int | None, default: 0 ) –

    Top and bottom margin size in pixels.

__post_init__

__post_init__() -> None

Normalize default-valued inputs and validate paired dimensions.

Bases: BoxTracker

Track AABB or OBB detections with geometric matching and region timeouts.

Uses observed boxes and OBB angle smoothing without a Kalman filter. Frame dimensions define central and marginal regions; image pixels and appearance embeddings are unused.

Parameters:

  • config (SFSORTConfig | None, default: None ) –

    Immutable algorithm settings. None selects SFSORTConfig defaults.

  • **kwargs (Unpack[BoxTrackerOptions], default: {} ) –

    Runtime per_class, is_obb, class_ids, class_names, mask_guidance, and edgetam settings.

calculate_cost staticmethod

calculate_cost(
    tracks: list[Track],
    boxes: ndarray,
    iou_only: bool = False,
    is_obb: bool = False,
    association_function: Callable[
        [ndarray, ndarray], ndarray
    ]
    | None = None,
) -> ndarray

Calculate cost from the selected geometry and SFSORT box cues.