micro_dl.networks.layers module

Submodules

micro_dl.networks.layers.interp_upsampling2D module

Nearest/Bilinear interpolation in 2D

class micro_dl.networks.layers.interp_upsampling2D.InterpUpSampling2D(size=(2, 2), interp_type='nearest', data_format='channels_last', **kwargs)

Bases: Layer

Interpolates the feature map for upsampling

build(input_shape)

Build layer

There are no weights for bilinear interpolation. InputSpec specifies the ndim, dtype and shape of every input to a layer

Parameters:

input_shape (tuple/list/np.array) – shape of the input tensor

call(x, mask=None)

Layer’s logic

tf.image.resize_bilinear uses channels_last and has border issues! https://github.com/tensorflow/tensorflow/issues/6720

Parameters:

x (keras.layers) – input layer for upsampling

Returns:

upsampled tensor

compute_output_shape(input_shape)

Compute shape output

Parameters:

input_shape (tuple/list/np.array) – shape of the input tensor

Returns:

width and height of the upsampled image

get_config()

Return config

micro_dl.networks.layers.interp_upsampling3D module

Nearest/Bilinear interpolation in 3D

class micro_dl.networks.layers.interp_upsampling3D.InterpUpSampling3D(size=(2, 2, 2), interp_type='nearest', data_format='channels_last', **kwargs)

Bases: InterpUpSampling2D

Interpolates the feature map for upsampling

build(input_shape)

Build layer

There are no weights for bilinear interpolation

Parameters:

input_shape (tuple/list/np.array) – shape of the input tensor

call(x, mask=None)

Layer’s logic

https://niftynet.readthedocs.io/en/dev/_modules/niftynet/layer/linear_resize.html https://stackoverflow.com/questions/43814367/resize-3d-data-in-tensorflow-like-tf-image-resize-images

Parameters:

x (keras.layers) – input layer for upsampling

Returns:

upsampled tensor

compute_output_shape(input_shape)

Compute shape of output

Parameters:

input_shape (tuple/list/np.array) – shape of the input tensor

Returns:

width and height of the upsampled image

get_config()

Return config

Module contents

Module for custom layers