{"id":13457933,"url":"https://github.com/openvinotoolkit/anomalib","last_synced_at":"2025-03-25T19:11:26.021Z","repository":{"id":37097719,"uuid":"423775360","full_name":"openvinotoolkit/anomalib","owner":"openvinotoolkit","description":"An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.","archived":false,"fork":false,"pushed_at":"2025-03-25T17:53:24.000Z","size":63740,"stargazers_count":4155,"open_issues_count":174,"forks_count":721,"subscribers_count":44,"default_branch":"main","last_synced_at":"2025-03-25T18:41:03.350Z","etag":null,"topics":["anomaly-detection","anomaly-localization","anomaly-segmentation","neural-network-compression","openvino","unsupervised-learning"],"latest_commit_sha":null,"homepage":"https://anomalib.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openvinotoolkit.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-02T09:11:38.000Z","updated_at":"2025-03-25T17:53:29.000Z","dependencies_parsed_at":"2023-09-25T19:33:44.489Z","dependency_job_id":"b9916f0a-8ca9-47b7-8f95-023fada08445","html_url":"https://github.com/openvinotoolkit/anomalib","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvinotoolkit%2Fanomalib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvinotoolkit%2Fanomalib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvinotoolkit%2Fanomalib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openvinotoolkit%2Fanomalib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openvinotoolkit","download_url":"https://codeload.github.com/openvinotoolkit/anomalib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245526183,"owners_count":20629834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anomaly-detection","anomaly-localization","anomaly-segmentation","neural-network-compression","openvino","unsupervised-learning"],"created_at":"2024-07-31T09:00:40.012Z","updated_at":"2025-03-25T19:11:26.014Z","avatar_url":"https://github.com/openvinotoolkit.png","language":"Python","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/openvinotoolkit/anomalib/main/docs/source/_static/images/logos/anomalib-wide-blue.png\" width=\"600px\" alt=\"Anomalib Logo - A deep learning library for anomaly detection\"\u003e\n\n**A library for benchmarking, developing and deploying deep learning anomaly detection algorithms**\n\n---\n\n[Key Features](#key-features) •\n[Docs](https://anomalib.readthedocs.io/en/latest/) •\n[Notebooks](examples/notebooks) •\n[License](LICENSE)\n\n[![python](https://img.shields.io/badge/python-3.10%2B-green)]()\n[![pytorch](https://img.shields.io/badge/pytorch-2.0%2B-orange)]()\n[![lightning](https://img.shields.io/badge/lightning-2.2%2B-blue)]()\n[![openvino](https://img.shields.io/badge/openvino-2024.0%2B-purple)]()\n\n[![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)\n[![codecov](https://codecov.io/gh/openvinotoolkit/anomalib/branch/main/graph/badge.svg?token=Z6A07N1BZK)](https://codecov.io/gh/openvinotoolkit/anomalib)\n[![Downloads](https://static.pepy.tech/personalized-badge/anomalib?period=total\u0026units=international_system\u0026left_color=grey\u0026right_color=green\u0026left_text=PyPI%20Downloads)](https://pepy.tech/project/anomalib)\n\n[![ReadTheDocs](https://readthedocs.org/projects/anomalib/badge/?version=latest)](https://anomalib.readthedocs.io/en/latest/?badge=latest)\n[![Anomalib - Gurubase docs](https://img.shields.io/badge/Gurubase-Ask%20Anomalib%20Guru-006BFF)](https://gurubase.io/g/anomalib)\n\n\u003ca href=\"https://trendshift.io/repositories/6030\" target=\"_blank\"\u003e\u003cimg src=\"https://trendshift.io/api/badge/repositories/6030\" alt=\"openvinotoolkit%2Fanomalib | Trendshift\" style=\"width: 250px; height: 55px;\" width=\"250\" height=\"55\"/\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n---\n\n\u003e 🌟 **Announcing v2.0.0 Release!** 🌟\n\u003e\n\u003e We're excited to announce the 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. Key features include:\n\u003e\n\u003e - Multi-GPU support\n\u003e - New [dataclasses](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/data/dataclasses.html) for model in- and outputs.\n\u003e - Flexible configuration of [model transforms and data augmentations](https://anomalib.readthedocs.io/en/latest/markdown/guides/how_to/data/transforms.html).\n\u003e - 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)\n\u003e - 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.\n\u003e - Configurable module for visualization via `Visualizer` (docs guide: coming soon)\n\u003e\n\u003e We value your input! Please share feedback via [GitHub Issues](https://github.com/openvinotoolkit/anomalib/issues) or our [Discussions](https://github.com/openvinotoolkit/anomalib/discussions)\n\n# 👋 Introduction\n\nAnomalib 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!\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/openvinotoolkit/anomalib/main/docs/source/_static/images/readme.png\" width=\"1000\" alt=\"A prediction made by anomalib\"\u003e\n\u003c/p\u003e\n\n## Key features\n\n- Simple and modular API and CLI for training, inference, benchmarking, and hyperparameter optimization.\n- The largest public collection of ready-to-use deep learning anomaly detection algorithms and benchmark datasets.\n- [**Lightning**](https://www.lightning.ai/) based model implementations to reduce boilerplate code and limit the implementation efforts to the bare essentials.\n- 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.\n- A set of [inference tools](tools) for quick and easy deployment of the standard or custom anomaly detection models.\n\n# 📦 Installation\n\nAnomalib provides multiple installation options to suit your needs. Choose the one that best fits your requirements:\n\n## 🚀 Install from PyPI\n\n```bash\n# Basic installation from PyPI\npip install anomalib\n\n# Full installation with all dependencies\npip install anomalib[full]\n```\n\n## 🔧 Install from Source\n\nFor contributing or customizing the library:\n\n```bash\ngit clone https://github.com/openvinotoolkit/anomalib.git\ncd anomalib\npip install -e .\n\n# Full development installation with all dependencies\npip install -e .[full]\n```\n\n# 🧠 Training\n\nAnomalib supports both API and CLI-based training approaches:\n\n## 🔌 Python API\n\n```python\nfrom anomalib.data import MVTecAD\nfrom anomalib.models import Patchcore\nfrom anomalib.engine import Engine\n\n# Initialize components\ndatamodule = MVTecAD()\nmodel = Patchcore()\nengine = Engine()\n\n# Train the model\nengine.fit(datamodule=datamodule, model=model)\n```\n\n## ⌨️ Command Line\n\n```bash\n# Train with default settings\nanomalib train --model Patchcore --data anomalib.data.MVTecAD\n\n# Train with custom category\nanomalib train --model Patchcore --data anomalib.data.MVTecAD --data.category transistor\n\n# Train with config file\nanomalib train --config path/to/config.yaml\n```\n\n# 🤖 Inference\n\nAnomalib provides multiple inference options including Torch, Lightning, Gradio, and OpenVINO. Here's how to get started:\n\n## 🔌 Python API\n\n```python\n# Load model and make predictions\npredictions = engine.predict(\n    datamodule=datamodule,\n    model=model,\n    ckpt_path=\"path/to/checkpoint.ckpt\",\n)\n```\n\n## ⌨️ Command Line\n\n```bash\n# Basic prediction\nanomalib predict --model anomalib.models.Patchcore \\\n                 --data anomalib.data.MVTecAD \\\n                 --ckpt_path path/to/model.ckpt\n\n# Prediction with results\nanomalib predict --model anomalib.models.Patchcore \\\n                 --data anomalib.data.MVTecAD \\\n                 --ckpt_path path/to/model.ckpt \\\n                 --return_predictions\n```\n\n\u003e 📘 **Note:** For advanced inference options including Gradio and OpenVINO, check our [Inference Documentation](https://anomalib.readthedocs.io).\n\n# Training on Intel GPUs\n\n\u003e [!Note]\n\u003e Currently, only single GPU training is supported on Intel GPUs.\n\u003e These commands were tested on Arc 750 and Arc 770.\n\nEnsure that you have PyTorch with XPU support installed. For more information, please refer to the [PyTorch XPU documentation](https://pytorch.org/docs/stable/notes/get_start_xpu.html)\n\n## 🔌 API\n\n```python\nfrom anomalib.data import MVTecAD\nfrom anomalib.engine import Engine, SingleXPUStrategy, XPUAccelerator\nfrom anomalib.models import Stfpm\n\nengine = Engine(\n    strategy=SingleXPUStrategy(),\n    accelerator=XPUAccelerator(),\n)\nengine.train(Stfpm(), datamodule=MVTecAD())\n```\n\n## ⌨️ CLI\n\n```bash\nanomalib train --model Padim --data MVTecAD --trainer.accelerator xpu --trainer.strategy xpu_single\n```\n\n# ⚙️ Hyperparameter Optimization\n\nAnomalib supports hyperparameter optimization (HPO) using [Weights \u0026 Biases](https://wandb.ai/) and [Comet.ml](https://www.comet.com/).\n\n```bash\n# Run HPO with Weights \u0026 Biases\nanomalib hpo --backend WANDB --sweep_config tools/hpo/configs/wandb.yaml\n```\n\n\u003e 📘 **Note:** For detailed HPO configuration, check our [HPO Documentation](https://openvinotoolkit.github.io/anomalib/tutorials/hyperparameter_optimization.html).\n\n# 🧪 Experiment Management\n\nTrack your experiments with popular logging platforms through [PyTorch Lightning loggers](https://pytorch-lightning.readthedocs.io/en/stable/extensions/logging.html):\n\n- 📊 Weights \u0026 Biases\n- 📈 Comet.ml\n- 📉 TensorBoard\n\nEnable logging in your config file to track:\n\n- Hyperparameters\n- Metrics\n- Model graphs\n- Test predictions\n\n\u003e 📘 **Note:** For logging setup, see our [Logging Documentation](https://openvinotoolkit.github.io/anomalib/tutorials/logging.html).\n\n# 📊 Benchmarking\n\nEvaluate and compare model performance across different datasets:\n\n```bash\n# Run benchmarking with default configuration\nanomalib benchmark --config tools/benchmarking/benchmark_params.yaml\n```\n\n\u003e 💡 **Tip:** Check individual model performance in their respective README files:\n\u003e\n\u003e - [Patchcore Results](src/anomalib/models/image/patchcore/README.md#mvtec-ad-dataset)\n\u003e - [Other Models](src/anomalib/models/)\n\n# ✍️ Reference\n\nIf you find Anomalib useful in your research or work, please cite:\n\n```tex\n@inproceedings{akcay2022anomalib,\n  title={Anomalib: A deep learning library for anomaly detection},\n  author={Akcay, Samet and Ameln, Dick and Vaidya, Ashwin and Lakshmanan, Barath and Ahuja, Nilesh and Genc, Utku},\n  booktitle={2022 IEEE International Conference on Image Processing (ICIP)},\n  pages={1706--1710},\n  year={2022},\n  organization={IEEE}\n}\n```\n\n# 👥 Contributing\n\nWe welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/openvinotoolkit/anomalib/graphs/contributors\"\u003e\n    \u003cimg src=\"https://contrib.rocks/image?repo=openvinotoolkit/anomalib\" alt=\"Contributors to openvinotoolkit/anomalib\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eThank you to all our contributors!\u003c/b\u003e\n\u003c/p\u003e\n","funding_links":[],"categories":["Medical (related)","Python","Deep Learning Framework","异常检测"],"sub_categories":["Anomaly Detection \u0026 Others"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenvinotoolkit%2Fanomalib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenvinotoolkit%2Fanomalib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenvinotoolkit%2Fanomalib/lists"}