Anomaly Detection via Autoencoder Composite Features and NCE
Authors: Yalin Liao, Austin J. Brockmeier
Organizations: Department of Electrical and Computer Engineering, University of Delaware, Newark, Delaware · Department of Electrical and Computer Engineering, Department of Computer and Information Sciences, University of Delaware, Newark, Delaware
Unsupervised anomaly detection is a challenging task. Autoencoders (AEs) or generative models are often employed to model the data distribution of normal inputs and subsequently identify anomalous, out-of-distribution inputs by high reconstruction error or low likelihood, respectively. However, AEs may generalize and achieve small reconstruction errors on abnormal inputs. We propose a decoupled training approach for anomaly detection that both an AE and a likelihood model trained with noise contrastive estimation (NCE). After training the AE, NCE estimates a probability density function, to serve as the anomaly score, on the joint space of the AE's latent representation combined with features of the reconstruction quality. To further reduce the false negative rate in NCE we systematically varying the reconstruction features to augment the training and optimize the contrastive Gaussian noise distribution. Experimental assessments on multiple benchmark datasets demonstrate that the proposed approach matches the performance of prevalent state-of-the-art anomaly detection algorithms.
Figures & tables
Figure 1: Illustration of Proposition 1 with normal observations Y=(Y1,Y2)T , where Yi=X+ϵi,X∼U([0,1]) , and ϵi∼N(0,0.082) . Anomalies are generated by perturbing Y by 0.7vr along the residual direction vr=(−1,1)T/2 . The panels show the observations, latent representations, and reconstruction errors.
Figure 2: CANCE for AD.
Data
Error
LatNCE
CNCE
CANCE
Unimodal
MNIST
95.1
84.1
97.0
97.7
F-MNIST
90.4
89.6
92.2
92.5
CIFAR-10
54.1
65.1
65.3
65.4
Multimodal
MNIST
94.6
87.6
97.3
97.6
Table 1: AUROC for CANCE ablations
Method
Mean AUROC (%)
Best Count
DAGMM
65.05
1
DSVDD
67.89
0
DROCC
60.30
0
GOAD
68.82
3
DDPM
77.92
3
DTE-NP
81.59
19
Table 2: Performance comparison across 57 datasets in terms of average AUROC and best count. The best count indicates the number of datasets on which each method achieves the highest AUROC.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Hyperparameter
MNIST
F-MNIST
CIFAR-10
MNIST-C
AE
Input channels
1
1
3
1
Hidden channels
8
8
32
8
Latent dimension
6
6
64
10
Activation
GELU
GELU
GELU
GELU
Learning rate
10−4
10−4
10−4
10−4
Appendix
Table 3: Training configurations for the ablation experiments.
Data
Error
LatNCE
CNCE
CANCE
MNIST
0
99.4(0.1)
85.0(3.5)
99.5(0.0)
99.6(0.0)
1
99.9(0.0)
98.4(0.3)
99.8(0.0)
99.8(0.0)
2
90.3(1.5)
81.9(6.5)
96.6(0.7)
97.1(0.5)
3
92.6(0.6)
81.2(1.2)
95.6(0.4)
96.7(0.3)
4
95.5(1.3)
75.0(3.8)
95.8(0.3)
96.9(0.4)
Appendix
Table 4: Ablation study on unimodal training dataset
Data
Error
LatNCE
CNCE
CANCE
MNIST
0,1
99.4(0.1)
93.8(1.1)
99.5(0.1)
99.6(0.1)
0,8
87.8(0.7)
79.8(1.3)
95.0(0.5)
95.5(0.4)
1,8
96.7(0.7)
89.3(2.3)
97.4(0.3)
97.8(0.2)
Avg
94.6
87.6
97.3
97.6
F-MNIST
Appendix
Table 5: Ablation study on the multimodal datasets
Data
Error
LatNCE
CNCE
CANCE
MNIST, ResNet-18|ResNet-50
0
98.1∣96.3
78.4(0.9)∣75.2(0.4)
96.7(0.6)∣95.8(0.4)
98.6(0.0)∣97.4(0.1)
1
99.8∣98.6
98.6(0.1)∣95.9(0.6)
99.6(0.0)∣98.5(0.1)
99.7(0.0)∣98.5(0.1)
2
88.3∣76.6
74.4(0.7)∣66.1(0.8)
83.8(1.4)∣80.2(1.0)
91.0(0.1)∣83.9(0.2)
3
95.1∣95.9
74.1(0.5)∣90.7(0.1)
92.5(0.3)∣94.8(0.1)
94.7(0.2)∣95.5(0.1)
4
97.3∣95.2
84.4(0.5)∣81.7(0.8)
96.3(0.3)∣94.1(0.1)
97.3(0.2)∣95.2(0.2)
Appendix
Table 6: Ablation study on features extracted by ResNet on MNIST, F-MNIST, and CIFAR-10
DAGMM
DSVDD
DROCC
GOAD
DDPM
DTE-NP
DTE-IG
DTE-C
CANCE
aloi
50.84(2.97)
50.89(2.05)
50.0(0.0)
48.01(0.92)
49.91(0.35)
51.19(0.46)
50.87(1.17)
50.44(0.19)
52.33(0.97)
amazon
50.47(2.01)
51.2(4.42)
50.0(0.0)
56.07(0.9)
55.09(0.1)
60.82(0.0)
51.93(3.5)
56.71(2.15)
61.49(0.79)
annthy- roid
72.23(15.13)
55.01(3.62)
88.9(2.31)
81.01(5.16)
88.82(1.34)
92.9(0.25)
87.6(4.46)
97.52(0.15)
88.19(1.58)
backdoor
54.36(19.91)
91.14(2.62)
94.25(0.73)
52.9(14.48)
80.93(0.56)
99.31(1.7)
94.02(1.46)
91.65(1.73)
91.85(0.63)
breastw
89.53(10.2)
96.96(0.92)
47.32(31.95)
98.86(0.33)
98.7(0.43)
99.28(0.12)
78.65(11.1)
92.78(1.75)
99.52(0.09)
campaign
61.47(2.73)
62.21(12.88)
50.0(0.0)
47.89(12.32)
74.51(0.42)
78.79(0.25)
74.81(1.69)
68.84(6.50)
68.84(6.50)
Appendix
Table 7: Average AUROC and standard deviations on ADBench dataset.
Data
KDE
VAE
PC
LSA
DAGMM
CANCE
MNIST
0
88.5
99.8
53.1
99.3
53.6
99.6(0.0)
1
99.6
99.9
99.5
99.9
51.5
99.8(0.0)
2
71.0
96.2
47.6
95.9
53.5
97.1(0.5)
3
69.3
94.7
51.7
96.6
49.7
96.7(0.3)
4
84.4
96.5
73.9
95.6
52.7
96.9(0.4)
Appendix
Table 8: AUCROC [%] for baseline methods, Pix-CNN (PC) and DAGMM, compared to CANCE mean and std. value across 5 independent runs.
Method
Precision
Recall
F1
DAGMM-0
93.0
94.4
93.7
DAGMM-1
97.7(0.3)
96.9(0.6)
97.3(0.5)
DAGMM-CANCE
97.6(0.3)
96.9(0.6)
97.3(0.5)
Appendix
Table 9: AD results on contaminated training data from KDDCUP99
Data
DAGMM
DSVDD
NN
DROCC
DPAD
CANCE
CANCE18
CANCE50
F-MNIST
0
42.1
79.1
91.2∣100
88.1
93.7(0.2)
90.6(0.4)
89.7(0.3)
91.3(0.3)
1
55.1
94.0
98.6∣100
97.7
98.7(0.0)
98.4(0.1)
98.5(0.1)
98.7(0.0)
2
50.4
83.0
88.5∣100
87.6
90.3(0.0)
89.0(0.4)
91.0(0.2)
92.6(0.1)
3
57.0
82.9
93.6∣100
87.7
94.7(0.3)
91.8(0.6)
85.7(0.2)
90.1(0.5)
4
26.9
87.0
89.4∣100
87.2
92.2(0.1)
90.7(0.2)
92.3(0.2)
91.7(0.1)
Appendix
Table 10: AUROC[%] CANCE vs DPAD on F-MNIST and CIFAR-10. NN (nearest neighbor, use raw | ResNet-18 feature), CANCE (AE), CANCE18 (ResNet-18), CANCE50 (ResNet-50)