Update README.md
Browse files
README.md
CHANGED
|
@@ -13,14 +13,41 @@ license: mit
|
|
| 13 |
|
| 14 |
# π SAM2 + MatAnyone Video Background Changer
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
- **Segmentation
|
| 19 |
-
- **Matting
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
- **Lazy Loading**: Models are loaded into GPU memory only when needed, keeping the Space resource-efficient.
|
| 24 |
-
- **GPU Optimization**: The Space is configured to use a T4 Small GPU for a balance of performance and availability.
|
| 25 |
-
- **Gradio Interface**: A simple and intuitive user interface for uploading videos and background images.
|
| 26 |
-
- **Memory Management**: After each run, models are offloaded and the GPU cache is cleared to minimize costs.
|
|
|
|
| 13 |
|
| 14 |
# π SAM2 + MatAnyone Video Background Changer
|
| 15 |
|
| 16 |
+
A Hugging Face Space for high-quality **video background replacement** using cutting-edge AI models:
|
| 17 |
|
| 18 |
+
- π¦Ύ **Segmentation:** [Segment Anything 2 (SAM2)](https://github.com/facebookresearch/segment-anything-2) for precise, state-of-the-art foreground detection.
|
| 19 |
+
- π¬ **Matting:** [MatAnyone](https://github.com/pq-yang/MatAnyone) for cinema-quality subject/background compositing.
|
| 20 |
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## β¨ Key Features
|
| 24 |
+
|
| 25 |
+
- ποΈ **Cinema-Quality Two-Stage Processing:**
|
| 26 |
+
Original β Green Screen β Final Background, for ultra-clean edge separation and realistic results.
|
| 27 |
+
- πΌοΈ **4 Background Methods:**
|
| 28 |
+
- π· Upload custom images
|
| 29 |
+
- π¨ Use professional presets
|
| 30 |
+
- π Create custom gradients
|
| 31 |
+
- π€ Generate backgrounds with AI prompts
|
| 32 |
+
- β‘ **Lazy Model Loading & GPU Optimization:**
|
| 33 |
+
Efficient use of the T4 GPU β models are loaded only when needed.
|
| 34 |
+
- π₯οΈ **Intuitive Gradio Interface:**
|
| 35 |
+
Just upload your video, pick a background, and hit process!
|
| 36 |
+
- π§Ή **Automatic Memory Management:**
|
| 37 |
+
Models and GPU cache are cleared after each run for maximum reliability.
|
| 38 |
+
|
| 39 |
+
---
|
| 40 |
+
|
| 41 |
+
## βοΈ Configuration Notice
|
| 42 |
+
|
| 43 |
+
> **Required Model Configs:**
|
| 44 |
+
> This app requires one or more [SAM2 model config YAML files](https://github.com/facebookresearch/segment-anything-2/tree/main/configs) to be present in a `configs/` directory at the root of your repo.
|
| 45 |
+
>
|
| 46 |
+
> **Examples:**
|
| 47 |
+
> - `configs/sam2_hiera_large.yaml` (**recommended**)
|
| 48 |
+
> - `configs/sam2_hiera_tiny.yaml` (for CPU/fallback)
|
| 49 |
+
>
|
| 50 |
+
> If missing, download from the official SAM2 repo and add them to `configs/`.
|
| 51 |
+
|
| 52 |
+
### π Example Directory Structure
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|