This is a GAN demo for creating anime character faces from random noise.
- main.py
- gan.py
- utils.py
- generate.py
- dcgan.py
- nets.py
- show.html
- show.js
- spider.py
main.py
contains training configurations.
gan.py
defines net structure.
utils.py
contains some auxiliary functions.
generate.py
generates anime faces.
dcgan.py
and nets.py
are rebuild versions of main.py
and gan.py
(not completed). show.html
and show.js
are for future presentation on web via Keras.js.
spider.py
collects and downloads training images from the Internet, thanks for the provider Acokil!
Datasets are not uploaded.
- faces.zip
- hqface.zip
faces.zip
is an anime face dataset with the image shape of (96, 96, 3). They are collected from Konachan.
hqface.zip
is also collected from Konachan, but contains images with higher quality.
- Linux CentOS
- Windows 10
The linux mainly serves as training platform. Windows is for coding.
- Nvidia Tesla K40M
GPUs are from ZJUSPC. Thanks for the authorization of the usage of K40M from ZJUSPC!
Code references: GAN-Zoo
Paper references:
- Generative Adversarial Nets (arxiv id: 1406.2661v1)
- Conditional Generative Adversarial Nets (arxiv id: 1411.1784v1)
- Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks (arxiv id: 1511.06434v2)
Here are some generated faces. I used a 300-d random noise as input and trained for 40,000 iterations. In each iteration, I used 64 images to train the model.
As you can see, the quality of these faces is not good enough. In fact, for most of the generated images you can only recognize blurry faces so I just picked out some well-performed results. It is hard but worth to improve the model's performance.
Try to improve performance via these approaches:
- Use high quality training images
- Use larger training images
I adjusted the GAN. Then I used dataset hqface
with the shape of (112, 112, 3) of each image to train a new model. It performs better on generating images of higher resolution.
Here are some new examples generated by the new GAN.