目录
目录README.md

A Jittor Implementation of CGAN

A Jittor implementation of Conditional Generative Adversarial Network (CGAN) that generates images conditioned on class labels using the Jittor deep learning framework.

Table of Contents

Introduction

This project implements a Conditional Generative Adversarial Network (CGAN) using the Jittor deep learning framework. CGANs are an extension of GANs where the generator and discriminator are conditioned on additional information, such as class labels.

Intention

The contents of this project meet the requirements of Program Assignment 3 in the course “Fundamentals of computer graphics” 2024-spring.

Features

  • Implemented using Jittor
  • Conditional image generation based on class labels
  • Training with MNIST dataset
  • Save and load trained models
  • Generate and save images

Installation

  1. Clone the repository:

  2. Install the required packages:

    pip install jittor
  3. The code will download the MNIST dataset when running, you need not install it by yourself.

Usage

  1. Run the training script:

    python CGAN.py --n_epochs 100 --batch_size 64 --lr 0.0002 --b1 0.5 --b2 0.999 --n_cpu 8 --latent_dim 100 --n_classes 10 --img_size 32 --channels 1 --sample_interval 1000

    Adjust the command-line arguments as needed:

    • --n_epochs: Number of epochs of training (default: 100)
    • --batch_size: Size of the batches (default: 64)
    • --lr: Adam: learning rate (default: 0.0002)
    • --b1: Adam: decay of first order momentum of gradient (default: 0.5)
    • --b2: Adam: decay of second order momentum of gradient (default: 0.999)
    • --n_cpu: Number of cpu threads to use during batch generation (default: 8)
    • --latent_dim: Dimensionality of the latent space (default: 100)
    • --n_classes: Number of classes for dataset (default: 10)
    • --img_size: Size of each image dimension (default: 32)
    • --channels: Number of image channels (default: 1)
    • --sample_interval: Interval between image sampling (default: 1000)
  2. Train and store models when running

  3. Generate images after training:

    After training, the script will automatically generate an image showing the number variable determined in the code.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create a new branch (git checkout -b feature-branch)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add some feature')
  5. Push to the branch (git push origin feature-branch)
  6. Open a Pull Request
关于

A jittor implementation of CGAN

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

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