Skip to content

Commit 8a6f4f9

Browse files
Merge pull request #65 from linkedlist771/optical-flow-generation-fix
Add a High-Quality cleaner model with Temporal Consistency
2 parents d57915e + d8e4b69 commit 8a6f4f9

File tree

91 files changed

+4607
-906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+4607
-906
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,6 @@ data
228228
upload_to_huggingface.py
229229
resources/best.pt
230230
resources/model_version.json
231-
.web
231+
.web
232+
examples
233+
resources/checkpoint

README-zh.md

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,30 @@
66

77
<table>
88
<tr>
9-
<td width="50%">
10-
<h3 align="center">移除水印后</h3>
9+
<td width="33%">
10+
<h3 align="center">快速移除</h3>
1111
<video src="https://github.com/user-attachments/assets/8cdc075e-7d15-4d04-8fa2-53dd287e5f4c" width="100%"></video>
1212
</td>
13-
<td width="50%">
13+
<td width="33%">
14+
<h3 align="center">更好的移除效果</h3>
15+
<video src="https://github.com/user-attachments/assets/4f032fc7-97da-471b-9a54-9de2a434fa57" width="100%"></video>
16+
</td>
17+
<td width="33%">
1418
<h3 align="center">原始视频</h3>
1519
<video src="https://github.com/user-attachments/assets/4f032fc7-97da-471b-9a54-9de2a434fa57" width="100%"></video>
1620
</td>
1721
</tr>
1822
</table>
1923
⭐️:
2024

