logo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readme
Files and versions

Updated 1 year ago

img2img-translation

Animating using AnimeGanV2

author: Filip Haltmayer


Description

Convert an image into an animated image using AnimeganV2.


Code Example

Load an image from path './test.png'.

Write the pipeline in simplified style:

import towhee

towhee.glob('./test.png') \
      .image_decode() \
      .img2img_translation.animegan(model_name = 'hayao') \
      .show()

Write a pipeline with explicit inputs/outputs name specifications:

import towhee
      
towhee.glob['path']('./test.png') \
      .image_decode['path', 'origin']() \
      .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()
results1


Factory Constructor

Create the operator via the following factory method

img2img_translation.animegan(model_name = 'which anime model to use')

Model options:

  • celeba
  • facepaintv1
  • facepaintv2
  • hayao
  • paprika
  • shinkai


Interface

Takes in a numpy rgb image in channels first. It transforms input into animated image in numpy form.

Parameters:

model_name: str

​ Which model to use for transfer.

framework: str

​ Which ML framework being used, for now only supports PyTorch.

device: str

​ Which device being used('cpu' or 'cuda'), defaults to 'cpu'.

Returns: towhee.types.Image (a sub-class of numpy.ndarray)

​ The new image.


Reference

Jie Chen, Gang Liu, Xin Chen "AnimeGAN: A Novel Lightweight GAN for Photo Animation." ISICA 2019: Artificial Intelligence Algorithms and Applications pp 242-256, 2019.

mengjia.gu@10.xxx.30.11 6d1c7ffe85 Fix for image channels 16 Commits
folder-icon pytorch Support GPU 2 years ago
file-icon .gitattributes
1.1 KiB
download-icon
Initial commit 2 years ago
file-icon README.md
2.1 KiB
download-icon
Support GPU 2 years ago
file-icon __init__.py
76 B
download-icon
files 2 years ago
file-icon animegan.py
1.3 KiB
download-icon
Fix for image channels 1 year ago
file-icon requirements.txt
46 B
download-icon
req added 2 years ago
file-icon results1.png
73 KiB
download-icon
add image 2 years ago
file-icon results2.png
282 KiB
download-icon
Update img 2 years ago
file-icon test.png
300 KiB
download-icon
Update README 2 years ago