Network Backbone

Local Net

class deepreg.model.backbone.local_net.LocalNet(*args: Any, **kwargs: Any)

Builds LocalNet for image registration.

Reference:

Image is encoded gradually, i from level 0 to E, then it is decoded gradually, j from level E to D. Some of the decoded levels are used for generating extractions

So, extract_levels are between [0, E] with E = max(extract_levels), and D = min(extract_levels).

Parameters
  • image_size – tuple, such as (dim1, dim2, dim3)

  • out_channels – int, number of channels for the extractions

  • num_channel_initial – int, number of initial channels.

  • extract_levels – list of int, number of extraction levels.

  • out_kernel_initializer – str, initializer to use for kernels.

  • out_activation – str, activation to use at end layer.

  • kwargs

call(inputs, training=None, mask=None)

Build LocalNet graph based on built layers.

Parameters
  • inputs – image batch, shape = (batch, f_dim1, f_dim2, f_dim3, ch)

  • training – None or bool.

  • mask – None or tf.Tensor.

Returns

tf.Tensor, shape = (batch, f_dim1, f_dim2, f_dim3, out_channels)

Global Net

class deepreg.model.backbone.global_net.GlobalNet(*args: Any, **kwargs: Any)

Builds GlobalNet for image registration.

Reference:

Image is encoded gradually, i from level 0 to E. Then, a densely-connected layer outputs an affine transformation.

Parameters
  • image_size – tuple, such as (dim1, dim2, dim3)

  • out_channels – int, number of channels for the output

  • num_channel_initial – int, number of initial channels

  • extract_levels – list, which levels from net to extract

  • out_kernel_initializer – str, which kernel to use as initializer

  • out_activation – str, activation at last layer

  • kwargs

call(inputs, training=None, mask=None)

Build GlobalNet graph based on built layers.

Parameters
  • inputs – image batch, shape = (batch, f_dim1, f_dim2, f_dim3, ch)

  • training – None or bool.

  • mask – None or tf.Tensor.

Returns

tf.Tensor, shape = (batch, dim1, dim2, dim3, 3)

U-Net

class deepreg.model.backbone.u_net.UNet(*args: Any, **kwargs: Any)

Class that implements an adapted 3D UNet.

Reference:

  • O. Ronneberger, P. Fischer, and T. Brox, “U-net: Convolutional networks for biomedical image segmentation,”, Lecture Notes in Computer Science, 2015, vol. 9351, pp. 234–241. https://arxiv.org/abs/1505.04597

Initialise UNet.

Parameters
  • image_size – tuple, (dim1, dim2, dim3), dims of input image.

  • out_channels – int, number of channels for the output

  • num_channel_initial – int, number of initial channels

  • depth – int, input is at level 0, bottom is at level depth

  • out_kernel_initializer – str, which kernel to use as initializer

  • out_activation – str, activation at last layer

  • pooling – Boolean, for downsampling, use non-parameterized pooling if true, otherwise use conv3d

  • concat_skip – Boolean, when upsampling, concatenate skipped tensor if true, otherwise use addition

  • kwargs

call(inputs, training=None, mask=None)

Builds graph based on built layers.

Parameters
  • inputs – shape = [batch, f_dim1, f_dim2, f_dim3, in_channels]

  • training

  • mask

Returns

shape = [batch, f_dim1, f_dim2, f_dim3, out_channels]