JGAN

JGAN

Jittor框架上27种GAN模型的实现与加速对比

JGAN项目在Jittor深度学习框架上实现了27种经典生成对抗网络(GAN)模型,包括ACGAN、CycleGAN和DCGAN等。相比PyTorch,这些模型平均加速185%,最高达283%。项目提供详细使用说明和性能对比数据,为GAN研究和应用开发提供全面的模型库支持。

GANJittorPyTorch深度学习人工智能Github开源项目

JGAN

我们的 GAN 模型库支持 27 种 GAN。 这个表格是我们从 Google Scholar 中找到的最新引用数据。 可以看到,自 2014 年 GAN 被提出以来,出现了许多基于 GAN 的优秀工作。 这 27 种 GAN 总共获得了 60953 次引用,平均每篇文章被引用 2176 次。

我们的 GAN 模型库支持 27 种 GAN 模型。该表是我们从 Google Scholar 中找到的最新引用量。可以看到,自 2014 年提出 GAN 以来,出现了很多基于 GAN 的优秀工作。这 27 个 GAN 模型总共有 60953 次引用,平均每篇文章被引用 2176 次。

<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/16a46a7f-199c-4064-8d20-0989f90b1ec2.png"\> </p>

我们比较了 Jittor 和 PyTorch 这些 GAN 的性能。PyTorch 版本代码使用了 GitHub 仓库 master 分支 2019 年 8 月 24 日的 commit a163b8。下图展示了 Jittor 相对于 PyTorch 的加速比。可以看出,这些 GAN 的最高加速比达到 283%,平均加速比为 185%。

我们比较了 Jittor 和 Pytorch 的这些 GAN 模型的性能。PyTorch 版本代码使用 github 仓库 master 分支 2019 年 8 月 24 日的 commit a163b8。下图是 Jittor 相对于 Pytorch 的加速比。可以看出,这些GANs的最高加速比达到283%,平均加速比为185%。

<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/d682914e-ad68-4322-adc9-1d2928431e75.png"\> </p>

用另一种方式呈现,假设 PyTorch 的训练时间为 100 小时,我们计算了 Jittor 对应的 GAN 训练所需时间。在这些 GAN 中,我们加速最快的 GAN 仅需 35 小时即可运行,平均运行时间为 57 小时。

以另一种形式的呈现,假设 Pytorch 的训练时间为 100 小时,我们计算了 Jittor 对应的 GAN 训练所需的时间。在这些 GAN 中,我们最快的加速 GAN 仅需 35 小时即可运行,平均为 57 小时。

<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/bf014a27-1e0f-4fab-b2e2-c64bb70e7e26.png"\> </p>

新闻

  • 第二届计图人工智能挑战赛已于2022年4月15日正式开启。
  • 计图(Jittor)人工智能算法挑战赛是在国家自然科学基金委信息科学部指导下,由北京信息科学与技术国家研究中心和清华大学-腾讯互联网创新技术联合实验室于2021年创办、基于清华大学"计图"深度学习框架的人工智能算法大赛。从今年开始,该赛事将作为中国软件开源创新大赛中开源任务挑战赛的一部分开展AI算法竞赛。
  • 大赛面向所有在校学生和AI相关领域从业人士开放,旨在通过竞技的方式提升人们对数据分析与处理的算法研究与技术应用的能力,推动我国自主人工智能平台的生态建设和人工智能研究及应用的深入。竞赛得到腾讯公司的赞助。
  • 本届挑战赛设置一个热身赛(手写数字生成赛题)和两个正式赛题(风景图片生成赛题和可微渲染新视角生成赛题),参赛选手需要通过热身赛才能参加两个正式赛题。比赛更多信息可以在官网查看。其中计图挑战热身赛和赛题一:风景图片生成赛题可以详见这里

目录

安装

$ git clone https://github.com/Jittor/JGAN.git
$ cd JGAN/
$ sudo python3.7 -m pip install -r requirements.txt

模型

辅助分类器生成对抗网络

辅助分类器生成对抗网络

作者

Augustus Odena, Christopher Olah, Jonathon Shlens

[论文] [代码]

运行示例

$ cd models/acgan/
$ python3.7 acgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/971f1dae-3c88-4253-8ae2-e0de4e7c214a.png" width="200"\> </p>

对抗自编码器

对抗自编码器

作者

Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, Brendan Frey

[论文] [代码]

运行示例

$ cd models/aae/
$ python3.7 aae.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/53db459c-9de0-4db6-9627-254e6713ca8e.gif" width="200"\> </p>

BEGAN

BEGAN: 边界均衡生成对抗网络

作者

David Berthelot, Thomas Schumm, Luke Metz

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/began/began.py

运行示例

$ cd models/began/
$ python3.7 began.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/94c625e5-901a-4959-bfb2-25e9e8e398a2.gif" width="200"\> </p>

BicycleGAN

多模态图像到图像转换

作者

Jun-Yan Zhu, Richard Zhang, Deepak Pathak, Trevor Darrell, Alexei A. Efros, Oliver Wang, Eli Shechtman

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/bicyclegan/bicyclegan.py

运行示例

$ cd data/
$ bash download_pix2pix_dataset.sh edges2shoes
$ cd ../models/bicyclegan/
$ python3.7 bicyclegan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/a72ee94b-a266-4af6-9d6f-d85de5300cc3.png" width="400"\> </p> <p align="center"> 通过改变潜在编码实现各种风格转换。 </p>

边界寻求GAN

边界寻求生成对抗网络

作者

R Devon Hjelm, Athul Paul Jacob, Tong Che, Adam Trischler, Kyunghyun Cho, Yoshua Bengio

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/bgan/bgan.py

运行示例

$ cd models/bgan/
$ python3.7 bgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/c9d9baf6-5958-4376-a0b3-8d191aefab20.png" width="240"\> </p>

聚类GAN

ClusterGAN:生成对抗网络中的潜在空间聚类

作者

Sudipto Mukherjee, Himanshu Asnani, Eugene Lin, Sreeram Kannan

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/cluster_gan/clustergan.py

运行示例

$ cd models/cluster_gan/
$ python3.7 clustergan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/3dd07852-3971-4128-87e0-20786193bf5e.png" width="200"\> </p>

条件GAN

条件生成对抗网络

作者

Mehdi Mirza, Simon Osindero

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/cgan/cgan.py

运行示例

$ cd models/cgan/
$ python3.7 cgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/bd668704-e143-4f0b-b621-844d413f522d.gif" width="200"\> </p>

上下文编码器

上下文编码器:通过修复学习特征

作者

Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, Alexei A. Efros

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/context_encoder/context_encoder.py

运行示例

$ cd models/context_encoder/
<按照context_encoder.py顶部的步骤操作>
$ python3.7 context_encoder.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/feffab86-3ba4-4471-abb8-67bdfdb0c277.png" width="640"\> </p> <p align="center"> 行:遮罩 | 修复 | 原图 | 遮罩 | 修复 | 原图 </p>

耦合GAN

耦合生成对抗网络

作者

Ming-Yu Liu, Oncel Tuzel [论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/cogan/cogan.py

运行示例

$ 从 https://cloud.tsinghua.edu.cn/f/d9a411da271745fcbe1f/?dl=1 下载 mnistm.pkl 并将其放入 data/mnistm/mnistm.pkl
$ cd models/cogan/
$ python3.7 cogan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/007f4eb8-a06e-4657-93a3-1a8341a35be5.gif" width="200"\> </p> <p align="center"> 生成的 MNIST 和 MNIST-M 图像 </p>

CycleGAN

使用循环一致对抗网络进行非配对图像到图像的转换

作者

Jun-Yan Zhu, Taesung Park, Phillip Isola, Alexei A. Efros

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/cyclegan/cyclegan.py

运行示例

$ cd data/
$ bash download_cyclegan_dataset.sh monet2photo
$ cd ../models/cyclegan/
$ python3.7 cyclegan.py --dataset_name monet2photo
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/5c41ebb4-cf3d-419f-a91a-70b9dff723dc.png" width="400"\> </p> <p align="center"> 莫奈风格到照片的转换 </p>

深度卷积GAN

深度卷积生成对抗网络

作者

Alec Radford, Luke Metz, Soumith Chintala

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/dcgan/dcgan.py

运行示例

$ cd models/dcgan/
$ python3.7 dcgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/a20a6ad0-8451-4b1c-b9c6-669365c96af4.png" width="240"\> </p>

DRAGAN

关于GAN的收敛性和稳定性

作者

Naveen Kodali, Jacob Abernethy, James Hays, Zsolt Kira

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/dragan/dragan.py

运行示例

$ cd models/dragan/
$ python3.7 dragan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/009f006d-1c6d-4413-9211-f1c2625abf64.png" width="240"\> </p>

基于能量的GAN

基于能量的生成对抗网络

作者

Junbo Zhao, Michael Mathieu, Yann LeCun

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/ebgan/ebgan.py

运行示例

$ cd models/ebgan/
$ python3.7 ebgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/4a23882d-7ccd-4e95-9338-73789a69114d.png" width="240"\> </p>

增强型超分辨率GAN

ESRGAN:增强型超分辨率生成对抗网络

作者

Xintao Wang, Ke Yu, Shixiang Wu, Jinjin Gu, Yihao Liu, Chao Dong, Chen Change Loy, Yu Qiao, Xiaoou Tang

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/esrgan/esrgan.py

运行示例

$ cd models/esrgan/
<按照esrgan.py顶部的步骤操作>
$ python3.7 esrgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/f55a4e8c-1704-45a8-9901-c7f2644f2c5c.gif" width="320"\> </p>

GAN

生成对抗网络

作者

Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/gan/gan.py

运行示例

$ cd models/gan/
$ python3.7 gan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/b78f70aa-3a94-4af3-9bcf-63ef60d1d70f.png" width="240"\> </p>

InfoGAN

InfoGAN:通过信息最大化生成对抗网络实现可解释表示学习

作者

Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, Pieter Abbeel

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/infogan/infogan.py

运行示例

$ cd models/infogan/
$ python3.7 infogan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/ec5ed7b0-7c9e-42a3-ad1f-c0af569ffc0c.png" width="200"\> </p> <p align="center"> 按行变化连续潜在变量的结果。 </p>

最小二乘GAN

最小二乘生成对抗网络

作者

Xudong Mao, Qing Li, Haoran Xie, Raymond Y.K. Lau, Zhen Wang, Stephen Paul Smolley

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/lsgan/lsgan.py

运行示例

$ cd models/lsgan/
$ python3.7 lsgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/01ba5dfc-6c7a-4b29-be45-7b6e7612dd81.png" width="200"\> </p>

Pix2Pix

使用条件对抗网络的非配对图像到图像转换

作者

Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, Alexei A. Efros

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/pix2pix/pix2pix.py

运行示例

$ cd data/
$ bash download_pix2pix_dataset.sh facades
$ cd ../models/pix2pix/
$ python3.7 pix2pix.py --dataset_name facades
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/a67f2aa5-fb8c-4481-98fb-76d93219c7a2.png" width="240"\> </p> <p align="center">
从上到下的行依次为:(1) 生成器的条件 (2) 基于条件生成的图像 <br>
(3) 与条件相对应的真实图像
</p>

PixelDA

使用生成对抗网络的无监督像素级域适应

作者

Konstantinos Bousmalis, Nathan Silberman, David Dohan, Dumitru Erhan, Dilip Krishnan

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/pixelda/pixelda.py

MNIST到MNIST-M分类

训练一个分类器,使用从源域(MNIST)转换到目标域(MNIST-M)的图像,并使用源域图像的标注。分类网络与生成器网络联合训练,以优化生成器既能提供适当的域转换,又能保留源域图像的语义。在转换后的图像上训练的分类网络与直接在MNIST上训练并在MNIST-M上评估的朴素解决方案进行比较。朴素模型在MNIST-M上实现55%的分类准确率,而在域适应过程中训练的模型达到95%的分类准确率。

$ 从 https://cloud.tsinghua.edu.cn/f/d9a411da271745fcbe1f/?dl=1 下载 mnistm.pkl 并将其放入 data/mnistm/mnistm.pkl
$ cd models/pixelda/
$ python3.7 pixelda.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/e9b07f3a-8f86-4c7a-851a-3b2327f02d2e.gif" width="200"\> </p> <p align="center"> 从上到下的行依次为:(1) MNIST的真实图像 (2) 从MNIST转换到MNIST-M的图像 <br> (3) MNIST-M的示例图像 </p>

相对论GAN

相对论判别器:标准GAN中缺失的关键元素

作者

Alexia Jolicoeur-Martineau

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/relativistic_gan/relativistic_gan.py

运行示例

$ cd models/relativistic_gan/
$ python3.7 relativistic_gan.py                 # 相对论标准GAN
$ python3.7 relativistic_gan.py --rel_avg_gan   # 相对论平均GAN
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/d05c04e1-fe70-4995-b6fb-73631f1dd932.png" width="240"\> </p>

半监督生成对抗网络

半监督生成对抗网络

作者

Augustus Odena

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/sgan/sgan.py

运行示例

$ cd models/sgan/
$ python3.7 sgan.py

Softmax 生成对抗网络

Softmax 生成对抗网络

作者

Min Lin

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/softmax_gan/softmax_gan.py

运行示例

$ cd models/softmax_gan/
$ python3.7 softmax_gan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/b043f92e-4ec0-4bda-885e-0e444eda31f6.png" width="240"\> </p>

StarGAN

StarGAN:用于多域图像到图像转换的统一生成对抗网络

作者

Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, Jaegul Choo

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/stargan/stargan.py

运行示例

$ cd models/stargan/
<按照stargan.py顶部的步骤操作>
$ python3.7 stargan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/9410b90c-9263-4e93-a212-8185fa6180de.png" width="240"\> </p> <p align="center">
原始 | 黑发 | 金发 | 棕发 | 性别翻转 | 变老
</p>

UNIT

无监督图像到图像转换网络

作者

Ming-Yu Liu, Thomas Breuel, Jan Kautz

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/unit/unit.py

运行示例

$ cd data/
$ bash download_cyclegan_dataset.sh apple2orange
$ cd models/unit/
$ python3.7 unit.py --dataset_name apple2orange

Wasserstein GAN

Wasserstein 生成对抗网络

作者

Martin Arjovsky, Soumith Chintala, Léon Bottou

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/wgan/wgan.py

运行示例

$ cd models/wgan/
$ python3.7 wgan.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/51489852-e2ba-4fa9-ba54-da961a10e899.png" width="240"\> </p>

Wasserstein GAN GP

改进的Wasserstein GAN训练

作者

Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, Aaron Courville

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/wgan_gp/wgan_gp.py

运行示例

$ cd models/wgan_gp/
$ python3.7 wgan_gp.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/43ce84a3-7861-4cb3-b26c-897f574baec2.png" width="240"\> </p>

Wasserstein GAN DIV

GAN的Wasserstein散度

作者

Jiqing Wu, Zhiwu Huang, Janine Thoma, Dinesh Acharya, Luc Van Gool

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/wgan_div/wgan_div.py

运行示例

$ cd models/wgan_div/
$ python3.7 wgan_div.py
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/c09300ab-782b-4471-935b-d0db8642c322.gif" width="240"\> </p>

StyleGAN2

GAN的Wasserstein散度

作者

Jiqing Wu, Zhiwu Huang, Janine Thoma, Dinesh Acharya, Luc Van Gool

[论文] [[代码]](https://github.com/Jittor/JGAN/blob/master/models/wgan_div/wgan_div.py

运行示例

$ cd models/StyleGAN2
<p align="center"> <img src="https://yellow-cdn.veclightyear.com/0a4dffa0/a2e3acfd-7fe3-4d2c-88a4-d13af249c6c2.png" \> </p>

编辑推荐精选

GPT Plus|Pro充值

GPT Plus|Pro充值

GPT充值

支持 ChatGPT Plus / Pro 充值服务,支付便捷,自动发货,售后可查。

GPT Image 2中文站

GPT Image 2中文站

AI 图片生成平台

GPT Image 2 是面向用户的 AI 图片生成平台,支持文生图、图生图及多模型创意工作流。

Vecbase

Vecbase

你的AI Agent团队

Vecbase 是专为 AI 团队打造的智能工作空间,将数据管理、模型协作与知识沉淀整合于一处。算法、产品与业务在同一平台无缝协同,让从数据到 AI 应用的落地更快一步。

音述AI

音述AI

全球首个AI音乐社区

音述AI是全球首个AI音乐社区,致力让每个人都能用音乐表达自我。音述AI提供零门槛AI创作工具,独创GETI法则帮助用户精准定义音乐风格,AI润色功能支持自动优化作品质感。音述AI支持交流讨论、二次创作与价值变现。针对中文用户的语言习惯与文化背景进行专门优化,支持国风融合、C-pop等本土音乐标签,让技术更好地承载人文表达。

QoderWork

QoderWork

阿里Qoder团队推出的桌面端AI智能体

QoderWork 是阿里推出的本地优先桌面 AI 智能体,适配 macOS14+/Windows10+,以自然语言交互实现文件管理、数据分析、AI 视觉生成、浏览器自动化等办公任务,自主拆解执行复杂工作流,数据本地运行零上传,技能市场可无限扩展,是高效的 Agentic 生产力办公助手。

lynote.ai

lynote.ai

一站式搞定所有学习需求

不再被海量信息淹没,开始真正理解知识。Lynote 可摘要 YouTube 视频、PDF、文章等内容。即时创建笔记,检测 AI 内容并下载资料,将您的学习效率提升 10 倍。

AniShort

AniShort

为AI短剧协作而生

专为AI短剧协作而生的AniShort正式发布,深度重构AI短剧全流程生产模式,整合创意策划、制作执行、实时协作、在线审片、资产复用等全链路功能,独创无限画布、双轨并行工业化工作流与Ani智能体助手,集成多款主流AI大模型,破解素材零散、版本混乱、沟通低效等行业痛点,助力3人团队效率提升800%,打造标准化、可追溯的AI短剧量产体系,是AI短剧团队协同创作、提升制作效率的核心工具。

seedancetwo2.0

seedancetwo2.0

能听懂你表达的视频模型

Seedance two是基于seedance2.0的中国大模型,支持图像、视频、音频、文本四种模态输入,表达方式更丰富,生成也更可控。

nano-banana纳米香蕉中文站

nano-banana纳米香蕉中文站

国内直接访问,限时3折

输入简单文字,生成想要的图片,纳米香蕉中文站基于 Google 模型的 AI 图片生成网站,支持文字生图、图生图。官网价格限时3折活动

扣子-AI办公

扣子-AI办公

职场AI,就用扣子

AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!

下拉加载更多