HyperAIHyperAI

Command Palette

Search for a command to run...

3 months ago

Target before Shooting: Accurate Anomaly Detection and Localization under One Millisecond via Cascade Patch Retrieval

Hanxi Li Jianfei Hu Bo Li Hao Chen Yongbin Zheng Chunhua Shen

Target before Shooting: Accurate Anomaly Detection and Localization under One Millisecond via Cascade Patch Retrieval

Abstract

In this work, by re-examining the "matching" nature of Anomaly Detection (AD), we propose a new AD framework that simultaneously enjoys new records of AD accuracy and dramatically high running speed. In this framework, the anomaly detection problem is solved via a cascade patch retrieval procedure that retrieves the nearest neighbors for each test image patch in a coarse-to-fine fashion. Given a test sample, the top-K most similar training images are first selected based on a robust histogram matching process. Secondly, the nearest neighbor of each test patch is retrieved over the similar geometrical locations on those "global nearest neighbors", by using a carefully trained local metric. Finally, the anomaly score of each test image patch is calculated based on the distance to its "local nearest neighbor" and the "non-background" probability. The proposed method is termed "Cascade Patch Retrieval" (CPR) in this work. Different from the conventional patch-matching-based AD algorithms, CPR selects proper "targets" (reference images and locations) before "shooting" (patch-matching). On the well-acknowledged MVTec AD, BTAD and MVTec-3D AD datasets, the proposed algorithm consistently outperforms all the comparing SOTA methods by remarkable margins, measured by various AD metrics. Furthermore, CPR is extremely efficient. It runs at the speed of 113 FPS with the standard setting while its simplified version only requires less than 1 ms to process an image at the cost of a trivial accuracy drop. The code of CPR is available at https://github.com/flyinghu123/CPR.

Code Repositories

flyinghu123/cpr
Official
pytorch

Benchmarks

BenchmarkMethodologyMetrics
anomaly-detection-on-btadCPR
Detection AUROC: 94.8
Segmentation AP: 70.3
Segmentation AUPRO: 85.1
Segmentation AUROC: 98.4
anomaly-detection-on-mvtec-3d-ad-rgbCPR
Detection AUROC: 88.5
Segmentation AP: 57.8
Segmentation AUPRO: 96.9
Segmentation AUROC: 99.1
anomaly-detection-on-mvtec-adCPR-faster
Detection AUROC: 99.4
FPS: 478
Segmentation AP: 80.6
Segmentation AUPRO: 97.3
Segmentation AUROC: 99.0
anomaly-detection-on-mvtec-adCPR-fast(TensorRT)
FPS: 362
anomaly-detection-on-mvtec-adCPR(TensorRT)
FPS: 130
anomaly-detection-on-mvtec-adCPR-fast
Detection AUROC: 99.7
FPS: 245
Segmentation AP: 82.3
Segmentation AUPRO: 97.7
Segmentation AUROC: 99.2
anomaly-detection-on-mvtec-adCPR-faster(TensorRT)
FPS: 1016
anomaly-detection-on-mvtec-adCPR
Detection AUROC: 99.7
FPS: 113
Segmentation AP: 82.7
Segmentation AUPRO: 97.8
Segmentation AUROC: 99.2
supervised-anomaly-detection-on-btadCPR
Detection AUROC: 98.3
Segmentation AP: 84.0
Segmentation AUPRO: 91.4
Segmentation AUROC: 99.1
supervised-anomaly-detection-on-mvtec-adCPR
Detection AUROC: 99.7
Segmentation AP: 86.0
Segmentation AUPRO: 98.3
Segmentation AUROC: 99.6

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp