ani-chara-gan / README.md
Eugene Siow
Add README.
e1c6348
metadata
license: apache-2.0
tags:
  - stylegan2
  - image-generation

AniCharaGAN: Anime Character Generation with StyleGAN2

GitHub Repo stars

This model uses the awesome lucidrains’s stylegan2-pytorch library to train a model on a private anime character dataset to generate full-body 256x256 female anime characters.

Here are some samples:

Samples of anime characters and styles generated by the model

Model description

The model generates 256x256, square, white background, full-body anime characters. It is trained using stylegan2-pytorch. It is trained to 150 epochs.

Intended uses & limitations

You can use the model for generating anime characters and than use a super resolution library like super_image to upscale.

How to use

Open In Colab

Install the dependencies:

pip install -q stylegan2_pytorch==1.5.10

Here is how to generate images:

import torch
from torchvision.utils import save_image
from stylegan2_pytorch import ModelLoader
from pathlib import Path

Path('./models/ani-chara-gan/').mkdir(parents=True, exist_ok=True)
torch.hub.download_url_to_file('https://huggingface.co/eugenesiow/ani-chara-gan/resolve/main/model.pt',
                               './models/ani-chara-gan/model_150.pt')
torch.hub.download_url_to_file('https://huggingface.co/eugenesiow/ani-chara-gan/resolve/main/.config.json',
                               './models/ani-chara-gan/.config.json')

loader = ModelLoader(
    base_dir = './', name = 'ani-chara-gan'
)

noise   = torch.randn(1, 256).cuda() # noise
styles  = loader.noise_to_styles(noise, trunc_psi = 0.7)  # pass through mapping network
images  = loader.styles_to_images(styles) # call the generator on intermediate style vectors

save_image(images, './sample.jpg')

BibTeX entry and citation info

The model is part of the practical-ml repository.

GitHub Repo stars