diff --git a/README copy.md b/README copy.md deleted file mode 100644 index aa1961e..0000000 --- a/README copy.md +++ /dev/null @@ -1,54 +0,0 @@ -# AnimeGanV2 Style-Transfer Operator - -Authors: filip - -## Overview - -AnimeGanV2 is a style transfer net that transforms images to looking like they fit in an anime movie. - -## Interface - -```python -__init__(self, model_name: str, framework: str = 'pytorch') -``` - -**Args:** - -- model_name: - - which weights to use for inference. - - supports 'celeba', 'facepaintv1', 'facepaitv2', 'hayao', 'paprika', 'shinkai' -- framework: - - the framework of the model - - supported types: `str`, default is 'pytorch' - -```python -__call__(self, image: 'towhee.types.Image') -``` - -**Args:** - -- image: - - the input image - - supported types: `towhee.types.Image` - -**Returns:** - -The Operator returns a tuple `Tuple[('styled_image', numpy.ndarray)]` containing following fields: - -- styled_image: - - styled photo - - data type: `numpy.ndarray` - - shape: (3, x, x) - - format: RGB - - values: [0,1] - -## Requirements - -You can get the required python package by [requirements.txt](./requirements.txt). - - -## 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. diff --git a/README.md b/README.md index e886a77..54da127 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,66 @@ -# animegan +# Animating using AnimeGanV2 +*author: Filip Haltmayer* +## Description + +Convert an image into an animated image using [`AnimeganV2`](https://github.com/TachibanaYoshino/AnimeGANv2). + + +## Code Example +Load an image from path './image.png'. + + *Write the pipeline in simplified style*: + +```python +import towhee +from PIL import Image +import numpy + +pipeline = towhee.glob('./image.png').image_decode.cv2().img2img_translation.animegan(model_name = 'hayao') +img = pipeline.to_list()[0] +img = numpy.transpose(img, (1,2,0)) +img = Image.fromarray((img * 255).astype(numpy.uint8)) +img.show() +``` + +## 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. + + + +**Returns**: *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.