Docs /Templates/ sinapsis-rf-trackers

DeepSORTTrackerInference

sinapsis-rf-trackersRFTrackerstrackersimageinferencemodels

Python template · sinapsis_rf_trackers.templates.deepsort_tracker_inference

Overview

This template provides the logic to use the DeepSORT tracker from Roboflow's trackers library. It enhances the basic SORT tracking by incorporating appearance features, making it more robust for challenging tracking scenarios with occlusions and crowded scenes.

Key Features: - Appearance-based re-identification using deep features - Reduced identity switches compared to motion-only trackers - Configurable appearance and motion feature weighting - Support for various CNN backbones via timm library

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-rf-trackers==1.0.0
uv pip install sinapsis-rf-trackers==1.0.0
uv add sinapsis-rf-trackers==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
frame_rate
float
Optional
Default: 30
reid_device

Device to run the Re-ID model on. 'auto' selects CUDA if available. Defaults to "auto".

typing.Literal['auto', 'cuda', 'cpu']
Optional
Default: "auto"
reid_kwargs

Additional keyword arguments to pass to the Re-ID model constructor.

ReIDKwargs
Optional
Default: null
no_jit
bool | None
Optional
Default: null
cache_dir
str
Optional
Default: "/home/ariel/.cache/sinapsis"
exportable
bool | None
Optional
Default: null
scriptable
bool | None
Optional
Default: null
pretrained_cfg
dict[str, typing.Any] | None
Optional
Default: null
checkpoint_path
str | None
Optional
Default: null
pretrained_cfg_overlay
dict[str, typing.Any] | None
Optional
Default: null
distance_metric

Distance metric for appearance feature comparison. Supported metrics include 'cosine' and 'euclidean'. Cosine distance is generally more robust for appearance features. Defaults to "cosine".

str
Optional
Default: "cosine"
reid_model_name

Name of the feature extraction model from timm or a path to a checkpoint. Defaults to "tf_efficientnet_b1.in1k".

str
Optional
Default: "tf_efficientnet_b1.in1k"
appearance_weight

Weight of appearance features versus motion features in the association cost. Higher values prioritize appearance matching, lower values prioritize motion consistency. Defaults to 0.5.

float
Optional
Default: 0.5
lost_track_buffer
int
Optional
Default: 30
appearance_threshold

Threshold for appearance-based matching. Higher values make the tracker more conservative in appearance matching, reducing identity switches but potentially losing tracks during occlusions. Defaults to 0.7.

float
Optional
Default: 0.7
minimum_iou_threshold
float
Optional
Default: 0.3
reid_get_pooled_features

Whether to use pooled features from the Re-ID model. Defaults to True.

bool
Optional
Default: true
minimum_consecutive_frames
int
Optional
Default: 3
track_activation_threshold
float
Optional
Default: 0.25

Configuration example

Example from the Python docstring:

yaml
agent:
      name: deepsort_tracker_agent
    templates:
    - template_name: InputTemplate
      class_name: InputTemplate
      attributes: {}
    - template_name: DeepSORTTrackerInference
      class_name: DeepSORTTrackerInference
      template_input: InputTemplate
      attributes:
        track_activation_threshold: 0.25
        lost_track_buffer: 30
        minimum_consecutive_frames: 3
        minimum_iou_threshold: 0.3
        frame_rate: 30
        appearance_threshold: 0.7
        appearance_weight: 0.5
        distance_metric: "cosine"
        reid_model_name: "tf_efficientnet_b1.in1k"
        reid_device: "auto"
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "DeepSORTTrackerInference"
    class_name: "DeepSORTTrackerInference"
    attributes:
      frame_rate: 30
      reid_device: "auto"
      reid_kwargs:
        no_jit: null
        cache_dir: "/home/ariel/.cache/sinapsis"
        exportable: null
        scriptable: null
        pretrained_cfg: null
        checkpoint_path: null
        pretrained_cfg_overlay: null
      distance_metric: "cosine"
      reid_model_name: "tf_efficientnet_b1.in1k"
      appearance_weight: 0.5
      lost_track_buffer: 30
      appearance_threshold: 0.7
      minimum_iou_threshold: 0.3
      reid_get_pooled_features: true
      minimum_consecutive_frames: 3
      track_activation_threshold: 0.25

Inheritance

Immediate parent: sinapsis_rf_trackers.templates.rf_tracker_base.RFTrackerBase

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_CACHE_DIR · defined elsewhere