Table of Contents
Fetching ...

CRD: Collaborative Representation Distance for Practical Anomaly Detection

Chao Han, Yudong Yan

TL;DR

This paper tackles practical anomaly detection by replacing costly patch-wise nearest-neighbor distances with a collaborative representation distance (CRD) under an $L_2$ relaxation. By deriving a closed-form solution and precomputing a fixed matrix $M_{\text{pre}}$, CRD enables edge-friendly inference via simple matrix multiplication, while preserving patch-level discrimination. Multi-scale WideResnet50 features are used to form a high-dimensional patch set, and the CRD score is computed efficiently for all patches, resulting in substantial speedups (up to ~274x) with only marginal performance loss on real industrial data. Experiments on the MvTec AD benchmark demonstrate competitive AUC results and strong scalability, highlighting the method's practical impact for edge deployment and large-scale anomaly detection. The approach reduces memory overhead and enables near-real-time anomaly scoring, making it suitable for production environments with strict latency and resource constraints.

Abstract

Visual defect detection plays an important role in intelligent industry. Patch based methods consider visual images as a collection of image patches according to positions, which have stronger discriminative ability for small defects in products, e.g. scratches on pills. However, the nearest neighbor search for the query image and the stored patches will occupy $O(n)$ complexity in terms of time and space requirements, posing strict challenges for deployment in edge environments. In this paper, we propose an alternative approach to the distance calculation of image patches via collaborative representation models. Starting from the nearest neighbor distance with $L_0$ constraint, we relax the constraint to $L_2$ constraint and solve the distance quickly in close-formed without actually accessing the original stored collection of image patches. Furthermore, we point out that the main computational burden of this close-formed solution can be pre-computed by high-performance server before deployment. Consequently, the distance calculation on edge devices only requires a simple matrix multiplication, which is extremely lightweight and GPU-friendly. Performance on real industrial scenarios demonstrates that compared to the existing state-of-the-art methods, this distance achieves several hundred times improvement in computational efficiency with slight performance drop, while greatly reducing memory overhead.

CRD: Collaborative Representation Distance for Practical Anomaly Detection

TL;DR

This paper tackles practical anomaly detection by replacing costly patch-wise nearest-neighbor distances with a collaborative representation distance (CRD) under an relaxation. By deriving a closed-form solution and precomputing a fixed matrix , CRD enables edge-friendly inference via simple matrix multiplication, while preserving patch-level discrimination. Multi-scale WideResnet50 features are used to form a high-dimensional patch set, and the CRD score is computed efficiently for all patches, resulting in substantial speedups (up to ~274x) with only marginal performance loss on real industrial data. Experiments on the MvTec AD benchmark demonstrate competitive AUC results and strong scalability, highlighting the method's practical impact for edge deployment and large-scale anomaly detection. The approach reduces memory overhead and enables near-real-time anomaly scoring, making it suitable for production environments with strict latency and resource constraints.

Abstract

Visual defect detection plays an important role in intelligent industry. Patch based methods consider visual images as a collection of image patches according to positions, which have stronger discriminative ability for small defects in products, e.g. scratches on pills. However, the nearest neighbor search for the query image and the stored patches will occupy complexity in terms of time and space requirements, posing strict challenges for deployment in edge environments. In this paper, we propose an alternative approach to the distance calculation of image patches via collaborative representation models. Starting from the nearest neighbor distance with constraint, we relax the constraint to constraint and solve the distance quickly in close-formed without actually accessing the original stored collection of image patches. Furthermore, we point out that the main computational burden of this close-formed solution can be pre-computed by high-performance server before deployment. Consequently, the distance calculation on edge devices only requires a simple matrix multiplication, which is extremely lightweight and GPU-friendly. Performance on real industrial scenarios demonstrates that compared to the existing state-of-the-art methods, this distance achieves several hundred times improvement in computational efficiency with slight performance drop, while greatly reducing memory overhead.
Paper Structure (18 sections, 8 equations, 3 figures, 3 tables)

This paper contains 18 sections, 8 equations, 3 figures, 3 tables.

Figures (3)

  • Figure 1: Graphical illustration of the overall framework.
  • Figure 2: Examples visulization in MvTec Ad.
  • Figure 3: Time cost for CRD and NN.