S ELF - SUPERVISE , R EFINE , R EPEAT : I MPROVING U NSUPERVISED A NOMALY D ETECTION
Anonymous authors
Paper under double-blind review
A BSTRACT
Anomaly detection (AD) – separating anomalies from normal data – has many applications across domains, from manufacturing to healthcare.
While most previous works have been shown to be effective for cases with fully or partially labeled data, that setting is in practice less common due to labeling being particularly tedious for this task.
In this paper, we focus on fully unsupervised AD in which the entire training dataset, containing both normal and anomalous samples is unlabeled.
To tackle this problem effectively
, we propose to improve the robustness of one-class classiﬁcation trained on self-supervised representations using a data reﬁnement process
Our proposed data reﬁnement approach is based on an ensemble of one class classiﬁers (OCCs) each of which is trained on a disjoint subset of training data
Representations learned by self
-supervised learning on the reﬁned data are iteratively updated as the reﬁnement improves.
We demonstrate our method on various unsupervised AD tasks with image and tabular data
With a
% anomaly ratio on
CIFAR
-10 image data / 2.5% anomaly ratio on Thyroid tabular data, the proposed method outperforms the state- of-the-art one-class classiﬁcation method by 6.
AUC and
.5 average precision / 22.
F1- score
I NTRODUCTION
Anomaly detection (AD), the task of distinguishing anomalies from normal data, plays a crucial role in many real-world applications such as detecting faulty products using visual sensors in manufacturing, fraudulent behaviors at credit card transactions, or adversarial outcomes at intensive care units.
AD has been considered under various settings based on the availability of negative (normal) and positive (anomalous) data and their labels at training, as overviewed in Sec. 2.
Each application scenario is dominated by different challenges.
When entire positive and negative data are available along with their labels (Fig. 1a), the problem can be treated as supervised classiﬁcation and the dominant challenge becomes the imbalance in label distributions [4, 16, 20, 27, 32, 35].
When only negative labeled data are available (Fig. 1b), the problem is ‘one-class classiﬁcation’ [23, 26, 33, 45, 47, 51, 53].
Various works have also extended approaches designed for these to settings with additional unlabeled data (Fig. 1c,d,e) [10, 18, 24, 46, 58] in a semi-supervised setting.
While there exist many prior works in these settings, they all depend on some labeled data , which is not desirable in all application scenarios.
Unsupervised AD, on the other hand, poses unique challenges in the absence of any labeled data information, and a straightforward adaption of methods developed with the assumption of labeled data would be suboptimal.
For example, some recent studies [7, 60] have applied one-class classiﬁers (OCCs) that are known to yield impressive performance when trained on negative samples [7, 23, 26, 33, 51] to unsupervised AD, but their performance for unsupervised AD has been quite sub-optimal.
Fig.
2 illustrates this, showing the unsupervised AD performance of state-of-the-art Deep OCCs [51] with different anomaly ratios in unlabeled training data – the average precision signiﬁcantly drops even when a small portion (2%) of training data is contaminated with anomalies.
Our framework SRR ( S elf-supervise, R eﬁne, R epeat), overviewed in Fig.
3, brings a novel approach to unsupervised AD with the principles of self-supervised learning without labels and iterative data reﬁnement based on the agreement of OCC outputs.
We propose to improve the state-of-the-art performance of OCCs, e.g. [33, 51], by reﬁning the unlabeled training data so as to address the fundamental challenges elaborated above.
SRR iteratively trains deep representations using reﬁned
[Figure]
data while improving the reﬁnement of unlabeled data by excluding potentially-positive (anomalous) samples.
For the data reﬁnement process, we employ an ensemble of OCCs, each of which is trained on a disjoint subset of unlabeled training data.
The samples are declared as normal if there is a consensus between all the OCCs.
The reﬁned training data are used to train the ﬁnal OCC to generate the anomaly scores in the unsupervised setting.
Most prior unsupervised AD works [23, 26, 33, 51] assume that the data contains entirely negative samples, which makes them not truly unsupervised as they require having humans to do the data ﬁltering.
Similar to ours, some prior unsupervised
AD works [7, 45, 60] considered evaluating on an unsupervised setting where there exist a small percentage of anomalous samples in the training data, i.e. operating in ‘truly’ unsupervised setting without having the need for humans to do any ﬁltering in the training data.
However, these methods often suffered from signiﬁcant performance degradation as the ratio of anomalous sample ratio has increased (see Sec. 4.2).
We would like to highlight that our method distinguishes from the literature by bringing a data-centric approach (reﬁning the unlabeled data) to unsupervised anomaly detection beyond the model-centric approaches (improving the model itself).
Our framework SRR aims to provide robustness in performance as the anomalous sample ratio increases, as shown in Fig.
[Figure]
We conduct extensive experiments across various datasets from different domains, including semantic
AD (CIFAR-10 [29], Dog-vs-Cat [19]), real-world manufacturing visual AD use case (MVTec [8]), and tabular AD benchmarks.
We consider methods with both shallow [36, 47] and deep [7, 33, 51] models.
We evaluate models at different anomaly ratios of unlabeled training data and show that SRR signiﬁcantly boosts performance.
For example, in Fig. 2,
SRR improves more than 15.0 average precision (AP) with a 10% anomaly ratio compared to a state-of-theart one-class contrastive representation model [51] on CIFAR-10.
Similarly, on MVTec SRR retains a strong performance, dropping less than 1.0 AUC with 10% anomaly ratio, while the best existing OCC [33] drops more than 6.0 AUC.
We further investigate the efﬁcacy of our design choices, such as the number of ensemble classiﬁers, thresholds, and reﬁnement of deep representations via ablation studies.
R ELATED W ORK
There are various existing works under the different settings described in Fig. 1:
The positive + negative setting is often considered as a supervised binary classiﬁcation problem.
The challenge arises due to the imbalance in label distributions as positive (anomalous) samples are rare.
As summarized in [12], to address this, over-/under-sampling [16, 20], weighted optimization [4, 27], synthesizing data of minority classes [32, 35], and hybrid methods [2, 22] have been studied.
The negative setting is often converted to a one-class classiﬁcation problem, with the goal of ﬁnding a decision boundary that includes as many one-class samples as possible.
Shallow models for this setting include one-class support vector machines [47] (OC-SVM), support vector data description [53] (SVDD), kernel density estimation (KDE) [31], and Gaussian density estimation (GDE) [44].
There are also auto-encoder based models [59] that treat the reconstruction error as the anomaly score.
Deep learning based OCCs have been developed, such as Deep OCC [45], geometric transformation [23], or outlier exposure [26].
Noting the degeneracy or inconsistency of learning objectives of existing end-to-end trainable Deep OCCs, [51] proposed a deep representation OCC, a two-stage framework that learns self-supervised representations [17, 28] followed by shallow OCCs.
That work was extended for texture anomaly localization with CutPaste [33].
The robustness to very low anomaly ratios of these methods under the unsupervised setting was explored in [7, 60].
The semi-supervised setting is deﬁned as utilizing a small set of labeled samples and large set of unlabeled samples to distinguish anomalies from normal data.
Depending on which labeled samples are given, this setting can be split into three sub-categories.
When only some positive/negative labeled samples are provided, we denote that as a PU/NU setting.
Most previous works in semi-supervised
AD settings focus on the NU setting where only some of the normal labeled samples are given [1, 41, 52].
The PNU setting is a more general semi-supervised setting where subsets of both positive and negative labeled samples are given.
Deep SAD [46] and SU-IDS [39] are included in this category.
We show the signiﬁcant outperformance of our proposed SRR framework compared to Deep SAD, for multiple benchmark datasets when not using any labeled data (see Sec. 4.2).
The unlabeled setting has received relatively less attention despite its signiﬁcance in automating machine learning.
The popular methods for this setting include isolation forest [36] and local outlier factor [13].
However, they are difﬁcult to scale, and less compatible with recent advances in representation learning.
While OCCs, such as OC-SVM, SVDD, or their deep counterparts, apply to unlabeled settings by assuming the data is all negative, and the robustness of those methods has also been demonstrated in part [7, 60], in practice we observe a signiﬁcant performance drop with a high anomaly ratio, shown in Fig.
In contrast, our proposed framework is able to maintain high performance across anomaly ratios.
Data reﬁnement has been applied to AD in some prior works.
[5, 42] generate pseudo-labels using binary classiﬁcation and OC-SVM for data reﬁnement to boost the consequent AD performances in unsupervised settings.
[6, 30, 40, 55, 59] used the reconstruction errors of the auto-encoder as an indicator for removing possible anomalies.
[21] and [38] used data reﬁnement for AD in supervised and semi-supervised settings.
Additional discussions can be found in Appendix A.9.
Self-training [37, 48] is an iterative training mechanism using predicted pseudo labels as targets for model training.
It has regained popularity recently with its successful results in semi-supervised image classiﬁcation [9, 50, 57].
To improve the quality of pseudo labels, employment of an ensemble of classiﬁers has also been studied.
[14] trains an ensemble of classiﬁers with different classiﬁcation methods to make a consensus for noisy label veriﬁcation.
Co-training [11] trains multiple classiﬁers, each of which is trained on the distinct views, to supervise other classiﬁers.
Co-teaching [25] and
DivideMix [34] share a similar idea in that they both train multiple deep networks on separate data batches to learn different decision boundaries, thus becoming useful for noisy label veriﬁcation.
While sharing a similarity, the proposed framework has clear differences from the previous works.
SRR performs iterative training with data reﬁnement (with robust ensemble methods) and self-supervised learning for unsupervised learning of an anomaly detector.
P ROPOSED FRAMEWORK
S elf-supervise, R eﬁne, and R epeat (SRR) is an iterative training framework, where we reﬁne the data (Sec. 3.1) and update the representation with the reﬁned data (Sec. 3.2), followed by OCCs on reﬁned representations.
Fig.
3 overviews the framework and Algorithm 1 provides the pseudo code.
Notation.
We denote the training data as D = { x i } Ni =1 where x
i ∈ X
and N is the number of training samples.
y i ∈ { 0 , 1 } is the corresponding label to x i , where 0 denotes normal (negative) and 1 denotes anomaly (positive).
Note that labels are not provided in the unsupervised setting.
Let us denote a feature extractor as g : X → Z .
g may include any data preprocessing functions, an identity function (if raw data is directly used for one-class classiﬁcation), and learned or learnable representation extractors such as deep neural networks.
Let us deﬁne an OCC as f : Z → [ −∞ , ∞ ] that outputs anomaly scores given the input features g ( x ) .
The higher the score f
( g ( x )) , the more anomalous the sample x is.
The binary anomaly prediction is made after thresholding: 1 (cid:0)
f ( g ( x )) ≥ η (cid:1) .
[Figure]
3. D ATA R EFINEMENT
A naive way to generate pseudo labels of unlabeled data is to construct an OCC on raw data or learned representations as in [51] and threshold the anomaly score to obtain a binary label for normal vs. anomalous.
As we update the model with reﬁned data that excludes samples that are predicted to be anomalous, it is important to generate pseudo labels of training data as accurately as possible.
To this end, instead of training a single classiﬁer (unlike most previous works on data reﬁnement for AD [5, 42, 59]), we train an ensemble of K OCCs and aggregate their predictions to generate pseudo labels.
We illustrate the data reﬁnement block in Fig.
3 and as R EFINE D ATA in Algorithm 1.
Speciﬁcally, we randomly divide the unlabeled training data D into K disjoint subsets D 1 , ..., D K , and train K different OCCs ( f 1 , ..., f K ) on corresponding subsets ( D 1 , ..., D K ) .
Then, we estimate a binary pseudo-label of the data x i ∈ D as follows:
[Equation]
where 1 ( · ) is the indicator function that outputs 1/0 if the input is True/False.
f k ( g ( x i )) represents an anomaly score of x i for an OCC f k .
η k in equation 2 is a threshold determined as a γ percentile of the anomaly score distribution { f k ( g ( x i ))
} Ni =1 .
To interpret equation 1, x i is predicted as normal, i.e. ˆ y i
= 0 , if all K OCCs predict it as normal.
While this may be too strict and potentially reject many true normal samples in the training set, we ﬁnd that empirically, it is critical to be able to exclude true anomalous samples from the training set.
The effectiveness of the employment of an ensemble of classiﬁers is empirically shown in Sec. 4.3.
3. R EPRESENTATION U PDATE
SRR follows the idea of deep representation OCCs [51], where in the ﬁrst stage a deep neural network is trained with self-supervised learning (such as rotation prediction [23], contrastive [51], or
CutPaste [33]) to obtain meaningful representations of the data, and in the second stage OCCs are trained on these learned representations.
Such a two-stage framework is shown to be beneﬁcial as it prevents the ‘hypersphere collapse’ of the deep OCCs by the favorable inductive bias it brings with the architectural constraints [45].
Here, we propose to conduct self-supervised representation learning jointly with data reﬁnement.
More precisely, we train a feature extractor g using ˆ D = { x i | ˆ y i = 0 } , a subset of unlabeled data Compute
’s γ percentile anomaly distributions Predict binary Initialize extractor g . g do 10:
ATA Update objectives. 12: end while 13: Train an model f on reﬁned data
D 15: end function
D that only includes samples whose predicted labels with an ensemble OCC from Sec.
3.1 are negative.
We also update ˆ D as we proceed with representation learning.
The proposed method is illustrated in Algorithm 1 as SRR.
In contrast to previous works [33, 51] that use the entire training data for learning self-supervised representation, we ﬁnd it necessary to reﬁne the training data even for learning deep representations.
Without representation reﬁnement, the performance improvements of SRR are limited, as shown in Sec.
Last, for test-time prediction, we train an OCC on reﬁned data ˆ D using updated representations by g as in line 13-14 in Algorithm 1.
3. U NSUPERVISED MODEL SELECTION
As SRR is designed for unsupervised AD, labeled validation data for hyperparameter tuning is typically not available and the framework should enable robust model selection without any reliance on labeled data .
Here, we provide insights on how to select important hyperparameters, and later in
Sec.
4.3.1 perform sensitivity analyses for these hyperparameters.
Data reﬁnement of SRR introduces two hyperparameters: the number of OCCs ( K ) and the percentile threshold ( γ ).
There is a trade-off between the number of classiﬁers for the ensemble and the size of disjoint subsets for training each classiﬁer.
With large K , we aggregate prediction from many classiﬁers, each of which may contain randomness from training.
This comes at a cost of reduced performance per classiﬁer as we use smaller subsets to train them.
In practice, we ﬁnd K = 5 works well across different datasets and anomaly ratios.
γ controls the purity and coverage of reﬁned data.
If γ is large, and thus classiﬁers reject too many samples, the reﬁned data could be more pure and contain mostly the normal samples; however, the coverage of the normal samples would be limited.
On the other hand, with a small γ , the reﬁned data may still contain many anomalies and the performance improvement with SRR would be limited.
We empirically observe that SRR is robust to the selection of γ when it is chosen from a reasonable range.
In our empirical experiments, we ﬁnd ∼ 1 − 2 × of the true anomaly ratio to be a reasonable choice.
In other words, it is safer to use γ higher than the expected true anomaly ratio.
In some cases, the true anomaly ratio may not be available at all; for such scenarios, we propose Otsu’s method [49] to estimate the anomaly ratio of the training data for determining the threshold γ (experimental results are in the Appendix A.5).
E XPERIMENTS
We evaluate the efﬁcacy of our proposed framework for unsupervised AD tasks on tabular (Sec. 4.1) and image (Sec. 4.2) data types.
We experiment varying ratios of anomaly samples in unlabeled training data and with different combinations of representation learning and OCCs.
In Sec. 4.3, we provide performance analyses to better explain major constituents of the performance, as well as sensitivity to hyperparameter values.
Implementation details: To reduce the computational complexity of the data reﬁnement block, we utilize a simple OCC such as GDE in the data reﬁnement block.
In a two-stage model, we only update the data reﬁnement block at 1st, 2nd, 5th, 10th, 20th, 50th, 100th, 500th epochs instead of every epoch.
After 500 epochs, we update the data reﬁnement block per each 500th epoch.
Each run of experiments requires a single V100 GPU.
Additional discussions can be found in Appendix A.10.
4. E XPERIMENTS ON T ABULAR D ATA
Datasets.
Following [7, 60], we test the efﬁcacy of SRR on a variety of tabular datasets, including
KDDCup, Thyroid, or Arrhythmia from the UCI repository [3].
We also use KDDCup-Rev, where the labels of KDDCup are reversed so that an attack represents anomaly [60].
To construct data splits, we use 50% of normal samples for training.
In addition, we hold out some anomaly samples (amounting to 10% of the normal samples) from the data.
This allows us to simulate unsupervised settings with an anomaly ratio of up to 10% of entire training set.
The rest of the data is used for testing.
1 We conduct experiments using 5 random splits and 5 random seeds, and report the average and standard deviation of 25 F1-scores (with scale 0-100) for the performance metric.
Models.
We mainly compare with GOAD [7] (the state-of-the-art AD model in the tabular domain) and implement SRR on top of it.
GOAD utilizes random transformation classiﬁcation as the pretext task of self-supervised learning, and the normality score is determined by whether transformations are accurately included in the transformed space of the normal samples.
We re-implement GOAD [7] with a few modiﬁcations.
First, instead of using embeddings to compute the loss, we use a parametric classiﬁer, similarly to augmentation prediction [51].
Second, we follow the two-stage framework [51] to construct deep OCCs.
For the clean training data setting, our implementation achieves 98.0 for
KDD, 95.0 for KDD-Rev, 75.1 for Thyroid, and 54.8 for Arrhythmia F1-scores, which are comparable to those reported in [7].
Please see Appendix A.3 for formulation and implementation details.
[Figure]
Results.
We show results of GOAD (the baseline) and GOAD with SRR in Fig.
The ranges of the noise ratio are set to 0% for the anomaly ratios in the original dataset (if anomaly ratios are larger than 10%, we set the maximum anomaly ratio as 10%).
For KDD-Rev, we set the maximum anomaly ratio to 2.5% because the performance of GOAD (without SRR) drops signiﬁcantly even with a small ratio of anomalies in the training data.
Fig.
4 shows that integrating SRR signiﬁcantly improves GOAD (the state-of-the-art methods for tabular OCC).
The improvements are more signiﬁcant especially at higher anomaly ratios.
This underlines how SRR can achieve signiﬁcant improvements for both small (Thyroid & Arrhythmia) and large-scale datasets (KDD & KDD-Rev).
4. E XPERIMENTS ON I MAGE D ATA
Datasets.
We evaluate SRR on visual AD benchmarks, including CIFAR-10 [29], f-MNIST [56],
Dog-vs-Cat [19], and MVTec [8].
For CIFAR-10, f-MNIST, and Dog-vs-Cat datasets, samples from one class are set to be normal and the rest from other classes are set to be an anomaly.
Similar to the experiments on tabular data in Section.
4.1, we swap a certain amount of the normal training data with anomalies given the target anomaly ratio.
For MVTec, since there are no anomalous data available for training, we borrow 10% of the anomalies from the test set and swap them with normal samples in the training set.
Note that 10% of samples borrowed from the test set are excluded from evaluation.
For all datasets, we experiment with varying anomaly ratios from 0% to 10%.
We use area under ROC curve (AUC) and average precision (AP) metrics to quantify the performance for visual AD (with scale 0-100).
When computing AP, we set the minority class of the test set as label 1 and majority as label 0 (e.g., normal samples are set as label 1 for CIFAR-10 experiments as there are more anomaly samples that are from 9 classes in the test set).
We run all experiments withrandom seeds and report the average performance for each dataset across all classes.
Per-class AUC and AP are reported in Appendix A.4.
Models.
For semantic AD benchmarks, CIFAR-10, f-MNIST, and Dog-vs-Cat, we compare the
SRR with two-stage OCCs [51] using various representation learning methods, such as distributionaugmented contrastive learning [51], rotation prediction [23, 28] and its improved version [51], and denoising autoencoder.
For MVTec benchmarks, we use CutPaste [33] as a baseline and compare to its version with SRR integration.
For both experiments, we use the ResNet-18 architecture, trained from random initialization, using the hyperparameters from [51] and [33].
The same model and hyperparameter conﬁgurations are used for SRR with K = 5 classiﬁers in the ensemble.
We set γ as twice the anomaly ratio of training data.
For 0% anomaly ratio, we set γ as 0.5.
Finally, a Gaussian
Density Estimator (GDE) on learned representations is used as OCC.
[Figure]
Results.
Fig.
5 shows a signiﬁcant performance drop with increased anomaly ratio, regardless of representation learning.
For example, the AUC of distribution-augmented contrastive representation [51] drops from 92.1 to 83.6 when anomaly ratio becomes 10%.
Similarly, the improved rotation prediction representation [28] drops from 90.0 to 84.1.
On the other hand, SRR effectively handles the contamination in the training data and achieves 89.9 AUC with 10% anomaly ratio, reducing the performance drop by 74.1%.
An ‘oracle’ upper bound would be the removal of all anomalies from the training data (which is the same as the performance at 0% anomaly ratio for the same size of the data).
As Fig.
5 shows, the performance of SRR is similar to this oracle upper bound performance (less than 2.5 AUC difference) even with high anomaly ratios (10%).
The results are also similar in other metrics, such as AP in Fig.
5 or Recall at Precision of 70 and 90 in Fig.
9 in the Appendix.
We repeat experiments on 3 additional visual AD datasets and report results in Fig.
We observe consistent and signiﬁcant improvements over the baseline across different datasets and different one-class classiﬁcation methods.
Note that the improvement is more signiﬁcant at higher anomaly ratios.
For instance, on MVTec dataset, SRR improves AUC by 4.9 and AP by 7.1 compared to the state-of-the-art CutPaste OCC with an anomaly ratio of 10%.
In the Appendix (Sec.
A.4), we also illustrate per-class performance of SRR compared with the state-of-the-art. [Figure] i [Figure]
i
[Figure]
4. P ERFORMANCE A NALYSES
In this section, we conduct sensitivity analyses on two hyperparameters of SRR, namely, the number
K for ensemble OCCs and the percentile threshold γ that determines normal and anomalies in the data reﬁnement module.
In addition, we show the importance of updating the representation with reﬁned data.
Ablation studies are conducted on two visual AD benchmarks, CIFAR-10 and MVTec.
More experimental results and discussions can be found in the Appendix.
4.3. S ENSITIVITY TO H YPERPARAMETERS
SRR is designed for unsupervised AD and it is important to ensure robust performance against changes in the hyperparameters as model selection without labeled data would be very challenging.
Fig.
7 presents the sensitivity analyses of SRR with respect to various hyperparameters.
In Fig.
7a, we observe the performance improvement as we increase the number of classiﬁers for ensemble.
This is particularly effective on CIFAR (top in Fig.
7a), where the number of samples in the training data is large enough that even with large K , the number of samples to train each OCC ( N/K ) would be sufﬁcient.
In Fig.
7b, we observe that SRR performs robustly when γ is set to be larger than the actual anomaly ratio (10%).
When γ is less than 10%, however, we see a signiﬁcant drop in performance, all the way to the baseline ( γ = 0 ).
Our results show that SRR improves upon baseline regardless of the threshold.
In addition, it suggests that γ could be set to be anywhere from the true anomaly ratio and and 2x the anomaly ratio to maximize its effectiveness.
When the true anomaly ratio is unknown, as discussed in Appendix A.5, Otsu’s method could be used.
4.3. I TERATIVELY U PDATING R EPRESENTATIONS WITH R EFINED D ATA
It is possible to decouple representation learning and data reﬁnement of SRR, which would result in a three-stage framework, where we learn representations until convergence without data reﬁnement, followed by the data reﬁnement and learning OCC.
Fig.
7c shows that SRR using a pre-trained then ﬁxed representation (i.e. when data reﬁnement is used for OCC only) already improves the performance upon the baseline with no data reﬁnement at any stage of learning representation or classiﬁer.
Improvements on CIFAR-10 are 4.9 in AUC and 8.0 in AP; and on MVTec are 1.3 in AD and in 1.3 in AP.
This underlines the effectiveness of our data reﬁnement module.
More results on applying SRR on raw tabular features or learned (and ﬁxed) visual representations are provided in
Appendix A.2.
Moreover, we ﬁnd that learning representation with reﬁned data plays a crucial role, resulting in another improvement in AUC by 1.4, AP by 4.5 on CIFAR-10, and AUC by 3.2, AP by 4.8 on MVTec, upon a SRR using a ﬁxed representation.
[Figure]
A v e r a g e
P r e c
i s i o n
[Figure]
[Figure] [Figure]
A v e r a g e
P r e c
i s i o n
[Figure]
without representation update.
4. Q UANTIFYING THE R EFINEMENT E FFICACY
We evaluate how many normal and anomalies are excluded by the proposed data reﬁnement block.
As in Fig.
8(a, b)
[Figure]
with data reﬁnement [Figure] we can exclude more than 80% of anomalies in the training set without removing too many normal samples. For instance, among 4% anomalies in CIFARdata, SRR is able to exclude 80% anomalies while removing less than 20% normal samples.
Such a high recall of anomalies of SRR is not only useful for unsupervised AD [Figure] but also could be useful for improving the annotation efﬁciency when a budget for active learning is available.
Fig.
8(c, d) demonstrates the removed normal and abnormal samples by the data reﬁnement module over training epochs.
It shows that better representation learning (as training epochs increase) consistently improves the efﬁcacy of the data reﬁnement
[Figure]
{+a n o m a l o u s s a m p l e s ( % ) 22 2428 
 R e m o v e d n o r m a l s a m p l e s ( % ) (d) MVTec+}
