Skip to content
Conditional GAN for Anime face generation.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
images
README.md
dataloader.py
generate.py
model.py
prepro.py Rename file. Dec 21, 2018
train.py

README.md

Conditional AnimeGAN

PyTorch implementation of conditional Generative Adversarial Network (cGAN) for Anime face generation conditioned on eye color and hair color.

Generated Data Animation

Row-1: Brown Eyes Blonde Hair
Row-2: Blue Eyes Blue Hair
Row-3: Red Eyes Green Hair
Row-4: Purple Eyes Orange Hair
Row-5: Green Eyes Purple Hair
Row-6: Aqua Eyes Pink Hair

You can download the dataset from the following repo.

Training

Download the data and place it in the data/ directory. (Optional) Run prepro.py to clean and preprocess the data. Run train.py to start training. To change the hyperparameters of the network, update the values in the param dictionary in train.py. Checkpoints will be saved by default in the checkpoint directory every 2 epochs. By deafult, GPU will be used for training if available. (Training on CPU is not recommended)

Loss Curve

Training Loss Curves

D: Discriminator, G: Generator

Generating New Images

To generate new images run generate.py.

python3 generate.py -load_path /path/to/pth/checkpoint -num_output n -eye_color c1 -hair_color c2
  • Possible colors for eyes
['yellow', 'gray', 'blue', 'brown', 'red', 'green', 'purple', 'orange',
 'black', 'aqua', 'pink', 'bicolored']
  • Possible colors for hair
['gray', 'blue', 'brown', 'red', 'blonde', 'green', 'purple', 'orange',
 'black', 'aqua', 'pink', 'white']

Results

Training Data cDCGAN after 50 epochs

Some Generated Samples:

Blue Eyes Blonde Hair
Blue Eyes Blonde Hair
Red Eyes Blonde Hair
Red Eyes Blonde Hair
Green Eyes Purple Hair
Green Eyes Purple Hair
Red Eyes Green Hair
Red Eyes Green Hair
Aqua Eyes Pink Hair
Aqua Eyes Pink Hair
Red Eyes Purple Hair
Red Eyes Purple Hair

References

  1. Mehdi Mirza, Simon Osindero. Conditional Generative Adversarial Nets. [arxiv]
  2. Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, Honglak Lee. Generative Adversarial Text to Image Synthesis. [arxiv]
  3. m516825/Conditional-GAN [repo]
  4. soumith/ganhacks [repo]
You can’t perform that action at this time.