anomalib.models.reverse_distillation.components.de_resnet¶
Torch model defining the decoder.
Module Contents¶
Classes¶
Basic block for decoder ResNet architecture. |
|
Bottleneck for Decoder. |
|
ResNet model for decoder. |
Functions¶
|
|
|
ResNet-18 model. |
|
ResNet-34 model. |
|
ResNet-50 model. |
|
ResNet-101 model. |
|
ResNet-152 model. |
|
ResNeXt-50 32x4d model. |
|
ResNeXt-101 32x8d model. |
|
Wide ResNet-50-2 model. |
|
Wide ResNet-101-2 model. |
|
Get decoder model based on the name of the backbone. |
- class anomalib.models.reverse_distillation.components.de_resnet.DecoderBasicBlock(inplanes: int, planes: int, stride: int = 1, upsample: Optional[torch.nn.Module] = None, groups: int = 1, base_width: int = 64, dilation: int = 1, norm_layer: Optional[Callable[Ellipsis, torch.nn.Module]] = None)[source]¶
Bases:
torch.nn.ModuleBasic block for decoder ResNet architecture.
- Parameters
inplanes (int) – Number of input channels.
planes (int) – Number of output channels.
stride (int, optional) – Stride for convolution and de-convolution layers. Defaults to 1.
upsample (Optional[nn.Module], optional) – Module used for upsampling output. Defaults to None.
groups (int, optional) – Number of blocked connections from input channels to output channels. Defaults to 1.
base_width (int, optional) – Number of layers in each intermediate convolution layer. Defaults to 64.
dilation (int, optional) – Spacing between kernel elements. Defaults to 1.
norm_layer (Optional[Callable[..., nn.Module]], optional) – Batch norm layer to use.Defaults to None.
- Raises
ValueError – If groups are not equal to 1 and base width is not 64.
NotImplementedError – If dilation is greater than 1.
- class anomalib.models.reverse_distillation.components.de_resnet.DecoderBottleneck(inplanes: int, planes: int, stride: int = 1, upsample: Optional[torch.nn.Module] = None, groups: int = 1, base_width: int = 64, dilation: int = 1, norm_layer: Optional[Callable[Ellipsis, torch.nn.Module]] = None)[source]¶
Bases:
torch.nn.ModuleBottleneck for Decoder.
- Parameters
inplanes (int) – Number of input channels.
planes (int) – Number of output channels.
stride (int, optional) – Stride for convolution and de-convolution layers. Defaults to 1.
upsample (Optional[nn.Module], optional) – Module used for upsampling output. Defaults to None.
groups (int, optional) – Number of blocked connections from input channels to output channels. Defaults to 1.
base_width (int, optional) – Number of layers in each intermediate convolution layer. Defaults to 64.
dilation (int, optional) – Spacing between kernel elements. Defaults to 1.
norm_layer (Optional[Callable[..., nn.Module]], optional) – Batch norm layer to use.Defaults to None.
- class anomalib.models.reverse_distillation.components.de_resnet.ResNet(block: Type[Union[DecoderBasicBlock, DecoderBottleneck]], layers: List[int], zero_init_residual: bool = False, groups: int = 1, width_per_group: int = 64, norm_layer: Optional[Callable[Ellipsis, torch.nn.Module]] = None)[source]¶
Bases:
torch.nn.ModuleResNet model for decoder.
- Parameters
block (Type[Union[DecoderBasicBlock, DecoderBottleneck]]) – Type of block to use in a layer.
layers (List[int]) – List to specify number for blocks per layer.
zero_init_residual (bool, optional) – If true, initializes the last batch norm in each layer to zero. Defaults to False.
groups (int, optional) – Number of blocked connections per layer from input channels to output channels. Defaults to 1.
width_per_group (int, optional) – Number of layers in each intermediate convolution layer.. Defaults to 64.
norm_layer (Optional[Callable[..., nn.Module]], optional) – Batch norm layer to use. Defaults to None.
- _make_layer(self, block: Type[Union[DecoderBasicBlock, DecoderBottleneck]], planes: int, blocks: int, stride: int = 1) torch.nn.Sequential[source]¶
- anomalib.models.reverse_distillation.components.de_resnet._resnet(block: Type[Union[DecoderBasicBlock, DecoderBottleneck]], layers: List[int], **kwargs: Any) ResNet[source]¶
- anomalib.models.reverse_distillation.components.de_resnet.de_resnet18() ResNet[source]¶
ResNet-18 model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnet34() ResNet[source]¶
ResNet-34 model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnet50() ResNet[source]¶
ResNet-50 model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnet101() ResNet[source]¶
ResNet-101 model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnet152() ResNet[source]¶
ResNet-152 model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnext50_32x4d() ResNet[source]¶
ResNeXt-50 32x4d model.
- anomalib.models.reverse_distillation.components.de_resnet.de_resnext101_32x8d() ResNet[source]¶
ResNeXt-101 32x8d model.
- anomalib.models.reverse_distillation.components.de_resnet.de_wide_resnet50_2() ResNet[source]¶
Wide ResNet-50-2 model.