tfmri.layers.UNet
tfmri.layers.UNet¶
- class UNet(*args, **kwargs)[source]¶
Bases:
keras.engine.base_layer.Layer
A UNet layer. (deprecated)
Deprecated: THIS FUNCTION IS DEPRECATED. It will be removed after 2022-10-01. Instructions for updating: Use tfmri.models.UNetND instead.
- Parameters
scales – The number of scales.
scales - 1
pooling layers will be added to the model. Lowering the depth may reduce the amount of memory required for training.base_filters – The number of filters that the first layer in the convolution network will have. The number of filters in following layers will be calculated from this number. Lowering this number may reduce the amount of memory required for training.
kernel_size – An integer or tuple/list of
rank
integers, specifying the size of the convolution window. Can be a single integer to specify the same value for all spatial dimensions.pool_size – The pooling size for the pooling operations. Defaults to 2.
block_depth – The number of layers in each convolutional block. Defaults to 2.
use_deconv – If True, transpose convolution (deconvolution) will be used instead of up-sampling. This increases the amount memory required during training. Defaults to False.
rank – An integer specifying the number of spatial dimensions. Defaults to 2.
activation – A callable or a Keras activation identifier. Defaults to
'relu'
.kernel_initializer – A
tf.keras.initializers.Initializer
or a Keras initializer identifier. Initializer for convolutional kernels. Defaults to'VarianceScaling'
.bias_initializer – A
tf.keras.initializers.Initializer
or a Keras initializer identifier. Initializer for bias terms. Defaults to'Zeros'
.kernel_regularizer – A
tf.keras.initializers.Regularizer
or a Keras regularizer identifier. Regularizer for convolutional kernels. Defaults to None.bias_regularizer –
A
tf.keras.initializers.Regularizer
or a Keras regularizer identifier. Regularizer for bias terms. Defaults to None.use_batch_norm –
use_sync_bn –
If True, use synchronised batch normalization. Defaults to False.
bn_momentum – A float. Momentum for the moving average in batch normalization.
bn_epsilon –
A float. Small float added to variance to avoid dividing by zero during batch normalization.
out_channels – An int. The number of output channels.
out_activation –
A callable or a Keras activation identifier. The output activation. Defaults to None.
use_global_residual –
A boolean. If True, adds a global residual connection to create a residual learning network. Defaults to False.
use_dropout –
A boolean. If True, a dropout layer is inserted after each activation. Defaults to False.
dropout_rate –
A float. The dropout rate. Only relevant if
use_dropout
is True. Defaults to 0.3.dropout_type –
A str. The dropout type. Must be one of
'standard'
or'spatial'
. Standard dropout drops individual elements from the feature maps, whereas spatial dropout drops entire feature maps. Only relevant ifuse_dropout
is True. Defaults to'standard'
.**kwargs – Additional keyword arguments to be passed to base class.
Creates a UNet layer.