|
@ -1,11 +1,23 @@ |
|
|
# Animating using AnimeGanV2 |
|
|
# Animating using AnimeGanV2 |
|
|
*author: Filip Haltmayer* |
|
|
*author: Filip Haltmayer* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Description |
|
|
## Description |
|
|
|
|
|
|
|
|
Convert an image into an animated image using [`AnimeganV2`](https://github.com/TachibanaYoshino/AnimeGANv2). |
|
|
Convert an image into an animated image using [`AnimeganV2`](https://github.com/TachibanaYoshino/AnimeGANv2). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Code Example |
|
|
## Code Example |
|
|
Load an image from path './test.png'. |
|
|
Load an image from path './test.png'. |
|
|
|
|
|
|
|
@ -14,27 +26,36 @@ Load an image from path './test.png'. |
|
|
```python |
|
|
```python |
|
|
import towhee |
|
|
import towhee |
|
|
|
|
|
|
|
|
towhee.glob('/Users/chenshiyu/workspace/data/pic/test.png') \ |
|
|
|
|
|
|
|
|
towhee.glob('./test.png') \ |
|
|
.image_decode.cv2() \ |
|
|
.image_decode.cv2() \ |
|
|
.img2img_translation.animegan(model_name = 'hayao') \ |
|
|
.img2img_translation.animegan(model_name = 'hayao') \ |
|
|
.show() |
|
|
.show() |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
<img src="./results1.png" alt="results1" style="height:40px;"/> |
|
|
|
|
|
|
|
|
<img src="./results1.png" height="150px"/> |
|
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
|
```python |
|
|
```python |
|
|
import towhee |
|
|
import towhee |
|
|
|
|
|
|
|
|
towhee.glob['path']('/Users/chenshiyu/workspace/data/pic/test.png') \ |
|
|
|
|
|
|
|
|
towhee.glob['path']('./test.png') \ |
|
|
.image_decode.cv2['path', 'origin']() \ |
|
|
.image_decode.cv2['path', 'origin']() \ |
|
|
.img2img_translation.animegan['origin', 'transformed'](model_name = 'hayao') \ |
|
|
|
|
|
.select('origin', 'transformed') \ |
|
|
|
|
|
|
|
|
.img2img_translation.animegan['origin', 'facepaintv2'](model_name = 'facepaintv2') \ |
|
|
|
|
|
.img2img_translation.animegan['origin', 'hayao'](model_name = 'hayao') \ |
|
|
|
|
|
.img2img_translation.animegan['origin', 'paprika'](model_name = 'paprika') \ |
|
|
|
|
|
.img2img_translation.animegan['origin', 'shinkai'](model_name = 'shinkai') \ |
|
|
|
|
|
.select('origin', 'facepaintv2', 'hayao', 'paprika', 'shinkai') \ |
|
|
.show() |
|
|
.show() |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
<img src="./results2.png" alt="results1" style="height:50px;"/> |
|
|
|
|
|
|
|
|
<img src="./results2.png" alt="results1" height="150px"/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Factory Constructor |
|
|
## Factory Constructor |
|
|
|
|
|
|
|
@ -50,6 +71,12 @@ Model options: |
|
|
- paprika |
|
|
- paprika |
|
|
- shinkai |
|
|
- shinkai |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Interface |
|
|
## Interface |
|
|
|
|
|
|
|
|
Takes in a numpy rgb image in channels first. It transforms input into animated image in numpy form. |
|
|
Takes in a numpy rgb image in channels first. It transforms input into animated image in numpy form. |
|
@ -67,11 +94,17 @@ Takes in a numpy rgb image in channels first. It transforms input into animated |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Returns**: *numpy.ndarray* |
|
|
|
|
|
|
|
|
**Returns**: *towhee.types.Image (a sub-class of dumpy.ndarray)* |
|
|
|
|
|
|
|
|
The new image. |
|
|
The new image. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Reference |
|
|
## Reference |
|
|
|
|
|
|
|
|
Jie Chen, Gang Liu, Xin Chen |
|
|
Jie Chen, Gang Liu, Xin Chen |
|
|