Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- LICENSE.md +14 -0
- README.md +203 -8
- config/config_boxer.yaml +27 -0
- config/config_carturn.yaml +30 -0
- config/config_dog.yaml +27 -0
- config/config_music.yaml +27 -0
- data/boxer-punching-towards-camera.mp4 +3 -0
- data/car-turn.mp4 +0 -0
- data/dog.mp4 +0 -0
- data/music.mp4 +0 -0
- install.py +95 -0
- model/README.md +0 -0
- model/epoch_resnet.pth +3 -0
- model/gmflow_sintel-0c07dcb3.pth +3 -0
- output/1/video/0000.png +0 -0
- output/1/video/0001.png +0 -0
- output/1/video/0002.png +0 -0
- output/1/video/0003.png +0 -0
- output/1/video/0004.png +0 -0
- output/1/video/0005.png +0 -0
- output/1/video/0006.png +0 -0
- output/1/video/0007.png +0 -0
- output/1/video/0008.png +0 -0
- output/1/video/0009.png +0 -0
- output/1/video/0010.png +0 -0
- output/1/video/0011.png +0 -0
- output/1/video/0012.png +0 -0
- output/1/video/0013.png +0 -0
- output/1/video/0014.png +0 -0
- output/1/video/0015.png +0 -0
- output/1/video/0016.png +0 -0
- output/1/video/0017.png +0 -0
- output/1/video/0018.png +0 -0
- output/1/video/0019.png +0 -0
- output/1/video/0020.png +0 -0
- output/1/video/0021.png +0 -0
- output/1/video/0022.png +0 -0
- output/1/video/0023.png +0 -0
- output/1/video/0024.png +0 -0
- output/1/video/0025.png +0 -0
- output/1/video/0026.png +0 -0
- output/1/video/0027.png +0 -0
- output/1/video/0028.png +0 -0
- output/1/video/0029.png +0 -0
- output/1/video/0030.png +0 -0
- output/1/video/0031.png +0 -0
- output/1/video/0032.png +0 -0
- output/1/video/0033.png +0 -0
- output/1/video/0034.png +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
data/boxer-punching-towards-camera.mp4 filter=lfs diff=lfs merge=lfs -text
|
37 |
+
src/ebsynth/deps/ebsynth/bin/ebsynth filter=lfs diff=lfs merge=lfs -text
|
LICENSE.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# S-Lab License 1.0
|
2 |
+
|
3 |
+
Copyright 2024 S-Lab
|
4 |
+
|
5 |
+
Redistribution and use for non-commercial purpose in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
6 |
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7 |
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8 |
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\
|
9 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
10 |
+
4. In the event that redistribution and/or use for commercial purpose in source or binary forms, with or without modification is required, please contact the contributor(s) of the work.
|
11 |
+
|
12 |
+
|
13 |
+
---
|
14 |
+
For the commercial use of the code, please consult Prof. Chen Change Loy (ccloy@ntu.edu.sg)
|
README.md
CHANGED
@@ -1,12 +1,207 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: purple
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: fresco
|
3 |
+
app_file: webUI.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
+
sdk_version: 3.50.2
|
|
|
|
|
6 |
---
|
7 |
+
# FRESCO - Official PyTorch Implementation
|
8 |
+
|
9 |
+
|
10 |
+
**FRESCO: Spatial-Temporal Correspondence for Zero-Shot Video Translation**<br>
|
11 |
+
[Shuai Yang](https://williamyang1991.github.io/), [Yifan Zhou](https://zhouyifan.net/), [Ziwei Liu](https://liuziwei7.github.io/) and [Chen Change Loy](https://www.mmlab-ntu.com/person/ccloy/)<br>
|
12 |
+
in CVPR 2024 <br>
|
13 |
+
[**Project Page**](https://www.mmlab-ntu.com/project/fresco/) | [**Paper**](https://arxiv.org/abs/2403.12962) | [**Supplementary Video**](https://youtu.be/jLnGx5H-wLw) | [**Input Data and Video Results**](https://drive.google.com/file/d/12BFx3hp8_jp9m0EmKpw-cus2SABPQx2Q/view?usp=sharing) <br>
|
14 |
+
|
15 |
+
**Abstract:** *The remarkable efficacy of text-to-image diffusion models has motivated extensive exploration of their potential application in video domains.
|
16 |
+
Zero-shot methods seek to extend image diffusion models to videos without necessitating model training.
|
17 |
+
Recent methods mainly focus on incorporating inter-frame correspondence into attention mechanisms. However, the soft constraint imposed on determining where to attend to valid features can sometimes be insufficient, resulting in temporal inconsistency.
|
18 |
+
In this paper, we introduce FRESCO, intra-frame correspondence alongside inter-frame correspondence to establish a more robust spatial-temporal constraint. This enhancement ensures a more consistent transformation of semantically similar content across frames. Beyond mere attention guidance, our approach involves an explicit update of features to achieve high spatial-temporal consistency with the input video, significantly improving the visual coherence of the resulting translated videos.
|
19 |
+
Extensive experiments demonstrate the effectiveness of our proposed framework in producing high-quality, coherent videos, marking a notable improvement over existing zero-shot methods.*
|
20 |
+
|
21 |
+
**Features**:<br>
|
22 |
+
- **Temporal consistency**: use intra-and inter-frame constraint with better consistency and coverage than optical flow alone.
|
23 |
+
- Compared with our previous work [Rerender-A-Video](https://github.com/williamyang1991/Rerender_A_Video), FRESCO is more robust to large and quick motion.
|
24 |
+
- **Zero-shot**: no training or fine-tuning required.
|
25 |
+
- **Flexibility**: compatible with off-the-shelf models (e.g., [ControlNet](https://github.com/lllyasviel/ControlNet), [LoRA](https://civitai.com/)) for customized translation.
|
26 |
+
|
27 |
+
https://github.com/williamyang1991/FRESCO/assets/18130694/aad358af-4d27-4f18-b069-89a1abd94d38
|
28 |
+
|
29 |
+
|
30 |
+
## Updates
|
31 |
+
- [03/2023] Paper is released.
|
32 |
+
- [03/2023] Code is released.
|
33 |
+
- [03/2024] This website is created.
|
34 |
+
|
35 |
+
### TODO
|
36 |
+
- [x] Integrate into Diffusers
|
37 |
+
- [x] Add Huggingface web demo
|
38 |
+
- [x] ~~Add webUI.~~
|
39 |
+
- [x] ~~Update readme~~
|
40 |
+
- [x] ~~Upload paper to arXiv, release related material~~
|
41 |
+
|
42 |
+
## Installation
|
43 |
+
|
44 |
+
1. Clone the repository.
|
45 |
+
|
46 |
+
```shell
|
47 |
+
git clone https://github.com/williamyang1991/FRESCO.git
|
48 |
+
cd FRESCO
|
49 |
+
```
|
50 |
+
|
51 |
+
2. You can simply set up the environment with pip based on [requirements.txt](https://github.com/williamyang1991/FRESCO/blob/main/requirements.txt)
|
52 |
+
- We have tested on torch 2.0.0/2.1.0 and diffusers 0.19.3
|
53 |
+
- If you use new versions of diffusers, you need to modify [my_forward()](https://github.com/williamyang1991/FRESCO/blob/fb991262615665de88f7a8f2cc903d9539e1b234/src/diffusion_hacked.py#L496)
|
54 |
+
|
55 |
+
3. Run the installation script. The required models will be downloaded in `./model`, `./src/ControlNet/annotator` and `./src/ebsynth/deps/ebsynth/bin`.
|
56 |
+
- Requires access to huggingface.co
|
57 |
+
|
58 |
+
```shell
|
59 |
+
python install.py
|
60 |
+
```
|
61 |
+
|
62 |
+
4. You can run the demo with `run_fresco.py`
|
63 |
+
|
64 |
+
```shell
|
65 |
+
python run_fresco.py ./config/config_music.yaml
|
66 |
+
```
|
67 |
+
|
68 |
+
5. For issues with Ebsynth, please refer to [issues](https://github.com/williamyang1991/Rerender_A_Video#issues)
|
69 |
+
|
70 |
+
|
71 |
+
## (1) Inference
|
72 |
+
|
73 |
+
### WebUI (recommended)
|
74 |
+
|
75 |
+
```
|
76 |
+
python webUI.py
|
77 |
+
```
|
78 |
+
The Gradio app also allows you to flexibly change the inference options. Just try it for more details.
|
79 |
+
|
80 |
+
Upload your video, input the prompt, select the model and seed, and hit:
|
81 |
+
- **Run Key Frames**: detect keyframes, translate all keyframes.
|
82 |
+
- **Run Propagation**: propagate the keyframes to other frames for full video translation
|
83 |
+
- **Run All**: **Run Key Frames** and **Run Propagation**
|
84 |
+
|
85 |
+
Select the model:
|
86 |
+
- **Base model**: base Stable Diffusion model (SD 1.5)
|
87 |
+
- Stable Diffusion 1.5: official model
|
88 |
+
- [rev-Animated](https://huggingface.co/stablediffusionapi/rev-animated): a semi-realistic (2.5D) model
|
89 |
+
- [realistic-Vision](https://huggingface.co/SG161222/Realistic_Vision_V2.0): a photo-realistic model
|
90 |
+
- [flat2d-animerge](https://huggingface.co/stablediffusionapi/flat-2d-animerge): a cartoon model
|
91 |
+
- You can add other models on huggingface.co by modifying this [line](https://github.com/williamyang1991/FRESCO/blob/1afcca9c7b1bc1ac68254f900be9bd768fbb6988/webUI.py#L362)
|
92 |
+
|
93 |
+
![overview](https://github.com/williamyang1991/FRESCO/assets/18130694/6ce5d54e-b020-4e43-95e7-72ab1783f482)
|
94 |
+
|
95 |
+
We provide abundant advanced options to play with
|
96 |
+
|
97 |
+
</details>
|
98 |
+
|
99 |
+
<details id="option1">
|
100 |
+
<summary> <b>Advanced options for single frame processing</b></summary>
|
101 |
+
|
102 |
+
1. **Frame resolution**: resize the short side of the video to 512.
|
103 |
+
2. ControlNet related:
|
104 |
+
- **ControlNet strength**: how well the output matches the input control edges
|
105 |
+
- **Control type**: HED edge, Canny edge, Depth map
|
106 |
+
- **Canny low/high threshold**: low values for more edge details
|
107 |
+
3. SDEdit related:
|
108 |
+
- **Denoising strength**: repaint degree (low value to make the output look more like the original video)
|
109 |
+
- **Preserve color**: preserve the color of the original video
|
110 |
+
4. SD related:
|
111 |
+
- **Steps**: denoising step
|
112 |
+
- **CFG scale**: how well the output matches the prompt
|
113 |
+
- **Added prompt/Negative prompt**: supplementary prompts
|
114 |
+
5. FreeU related:
|
115 |
+
- **FreeU first/second-stage backbone factor**: =1 do nothing; >1 enhance output color and details
|
116 |
+
- **FreeU first/second-stage skip factor**: =1 do nothing; <1 enhance output color and details
|
117 |
+
|
118 |
+
</details>
|
119 |
+
|
120 |
+
<details id="option2">
|
121 |
+
<summary> <b>Advanced options for FRESCO constraints</b></summary>
|
122 |
+
|
123 |
+
1. Keyframe related
|
124 |
+
- **Number of frames**: Total frames to be translated
|
125 |
+
- **Number of frames in a batch**: To avoid out-of-memory, use small batch size
|
126 |
+
- **Min keyframe interval (s_min)**: The keyframes will be detected at least every s_min frames
|
127 |
+
- **Max keyframe interval (s_max)**: The keyframes will be detected at most every s_max frames
|
128 |
+
2. FRESCO constraints
|
129 |
+
- FRESCO-guided Attention:
|
130 |
+
- **spatial-guided attention**: Check to enable spatial-guided attention
|
131 |
+
- **cross-frame attention**: Check to enable efficient cross-frame attention
|
132 |
+
- **temporal-guided attention**: Check to enable temporal-guided attention
|
133 |
+
- FRESCO-guided optimization:
|
134 |
+
- **spatial-guided optimization**: Check to enable spatial-guided optimization
|
135 |
+
- **temporal-guided optimization**: Check to enable temporal-guided optimization
|
136 |
+
3. **Background smoothing**: Check to enable background smoothing (best for static background)
|
137 |
+
|
138 |
+
</details>
|
139 |
+
|
140 |
+
<details id="option3">
|
141 |
+
<summary> <b>Advanced options for the full video translation</b></summary>
|
142 |
+
|
143 |
+
1. **Gradient blending**: apply Poisson Blending to reduce ghosting artifacts. May slow the process and increase flickers.
|
144 |
+
2. **Number of parallel processes**: multiprocessing to speed up the process. Large value (4) is recommended.
|
145 |
+
</details>
|
146 |
+
|
147 |
+
![option](https://github.com/williamyang1991/FRESCO/assets/18130694/72600758-1dff-4b7c-8f3f-65ee3909f8f6)
|
148 |
+
|
149 |
+
### Command Line
|
150 |
+
|
151 |
+
We provide a flexible script `run_fresco.py` to run our method.
|
152 |
+
|
153 |
+
Set the options via a config file. For example,
|
154 |
+
```shell
|
155 |
+
python run_fresco.py ./config/config_music.yaml
|
156 |
+
```
|
157 |
+
We provide some examples of the config in `config` directory.
|
158 |
+
Most options in the config is the same as those in WebUI.
|
159 |
+
Please check the explanations in the WebUI section.
|
160 |
+
|
161 |
+
We provide a separate Ebsynth python script `video_blend.py` with the temporal blending algorithm introduced in
|
162 |
+
[Stylizing Video by Example](https://dcgi.fel.cvut.cz/home/sykorad/ebsynth.html) for interpolating style between key frames.
|
163 |
+
It can work on your own stylized key frames independently of our FRESCO algorithm.
|
164 |
+
For the details, please refer to our previous work [Rerender-A-Video](https://github.com/williamyang1991/Rerender_A_Video/tree/main?tab=readme-ov-file#our-ebsynth-implementation)
|
165 |
+
|
166 |
+
## (2) Results
|
167 |
+
|
168 |
+
### Key frame translation
|
169 |
+
|
170 |
+
<table class="center">
|
171 |
+
<tr>
|
172 |
+
<td><img src="https://github.com/williamyang1991/FRESCO/assets/18130694/e8d5776a-37c5-49ae-8ab4-15669df6f572" raw=true></td>
|
173 |
+
<td><img src="https://github.com/williamyang1991/FRESCO/assets/18130694/8a792af6-555c-4e82-ac1e-5c2e1ee35fdb" raw=true></td>
|
174 |
+
<td><img src="https://github.com/williamyang1991/FRESCO/assets/18130694/10f9a964-85ac-4433-84c5-1611a6c2c434" raw=true></td>
|
175 |
+
<td><img src="https://github.com/williamyang1991/FRESCO/assets/18130694/0ec0fbf9-90dd-4d8b-964d-945b5f6687c2" raw=true></td>
|
176 |
+
</tr>
|
177 |
+
<tr>
|
178 |
+
<td width=26.5% align="center">a red car turns in the winter</td>
|
179 |
+
<td width=26.5% align="center">an African American boxer wearing black boxing gloves punches towards the camera, cartoon style</td>
|
180 |
+
<td width=26.5% align="center">a cartoon spiderman in black suit, black shoes and white gloves is dancing</td>
|
181 |
+
<td width=20.5% align="center">a beautiful woman holding her glasses in CG style</td>
|
182 |
+
</tr>
|
183 |
+
</table>
|
184 |
+
|
185 |
+
|
186 |
+
### Full video translation
|
187 |
+
|
188 |
+
https://github.com/williamyang1991/FRESCO/assets/18130694/bf8bfb82-5cb7-4b2f-8169-cf8dbf408b54
|
189 |
+
|
190 |
+
## Citation
|
191 |
+
|
192 |
+
If you find this work useful for your research, please consider citing our paper:
|
193 |
+
|
194 |
+
```bibtex
|
195 |
+
@inproceedings{yang2024fresco,
|
196 |
+
title = {FRESCO: Spatial-Temporal Correspondence for Zero-Shot Video Translation},
|
197 |
+
author = {Yang, Shuai and Zhou, Yifan and Liu, Ziwei and and Loy, Chen Change},
|
198 |
+
booktitle = {CVPR},
|
199 |
+
year = {2024},
|
200 |
+
}
|
201 |
+
```
|
202 |
+
|
203 |
+
## Acknowledgments
|
204 |
+
|
205 |
+
The code is mainly developed based on [Rerender-A-Video](https://github.com/williamyang1991/Rerender_A_Video), [ControlNet](https://github.com/lllyasviel/ControlNet), [Stable Diffusion](https://github.com/Stability-AI/stablediffusion), [GMFlow](https://github.com/haofeixu/gmflow) and [Ebsynth](https://github.com/jamriska/ebsynth).
|
206 |
+
|
207 |
|
|
config/config_boxer.yaml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# data
|
2 |
+
file_path: './data/boxer-punching-towards-camera.mp4'
|
3 |
+
save_path: './output/boxer-punching-towards-camera/'
|
4 |
+
mininterv: 2 # for keyframe selection
|
5 |
+
maxinterv: 2 # for keyframe selection
|
6 |
+
|
7 |
+
# diffusion
|
8 |
+
seed: 0
|
9 |
+
prompt: 'An African American boxer wearing black boxing gloves punches towards the camera, cartoon style'
|
10 |
+
sd_path: 'stablediffusionapi/flat-2d-animerge'
|
11 |
+
use_controlnet: True
|
12 |
+
controlnet_type: 'depth' # 'hed', 'canny'
|
13 |
+
cond_scale: 0.7
|
14 |
+
use_freeu: False
|
15 |
+
|
16 |
+
# video-to-video translation
|
17 |
+
batch_size: 8
|
18 |
+
num_inference_steps: 20
|
19 |
+
num_warmup_steps: 5
|
20 |
+
end_opt_step: 15
|
21 |
+
run_ebsynth: False
|
22 |
+
max_process: 4
|
23 |
+
|
24 |
+
# supporting model
|
25 |
+
gmflow_path: './model/gmflow_sintel-0c07dcb3.pth'
|
26 |
+
sod_path: './model/epoch_resnet.pth'
|
27 |
+
use_salinecy: True
|
config/config_carturn.yaml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# data
|
2 |
+
file_path: './data/car-turn.mp4'
|
3 |
+
save_path: './output/car-turn/'
|
4 |
+
mininterv: 5 # for keyframe selection
|
5 |
+
maxinterv: 5 # for keyframe selection
|
6 |
+
|
7 |
+
# diffusion
|
8 |
+
seed: 0
|
9 |
+
prompt: 'a red car turns in the winter'
|
10 |
+
# sd_path: 'runwayml/stable-diffusion-v1-5'
|
11 |
+
# sd_path: 'stablediffusionapi/rev-animated'
|
12 |
+
# sd_path: 'stablediffusionapi/flat-2d-animerge'
|
13 |
+
sd_path: 'SG161222/Realistic_Vision_V2.0'
|
14 |
+
use_controlnet: True
|
15 |
+
controlnet_type: 'hed' # 'depth', 'canny'
|
16 |
+
cond_scale: 0.7
|
17 |
+
use_freeu: False
|
18 |
+
|
19 |
+
# video-to-video translation
|
20 |
+
batch_size: 8
|
21 |
+
num_inference_steps: 20
|
22 |
+
num_warmup_steps: 5
|
23 |
+
end_opt_step: 15
|
24 |
+
run_ebsynth: False
|
25 |
+
max_process: 4
|
26 |
+
|
27 |
+
# supporting model
|
28 |
+
gmflow_path: './model/gmflow_sintel-0c07dcb3.pth'
|
29 |
+
sod_path: './model/epoch_resnet.pth'
|
30 |
+
use_salinecy: True
|
config/config_dog.yaml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# data
|
2 |
+
file_path: './data/dog.mp4'
|
3 |
+
save_path: './output/dog/'
|
4 |
+
mininterv: 10 # for keyframe selection
|
5 |
+
maxinterv: 30 # for keyframe selection
|
6 |
+
|
7 |
+
# diffusion
|
8 |
+
seed: 0
|
9 |
+
prompt: 'greetings from a fox by shaking front paws'
|
10 |
+
sd_path: 'SG161222/Realistic_Vision_V2.0'
|
11 |
+
use_controlnet: True
|
12 |
+
controlnet_type: 'hed' # 'depth', 'canny'
|
13 |
+
cond_scale: 1.0
|
14 |
+
use_freeu: False
|
15 |
+
|
16 |
+
# video-to-video translation
|
17 |
+
batch_size: 8
|
18 |
+
num_inference_steps: 20
|
19 |
+
num_warmup_steps: 8
|
20 |
+
end_opt_step: 15
|
21 |
+
run_ebsynth: False
|
22 |
+
max_process: 4
|
23 |
+
|
24 |
+
# supporting model
|
25 |
+
gmflow_path: './model/gmflow_sintel-0c07dcb3.pth'
|
26 |
+
sod_path: './model/epoch_resnet.pth'
|
27 |
+
use_salinecy: True
|
config/config_music.yaml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# data
|
2 |
+
file_path: './data/music.mp4'
|
3 |
+
save_path: './output/music/'
|
4 |
+
mininterv: 10 # for keyframe selection
|
5 |
+
maxinterv: 30 # for keyframe selection
|
6 |
+
|
7 |
+
# diffusion
|
8 |
+
seed: 0
|
9 |
+
prompt: 'A beautiful woman with headphones listening to music in CG cyberpunk style, neon, closed eyes, colorful'
|
10 |
+
sd_path: 'stablediffusionapi/rev-animated'
|
11 |
+
use_controlnet: True
|
12 |
+
controlnet_type: 'hed' # 'depth', 'canny'
|
13 |
+
cond_scale: 1.0
|
14 |
+
use_freeu: False
|
15 |
+
|
16 |
+
# video-to-video translation
|
17 |
+
batch_size: 8
|
18 |
+
num_inference_steps: 20
|
19 |
+
num_warmup_steps: 3
|
20 |
+
end_opt_step: 15
|
21 |
+
run_ebsynth: False
|
22 |
+
max_process: 4
|
23 |
+
|
24 |
+
# supporting model
|
25 |
+
gmflow_path: './model/gmflow_sintel-0c07dcb3.pth'
|
26 |
+
sod_path: './model/epoch_resnet.pth'
|
27 |
+
use_salinecy: True
|
data/boxer-punching-towards-camera.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:265fc4d5e53bfdc1b8fb8b7792815bd86d8d5bd14b1463f41e5df7d9fc500525
|
3 |
+
size 1467723
|
data/car-turn.mp4
ADDED
Binary file (942 kB). View file
|
|
data/dog.mp4
ADDED
Binary file (759 kB). View file
|
|
data/music.mp4
ADDED
Binary file (830 kB). View file
|
|
install.py
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import platform
|
3 |
+
|
4 |
+
import requests
|
5 |
+
|
6 |
+
|
7 |
+
def build_ebsynth():
|
8 |
+
if os.path.exists('src/ebsynth/deps/ebsynth/bin/ebsynth'):
|
9 |
+
print('Ebsynth has been built.')
|
10 |
+
return
|
11 |
+
|
12 |
+
os_str = platform.system()
|
13 |
+
|
14 |
+
if os_str == 'Windows':
|
15 |
+
print('Build Ebsynth Windows 64 bit.',
|
16 |
+
'If you want to build for 32 bit, please modify install.py.')
|
17 |
+
cmd = '.\\build-win64-cpu+cuda.bat'
|
18 |
+
exe_file = 'src/ebsynth/deps/ebsynth/bin/ebsynth.exe'
|
19 |
+
elif os_str == 'Linux':
|
20 |
+
cmd = 'bash build-linux-cpu+cuda.sh'
|
21 |
+
exe_file = 'src/ebsynth/deps/ebsynth/bin/ebsynth'
|
22 |
+
elif os_str == 'Darwin':
|
23 |
+
cmd = 'sh build-macos-cpu_only.sh'
|
24 |
+
exe_file = 'src/ebsynth/deps/ebsynth/bin/ebsynth.app'
|
25 |
+
else:
|
26 |
+
print('Cannot recognize OS. Ebsynth installation stopped.')
|
27 |
+
return
|
28 |
+
|
29 |
+
os.chdir('src/ebsynth/deps/ebsynth')
|
30 |
+
print(cmd)
|
31 |
+
os.system(cmd)
|
32 |
+
os.chdir('../../../..')
|
33 |
+
if os.path.exists(exe_file):
|
34 |
+
print('Ebsynth installed successfully.')
|
35 |
+
else:
|
36 |
+
print('Failed to install Ebsynth.')
|
37 |
+
|
38 |
+
|
39 |
+
def download(url, dir, name=None):
|
40 |
+
os.makedirs(dir, exist_ok=True)
|
41 |
+
if name is None:
|
42 |
+
name = url.split('/')[-1]
|
43 |
+
path = os.path.join(dir, name)
|
44 |
+
if not os.path.exists(path):
|
45 |
+
print(f'Install {name} ...')
|
46 |
+
open(path, 'wb').write(requests.get(url).content)
|
47 |
+
print('Install successfully.')
|
48 |
+
|
49 |
+
|
50 |
+
def download_gmflow_ckpt():
|
51 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
52 |
+
'resolve/main/models/gmflow_sintel-0c07dcb3.pth')
|
53 |
+
download(url, 'model')
|
54 |
+
|
55 |
+
|
56 |
+
def download_egnet_ckpt():
|
57 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
58 |
+
'resolve/main/models/epoch_resnet.pth')
|
59 |
+
download(url, 'model')
|
60 |
+
|
61 |
+
def download_hed_ckpt():
|
62 |
+
url = ('https://huggingface.co/lllyasviel/Annotators/'
|
63 |
+
'resolve/main/ControlNetHED.pth')
|
64 |
+
download(url, 'src/ControlNet/annotator/ckpts')
|
65 |
+
|
66 |
+
def download_depth_ckpt():
|
67 |
+
url = ('https://huggingface.co/lllyasviel/ControlNet/'
|
68 |
+
'resolve/main/annotator/ckpts/dpt_hybrid-midas-501f0c75.pt')
|
69 |
+
download(url, 'src/ControlNet/annotator/ckpts')
|
70 |
+
|
71 |
+
def download_ebsynth_ckpt():
|
72 |
+
os_str = platform.system()
|
73 |
+
if os_str == 'Linux':
|
74 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
75 |
+
'resolve/main/models/ebsynth')
|
76 |
+
download(url, 'src/ebsynth/deps/ebsynth/bin')
|
77 |
+
elif os_str == 'Windows':
|
78 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
79 |
+
'resolve/main/models/ebsynth.exe')
|
80 |
+
download(url, 'src/ebsynth/deps/ebsynth/bin')
|
81 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
82 |
+
'resolve/main/models/ebsynth_cpu.dll')
|
83 |
+
download(url, 'src/ebsynth/deps/ebsynth/bin')
|
84 |
+
url = ('https://huggingface.co/PKUWilliamYang/Rerender/'
|
85 |
+
'resolve/main/models/ebsynth_cpu.exe')
|
86 |
+
download(url, 'src/ebsynth/deps/ebsynth/bin')
|
87 |
+
else:
|
88 |
+
print('No available compiled Ebsynth.')
|
89 |
+
|
90 |
+
#build_ebsynth()
|
91 |
+
download_ebsynth_ckpt()
|
92 |
+
download_gmflow_ckpt()
|
93 |
+
download_egnet_ckpt()
|
94 |
+
download_hed_ckpt()
|
95 |
+
download_depth_ckpt()
|
model/README.md
ADDED
File without changes
|
model/epoch_resnet.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:38e000887ec6445f91faac7dac9539daae33ab05eb98ce6c80ba82fff0f836b7
|
3 |
+
size 447062559
|
model/gmflow_sintel-0c07dcb3.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0c07dcb35770464f38a5ff4de18c04177b242dc5de8cd2068adf46f3d4fe193a
|
3 |
+
size 18768907
|
output/1/video/0000.png
ADDED
output/1/video/0001.png
ADDED
output/1/video/0002.png
ADDED
output/1/video/0003.png
ADDED
output/1/video/0004.png
ADDED
output/1/video/0005.png
ADDED
output/1/video/0006.png
ADDED
output/1/video/0007.png
ADDED
output/1/video/0008.png
ADDED
output/1/video/0009.png
ADDED
output/1/video/0010.png
ADDED
output/1/video/0011.png
ADDED
output/1/video/0012.png
ADDED
output/1/video/0013.png
ADDED
output/1/video/0014.png
ADDED
output/1/video/0015.png
ADDED
output/1/video/0016.png
ADDED
output/1/video/0017.png
ADDED
output/1/video/0018.png
ADDED
output/1/video/0019.png
ADDED
output/1/video/0020.png
ADDED
output/1/video/0021.png
ADDED
output/1/video/0022.png
ADDED
output/1/video/0023.png
ADDED
output/1/video/0024.png
ADDED
output/1/video/0025.png
ADDED
output/1/video/0026.png
ADDED
output/1/video/0027.png
ADDED
output/1/video/0028.png
ADDED
output/1/video/0029.png
ADDED
output/1/video/0030.png
ADDED
output/1/video/0031.png
ADDED
output/1/video/0032.png
ADDED
output/1/video/0033.png
ADDED
output/1/video/0034.png
ADDED