Architectures¶
Autoencoder¶
-
antspynet.architectures.
create_autoencoder_model
(number_of_units_per_layer, activation='relu', initializer='glorot_uniform')[source]¶ 2-D implementation of the Vgg deep learning architecture.
Builds an autoencoder based on the specified array definining the number of units in the encoding branch. Ported to Keras R from the Keras python implementation here:
https://github.com/XifengGuo/DEC-keras
- Parameters
number_of_units_per_layer (tuple) – A tuple defining the number of units in the encoding branch.
activation (string) – Activation type for the dense layers
initializer (string) – Initializer type for the dense layers
- Returns
An encoder and autoencoder Keras model.
- Return type
Keras model
Example
>>> model = create_autoencoder_model((784, 500, 500, 2000, 10)) >>> model.summary()
-
antspynet.architectures.
create_convolutional_autoencoder_model_2d
(input_image_size, number_of_filters_per_layer=32, 64, 128, 10, convolution_kernel_size=5, 5, deconvolution_kernel_size=5, 5)[source]¶ Function for creating a 2-D symmetric convolutional autoencoder model.
Builds an autoencoder based on the specified array definining the number of units in the encoding branch. Ported from the Keras python implementation here:
https://github.com/XifengGuo/DEC-keras
- Parameters
input_image_size (tuple) – A tuple defining the shape of the 2-D input image
number_of_units_per_layer (tuple) – A tuple defining the number of units in the encoding branch.
convolution_kernel_size (tuple or scalar) – Kernel size for convolution
deconvolution_kernel_size (tuple or scalar) – Kernel size for deconvolution
- Returns
A convolutional encoder and autoencoder Keras model.
- Return type
Keras models
Example
>>> autoencoder, encoder = create_convolutional_autoencoder_model_2d((128, 128, 3)) >>> autoencoder.summary() >>> encoder.summary()
-
antspynet.architectures.
create_convolutional_autoencoder_model_3d
(input_image_size, number_of_filters_per_layer=32, 64, 128, 10, convolution_kernel_size=5, 5, 5, deconvolution_kernel_size=5, 5, 5)[source]¶ Function for creating a 3-D symmetric convolutional autoencoder model.
Builds an autoencoder based on the specified array definining the number of units in the encoding branch. Ported from the Keras python implementation here:
https://github.com/XifengGuo/DEC-keras
- Parameters
input_image_size (tuple) – A tuple defining the shape of the 3-D input image
number_of_units_per_layer (tuple) – A tuple defining the number of units in the encoding branch.
convolution_kernel_size (tuple or scalar) – Kernel size for convolution
deconvolution_kernel_size (tuple or scalar) – Kernel size for deconvolution
- Returns
A convolutional encoder and autoencoder Keras model.
- Return type
Keras models
Example
>>> autoencoder, encoder = create_convolutional_autoencoder_model_3d((128, 128, 128, 3)) >>> autoencoder.summary() >>> encoder.summary()
Image classification/regression¶
-
antspynet.architectures.
create_alexnet_model_2d
(input_image_size, number_of_classification_labels=1000, number_of_dense_units=4096, dropout_rate=0.0, mode='classification')[source]¶ 2-D implementation of the AlexNet deep learning architecture.
Creates a keras model of the AlexNet deep learning architecture for image recognition based on the paper
Krizhevsky, and I. Sutskever, and G. Hinton. ImageNet Classification with Deep Convolutional Neural Networks.
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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.
number_of_classification_labels (integer) – Number of segmentation labels.
number_of_dense_units (integer) – Number of dense units.
dropout_rate (scalar) – Optional regularization parameter between [0, 1]. Default = 0.0.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_alexnet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_alexnet_model_3d
(input_image_size, number_of_classification_labels=1000, number_of_dense_units=4096, dropout_rate=0.0, mode='classification')[source]¶ 3-D implementation of the AlexNet deep learning architecture.
Creates a keras model of the AlexNet deep learning architecture for image recognition based on the paper
Krizhevsky, and I. Sutskever, and G. Hinton. ImageNet Classification with Deep Convolutional Neural Networks.
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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.
number_of_classification_labels (integer) – Number of segmentation labels.
number_of_dense_units (integer) – Number of dense units.
dropout_rate (scalar) – Optional regularization parameter between [0, 1]. Default = 0.0.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_alexnet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_densenet_model_2d
(input_image_size, number_of_classification_labels=1000, number_of_filters=16, depth=7, number_of_dense_blocks=1, growth_rate=12, dropout_rate=0.2, weight_decay=0.0001, mode='classification')[source]¶ 2-D implementation of the Wide ResNet deep learning architecture.
Creates a keras model of the DenseNet deep learning architecture for image recognition based on the paper
G. Huang, Z. Liu, K. Weinberger, and L. van der Maaten. Densely Connected Convolutional Networks Networks
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
number_of_classification_labels (integer) – Number of classification labels.
number_of_filters (integer) – Number of filters.
depth (integer) – Number of layers—must be equal to 3 * N + 4 where N is an integer (default = 7).
number_of_dense_blocks (integer) – Number of dense blocks number of dense blocks to add to the end (default = 1).
growth_rate (integer) – Number of filters to add for each dense block layer (default = 12).
dropout_rate (scalar) – Per drop out layer rate (default = 0.2).
weight_decay (scalar) – Weight decay (default = 1e-4).
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_densenet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_densenet_model_3d
(input_image_size, number_of_classification_labels=1000, number_of_filters=16, depth=7, number_of_dense_blocks=1, growth_rate=12, dropout_rate=0.2, weight_decay=0.0001, mode='classification')[source]¶ 2-D implementation of the Wide ResNet deep learning architecture.
Creates a keras model of the DenseNet deep learning architecture for image recognition based on the paper
G. Huang, Z. Liu, K. Weinberger, and L. van der Maaten. Densely Connected Convolutional Networks Networks
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_classification_labels (integer) – Number of classification labels.
number_of_filters (integer) – Number of filters.
depth (integer) – Number of layers—must be equal to 3 * N + 4 where N is an integer (default = 7).
number_of_dense_blocks (integer) – Number of dense blocks number of dense blocks to add to the end (default = 1).
growth_rate (integer) – Number of filters to add for each dense block layer (default = 12).
dropout_rate (scalar) – Per drop out layer rate (default = 0.2).
weight_decay (scalar) – Weight decay (default = 1e-4).
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_densenet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resnet_model_2d
(input_image_size, input_scalars_size=0, number_of_classification_labels=1000, layers=1, 2, 3, 4, residual_block_schedule=3, 4, 6, 3, lowest_resolution=64, cardinality=1, squeeze_and_excite=False, mode='classification')[source]¶ 2-D implementation of the ResNet deep learning architecture.
Creates a keras model of the ResNet deep learning architecture for image classification. The paper is available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
input_scalars_size (integer) – Optional integer specifying the size of the input vector for scalars that get concatenated to the fully connected layer at the end of the network.
number_of_classification_labels (integer) – Number of classification labels.
layers (tuple) – A tuple determining the number of ‘filters’ defined at for each layer.
residual_block_schedule (tuple) – A tuple defining the how many residual blocks repeats for each layer.
lowest_resolution (integer) – Number of filters at the initial layer.
cardinality (integer) – perform ResNet (cardinality = 1) or ResNeX (cardinality does not 1 but, instead, powers of 2—try ‘32’).
squeeze_and_excite (boolean) – add the squeeze-and-excite block variant.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resnet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resnet_model_3d
(input_image_size, input_scalars_size=0, number_of_classification_labels=1000, layers=1, 2, 3, 4, residual_block_schedule=3, 4, 6, 3, lowest_resolution=64, cardinality=1, squeeze_and_excite=False, mode='classification')[source]¶ 3-D implementation of the ResNet deep learning architecture.
Creates a keras model of the ResNet deep learning architecture for image classification. The paper is available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
input_scalars_size (integer) – Optional integer specifying the size of the input vector for scalars that get concatenated to the fully connected layer at the end of the network.
number_of_classification_labels (integer) – Number of classification labels.
layers (tuple) – A tuple determining the number of ‘filters’ defined at for each layer.
residual_block_schedule (tuple) – A tuple defining the how many residual blocks repeats for each layer.
lowest_resolution (integer) – Number of filters at the initial layer.
cardinality (integer) – perform ResNet (cardinality = 1) or ResNeX (cardinality does not 1 but, instead, powers of 2—try ‘32’).
squeeze_and_excite (boolean) – add the squeeze-and-excite block variant.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resnet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_simple_classification_with_spatial_transformer_network_model_2d
(input_image_size, resampled_size=30, 30, number_of_classification_labels=10)[source]¶ 2-D implementation of the spatial transformer network.
Creates a keras model of the spatial transformer network:
based on the following python Keras model:
@param 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. @param resampledSize resampled size of the transformed input images. @param numberOfClassificationLabels Number of classes.
- Parameters
input_image_size (tuple of length 3) – 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).
resampled_size (tuple of length 2) – Resampled size of the transformed input images.
number_of_classification_labels (integer) – Number of units in the final dense layer.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_simple_classification_with_spatial_transformer_network_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_simple_classification_with_spatial_transformer_network_model_3d
(input_image_size, resampled_size=30, 30, 30, number_of_classification_labels=10)[source]¶ 3-D implementation of the spatial transformer network.
Creates a keras model of the spatial transformer network:
based on the following python Keras model:
@param 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. @param resampledSize resampled size of the transformed input images. @param numberOfClassificationLabels Number of classes.
- Parameters
input_image_size (tuple of length 4) – 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).
resampled_size (tuple of length 3) – Resampled size of the transformed input images.
number_of_classification_labels (integer) – Number of units in the final dense layer.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_simple_classification_with_spatial_transformer_network_model_3d((128, 128, 128, 1)) >>> model.summary()
Image super-resolution¶
-
antspynet.architectures.
create_deep_back_projection_network_model_2d
(input_image_size, number_of_outputs=1, number_of_base_filters=64, number_of_feature_filters=256, number_of_back_projection_stages=7, convolution_kernel_size=12, 12, strides=8, 8, last_convolution=3, 3, number_of_loss_functions=1)[source]¶ 2-D implementation of the deep back-projection network.
Creates a keras model of the deep back-project network for image super resolution. More information is provided at the authors’ website:
with the paper available here:
This particular implementation was influenced by the following keras (python) implementation:
with help from the original author’s Caffe and Pytorch implementations:
- Parameters
input_image_size (tuple of length 3) – 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).
number_of_outputs (integer) – Number of outputs (e.g., 3 for RGB images).
number_of_feature_filters (integer) – Number of feature filters.
number_of_base_filters (integer) – Number of base filters.
number_of_back_projection_stages (integer) – Number of up-down-projection stages. This number includes the final up block.
convolution_kernel_size (tuple of length 2) – Kernel size for certain convolutional layers. The strides are dependent on the scale factor discussed in original paper. Factors used in the original implementation are as follows: 2x –> convolution_kernel_size=(6, 6), 4x –> convolution_kernel_size=(8, 8), 8x –> convolution_kernel_size=(12, 12). We default to 8x parameters.
strides (tuple of length 2) – Strides for certain convolutional layers. This and the convolution_kernel_size are dependent on the scale factor discussed in original paper. Factors used in the original implementation are as follows: 2x –> strides = (2, 2), 4x –> strides = (4, 4), 8x –> strides = (8, 8). We default to 8x parameters.
last_convolution (tuple of length 2) – The kernel size for the last convolutional layer.
number_of_loss_functions (integer) – The number of data targets, e.g. 2 for 2 targets
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_deep_back_projection_network_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_deep_back_projection_network_model_3d
(input_image_size, number_of_outputs=1, number_of_base_filters=64, number_of_feature_filters=256, number_of_back_projection_stages=7, convolution_kernel_size=12, 12, 12, strides=8, 8, 8, last_convolution=3, 3, 3, number_of_loss_functions=1)[source]¶ 3-D implementation of the deep back-projection network.
Creates a keras model of the deep back-project network for image super resolution. More information is provided at the authors’ website:
with the paper available here:
This particular implementation was influenced by the following keras (python) implementation:
with help from the original author’s Caffe and Pytorch implementations:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_outputs (integer) – Number of outputs (e.g., 3 for RGB images).
number_of_feature_filters (integer) – Number of feature filters.
number_of_base_filters (integer) – Number of base filters.
number_of_back_projection_stages (integer) – Number of up-down-projection stages. This number includes the final up block.
convolution_kernel_size (tuple of length 3) – Kernel size for certain convolutional layers. The strides are dependent on the scale factor discussed in original paper. Factors used in the original implementation are as follows: 2x –> convolution_kernel_size=(6, 6, 6), 4x –> convolution_kernel_size=(8, 8, 8), 8x –> convolution_kernel_size=(12, 12, 12). We default to 8x parameters.
strides (tuple of length 3) – Strides for certain convolutional layers. This and the convolution_kernel_size are dependent on the scale factor discussed in original paper. Factors used in the original implementation are as follows: 2x –> strides = (2, 2, 2), 4x –> strides = (4, 4, 4), 8x –> strides = (8, 8, 8). We default to 8x parameters.
last_convolution (tuple of length 3) – The kernel size for the last convolutional layer.
number_of_loss_functions (integer) – The number of data targets, e.g. 2 for 2 targets
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_deep_back_projection_network_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_deep_denoise_super_resolution_model_2d
(input_image_size, layers=2, lowest_resolution=64, convolution_kernel_size=3, 3, pool_size=2, 2, strides=2, 2)[source]¶ 2-D implementation of the denoising autoencoder image super resolution deep learning architecture.
- Parameters
input_image_size (tuple of length 3) – 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).
layers (integer) – Number of architecture layers.
lowest_resolution (integer) – Number of filters at the beginning and end of the architecture.
convolution_kernel_size (2-d tuple) – specifies the kernel size during the encoding path.
pool_size (2-d tuple) – Defines the region for each pooling layer.
strides (2-d tuple) – Defines the stride length in each direction.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_deep_denoise_super_resolution_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_deep_denoise_super_resolution_model_3d
(input_image_size, layers=2, lowest_resolution=64, convolution_kernel_size=3, 3, 3, pool_size=2, 2, 2, strides=2, 2, 2)[source]¶ 3-D implementation of the denoising autoencoder image super resolution deep learning architecture.
- Parameters
input_image_size (tuple of length 4) – 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).
layers (integer) – Number of architecture layers.
lowest_resolution (integer) – Number of filters at the beginning and end of the architecture.
convolution_kernel_size (3-d tuple) – specifies the kernel size during the encoding path.
pool_size (3-d tuple) – Defines the region for each pooling layer.
strides (3-d tuple) – Defines the stride length in each direction.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_deep_denoise_super_resolution_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_denoising_auto_encoder_super_resolution_model_2d
(input_image_size, convolution_kernel_sizes=[3, 3, 5, 5], number_of_encoding_layers=2, number_of_filters=64)[source]¶ 2-D implementation of the denoising autoencoder image super resolution deep learning architecture.
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_sizes (list of 2-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_encoding_layers (integer) – The number of encoding layers.
number_of_filters (integer) – The number of filters for each encoding layer.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_denoising_auto_encoder_super_resolution_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_denoising_auto_encoder_super_resolution_model_3d
(input_image_size, convolution_kernel_sizes=[3, 3, 3, 5, 5, 5], number_of_encoding_layers=2, number_of_filters=64)[source]¶ 2-D implementation of the denoising autoencoder image super resolution deep learning architecture.
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_sizes (list of 3-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_encoding_layers (integer) – The number of encoding layers.
number_of_filters (integer) – The number of filters for each encoding layer.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_denoising_auto_encoder_super_resolution_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_expanded_super_resolution_model_2d
(input_image_size, convolution_kernel_sizes=[9, 9, 1, 1, 3, 3, 5, 5, 5, 5], number_of_filters=64, 32, 32, 32)[source]¶ 2-D implementation of the expanded image super resolution deep learning architecture.
Creates a keras model of the image super resolution deep learning framework. based on the paper available here:
This particular implementation is based on the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_sizes (list of 2-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_filters (tuple) – Contains the number of filters for each convolutional layer. Default values are the same as given in the original paper.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_expanded_super_resolution_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_expanded_super_resolution_model_3d
(input_image_size, convolution_kernel_sizes=[9, 9, 9, 1, 1, 1, 3, 3, 3, 5, 5, 5, 5, 5, 5], number_of_filters=64, 32, 32, 32)[source]¶ 3-D implementation of the expanded image super resolution deep learning architecture.
Creates a keras model of the image super resolution deep learning framework. based on the paper available here:
This particular implementation is based on the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_sizes (list of 3-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_filters (tuple) – Contains the number of filters for each convolutional layer. Default values are the same as given in the original paper.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_expanded_super_resolution_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_image_super_resolution_model_2d
(input_image_size, convolution_kernel_sizes=[9, 9, 1, 1, 5, 5], number_of_filters=64, 32)[source]¶ 2-D implementation of the image super resolution deep learning architecture.
Creates a keras model of the image super resolution deep learning framework. based on the paper available here:
This particular implementation is based on the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_sizes (list of 2-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_filters (tuple) – Contains the number of filters for each convolutional layer. Default values are the same as given in the original paper.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_image_super_resolution_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_image_super_resolution_model_3d
(input_image_size, convolution_kernel_sizes=[9, 9, 9, 1, 1, 1, 5, 5, 5], number_of_filters=64, 32)[source]¶ 3-D implementation of the image super resolution deep learning architecture.
Creates a keras model of the image super resolution deep learning framework. based on the paper available here:
This particular implementation is based on the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
convolution_kernel_sizes (list of 3-d tuples) – specifies the kernel size at each convolution layer. Default values are the same as given in the original paper. The length of kernel size list must be 1 greater than the tuple length of the number of filters.
number_of_filters (tuple) – Contains the number of filters for each convolutional layer. Default values are the same as given in the original paper.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_image_super_resolution_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resnet_super_resolution_model_2d
(input_image_size, convolution_kernel_size=3, 3, number_of_filters=64, number_of_residual_blocks=5, number_of_resnet_blocks=1)[source]¶ 2-D implementation of the ResNet image super resolution architecture.
Creates a keras model of the expanded image super resolution deep learning framework based on the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
convolution_kernel_size (2-d tuple) – Specifies the kernel size
number_of_filters (integer) – The number of filters for each encoding layer.
number_of_residual_blocks (integer) – Number of residual blocks.
number_of_resnet_blocks (integer) – Number of resnet blocks. Each block will double the upsampling amount.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resnet_super_resolution_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resnet_super_resolution_model_3d
(input_image_size, convolution_kernel_size=3, 3, 3, number_of_filters=64, number_of_residual_blocks=5, number_of_resnet_blocks=1)[source]¶ 3-D implementation of the ResNet image super resolution architecture.
Creates a keras model of the expanded image super resolution deep learning framework based on the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
convolution_kernel_size (3-d tuple) – Specifies the kernel size
number_of_filters (integer) – The number of filters for each encoding layer.
number_of_residual_blocks (integer) – Number of residual blocks.
number_of_resnet_blocks (integer) – Number of resnet blocks. Each block will double the upsampling amount.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resnet_super_resolution_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_vgg_model_2d
(input_image_size, number_of_classification_labels=1000, layers=1, 2, 3, 4, 4, lowest_resolution=64, convolution_kernel_size=3, 3, pool_size=2, 2, strides=2, 2, number_of_dense_units=4096, dropout_rate=0.0, style=19, mode='classification')[source]¶ 2-D implementation of the Vgg deep learning architecture.
Creates a keras model of the Vgg deep learning architecture for image recognition based on the paper
K. Simonyan and A. Zisserman, Very Deep Convolutional Networks for Large-Scale Image Recognition
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
number_of_classification_labels (integer) – Number of classification labels.
layers (tuple) – A tuple determining the number of ‘filters’ defined at for each layer.
lowest_resolution (integer) – Number of filters at the beginning.
convolution_kernel_size (tuple) – 2-d vector definining the kernel size during the encoding path
pool_size (tuple) – 2-d vector defining the region for each pooling layer.
strides (tuple) – 2-d vector describing the stride length in each direction.
number_of_dense_units (integer) – Number of units in the last layers.
dropout_rate (scalar) – Between 0 and 1 to use between dense layers.
style (integer) – ‘16’ or ‘19’ for VGG16 or VGG19, respectively.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_vgg_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_vgg_model_3d
(input_image_size, number_of_classification_labels=1000, layers=1, 2, 3, 4, 4, lowest_resolution=64, convolution_kernel_size=3, 3, 3, pool_size=2, 2, 2, strides=2, 2, 2, number_of_dense_units=4096, dropout_rate=0.0, style=19, mode='classification')[source]¶ 3-D implementation of the Vgg deep learning architecture.
Creates a keras model of the Vgg deep learning architecture for image recognition based on the paper
K. Simonyan and A. Zisserman, Very Deep Convolutional Networks for Large-Scale Image Recognition
available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_classification_labels (integer) – Number of classification labels.
layers (tuple) – A tuple determining the number of ‘filters’ defined at for each layer.
lowest_resolution (integer) – Number of filters at the beginning.
convolution_kernel_size (tuple) – 3-d vector definining the kernel size during the encoding path
pool_size (tuple) – 3-d vector defining the region for each pooling layer.
strides (tuple) – 3-d vector describing the stride length in each direction.
number_of_dense_units (integer) – Number of units in the last layers.
dropout_rate (scalar) – Between 0 and 1 to use between dense layers.
style (integer) – ‘16’ or ‘19’ for VGG16 or VGG19, respectively.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_vgg_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_wide_resnet_model_2d
(input_image_size, number_of_classification_labels=1000, depth=2, width=1, residual_block_schedule=16, 32, 64, pool_size=8, 8, dropout_rate=0.0, weight_decay=0.0005, mode='classification')[source]¶ 2-D implementation of the Wide ResNet deep learning architecture.
Creates a keras model of the Wide ResNet deep learning architecture for image classification/regression. The paper is available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
number_of_classification_labels (integer) – Number of classification labels.
depth (integer) – Determines the depth of the network. Related to the actual number of layers by number_of_layers = depth * 6 + 4. Default = 2 (such that number_of_layers = 16).
width (integer) – Determines the width of the network. Default = 1.
residual_block_schedule (tuple) – Determines the number of filters per convolutional block. Default = (16, 32, 64).
pool_size (tuple) – Pool size for final average pooling layer. Default = (8, 8).
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for regularization of the kernel weights of the convolution layers. Default = 0.0005.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_wide_resnet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_wide_resnet_model_3d
(input_image_size, number_of_classification_labels=1000, depth=2, width=1, residual_block_schedule=16, 32, 64, pool_size=8, 8, 8, dropout_rate=0.0, weight_decay=0.0005, mode='classification')[source]¶ 3-D implementation of the Wide ResNet deep learning architecture.
Creates a keras model of the Wide ResNet deep learning architecture for image classification/regression. The paper is available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_classification_labels (integer) – Number of classification labels.
depth (integer) – Determines the depth of the network. Related to the actual number of layers by number_of_layers = depth * 6 + 4. Default = 2 (such that number_of_layers = 16).
width (integer) – Determines the width of the network. Default = 1.
residual_block_schedule (tuple) – Determines the number of filters per convolutional block. Default = (16, 32, 64).
pool_size (tuple) – Pool size for final average pooling layer. Default = (8, 8, 8).
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for regularization of the kernel weights of the convolution layers. Default = 0.0005.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_wide_resnet_model_3d((128, 128, 128, 1)) >>> model.summary()
Image voxelwise segmentation¶
-
antspynet.architectures.
create_unet_model_2d
(input_image_size, number_of_outputs=2, scalar_output_size=0, scalar_output_activation='relu', number_of_layers=4, number_of_filters_at_base_layer=32, number_of_filters=None, convolution_kernel_size=3, 3, deconvolution_kernel_size=2, 2, pool_size=2, 2, strides=2, 2, dropout_rate=0.0, weight_decay=0.0, mode='classification', additional_options=None)[source]¶ 2-D implementation of the U-net deep learning architecture.
Creates a keras model of the U-net deep learning architecture for image segmentation and regression. More information is provided at the authors’ website:
with the paper available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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).
number_of_outputs (integer) – Meaning depends on the mode. For classification this is the number of segmentation labels. For regression this is the number of outputs.
scalar_output_size (integer) – If greater than 0, a global average pooling from each encoding layer is concatenated to a dense layer as a secondary output.
scalar_output_activation (string) – Activation for nonzero output scalar.
number_of_layers (integer) – number of encoding/decoding layers.
number_of_filters_at_base_layer (integer) – number of filters at the beginning and end of the U. Doubles at each descending/ascending layer.
number_of_filters (tuple) – tuple explicitly setting the number of filters at each layer. One can either set this or number_of_layers and number_of_filters_at_base_layer. Default = None.
convolution_kernel_size (tuple of length 2) – Defines the kernel size during the encoding.
deconvolution_kernel_size (tuple of length 2) – Defines the kernel size during the decoding.
pool_size (tuple of length 2) – Defines the region for each pooling layer.
strides (tuple of length 2) – Strides for the convolutional layers.
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers. Default = 0.0.
mode (string) – classification, regression, or sigmoid. Default = classification.
additional_options (string or tuple of strings) –
- specific configuration add-ons/tweaks:
”attentionGating” – attention-unet variant in https://pubmed.ncbi.nlm.nih.gov/33288961/
”nnUnetActivationStyle” – U-net activation explained in https://pubmed.ncbi.nlm.nih.gov/33288961/
”initialConvolutionalKernelSize[X]” – Set the first two convolutional layer kernel sizes to X.
- Returns
A 2-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> model = create_unet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_unet_model_3d
(input_image_size, number_of_outputs=2, scalar_output_size=0, scalar_output_activation='relu', number_of_layers=4, number_of_filters_at_base_layer=32, number_of_filters=None, convolution_kernel_size=3, 3, 3, deconvolution_kernel_size=2, 2, 2, pool_size=2, 2, 2, strides=2, 2, 2, dropout_rate=0.0, weight_decay=0.0, mode='classification', additional_options=None)[source]¶ 3-D implementation of the U-net deep learning architecture.
Creates a keras model of the U-net deep learning architecture for image segmentation and regression. More information is provided at the authors’ website:
with the paper available here:
This particular implementation was influenced by the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_outputs (integer) – Meaning depends on the mode. For classification this is the number of segmentation labels. For regression this is the number of outputs.
scalar_output_size (integer) – If greater than 0, a global average pooling from each encoding layer is concatenated to a dense layer as a secondary output.
scalar_output_activation (string) – Activation for nonzero output scalar.
number_of_layers (integer) – number of encoding/decoding layers.
number_of_filters_at_base_layer (integer) – number of filters at the beginning and end of the U. Doubles at each descending/ascending layer.
number_of_filters (tuple) – tuple explicitly setting the number of filters at each layer. One can either set this or number_of_layers and number_of_filters_at_base_layer. Default = None.
convolution_kernel_size (tuple of length 3) – Defines the kernel size during the encoding.
deconvolution_kernel_size (tuple of length 3) – Defines the kernel size during the decoding.
pool_size (tuple of length 3) – Defines the region for each pooling layer.
strides (tuple of length 3) – Strides for the convolutional layers.
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers. Default = 0.0.
mode (string) – classification regression, or sigmoid. Default = classification.
additional_options (string or tuple of strings) –
- specific configuration add-ons/tweaks:
”attentionGating” – attention-unet variant in https://pubmed.ncbi.nlm.nih.gov/33288961/
”nnUnetActivationStyle” – U-net activation explained in https://pubmed.ncbi.nlm.nih.gov/33288961/
”initialConvolutionalKernelSize[X]” – Set the first two convolutional layer kernel sizes to X.
- Returns
A 3-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> model = create_unet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resunet_model_2d
(input_image_size, number_of_outputs=1, number_of_filters_at_base_layer=32, bottle_neck_block_depth_schedule=3, 4, convolution_kernel_size=3, 3, deconvolution_kernel_size=2, 2, dropout_rate=0.0, weight_decay=0.0, mode='classification')[source]¶ 2-D implementation of the Resnet + U-net deep learning architecture.
Creates a keras model of the U-net + ResNet deep learning architecture for image segmentation and regression with the paper available here:
This particular implementation was ported from the following python implementation:
- Parameters
input_image_size (tuple of length 3) – 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.
number_of_outputs (integer) – Meaning depends on the mode. For ‘classification’ this is the number of segmentation labels. For ‘regression’ this is the number of outputs.
number_of_filters_at_base_layer (integer) – Number of filters at the beginning and end of the ‘U’. Doubles at each descending/ascending layer.
bottle_neck_block_depth_schedule (tuple) – Tuple that provides the encoding layer schedule for the number of bottleneck blocks per long skip connection.
convolution_kernel_size (tuple of length 2) – 2-d vector defining the kernel size during the encoding path
deconvolution_kernel_size (tuple of length 2) – 2-d vector defining the kernel size during the decoding
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers. Default = 0.0.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resunet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_resunet_model_3d
(input_image_size, number_of_outputs=1, number_of_filters_at_base_layer=32, bottle_neck_block_depth_schedule=3, 4, convolution_kernel_size=3, 3, 3, deconvolution_kernel_size=2, 2, 2, dropout_rate=0.0, weight_decay=0.0, mode='classification')[source]¶ 3-D implementation of the Resnet + U-net deep learning architecture.
Creates a keras model of the U-net + ResNet deep learning architecture for image segmentation and regression with the paper available here:
This particular implementation was ported from the following python implementation:
- Parameters
input_image_size (tuple of length 4) – 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.
number_of_outputs (integer) – Meaning depends on the mode. For ‘classification’ this is the number of segmentation labels. For ‘regression’ this is the number of outputs.
number_of_filters_at_base_layer (integer) – Number of filters at the beginning and end of the ‘U’. Doubles at each descending/ascending layer.
bottle_neck_block_depth_schedule (tuple) – Tuple that provides the encoding layer schedule for the number of bottleneck blocks per long skip connection.
convolution_kernel_size (tuple of length 3) – 3-d vector defining the kernel size during the encoding path
deconvolution_kernel_size (tuple of length 3) – 3-d vector defining the kernel size during the decoding
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers. Default = 0.0.
mode (string) – ‘classification’ or ‘regression’. Default = ‘classification’.
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_resunet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_denseunet_model_2d
(input_image_size, number_of_outputs=1, number_of_layers_per_dense_block=6, 12, 36, 24, growth_rate=48, initial_number_of_filters=96, reduction_rate=0.0, depth=7, dropout_rate=0.0, weight_decay=0.0001, mode='classification')[source]¶ 2-D implementation of the dense U-net deep learning architecture.
Creates a keras model of the dense U-net deep learning architecture for image segmentation
X. Li, H. Chen, X. Qi, Q. Dou, C.-W. Fu, P.-A. Heng. H-DenseUNet: Hybrid Densely Connected UNet for Liver and Tumor Segmentation from CT Volumes
available here:
with the author’s implementation available at:
- Parameters
input_image_size (tuple of length 3) – 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.
number_of_outputs (integer) – Meaning depends on the mode. For ‘classification’ this is the number of segmentation labels. For ‘regression’ this is the number of outputs.
number_of_layers_per_dense_blocks (tuple) – Number of dense blocks per layer.
growth_rate (integer) – Number of filters to add for each dense block layer (default = 48).
initial_number_of_filters (integer) – Number of filters at the beginning (default = 96).
reduction_rate (scalar) – Reduction factor of transition blocks.
depth (integer) – Number of layers—must be equal to 3 * N + 4 where N is an integer (default = 7).
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers (default = 1e-4).
- Returns
A 2-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_denseunet_model_2d((128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_denseunet_model_3d
(input_image_size, number_of_outputs=1, number_of_layers_per_dense_block=6, 12, 36, 24, growth_rate=48, initial_number_of_filters=96, reduction_rate=0.0, depth=7, dropout_rate=0.0, weight_decay=0.0001, mode='classification')[source]¶ 2-D implementation of the dense U-net deep learning architecture.
Creates a keras model of the dense U-net deep learning architecture for image segmentation
X. Li, H. Chen, X. Qi, Q. Dou, C.-W. Fu, P.-A. Heng. H-DenseUNet: Hybrid Densely Connected UNet for Liver and Tumor Segmentation from CT Volumes
available here:
with the author’s implementation available at:
- Parameters
input_image_size (tuple of length 4) – 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.
number_of_outputs (integer) – Meaning depends on the mode. For ‘classification’ this is the number of segmentation labels. For ‘regression’ this is the number of outputs.
number_of_layers_per_dense_blocks (tuple) – Number of dense blocks per layer.
growth_rate (integer) – Number of filters to add for each dense block layer (default = 48).
initial_number_of_filters (integer) – Number of filters at the beginning (default = 96).
reduction_rate (scalar) – Reduction factor of transition blocks.
depth (integer) – Number of layers—must be equal to 3 * N + 4 where N is an integer (default = 7).
dropout_rate (scalar) – Float between 0 and 1 to use between dense layers.
weight_decay (scalar) – Weighting parameter for L2 regularization of the kernel weights of the convolution layers (default = 1e-4).
- Returns
A 3-D Keras model defining the network.
- Return type
Keras model
Example
>>> model = create_denseunet_model_3d((128, 128, 128, 1)) >>> model.summary()
-
antspynet.architectures.
create_nobrainer_unet_model_3d
(input_image_size)[source]¶ Implementation of the “NoBrainer” U-net architecture
Creates a keras model of the U-net deep learning architecture for image segmentation available at:
- Parameters
input_image_size (tuple of length 4) – 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).
- Returns
A 3-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> model = create_nobrainer_unet_model_3d((None, None, None, 1)) >>> model.summary()
-
antspynet.architectures.
create_hippmapp3r_unet_model_3d
(input_image_size, do_first_network=True, data_format='channels_last')[source]¶ Implementation of the “HippMapp3r” U-net architecture
Creates a keras model implementation of the u-net architecture described here:
with the implementation available here:
- Parameters
input_image_size (tuple of length 4) – 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).
do_first_network (boolean) – Boolean dictating if the model built should be the first (initial) network or second (refinement) network.
data_format (string) – One of “channels_first” or “channels_last”. We do this for this specific architecture as the original weights were saved in “channels_first” format.
- Returns
A 3-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> shape_initial_stage = (160, 160, 128) >>> model_initial_stage = antspynet.create_hippmapp3r_unet_model_3d((*shape_initial_stage, 1), True) >>> model_initial_stage.load_weights(antspynet.get_pretrained_network("hippMapp3rInitial")) >>> shape_refine_stage = (112, 112, 64) >>> model_refine_stage = antspynet.create_hippmapp3r_unet_model_3d((*shape_refine_stage, 1), False) >>> model_refine_stage.load_weights(antspynet.get_pretrained_network("hippMapp3rRefine"))
-
antspynet.architectures.
create_sysu_media_unet_model_2d
(input_image_size, anatomy='wmh')[source]¶ Implementation of the sysu_media U-net architecture
Creates a keras model implementation of the u-net architecture in the 2017 MICCAI WMH challenge by the sysu_medial team described here:
with the original implementation available here:
- Parameters
input_image_size (tuple of length 4) – This will be (200, 200, 2) for t1/flair input and (200, 200, 1)} for flair-only input.
anatomy (string) – “wmh” or “claustrum”
- Returns
A 2-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> image_size = (200, 200) >>> model = antspynet.create_sysu_media_unet_model_2d((*image_size, 1))
-
antspynet.
create_hypothalamus_unet_model_3d
(input_image_size)[source]¶ Implementation of the U-net architecture for hypothalamus segmentation described in
https://pubmed.ncbi.nlm.nih.gov/32853816/
and ported from the original implementation:
- The network has is characterized by the following parameters:
3 resolution levels: 24 —> 48 —> 96 filters
convolution: kernel size: (3, 3, 3), activation: ‘elu’,
pool size: (2, 2, 2)
- Returns
A 3-D keras model defining the U-net network.
- Return type
Keras model
Example
>>> model = create_hypothalamus_unet_model_3d((160, 160, 160, 1))
Custom¶
-
antspynet.architectures.
create_simple_fully_convolutional_network_model_3d
(input_image_size, number_of_filters_per_layer=32, 64, 128, 256, 256, 64, number_of_bins=40, dropout_rate=0.5)[source]¶ Implementation of the “SCFN” architecture for Brain/Gender prediction
Creates a keras model implementation of the Simple Fully Convolutional Network model from the FMRIB group:
- Parameters
input_image_size (tuple of length 4) – 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).
number_of_filters_per_layer (array) – number of filters for the convolutional layers.
number_of_bins (integer) – number of bins for final softmax output.
dropout_rate (float between 0 and 1) – Optional dropout rate before final convolution layer.
- Returns
A 3-D keras model.
- Return type
Keras model
Example
>>> model = create_simple_fully_convolutional_network_model_3d((None, None, None, 1)) >>> model.summary()
Generative adverserial networks¶
-
class
antspynet.architectures.
VanillaGanModel
(input_image_size, latent_dimension=100)[source]¶ Vanilla GAN model.
- Parameters
input_image_size (tuple) – 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).
latent_dimension (integer) –
- Returns
A Keras model defining the network.
- Return type
Keras model
-
class
antspynet.architectures.
DeepConvolutionalGanModel
(input_image_size, latent_dimension=100)[source]¶ GAN model using CNNs
Deep convolutional generative adverserial network from the paper:
and ported from the Keras (python) implementation:
- Parameters
input_image_size (tuple) – 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).
latent_dimension (integer) –
- Returns
A Keras model defining the network.
- Return type
Keras model
-
class
antspynet.architectures.
WassersteinGanModel
(input_image_size, latent_dimension=100, number_of_critic_iterations=5, clip_value=0.01)[source]¶ Wasserstein GAN model
Wasserstein generative adverserial network from the paper:
and ported from the Keras implementation:
- Parameters
input_image_size (tuple) – 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).
latent_dimension (integer) – Default = 100.
number_of_critic_iterations (integer) – Default = 5.
clip_value (float) – Default = 0.01.
- Returns
A Keras model defining the network.
- Return type
Keras model
-
class
antspynet.architectures.
ImprovedWassersteinGanModel
(input_image_size, latent_dimension=100, number_of_critic_iterations=5)[source]¶ Improved Wasserstein GAN model
Improved Wasserstein generative adverserial network from the paper:
and ported from the Keras implementation:
- Parameters
input_image_size (tuple) – 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).
latent_dimension (integer) – Default = 100.
number_of_critic_iterations (integer) – Default = 5.
- Returns
A Keras model defining the network.
- Return type
Keras model
-
class
antspynet.architectures.
CycleGanModel
(input_image_size, lambda_cycle_loss_weight=10.0, lambda_identity_loss_weight=1.0, number_of_filters_at_base_layer=32, 64)[source]¶ Cycle GAN model
Cycle generative adverserial network from the paper:
and ported from the Keras (python) implementation:
- Parameters
input_image_size (tuple) – 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).
latent_dimension (integer) –
- Returns
A Keras model defining the network.
- Return type
Keras model
-
class
antspynet.architectures.
SuperResolutionGanModel
(low_resolution_image_size, scale_factor=2, use_image_net_weights=True, number_of_residual_blocks=16, number_of_filters_at_base_layer=64, 64)[source]¶ Super resolution GAN model
Super resolution generative adverserial network from the paper:
and ported from the Keras implementation:
- Parameters
input_image_size (tuple) – 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).
low_resolution_image_size (tuple) – Size of the input image.
scale_factor (integer) – Upsampling factor for the output super-resolution image.
use_image_net_weights (boolean) – Determines whether or not one uses the image-net weights. Only valid for 2-D images.
number_of_residual_blocks (16) – Number of residual blocks used in constructing the generator.
number_of_filters_at_base_layer (tuple of length 2) – Number of filters at the base layer for the generator and discriminator, respectively.
- Returns
A Keras model defining the network.
- Return type
Keras model