createResUnetModel3D: 3-D implementation of the Resnet + U-net deep learning...

View source: R/createResUnetModel.R

createResUnetModel3DR Documentation

3-D implementation of the Resnet + U-net deep learning architecture.

Description

Creates a keras model of the U-net + ResNet deep learning architecture for image segmentation and regression with the paper available here:

Usage

createResUnetModel3D(
  inputImageSize,
  numberOfOutputs = 1,
  numberOfFiltersAtBaseLayer = 32,
  bottleNeckBlockDepthSchedule = c(3, 4),
  convolutionKernelSize = c(3, 3, 3),
  deconvolutionKernelSize = c(2, 2, 2),
  dropoutRate = 0,
  weightDecay = 0.0001,
  mode = c("classification", "regression")
)

Arguments

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.

numberOfOutputs

Meaning depends on the mode. For 'classification' this is the number of segmentation labels. For 'regression' this is the number of outputs.

numberOfFiltersAtBaseLayer

number of filters at the beginning and end of the ⁠'U'⁠. Doubles at each descending/ascending layer.

bottleNeckBlockDepthSchedule

vector that provides the encoding layer schedule for the number of bottleneck blocks per long skip connection.

convolutionKernelSize

2-d vector defining the kernel size during the encoding path

deconvolutionKernelSize

2-d vector defining the kernel size during the decoding

dropoutRate

float between 0 and 1 to use between dense layers.

weightDecay

weighting parameter for L2 regularization of the kernel weights of the convolution layers. Default = 0.0.

mode

'classification' or 'regression'.

Details

    \url{https://arxiv.org/abs/1608.04117}

This particular implementation was ported from the following python implementation:

    \url{https://github.com/veugene/fcn_maker/}

Value

a res/u-net keras model

Author(s)

Tustison NJ

Examples


library( ANTsRNet )
library( keras )

model <- createResUnetModel3D( c( 64, 64, 64, 1 ) )

metric_multilabel_dice_coefficient <-
  custom_metric( "multilabel_dice_coefficient",
    multilabel_dice_coefficient )

loss_dice <- function( y_true, y_pred ) {
  -multilabel_dice_coefficient(y_true, y_pred)
}
attr(loss_dice, "py_function_name") <- "multilabel_dice_coefficient"

model %>% compile( loss = loss_dice,
  optimizer = optimizer_adam( lr = 0.0001 ),
  metrics = c( metric_multilabel_dice_coefficient,
    metric_categorical_crossentropy ) )

print( model )


ANTsX/ANTsRNet documentation built on April 18, 2024, 8 a.m.