U-Net ResNet34

class src.pipelines.tensorflow_v2.models.unet_resnet.ResBlock(*args, **kwargs)[source]

A Residual block

call(x)[source]

Applies a ResBlock to the an input

Parameters

x (Tensor) – the input to apply the ResBlock to

Return type

Tensor

Returns

the output of the ResBlock

class src.pipelines.tensorflow_v2.models.unet_resnet.UnetResnet(output_channels, activation='relu', initializer='he_normal', filters=3)[source]

A U-Net model, which has a ResNet 34 backbone

call(x)[source]

Applies a U-Net ResNet34 model to the input.

Parameters

inputs – an input image

Return type

Tensor

Returns

the output of a U-Net ResNet34 model

model(shape=(512, 512, 1))[source]

Returns a U-Net model as tf.keras.Model. This is a workaround to use the functional api, which allows the model to be viewed.

Parameters

shape (Tuple[int, int, int]) – the shape of the input

Return type

Model

Returns

the tf.keras.Model instantiated using the functional api

print_all_layers()[source]

Prints all the layers in the model, including the layers in the subclasses which make up the model. This uses the model() workaround function.

Return type

None

Returns

None

get_all_layers()[source]

Returns all the layers in the model, including the layers in the subclasses which make up the model. This uses the model() workaround function.

Return type

List[Layer]

Returns

a list of layers