Skip to content

t-ae/singan-s4tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SinGAN on Swift for TensorFlow

Run

Swift for TensorFlow and some python dependencies are required.
It's not trainable with latest release v0.6.0 due to its AD bug. Use development snapshot.

I recommend this Dockerfile:
https://github.com/t-ae/s4tf-docker

Commands

$ swift run -c release SinGAN Input/ballons.png

TensorBoard log will be generated under logdir.

$ tensorboard --logdir logdir/

Example

Super resolution

Original SR
33039_LR super_resolution5

Multiple sizes

multisize_181x181 multisize_181x369 multisize_293x181 multisize_592x181

More examples in Results directory.

Differences from original

Instance norm instead of batch norm

Original implementation uses batch norm. I afraid it's problematic.
SinGAN is trained with single image. It means batch size is always 1.
Therefore batch norm works like instance norm while training.
But when it comes to inference phase, batch norm uses running stats of training phase. It can be much different from training phase.

To avoid this, I simply replaced batch norm with instance norm.

Cease WGAN-GP training

As I wrote in the issue, original implementation of gradient penalty looks wrong.
Anyway S4TF doesn't support higher-order differentiaion for now. So I decided not to use WGAN-GP.

Use spectral normalization

Since I didn't use WGAN-GP, I need other techniques to stabilize training.
I employed spectral normalization and use hinge loss.

About

SinGAN on Swift for TensorFlow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages