目录
目录README.md

jittor-CGAN

简介

本项目基于Jittor框架实现了Conditional GAN(条件生成对抗网络),能够根据输入的数字标签生成对应的手写数字图像。项目特点:

  • 使用Jittor高效计算框架
  • 实现了完整的CGAN训练流程
  • 支持自定义生成特定数字序列
  • 训练速度快,CPU也可运行

安装

运行环境

  • Python >= 3.6
  • Jittor >= 1.3.0
  • CUDA >= 10.2 (GPU版本)

安装方法

# 安装Jittor
pip install jittor

# 克隆本项目
git clone https://gitlink.org.cn/xuduyidong/CGAN.git
cd graphics

快速开始

训练模型

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

生成数字

修改代码中number = "28269342819688"为您想生成的数字序列,然后运行:

python CGAN.py

生成的图片将保存为result.png,生成图片示例如下: 生成示例

预训练模型

预训练模型已包含在项目中:

  • generator_last.pkl - 生成器模型
  • discriminator_last.pkl - 判别器模型

参数配置

可通过命令行参数调整模型:

--n_epochs      训练轮数(默认100)
--batch_size    批大小(默认64) 
--lr            学习率(默认0.0002)
--latent_dim    噪声维度(默认100)
--img_size      图像尺寸(默认32)

致谢

  • 感谢Jittor团队提供的深度学习框架
  • 项目参考了CGAN原始论文《Conditional Generative Adversarial Nets》

注意事项

  1. 首次运行会自动下载MNIST数据集
  2. 生成图片前请确保已加载预训练模型
  3. 项目描述中需包含”jittor”关键字
关于

A Jittor implementation of Conditional GAN (CGAN).

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

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