niftynet.network.resnet module¶
-
class
ResNetDesc
(bn, fc, conv1, blocks)¶ Bases:
tuple
-
blocks
¶ Alias for field number 3
-
bn
¶ Alias for field number 0
-
conv1
¶ Alias for field number 2
-
fc
¶ Alias for field number 1
-
-
class
ResNet
(num_classes, n_features=[16, 64, 128, 256], n_blocks_per_resolution=10, w_initializer=None, w_regularizer=None, b_initializer=None, b_regularizer=None, acti_func='relu', name='ResNet')[source]¶ Bases:
niftynet.network.base_net.BaseNet
- ### Description
- implementation of Res-Net:
- He et al., “Identity Mappings in Deep Residual Networks”, arXiv:1603.05027v3
### Building Blocks [CONV] - Convolutional layer, no activation, no batch norm (s)[DOWNRES] - Downsample residual block.
Each block is composed of a first bottleneck block with stride s, followed by n_blocks_per_resolution bottleneck blocks with stride 1.[FC] - Fully connected layer with nr output channels == num_classes
### Diagram
INPUT –> [CONV] –>(s=1)[DOWNRES] –> (s=2)[DOWNRES]x2 –> BN, ReLU, mean –> [FC] –> OUTPUT
### Constraints
-
__init__
(num_classes, n_features=[16, 64, 128, 256], n_blocks_per_resolution=10, w_initializer=None, w_regularizer=None, b_initializer=None, b_regularizer=None, acti_func='relu', name='ResNet')[source]¶ Parameters: - num_classes – int, number of channels of output
- n_features – array, number of features per ResNet block
- n_blocks_per_resolution – int, number of BottleneckBlock per DownResBlock
- w_initializer – weight initialisation for network
- w_regularizer – weight regularisation for network
- b_initializer – bias initialisation for network
- b_regularizer – bias regularisation for network
- acti_func – ctivation function to use
- name – layer name
-
class
BottleneckBlockDesc2
(common_bn, conv, conv_shortcut)¶ Bases:
tuple
-
common_bn
¶ Alias for field number 0
-
conv
¶ Alias for field number 1
-
conv_shortcut
¶ Alias for field number 2
-
-
class
BottleneckBlock
(n_output_chns, stride, Conv, name='bottleneck')[source]¶ Bases:
niftynet.layer.base_layer.TrainableLayer
-
__init__
(n_output_chns, stride, Conv, name='bottleneck')[source]¶ Parameters: - n_output_chns – int, number of output channels
- stride – int, stride to use in the convolutional layers
- Conv – layer, convolutional layer
- name – layer name
-
-
class
DownResBlock
(n_output_chns, count, stride, Conv, name='downres')[source]¶