This is a Jittor implementation of Conditional GAN (CGAN).
The model consists of a generator and a disciminator. The generator takes a random vector and a numeric label as input, and outputs the corresponding numeric image; the discriminator inputs an image and outputs the probabilities of different numeric classifications. The generator and the discriminator are jointly trained to reduce the overall model’s loss. The dataset is loaded from MNIST.
Requirements
Python 3.7 or higher
Numpy
Jittor
Usage
Clone this repository and navigate to the cloned project:
https://www.gitlink.org.cn/lengyanze/CGAN_jittor
cd CGAN_jittor
Run CGAN.py:
python CGAN.py
More running options below:
usage: CGAN.py [-h] [--n_epochs N_EPOCHS] [--batch_size BATCH_SIZE] [--lr LR] [--b1 B1] [--b2 B2] [--n_cpu N_CPU] [--latent_dim LATENT_DIM]
[--n_classes N_CLASSES] [--img_size IMG_SIZE] [--channels CHANNELS] [--sample_interval SAMPLE_INTERVAL]
options:
-h, --help show this help message and exit
--n_epochs N_EPOCHS number of epochs of training
--batch_size BATCH_SIZE
size of the batches
--lr LR adam: learning rate
--b1 B1 adam: decay of first order momentum of gradient
--b2 B2 adam: decay of first order momentum of gradient
--n_cpu N_CPU number of cpu threads to use during batch generation
--latent_dim LATENT_DIM
dimensionality of the latent space
--n_classes N_CLASSES
number of classes for dataset
--img_size IMG_SIZE size of each image dimension
--channels CHANNELS number of image channels
--sample_interval SAMPLE_INTERVAL
interval between image sampling
关于
A Jittor implementation of Conditional GAN (CGAN).
CGAN_jittor
This is a Jittor implementation of Conditional GAN (CGAN).
The model consists of a generator and a disciminator. The generator takes a random vector and a numeric label as input, and outputs the corresponding numeric image; the discriminator inputs an image and outputs the probabilities of different numeric classifications. The generator and the discriminator are jointly trained to reduce the overall model’s loss. The dataset is loaded from MNIST.
Requirements
Usage
Clone this repository and navigate to the cloned project:
Run CGAN.py:
More running options below: