# Back to the Metrics: Exploration of Distance Metrics in Anomaly Detection
## 1 Introduction
### Two-Dimensional Industrial Anomaly Detection  
When 2D industrial anomaly detection becomes increasingly emphasized, datasets such as MVTec AD [5; 6], BTAD [7], MTD [8], and MVTec LOCO AD [9] are successively introduced. MVTec AD includes various industrial objects and materials with normal and anomalous samples, BTAD focuses on transparent bottle anomalies, MTD targets defects in magnetic tiles, and MVTec LOCOAD evaluates methods under logical constraints and complex scenes. This has stimulated the development of industrial AD&S and facilitated the proposal of many novel AD&S methods. We categorize these methods into three main types:  
1. Supervised Learning: These algorithms treat anomaly detection as an imbalanced binary classification problem. This approach suffers from the scarcity of abnormal samples and the high cost of labeling. To deal with these problems, various methods have been proposed to generate anomalous samples so as to alleviate the labeling cost. For example, CutPaste [10] and DRAEM [11] manually construct anomaloussamples; SimpleNet [12] samples anomalous features near positive sample features; NSA [13] and GRAD [14] synthesize anomalous samples based on normal samples. Despite the diversity of anomaly generation methods, they consistently fail to address the underlying issue of discrepancies between the distributions of generated and real data [15; 16; 17].
2. Unsupervised Learning: These algorithms operate under the assumption that data follow a normal distribution. For example, SROC [18] and SRR [19] rely on this assumption to identify and remove minor anomalies from normal data. When combined with semi-supervised learning techniques, these algorithms achieve enhanced performance.
3. Semi-supervised Learning: The concentration assumption, which supposes the normal data are usually bound if the features extracted are good enough, is commonly used when designing semi-supervised learning AD&S methods. These algorithms require only labels for normal data and assume boundaries in the normal data distribution for anomaly detection. Examples include the following: autoencoder-based [20; 21; 22], GAN-based [23; 24; 25], flow-based [26; 27; 28; 29; 30], and SVDD-based methods [31; 32; 33]. Some memory bank-based methods (MBBM) [16; 17; 34; 35; 36; 37] that combine pre-trained features from deep neural networks with traditional semi-supervised algorithms have achieved particularly outstanding results and also possess strong interpretability. In rough chronological order, we summarize the main related algorithms as follows: (a) DN2 [34] was the first to use \(k\)-nearest neighbors (\(k\)NN) with deep pre-trained features for the AD task, introducing group anomaly detection (GAD) [38]. After that, some works [16; 17] fit Gaussian distributions to deep pre-trained features for anomaly scoring using the Mahalanobis distance. (b) SPADE, building on DN2, [35] employs feature pyramid matching to achieve image AD&S. (c) PaDiM [36] models pre-train feature patches with Gaussian distributions for better AD&S performance. (d) Panda [33] sets subtasks based on pre-trained features for model tuning to achieve better feature extraction and improve model performance. (e) PatchCore [37] and ReConPatch [39] have achieved excellent performance by utilizing downsampled pre-trained feature sets from the \(k\)NN method. They have consistently held top positions on the performance leaderboard for an extended period.