How hjwn/mvtec-anomaly-detection works
This is a CPU-oriented MVTec AD anomaly-detection and model-comparison project. Its workflow loads normal training images and labeled test images, fits one of three detection methods, produces image scores and anomaly maps, and evaluates results. The README also describes a benchmark workflow that compares models across categories and seeds, summarizes performance and efficiency scenarios, and produces visualizations. The sampled src/run.py shows the single-run path; benchmark internals and visualization wiring are documented but not sampled, so those links are not inferred.
Main entry points: run.py Single-run CLI · benchmark.py Benchmark CLI · padim.py PaDiM · patchcore.py PatchCore
Components 14
Data and execution
- Dataset loader
src/datasets/mvtec.py - Single-run CLI
src/run.py - Benchmark CLI
src/benchmark.py
Detection methods
- AutoEncoder
src/methods/ae.py - PaDiM
src/methods/padim.py - PatchCore
src/methods/patchcore.py - ResNet features
src/models/feature_extractor.py - Method output contract
src/methods/base.py
Evaluation and analysis
- Image AUROC
src/metrics/auroc.py - Scenario scoring
src/utils/scoring.py
Benchmark results
- Benchmark reports
src/benchmark.py - Maps and overlays
src/benchmark.py
Other components
- Researcher
- MVTec AD data
Connections 17
- Researcher → Single-run CLI: runs
src/run.py - MVTec AD data → Dataset loader: provides images
src/datasets/mvtec.py - Single-run CLI → Dataset loader: loads train and test
src/run.py - Single-run CLI → AutoEncoder: selects and fits
src/run.py - Single-run CLI → PaDiM: selects and fits
src/run.py - Single-run CLI → PatchCore: selects and fits
src/run.py - Single-run CLI → ResNet features: constructs backbone
src/run.py - PaDiM → ResNet features: extracts features
src/run.py - PatchCore → ResNet features: extracts features
src/run.py - AutoEncoder → Method output contract: returns
src/methods/ae.py - PaDiM → Method output contract: returns
src/methods/padim.py - PatchCore → Method output contract: returns
src/methods/patchcore.py - Single-run CLI → Image AUROC: evaluates scores
src/run.py - Researcher → Benchmark CLI: runs comparisons
README.md - Benchmark CLI → Scenario scoring: uses analysis logic
- Benchmark CLI → Benchmark reports: produces summaries
README.md - Benchmark CLI → Maps and overlays: produces visualizations
README.md