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

13 Aug 2023  ·  Hanxi Li, Jianfei Hu, Bo Li, Hao Chen, Yongbin Zheng, Chunhua Shen ·

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.

PDF Abstract

Results from the Paper


Task Dataset Model Metric Name Metric Value Global Rank Result Benchmark
Anomaly Detection BTAD CPR Segmentation AUROC 98.4 # 1
Detection AUROC 94.8 # 5
Segmentation AUPRO 85.1 # 1
Segmentation AP 70.3 # 1
Supervised Anomaly Detection BTAD CPR Segmentation AP 84.0 # 1
Segmentation AUPRO 91.4 # 1
Segmentation AUROC 99.1 # 1
Detection AUROC 98.3 # 1
Anomaly Detection MVTec 3D-AD (RGB) CPR Segmentation AP 57.8 # 1
Segmentation AUPRO 96.9 # 1
Segmentation AUROC 99.1 # 1
Detection AUROC 88.5 # 1
Supervised Anomaly Detection MVTec AD CPR Detection AUROC 99.7 # 1
Segmentation AUROC 99.6 # 1
Segmentation AUPRO 98.3 # 1
Segmentation AP 86.0 # 1
Anomaly Detection MVTec AD CPR(TensorRT) FPS 130 # 7
Anomaly Detection MVTec AD CPR-faster(TensorRT) FPS 1016 # 1
Anomaly Detection MVTec AD CPR Detection AUROC 99.7 # 5
Segmentation AUROC 99.2 # 2
Segmentation AUPRO 97.8 # 1
Segmentation AP 82.7 # 1
FPS 113 # 8
Anomaly Detection MVTec AD CPR-fast(TensorRT) FPS 362 # 4
Anomaly Detection MVTec AD CPR-fast Detection AUROC 99.7 # 5
Segmentation AUROC 99.2 # 2
Segmentation AUPRO 97.7 # 2
Segmentation AP 82.3 # 2
FPS 245 # 5
Anomaly Detection MVTec AD CPR-faster Detection AUROC 99.4 # 20
Segmentation AUROC 99.0 # 6
Segmentation AUPRO 97.3 # 4
Segmentation AP 80.6 # 4
FPS 478 # 3

Methods