Pre-trained GANs, VAEs + Classifiers for MNIST & CIFAR10

Jul 27, 2024 | Data Science

A simple starting point for modeling with GANs and VAEs in PyTorch.



Introduction

Dive into the world of generative models with our pre-trained Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs) specifically tailored for the MNIST and CIFAR10 datasets. This guide will walk you through the essentials of utilizing these models in PyTorch.

Getting Started

This repository includes model class definitions, essential training scripts, and notebooks detailing how to load and use pre-trained networks. The models are compatible with PyTorch versions from 1.0 and above and generate images that match the sizes of the dataset images.

MNIST Dataset

For the MNIST dataset, the pre-trained model generates images sized at 28×28 pixels, following an architecture based on the DCGAN paper. The model was trained for 100 epochs. You can find the weights here.

  • Generated Images Samples:
    • Real MNIST Images
    • Fake MNIST Images
    • VAE Sample Images

Also included is a pre-trained non-convolutional GAN in the mnist_gan_mlp folder based on code from this repository, which was trained for 300 epochs. Additionally, a pre-trained LeNet classifier achieving 99% test accuracy is available in the mnist_classifier folder from this repository.

CIFAR10 Dataset

For the CIFAR10 dataset, the GAN implementation stems from the PyTorch examples repository, adhering to the DCGAN architecture. This model was altered slightly to output images of size 32x32x3 and was trained for 200 epochs. Weights can be found here.

  • Generated CIFAR10 Samples:
    • Real CIFAR10 Images
    • Fake CIFAR10 Images

For CIFAR100, a similar DCGAN generates 32x32x1 grayscale images, trained for 200 epochs. The weights for this model can be found here.

  • Generated CIFAR100 Samples:
    • Real CIFAR100 Images
    • Fake CIFAR100 Images

Troubleshooting

Should you encounter issues while running the code or loading models, consider the following potential solutions:

  • Ensure you have the correct version of PyTorch installed (1.0 or above).
  • Check for any missing dependencies listed in the scripts.
  • Ensure that your Python environment matches the required versions (3.6 to 3.9).
  • For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

By leveraging these pre-trained GAN and VAE models, you’ll have a straightforward foundation for generative modeling. These tools not only save time but also allow you to focus on application and innovation.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox