{"id":23388303,"url":"https://github.com/grohith327/simplegan","last_synced_at":"2025-04-11T06:28:55.648Z","repository":{"id":149224172,"uuid":"241020347","full_name":"grohith327/simplegan","owner":"grohith327","description":"Tensorflow-based framework to ease training of generative models","archived":false,"fork":false,"pushed_at":"2020-06-12T23:56:42.000Z","size":4492,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T18:54:54.432Z","etag":null,"topics":["computer-vision","deep-learning","gan","generative-adversarial-network","generative-model","neural-networks","python-library","python3","tensorflow"],"latest_commit_sha":null,"homepage":"https://simplegan.readthedocs.io","language":"Python","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/grohith327.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-17T04:37:20.000Z","updated_at":"2022-01-09T11:04:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"a80ade9c-14e7-465f-aa64-2a88f33600e8","html_url":"https://github.com/grohith327/simplegan","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grohith327%2Fsimplegan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grohith327%2Fsimplegan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grohith327%2Fsimplegan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grohith327%2Fsimplegan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grohith327","download_url":"https://codeload.github.com/grohith327/simplegan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248354238,"owners_count":21089778,"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":["computer-vision","deep-learning","gan","generative-adversarial-network","generative-model","neural-networks","python-library","python3","tensorflow"],"created_at":"2024-12-22T02:18:39.426Z","updated_at":"2025-04-11T06:28:55.628Z","avatar_url":"https://github.com/grohith327.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleGAN\n\n[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE) [![Documentation Status](https://readthedocs.org/projects/simplegan/badge/?version=latest)](https://simplegan.readthedocs.io/en/latest/?badge=latest) [![Downloads](https://pepy.tech/badge/simplegan)](https://pepy.tech/project/simplegan) [![Downloads](https://pepy.tech/badge/simplegan/month)](https://pepy.tech/project/simplegan/month) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n**Framework to ease training of generative models**\n\nSimpleGAN is a framework based on [TensorFlow](https://www.tensorflow.org/) to make training of generative models easier. SimpleGAN provides high level APIs with customizability options to user which allows them to train a generative models with few lines of code or the user can reuse modules from the exisiting architectures to run custom training loops and experiments.\n\n### Requirements\n\nMake sure you have the following packages installed\n\n- [tensorflow](https://www.tensorflow.org/install)\n- [tqdm](https://github.com/tqdm/tqdm#latest-pypi-stable-release)\n- [imagio](https://pypi.org/project/imageio/)\n- [opencv](https://pypi.org/project/opencv-python/)\n- [tensorflow-datasets](https://www.tensorflow.org/datasets/overview#installation)\n\n### Installation\n\nLatest stable release:\n\n```bash\n  $ pip install simplegan\n```\n\nLatest Development release:\n\n```bash\n  $ pip install git+https://github.com/grohith327/simplegan.git\n```\n\n### Getting Started\n\n##### DCGAN\n\n```python\nfrom simplegan.gan import DCGAN\n\n## initialize model\ngan = DCGAN()\n\n## load train data\ntrain_ds = gan.load_data(use_mnist = True)\n\n## get samples from the data object\nsamples = gan.get_sample(train_ds, n_samples = 5)\n\n## train the model\ngan.fit(train_ds = train_ds)\n\n## get generated samples from model\ngenerated_samples = gan.generate_samples(n_samples = 5)\n```\n\n##### Custom training loops for GANs\n\n```python\nfrom simplegan.gan import Pix2Pix\n\n## initialize model\ngan = Pix2Pix()\n\n## get generator module of Pix2Pix\ngenerator = gan.generator() ## A tf.keras model\n\n## get discriminator module of Pix2Pix\ndiscriminator = gan.discriminator() ## A tf.keras model\n\n## training loop\nwith tf.GradientTape() as tape:\n\"\"\" Custom training loops \"\"\"\n```\n\n##### Convolutional Autoencoder\n\n```python\nfrom simplegan.autoencoder import ConvolutionalAutoencoder\n\n## initialize autoencoder\nautoenc = ConvolutionalAutoencoder()\n\n## load train and test data\ntrain_ds, test_ds = autoenc.load_data(use_cifar10 = True)\n\n## get sample from data object\ntrain_sample = autoenc.get_sample(data = train_ds, n_samples = 5)\ntest_sample = autoenc.get_sample(data = test_ds, n_samples = 1)\n\n## train the autoencoder\nautoenc.fit(train_ds = train_ds, epochs = 5, optimizer = 'RMSprop', learning_rate = 0.002)\n\n## get generated test samples from model\ngenerated_samples = autoenc.generate_samples(test_ds = test_ds.take(1))\n```\n\nTo have a look at more examples in detail, check [here](examples)\n\n### Documentation\n\nCheck out the [docs page](https://simplegan.readthedocs.io/en/latest/)\n\n### Provided models\n\n|                                         Model                                          |                                 Generated Images                                  |\n| :------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------: |\n|                                  Vanilla Autoencoder                                   |                                       None                                        |\n|                               Convolutional Autoencoder                                | ![](https://github.com/grohith327/simplegan/blob/master/assets/mnist_conv_ae.png) |\n|           Variational Autoencoder [[Paper](https://arxiv.org/abs/1312.6114)]           |     ![](https://github.com/grohith327/simplegan/blob/master/assets/vae.jpeg)      |\n| Vector Quantized - Variational Autoencoder [[Paper](https://arxiv.org/abs/1711.00937)] |    ![](https://github.com/grohith327/simplegan/blob/master/assets/vq_vae.png)     |\n|                 Vanilla GAN [[Paper](https://arxiv.org/abs/1406.2661)]                 |      ![](https://github.com/grohith327/simplegan/blob/master/assets/GAN.png)      |\n|                   DCGAN [[Paper](https://arxiv.org/abs/1511.06434)]                    |     ![](https://github.com/grohith327/simplegan/blob/master/assets/DCGAN.png)     |\n|                    WGAN [[Paper](https://arxiv.org/abs/1701.07875)]                    |     ![](https://github.com/grohith327/simplegan/blob/master/assets/WGAN.png)      |\n|                    CGAN [[Paper](https://arxiv.org/abs/1411.1784)]                     |     ![](https://github.com/grohith327/simplegan/blob/master/assets/CGAN.png)      |\n|                  InfoGAN [[Paper](https://arxiv.org/abs/1606.03657)]                   |    ![](https://github.com/grohith327/simplegan/blob/master/assets/InfoGAN.png)    |\n|                  Pix2Pix [[Paper](https://arxiv.org/abs/1611.07004)]                   |    ![](https://github.com/grohith327/simplegan/blob/master/assets/Pix2Pix.png)    |\n|                  CycleGAN [[Paper](https://arxiv.org/abs/1703.10593)]                  |   ![](https://github.com/grohith327/simplegan/blob/master/assets/CycleGAN.png)    |\n|      3DGAN(VoxelGAN) [[Paper](http://3dgan.csail.mit.edu/papers/3dgan_nips.pdf)]       |     ![](https://github.com/grohith327/simplegan/blob/master/assets/3DGAN.png)     |\n|       Self-Attention GAN(SAGAN) [[Paper](https://arxiv.org/pdf/1805.08318.pdf)]        |     ![](https://github.com/grohith327/simplegan/blob/master/assets/SAGAN.png)     |\n\n### Contributing\n\nWe appreciate all contributions. If you are planning to perform bug-fixes, add new features or models, please file an issue and discuss before making a pull request.\n\n### Citation\n\n```\n@software{simplegan,\n    author = {{Rohith Gandhi et al.}},\n    title = {simplegan},\n    url = {https://simplegan.readthedocs.io},\n    version = {0.2.9},\n}\n```\n\n### Contributors\n\n- [Rohith Gandhi](https://github.com/grohith327)\n- [Prem Kumar](https://github.com/Prem-kumar27)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrohith327%2Fsimplegan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrohith327%2Fsimplegan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrohith327%2Fsimplegan/lists"}