Skip to content

Chainer and PyTorch implementation of GAN with gradient reversal layer

License

Notifications You must be signed in to change notification settings

kzkadc/gan-with-grl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GAN with Gradient Reversal Layer

Implemented with Chainer and PyTorch.

Ganin, Yaroslav, et al. "Domain-adversarial training of neural networks." The Journal of Machine Learning Research 17.1 (2016): 2096-2030.

Requirements (Chainer)

Chainer, OpenCV, NumPy

$ pip install chainer opencv-python numpy

Requirements (PyTorch)

PyTorch, Ignite, OpenCV, NumPy

PyTorch: see the official document.

$ pip install pytorch-ignite opencv-python numpy

Training of GAN

$ python train_gan.py [options]

Image generation from trained generator

$ python generate.py [options]

You can read help with -h option.

$ python gan.py -h
usage: gan.py [-h] [-b B] [-z Z] [-e E] [-r R] [--save_model]

Trains GAN

optional arguments:
  -h, --help    show this help message and exit
  -b B          batch size
  -z Z          dimension
  -e E          epoch
  -r R          result directory
  --save_model  save models
  
$ python generate.py -h
usage: generate.py [-h] -m M [-n N] [-z Z] [-r R]

Generates images randomly from trained generator model

optional arguments:
  -h, --help  show this help message and exit
  -m M        generator model file
  -n N        number of images to generate
  -z Z        dimension
  -r R        result directory

About

Chainer and PyTorch implementation of GAN with gradient reversal layer

Topics

Resources

License

Stars

Watchers

Forks

Languages