anomalib.models.draem¶
DRAEM model.
Subpackages¶
Submodules¶
Package Contents¶
Classes¶
DRÆM: A discriminatively trained reconstruction embedding for surface anomaly detection. |
|
DRÆM: A discriminatively trained reconstruction embedding for surface anomaly detection. |
- class anomalib.models.draem.Draem(anomaly_source_path: Optional[str] = None)[source]¶
Bases:
anomalib.models.components.AnomalyModuleDRÆM: A discriminatively trained reconstruction embedding for surface anomaly detection.
- Parameters
anomaly_source_path (Optional[str]) – Path to folder that contains the anomaly source images. Random noise will be used if left empty.
- training_step(batch, _)¶
Training Step of DRAEM.
Feeds the original image and the simulated anomaly image through the network and computes the training loss.
- Parameters
batch (Dict[str, Any]) – Batch containing image filename, image, label and mask
- Returns
Loss dictionary
- validation_step(batch, _)¶
Validation step of DRAEM. The Softmax predictions of the anomalous class are used as anomaly map.
- Parameters
batch – Batch of input images
- Returns
Dictionary to which predicted anomaly maps have been added.
- class anomalib.models.draem.DraemLightning(hparams: Union[omegaconf.DictConfig, omegaconf.ListConfig])[source]¶
Bases:
DraemDRÆM: A discriminatively trained reconstruction embedding for surface anomaly detection.
- Parameters
hparams (Union[DictConfig, ListConfig]) – Model parameters
- configure_callbacks()¶
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.
- configure_optimizers()¶
Configure the Adam optimizer.