{"id":13477205,"url":"https://github.com/mafda/generative_adversarial_networks_101","last_synced_at":"2025-04-09T13:10:15.729Z","repository":{"id":81393531,"uuid":"137363612","full_name":"mafda/generative_adversarial_networks_101","owner":"mafda","description":"Keras implementations of Generative Adversarial Networks. GANs, DCGAN, CGAN, CCGAN, WGAN and LSGAN models with MNIST and CIFAR-10 datasets.","archived":false,"fork":false,"pushed_at":"2023-11-08T01:10:52.000Z","size":16918,"stargazers_count":209,"open_issues_count":0,"forks_count":79,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T06:51:18.188Z","etag":null,"topics":["ccgan","ccgans","cgan","cgans","cifar-10","cifar10","conda-environment","dcgan","gan","gans","generative-adversarial-network","generative-adversarial-networks","jupyter-notebook","keras","lsgan","lsgans","mnist","mnist-dataset","tensorflow","wgan"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mafda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-06-14T13:43:36.000Z","updated_at":"2025-02-17T07:30:12.000Z","dependencies_parsed_at":"2024-01-13T19:18:04.854Z","dependency_job_id":"365a5b54-589e-4f79-8d64-0341c34fbe1c","html_url":"https://github.com/mafda/generative_adversarial_networks_101","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fgenerative_adversarial_networks_101","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fgenerative_adversarial_networks_101/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fgenerative_adversarial_networks_101/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mafda%2Fgenerative_adversarial_networks_101/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mafda","download_url":"https://codeload.github.com/mafda/generative_adversarial_networks_101/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045245,"owners_count":21038554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ccgan","ccgans","cgan","cgans","cifar-10","cifar10","conda-environment","dcgan","gan","gans","generative-adversarial-network","generative-adversarial-networks","jupyter-notebook","keras","lsgan","lsgans","mnist","mnist-dataset","tensorflow","wgan"],"created_at":"2024-07-31T16:01:39.425Z","updated_at":"2025-04-09T13:10:15.708Z","avatar_url":"https://github.com/mafda.png","language":"Jupyter Notebook","funding_links":[],"categories":["Jupyter Notebook"],"sub_categories":[],"readme":"# Generative Adversarial Networks - GANs\n\nThis repository presents the **basic notions** that involve the concept of Generative Adversarial Networks.\n\n\u003e *\"...the most interesting idea in the last 10 years in ML\". Yann LeCun*\n\n## Definition\n\n[Generative Adversarial Networks or GANs](https://arxiv.org/abs/1406.2661) is a framework proposed by [Ian Goodfellow](http://www.iangoodfellow.com/), Yoshua Bengio and others in 2014.\n\nGANs are composed of two models, represented by artificial neural network:\n* The first model is called a **Generator** and it aims to generate new data similar to the expected one.\n* The second model is named the **Discriminator** and it aims to recognize if an input data is ‘real’ — belongs to the original dataset — or if it is ‘fake’ — generated by a forger.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"img/gans_arq.png\" width=\"600\"\\\u003e\n\u003c/p\u003e\n\nRead more in this post [GANs — Generative Adversarial Networks 101](https://mafda.medium.com/gans-generative-adversarial-networks-101-8bf8e304585c).\n\n## Configure environment\n\n- Create the conda environment\n\n```shell\n(base)$: conda env create -f environment.yml\n```\n\n- Activate the environment\n\n```shell\n(base)$: conda activate gans_101\n```\n\n- Run!\n\n```shell\n(gans_101)$: python -m jupyter notebook\n```\n\n## Models\n\nDefinition and training some models with MNIST and CIFAR-10 datasets.\n\n### MNIST dataset\n\n* GAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/01_GAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-generative-adversarial-network-with-mnist-part-db8b9c061de0)\n* DCGAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/02_DCGAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-deep-convolutional-gans-with-mnist-part-3-8bad9a96ff65)\n* CGAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/03_CGAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-conditional-gans-with-mnist-part-4-7f816d274d8c)\n* CCGAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/04_CCGAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-context-conditional-gans-with-mnist-part-5-a8d56a243377)\n* WGAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/05_WGAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-wasserstein-gan-with-mnist-part-6-7f796a0cea47)\n* LSGAN - MNIST [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/06_LSGAN_MNIST.ipynb) - [Post Medium](https://mafda.medium.com/gans-least-squares-gans-with-mnist-part-7-e6cf2fff503c)\n\n### CIFAR-10 dataset\n\n* DCGAN - CIFAR10 [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/cifar10/02_DCGAN_CIFAR10.ipynb) - [Post Medium](https://mafda.medium.com/gans-deep-convolutional-gans-with-cifar10-part-8-be881a77e55b)\n* CGAN - CIFAR10 [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/cifar10/03_CGAN_CIFAR10.ipynb) - [Post Medium](https://mafda.medium.com/gans-conditional-gans-with-cifar10-part-9-8e47373e33b8)\n\n\n## Results\n\nTraining models with Keras - TensorFlow.\n\n### MNIST dataset\n\n#### Generative Adversarial Networks - GANs\nA GANs implementation using fully connected layers. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/01_GAN_MNIST.ipynb)\n\n| Epoch 00                          | Epoch 100                          | Loss                                |\n| --------------------------------- | ---------------------------------- | ----------------------------------- |\n| ![GAN with MNIST](img/00_gan.png) | ![GAN with MNIST](img/100_gan.png) | ![GAN with MNIST](img/loss_gan.png) |\n\n#### Deep Convolutional Generative Adversarial Networks - DCGANs\nA DCGANs implementation using the transposed convolution technique. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/02_DCGAN_MNIST.ipynb)\n\n| Epoch 00                            | Epoch 100                            | Loss                                  |\n| ----------------------------------- | ------------------------------------ | ------------------------------------- |\n| ![GAN with MNIST](img/00_dcgan.png) | ![GAN with MNIST](img/100_dcgan.png) | ![GAN with MNIST](img/loss_dcgan.png) |\n\n#### Conditional Generative Adversarial Nets - CGANs\nA CGANs implementation using fully connected layers and embedding layers. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/03_CGAN_MNIST.ipynb)\n\n| Epoch 00                            | Epoch 100                            | Loss                                  |\n| ----------------------------------- | ------------------------------------ | ------------------------------------- |\n| ![CGAN with MNIST](img/00_cgan.png) | ![CGAN with MNIST](img/100_cgan.png) | ![CGAN with MNIST](img/loss_cgan.png) |\n\n#### Context-Conditional Generative Adversarial Networks - CCGANs\nA CCGANs implementation using U-Net and convolutional neural network. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/04_CCGAN_MNIST.ipynb)\n\n| Epoch 00                             | Epoch 100                             | Loss                                   |\n| ------------------------------------ | ------------------------------------- | -------------------------------------- |\n| ![CGAN with MNIST](img/00_ccgan.png) | ![CGAN with MNIST](img/100_ccgan.png) | ![CGAN with MNIST](img/loss_ccgan.png) |\n\n#### Wasserstein Generative Adversarial Networks - WGANs\nA WGANs implementation using convolutional neural network. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/05_WGAN_MNIST.ipynb)\n\n| Epoch 00                            | Epoch 100                            | Loss                                  |\n| ----------------------------------- | ------------------------------------ | ------------------------------------- |\n| ![WGAN with MNIST](img/00_wgan.png) | ![WGAN with MNIST](img/100_wgan.png) | ![WGAN with MNIST](img/loss_wgan.png) |\n\n#### Least Squares General Adversarial Networks - LSGANs\nA LSGANs implementation using using fully connected layers. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/mnist/06_LSGAN_MNIST.ipynb)\n\n| Epoch 00                                    | Epoch 100                                    | Loss                                          |\n| ------------------------------------------- | -------------------------------------------- | --------------------------------------------- |\n| ![LSGAN with MNIST](img/00_lsgan_mnist.png) | ![LSGAN with MNIST](img/100_lsgan_mnist.png) | ![LSGAN with MNIST](img/loss_lsgan_mnist.png) |\n\n\n\n### CIFAR-10 dataset\n\n#### Deep Convolutional Generative Adversarial Networks - DCGANs\nA DCGANs implementation using the transposed convolution technique. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/cifar10/02_DCGAN_CIFAR10.ipynb)\n\n| Epoch 00                                       | Epoch 100                                       | Loss                                             |\n| ---------------------------------------------- | ----------------------------------------------- | ------------------------------------------------ |\n| ![DCGAN with CIFAR-10](img/00_dcgan_cifar.png) | ![DCGAN with CIFAR-10](img/100_dcgan_cifar.png) | ![DCGAN with CIFAR-10](img/loss_dcgan_cifar.png) |\n\n#### Conditional Generative Adversarial Networks - CGANs\nA CGANs implementation using the transposed convolution and convolution neural network, and concatenate layers. [Notebook](https://github.com/mafda/generative_adversarial_networks_101/blob/master/src/cifar10/03_CGAN_CIFAR10.ipynb)\n\n| Epoch 00                                     | Epoch 100                                     | Loss                                           |\n| -------------------------------------------- | --------------------------------------------- | ---------------------------------------------- |\n| ![CGAN with CIFAR-10](img/00_cgan_cifar.png) | ![CGAN with CIFAR-10](img/100_cgan_cifar.png) | ![CGAN with CIFAR-10](img/loss_cgan_cifar.png) |\n\n---\n\n## References\n\n* Complete Post Medium\n  * [GANs — Generative Adversarial Networks 101](https://mafda.medium.com/gans-generative-adversarial-networks-101-8bf8e304585c)\n\n* Related papers:\n    * [Generative Adversarial Networks](https://arxiv.org/abs/1406.2661)\n    * [Unsupervised Representation Learning With Deep Convolutional](https://arxiv.org/pdf/1511.06434.pdf)\n    * [Conditional Generative Adversarial Nets](https://arxiv.org/pdf/1411.1784.pdf)\n    * [Semi-Supervised Learning with Context-Conditional Generative Adversarial Networks](https://arxiv.org/pdf/1611.06430.pdf)\n    * [Wasserstein GAN](https://arxiv.org/pdf/1701.07875.pdf)\n    * [Least Squares General Adversarial Networks](https://arxiv.org/pdf/1611.04076.pdf)\n\n* Datasets:\n    * [THE MNIST DATABASE of handwritten digits](http://yann.lecun.com/exdb/mnist/)\n    * [The CIFAR-10 dataset](https://www.cs.toronto.edu/%7Ekriz/cifar.html)\n\n* Other repositories:\n    * [Keras-GAN](https://github.com/eriklindernoren/Keras-GAN)\n    * [Adversarial Nets Papers](https://github.com/zhangqianhui/AdversarialNetsPapers)\n    * [How to Train a GAN? Tips and tricks to make GANs work](https://github.com/soumith/ganhacks)\n    * [The GAN Zoo](https://github.com/hindupuravinash/the-gan-zoo)\n    * [GAN Lab: An Interactive, Visual Experimentation Tool for Generative Adversarial Networks](https://github.com/poloclub/ganlab)\n    * [gans-awesome-applications](https://github.com/nashory/gans-awesome-applications)\n    * [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections)\n\n---\n\nmade with 💙 by [mafda](https://mafda.github.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Fgenerative_adversarial_networks_101","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmafda%2Fgenerative_adversarial_networks_101","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmafda%2Fgenerative_adversarial_networks_101/lists"}