Skip to content

danielkorth/dam4sam-multi

Repository files navigation

Multi-Object Tracking Extension for DAM4SAM

teaser.mp4

Overview

This project extends the DAM4SAM tracker to support multi-object tracking. The original DAM4SAM introduced a distractor-aware memory mechanism that significantly improves tracking robustness against distractors. This extension builds upon that foundation to enable tracking of multiple objects simultaneously.

⚠️ Disclaimer: This multi-object tracking extension is implemented as a hacky modification to the original DAM4SAM codebase. While the modifications work for multi-object tracking scenarios, they may result in output masks that are not 100% identical to the original single-object implementation. However, visual differences are typically very slight and often imperceptible in practice. Use at your own discretion for applications requiring exact mask consistency with the original DAM4SAM.

Key Features

  • Multi-Object Tracking: Track multiple objects simultaneously in video sequences
  • Interactive Box Selection: User-friendly interface for selecting multiple bounding boxes
  • Distractor-Aware Memory: Inherits the robust distractor handling from the original DAM4SAM
  • Video Output: Generate annotated videos showing tracking results

Installation

For installation instructions and detailed setup, please refer to the original DAM4SAM repository.

Quick Start

Run the multi-object tracking demo on a sequence of frames:

CUDA_VISIBLE_DEVICES=0 python run_bbox_example.py --input_dir <frames-dir> --output_dir <output-dir> --ext <frame-ext> --make_video True

Parameters:

  • <frames-dir>: Path to directory containing video frames
  • <frame-ext>: Frame file extension (default: jpg)
  • <output-dir>: Output directory for saving tracking results (optional)

Usage:

  1. The script will display the first frame
  2. Click and drag to draw bounding boxes around objects you want to track
  3. Press ENTER when done selecting boxes
  4. The tracker will process all frames and save results

Acknowledgments

This work is built upon the excellent research and implementation of:

  • DAM4SAM by Jovana Videnović, Alan Lukežič, and Matej Kristan - A Distractor-Aware Memory for Visual Object Tracking with SAM2
  • SAM 2 by Meta FAIR - Segment Anything Model 2

Citation

If you use this multi-object tracking extension, please cite the original DAM4SAM paper:

@InProceedings{dam4sam,
  author = {Videnovic, Jovana and Lukezic, Alan and Kristan, Matej},
  title = {A Distractor-Aware Memory for Visual Object Tracking with {SAM2}},
  booktitle = {Comp. Vis. Patt. Recognition},
  year = {2025}
}

License

This project follows the same license as the original DAM4SAM repository. Please refer to the original repository for licensing details.

About

Extend DAM4SAM to Multi-Object Tracking

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published