Skip to main content
Anomalib Logo - A deep learning library for anomaly detection

A library for benchmarking, developing and deploying deep learning anomaly detection algorithms


Key FeaturesDocsNotebooksLicense

python pytorch lightning openvino

Pre-Merge Checks codecov Downloads snyk OpenSSF Best Practices

ReadTheDocs Anomalib - Gurubase docs

open-edge-platform%2Fanomalib | Trendshift


🌟 Announcing v2.6.2 Release! 🌟

This patch release hardens Tabular.from_file() by restricting it to safe, data-only file formats.

Key Changes

  • Security / API change: Tabular.from_file() now only accepts csv, json, and parquet. Formats such as pickle and hdf are rejected because loading them can execute arbitrary code. Load those files yourself and pass a DataFrame to Tabular(...).

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!

A prediction made by anomalib

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.

# With uv
uv pip install anomalib

# Or with pip
pip install anomalib

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:

# CPU support (default, works on all platforms)
uv pip install "anomalib[cpu]"

# CUDA 12.6 support (Linux/Windows with NVIDIA GPU)
uv pip install "anomalib[cu126]"

# CUDA 13.0 support (Linux/Windows with NVIDIA GPU)
uv pip install "anomalib[cu130]"

# ROCm support (Linux with AMD GPU)
uv pip install "anomalib[rocm]"

# Intel XPU support (Linux with Intel GPU)
uv pip install "anomalib[xpu]"

Using pip: The same extras can be used with pip:

pip install "anomalib[cu130]"
🧩 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.

# Example: Install with OpenVINO support and CUDA 13.0
uv pip install "anomalib[openvino,cu130]"

# Example: Install all optional dependencies for a CPU-only setup
uv pip install "anomalib[full,cpu]"

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.

git clone https://github.com/open-edge-platform/anomalib.git
cd anomalib

# Create the virtual environment
uv venv

# Sync with the lockfile for a specific backend (e.g., CPU)
uv sync --extra cpu

# Or for a different backend like CUDA 13.0
uv sync --extra cu130

# To set up a full development environment
uv sync --extra dev --extra cpu

Using pip:

git clone https://github.com/open-edge-platform/anomalib.git
cd anomalib

# Install in editable mode with a specific backend
pip install -e ".[cpu]"

# Install with development dependencies
pip install -e ".[dev,cpu]"

🧠 Training

Anomalib supports both API and CLI-based training approaches:

🔌 Python API

from anomalib.data import MVTecAD
from anomalib.models import Patchcore
from anomalib.engine import Engine

# Initialize components
datamodule = MVTecAD()
model = Patchcore()
engine = Engine()

# Train the model
engine.fit(datamodule=datamodule, model=model)

⌨️ Command Line

# Train with default settings
anomalib train --model Patchcore --data anomalib.data.MVTecAD

# Train with custom category
anomalib train --model Patchcore --data anomalib.data.MVTecAD --data.category transistor

# Train with config file
anomalib train --config path/to/config.yaml

🤖 Inference

Anomalib provides multiple inference options including Torch, Lightning, Gradio, and OpenVINO. Here's how to get started:

🔌 Python API

# Load model and make predictions
predictions = engine.predict(
    datamodule=datamodule,
    model=model,
    ckpt_path="path/to/checkpoint.ckpt",
)

⌨️ Command Line

# Basic prediction
anomalib predict --model anomalib.models.Patchcore \
                 --data anomalib.data.MVTecAD \
                 --ckpt_path path/to/model.ckpt

# Prediction with results
anomalib predict --model anomalib.models.Patchcore \
                 --data anomalib.data.MVTecAD \
                 --ckpt_path path/to/model.ckpt \
                 --return_predictions

📘 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

from anomalib.data import MVTecAD
from anomalib.engine import Engine, SingleXPUStrategy, XPUAccelerator
from anomalib.models import Stfpm

engine = Engine(
    strategy=SingleXPUStrategy(),
    accelerator=XPUAccelerator(),
)
engine.train(Stfpm(), datamodule=MVTecAD())

⌨️ CLI

anomalib train --model Padim --data MVTecAD --trainer.accelerator xpu --trainer.strategy xpu_single

⚙️ Hyperparameter Optimization

Anomalib supports hyperparameter optimization (HPO) using Weights & Biases and Comet.ml.

# Run HPO with Weights & Biases
anomalib hpo --backend WANDB --sweep_config tools/hpo/configs/wandb.yaml

📘 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:

# Run benchmarking with default configuration
anomalib benchmark --config tools/experimental/benchmarking/sample.yaml

💡 Tip: Check individual model performance in their respective README files:

Anomalib Studio

[!IMPORTANT] Anomalib Studio is currently under active development and should be considered a pre-release. Features may change, and some functionality may be incomplete or unstable. We welcome feedback and contributions as we work towards a stable release.

Anomalib Studio is a low/no-code web application that allows users to train and deploy anomaly detection models. It enables users to leverage Anomalib's features in their operational environment. Users can connect USB and IP cameras, or use a folder of images, as input to the training pipeline. The tool allows direct output to their industrial pipelines through ROS messages, MQTT, etc.

Anomalib Studio

The source code for Anomalib Studio lives in the application folder.

Anomalib Studio is available as two distributions:

  1. As a docker container
  2. As a standalone application

For more information on each, refer to the respective README files.

Get started with development build

Setup Backend Dependencies

[!NOTE] This assumes that you have uv installed. If not, please refer to the installation guide.

cd application/backend
uv sync --extra xpu # or uv sync --extra cu130 for CUDA 13.0, uv sync --extra cpu for CPU

Setup Frontend Dependencies

cd application/ui
npm install

Run the application

[!IMPORTANT] Both backend and frontend dependencies should be installed before running the application.

Run the backend server:

cd application/backend
./run.sh

Run the frontend server:

cd application/ui
npm run start

Navigate to http://localhost:3000 to see the application.

✍️ Reference

If you find Anomalib useful in your research or work, please cite:

@inproceedings{akcay2022anomalib,
  title={Anomalib: A deep learning library for anomaly detection},
  author={Akcay, Samet and Ameln, Dick and Vaidya, Ashwin and Lakshmanan, Barath and Ahuja, Nilesh and Genc, Utku},
  booktitle={2022 IEEE International Conference on Image Processing (ICIP)},
  pages={1706--1710},
  year={2022},
  organization={IEEE}
}

👥 Contributing

We welcome contributions! Check out our Contributing Guide to get started.

Contributors to open-edge-platform/anomalib

Thank you to all our contributors!

Release files for anomalib 2.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anomalib 2.6.2
File Size Uploaded
anomalib-2.6.2.tar.gz 714.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anomalib 2.6.2
File Interpreter ABI Platform
anomalib-2.6.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / anomalib-2.6.2.tar.gz

Download URL anomalib-2.6.2.tar.gz
Size 714.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f2627998555a0600346bfd83f5dcc90386e11db6d7be243bbf094765c25d0391
BLAKE2b-256 checksum
How to use checksums
5ffa195aca25ae9594c60c0bd755b6e801e53ec0f51bc66b78cefea44f3ed26a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / anomalib-2.6.2-py3-none-any.whl

Download URL anomalib-2.6.2-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
e90f7e0ac40c9cab383eecc5bbfb7d9bfb8c48c822694463d4ce025a7ea15c4f
BLAKE2b-256 checksum
How to use checksums
383106081cabc504156ec609de7194669a205ad132ca36ba229c456753d0148f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.6.2 This release

2 release files

2.6.1

2 release files

2.6.0

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.3

2 release files

2.3.2

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

1 release file

0.2.6

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page