Commit
·
44dcd56
1
Parent(s):
0aac8f7
Create README.md
Browse filesadded inference code, works well on colab
README.md
CHANGED
|
@@ -1,107 +1,21 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-

|
| 5 |
-

|
| 6 |
-
|
| 7 |
-
Source code of the CVPR'2022 paper "Thin-Plate Spline Motion Model for Image Animation"
|
| 8 |
-
|
| 9 |
-
[**Paper**](https://arxiv.org/abs/2203.14367) **|** [**Supp**](https://cloud.tsinghua.edu.cn/f/f7b8573bb5b04583949f/?dl=1)
|
| 10 |
-
|
| 11 |
-
### Example animation
|
| 12 |
-
|
| 13 |
-

|
| 14 |
-

|
| 15 |
-
|
| 16 |
-
**PS**: The paper trains the model for 100 epochs for a fair comparison. You can use more data and train for more epochs to get better performance.
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
### Web demo for animation
|
| 20 |
-
- Integrated into [Huggingface Spaces 🤗](https://huggingface.co/spaces) using [Gradio](https://github.com/gradio-app/gradio). Try out the Web Demo: [](https://huggingface.co/spaces/CVPR/Image-Animation-using-Thin-Plate-Spline-Motion-Model)
|
| 21 |
-
- Try the web demo for animation here: [](https://replicate.com/yoyo-nb/thin-plate-spline-motion-model)
|
| 22 |
-
- Google Colab: [](https://colab.research.google.com/drive/1DREfdpnaBhqISg0fuQlAAIwyGVn1loH_?usp=sharing)
|
| 23 |
-
|
| 24 |
-
### Pre-trained models
|
| 25 |
-
- ~~[Tsinghua Cloud](https://cloud.tsinghua.edu.cn/d/30ab8765da364fefa101/)~~
|
| 26 |
-
- [Yandex](https://disk.yandex.com/d/bWopgbGj1ZUV1w)
|
| 27 |
-
- [Google Drive](https://drive.google.com/drive/folders/1pNDo1ODQIb5HVObRtCmubqJikmR7VVLT?usp=sharing)
|
| 28 |
-
- [Baidu Yun](https://pan.baidu.com/s/1hnXmDpIbRC6WqE3tF9c5QA?pwd=1234)
|
| 29 |
-
|
| 30 |
-
### Installation
|
| 31 |
-
|
| 32 |
-
We support ```python3```.(Recommended version is Python 3.9).
|
| 33 |
-
To install the dependencies run:
|
| 34 |
-
```bash
|
| 35 |
-
pip install -r requirements.txt
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
### YAML configs
|
| 40 |
-
|
| 41 |
-
There are several configuration files one for each `dataset` in the `config` folder named as ```config/dataset_name.yaml```.
|
| 42 |
-
|
| 43 |
-
See description of the parameters in the ```config/taichi-256.yaml```.
|
| 44 |
-
|
| 45 |
-
### Datasets
|
| 46 |
-
|
| 47 |
-
1) **MGif**. Follow [Monkey-Net](https://github.com/AliaksandrSiarohin/monkey-net).
|
| 48 |
-
|
| 49 |
-
2) **TaiChiHD** and **VoxCeleb**. Follow instructions from [video-preprocessing](https://github.com/AliaksandrSiarohin/video-preprocessing).
|
| 50 |
-
|
| 51 |
-
3) **TED-talks**. Follow instructions from [MRAA](https://github.com/snap-research/articulated-animation).
|
| 52 |
-
|
| 53 |
-
Here are **VoxCeleb**, **TaiChiHD** and **TED-talks** pre-processed datasets used in the paper. [Baidu Yun](https://pan.baidu.com/s/1HKJOtXBIiP_tlLiFbzn3oA?pwd=x7xv)
|
| 54 |
-
Download all files under the folder, then merge the files and decompress, for example:
|
| 55 |
-
```bash
|
| 56 |
-
cat vox.tar.* > vox.tar
|
| 57 |
-
tar xvf vox.tar
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
### Training
|
| 62 |
-
To train a model on specific dataset run:
|
| 63 |
```
|
| 64 |
-
|
| 65 |
```
|
| 66 |
-
A log folder named after the timestamp will be created. Checkpoints, loss values, reconstruction results will be saved to this folder.
|
| 67 |
|
|
|
|
| 68 |
|
| 69 |
-
#### Training AVD network
|
| 70 |
-
To train a model on specific dataset run:
|
| 71 |
```
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
Checkpoints, loss values, reconstruction results will be saved to `{checkpoint_folder}`.
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
### Evaluation on video reconstruction
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
```
|
| 82 |
-
CUDA_VISIBLE_DEVICES=0 python run.py --mode reconstruction --config config/dataset_name.yaml --checkpoint '{checkpoint_folder}/checkpoint.pth.tar'
|
| 83 |
-
```
|
| 84 |
-
The `reconstruction` subfolder will be created in `{checkpoint_folder}`.
|
| 85 |
-
The generated video will be stored to this folder, also generated videos will be stored in ```png``` subfolder in loss-less '.png' format for evaluation.
|
| 86 |
-
To compute metrics, follow instructions from [pose-evaluation](https://github.com/AliaksandrSiarohin/pose-evaluation).
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
### Image animation demo
|
| 90 |
-
- notebook: `demo.ipynb`, edit the config cell and run for image animation.
|
| 91 |
-
- python:
|
| 92 |
-
```bash
|
| 93 |
-
CUDA_VISIBLE_DEVICES=0 python demo.py --config config/vox-256.yaml --checkpoint checkpoints/vox.pth.tar --source_image ./source.jpg --driving_video ./driving.mp4
|
| 94 |
-
```
|
| 95 |
-
|
| 96 |
-
# Acknowledgments
|
| 97 |
-
The main code is based upon [FOMM](https://github.com/AliaksandrSiarohin/first-order-model) and [MRAA](https://github.com/snap-research/articulated-animation)
|
| 98 |
-
|
| 99 |
-
Thanks for the excellent works!
|
| 100 |
-
|
| 101 |
-
And Thanks to:
|
| 102 |
-
|
| 103 |
-
- [@chenxwh](https://github.com/chenxwh): Add Web Demo & Docker environment [](https://replicate.com/yoyo-nb/thin-plate-spline-motion-model)
|
| 104 |
|
| 105 |
-
- [@TalkUHulk](https://github.com/TalkUHulk): The C++/Python demo is provided in [Image-Animation-Turbo-Boost](https://github.com/TalkUHulk/Image-Animation-Turbo-Boost)
|
| 106 |
|
| 107 |
-
- [@AK391](https://github.com/AK391): Add huggingface web demo [](https://huggingface.co/spaces/CVPR/Image-Animation-using-Thin-Plate-Spline-Motion-Model)
|
|
|
|
| 1 |
+
# Model repo
|
| 2 |
|
| 3 |
+
following is the original repo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
```
|
| 5 |
+
https://github.com/yoyo-nb/Thin-Plate-Spline-Motion-Model.git
|
| 6 |
```
|
|
|
|
| 7 |
|
| 8 |
+
inference was run using colab and then the following code was used to upload data here:
|
| 9 |
|
|
|
|
|
|
|
| 10 |
```
|
| 11 |
+
from huggingface_hub import HfApi
|
| 12 |
+
api = HfApi()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
api.upload_folder(
|
| 15 |
+
folder_path="/content/Thin-Plate-Spline-Motion-Model",
|
| 16 |
+
repo_id="SaffalPoosh/thin-spline",
|
| 17 |
+
repo_type="model",
|
| 18 |
+
)
|
| 19 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
|
|
|
| 21 |
|
|
|