Skip to content

An implementation of one personal project to gain experience with Generative Adversarial Network models and in particular on Wasserstrein GAN with gradient penalty. The final application's purpose is to generate synthetic images given a food category.

License

Notifications You must be signed in to change notification settings

MrCosta57/foodGAN

Repository files navigation


Pytorch logo Fabric logo

Food GAN project

WGAN-GP for conditional food generation!
View Demo · Report Bug · Request Feature


About The Project

Product Name Screen Shot

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

Getting Started

Deployment

Only CPU inference is supported in the Docker container

  1. Build the Docker image

    docker build -t food_gan .
  2. Run the Docker container

    docker run -p 8501:8501 food_gan
  3. Open the browser and go to http://localhost:8501

Development

  1. Clone the repo

    git clone https://github.com/MrCosta57/food_gan.git
  2. 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
  3. Enter your configuration in config.py or use the default one

  4. Train the model

    python src/train.py
  5. 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

Roadmap / Future work

  • 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).

References

@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}
}

About

An implementation of one personal project to gain experience with Generative Adversarial Network models and in particular on Wasserstrein GAN with gradient penalty. The final application's purpose is to generate synthetic images given a food category.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages