MIT License

项目介绍

EmilienDupont/wgan-gp 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 283 个 Star、55 次 Fork。

仓库全名
EmilienDupont/wgan-gp
开源许可证
MIT License
Star 数
283
Fork 数
55
未关闭 Issue
3

README 摘要

Wasserstein GAN with Gradient penalty Pytorch implementation of Improved Training of Wasserstein GANs by Gulrajani et al. Examples MNIST Parameters used were lr=1e-4, betas=(.9, .99), dim=16, latentdim=100. Note that the images were resized from (28, 28) to (32, 32). Training (200 epochs) Samples Fashion MNIST Training (200 epochs) Samples LSUN Bedrooms Gif [work in progress] Samples [work in progress] Usage Set up…

完整内容见 GitHub 原始 README 或本页 。

常见问题

wgan-gp 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 283 个 Star。

wgan-gp 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 wgan-gp 的源码?

可以直接克隆仓库:git clone https://github.com/EmilienDupont/wgan-gp.git,默认分支为 master;安装与运行步骤见仓库 README。

wgan-gp 最近还在维护吗?

仓库最近一次更新为 2020年12月5日,当前有 3 个未关闭 Issue;Star 数为 283,可作为社区活跃度的参考。

关于

Pytorch implementation of Wasserstein GANs with Gradient Penalty

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
396
价值分
186
活跃状态
活跃

语言占比

Python

贡献者

README

Wasserstein GAN with Gradient penalty

Pytorch implementation of Improved Training of Wasserstein GANs by Gulrajani et al.

Examples

MNIST

Parameters used were lr=1e-4, betas=(.9, .99), dim=16, latent_dim=100. Note that the images were resized from (28, 28) to (32, 32).

Training (200 epochs)

mnist_gif

Samples

mnist_samples

Fashion MNIST

Training (200 epochs)

fashion_mnist_gif

Samples

fashion_mnist_samples

LSUN Bedrooms

Gif [work in progress]

Samples [work in progress]

Usage

Set up a generator and discriminator model

from models import Generator, Discriminator
generator = Generator(img_size=(32, 32, 1), latent_dim=100, dim=16)
discriminator = Discriminator(img_size=(32, 32, 1), dim=16)

The generator and discriminator are built to automatically scale with image sizes, so you can easily use images from your own dataset.

Train the generator and discriminator with the WGAN-GP loss

import torch
# Initialize optimizers
G_optimizer = torch.optim.Adam(generator.parameters(), lr=1e-4, betas=(.9, .99))
D_optimizer = torch.optim.Adam(discriminator.parameters(), lr=1e-4, betas=(.9, .99))

# Set up trainer
from training import Trainer
trainer = Trainer(generator, discriminator, G_optimizer, D_optimizer,
                  use_cuda=torch.cuda.is_available())

# Train model for 200 epochs
trainer.train(data_loader, epochs=200, save_training_gif=True)

This will train the models and generate a gif of the training progress.

Note that WGAN-GPs take a long time to converge. Even on MNIST it takes about 50 epochs to start seeing decent results. For more information and a full example on MNIST, check out main.py.

Sources and inspiration

评论

暂无评论