KerasResNoduleNet¶
-
class
radio.models.
KerasResNoduleNet
(config=None, *args, **kwargs)[source]¶ Bases:
radio.models.keras.keras_model.KerasModel
ResNoduleNet model for 3D scans implemented in keras.
Class extends KerasModel class.
Contains description of three types of blocks: ‘identity_block’ and ‘conv_block’. ResNet architercture is implemented inside _build method using these blocks. Model is inspired by ResNet (Kaiming He et Al., https://arxiv.org/abs/1512.03385/).
-
config
¶ dict – config dictionary from dataset pipeline see configuring model section of dataset module: https://analysiscenter.github.io/dataset/intro/models.html.
-
name
¶ str – name of the model.
-
units
¶ tuple(int, int) or int or None – number of units in final dense layers before tensor with predicitons. default: (512, 256).
-
num_targets
¶ int – size of tensor with predicitons. default: 1.
-
dropout_rate
¶ float – probability of dropout. default: 0.35.
Notes
Implementation requires the input tensor having shape=(batch_size, 32, 64, 64, 1).
-
conv_block
(inputs, kernel_size, filters, stage, block, strides=(2, 2, 2))[source]¶ Convolutional block that has a conv layer at shortcut.
3D-convolution with (1, 1, 1) kernel size, (2, 2, 2)-strides, batch normalization and relu activation are applied. Then resulting tensor flows into 3D-convolution with (3, 3, 3) kernel size, batch normalization and relu activation. Finally, the result of previous convolution goes into 3D-convolution with (1, 1, 1) kernel size, batch normalization without activation and its output is summed with the result of 3D-convolution with kernel_size=(1, 1, 1), strides=(2, 2, 2) and batch normalization of inputs. After that relu activation is applied to the result of add operation. Argument filters should be tuple(int, int, int) and specifies number of filters in first, second and third convolution correspondingly.
Parameters: - inputs (keras tensor) – input tensor.
- kernel_size (tuple(int, int, int)) – size of the kernel along three dimensions for middle convolution operation in block.
- filters (tuple(int, int, int)) – number of filters in first, second and third 3D-convolution operations.
- stage (int) – number of stage, on par with block argument used to derive names of inner layers.
- block (str) – block prefix, on par with stage argument used to derive names of inner layers.
Returns: output tensor.
Return type: keras tensor
-
identity_block
(inputs, kernel_size, filters, stage, block)[source]¶ The identity block is the block that has no conv layer at shortcut.
First of all, 3D-convolution with (1, 1, 1) kernel size, batch normalization and relu activation is applied. Then the result flows into 3D-convolution with (3, 3, 3) kernel size, batch normalization and relu activation. Finally, the result of previous convolution goes into 3D-convolution with (1, 1, 1) kernel size, batch normalization without activation and its output is summed with the input tensor and relu activation is applied. Argument filters should be tuple(int, int, int) and specifies number of filters in first, second and third convolution correspondingly. Number of filters in third convolution must be the same as in the input tensor.
Parameters: - inputs (keras tensor) – input tensor.
- kernel_size (tuple(int, int, int)) – size of the kernel along three dimensions for middle convolution operation in block.
- filters (tuple(int, int, int)) – number of filters in first, second and third 3D-convolution operations.
- stage (int) – number of stage, on par with block argument used to derive names of inner layers.
- block (str) – block prefix, on par with stage argument used to derive names of inner layers.
Returns: output tensor.
Return type: keras tensor
-