gulabpatel commited on
Commit
f82f9db
1 Parent(s): 5f414c1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -175
README.md CHANGED
@@ -1,175 +1,28 @@
1
- <b>!!! Check out our new [paper](https://arxiv.org/pdf/2104.11280.pdf) and [framework](https://github.com/snap-research/articulated-animation) improved for articulated objects</b>
2
-
3
- # First Order Motion Model for Image Animation
4
-
5
- This repository contains the source code for the paper [First Order Motion Model for Image Animation](https://papers.nips.cc/paper/8935-first-order-motion-model-for-image-animation) by Aliaksandr Siarohin, [Stéphane Lathuilière](http://stelat.eu), [Sergey Tulyakov](http://stulyakov.com), [Elisa Ricci](http://elisaricci.eu/) and [Nicu Sebe](http://disi.unitn.it/~sebe/).
6
-
7
- ## Example animations
8
-
9
- The videos on the left show the driving videos. The first row on the right for each dataset shows the source videos. The bottom row contains the animated sequences with motion transferred from the driving video and object taken from the source image. We trained a separate network for each task.
10
-
11
- ### VoxCeleb Dataset
12
- ![Screenshot](sup-mat/vox-teaser.gif)
13
- ### Fashion Dataset
14
- ![Screenshot](sup-mat/fashion-teaser.gif)
15
- ### MGIF Dataset
16
- ![Screenshot](sup-mat/mgif-teaser.gif)
17
-
18
-
19
- ### Installation
20
-
21
- We support ```python3```. To install the dependencies run:
22
- ```
23
- pip install -r requirements.txt
24
- ```
25
-
26
- ### YAML configs
27
-
28
- There are several configuration (```config/dataset_name.yaml```) files one for each `dataset`. See ```config/taichi-256.yaml``` to get description of each parameter.
29
-
30
-
31
- ### Pre-trained checkpoint
32
- Checkpoints can be found under following link: [google-drive](https://drive.google.com/open?id=1PyQJmkdCsAkOYwUyaj_l-l0as-iLDgeH) or [yandex-disk](https://yadi.sk/d/lEw8uRm140L_eQ).
33
-
34
- ### Animation Demo
35
- To run a demo, download checkpoint and run the following command:
36
- ```
37
- python demo.py --config config/dataset_name.yaml --driving_video path/to/driving --source_image path/to/source --checkpoint path/to/checkpoint --relative --adapt_scale
38
- ```
39
- The result will be stored in ```result.mp4```.
40
-
41
- The driving videos and source images should be cropped before it can be used in our method. To obtain some semi-automatic crop suggestions you can use ```python crop-video.py --inp some_youtube_video.mp4```. It will generate commands for crops using ffmpeg. In order to use the script, face-alligment library is needed:
42
- ```
43
- git clone https://github.com/1adrianb/face-alignment
44
- cd face-alignment
45
- pip install -r requirements.txt
46
- python setup.py install
47
- ```
48
-
49
- ### Animation demo with Docker
50
-
51
- If you are having trouble getting the demo to work because of library compatibility issues,
52
- and you're running Linux, you might try running it inside a Docker container, which would
53
- give you better control over the execution environment.
54
-
55
- Requirements: Docker 19.03+ and [nvidia-docker](https://github.com/NVIDIA/nvidia-docker)
56
- installed and able to successfully run the `nvidia-docker` usage tests.
57
-
58
- We'll first build the container.
59
-
60
- ```
61
- docker build -t first-order-model .
62
- ```
63
-
64
- And now that we have the container available locally, we can use it to run the demo.
65
-
66
- ```
67
- docker run -it --rm --gpus all \
68
- -v $HOME/first-order-model:/app first-order-model \
69
- python3 demo.py --config config/vox-256.yaml \
70
- --driving_video driving.mp4 \
71
- --source_image source.png \
72
- --checkpoint vox-cpk.pth.tar \
73
- --result_video result.mp4 \
74
- --relative --adapt_scale
75
- ```
76
-
77
- ### Colab Demo
78
- @graphemecluster prepared a gui-demo for the google-colab see: ```demo.ipynb```. To run press ```Open In Colab``` button.
79
-
80
- For old demo, see ```old-demo.ipynb```.
81
-
82
- ### Face-swap
83
- It is possible to modify the method to perform face-swap using supervised segmentation masks.
84
- ![Screenshot](sup-mat/face-swap.gif)
85
- For both unsupervised and supervised video editing, such as face-swap, please refer to [Motion Co-Segmentation](https://github.com/AliaksandrSiarohin/motion-cosegmentation).
86
-
87
-
88
- ### Training
89
-
90
- To train a model on specific dataset run:
91
- ```
92
- CUDA_VISIBLE_DEVICES=0,1,2,3 python run.py --config config/dataset_name.yaml --device_ids 0,1,2,3
93
- ```
94
- The code will create a folder in the log directory (each run will create a time-stamped new directory).
95
- Checkpoints will be saved to this folder.
96
- To check the loss values during training see ```log.txt```.
97
- You can also check training data reconstructions in the ```train-vis``` subfolder.
98
- By default the batch size is tunned to run on 2 or 4 Titan-X gpu (appart from speed it does not make much difference). You can change the batch size in the train_params in corresponding ```.yaml``` file.
99
-
100
- ### Evaluation on video reconstruction
101
-
102
- To evaluate the reconstruction performance run:
103
- ```
104
- CUDA_VISIBLE_DEVICES=0 python run.py --config config/dataset_name.yaml --mode reconstruction --checkpoint path/to/checkpoint
105
- ```
106
- You will need to specify the path to the checkpoint,
107
- the ```reconstruction``` subfolder will be created in the checkpoint folder.
108
- 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.
109
- Instructions for computing metrics from the paper can be found: https://github.com/AliaksandrSiarohin/pose-evaluation.
110
-
111
- ### Image animation
112
-
113
- In order to animate videos run:
114
- ```
115
- CUDA_VISIBLE_DEVICES=0 python run.py --config config/dataset_name.yaml --mode animate --checkpoint path/to/checkpoint
116
- ```
117
- You will need to specify the path to the checkpoint,
118
- the ```animation``` subfolder will be created in the same folder as the checkpoint.
119
- You can find the generated video there and its loss-less version in the ```png``` subfolder.
120
- By default video from test set will be randomly paired, but you can specify the "source,driving" pairs in the corresponding ```.csv``` files. The path to this file should be specified in corresponding ```.yaml``` file in pairs_list setting.
121
-
122
- There are 2 different ways of performing animation:
123
- by using **absolute** keypoint locations or by using **relative** keypoint locations.
124
-
125
- 1) <i>Animation using absolute coordinates:</i> the animation is performed using the absolute postions of the driving video and appearance of the source image.
126
- In this way there are no specific requirements for the driving video and source appearance that is used.
127
- However this usually leads to poor performance since unrelevant details such as shape is transfered.
128
- Check animate parameters in ```taichi-256.yaml``` to enable this mode.
129
-
130
- <img src="sup-mat/absolute-demo.gif" width="512">
131
-
132
- 2) <i>Animation using relative coordinates:</i> from the driving video we first estimate the relative movement of each keypoint,
133
- then we add this movement to the absolute position of keypoints in the source image.
134
- This keypoint along with source image is used for animation. This usually leads to better performance, however this requires
135
- that the object in the first frame of the video and in the source image have the same pose
136
-
137
- <img src="sup-mat/relative-demo.gif" width="512">
138
-
139
-
140
- ### Datasets
141
-
142
- 1) **Bair**. This dataset can be directly [downloaded](https://yadi.sk/d/Rr-fjn-PdmmqeA).
143
-
144
- 2) **Mgif**. This dataset can be directly [downloaded](https://yadi.sk/d/5VdqLARizmnj3Q).
145
-
146
- 3) **Fashion**. Follow the instruction on dataset downloading [from](https://vision.cs.ubc.ca/datasets/fashion/).
147
-
148
- 4) **Taichi**. Follow the instructions in [data/taichi-loading](data/taichi-loading/README.md) or instructions from https://github.com/AliaksandrSiarohin/video-preprocessing.
149
-
150
- 5) **Nemo**. Please follow the [instructions](https://www.uva-nemo.org/) on how to download the dataset. Then the dataset should be preprocessed using scripts from https://github.com/AliaksandrSiarohin/video-preprocessing.
151
-
152
- 6) **VoxCeleb**. Please follow the instruction from https://github.com/AliaksandrSiarohin/video-preprocessing.
153
-
154
-
155
- ### Training on your own dataset
156
- 1) Resize all the videos to the same size e.g 256x256, the videos can be in '.gif', '.mp4' or folder with images.
157
- We recommend the later, for each video make a separate folder with all the frames in '.png' format. This format is loss-less, and it has better i/o performance.
158
-
159
- 2) Create a folder ```data/dataset_name``` with 2 subfolders ```train``` and ```test```, put training videos in the ```train``` and testing in the ```test```.
160
-
161
- 3) Create a config ```config/dataset_name.yaml```, in dataset_params specify the root dir the ```root_dir: data/dataset_name```. Also adjust the number of epoch in train_params.
162
-
163
- #### Additional notes
164
-
165
- Citation:
166
-
167
- ```
168
- @InProceedings{Siarohin_2019_NeurIPS,
169
- author={Siarohin, Aliaksandr and Lathuilière, Stéphane and Tulyakov, Sergey and Ricci, Elisa and Sebe, Nicu},
170
- title={First Order Motion Model for Image Animation},
171
- booktitle = {Conference on Neural Information Processing Systems (NeurIPS)},
172
- month = {December},
173
- year = {2019}
174
- }
175
- ```
 
1
+ ---
2
+ title: First Order Motion Model
3
+ emoji: 🐢
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: gradio
7
+ app_file: app.py
8
+ pinned: false
9
+ ---
10
+ # Configuration
11
+ `title`: _string_
12
+ Display title for the Space
13
+ `emoji`: _string_
14
+ Space emoji (emoji-only character allowed)
15
+ `colorFrom`: _string_
16
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
17
+ `colorTo`: _string_
18
+ Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
19
+ `sdk`: _string_
20
+ Can be either `gradio` or `streamlit`
21
+ `sdk_version` : _string_
22
+ Only applicable for `streamlit` SDK.
23
+ See [doc](https://hf.co/docs/hub/spaces) for more info on supported versions.
24
+ `app_file`: _string_
25
+ Path to your main application file (which contains either `gradio` or `streamlit` Python code).
26
+ Path is relative to the root of the repository.
27
+ `pinned`: _boolean_
28
+ Whether the Space stays on top of your list.