python pytorch库_在Pytorch版本中生成模型的集合

这是一个重新实现的 PyTorch 库,包含各种 GANs,如 LSGAN、WGAN_GP 和 DRAGAN。项目参照了 tensorflow-generative-model-collections,已在 MNIST 和 Fashion-MNIST 数据集上测试。提供了固定生成、条件生成以及不同 GAN 结构的损失曲线。
摘要由CSDN通过智能技术生成

pytorch-generative-model-collections

Pytorch implementation of various GANs.

This repository was re-implemented with reference to tensorflow-generative-model-collections by Hwalsuk Lee

I tried to implement this repository as much as possible with tensorflow-generative-model-collections, But some models are a little different.

This repository is included code for CPU mode Pytorch, but i did not test. I tested only in GPU mode Pytorch.

Dataset

MNIST

Fashion-MNIST

CIFAR10

SVHN

STL10

LSUN-bed

I only tested the code on MNIST and Fashion-MNIST.

Generative Adversarial Networks (GANs)

Name

Paper Link

Value Function

LSGAN

WGAN_GP

DRAGAN

infoGAN

ACGAN

EBGAN

BEGAN

Variants of GAN structure (Figures are borrowed from tensorflow-generative-model-collections)

Results for mnist

Network architecture of generator and discriminator is the exaclty sames as in infoGAN paper.

For fair comparison of core ideas in all gan variants, all implementations for network architecture are kept same except EBGAN and BEGAN. Small modification is made for EBGAN/BEGAN, since those adopt auto-encoder strucutre for discriminator. But I tried to keep the capacity of discirminator.

The following results can be reproduced with command:

python main.py --dataset mnist --gan_type --epoch 50 --batch_size 64

Fixed generation

All results are generated from the fixed noise vector.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

GAN

LSGAN

WGAN

WGAN_GP

DRAGAN

EBGAN

BEGAN

Conditional generation

Each row has the same noise vector and each column has the same label condition.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

CGAN

ACGAN

infoGAN

InfoGAN : Manipulating two continous codes

All results have the same noise vector and label condition, but have different continous vector.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

infoGAN

Loss plot

Name

Loss

GAN

LSGAN

WGAN

WGAN_GP

DRAGAN

EBGAN

BEGAN

CGAN

ACGAN

infoGAN

Results for fashion-mnist

Comments on network architecture in mnist are also applied to here.

Fashion-mnist is a recently proposed dataset consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. (T-shirt/top, Trouser, Pullover, Dress, Coat, Sandal, Shirt, Sneaker, Bag, Ankle boot)

The following results can be reproduced with command:

python main.py --dataset fashion-mnist --gan_type --epoch 50 --batch_size 64

Fixed generation

All results are generated from the fixed noise vector.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

GAN

LSGAN

WGAN

WGAN_GP

DRAGAN

EBGAN

BEGAN

Conditional generation

Each row has the same noise vector and each column has the same label condition.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

CGAN

ACGAN

infoGAN

ACGAN tends to fall into mode-collapse in tensorflow-generative-model-collections, but Pytorch ACGAN does not fall into mode-collapse.

InfoGAN : Manipulating two continous codes

All results have the same noise vector and label condition, but have different continous vector.

Name

Epoch 1

Epoch 25

Epoch 50

GIF

infoGAN

Loss plot

Name

Loss

GAN

LSGAN

WGAN

WGAN_GP

DRAGAN

EBGAN

BEGAN

CGAN

ACGAN

infoGAN

Folder structure

The following shows basic folder structure.

├── main.py # gateway

├── data

│ ├── mnist # mnist data (not included in this repo)

│ ├── ...

│ ├── ...

│ └── fashion-mnist # fashion-mnist data (not included in this repo)

├── GAN.py # vainilla GAN

├── utils.py # utils

├── dataloader.py # dataloader

├── models # model files to be saved here

└── results # generation results to be saved here

Development Environment

Ubuntu 16.04 LTS

NVIDIA GTX 1080 ti

cuda 9.0

Python 3.5.2

pytorch 0.4.0

torchvision 0.2.1

numpy 1.14.3

matplotlib 2.2.2

imageio 2.3.0

scipy 1.1.0

Acknowledgements

This implementation has been based on tensorflow-generative-model-collections and tested with Pytorch 0.4.0 on Ubuntu 16.04 using GPU.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值