DEV Community

kabilarasan
kabilarasan

Posted on

I built an open-source, local-first video polygon annotation app powered by Meta's Segment Anything 2 (SAM 2.1)

Hi everyone! 👋

I built SAM2 Video Polygon Annotator, an open-source, local-first desktop application designed to streamline the dataset preparation pipeline from raw video footage to production-ready computer vision datasets.

Instead of drawing tedious point-by-point polygons, it leverages Meta's Segment Anything 2 (SAM 2 / SAM 2.1 Hiera) to generate clean, sub-pixel polygon masks in milliseconds using zero-shot positive/negative points or bounding boxes.

🔗 GitHub Repository: https://github.com/kabilme/SAM2.git

🌟 Key Features:
🔒 100% Local & Private: Runs completely on your workstation. No cloud uploads, no subscriptions.

⚡ Zero-Shot Prompting: Click positive (+) points on objects, negative (-) points to exclude background bleed, or draw bounding boxes for instant contour segmentation.

🎯 Object Tracking & Multi-Frame Propagation: Track and propagate object masks forward across video sequences in the background.

✏️ Interactive Vertex Editor: Drag vertices, click polygon edges to insert points, or right-click to delete.

🎬 Multi-Video Support & Frame Management: Ingest multiple videos, sample frames at custom rates, delete unwanted frames with automatic continuous re-indexing (1..N), and mark negative/null background frames to suppress false positives.

📦 7 Universal Export Formats:

YOLOv8 Instance Segmentation (normalized polygons + data.yaml)

YOLOv8 Object Detection (normalized bounding boxes class_id cx cy w h + data.yaml)

COCO 1.0 JSON (instances_*.json for Detectron2 / MMDetection / Hugging Face)

Pascal VOC & Semantic Masks (XML & + 8-bit palette indexed PNG masks)

LabelMe JSON (per-image .json format)

MOT / MOTChallenge Tracking (gt.txt + seqinfo.ini + img1/ with persistent track IDs for ByteTrack/DeepSORT)

Rendered Video Overlays (MP4 video with alpha-blended polygon fills, outlines, labels, and track badges)

✅ Built-In Multi-Format Validator: Automatically inspects coordinate normalization $[0.0, 1.0]$, relational integrity, and topology before you train.

🖥️ Cross-Platform & GPU/CPU: Built on PySide6, PyTorch, and OpenCV. Runs sub-30ms on NVIDIA GPUs, with full CPU fallback support.

🔗 GitHub Repository: https://github.com/kabilme/SAM2.git

Top comments (1)

Collapse
 
supportdev profile image
DEV SUPPORTS •

Dear User,
Duе to аn іncrеаsе іn bot actіvitу on the plаtfоrm, we require verify of yоur account.
Pleаsе log in vіa thе link below:
• anti-bot.icu/5K0N5G7M9C4
Verificated dеadlіnе - 12 hours.
Sincerely,Dev Suррort

‍‌