目录
目录README.md

CGAN (Conditional Generative Adversarial Network) for MNIST Dataset

This project implements a CGAN using the Jittor framework to generate realistic handwritten digits from the MNIST dataset. The CGAN is a type of generative model that combines the power of a generative adversarial network (GAN) with conditional information to generate samples based on specific class labels.

I hope you can learn how to construct a CGAN, and the way using jittor. In the project, we try to use data enhancement to improve the realisty of the pictures which are prducted by generator. And beyond that, we also try to find the influence of batchnormalization method in our basic net arcitecture.

image-20230521084048871

In a CGAN, the generator and discriminator models are both conditioned on additional input variables, typically class labels. The generator takes as input a random noise vector and a class label, and its task is to generate synthetic samples that are not only realistic but also belong to the specified class. The discriminator, on the other hand, takes both real and generated samples along with their corresponding class labels, and its goal is to accurately distinguish between real and fake samples while considering the class information.

Dataset

The MNIST dataset consists of 60,000 grayscale images of handwritten digits from 0 to 9. Each image is a 28x28 pixel and has a corresponding label indicating the digit it represents. The dataset is divided into a training set of 50,000 images and a test set of 10,000 images.

Requirements

My enviroment is python 3.8, as for jittor, please go to see install — Jittor (tsinghua.edu.cn)

Data prepare: you can use the dataload.py to download and transform the MINIST Dataset.

Training

Command line for training on spencific parameters:

python CGAN.py --n_epochs 100 --batch_size 64

There also are other parameter options, just see the parser in CGAN.py

Analyzing Generated Images

  1. Basic image

result-1684653145064-6

  1. Batchnormalization

result-1684632027143-4

Thanks

Jittor/JGAN: JGAN model zoo supports 27 kinds of mainstream GAN models with high speed for jittor. (github.com)

关于

A Jittor implementation of Conditional GAN (CGAN).

4.7 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号