{"id":13528938,"url":"https://github.com/znxlwm/pytorch-generative-model-collections","last_synced_at":"2025-05-15T14:04:57.968Z","repository":{"id":44334504,"uuid":"101957429","full_name":"znxlwm/pytorch-generative-model-collections","owner":"znxlwm","description":"Collection of generative models in Pytorch version.","archived":false,"fork":false,"pushed_at":"2020-04-12T11:55:29.000Z","size":130147,"stargazers_count":2631,"open_issues_count":27,"forks_count":541,"subscribers_count":63,"default_branch":"master","last_synced_at":"2025-05-15T14:04:50.415Z","etag":null,"topics":["acgan","began","cgan","collection","conditional-gan","dragan","ebgan","fashion-mnist","gan","generative-adversarial-network","infogan","lsgan","mnist","package","pytorch","wgan","wgan-gp"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/znxlwm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-31T03:58:25.000Z","updated_at":"2025-05-06T03:29:31.000Z","dependencies_parsed_at":"2022-08-26T14:31:54.832Z","dependency_job_id":null,"html_url":"https://github.com/znxlwm/pytorch-generative-model-collections","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/znxlwm%2Fpytorch-generative-model-collections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znxlwm%2Fpytorch-generative-model-collections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znxlwm%2Fpytorch-generative-model-collections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znxlwm%2Fpytorch-generative-model-collections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znxlwm","download_url":"https://codeload.github.com/znxlwm/pytorch-generative-model-collections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"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":["acgan","began","cgan","collection","conditional-gan","dragan","ebgan","fashion-mnist","gan","generative-adversarial-network","infogan","lsgan","mnist","package","pytorch","wgan","wgan-gp"],"created_at":"2024-08-01T07:00:29.018Z","updated_at":"2025-05-15T14:04:52.957Z","avatar_url":"https://github.com/znxlwm.png","language":"Python","funding_links":[],"categories":["Uncategorized","Python","Paper implementations｜论文实现","Paper implementations"],"sub_categories":["Uncategorized","Other libraries｜其他库:","Other libraries:"],"readme":"# pytorch-generative-model-collections\nOriginal : [[Tensorflow version]](https://github.com/hwalsuklee/tensorflow-generative-model-collections)\n\nPytorch implementation of various GANs.\n\nThis repository was re-implemented with reference to [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections) by [Hwalsuk Lee](https://github.com/hwalsuklee)\n\nI tried to implement this repository as much as possible with [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections), But some models are a little different.\n\nThis repository is included code for CPU mode Pytorch, but i did not test. I tested only in GPU mode Pytorch.\n\n## Dataset\n\n- MNIST\n- Fashion-MNIST\n- CIFAR10\n- SVHN\n- STL10\n- LSUN-bed\n#### I only tested the code on MNIST and Fashion-MNIST.\n\n## Generative Adversarial Networks (GANs)\n### Lists (Table is borrowed from [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections))\n\n*Name* | *Paper Link* | *Value Function*\n:---: | :---: | :--- |\n**GAN** | [Arxiv](https://arxiv.org/abs/1406.2661) | \u003cimg src = 'assets/equations/GAN.png' height = '70px'\u003e\n**LSGAN**| [Arxiv](https://arxiv.org/abs/1611.04076) | \u003cimg src = 'assets/equations/LSGAN.png' height = '70px'\u003e\n**WGAN**| [Arxiv](https://arxiv.org/abs/1701.07875) | \u003cimg src = 'assets/equations/WGAN.png' height = '105px'\u003e\n**WGAN_GP**| [Arxiv](https://arxiv.org/abs/1704.00028) | \u003cimg src = 'assets/equations/WGAN_GP.png' height = '70px'\u003e\n**DRAGAN**| [Arxiv](https://arxiv.org/abs/1705.07215) | \u003cimg src = 'assets/equations/DRAGAN.png' height = '70px'\u003e\n**CGAN**| [Arxiv](https://arxiv.org/abs/1411.1784) | \u003cimg src = 'assets/equations/CGAN.png' height = '70px'\u003e\n**infoGAN**| [Arxiv](https://arxiv.org/abs/1606.03657) | \u003cimg src = 'assets/equations/infoGAN.png' height = '70px'\u003e\n**ACGAN**| [Arxiv](https://arxiv.org/abs/1610.09585) | \u003cimg src = 'assets/equations/ACGAN.png' height = '70px'\u003e\n**EBGAN**| [Arxiv](https://arxiv.org/abs/1609.03126) | \u003cimg src = 'assets/equations/EBGAN.png' height = '70px'\u003e\n**BEGAN**| [Arxiv](https://arxiv.org/abs/1703.10717) | \u003cimg src = 'assets/equations/BEGAN.png' height = '105px'\u003e  \n\n#### Variants of GAN structure (Figures are borrowed from [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections))\n\u003cimg src = 'assets/etc/GAN_structure.png' height = '600px'\u003e\n\n### Results for mnist\nNetwork architecture of generator and discriminator is the exaclty sames as in [infoGAN paper](https://arxiv.org/abs/1606.03657).  \nFor fair comparison of core ideas in all gan variants, all implementations for network architecture are kept same except EBGAN and BEGAN. Small modification is made for EBGAN/BEGAN, since those adopt auto-encoder strucutre for discriminator. But I tried to keep the capacity of discirminator.\n\nThe following results can be reproduced with command:  \n```\npython main.py --dataset mnist --gan_type \u003cTYPE\u003e --epoch 50 --batch_size 64\n```\n\n#### Fixed generation\nAll results are generated from the fixed noise vector.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\nGAN | \u003cimg src = 'assets/mnist_results/GAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/GAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/GAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/GAN_generate_animation.gif' height = '200px'\u003e\nLSGAN | \u003cimg src = 'assets/mnist_results/LSGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/LSGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/LSGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/LSGAN_generate_animation.gif' height = '200px'\u003e\nWGAN | \u003cimg src = 'assets/mnist_results/WGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_generate_animation.gif' height = '200px'\u003e\nWGAN_GP | \u003cimg src = 'assets/mnist_results/WGAN_GP_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_GP_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_GP_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/WGAN_GP_generate_animation.gif' height = '200px'\u003e\nDRAGAN | \u003cimg src = 'assets/mnist_results/DRAGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/DRAGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/DRAGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/DRAGAN_generate_animation.gif' height = '200px'\u003e\nEBGAN | \u003cimg src = 'assets/mnist_results/EBGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/EBGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/EBGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/EBGAN_generate_animation.gif' height = '200px'\u003e\nBEGAN | \u003cimg src = 'assets/mnist_results/BEGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/BEGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/BEGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/BEGAN_generate_animation.gif' height = '200px'\u003e\n\n#### Conditional generation\nEach row has the same noise vector and each column has the same label condition.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\nCGAN | \u003cimg src = 'assets/mnist_results/CGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/CGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/CGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/CGAN_generate_animation.gif' height = '200px'\u003e\nACGAN | \u003cimg src = 'assets/mnist_results/ACGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/ACGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/ACGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/ACGAN_generate_animation.gif' height = '200px'\u003e\ninfoGAN | \u003cimg src = 'assets/mnist_results/infoGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_generate_animation.gif' height = '200px'\u003e\n\n#### InfoGAN : Manipulating two continous codes\nAll results have the same noise vector and label condition, but have different continous vector.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\ninfoGAN | \u003cimg src = 'assets/mnist_results/infoGAN_cont_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_cont_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_cont_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/mnist_results/infoGAN_cont_generate_animation.gif' height = '200px'\u003e\n\n#### Loss plot\n\n*Name* | *Loss*\n:---: | :---: |\nGAN | \u003cimg src = 'assets/mnist_results/GAN_loss.png' height = '230px'\u003e\nLSGAN | \u003cimg src = 'assets/mnist_results/LSGAN_loss.png' height = '230px'\u003e\nWGAN | \u003cimg src = 'assets/mnist_results/WGAN_loss.png' height = '230px'\u003e\nWGAN_GP | \u003cimg src = 'assets/mnist_results/WGAN_GP_loss.png' height = '230px'\u003e\nDRAGAN | \u003cimg src = 'assets/mnist_results/DRAGAN_loss.png' height = '230px'\u003e\nEBGAN | \u003cimg src = 'assets/mnist_results/EBGAN_loss.png' height = '230px'\u003e\nBEGAN | \u003cimg src = 'assets/mnist_results/BEGAN_loss.png' height = '230px'\u003e\nCGAN | \u003cimg src = 'assets/mnist_results/CGAN_loss.png' height = '230px'\u003e\nACGAN | \u003cimg src = 'assets/mnist_results/ACGAN_loss.png' height = '230px'\u003e\ninfoGAN | \u003cimg src = 'assets/mnist_results/infoGAN_loss.png' height = '230px'\u003e\n\n### Results for fashion-mnist\nComments on network architecture in mnist are also applied to here.  \n[Fashion-mnist](https://github.com/zalandoresearch/fashion-mnist) is a recently proposed dataset consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. (T-shirt/top, Trouser, Pullover, Dress, Coat, Sandal, Shirt, Sneaker, Bag, Ankle boot)\n\nThe following results can be reproduced with command:  \n```\npython main.py --dataset fashion-mnist --gan_type \u003cTYPE\u003e --epoch 50 --batch_size 64\n```\n\n#### Fixed generation\nAll results are generated from the fixed noise vector.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\nGAN | \u003cimg src = 'assets/fashion_mnist_results/GAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/GAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/GAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/GAN_generate_animation.gif' height = '200px'\u003e\nLSGAN | \u003cimg src = 'assets/fashion_mnist_results/LSGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/LSGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/LSGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/LSGAN_generate_animation.gif' height = '200px'\u003e\nWGAN | \u003cimg src = 'assets/fashion_mnist_results/WGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_generate_animation.gif' height = '200px'\u003e\nWGAN_GP | \u003cimg src = 'assets/fashion_mnist_results/WGAN_GP_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_GP_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_GP_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/WGAN_GP_generate_animation.gif' height = '200px'\u003e\nDRAGAN | \u003cimg src = 'assets/fashion_mnist_results/DRAGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/DRAGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/DRAGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/DRAGAN_generate_animation.gif' height = '200px'\u003e\nEBGAN | \u003cimg src = 'assets/fashion_mnist_results/EBGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/EBGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/EBGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/EBGAN_generate_animation.gif' height = '200px'\u003e\nBEGAN | \u003cimg src = 'assets/fashion_mnist_results/BEGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/BEGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/BEGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/BEGAN_generate_animation.gif' height = '200px'\u003e\n\n#### Conditional generation\nEach row has the same noise vector and each column has the same label condition.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\nCGAN | \u003cimg src = 'assets/fashion_mnist_results/CGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/CGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/CGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/CGAN_generate_animation.gif' height = '200px'\u003e\nACGAN | \u003cimg src = 'assets/fashion_mnist_results/ACGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/ACGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/ACGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/ACGAN_generate_animation.gif' height = '200px'\u003e\ninfoGAN | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_generate_animation.gif' height = '200px'\u003e\n\n- ACGAN tends to fall into mode-collapse in [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections), but Pytorch ACGAN does not fall into mode-collapse.\n\n#### InfoGAN : Manipulating two continous codes\nAll results have the same noise vector and label condition, but have different continous vector.\n\n*Name* | *Epoch 1* | *Epoch 25* | *Epoch 50* | *GIF*\n:---: | :---: | :---: | :---: | :---: |\ninfoGAN | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_cont_epoch001.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_cont_epoch025.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_cont_epoch050.png' height = '200px'\u003e | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_cont_generate_animation.gif' height = '200px'\u003e\n\n#### Loss plot\n\n*Name* | *Loss*\n:---: | :---: |\nGAN | \u003cimg src = 'assets/fashion_mnist_results/GAN_loss.png' height = '230px'\u003e\nLSGAN | \u003cimg src = 'assets/fashion_mnist_results/LSGAN_loss.png' height = '230px'\u003e\nWGAN | \u003cimg src = 'assets/fashion_mnist_results/WGAN_loss.png' height = '230px'\u003e\nWGAN_GP | \u003cimg src = 'assets/fashion_mnist_results/WGAN_GP_loss.png' height = '230px'\u003e\nDRAGAN | \u003cimg src = 'assets/fashion_mnist_results/DRAGAN_loss.png' height = '230px'\u003e\nEBGAN | \u003cimg src = 'assets/fashion_mnist_results/EBGAN_loss.png' height = '230px'\u003e\nBEGAN | \u003cimg src = 'assets/fashion_mnist_results/BEGAN_loss.png' height = '230px'\u003e\nCGAN | \u003cimg src = 'assets/fashion_mnist_results/CGAN_loss.png' height = '230px'\u003e\nACGAN | \u003cimg src = 'assets/fashion_mnist_results/ACGAN_loss.png' height = '230px'\u003e\ninfoGAN | \u003cimg src = 'assets/fashion_mnist_results/infoGAN_loss.png' height = '230px'\u003e\n\n## Folder structure\nThe following shows basic folder structure.\n```\n├── main.py # gateway\n├── data\n│   ├── mnist # mnist data (not included in this repo)\n│   ├── ...\n│   ├── ...\n│   └── fashion-mnist # fashion-mnist data (not included in this repo)\n│\n├── GAN.py # vainilla GAN\n├── utils.py # utils\n├── dataloader.py # dataloader\n├── models # model files to be saved here\n└── results # generation results to be saved here\n```\n\n## Development Environment\n* Ubuntu 16.04 LTS\n* NVIDIA GTX 1080 ti\n* cuda 9.0\n* Python 3.5.2\n* pytorch 0.4.0\n* torchvision 0.2.1\n* numpy 1.14.3\n* matplotlib 2.2.2\n* imageio 2.3.0\n* scipy 1.1.0\n\n## Acknowledgements\nThis implementation has been based on [tensorflow-generative-model-collections](https://github.com/hwalsuklee/tensorflow-generative-model-collections) and tested with Pytorch 0.4.0 on Ubuntu 16.04 using GPU.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznxlwm%2Fpytorch-generative-model-collections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznxlwm%2Fpytorch-generative-model-collections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznxlwm%2Fpytorch-generative-model-collections/lists"}