C ONCLUSION
AD has wide range of practical use cases.
A challenging and costly aspect of building an AD system is that anomalies are rare and not easy to detect by humans, making them difﬁcult to label.
To this end, we propose a novel AD framework to enable high performance AD without any labels called SRR.
SRR can be ﬂexibly integrated with any OCC, and applied on raw data or on a trainable representations.
SRR employs an ensemble of multiple OCCs to propose candidate anomaly samples that are reﬁned from training, which allows more robust ﬁtting of the anomaly decision boundaries as well as better learning of data representations.
We demonstrate the state-of-the-art AD performance of SRR on multiple tabular and image data.
E THICS S TATEMENT
SRR has the potential to make signiﬁcant positive impact in real-world AD applications where detecting anomalies is crucial, such as for ﬁnancial crime elimination, cybersecurity advances, or improving manufacturing quality.
We note a potential risk associated with using SRR: when representations are not sufﬁciently good, there will be a negative cycle of reﬁnement and representation updates/OCC.
While we rely on the existence of good representations, in some applications they may be difﬁcult to obtain (e g., cybersecurity).
This paper focuses on the unsupervised setting and demonstrates strong
AD performance, opening new horizons for human-in-the-loop AD systems that are low cost and robust.
We leave these explorations to future work.
R EPRODUCIBILITY S TATEMENT
The source code of SRR will be published upon acceptance.
For reproducibility, we only use public tabular and image datasets to evaluate the performances of SRR.
Complete descriptions of those datasets can be found in Datasets subsections in Sec.
4.1 and 4.2.
Detailed experimental settings and hyperparameters can be found in Models subsections in Sec.
4.1 and 4.2.
The implementation details (including hyperparameters that we used) on GOAD [7] are described in Sec.
A.
A A PPENDIX A. A DDITIONAL RESULTS WITH DIFFERENT METRICS
There are various performance metrics of OCCs.
In the main manuscript, we mainly use AUC,
Average Precision (AP) and F1-score as the evaluation metrics.
In this subsection, we report the performances of the proposed model (SRR) and baselines in terms on Recall at Precision 70 andas the additional metrics on CIFAR-10 dataset. [Figure]
As in Fig.
[Figure] we observe a similar trends with these two additional metrics as well.
For example, the performances of SRR are robust across various anomaly ratios.
On the other hand, all the other
OCCs show consistent and signiﬁcant performance degradation as the anomaly ratio increases. SRR performs 15.8 and 10.9 better than the state-of-the-art OCC [51] in terms of recall at precision 70 and 90, respectively.
A. SRR ON RAW TABULAR FEATURES / LEARNED IMAGE REPRESENTATIONS
[Figure]
[Figure] SRR is also applicable on raw tabular features or learned image representation without representation update using data reﬁnement.
In this section, we demonstrate the performance improvements by SRR without representation update to verify the effectiveness of data reﬁnement block of SRR for shallow
OCCs.
Fig.
10 (upper) demonstrates consistent and signiﬁcant performance improvements when we apply
SRR on top of raw tabular features.
Speciﬁcally, the Average Precision (AP) improvements are 10.2, 29.0, and 4.1 with KDD-Rev, Thyroid, and Arrhythmia tabular datasets, respectively.
We also apply SRR on top of various learned image representations.
As can be seen in Fig.(lower), the performance improvements of SRR are consistent across various different learned image representations (without representation update).
For instance, the AP improvements are 9.2, 1.0, and 12.1 with learned image representations using RotNet [23], Rotation [28], and Contrastive [51], respectively.
A. I MPLEMENTATION D ETAILS ON GOAD [7] FOR T ABULAR D ATA E XPERIMENTS
A classiﬁcation-based AD method, GOAD [7], has demonstrated strong AD performance on tabular datasets.
Unlike previous works [23, 26] that formulate a parametric classiﬁer for multiple transformation classiﬁcation, GOAD employs distance-based classiﬁcation of multiple transformations.
For the set of transformations T m : X → D , m = 1 , ..., M , the loss function of GOAD is written as in equation 3 with the probability deﬁned in equation 4.
[Equation]
4) where the centers c m ’s are updated by the average feature over the training set.
While it is shown to perform well [7], we ﬁnd that the distance-based formulation is not necessary, and we achieve the similar performance, if not worse, to [7] using a parametric classiﬁer when computing the probability:
[Equation]
The formulation in equation 5 is easier to optimize than its original form in equation 4 as it can be fully optimized with backpropagation without alternating updates of feature extractor f and centers c m .
Once we learn a representation by optimizing the loss in equation 3 using equation 5, we follow a two-stage one-class classiﬁcation framework of [51] to construct a set of Gaussian density estimation
OCCs for each transformation.
Finally, we aggregate a maximum normality scores from a set of classiﬁers as the normality score.
In Table 1, we summarize the implementation details, such as network architecture or hyperparameters, and AD performance under clean training data setting that reproduces the results in [7].
[Table]
Our implementation demonstrates comparable, if not worse, performance to those reported in [7].
Our implementation also shares most hyperparameters across datasets except the M , the number of transformations, and the train steps, which are closely related to the size of training data.
A. P ER - CLASS AUC AND AP
In the main manuscript, we report the mean and standard deviation of AUC and AP across all classes in each dataset.
In this section, we report the mean and standard deviation of AUC and AP for each class in each dataset (including CIFAR-10 (Table 2), MVTec (Table 3), fMNIST (Table 4), and
Dog-vs-Cat (Table 5) datasets)
. A.4. P ER - CLASS AUC AND AP ON CIFAR-10 DATASET
[Table]
A.4. P ER - CLASS AUC AND AP ON MVT EC DATASET
[Table]
Cable
[Table]
Capsule
[Table]
Hazelnut
[Table]
Metal Nut
[Table]
Screw
[Table]
Toothbrush
[Table]
Transistor
[Table]
Zipper
[Table]
Carpet
[Table]
Leather
[Table]
Tile
[Table]
[Table] [Table]
[Table]
A. SRR WITH O TSU ’ S METHOD
In the main manuscript we show that the performances of the proposed unsupervised anomaly detection framework (SRR) are signiﬁcantly better than the state-of-the-art OCCs if the given data is fully unlabeled.
Although SRR does not need any labeled data, it needs a true anomaly ratio for hyper-parameter optimization.
In this subsection, we further extend SRR to the setting where there is no access to the true anomaly ratio as well.
We utilize the Otsu’s method [49] to identify the threshold between normal and anomalous samples and use that as the hyper-parameter ( γ ) instead of twice of the true anomaly ratio.
Note that other previous works [5, 42, 55] also utilized intra-variance minimization, in a similar vein to Otsu’s method, for determining the threshold for data reﬁnement.
The key idea of the Otsu’s method is to ﬁnd the threshold that minimizes the intra-class variance.
This is deﬁned as the weighted sum of variances of the two classes.
Let us denote the normality scores as { s i } Ni =1 and threshold as η .
Then, we try to ﬁnd the threshold ( η ) that minimizes the weighted sum of the variance ( w 0 ( η ) × σ 0 ( η ) + w 1 ( η ) × σ 1 ( η )) where w 0 ( η )
=
(cid:80) Ni
=
I ( s i < η ) /N and w 1 ( η ) =
(cid:80) Ni
=
I ( s i ≥ η ) /N .
σ 0 ( η ) and σ 1 ( η ) are the variances of each class.
The optimal threshold ( η ∗ ) is determined as
[Equation]
We use the twice of η ∗ as the hyperparameter ( γ ) in SRR.
We evaluate the performances of Otsu’s method (on top of SRR) in comparison to the state-of-the-art
OCC [33] and original SRR with the knowledge of the true anomaly ratio using MVTec dataset.
[Figure]
Fig.
11 demonstrates that even without true anomaly ratio, the performance of SRR can be signiﬁcantly better than the state-of-the-art OCC [33] with Otsu’s method.
Also, Fig.
11 shows that the knowledge of true anomaly ratio is crucial information for maximizing the performance of SRR in fully unsupervised settings.
We further extend the experimental results using Otsu’s method with other datasets such as CIFARand Thyroid datasets.
Table 6 are the overall results - Otsu’s method yields only slight degradation compared to SRR with true anomaly ratio; however, it still signiﬁcantly outperforms SOTA OCC baselines.
[Table]
A. A DDITIONAL ABLATION STUDIES
To better understand the source of gains, we include comparisons between the ﬁnal ensemble model on the converged self-supervised extractor (SRR without ﬁnal OCC) with the proposed SRR (using an additional ﬁnal OCC).
Also, to further support the novelty of SRR, we report additional experimental results only with ensemble model without data reﬁnement (Ensemble Only).
As can be seen in Table 7, the proposed version of SRR (with an additional ﬁnal OCC) outperforms signiﬁcantly, which is attributed to the fact that while ﬁtting the individual OCC models in the ensemble, we do not exclude the possible anomaly samples for diversity of the trained submodels, so the anomaly decision boundaries can be ﬁtted robustly.
Therefore, the ensemble model can be somewhat less accurate for classifying difﬁcult samples (near the decision boundary between normal and abnormal) compared to the ﬁnal OCC used (that is trained with only normal samples).
Also, employment of ensemble learning without data reﬁnement (Ensemble only), yields much worse performance than the proposed method (SRR), underlining the importance of the core data reﬁnement idea of SRR.
[Table]
[Table]
A. A DDITIONAL BASELINES
We add extra baselines from robust anomaly detection literature: Standard PCA [54], Robust PCA [15] and Local Outlier Factor (LOF)
[13] for tabular data and Robust autoencoder (Robust AE) [59] for image data.
As can be seen in Table
[Table]
the performance of PCA and LOF are highly degraded even with a small amount of anomalies in the training data.
For Robust PCA and Robust AE, the performance degradation is less but still signiﬁcant in comparison to SRR.
Overall, SRR outperforms other benchmarks in fully unsupervised settings, underlining the importance of data reﬁnement in improving the robustness to anomaly ratio in training data, as the core constituent of SRR framework
[Table]
F tabular
A. C ONVERGENCE GRAPHS
The proposed SRR framework is converged when the iterative training of the self-supervised learning is converged.
Depending on the data reﬁnement model training, corresponding self-supervised models are also trained with differently reﬁned training data.
Usually, the data reﬁnement model and self-supervised models converge after a similar number of epochs.
Fig.
12 illustrate the convergence graphs of SRR with MVTec and CIFAR-10 datasets.
[Figure]
A. A DDITIONAL DISCUSSIONS : R ELATED WORKS FOR DATA REFINEMENT
In this subsection, we further discuss the related works [5, 42, 55] for data reﬁnement that we brieﬂy mentioned in Section 2.
We highlight the differences between SRR and [5, 42, 55] below.
First, [5, 55] are based on auto-encoders and they directly utilize the reconstruction errors as informative signals for anomaly detection and iterative data reﬁnement.
However, prior work [43] discovered that the reconstruction is not a good informative signal for outlier detection.
Also as shown in Fig.
5, the performance of DAE (reconstruction errors based anomaly detection model) works much worse than alternatives.
Second, SRR utilizes ensemble learning for data reﬁnement to improve the robustness which is critical in unsupervised anomaly detection.
On the other hand, [5, 42, 55] utilize a single model for data reﬁnement.
As can be seen in Fig.
7a, the impact of the ensemble model for data reﬁnement is signiﬁcant.
Third, [5, 42, 55] directly utilize the (pseudo) abnormal samples for model training in addition to (pseudo) normal samples.
For instance, the model in [42] is trained via two-class ordinal regression where two classes come from (pseudo) normal and (pseudo) abnormal samples.
Directly relying on the (imperfectly) labeled abnormal samples can be harmful for the anomaly detection due to the overﬁtting problems and high False Positive Rates (FPR) in (pseudo) abnormal samples.
For instance, with 80% of the recall (for the abnormal sample discovery), the precisions (for the abnormal sample discovery) are 28.2% for CIFAR-10 and 31.7% with MVTec datasets (with 6% abnormal ratio) using
SRR framework.
It means that the majority of the (pseudo) abnormal samples are actually the normal samples (71.8% for CIFAR-10 and 68.3% for MVTec datasets).
This would be strong evidence that directly utilizing the (pseudo) abnormal samples for training can be harmful.
Lastly, [42, 55] are based on the end-to-end anomaly detection models which are empirically less accurate than two-stage models [51].
A. A DDITIONAL DISCUSSIONS : C OMPUTATIONAL COMPLEXITY
Note that when applying SRR on top of representation learning, the computational complexity of the representation learning part is not changed.
With SRR, the additional computations come from training the ensemble models on top of learned representations.
Note that we use shallow one-class classiﬁers (such as GDE or one-class SVM) for submodels; thus, the additional computational complexity is marginal.
We would like to mention that all the experiments are done on a single V
GPU and each experiment needs at most 12 hours for training (the additional training time caused by the SRR framework is an average 13.1% of the total training time).
The computations of the ensemble parts can be further improved by the model parallelization.