AnomalyVFM#
Vision Foundation Model (VFM) based zero-shot anomaly detection model.
Example
>>> from anomalib.models.image import AnomalyVFM
>>> # Zero-shot approach
>>> model = AnomalyVFM()
- class anomalib.models.image.anomalyvfm.lightning_model.AnomalyVFM(pre_processor=True, post_processor=True, evaluator=True, visualizer=True, precision=PrecisionType.FLOAT32)#
Bases:
AnomalibModuleVision Foundation Model (VFM) based zero-shot anomaly detection model.
Example
>>> from anomalib.models.image import AnomalyVFM >>> # Zero-shot approach >>> model = AnomalyVFM()
- classmethod configure_post_processor()#
Configure the default post processor.
- Returns:
- Post-processor for one-class models that
converts raw scores to anomaly predictions
- Return type:
- classmethod configure_pre_processor(image_size=None)#
Configure the default pre-processor for AnomalyVFM.
Pre-processor resizes images.
- static configure_transforms(image_size=None)#
Configure image transforms.
- property learning_type: LearningType#
Get the learning type of the model. This model always uses zero-shot learning.
- Returns:
ZERO_SHOT.
- Return type:
LearningType
- predict_step(batch, *args, **kwargs)#
Redirect to validation step.
- Return type:
- test_step(batch, *args, **kwargs)#
Redirect to validation step.
- Return type:
- validation_step(batch, *args, **kwargs)#
Perform the validation step and return the anomaly map and anomaly score.
PyTorch model for the AnomalyVFM model implementation.
See also
anomalib.models.image.anomalyvfm.lightning_model.AnomalyVFM:AnomalyVFM Lightning model.
- class anomalib.models.image.anomalyvfm.torch_model.AnomalyVFMModel#
Bases:
ModuleAnomalyVFM PyTorch model.
This model integrates a base Vision Foundation Model (RADIO) configured with Parameter-Efficient Fine-Tuning (PEFT), alongside a simple decoder for generating pixel-level anomaly masks and a simple predictor for image-level anomaly scores.
- forward(img)#
Forward pass to compute anomaly scores and masks.