|
|
@ -1,11 +1,23 @@ |
|
|
|
# Animating using AnimeGanV2 |
|
|
|
*author: Filip Haltmayer* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Description |
|
|
|
|
|
|
|
Convert an image into an animated image using [`AnimeganV2`](https://github.com/TachibanaYoshino/AnimeGANv2). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Code Example |
|
|
|
Load an image from path './test.png'. |
|
|
|
|
|
|
@ -14,27 +26,36 @@ Load an image from path './test.png'. |
|
|
|
```python |
|
|
|
import towhee |
|
|
|
|
|
|
|
towhee.glob('/Users/chenshiyu/workspace/data/pic/test.png') \ |
|
|
|
towhee.glob('./test.png') \ |
|
|
|
.image_decode.cv2() \ |
|
|
|
.img2img_translation.animegan(model_name = 'hayao') \ |
|
|
|
.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:* |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee |
|
|
|
|
|
|
|
towhee.glob['path']('/Users/chenshiyu/workspace/data/pic/test.png') \ |
|
|
|
towhee.glob['path']('./test.png') \ |
|
|
|
.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() |
|
|
|
``` |
|
|
|
|
|
|
|
<img src="./results2.png" alt="results1" style="height:50px;"/> |
|
|
|
<img src="./results2.png" alt="results1" height="150px"/> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Factory Constructor |
|
|
|
|
|
|
@ -50,6 +71,12 @@ Model options: |
|
|
|
- paprika |
|
|
|
- shinkai |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Interface |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<br /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Reference |
|
|
|
|
|
|
|
Jie Chen, Gang Liu, Xin Chen |
|
|
|