tfmri.models.ConvBlock3D

class ConvBlock3D(*args, **kwargs)[source]

Bases: tensorflow_mri.python.models.conv_blocks.ConvBlock

3D convolutional block.

A basic Conv + BN + Activation block. The number of convolutional layers is determined by filters. BN and activation are optional.

Parameters
  • filters

    A list of int numbers or an int number of filters. Given an int input, a single convolution is applied; otherwise a series of convolutions are applied.

  • 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.

  • strides – An integer or tuple/list of rank integers, specifying the strides of the convolution along each spatial dimension. Can be a single integer to specify the same value for all spatial dimensions.

  • activation – A callable or a Keras activation identifier. The activation to use in all layers. Defaults to 'relu'.

  • out_activation – A callable or a Keras activation identifier. The activation to use in the last layer. Defaults to 'same', in which case we use the same activation as in previous layers as defined by activation.

  • use_bias – A boolean, whether the block’s layers use bias vectors. Defaults to True.

  • 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

    If True, use batch normalization. Defaults to False.

  • 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.

  • use_residual

    A boolean. If True, the input is added to the outputs to create a residual learning block. 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 if use_dropout is True. Defaults to 'standard'.

  • **kwargs – Additional keyword arguments to be passed to base class.

Create a basic convolution block.