:py:mod:`anomalib.models.draem.utils.augmenter` =============================================== .. py:module:: anomalib.models.draem.utils.augmenter .. autoapi-nested-parse:: Augmenter module to generates out-of-distribution samples for the DRAEM implementation. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: anomalib.models.draem.utils.augmenter.Augmenter .. py:class:: Augmenter(anomaly_source_path: Optional[str] = None) Class that generates noisy augmentations of input images. :param anomaly_source_path: Path to a folder of images that will be used as source of the anomalous :type anomaly_source_path: Optional[str] :param noise. If not specified: :param random noise will be used instead.: .. py:method:: rand_augmenter(self) -> imgaug.augmenters.Sequential Selects 3 random transforms that will be applied to the anomaly source images. :returns: A selection of 3 transforms. .. py:method:: generate_perturbation(self, height: int, width: int, anomaly_source_path: Optional[str]) -> Tuple[numpy.ndarray, numpy.ndarray] Generate an image containing a random anomalous perturbation using a source image. :param height: height of the generated image. :type height: int :param width: (int): width of the generated image. :param anomaly_source_path: Path to an image file. If not provided, random noise will be used :type anomaly_source_path: Optional[str] :param instead.: :returns: Image containing a random anomalous perturbation, and the corresponding ground truth anomaly mask. .. py:method:: augment_batch(self, batch: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor] Generate anomalous augmentations for a batch of input images. :param batch: Batch of input images :type batch: Tensor :returns: - Augmented image to which anomalous perturbations have been added. - Ground truth masks corresponding to the anomalous perturbations.