This project uses the Segment Anything 2 (SAM2) model to remove backgrounds from videos. It's designed to run on Replicate, leveraging GPU acceleration for efficient processing.
- Removes background from input videos
- Allows custom background color selection
- Uses SAM2 for accurate object segmentation
- Supports CUDA acceleration for faster processing
- CUDA 11.7
- Python 3.10
- FFmpeg
- Various Python libraries (see
cog.yaml
for details)
This project is designed to be run on Replicate. To use it:
- Upload your video to Replicate
- Choose a background color (default is green)
- Run the model
- Download the processed video
- The input video is split into frames
- SAM2 is used to segment the main object in the video
- The background is replaced with the chosen color
- The frames are recombined into a video
To set up the development environment:
- Clone this repository
- Install the required dependencies as specified in
cog.yaml
- Download the SAM2 model weights
This project uses the Segment Anything 2 (SAM2) model from Meta AI Research.