open-edge-platform/anomalib

A library for benchmarking, developing and deploying deep learning anomaly detection algorithms
Key Features • Docs • Notebooks • License
🌟 Announcing v2.1.0 Release! 🌟
We’re excited to announce the release of Anomalib v2.1.0! This version brings several state-of-the-art models and anomaly detection datasets. Key features include:
New models :
- 🖼️ UniNet (CVPR 2025): A contrastive learning-guided unified framework with feature selection for anomaly detection.
- 🖼️ Dinomaly (CVPR 2025): A ’less is more philosophy’ encoder-decoder architecture model leveraging pre-trained foundational models.
- 🎥 Fuvas (ICASSP 2025): Few-shot unsupervised video anomaly segmentation via low-rank factorization of spatio-temporal features.
New datasets:
- MVTec AD 2 : A new version of the MVTec AD dataset with 8 categories of industrial anomaly detection.
- MVTec LOCO AD : MVTec logical constraints anomaly detection dataset that includes both structural and logical anomalies.
- Real-IAD : A real-world multi-view dataset for benchmarking versatile industrial anomaly detection.
- VAD dataset : Valeo Anomaly Dataset (VAD) showcasing a diverse range of defects, from highly obvious to extremely subtle.
We value your input! Please share feedback via GitHub Issues or our Discussions
👋 Introduction
Anomalib is a deep learning library that aims to collect state-of-the-art anomaly detection algorithms for benchmarking on both public and private datasets. Anomalib provides several ready-to-use implementations of anomaly detection algorithms described in the recent literature, as well as a set of tools that facilitate the development and implementation of custom models. The library has a strong focus on visual anomaly detection, where the goal of the algorithm is to detect and/or localize anomalies within images or videos in a dataset. Anomalib is constantly updated with new algorithms and training/inference extensions, so keep checking!
Key features
- Simple and modular API and CLI for training, inference, benchmarking, and hyperparameter optimization.
- The largest public collection of ready-to-use deep learning anomaly detection algorithms and benchmark datasets.
- Lightning based model implementations to reduce boilerplate code and limit the implementation efforts to the bare essentials.
- The majority of models can be exported to OpenVINO Intermediate Representation (IR) for accelerated inference on Intel hardware.
- A set of inference tools for quick and easy deployment of the standard or custom anomaly detection models.
📦 Installation
Anomalib can be installed from PyPI. We recommend using a virtual environment and a modern package installer like uv
or pip
.
🚀 Quick Install
For a standard installation, you can use uv
or pip
. This will install the latest version of Anomalib with its core dependencies. PyTorch will be installed based on its default behavior, which usually works for CPU and standard CUDA setups.
|
|
For more control over the installation, such as specifying the PyTorch backend (e.g., XPU, CUDA and ROCm) or installing extra dependencies for specific models, see the advanced options below.
💡 Advanced Installation: Specify Hardware Backend
To ensure compatibility with your hardware, you can specify a backend during installation. This is the recommended approach for production environments and for hardware other than CPU or standard CUDA.
Using uv
:
|
|
Using pip
:
The same extras can be used with pip
:
|
|
🧩 Advanced Installation: Additional Dependencies
Anomalib includes most dependencies by default. For specialized features, you may need additional optional dependencies. Remember to include your hardware-specific extra.
|
|
Here is a list of available optional dependency groups:
Extra | Description | Purpose |
---|---|---|
[openvino] |
Intel OpenVINO optimization | For accelerated inference on Intel hardware |
[clip] |
Vision-language models | winclip |
[vlm] |
Vision-language model backends | Advanced VLM features |
[loggers] |
Experiment tracking (wandb, comet, etc.) | For experiment management |
[notebooks] |
Jupyter notebook support | For running example notebooks |
[full] |
All optional dependencies | All optional features |
🔧 Advanced Installation: Install from Source
For contributing to anomalib
or using a development version, you can install from source.
Using uv
:
This is the recommended method for developers as it uses the project’s lock file for reproducible environments.
|
|
Using pip
:
|
|
🧠 Training
Anomalib supports both API and CLI-based training approaches:
🔌 Python API
|
|
⌨️ Command Line
|
|
🤖 Inference
Anomalib provides multiple inference options including Torch, Lightning, Gradio, and OpenVINO. Here’s how to get started:
🔌 Python API
|
|
⌨️ Command Line
|
|
📘 Note: For advanced inference options including Gradio and OpenVINO, check our Inference Documentation.
Training on Intel GPUs
[!Note] Currently, only single GPU training is supported on Intel GPUs. These commands were tested on Arc 750 and Arc 770.
Ensure that you have PyTorch with XPU support installed. For more information, please refer to the PyTorch XPU documentation
🔌 API
|
|
⌨️ CLI
|
|
⚙️ Hyperparameter Optimization
Anomalib supports hyperparameter optimization (HPO) using Weights & Biases and Comet.ml.
|
|
📘 Note: For detailed HPO configuration, check our HPO Documentation.
🧪 Experiment Management
Track your experiments with popular logging platforms through PyTorch Lightning loggers:
- 📊 Weights & Biases
- 📈 Comet.ml
- 📉 TensorBoard
Enable logging in your config file to track:
- Hyperparameters
- Metrics
- Model graphs
- Test predictions
📘 Note: For logging setup, see our Logging Documentation.
📊 Benchmarking
Evaluate and compare model performance across different datasets:
|
|
💡 Tip: Check individual model performance in their respective README files:
✍️ Reference
If you find Anomalib useful in your research or work, please cite:
|
|
👥 Contributing
We welcome contributions! Check out our Contributing Guide to get started.
Thank you to all our contributors!