OC-SORT Tracker¶
Class: OCSORTBlockV1
Source: inference.core.workflows.core_steps.trackers.ocsort.v1.OCSORTBlockV1
Track objects across video frames using the OC-SORT algorithm from the roboflow/trackers package.
OC-SORT extends SORT with two key mechanisms:
- Observation-Centric Re-Update (OCR): When a track reappears after occlusion, OC-SORT retroactively corrects the Kalman filter using the real observations before and after the gap, reducing accumulated drift.
- Observation-Centric Momentum (OCM): A direction-consistency cost is blended with IoU during association, penalising matches where the candidate detection lies in a direction inconsistent with the track's recent motion.
This makes OC-SORT significantly more robust than SORT in scenes with heavy occlusion, erratic motion, and uniform appearance.
When to use OC-SORT: - Crowded scenes with frequent and prolonged occlusions (e.g. pedestrians, warehouse workers). - Non-linear or erratic motion patterns (e.g. dancing, sports with abrupt direction changes). - When identity consistency over long sequences is more important than raw speed.
When to consider alternatives: - For general-purpose tracking with mixed-confidence detections, try ByteTrack. - For maximum simplicity and speed with a strong detector, try SORT.
Outputs three detection sets: - tracked_detections: All confirmed tracked detections with assigned track IDs. - new_instances: Detections whose track ID appears for the first time. - already_seen_instances: Detections whose track ID has been seen in a prior frame.
The block maintains separate tracker state and instance cache per video_identifier,
enabling multi-stream tracking within a single workflow.
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/trackers_ocsort@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
minimum_iou_threshold |
float |
Minimum IoU required to associate a detection with an existing track. Default: 0.3.. | ✅ |
minimum_consecutive_frames |
int |
Number of consecutive frames a track must be matched before it is emitted as a confirmed track (tracker_id != -1). Default: 3.. | ✅ |
lost_track_buffer |
int |
Number of frames to keep a track alive after it loses its matched detection. Higher values improve occlusion recovery. Default: 30.. | ✅ |
high_conf_det_threshold |
float |
Confidence threshold for high-confidence detections used in association. Default: 0.6.. | ✅ |
direction_consistency_weight |
float |
Weight for the direction consistency term in the OC-SORT association cost. Higher values prioritise alignment between historical motion direction and the direction to the candidate detection. Default: 0.2.. | ✅ |
delta_t |
int |
Number of past frames used by OC-SORT to estimate per-track velocity for direction consistency momentum. Default: 3.. | ✅ |
instances_cache_size |
int |
Maximum number of track IDs retained in the instance cache for new/already-seen categorisation. Uses FIFO eviction. Default: 16384.. | ❌ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to OC-SORT Tracker in version v1.
- inputs:
Object Detection Model,Perspective Correction,SAM 3,BoT-SORT Tracker,Stability AI Inpainting,Image Convert Grayscale,Keypoint Detection Model,Morphological Transformation,Path Deviation,VLM As Detector,Object Detection Model,Line Counter,QR Code Generator,SAM 3,Clip Comparison,YOLO-World Model,Line Counter,Time in Zone,Polygon Zone Visualization,Image Threshold,OC-SORT Tracker,VLM As Detector,Dynamic Crop,Detections Consensus,Heatmap Visualization,Keypoint Visualization,Seg Preview,Stability AI Image Generation,Google Vision OCR,Camera Focus,Label Visualization,SAM 3,Instance Segmentation Model,Identify Outliers,Path Deviation,Contrast Enhancement,Bounding Box Visualization,Overlap Filter,Depth Estimation,Detection Offset,Keypoint Detection Model,Image Contours,EasyOCR,Relative Static Crop,Motion Detection,Polygon Visualization,Byte Tracker,Background Color Visualization,Template Matching,Mask Edge Snap,Instance Segmentation Model,Image Blur,Polygon Visualization,Moondream2,Velocity,SIFT Comparison,Grid Visualization,Detection Event Log,Per-Class Confidence Filter,Triangle Visualization,Object Detection Model,Time in Zone,OCR Model,SIFT Comparison,Detections Filter,Image Stack,Detections Merge,Pixelate Visualization,Stitch Images,Instance Segmentation Model,Detections Stabilizer,Image Slicer,Keypoint Detection Model,Image Preprocessing,SIFT,Line Counter Visualization,Image Slicer,Detections Classes Replacement,Dynamic Zone,Corner Visualization,Stability AI Outpainting,Segment Anything 2 Model,Halo Visualization,Detections Transformation,Color Visualization,Time in Zone,Blur Visualization,Detections List Roll-Up,Classification Label Visualization,Camera Focus,Camera Calibration,Morphological Transformation,Trace Visualization,Detections Stitch,Distance Measurement,Gaze Detection,Reference Path Visualization,Halo Visualization,Byte Tracker,Ellipse Visualization,Model Comparison Visualization,Dot Visualization,PTZ Tracking (ONVIF),SORT Tracker,Identify Changes,Mask Visualization,Pixel Color Count,Crop Visualization,Background Subtraction,Circle Visualization,Text Display,Detections Combine,Bounding Rectangle,ByteTrack Tracker,Absolute Static Crop,SAM2 Video Tracker,Contrast Equalization,Byte Tracker,Icon Visualization,Mask Area Measurement - outputs:
Perspective Correction,BoT-SORT Tracker,Stability AI Inpainting,Path Deviation,Line Counter,Model Monitoring Inference Aggregator,Line Counter,Time in Zone,Stitch OCR Detections,OC-SORT Tracker,Dynamic Crop,Size Measurement,Detections Consensus,Heatmap Visualization,Keypoint Visualization,Label Visualization,Path Deviation,Bounding Box Visualization,Overlap Filter,Detection Offset,Polygon Visualization,Byte Tracker,Background Color Visualization,Mask Edge Snap,Polygon Visualization,Velocity,Detection Event Log,Florence-2 Model,Per-Class Confidence Filter,Triangle Visualization,Time in Zone,Roboflow Custom Metadata,Detections Filter,Detections Merge,Pixelate Visualization,Detections Stabilizer,Roboflow Dataset Upload,Detections Classes Replacement,Dynamic Zone,Segment Anything 2 Model,Corner Visualization,Halo Visualization,Roboflow Dataset Upload,Detections Transformation,Time in Zone,Detections List Roll-Up,Blur Visualization,Color Visualization,Camera Focus,Distance Measurement,Trace Visualization,Detections Stitch,Stitch OCR Detections,Halo Visualization,Byte Tracker,Ellipse Visualization,Model Comparison Visualization,Dot Visualization,PTZ Tracking (ONVIF),SORT Tracker,Mask Visualization,Crop Visualization,Circle Visualization,Detections Combine,Bounding Rectangle,ByteTrack Tracker,SAM2 Video Tracker,Florence-2 Model,Byte Tracker,Roboflow Vision Events,Icon Visualization,Mask Area Measurement
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
OC-SORT Tracker in version v1 has.
Bindings
-
input
image(image): Input image with embedded video metadata (fps and video_identifier). Used to initialise and retrieve per-video tracker state..detections(Union[instance_segmentation_prediction,object_detection_prediction,rle_instance_segmentation_prediction,keypoint_detection_prediction]): Detection predictions for the current frame to track..minimum_iou_threshold(float_zero_to_one): Minimum IoU required to associate a detection with an existing track. Default: 0.3..minimum_consecutive_frames(integer): Number of consecutive frames a track must be matched before it is emitted as a confirmed track (tracker_id != -1). Default: 3..lost_track_buffer(integer): Number of frames to keep a track alive after it loses its matched detection. Higher values improve occlusion recovery. Default: 30..high_conf_det_threshold(float_zero_to_one): Confidence threshold for high-confidence detections used in association. Default: 0.6..direction_consistency_weight(float_zero_to_one): Weight for the direction consistency term in the OC-SORT association cost. Higher values prioritise alignment between historical motion direction and the direction to the candidate detection. Default: 0.2..delta_t(integer): Number of past frames used by OC-SORT to estimate per-track velocity for direction consistency momentum. Default: 3..
-
output
tracked_detections(Union[object_detection_prediction,instance_segmentation_prediction,keypoint_detection_prediction,rle_instance_segmentation_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object ifobject_detection_predictionor Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object ifinstance_segmentation_predictionor Prediction with detected bounding boxes and detected keypoints in form of sv.Detections(...) object ifkeypoint_detection_predictionor Prediction with detected bounding boxes and RLE-encoded segmentation masks in form of sv.Detections(...) object ifrle_instance_segmentation_prediction.new_instances(Union[object_detection_prediction,instance_segmentation_prediction,keypoint_detection_prediction,rle_instance_segmentation_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object ifobject_detection_predictionor Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object ifinstance_segmentation_predictionor Prediction with detected bounding boxes and detected keypoints in form of sv.Detections(...) object ifkeypoint_detection_predictionor Prediction with detected bounding boxes and RLE-encoded segmentation masks in form of sv.Detections(...) object ifrle_instance_segmentation_prediction.already_seen_instances(Union[object_detection_prediction,instance_segmentation_prediction,keypoint_detection_prediction,rle_instance_segmentation_prediction]): Prediction with detected bounding boxes in form of sv.Detections(...) object ifobject_detection_predictionor Prediction with detected bounding boxes and segmentation masks in form of sv.Detections(...) object ifinstance_segmentation_predictionor Prediction with detected bounding boxes and detected keypoints in form of sv.Detections(...) object ifkeypoint_detection_predictionor Prediction with detected bounding boxes and RLE-encoded segmentation masks in form of sv.Detections(...) object ifrle_instance_segmentation_prediction.
Example JSON definition of step OC-SORT Tracker in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/trackers_ocsort@v1",
"image": "<block_does_not_provide_example>",
"detections": "$steps.object_detection_model.predictions",
"minimum_iou_threshold": 0.3,
"minimum_consecutive_frames": 3,
"lost_track_buffer": 30,
"high_conf_det_threshold": 0.6,
"direction_consistency_weight": 0.2,
"delta_t": 3,
"instances_cache_size": "<block_does_not_provide_example>"
}