Skip to main content

AnomaVision

AnomaVision banner

Simple visual anomaly detection from normal images.

PyPI version PyPI downloads Python 3.10 to 3.12 PyTorch 2.0 or newer ONNX export ready TensorRT supported OpenVINO supported CI status MIT license KV260 DPU support

AnomaVision is a production-oriented computer vision toolkit for detecting defects and unusual patterns from normal images.

It supports three anomaly detection methods:

  • PaDiM — a simple, fast feature-distribution baseline.
  • PatchCore — a lightweight memory-based method designed for efficient inference.
  • EfficientAD — a lightweight student-teacher method designed for fast industrial anomaly detection.

Training requires only normal (good) images. Labeled test images can then be used for evaluation, threshold calibration, and production model selection.

Open the AnomaVision live demo

New here? Start with the five-minute quickstart.

What can AnomaVision do?

  • Train anomaly detection models using normal images.
  • Detect image-level anomalies and generate anomaly heatmaps.
  • Evaluate anomaly detection and localization performance.
  • Calibrate anomaly thresholds from validation data.
  • Export models to ONNX, OpenVINO, and TensorRT where supported.
  • Run production model selection with Production Autopilot.
  • Export and compile PaDiM and PatchCore to XModel for the AMD/Xilinx Kria KV260.

Quick start

1. Install

Option A — From Source

git clone https://github.com/DeepKnowledge1/AnomaVision.git
cd AnomaVision

uv venv --python 3.11 .venv
source .venv/bin/activate        # Windows: .venv\Scripts\Activate.ps1

uv sync --extra cpu              # CPU
uv sync --extra cu121            # CUDA 12.1

Option B — From PyPI

uv pip install "anomavision[cpu]"

# NVIDIA GPU
uv pip install "anomavision[cu118]"
uv pip install "anomavision[cu121]"
uv pip install "anomavision[cu124]"

For other environments, see Installation.

2. Prepare your dataset

Use an MVTec-style structure:

dataset/
└── bottle/
    ├── ground_truth/
    │   ├── broken_large/
    │   ├── broken_small/
    │   └── contamination/
    ├── test/
    │   ├── broken_large/
    │   ├── broken_small/
    │   ├── contamination/
    │   └── good/
    └── train/
        └── good/

Training uses only train/good. Test images may contain defects.

3. Train

Create or edit config.yml and set dataset_path to your dataset.

Select the algorithm in the configuration:

algorithm: padim       # padim | patchcore | efficientad
anomavision train --config config.yml

4. Detect

anomavision detect --config config.yml --img_path ./dataset/bottle/test

5. Export

anomavision export --config config.yml --format onnx

See Export and deployment for deployment-specific options.

Production Autopilot

Production Autopilot compares trained anomaly models on the same validation data, measures their performance and latency on the target device, calibrates thresholds, and selects the best candidate for deployment.

PaDiM, PatchCore, and EfficientAD can be supplied as independent candidate models. The model paths are provided directly through the CLI:

anomavision autopilot \
  --config config.yml \
  --padim_model ./distributions/padim/bottle/anomav_exp/model.pt \
  --patchcore_model ./distributions/patchcore/bottle/anomav_exp/model.pt \
  --efficientad_model ./distributions/efficientad/bottle/anomav_exp/model.pt \
  --device cpu \
  --validation_split 1.0 \
  --target_latency_ms 50 \
  --output_dir ./production_package

How selection works

For every supplied model, Autopilot:

  1. Evaluates the model on the validation split.
  2. Calibrates an image-level anomaly threshold.
  3. Measures inference latency on the selected device.
  4. Calculates image-level and pixel-level metrics when localization maps are available.
  5. Checks localization quality and false-positive behavior.
  6. Applies the target latency constraint when selecting the production candidate.
  7. Packages the selected model and writes a deployment manifest.

If multiple models satisfy the latency target, the model with the strongest image-level AUROC is preferred, with latency used as a tie-breaker.

Output

Autopilot creates a production package containing:

production_package/
├── model.pt
├── deployment_manifest.json
├── localization_report.md
└── production_autopilot_report.html

The HTML report is a self-contained dashboard showing the candidate comparison, selected model, AUROC, calibrated threshold, latency, localization diagnostics, and deployment recommendation.

KV260 support

AnomaVision supports a Vitis AI workflow for PaDiM and PatchCore on the AMD/Xilinx Kria KV260.

PyTorch → INT8 quantization → XModel → KV260 DPU compilation

Both PaDiM and PatchCore currently compile with 1 DPU subgraph in the KV260 compiler.

See the complete KV260 XModel Guide.

XModel compilation has been validated in the Vitis AI environment. Final on-device KV260 validation requires the physical hardware.

Documentation

Topic Guide
Quick start docs/quickstart.md
Installation docs/installation.md
CLI and configuration docs/cli.md, docs/config.md
Python API docs/api.md
KV260 / XModel docs/kv260_xmodel.md
Production deployment docs/production_deployment.md
Benchmarks docs/benchmark.md
Troubleshooting docs/troubleshooting.md
Examples examples/README.md
Contributing docs/contributing.md

Python example

import torch
from torch.utils.data import DataLoader
import anomavision

train_set = anomavision.AnodetDataset("./dataset/bottle/train/good")
train_loader = DataLoader(train_set, batch_size=16, shuffle=False)

model = anomavision.Padim(backbone="resnet18", device=torch.device("cpu"))
model.fit(train_loader)

batch = next(iter(train_loader))
if isinstance(batch, (tuple, list)):
    batch = batch[0]

scores, maps = model.predict(batch)

License

AnomaVision is released under the MIT License. See LICENSE.

Questions and contributions

Found a problem or have an idea? Feel free to open an issue or contribute to the project.

Metadata

Release files for anomavision 3.6.0

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

Source distribution (sdist)

Source distribution for anomavision 3.6.0
File Size Uploaded
anomavision-3.6.0.tar.gz 8.0 MB Details

Built distribution (wheel)

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

Total release size: 8.2 MB

Release files / anomavision-3.6.0.tar.gz

Download URL anomavision-3.6.0.tar.gz
Size 8.0 MB
Tags Source
SHA-256 checksum
How to use checksums
c4f758e729f7d5f08e1fed608a38a3dec6d1ad69e7041b4eabb4e010bd6ed2ba
BLAKE2b-256 checksum
How to use checksums
88f3581029c56868cb69499960d0fca1f46beda804fd5f14a70aba99b91bf853
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 15, 2026.

Transparency log

Release files / anomavision-3.6.0-py3-none-any.whl

Download URL anomavision-3.6.0-py3-none-any.whl
Size 132.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
443d7d2eb7ea81be6480d6cee9c572365fc5816d9b397f0913230659e028f4e7
BLAKE2b-256 checksum
How to use checksums
7314d671613b1eae8765eb7868ec2d17f45e587e2abd13fc06a4c80189ce52be
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 15, 2026.

Transparency log

Release history Release notifications | RSS feed

3.6.2

2 release files

3.6.1

2 release files

This release

3.6.0 This release

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.0

2 release files

3.3.3

2 release files

3.3.1

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.27

2 release files

3.0.12

2 release files

3.0.10

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