patchcore-inspection  by amazon-science

Anomaly detection research paper implementation

Created 3 years ago
991 stars

Top 37.5% on SourcePulse

GitHubView on GitHub
Project Summary

This repository implements PatchCore, a state-of-the-art anomaly detection algorithm for industrial applications. It provides pretrained models achieving high AUROC scores for image-level and pixel-level anomaly detection, targeting researchers and engineers in quality control and manufacturing.

How It Works

PatchCore extracts a coreset-subsampled memory of pretrained, locally aggregated patch features from a backbone network (e.g., WideResNet50). It leverages these features for efficient similarity search and anomaly scoring, enabling robust detection of deviations from normal patterns. The approach is advantageous for its ability to capture local structural information and its computational efficiency through coreset subsampling.

Quick Start & Requirements

  • Install and run: env PYTHONPATH=src python bin/run_patchcore.py
  • Prerequisites: Python 3.8, PyTorch, FAISS (GPU support recommended), MVTec AD dataset.
  • Setup: Download MVTec AD dataset and place it in the specified directory structure.
  • Links: sample_training.sh, sample_evaluation.sh

Highlighted Details

  • Achieves up to 99.6% image-level AUROC and 98.4% pixel-level AUROC on MVTec AD.
  • Supports ensembling of multiple backbone networks for improved performance.
  • Utilizes FAISS for efficient nearest neighbor search, with GPU acceleration.
  • Integrates with Weights & Biases for experiment tracking.

Maintenance & Community

Licensing & Compatibility

  • License: Apache-2.0
  • Compatible with commercial use and closed-source linking.

Limitations & Caveats

  • Performance may slightly deviate from paper due to software/hardware differences.
  • Requires significant GPU memory for large input images.
Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
1
Issues (30d)
1
Star History
26 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.