ani chara gan

eugenesiow

Introduction

ANI-CHARA-GAN is a model designed for generating full-body 256x256 anime characters. It utilizes the stylegan2-pytorch library to train on a private dataset of anime characters.

Architecture

The model is based on StyleGAN2, which is a popular architecture for image generation tasks. It specifically generates square images with a white background, showcasing full-body anime characters.

Training

The model was trained using the stylegan2-pytorch library over 150 epochs. The dataset consists of private anime character images, and the output is optimized for generating detailed 256x256 resolution images.

Guide: Running Locally

To run the model locally, follow these steps:

  1. Install Dependencies:

    pip install -q stylegan2_pytorch==1.5.10
    
  2. Code 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')
    
  3. Hardware Recommendation:
    It is recommended to use a cloud GPU service such as Google Colab for running the model efficiently.

License

The ANI-CHARA-GAN model is released under the Apache-2.0 license.

More Related APIs