目录
目录README.md

CGAN with Jittor

1. 简述 Description

Jittor(计图)是清华大学自主研发的深度学习框架(官网 https://cg.cs.tsinghua.edu.cn/jittor/ ),使用元算子和统一计算图提升性能。本项目使用计图框架实现条件生成对抗网络(Conditional Generative Adversarial Nets, CGAN),用来训练模型生成人类手写数字。具体而言,这个项目中同时训练了1个生成器和1个判别器模型,最终使用生成器模仿人类。

Jittor is a deep learning framework developed by Tsinghua University, which uses various methods to boost it’s performance. This project contains a CGAN model implemented with Jittor, and uses this model to generate human handwritten numerals. In this project, a generator and a discriminator are trained at the same time, and we take the generator’s final output as a mimic of human handwriting.

2. 环境配置 Environment settings

建议使用Anaconda或Miniconda,可避免Python包和CUDA Toolkit版本冲突:

I recommend you to install Jittor in Anaconda or Minicona, because the default version of Jittor dependencies may conflict with your local packages.

3. 使用方法 Usage

这个程序会同时训练生成器和判别器,在训练过程中会每隔一段时间保存生成器的训练结果,同时记录两个模型的误差,在训练结束之后会生成指定的目标图像。

为了指定输出目标,可以设置CGAN.pyy代码第200行:

number = "20505812045727"

这样模型就会输出该数字串的手写版本.

之后打开终端,进入项目文件夹并运行命令

python CGAN.py

即可启动程序并开始训练。

This program trains a generator and a discriminator at the same time. While training, the program will constantly log both two models’ losses and generator’s output image. After the training has finished, generator will produce a picture of handwritten numbers.

To specify which numbers to generate, you can modify the code in CGAN.py, at line 200:

number = "20505812045727"

If you change the value of this variable, generator will output different images.

To execute this program, open a new terminal/console in your computer, enter this project’s directory and simply run

python CGAN.py

4. 结果 result

生成的图片结果在result.png中显示。

Generator’s result can be found at result.png.

关于

利用计图框架实现条件生成对抗网络。 A Jittor implementation of Conditional GAN (CGAN).

48.0 KB
邀请码