unet3d: 3D U-Net model

unet3dR Documentation

3D U-Net model

Description

3D U-Net model

Usage

unet3d(
  include_top = TRUE,
  weights = "imagenet",
  input_tensor = NULL,
  input_shape = NULL,
  dropout = 0.5,
  filters = 64,
  num_layers = 4,
  classes = 1,
  classifier_activation = "sigmoid"
)

Arguments

include_top

Whether to include the fully-connected layer at the top of the network. A model without a top will output activations from the last convolutional or pooling layer directly.

weights

One of NULL (random initialization), 'imagenet' (pre-trained weights), an array, or the path to the weights file to be loaded.

input_tensor

Optional tensor to use as image input for the model.

input_shape

Dimensionality of the input not including the samples axis.

dropout

Dropout rate applied between downsampling and upsampling phases.

filters

Number of filters of the first convolution.

num_layers

Number of downsizing blocks in the encoder.

classes

Optional number of classes or labels to classify images into, only to be specified if include_top = TRUE.

classifier_activation

A string or callable for the activation function to use on top layer, only if include_top = TRUE.

Details

The input shape is usually c(height, width, depth, channels) for a 3D image but this is depending on the given image. The image array can also be given in the shape x, y, z, so width x height x depth. That doesn't really matter whether height or weight are interchanged. If no input shape is specified the default shape 132x132x116x3 is used.
The number of classes can be computed in three steps. First, build a factor of the labels (classes). Second, use as_CNN_image_Y to one-hot encode the outcome created in the first step. Third, use nunits to get the number of classes. The result is equal to nlevels used on the result of the first step.

For a n-ary classification problem with single-label associations, the output is either one-hot encoded with categorical_crossentropy loss function or binary encoded (0,1) with sparse_categorical_crossentropy loss function. In both cases, the output activation function is softmax.
For a n-ary classification problem with multi-label associations, the output is one-hot encoded with sigmoid activation function and binary_crossentropy loss function.

For a task with another top layer block, e.g. a regression problem, use the following code template:

base_model <- unet3d(include_top = FALSE)
base_model$trainable <- FALSE
outputs <- base_model$output %>%
layer_dense(units = 1, activation = "linear")
model <- keras_model(inputs = base_model$input, outputs = outputs)

inputs <- layer_input(shape = c(512, 512, 128, 1))
blocks <- inputs %>%
layer_conv_3d_transpose(filters = 3, kernel_size = c(1, 1, 1)) %>%
layer_max_pooling_3d()
model <- unet3d(input_tensor = blocks)

Value

A CNN model object from type 3D U-Net.

References

Ronneberger, O., Fischer, P., Brox T. (2015): U-Net: Convolutional Networks f?r Biomedical Image Segmentation. In: Navab, N., Hornegger, J., Wells, W., Frangi, A. (Hrsg.): Medical Image Computing and Computer-Assisted Intervention - MICCAI 2015. Lecture Notes in Computer Science, vol 9351. Part III. pp. 234-241. Cham: Springer. https://doi.org/10.1007/978-3-319-24574-4_28.
see also: https://arxiv.org/pdf/1505.04597.pdf
For an implementation in Python see here.


stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.