:py:mod:`anomalib.models.reverse_distillation.torch_model` ========================================================== .. py:module:: anomalib.models.reverse_distillation.torch_model .. autoapi-nested-parse:: PyTorch model for Reverse Distillation. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: anomalib.models.reverse_distillation.torch_model.ReverseDistillationModel .. py:class:: ReverseDistillationModel(backbone: str, input_size: Tuple[int, int], layers: List[str], anomaly_map_mode: str) Bases: :py:obj:`torch.nn.Module` Reverse Distillation Model. :param backbone: Name of the backbone used for encoder and decoder :type backbone: str :param input_size: Size of input image :type input_size: Tuple[int, int] :param layers: Name of layers from which the features are extracted. :type layers: List[str] :param anomaly_map_mode: Mode used to generate anomaly map. Options are between ``multiply`` and ``add``. :type anomaly_map_mode: str .. py:method:: forward(self, images: torch.Tensor) -> Union[torch.Tensor, Tuple[List[torch.Tensor], List[torch.Tensor]]] Forward-pass images to the network. During the training mode the model extracts features from encoder and decoder networks. During evaluation mode, it returns the predicted anomaly map. :param images: Batch of images :type images: Tensor :returns: Encoder and decoder features in training mode, else anomaly maps. :rtype: Union[Tensor, Tuple[List[Tensor],List[Tensor]]]