This project refers to the implementation of one personal project for approaching the Generative AI field.
The idea is to gain experience with Generative Adversarial Network models and in particular on Wasserstrein GAN with gradient penalty. This variant allows a more stable training procedure, get rids of some problems like mode collapse and provides a meaningful loss function interpretation. The final application's purpose is to generate synthetic images given a food category.
In details the NN architectures and the hyperparameters used are taken from different popular parers cited in References section while instead, the development is realized with Pytorch and Lighting Fabric
Only CPU inference is supported in the Docker container
-
Build the Docker image
docker build -t food_gan .
-
Run the Docker container
docker run -p 8501:8501 food_gan
-
Open the browser and go to
http://localhost:8501
-
Clone the repo
git clone https://github.com/MrCosta57/food_gan.git
-
Run the following commands to install the required libraries
# CPU pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu # CUDA pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118
-
Enter your configuration in
config.py
or use the default one -
Train the model
python src/train.py
-
Run the streamlit GUI
streamlit run src/app.py
Note: Before run the streamlit GUI you must place some model checkpoint in checkpoints/
directory or train the model from scratch. You can download one checkpoint from Google Drive
- Base project structure
- GAN implementation using parameters and convolutional architectures from different papers
- Train model for more epochs and trying different parameters
- Trying other discriminator/generator architecture or model
See the open issues for a full list of proposed features (and known issues).
@misc{goodfellow2014generative,
title={Generative Adversarial Networks},
author={Ian J. Goodfellow and Jean Pouget-Abadie and Mehdi Mirza and Bing Xu and David Warde-Farley and Sherjil Ozair and Aaron Courville and Yoshua Bengio},
year={2014},
eprint={1406.2661},
archivePrefix={arXiv},
primaryClass={stat.ML}
}
@misc{radford2016unsupervised,
title={Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks},
author={Alec Radford and Luke Metz and Soumith Chintala},
year={2016},
eprint={1511.06434},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@misc{arjovsky2017wasserstein,
title={Wasserstein GAN},
author={Martin Arjovsky and Soumith Chintala and Léon Bottou},
year={2017},
eprint={1701.07875},
archivePrefix={arXiv},
primaryClass={stat.ML}
}
@misc{gulrajani2017improved,
title={Improved Training of Wasserstein GANs},
author={Ishaan Gulrajani and Faruk Ahmed and Martin Arjovsky and Vincent Dumoulin and Aaron Courville},
year={2017},
eprint={1704.00028},
archivePrefix={arXiv},
primaryClass={cs.LG}
}