PyTorch implementation of conditional Generative Adversarial Network (cGAN) for Anime face generation conditioned on eye color and hair color.
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.
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
D: Discriminator, G: GeneratorTo 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']
Training Data | cDCGAN after 50 epochs |
Blue Eyes Blonde Hair
Red Eyes Blonde Hair
Green Eyes Purple Hair
Red Eyes Green Hair
Aqua Eyes Pink Hair
Red Eyes Purple Hair