ImprovedWassersteinGanModel: Improved Wasserstein GAN model

ImprovedWassersteinGanModelR Documentation

Improved Wasserstein GAN model

Description

Improved Wasserstein generative adverserial network (with gradient penalty) from the paper:

Details

https://arxiv.org/abs/1704.00028

and ported from the Keras (python) implementation:

https://github.com/eriklindernoren/Keras-GAN/blob/master/wgan_gp/wgan_gp.py

Arguments

inputImageSize
latentDimension

Details

$initialize instantiates a new class and builds the generator and critic. $buildGeneratorbuild generator. $buildGeneratorbuild critic.

Author(s)

Tustison NJ

Examples


library( keras )
library( ANTsRNet )

keras::backend()$clear_session()

# Let's use the mnist data set.

mnist <- dataset_mnist()

numberOfTrainingData <- length( mnist$train$y )

inputImageSize <- c( dim( mnist$train$x[1,,] ), 1 )

x <- array( data = mnist$train$x / 255, dim = c( numberOfTrainingData, inputImageSize ) )
y <- mnist$train$y

numberOfClusters <- length( unique( mnist$train$y ) )

# Instantiate the WGAN model

ganModel <- ImprovedWassersteinGanModel$new(
   inputImageSize = inputImageSize,
   latentDimension = 100 )

## Not run: 
ganModel$train( x, numberOfEpochs = 2 )

## End(Not run)
tryCatch({tensorflow::tf$compat$v1$enable_eager_execution()},
silent = TRUE, error = function(e) {})

ANTsX/ANTsRNet documentation built on Nov. 21, 2024, 4:07 a.m.