{"id":15633615,"url":"https://github.com/csinva/gan-vae-pretrained-pytorch","last_synced_at":"2025-04-04T12:08:28.689Z","repository":{"id":47704002,"uuid":"171568185","full_name":"csinva/gan-vae-pretrained-pytorch","owner":"csinva","description":"Pretrained GANs + VAEs + classifiers for MNIST/CIFAR in pytorch.","archived":false,"fork":false,"pushed_at":"2025-02-02T23:51:06.000Z","size":103214,"stargazers_count":191,"open_issues_count":2,"forks_count":49,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T11:11:06.469Z","etag":null,"topics":["ai","cifar","cnn","convolutional-neural-networks","dcgan","deep-learning","gan","gans","generative-adversarial-network","generative-adversarial-networks","machine-learning","ml","mnist","neural-network","pretrained","pretrained-models","python","pytorch","pytorch-implementation","statistics"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/csinva.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-19T23:44:09.000Z","updated_at":"2025-03-20T15:07:10.000Z","dependencies_parsed_at":"2025-03-28T11:11:17.524Z","dependency_job_id":"a49d99bf-842e-41fd-b302-8de7aea1db50","html_url":"https://github.com/csinva/gan-vae-pretrained-pytorch","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinva%2Fgan-vae-pretrained-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinva%2Fgan-vae-pretrained-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinva%2Fgan-vae-pretrained-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csinva%2Fgan-vae-pretrained-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csinva","download_url":"https://codeload.github.com/csinva/gan-vae-pretrained-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247174421,"owners_count":20896078,"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":["ai","cifar","cnn","convolutional-neural-networks","dcgan","deep-learning","gan","gans","generative-adversarial-network","generative-adversarial-networks","machine-learning","ml","mnist","neural-network","pretrained","pretrained-models","python","pytorch","pytorch-implementation","statistics"],"created_at":"2024-10-03T10:49:37.723Z","updated_at":"2025-04-04T12:08:23.681Z","avatar_url":"https://github.com/csinva.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e Pre-trained GANs, VAEs + classifiers for MNIST / CIFAR10 \u003c/h1\u003e\n\u003cp align=\"center\"\u003e A simple starting point for modeling with GANs/VAEs in pytorch.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-mit-blue.svg\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/python-3.6--3.9-blue\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/checks-status/csinva/gan-vae-pretrained-pytorch/master\"\u003e\n\u003c/p\u003e  \n\n- includes model class definitions + training scripts\n- includes notebooks showing how to load pretrained nets / use them\n- tested with pytorch 1.0+\n- generates images the same size as the dataset images\n\n### mnist\n\nGenerates images the size of the MNIST dataset (28x28), using an architecture based on the [DCGAN paper](http://arxiv.org/abs/1511.06434). Trained for 100 epochs. Weights [here](https://github.com/csinva/pytorch_gan_pretrained/tree/master/mnist_dcgan/weights).\n\n| data samples                                                |  dcgan samples                                       |    vae samples                                      |\n| ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------------------------------------------- |\n| ![real_images](mnist_dcgan/samples/real_samples.png)  | ![fake_images-300](mnist_dcgan/samples/fake_samples_epoch_099.png) | ![fake_images-300](mnist_vae/samples/sample_25.png) | \n\nFor comparison with a less complicated architecture, I've also included a pre-trained non-convolutional GAN  in the [mnist_gan_mlp](mnist_mlp) folder, based on code from [this repo](https://github.com/BeierZhu/GAN-MNIST-Pytorch/blob/master/main.py) (trained for 300 epochs).\n\nI've also included a pre-trained LeNet classifier which achieves 99% test accuracy in the [mnist_classifier](mnist_classifier) folder, based on [this repo](https://github.com/activatedgeek/LeNet-5).\n\n### cifar10\n\nThe cifar10 gan is from the [pytorch examples repo](https://github.com/pytorch/examples/tree/master/dcgan) and implements the [DCGAN paper](http://arxiv.org/abs/1511.06434). It required only minor alterations to generate images the size of the cifar10 dataset (32x32x3). Trained for 200 epochs. Weights [here](https://github.com/csinva/pytorch_gan_pretrained/tree/master/cifar10_dcgan/weights).\n\n| data samples                                            |    generated samples                                        |\n| ------------------------------------------------------------ | ------------------------------------------------------ |\n| ![real_images](cifar10_dcgan/samples/real_samples.png) | ![fake_images-300](cifar10_dcgan/samples/fake_samples_epoch_199.png)  |\n\nI've also linked to a pre-trained cifar10 classifier in the [cifar10_classifier](cifar10_classifier) folder from [this repo](https://github.com/aaron-xichen/pytorch-playground/tree/master/cifar).\n\n\n\n### cifar100\n\nSimiliar to the above gans, the cifar100 gan here generates 32x32x1 images for generating grayscale images. Trained for 200 epochs. Weights [here](https://github.com/csinva/pytorch_gan_pretrained/tree/master/cifar100_dcgan_grayscale/weights). There are also weights/code for generating images which are 34x45x1.\n\n| data samples                                             |   generated samples                                        |\n| ------------------------------------------------------------ | ------------------------------------------------------ |\n| ![real_images](cifar100_dcgan_grayscale/samples/real_samples.png) | ![fake_images-300](cifar100_dcgan_grayscale/samples/fake_samples_epoch_299.png) |\n\n### reference\n- based on the official [pytorch examples repo](https://github.com/pytorch/examples/tree/master/dcgan) with modifications to generate the appropriate size\n- feel free to use/share this code openly\n- for similar projects, see related repos: (e.g. [imodels](https://github.com/csinva/imodels), [neural-network-interpretations](https://github.com/csinva/acd)) or my website ([csinva.io](https://csinva.github.io/))\n- tweets [@csinva_](https://twitter.com/csinva_)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsinva%2Fgan-vae-pretrained-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsinva%2Fgan-vae-pretrained-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsinva%2Fgan-vae-pretrained-pytorch/lists"}