Giter VIP home page Giter VIP logo

scangan's Introduction

ScanGAN

Convenient GAN implementation in Keras

This is a WIP

Basic Usage

from GAN import GAN

# 128x128, 3 channels

shape = (128, 128, 3)
model = GAN(shape)

model.train(x, y, epochs=100)

pred = model.generate(x[0])

Settings

You may construct the model with some custom hyperparameters by passing in a settings object at construction.

from keras.optimizers import Adagrad

shape = (64, 64, 1) # 64x64 grayscal images

my_settings = {
	'input_mask':True,
	'g_ksize': 3,
	'd_optimizer': Adagrad()
}

model = GAN(shape, settings=my_settings)
Key Type Default Value Description
input_mask boolean False If set to True, the model with replace the output of the generator with the input where the input != 0. The masked output is used when computing loss
d_loss_target 0.3 float between 0 .. 1 Each epoch, the discriminator will be trained if its loss is less than the target, the generator will be trained otherwise
g_optimizer str, keras Optimizer, or lambda Adam(1e-3) The optimizer that will be used for the Generator.
g_ksize int 5 Convolution kernel size for the generator (g_ksize * g_ksize)
g_depth int 64 Output depth of each hidden layer of the generator
g_activation str or lambda lambda: LeakyReLU() Activation function to use for the generator
g_regularizer str of lambda None Regularization to use for the generator
d_optimizer str, keras Optimizer, or lambda SGD() The optimizer that will be used for the Discriminator.
d_ksize int 5 Convolution kernel size for the discriminator (d_ksize * d_ksize)
d_depth int 32 Output depth of each hidden layer of the discriminator
d_activation str or lambda lambda: LeakyReLU() Activation function to use for the discriminator
d_output_activation str or lambda 'sigmoid' Activation function to use for output layer the discriminator
d_regularizer str of lambda None Regularization to use for the discriminator
  • lambda settings values should always return a new instance

Sample Output (inpainting)

  • Training set was ~400 128x128 RGB images of landscapes
  • Default settings
  • epochs = 100

Input / Output / Original

scangan's People

Contributors

chickenbellyfin avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.