R/createSimpleClassificationWithSpatialTransformerNetworkModel.R
createSimpleClassificationWithSpatialTransformerNetworkModel2D.Rd
Creates a keras model of the spatial transformer network:
createSimpleClassificationWithSpatialTransformerNetworkModel2D( inputImageSize, resampledSize = c(30, 30), numberOfClassificationLabels = 10 )
inputImageSize | Used for specifying the input tensor shape. The shape (or dimension) of that tensor is the image dimensions followed by the number of channels (e.g., red, green, and blue). The batch size (i.e., number of training images) is not specified a priori. |
---|---|
resampledSize | resampled size of the transformed input images. |
numberOfClassificationLabels | Number of classes. |
a keras model
\url{https://arxiv.org/abs/1506.02025}
based on the following python Keras model:
\url{https://github.com/oarriaga/STN.keras/blob/master/src/models/STN.py}
Tustison NJ
#> Error in py_discover_config(required_module, use_environment): Python specified in RETICULATE_PYTHON (/Users/ntustison/anaconda3/envs/antsx/bin/python3) does not existnumberOfLabels <- 10 # Extract a small subset for something that can run quickly X_trainSmall <- mnistData$train$x[1:100,,]#> Error in eval(expr, envir, enclos): object 'mnistData' not found#> Error in array(data = X_trainSmall, dim = c(dim(X_trainSmall), 1)): object 'X_trainSmall' not found#> Error in to_categorical(mnistData$train$y[1:100], numberOfLabels): object 'mnistData' not foundX_testSmall <- mnistData$test$x[1:10,,]#> Error in eval(expr, envir, enclos): object 'mnistData' not found#> Error in array(data = X_testSmall, dim = c(dim(X_testSmall), 1)): object 'X_testSmall' not found#> Error in to_categorical(mnistData$test$y[1:10], numberOfLabels): object 'mnistData' not found# We add a dimension of 1 to specify the channel size inputImageSize <- c( dim( X_trainSmall )[2:3], 1 )#> Error in eval(expr, envir, enclos): object 'X_trainSmall' not foundif (FALSE) { model <- createSimpleClassificationWithSpatialTransformerNetworkModel2D( inputImageSize = inputImageSize, resampledSize = c( 30, 30 ), numberOfClassificationLabels = numberOfLabels ) }