anomalib
An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
Python library for detecting visual defects and anomalies in images without needing labeled defect examples. Bundles many published algorithms, trains on normal images, and flags anything that looks wrong, ideal for manufacturing quality inspection and similar tasks.
Anomalib is a Python library for detecting things that look wrong or out of place in images and video. The core problem it solves is called anomaly detection: given a set of images of how something normally looks (say, a product on a manufacturing line), the library can train a model to flag images where something appears different or defective. This is done without needing labeled examples of every possible defect, which makes it useful when defects are rare or unpredictable.
The library collects a large number of published anomaly detection algorithms in one place so that researchers and engineers can compare them against each other on standard datasets. It also provides the infrastructure to run training, make predictions on new images, and tune model settings automatically. The code is built on top of PyTorch and the Lightning training framework, which handle the underlying machine learning machinery.
Once a model is trained, Anomalib can export it to a format compatible with Intel's OpenVINO toolkit, which speeds up inference on Intel CPUs and GPUs. There are also tools for deploying models directly from the command line or via a Python API, without writing much extra code.
Installing the library is straightforward with pip or the uv package manager. Different installation options exist depending on your hardware: NVIDIA GPUs with CUDA, AMD GPUs with ROCm, Intel GPUs with XPU, or a plain CPU-only setup. Optional extras add support for experiment tracking, Jupyter notebooks, and vision-language model features.
The project is maintained by the Open Edge Platform team and is actively updated with new algorithms. It is aimed at machine learning practitioners working on visual quality inspection, manufacturing, and similar tasks where spotting visual defects matters.
Where it fits
- Spot defective products on a manufacturing line by training only on images of good products
- Flag unusual frames in video streams without manually labeling every possible fault type
- Compare multiple anomaly detection algorithms on the same dataset to find the best fit
- Export a trained defect-detection model for fast inference on Intel hardware