Skip to content

daniel-guooo/Automatic-Hand-Tracking-using-SAM2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automatic Hand Tracking with SAM

This project implements automatic hand tracking in videos using SAM2. It detects and masks hands in each frame of a video and outputs the processed video.

Features

  • Hand Detection: Detects hand locations in video frames.
  • Hand Masking: Generates segmentation masks for detected hands using SAM.
  • Video Processing: Outputs a processed video with hands masked.

Prerequisites

  • Python 3.8 or higher
  • NVIDIA GPU with CUDA support (recommended for faster processing)

Installation

  1. Clone the repository:

    git clone https://github.com/your-repo/automatic-hand-tracking.git
    cd automatic-hand-tracking
  2. Install dependencies:

    pip install -r requirements.txt
  3. Download the SAM checkpoint:

    wget -O sam_vit_b.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth

Usage

  1. Prepare your input video and place it in the project directory.

  2. Run the script to process the video:

    python hand_tracking.py --input_path <input_video_path> --output_path <output_video_path>

    Replace <input_video_path> with the path to your input video and <output_video_path> with the desired output path.

  3. The processed video with masked hands will be saved at the specified output location.

Dependencies

See requirements.txt for a list of dependencies.

Acknowledgements

This project utilizes Segment Anything Model (SAM) by Facebook Research.

About

Automatic Hand Tracking

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors