Encoders#
PyTorch Encoders#
AlexNet#
- class fusionlab.encoders.AlexNet(cin=3, spatial_dims=2)[source]#
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
Tensor
VGG#
- class fusionlab.encoders.VGG16(cin=3, spatial_dims=2)[source]#
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class fusionlab.encoders.VGG19(cin=3, spatial_dims=2)[source]#
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
InceptionNet#
- class fusionlab.encoders.InceptionNetV1(cin=3, spatial_dims=2)[source]#
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
ResNet#
- class fusionlab.encoders.ResNet(block, layers, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, norm_layer=None, cin=3, spatial_dims=2)[source]#
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
Tensor
EfficientNet#
- class fusionlab.encoders.EfficientNet(inverted_residual_setting, cin=3, stochastic_depth_prob=0.2, last_channel=None, norm_layer=None, spatial_dims=2)[source]#
- __init__(inverted_residual_setting, cin=3, stochastic_depth_prob=0.2, last_channel=None, norm_layer=None, spatial_dims=2)[source]#
EfficientNet V1 and V2 main class
- Parameters:
inverted_residual_setting (Sequence[Union[MBConvConfig, FusedMBConvConfig]]) – Network structure
dropout (float) – The droupout probability
stochastic_depth_prob (float) – The stochastic depth probability
num_classes (int) – Number of classes
norm_layer (Optional[Callable[..., nn.Module]]) – Module specifying the normalization layer to use
last_channel (int) – The number of channels on the penultimate layer
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type:
Tensor
ConvNeXt#
- class fusionlab.encoders.ConvNeXt(in_chans=3, depths=[3, 3, 9, 3], dims=[96, 192, 384, 768], drop_path_rate=0.0, layer_scale_init_value=1e-06, spatial_dims=2)[source]#
- A PyTorch impl ofA ConvNet for the 2020s -
- Parameters:
in_chans (int) – Number of input image channels. Default: 3
num_classes (int) – Number of classes for classification head. Default: 1000
depths (tuple(int)) – Number of blocks at each stage. Default: [3, 3, 9, 3]
dims (int) – Feature dimension at each stage. Default: [96, 192, 384, 768]
drop_path_rate (float) – Stochastic depth rate. Default: 0.
layer_scale_init_value (float) – Init value for Layer Scale. Default: 1e-6.
head_init_scale (float) – Init scaling value for classifier weights and biases. Default: 1.
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.