Skip to content

Conversation

soumik12345
Copy link
Contributor

@soumik12345 soumik12345 commented Apr 14, 2025

Description

Create SORTTracker as an implementation of the SORT (Simple Online and Realtime Tracking).

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Example Usage

import numpy as np
import supervision as sv
from rfdetr import RFDETRBase
from rfdetr.util.coco_classes import COCO_CLASSES
from trackers import SORTTracker


model = RFDETRBase(device="mps")
tracker = SORTTracker()

def callback(frame: np.ndarray, _: int):
    detections = model.predict(frame, threshold=0.5)
    detections = tracker.update_with_detections(detections)

    labels = [
        f"{COCO_CLASSES[class_id]} {confidence:.2f}"
        for class_id, confidence in zip(detections.class_id, detections.confidence)
    ]

    annotated_image = frame.copy()
    annotated_image = sv.BoxAnnotator().annotate(annotated_image, detections)
    annotated_image = sv.LabelAnnotator().annotate(annotated_image, detections, labels)

    return annotated_image

sv.process_video(
    source_path="data/traffic_video.mp4",
    target_path="data/out.mp4",
    callback=callback,
)

Docs

  • Docs updated?

@soumik12345 soumik12345 requested a review from SkalskiP April 14, 2025 18:04
@SkalskiP SkalskiP merged commit 622c70b into main Apr 14, 2025
16 checks passed
soumik12345 added a commit that referenced this pull request Apr 17, 2025
feat(GTR): A barebones repository setup for GTR
@soumik12345 soumik12345 deleted the feat/sort-tracker branch April 17, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants