anomalib.models.patchcore.lightning_model¶
Towards Total Recall in Industrial Anomaly Detection.
Paper https://arxiv.org/abs/2106.08265.
Module Contents¶
Classes¶
PatchcoreLightning Module to train PatchCore algorithm. |
|
PatchcoreLightning Module to train PatchCore algorithm. |
Attributes¶
- class anomalib.models.patchcore.lightning_model.Patchcore(input_size: Tuple[int, int], backbone: str, layers: List[str], pre_trained: bool = True, coreset_sampling_ratio: float = 0.1, num_neighbors: int = 9)[source]¶
Bases:
anomalib.models.components.AnomalyModulePatchcoreLightning Module to train PatchCore algorithm.
- Parameters
input_size (Tuple[int, int]) – Size of the model input.
backbone (str) – Backbone CNN network
layers (List[str]) – Layers to extract features from the backbone CNN
pre_trained (bool, optional) – Boolean to check whether to use a pre_trained backbone.
coreset_sampling_ratio (float, optional) – Coreset sampling ratio to subsample embedding. Defaults to 0.1.
num_neighbors (int, optional) – Number of nearest neighbors. Defaults to 9.
- configure_optimizers() None[source]¶
Configure optimizers.
- Returns
Do not set optimizers by returning None.
- Return type
None
- training_step(batch, _batch_idx)[source]¶
Generate feature embedding of the batch.
- Parameters
batch (Dict[str, Any]) – Batch containing image filename, image, label and mask
_batch_idx (int) – Batch Index
- Returns
Embedding Vector
- Return type
Dict[str, np.ndarray]