Skip to content

A deep learning model that can create high quality images by training on a dataset.

License

Notifications You must be signed in to change notification settings

angeluriot/Generative_adversarial_network

Repository files navigation

🎨 Generative Adversarial Network (GAN)

Release Language Libraries Size Open Source


This project is a deep convolutional generative adversarial network that can create high quality images from a random seed like portraits, animals, drawings and more.



📋 Summary


🤖 Model

🏗️ Architecture

The model is a Generative Adversarial Network (GAN) like described in the paper Generative Adversarial Nets from Montreal University (2014)

The generator and the discriminator are both deep convolutional neural networks like in the paper Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks from Facebook AI Research (2015) but with a few improvements:

For both networks:

For the generator:

For the discriminator:

For training:

For testing:


🧪 Tests

Human faces 256*256 (FID: 5.97)


Animal faces 256*256 (FID: 6.56)


Anime faces 256*256 (FID: 3.74)


Painting faces 256*256 (FID: 20.32)


🎛️ Trained weights

The trained weights on multiple datasets are available on Google Drive, you just need to download the .pt files and put them in the models folder.


📦 Dependencies


Run the following command to install the dependencies:

$ pip install -r requirements.txt

(You may need to use a specific command for PyTorch if you want to use CUDA)


🦾 Training

  • First, you need to find and download a dataset of images (less than 5,000 may be too little and more than 150,000 is not necessary). You can find a lot of datasets on Kaggle and the ones I used on my Google Drive.

  • Then, in the training/settings.py file, specify the path to the dataset

  • If you don't have an overpriced 24GB GPU like me, the default settings may not work for you. You can try to:

    • Lower the batch size (less stable and worse lower point)
    • Increase the accumulation steps (fix previous problems but slower)
    • Lower the min features (worse results)
    • Decrease the image size
  • Run the training.ipynb file (you can stop the training at any time and resume it later thanks to the checkpoints)


⚗️ Testing

  • Run the testing.ipynb file to generate random images

  • Run the testing/interpolation.ipynb file to generate the images of a smooth interpolation video

  • Run the testing/projector.ipynb file to project real images into the latent space

  • Run the testing/style_mixing.ipynb file to generate the images of a style mixing interpolation video

  • Run the testing/timelapse.ipynb file to generate the images of a training timelapse video


🙏 Credits

About

A deep learning model that can create high quality images by training on a dataset.

Topics

Resources

License

Stars

Watchers

Forks