CGAN_Jittor
A Jittor implementation of Conditional GAN (CGAN) for handwritten digit image generation.
Project Overview
This project implements a Conditional GAN using the Jittor deep learning framework to generate handwritten digit images trained on the MNIST dataset.
Key features
- Conditional generation of specific digits through label-guided adversarial training.
- Lightweight implementation optimized for Jittor’s dynamic computation graph.
- Real-time visualization of generated samples during training.
Installation
Prerequisites
- Supported Systems: Linux or Windows (including WSL). macOS users require a virtual machine.
- Dependencies: Python (≥3.7) and a C++ compiler (
g++
≥5.4.0 for linux or clang
≥8.0 for mac).
Installing Jittor
Choose one of these methods (full guide here):
# Pip (recommended)
python -m pip install jittor
# Docker (CPU-only)
docker run -it --network host jittor/jittor
# For CUDA support, see official installation docs.
Usage
Clone this repository:
git clone https://gitlink.org.cn/chen_03/CGAN_Jittor.git
Run the CGAN script with default parameters:
# Default: Generate "0123456789"
python CGAN.py
Customize training (examples):
# Generate "02468", train for 100 epochs with learning rate 0.0001
python CGAN.py --number="02468" --n_epochs=100 --lr=0.0001
# Generate "13579", batch size 128, latent dimension 100
python CGAN.py --number="13579" --batch_size=128 --latent_dim=100
Key Arguments
Parameter |
Default |
Description |
--number |
"0123456789" |
Labels of digits to generate |
--n_epochs |
50 |
Total training epochs |
--lr |
0.0002 |
Learning rate for Adam optimizer |
--batch_size |
64 |
Training batch size |
--latent_dim |
100 |
Dimension of noise vector |
Output
- Training phase: Generated samples saved every 1000 steps in
./samples/
for debugging.
- Final result:
result.png
showing grid of generated digits after training completion.
Contributing
Contributions are welcome! Open an issue or submit a PR for:
- Performance optimizations
- Additional visualization features
- Extended documentation
CGAN_Jittor
A Jittor implementation of Conditional GAN (CGAN) for handwritten digit image generation.
Project Overview
This project implements a Conditional GAN using the Jittor deep learning framework to generate handwritten digit images trained on the MNIST dataset.
Key features
Installation
Prerequisites
g++
≥5.4.0 for linux orclang
≥8.0 for mac).Installing Jittor
Choose one of these methods (full guide here):
Usage
Clone this repository:
Run the CGAN script with default parameters:
Customize training (examples):
Key Arguments
--number
"0123456789"
--n_epochs
50
--lr
0.0002
--batch_size
64
--latent_dim
100
Output
./samples/
for debugging.result.png
showing grid of generated digits after training completion.Contributing
Contributions are welcome! Open an issue or submit a PR for: