Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/openvinotoolkit/anomalib
An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
https://github.com/openvinotoolkit/anomalib
anomaly-detection anomaly-localization anomaly-segmentation neural-network-compression openvino unsupervised-learning
Last synced: 1 day ago
JSON representation
An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
- Host: GitHub
- URL: https://github.com/openvinotoolkit/anomalib
- Owner: openvinotoolkit
- License: apache-2.0
- Created: 2021-11-02T09:11:38.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-13T11:23:31.000Z (9 days ago)
- Last Synced: 2025-01-14T03:05:55.906Z (8 days ago)
- Topics: anomaly-detection, anomaly-localization, anomaly-segmentation, neural-network-compression, openvino, unsupervised-learning
- Language: Python
- Homepage: https://anomalib.readthedocs.io/en/latest/
- Size: 59 MB
- Stars: 3,969
- Watchers: 41
- Forks: 703
- Open Issues: 178
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
- Governance: GOVERNANCE.md
Awesome Lists containing this project
- awesome-industrial-anomaly-detection - [code
- awesome-list - Anomalib - An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference. (Deep Learning Framework / Anomaly Detection & Others)
- StarryDivineSky - openvinotoolkit/anomalib
README
**A library for benchmarking, developing and deploying deep learning anomaly detection algorithms**
---
[Key Features](#key-features) โข
[Docs](https://anomalib.readthedocs.io/en/latest/) โข
[Notebooks](examples/notebooks) โข
[License](LICENSE)[![python](https://img.shields.io/badge/python-3.10%2B-green)]()
[![pytorch](https://img.shields.io/badge/pytorch-2.0%2B-orange)]()
[![lightning](https://img.shields.io/badge/lightning-2.2%2B-blue)]()
[![openvino](https://img.shields.io/badge/openvino-2024.0%2B-purple)]()[![Pre-Merge Checks](https://github.com/openvinotoolkit/anomalib/actions/workflows/pre_merge.yml/badge.svg)](https://github.com/openvinotoolkit/anomalib/actions/workflows/pre_merge.yml)
[![codecov](https://codecov.io/gh/openvinotoolkit/anomalib/branch/main/graph/badge.svg?token=Z6A07N1BZK)](https://codecov.io/gh/openvinotoolkit/anomalib)
[![Downloads](https://static.pepy.tech/personalized-badge/anomalib?period=total&units=international_system&left_color=grey&right_color=green&left_text=PyPI%20Downloads)](https://pepy.tech/project/anomalib)[![ReadTheDocs](https://readthedocs.org/projects/anomalib/badge/?version=latest)](https://anomalib.readthedocs.io/en/latest/?badge=latest)
[![Anomalib - Gurubase docs](https://img.shields.io/badge/Gurubase-Ask%20Anomalib%20Guru-006BFF)](https://gurubase.io/g/anomalib)---
> ๐ **Announcing v2.0.0 Beta Release!** ๐
>
> We're excited to announce the beta release of Anomalib v2.0.0! This version introduces significant improvements and customization options to enhance your anomaly detection workflows. Please be aware that there are several API changes between `v1.2.0` and `v2.0.0`, so please be careful when updating your existing pipelines. We invite you to try it out and share your feedback:
>
> - Multi-GPU support
> - New [dataclasses](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/data/dataclasses.html) for model in- and outputs.
> - Flexible configuration of [model transforms and data augmentations](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/data/transforms.html).
> - Configurable modules for pre- and post-processing operations via [`Preprocessor`](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/models/pre_processor.html) and [`Postprocessor`](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/models/post_processor.html)
> - Customizable model evaluation workflow with new [Metrics API](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/evaluation/metrics.html) and [`Evaluator`](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/evaluation/evaluator.html) module.
> - Configurable module for visualization via `Visualizer` (docs guide: coming soon)
>
> We value your input! Please test and share feedback via [GitHub Issues](https://github.com/openvinotoolkit/anomalib/issues) or our [Discussions](https://github.com/openvinotoolkit/anomalib/discussions)
>
> Install beta: `pip install anomalib==2.0.0b2`# ๐ 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**](https://www.lightning.ai/) 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**](https://www.intel.com/content/www/us/en/developer/tools/openvino-toolkit/overview.html) Intermediate Representation (IR) for accelerated inference on Intel hardware.
- A set of [inference tools](tools) for quick and easy deployment of the standard or custom anomaly detection models.# ๐ฆ Installation
Anomalib provides multiple installation options to suit your needs. Choose the one that best fits your requirements:
## ๐ Quick Install (Stable)
```bash
# Basic installation
pip install anomalib# Full installation with all dependencies
pip install anomalib[full]
```## ๐ Beta Version (v2.0.0b2)
Try our latest beta release with new features and improvements:
```bash
# Basic beta installation
pip install anomalib==2.0.0b2# Full beta installation with all dependencies
pip install anomalib[full]==2.0.0b2
```### ๐ ๏ธ Installation Options
Use the CLI for customized installation:
```bash
# Get help for installation options
anomalib install -h# Full package installation
anomalib install# Core package only (for training and evaluation)
anomalib install --option core# OpenVINO optimization support
anomalib install --option openvino
```### ๐ง Development Install
For contributing or customizing the library:
```bash
git clone https://github.com/openvinotoolkit/anomalib.git
cd anomalib
pip install -e .# Full development installation with all dependencies
pip install -e .[full]
```# ๐ง Training
Anomalib supports both API and CLI-based training approaches:
## ๐ Python API
```python
from anomalib.data import MVTec
from anomalib.models import Patchcore
from anomalib.engine import Engine# Initialize components
datamodule = MVTec()
model = Patchcore()
engine = Engine()# Train the model
engine.fit(datamodule=datamodule, model=model)
```## โจ๏ธ Command Line
```bash
# Train with default settings
anomalib train --model Patchcore --data anomalib.data.MVTec# Train with custom category
anomalib train --model Patchcore --data anomalib.data.MVTec --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
```python
# Load model and make predictions
predictions = engine.predict(
datamodule=datamodule,
model=model,
ckpt_path="path/to/checkpoint.ckpt",
)
```## โจ๏ธ Command Line
```bash
# Basic prediction
anomalib predict --model anomalib.models.Patchcore \
--data anomalib.data.MVTec \
--ckpt_path path/to/model.ckpt# Prediction with results
anomalib predict --model anomalib.models.Patchcore \
--data anomalib.data.MVTec \
--ckpt_path path/to/model.ckpt \
--return_predictions
```> ๐ **Note:** For advanced inference options including Gradio and OpenVINO, check our [Inference Documentation](https://anomalib.readthedocs.io).
# โ๏ธ Hyperparameter Optimization
Anomalib supports hyperparameter optimization (HPO) using [Weights & Biases](https://wandb.ai/) and [Comet.ml](https://www.comet.com/).
```bash
# 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](https://openvinotoolkit.github.io/anomalib/tutorials/hyperparameter_optimization.html).
# ๐งช Experiment Management
Track your experiments with popular logging platforms through [PyTorch Lightning loggers](https://pytorch-lightning.readthedocs.io/en/stable/extensions/logging.html):
- ๐ Weights & Biases
- ๐ Comet.ml
- ๐ TensorBoardEnable logging in your config file to track:
- Hyperparameters
- Metrics
- Model graphs
- Test predictions> ๐ **Note:** For logging setup, see our [Logging Documentation](https://openvinotoolkit.github.io/anomalib/tutorials/logging.html).
# ๐ Benchmarking
Evaluate and compare model performance across different datasets:
```bash
# Run benchmarking with default configuration
anomalib benchmark --config tools/benchmarking/benchmark_params.yaml
```> ๐ก **Tip:** Check individual model performance in their respective README files:
>
> - [Patchcore Results](src/anomalib/models/image/patchcore/README.md#mvtec-ad-dataset)
> - [Other Models](src/anomalib/models/)# โ๏ธ Reference
If you find Anomalib useful in your research or work, please cite:
```tex
@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](CONTRIBUTING.md) to get started.
Thank you to all our contributors!