:py:mod:`anomalib.models.fastflow.lightning_model` ================================================== .. py:module:: anomalib.models.fastflow.lightning_model .. autoapi-nested-parse:: FastFlow Lightning Model Implementation. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: anomalib.models.fastflow.lightning_model.Fastflow anomalib.models.fastflow.lightning_model.FastflowLightning .. py:class:: Fastflow(input_size: Tuple[int, int], backbone: str, flow_steps: int, conv3x3_only: bool = False, hidden_ratio: float = 1.0) Bases: :py:obj:`anomalib.models.components.AnomalyModule` PL Lightning Module for the FastFlow algorithm. :param input_size: Model input size. :type input_size: Tuple[int, int] :param backbone: Backbone CNN network :type backbone: str :param flow_steps: Flow steps. :type flow_steps: int :param conv3x3_only: Use only conv3x3 in fast_flow model. Defaults to False. :type conv3x3_only: bool, optinoal :param hidden_ratio: Ratio to calculate hidden var channels. Defaults to 1.0. :type hidden_ratio: float, optional .. py:method:: training_step(self, batch, _) Forward-pass input and return the loss. :param batch: Input batch :type batch: Tensor :param _batch_idx: Index of the batch. :returns: Dictionary containing the loss value. :rtype: STEP_OUTPUT .. py:method:: validation_step(self, batch, _) Forward-pass the input and return the anomaly map. :param batch: Input batch :type batch: Tensor :param _batch_idx: Index of the batch. :returns: batch dictionary containing anomaly-maps. :rtype: dict .. py:class:: FastflowLightning(hparams: Union[omegaconf.DictConfig, omegaconf.ListConfig]) Bases: :py:obj:`Fastflow` PL Lightning Module for the FastFlow algorithm. :param hparams: Model params :type hparams: Union[DictConfig, ListConfig] .. py:method:: configure_callbacks(self) Configure model-specific callbacks. .. note:: This method is used for the existing CLI. When PL CLI is introduced, configure callback method will be deprecated, and callbacks will be configured from either config.yaml file or from CLI. .. py:method:: configure_optimizers(self) -> torch.optim.Optimizer Configures optimizers for each decoder. .. note:: This method is used for the existing CLI. When PL CLI is introduced, configure optimizers method will be deprecated, and optimizers will be configured from either config.yaml file or from CLI. :returns: Adam optimizer for each decoder :rtype: Optimizer