Spaces:
Running
on
Zero
Running
on
Zero
Update README.md
Browse files
README.md
CHANGED
@@ -1,113 +1,14 @@
|
|
1 |
-
<h1 align="center">
|
2 |
-
<span style="color:#2196f3;"><b>MiniMax</b></span><span style="color:#f06292;"><b>-Remover</b></span>: Taming Bad Noise Helps Video Object Removal
|
3 |
-
</h1>
|
4 |
-
|
5 |
-
<p align="center">
|
6 |
-
Bojia Zi<sup>*</sup>,
|
7 |
-
Weixuan Peng<sup>*</sup>,
|
8 |
-
Xianbiao Qi<sup>†</sup>,
|
9 |
-
Jianan Wang, Shihao Zhao, Rong Xiao, Kam-Fai Wong<br>
|
10 |
-
<sup>*</sup> Equal contribution. <sup>†</sup> Corresponding author.
|
11 |
-
</p>
|
12 |
-
|
13 |
-
<p align="center">
|
14 |
-
<a href="https://huggingface.co/zibojia/minimax-remover"><img alt="Huggingface Model" src="https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-Model-brightgreen"></a>
|
15 |
-
<a href="https://github.com/zibojia/MiniMax-Remover"><img alt="Github" src="https://img.shields.io/badge/MiniMaxRemover-github-black"></a>
|
16 |
-
<a href="https://huggingface.co/spaces/zibojia/MiniMaxRemover"><img alt="Huggingface Space" src="https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-Space-1e90ff"></a>
|
17 |
-
<a href="https://arxiv.org/abs/2505.24873"><img alt="arXiv" src="https://img.shields.io/badge/MiniMaxRemover-arXiv-b31b1b"></a>
|
18 |
-
<a href="https://www.youtube.com/watch?v=KaU5yNl6CTc"><img alt="YouTube" src="https://img.shields.io/badge/Youtube-video-ff0000"></a>
|
19 |
-
<a href="https://minimax-remover.github.io"><img alt="Demo Page" src="https://img.shields.io/badge/Website-Demo%20Page-yellow"></a>
|
20 |
-
</p>
|
21 |
-
|
22 |
-
---
|
23 |
-
|
24 |
-
## 🚀 Overview
|
25 |
-
|
26 |
-
**MiniMax-Remover** is a fast and effective video object remover based on minimax optimization. It operates in two stages: the first stage trains a remover using a simplified DiT architecture, while the second stage distills a robust remover with CFG removal and fewer inference steps.
|
27 |
-
|
28 |
-
---
|
29 |
-
|
30 |
-
## ✨ Features:
|
31 |
-
|
32 |
-
* **Fast:** Requires only 6 inference steps and does not use CFG, making it highly efficient.
|
33 |
-
|
34 |
-
* **Effective:** Seamlessly removes objects from videos and generates high-quality visual content.
|
35 |
-
|
36 |
-
* **Robust:** Maintains robustness by preventing the regeneration of undesired objects or artifacts within the masked region, even under varying noise conditions.
|
37 |
-
|
38 |
-
---
|
39 |
-
|
40 |
-
## 🛠️ Installation
|
41 |
-
|
42 |
-
All dependencies are listed in `requirements.txt`.
|
43 |
-
|
44 |
-
```bash
|
45 |
-
pip install -r requirements.txt
|
46 |
-
```
|
47 |
-
|
48 |
---
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
```bash
|
60 |
-
cd gradio_demo
|
61 |
-
python3 test.py
|
62 |
-
```
|
63 |
-
|
64 |
-
---
|
65 |
-
|
66 |
-
## 📂 Download
|
67 |
-
|
68 |
-
```shell
|
69 |
-
huggingface-cli download zibojia/minimax-remover --include vae transformer scheduler --local-dir .
|
70 |
-
```
|
71 |
-
|
72 |
-
---
|
73 |
-
|
74 |
-
## ⚡ Quick Start
|
75 |
-
|
76 |
-
### Minimal Example
|
77 |
-
|
78 |
-
```python
|
79 |
-
import torch
|
80 |
-
from diffusers.utils import export_to_video
|
81 |
-
from decord import VideoReader
|
82 |
-
from diffusers.models import AutoencoderKLWan
|
83 |
-
from transformer_minimax_remover import Transformer3DModel
|
84 |
-
from diffusers.schedulers import UniPCMultistepScheduler
|
85 |
-
from pipeline_minimax_remover import Minimax_Remover_Pipeline
|
86 |
-
|
87 |
-
random_seed = 42
|
88 |
-
video_length = 81
|
89 |
-
device = torch.device("cuda:0")
|
90 |
-
|
91 |
-
# Load model weights separately
|
92 |
-
vae = AutoencoderKLWan.from_pretrained("./vae", torch_dtype=torch.float16)
|
93 |
-
transformer = Transformer3DModel.from_pretrained("./transformer", torch_dtype=torch.float16)
|
94 |
-
scheduler = UniPCMultistepScheduler.from_pretrained("./scheduler")
|
95 |
-
|
96 |
-
images = # images in range [-1, 1]
|
97 |
-
masks = # masks in range [0, 1]
|
98 |
-
|
99 |
-
# Initialize the pipeline (pass the loaded weights as objects)
|
100 |
-
pipe = Minimax_Remover_Pipeline(vae=vae, transformer=transformer, \
|
101 |
-
scheduler=scheduler, torch_dtype=torch.float16
|
102 |
-
).to(device)
|
103 |
-
|
104 |
-
result = pipe(images=images, masks=masks, num_frames=video_length, height=480, width=832, \
|
105 |
-
num_inference_steps=12, generator=torch.Generator(device=device).manual_seed(random_seed), iterations=6 \
|
106 |
-
).frames[0]
|
107 |
-
export_to_video(result, "./output.mp4")
|
108 |
-
```
|
109 |
---
|
110 |
|
111 |
-
|
112 |
-
|
113 |
-
Feel free to send an email to [[email protected]](mailto:[email protected]) if you have any questions or suggestions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: MiniMax Remover
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 5.34.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: cc-by-nc-2.0
|
11 |
+
short_description: MiniMax-Remover is a fast and effective video object remover
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|