Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sam2 tracker for multiple object using yolo detection prompts in firs… #680

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

adityarauniyar
Copy link

@adityarauniyar adityarauniyar commented Dec 23, 2024

Motivation:

  • The existing YOLO MOT ML backend integration in Label Studio primarily supports BoT-SORT and ByteTrack. While effective, they fall short in cases of complex occlusions or challenging re-identification scenarios.
  • This pipeline improves tracking robustness by combining YOLO's precision in detection with SAM2.1's tracking capabilities.

SAM2.1 Prompting with YOLO11 Detections:

  • At the initial frame, SAM2.1 is prompted using YOLO11 detections (bounding boxes).
  • SAM2.1 now supports tracking multiple objects of varying categories detected by YOLO.

Tracking Across Frames:

  • Tracks objects across frames using SAM2.1's features.
  • Known limitation: New objects appearing later (not present in the initial frame) are not tracked, as SAM2.1 is only prompted in the first frame.

YOLO for Detection:

  • Utilizes Ultralyitcs' built-in methods for object detection.
  • Configurations (e.g., confidence threshold, model variants) are dynamically read from the frontend.

Bounding Box Support for Label Studio:
Outputs bounding boxes for video labeling, aligning with Label Studio's requirements for video annotations.

Implementation Approach:
Class Inheritance:

  • Created a new class VideoRectangleWithSam2Tracker, inheriting from VideoRectangle in the YOLO ML backend example.

Overridden predict_region():

  • Replaced default bounding box prediction logic with SAM2.1 tracker integration.
  • Added support for a custom XML tag attribute (model_sam_tracker) to toggle the SAM2.1-based tracker.

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.

1 participant