21-
1. **我们现在支持批量处理了。**
22-
2. **对于带用户名的新水印,Yolo 权重已更新** — 请尝试新版本的水印检测模型,效果会更好!
25+
- **我们提供了另一个模型,可以保持时间一致性,无闪烁!**
26+
27+
- **我们现在支持批量处理了。**
28+
- **对于带用户名的新水印,Yolo 权重已更新** — 请尝试新版本的水印检测模型,效果会更好!
29+
30+
- **数据集已开源** — 我们已经将标注好的数据集上传到了 Hugging Face,查看[此数据集](https://huggingface.co/datasets/LLinked/sora-watermark-dataset)。欢迎训练你自己的检测模型或改进我们的模型!
2331

24-
3. **数据集已开源** — 我们已经将标注好的数据集上传到了 Hugging Face,查看[此数据集](https://huggingface.co/datasets/LLinked/sora-watermark-dataset)。欢迎训练你自己的检测模型或改进我们的模型!
25-
4. **一键便携版已发布**[点击这里下载](#3-一键便携版),Windows 用户无需安装即可使用!
32+
- **一键便携版已发布**[点击这里下载](#3-一键便携版),Windows 用户无需安装即可使用!
2633

2734
---
2835

@@ -62,22 +69,22 @@ uv sync
6269
训练好的 YOLO 权重将存储在 `resources` 目录中,文件名为 `best.pt`。它将从 https://github.com/linkedlist771/SoraWatermarkCleaner/releases/download/V0.0.1/best.pt 自动下载。`Lama` 模型从 https://github.com/Sanster/models/releases/download/add_big_lama/big-lama.pt 下载,并将存储在 torch 缓存目录中。两者都是自动下载的,如果失败,请检查你的网络状态。
6370
6471
3. 批量处理
65-
Use the cli.py for batch processing
72+
使用 cli.py 进行批量处理
6673
6774
```
6875
python cli.py [-h] -i INPUT -o OUTPUT [-p PATTERN] [--quiet]
6976
```
7077
71-
examples:
78+
示例:
7279

7380
```
74-
# Process all .mp4 files in input folder
81+
# 处理输入文件夹中的所有 .mp4 文件
7582
python batch_process.py -i /path/to/input -o /path/to/output
76-
# Process all .mov files
83+
# 处理所有 .mov 文件
7784
python batch_process.py -i /path/to/input -o /path/to/output --pattern "*.mov"
78-
# Process all video files (mp4, mov, avi)
85+
# 处理所有视频文件(mp4, mov, avi
7986
python batch_process.py -i /path/to/input -o /path/to/output --pattern "*.{mp4,mov,avi}"
80-
# Without displaying the Tqdm bar inside sorawm procrssing.
87+
# 不显示 sorawm 处理过程中的 Tqdm 进度条
8188
python batch_process.py -i /path/to/input -o /path/to/output --quiet
8289
```
8390

@@ -106,29 +113,37 @@ python batch_process.py -i /path/to/input -o /path/to/output --quiet
106113

107114
基本用法,只需尝试 `example.py`
108115

109-
```python
116+
> 我们提供了两个模型来移除水印。LAMA 速度快但在清理区域可能会有闪烁,而 E2FGVI_HQ 可以解决这个问题,但只在 CUDA 上运行,否则在 CPU 或 MPS 上会非常慢。
110117
118+
```python
111119
from pathlib import Path
112-
from sorawm.core import SoraWM
113120

121+
from sorawm.core import SoraWM
122+
from sorawm.schemas import CleanerType
114123

115124
if __name__ == "__main__":
116-
input_video_path = Path(
117-
"resources/dog_vs_sam.mp4"
118-
)
119-
output_video_path = Path("outputs/sora_watermark_removed.mp4")
120-
sora_wm = SoraWM()
121-
sora_wm.run(input_video_path, output_video_path)
125+
input_video_path = Path("resources/dog_vs_sam.mp4")
126+
output_video_path = Path("outputs/sora_watermark_removed")
127+
128+
# 1. LAMA 速度快,质量好,但时间上不一致
129+
sora_wm = SoraWM(cleaner_type=CleanerType.LAMA)
130+
sora_wm.run(input_video_path, f"{output_video_path}_lama.mp4")
131+
132+
# 2. E2FGVI_HQ 确保时间一致性,但在非 CUDA 设备上会非常慢
133+
sora_wm = SoraWM(cleaner_type=CleanerType.E2FGVI_HQ)
134+
sora_wm.run(input_video_path, f"{output_video_path}_e2fgvi_hq.mp4")
122135

123136
```
124137

125138
我们还提供了基于 `streamlit` 的交互式网页界面,使用以下命令尝试:
126139

140+
> 我们也在这里提供了切换选项。
141+
127142
```bash
128143
streamlit run app.py
129144
```
130145

131-
<img src="resources/app.png" style="zoom: 25%;" />
146+
<img src="assests/model_switch.png" style="zoom: 25%;" />
132147

133148
现在也支持批量处理,你可以拖入一个文件夹或选择多个文件进行处理。
134149
<img src="assests/streamlit_batch.png" style="zoom: 50%;" />
@@ -140,25 +155,33 @@ streamlit run app.py
140155

141156
只需运行:
142157

143-
```python
158+
```
144159
python start_server.py
145160
```
146161

147-
Web 服务器将在端口 `5344` 启动,你可以查看 FastAPI [文档](http://localhost:5344/docs) 了解详情,有三个路由:
162+
Web 服务器将在端口 **5344** 启动。
163+
164+
你可以查看 FastAPI [文档](http://localhost:5344/docs) 了解详情。
148165

149-
1. submit_remove_task:
166+
有三个路由可用:
167+
168+
1. **submit_remove_task**
150169

151170
> 上传视频后,会返回一个任务 ID,该视频将立即被处理。
152171
153-
<img src="resources/53abf3fd-11a9-4dd7-a348-34920775f8ad.png" alt="image" style="zoom: 25%;" />
172+
<img src="resources/53abf3fd-11a9-4dd7-a348-34920775f8ad.png" alt="image" style="zoom: 25%;" />
173+
174+
2. **get_results**
175+
176+
你可以使用上面的任务 ID 检索任务状态。
154177

155-
2. get_results:
178+
它会显示视频处理完成的百分比。
156179

157-
你可以使用上面的任务 ID 检索任务状态,它会显示视频处理的百分比。一旦完成,返回的数据中会有下载 URL。
180+
一旦完成,返回的数据中会包含一个**下载 URL**
158181

159-
3. downlaod:
182+
3. **download**
160183

161-
你可以使用第2步中的下载 URL 来获取清理后的视频。
184+
你可以使用第2步中的**下载 URL** 来获取清理后的视频。
162185

163186
## 6. 数据集
164187

README.md

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,31 @@ This project provides an elegant way to remove the sora watermark in the sora2 g
66

77
<table>
88
<tr>
9-
<td width="50%">
10-
<h3 align="center">Watermark removed</h3>
11-
<video src="https://github.com/user-attachments/assets/8cdc075e-7d15-4d04-8fa2-53dd287e5f4c" width="100%"></video>
9+
<td width="33%">
10+
<h3 align="center">Fast Remove</h3>
11+
<video src="https://github.com/user-attachments/assets/6980189e-b3e0-4fca-8a21-497b6beb6ef0" width="100%"></video>
1212
</td>
13-
<td width="50%">
13+
<td width="33%">
14+
<h3 align="center" > Better Remove</h3>
15+
<video src="https://github.com/user-attachments/assets/92f516e3-bff2-41e3-803d-c5093c870717" width="100%"></video>
16+
</td>
17+
<td width="33%">
1418
<h3 align="center">Original</h3>
15-
<video src="https://github.com/user-attachments/assets/4f032fc7-97da-471b-9a54-9de2a434fa57" width="100%"></video>
19+
<video src="https://github.com/user-attachments/assets/1384e4ba-8478-4bf1-8b08-cc926961ad29" width="100%"></video>
1620
</td>
1721
</tr>
1822
</table>
23+
1924
⭐️:
2025

21-
1. **We support batch processing now.**
22-
2. **For the new watermark with username, the Yolo weights has been updated, try the new version watermark detect model, it should work better.**
26+
- **We have provided another model which could preserve time consistency without flicker!**
27+
28+
- **We support batch processing now.**
29+
- **For the new watermark with username, the Yolo weights has been updated, try the new version watermark detect model, it should work better.**
2330

24-
3. **We have uploaded the labelled datasets into huggingface, check this [dataset](https://huggingface.co/datasets/LLinked/sora-watermark-dataset) out. Free free to train your custom detector model or improve our model!**
25-
4. **One-click portable build is available**[Download here](#3-one-click-portable-version) for Windows users! No installation required.
31+
- **We have uploaded the labelled datasets into huggingface, check this [dataset](https://huggingface.co/datasets/LLinked/sora-watermark-dataset) out. Free free to train your custom detector model or improve our model!**
32+
33+
- **One-click portable build is available**[Download here](#3-one-click-portable-version) for Windows users! No installation required.
2634

2735
---
2836

@@ -107,29 +115,37 @@ Simply download, extract, and run!
107115
108116
To have a basic usage, just try the `example.py`:
109117
110-
```python
118+
> We provide two models to remove watermark. LAMA is fast but may have flicker on the cleaned area, which E2FGVI_HQ compromise this only requires cuda otherwise very slow on CPU or MPS.
111119
120+
```python
112121
from pathlib import Path
113-
from sorawm.core import SoraWM
114122
123+
from sorawm.core import SoraWM
124+
from sorawm.schemas import CleanerType
115125
116126
if __name__ == "__main__":
117-
input_video_path = Path(
118-
"resources/dog_vs_sam.mp4"
119-
)
120-
output_video_path = Path("outputs/sora_watermark_removed.mp4")
121-
sora_wm = SoraWM()
122-
sora_wm.run(input_video_path, output_video_path)
127+
input_video_path = Path("resources/dog_vs_sam.mp4")
128+
output_video_path = Path("outputs/sora_watermark_removed")
129+
130+
# 1. LAMA is fast and good quality, but not time consistent.
131+
sora_wm = SoraWM(cleaner_type=CleanerType.LAMA)
132+
sora_wm.run(input_video_path, f"{output_video_path}_lama.mp4")
133+
134+
# 2. E2FGVI_HQ ensures time consistency, but will be very slow on no-cuda device.
135+
sora_wm = SoraWM(cleaner_type=CleanerType.E2FGVI_HQ)
136+
sora_wm.run(input_video_path, f"{output_video_path}_e2fgvi_hq.mp4")
123137
124138
```
125139
126140
We also provide you with a `streamlit` based interactive web page, try it with:
127141
142+
> We also provide the switch here.
143+
128144
```bash
129145
streamlit run app.py
130146
```
131147
132-
<img src="resources/app.png" style="zoom: 25%;" />
148+
<img src="assests/model_switch.png" style="zoom: 25%;" />
133149
134150
Batch processing is also supported, now you can drag a folder or select multiple files to process.
135151
<img src="assests/streamlit_batch.png" style="zoom: 50%;" />

0 commit comments

Comments
 (0)