Overview of Anomalib Core Components
mainAnomalib's architecture is composed of several modular components that interact through a central Engine:
- API/CLI: Interfaces for data ingestion, configuration, and result export. The CLI and API provide identical functionality.
- Datamodules: Handle data loading, preprocessing, and splitting (sub-classed for image, video, and depth data).
- Models: Implement anomaly detection algorithms (sub-classed from
AnomalibModule). - Callbacks: Extend the training loop (e.g., logging, early stopping) using
LightningCallbacksor custom anomaly detection callbacks. - Metrics: Evaluate performance using
Torchmetricsor custom anomaly metrics likePRO,sPRO, andPIMO. - Visualizers: Tools for interpreting results, specifically
ImageVisualizerandMetricsVisualizer. - Engine: The orchestrator that manages the workflow (train, validate, test, export, predict) and utilizes PyTorch Lightning's
Trainer.