patchcore-inspection  by amazon-science

Anomaly detection research paper implementation

created 3 years ago
952 stars

Top 39.4% 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

1+ week

Pull Requests (30d)
0
Issues (30d)
1
Star History
85 stars in the last 90 days

Explore Similar Projects

Starred by Lewis Tunstall Lewis Tunstall(Researcher at Hugging Face), Lysandre Debut Lysandre Debut(Chief Open-Source Officer at Hugging Face), and
3 more.

FARM by deepset-ai

0%
2k
NLP framework for transfer learning with BERT & Co
created 6 years ago
updated 1 year ago
Feedback? Help us improve.