Skip to content

Lornatang/PyTorch-DCGAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Convolution Generative Adversarial Networks

PyTorch-DCGAN has been deprecated. Please see DCGAN-PyTorch, which includes implementations for all models in DCGAN.

Introduction

This example implements the paper Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks

The implementation is very close to the Torch implementation main.py

After every 100 training iterations, the files real_samples.png and fake_samples.png are written to disk with the samples from the generative model.

After every epoch, models are saved to: netG_epoch_%d.pth and netD_epoch_%d.pth

Configure

Load dataset

download data put on ./data/ folder.

Thanks 何之源

data/
└── faces/
    ├── 0000fdee4208b8b7e12074c920bc6166-0.jpg
    ├── 0001a0fca4e9d2193afea712421693be-0.jpg
    ├── 0001d9ed32d932d298e1ff9cc5b7a2ab-0.jpg
    ├── 0001d9ed32d932d298e1ff9cc5b7a2ab-1.jpg
    ├── 00028d3882ec183e0f55ff29827527d3-0.jpg
    ├── 00028d3882ec183e0f55ff29827527d3-1.jpg
    ├── 000333906d04217408bb0d501f298448-0.jpg
    ├── 0005027ac1dcc32835a37be806f226cb-0.jpg

Purpose

Use a stable DCGAN structure to generate avatar images of anime girls.

Usage

  • train

if you want pretrain generate model, click it netg_200.pth

if you want pretrain discriminate model, click it netd_200.pth

please rename model name. netd_200.pth -> D.pth and netg_200.pth -> G.pth

start run:

python main.py --dataroot ./data --cuda

if you n't have GPU, run

python main.py --dataroot ./data
  • test
python main.py --mode test --out_images ./result

Example

  • epoch 1

epoch1.png

  • epoch 30

epoch30.png

  • epoch 100

epoch100.png

  • epoch 200

epoch200.png

Releases

No releases published

Packages

No packages published

Languages