Y OU M AY N EED BOTH G OOD -GAN AND B AD -GAN FOR A NOMALY D ETECTION
Anonymous authors
Paper under double-blind review
A BSTRACT
Generative adversarial nets (GAN) have been successfully adapted for anomaly detection, where end-to-end anomaly scoring by so-called Bad-GAN has shown promising results.
A Bad-GAN generates pseudo anomalies at the low-density area of inlier distribution, and thus the inlier/outlier distinction can be approximated.
However, the generated pseudo anomalies from existing Bad-GAN approaches may (1) converge to certain patterns with limited diversity, and (2) differ from the real anomalies, making the anomaly detection hard to generalize.
In this work, we propose a new model called Taichi-GAN 1 to address the aforementioned issues of a conventional Bad-GAN.
First, a new orthogonal loss is proposed to regularize the cosine distance of decentralized generated samples in a Bad-GAN.
Second, we utilize few anomaly samples (when available) with a conventional
GAN, i.e., so-called Good-GAN, to draw the generated pseudo anomalies closer to the real anomalies.
Our Taichi-GAN incorporates Good-GAN and Bad-GAN in an adversarial manner; which generates pseudo anomalies that contributing to a more robust discriminator for anomaly scoring, and thus anomaly detection.
Substantial improvements can be observed from our proposed model on multiple simulated and real-life anatomy detection tasks.
I NTRODUCTION
Anomaly detection (AD), a.k.a.
outlier detection, refers to detecting uncommon samples (usually heterogeneous) out of inlier distribution (ChandolaVarun et al., 2009; Pang et al., 2021a).
AD can be performed either in an unsupervised manner when only inliers are involved during the training process (Schlegl et al., 2019;
Ngo et al., 2019; Ruff et al., 2018), or in a semi-supervised manner when few labeled anomalies are available (Ruff et al., 2020b; Liznerski et al., 2021).
Generative
adversarial nets (GAN) (Goodfellow et al., 2014) are considered the most effective generative models nowadays, which have also been applied for AD (Schlegl et al., 2017; 2019; Zenati et al., 2018b; Siddiquee et al., 2019; Perera et al., 2019).
Likewise, one-class classiﬁcation and its variants are often used as the backbone of AD approaches (Sch ¨ olkopf et al., 2001; Ruff et al., 2018;
Liznerski et al., 2021; Wu et al., 2019).
Recently, the adversarial training and one-class classiﬁcation have been leveraged together to discriminate inlier/outlier in an end-to-end manner (Zheng et al., 2019; Ngo et al., 2019).
Such efforts share a similar spirit with the work introduced in Dai et al.
and here we call them Bad-GANs.
Instead of generating samples to match the training data distribution as a conventional GAN (Goodfellow et al., 2014) that we refer as Good-GAN in this paper, a Bad-GAN pushes its generated samples towards the peripheral area of the training data distribution and considers them as pseudo anomalies.
Rather than deﬁning anomaly scores based on 1) the residual between reconstructed and original samples such as AnoGAN series (Schlegl et al., 2017; 2019), or 2) existing one-class classiﬁcation-based measures such as Deep SVDD (Ruff et al., 2018) and FCDD (Liznerski et al., 2021), Bad-GANs directly leverage the learned discriminator to identify unseen anomalies from normal cases.
Although Bad-GANs have shown great potentials, they suffer from several disadvantages.
Dis1 : the generated samples can converge to limited patterns rather than being heterogeneous as real anomalies;
Dis2 : it is hard to ensure generated samples to resemble real anomalies, while abundance of irrelevant pseudo anomalies may negatively affect the discrimination of real anomalies; Dis3 : no application has been found to integrate labeled anomalies in prior-art Bad-GANs.
In this work, we propose a new Taichi-GAN to address aforementioned disadvantages.
First , based on a state-of-the-art Bad-GAN (FenceGAN (Ngo et al., 2019)) framework, an orthogonal loss is proposed to increase the angular diversity, which addresses Dis1 , and partially relieves Dis2 by increasing the overlap between generated pseudo anomalies and real anomalies.
Second , we are the ﬁrst to incorporate Good-GAN within a Bad-GAN framework, where the Good-GAN contributes to generating pseudo anomalies guided by few real anomalies, which addresses Dis2 and Dis3 .
Our model is termed Taichi-GAN, as the Good-GAN and Bad-GAN are integrated in a competing yet balanced manner to generate pseudo anomalies towards better AD.
We illustrate our ideas with 2D synthetic data and validate the proposed model with ﬁve datasets including clinical applications.
R ELATED WORKS
Shallow AD models have their limitations in dealing with high-dimensional data and large-scale datasets (Ruff et al., 2020b).
Here we focus on the most related deep AD approaches.
Reconstruction-error-based (REB) Model .
REB approaches have been widely applied to imagebased AD, where auto-encoder (Sato et al., 2018;
Baur et al., 2018; Chen & Konukoglu, 2018) or GAN (Schlegl et al., 2017; 2019; Zenati et al., 2018b; Siddiquee et al., 2019; Akcay et al., 2018; Zenati et al., 2018a) is typically used for reconstruction.
REB methods assume that anomalies would not be well reconstructed when the model is only trained with normal samples.
Therefore, the reconstruction errors can be used to evaluate the abnormality.
AnoGAN (Schlegl et al., 2017) is a representative REB approach which learns a manifold of anatomical variability and detects the anomalies with reconstruction errors mainly on pixel level.
F-AnoGAN (Schlegl et al., 2019) follow the same framework as AnoGAN with improved processing speed.
Han et al. (2021) ensemble multiple GANs for AD. However, REB approaches are mainly designed for data synthesis rather than AD, which may limit their comprehension for heterogeneous anomalies.
One-class Classiﬁcation-based Measure (OCCBM) .
OCCBM approaches (Ruff et al., 2018; Wu et al., 2019; Ruff et al., 2020b; Chalapathy et al., 2018) learn one-class embedding from normal samples to measure the derivation of an unseen case from the inlier distribution, where the measurement is then served for AD purposes.
Deep OCCBM models extend the classical one-class models, e.g., one-class SVM (Sch ¨ olkopf et al., 2001) and SVDD (Tax & Duin, 2004), by extracting features via deep nets (Ruff et al., 2018; Liznerski et al., 2021).
OCCBM methods have been deployed to sophisticated applications, e.g., detecting anomalous event in practical scenes (Wu et al., 2019).
Bad-GANs .
The Bad-GAN idea (Dai et al., 2017) is introduced for semi-supervised learning in multi-class classiﬁcation.
Similar approaches are found in the scope of the AD such as Sabokrou et al.
; Lim et al.
; Zheng et al.
; Ngo et al.
Such techniques are termed as Bad-GANs in this paper.
The key idea of Bad-GANs is to learn a classiﬁer (i.e., the discriminator) based on inliers and generated pseudo outliers during training so that it can distinguish unseen outliers and inliers during inference.
Bad-GANs belong to the one-class classiﬁcation family and can be trained end-to-end.
In addition, it does not require a manually deﬁned one-class classiﬁcation measure as OCCBM models (Pang et al., 2021a); the Bad-GAN discriminator handles the measure.
AD Models Utilizing Real Anomalies .
Deep SAD (Ruff et al., 2020b) and ESAD (Huang et al., 2020) extend the Deep SVDD (Ruff et al., 2018) to take advantage of labeled anomalies.
Siddiquee et al.
(2019) propose a REB model for AD by considering normal and anomalies as two “styles” via image-to-image translation techniques.
Few-shot learning and reinforcement learning are adapted to utilize limited label information, respectively (Tian et al., 2020; Pang et al., 2021b).
M ETHOD 3. B ACKGROUND : G OOD -GAN AND B AD -GAN
GANs (Goodfellow et al., 2014) train generative models using a minimax game, which generate data instances from a noise distribution z ∼ p z to match the given data distribution p data by iteratively optimizing a generator G and a discriminator D with the following objective:
[Equation]
Dai et al.
(2017) introduce the concept of the Bad-GAN that generates samples at the periphery of the training data.
The generator is optimized by minimizing E x ∼
[Equation]
G log p
[Equation]
( x ) I [ p data ( x ) > (cid:15) ] , where I [ x ] is an indicator function.
With a threshold (cid:15) ∈ (0 , 1) , the training process penalizes the high-density samples and leaves the low-density ones unaffected, where the data distribution p data of
Dai et al.
(2017) is estimated with an additional model PixelCNN++ (Salimans et al., 2017).
The more recent FenceGAN (Ngo et al., 2019) shares the similar spirit of Dai et al.
(2017), which generates samples at the boundary of a normal distribution.
FenceGAN gets rid of the additional intensity estimation model as in Dai et al.
(2017), and thus formulates an end-to-end training process.
The generator loss 2 on the batch with size N is deﬁned as:
[Equation]
where BCE ( A, B ) is the binary cross-entropy between A and B .
The ﬁrst term is the dispersion loss which regularizes generated samples to be distant from their center µ .
The hyperparameter α is a discriminative anomaly score that pushes generated pseudo anomalies on inlier distribution boundary and β is the so-called dispersion hyperparameter.
The discriminator loss is deﬁned as:
[Equation]
where γ ∈ (0 , 1] is the so-called anomaly hyperparameter.
The discriminator is used to compute an anomaly score ranged (0,1) for each unseen case during the inference stage.
3. O RTHOGONAL L OSS
As anything not normal is deﬁned as an anomaly and anomalies are heterogeneous (Ruff et al., 2020b), we hypothesize that generated pseudo anomalies in a Bad-GAN framework should have high diversity to cover as many abnormal patterns as possible.
Dispersion loss (Ngo et al., 2019)
( L d in
Fig. 1) regularizes generated pseudo anomalies lying at boundary of inlier distribution.
Here, we propose to push pseudo anomalies further distributed to evenly cover the entire angular space.
[Equation]
[Figure]
As veriﬁed in empirical experiments, the generated samples from a Bad-GAN can be prone to speciﬁc patterns, even with the Euclidean dispersion regularization of FenceGAN (Ngo et al., 2019).
We introduce an orthogonal loss L orth to expand generated samples from the angular perspective.
As depicted in Fig.
1, paired samples with smaller angles (left in Fig. 1) to each other can have a larger penalty given the orthogonal regularization.
The orthogonal regularization has been used for weight initialization and optimized on deep features (Brock et al., 2017; Arjovsky et al., 2015; Zhao et al., 2016).
Here, we deﬁne our L orth in a decentralized way and optimized on generated pseudo anomalies in an AD framework:
[Equation]
Instead of optimizing on the commonly used Euclidean distance and individual regularization (e.g., the dispersion term of Ngo et al.
(2019) and the losses in OCCBM models (Ruff et al., 2018; 2020a;b)), our proposed orthogonal loss leverages Cosine distance and relational regularization 3 to be complementary to the dispersion term in the Bad-GAN framework.
3. T HE INTUITION OF ADDING G OOD -GAN TO B AD -GAN
As Good-GANs optimize generated samples to match the training distribution, given few real anomalies are available, we take this Good-GAN nature to guide pseudo anomaly generation in
AD tasks.
Simultaneously, to avoid generated samples overﬁtting to limited anomaly patterns, we balance the Good-GAN and the Bad-GAN (including L orth ) with a hyperparameter δ .
Speciﬁcally, the Good-GAN guides the generated pseudo anomalies to resemble the reference distribution from given real anomalies, while the Bad-GAN regularizes pseudo anomalies at the boundary of inlier distribution.
The Good-GAN and the Bad-GAN share the same generator, and have their own discriminators separately.
The overall objective is deﬁned as follows:
[Equation]
Bad-GAN +
[Equation]
orth (cid:124)
[Equation]
angular diversity +
[Equation]
gd (
[Equation]
D
[Equation]
) (cid:124) (cid:123)(cid:122) (cid:125) Good-GAN } (5) where V bd and V gd are the objective functions of the Bad-GAN and Good-GAN, respectively.
G is the shared generator.
D bd and D gd are discriminators of Bad-GAN and Good-GAN, respectively.
The generated samples serve as pseudo anomalies to train a classiﬁer (i.e., D bd ) to discriminate unseen real anomalies from inliers during inference.
L orth is the proposed orthogonal loss to further increase the diversities of pseudo anomalies.
The overall model (Eq. 5) is termed as Taichi-GAN.
[Figure]
As shown in Fig.
2(a), the Bad-GAN generates samples along the boundary of the inlier distribution, however, with limited diversity, even including a dispersion loss on Euclidean distance space.
Adding a pull-away term (Zhao et al., 2016) (an orthogonal regularization without decentralization to the sample average) is also not effective in this AD framework as in Fig. 2(b).
The generated samples are more evenly distributed with the proposed orthogonal loss (Fig. 2(c)), which are more likely to cover samples that resemble real anomalies even though no real anomaly is included for training.
Further, when few labeled anomalies are available, the Good-GAN inclusion pushes the generated samples to have higher density near the given anomalies, meanwhile, L orth maintains high diversity to cover other potential anomaly patterns (Fig. 2(d)).
3. T HE PROPOSED T
[Figure]
-GAN
[Figure] [Figure]
Random
[Figure]
~'
[Figure]
* * + {*
[Figure]
, * + } / 0123 + / $+# / $+# / "
Training: !
$# ' +
Testing: {* }
[Figure]
generated anomaly forward backward * - : normal )* : generated * + : anomaly
[Figure]
Fig. 3(a) shows our motivation with inlier and (pseudo) outlier example from HAM10000 (Tschandl et al., 2018).
The upper depicts the training with only normal samples, where we target generating highly diverse samples (e.g., (1) vs. (2) in Fig. 3(a)) at the boundary of normal distribution.
The bottom shows the motivation on sample generation after adding few anomalies.
Besides keeping the diversity, some generated samples are close to known anomalies (e.g., (3) is close to (4)).
We borrow Bad-GAN components from FenceGAN.
The generator loss is deﬁned as follows:
[Equation]
The generator losses of Bad-GAN ( L badG ) and Good-GAN ( L goodG ), is consistent with the form of
Eq. 2 and shares the same spirit of Goodfellow et al.
(2014), respectively.
G denotes the generator,
D bd and D gd are the discriminators of Bad-GAN and Good-GAN, respectively.
L orth is the proposed orthogonal loss to increase the diversity from the angular perspective.
The loss of Good-GAN discriminator is deﬁned as: (Goodfellow et al., 2014):
[Equation] [Equation]
[Figure]
FashionMNIST
HAM
I n li e r
B a dG A N
B a d - G
A N + 𝐿 ! " # $
B a d - G
A N + 𝐿 ! " # $
G oo dG A N CIFAR
The loss of Bad-GAN discriminator is adapted from Ngo et al.
by adding a third term:
[Equation]
where x n and x a are normal (inlier) and anomaly (outlier) cases, respectively.
The third term includes real anomalies to train the discriminator of Bad-GAN.
η = 0 when no anomalies are available.
Note V bd and V gd (from Eq. 5) are composed of { L badG , L badD } (from Eq.
6 and Eq.
8) and { L goodG , L goodD } (from Eq.
and Eq. 7), respectively.
The procedures of Taichi-GAN are illustrated in Fig. 3(b).
The unsupervised training setting (no real anomalies) is performed with only the black text components (Bad-GAN + L orth ).
The red text components are added when few anomalies are available.
E XPERIMENTS
In addition to 2D synthetic data in Fig. 2, we involve ﬁve datasets to evaluate our method for AD.
MNIST, Fashion-MNIST, and CIFAR10 are popular in previous literature (Ruff et al., 2020b; Ngo et al., 2019; Lee et al., 2018).
HAM1000 and BraTS20 are medical datasets where the anomalies are well deﬁned clinically.
The Area Under the ROC Curve (AUC) (Fawcett, 2006) is used to evaluate the AD performance.
The reported AUCs are average values over three independent runs of each experiment using different random seeds.
Detailed network architectures, dataset splits, dataset sizes, model hyperparameters, and baseline implementations can be found in the Appendix A, B, and E.
4. D ATA AND S ETUP
MNIST (LeCun et al., 1998) contains 10 classes of digits (0-9).
As one-vs-rest setting (i.e., one class is inlier and the rest classes are outlier) in MNIST is proved to be easy (Ruff et al., 2018; 2020b), we consider the N-vs-rest setup.
Class 0-2 are formalized as normal set and class 3-9 are formalized as anomaly set in our main setting (Table 1).
Ablation studies considering different “N” and different amount of labeled anomalies are shown in Table 2 and Table 3, respectively.
Fashion-MNIST (Xiao et al., 2017) & CIFAR10 (Krizhevsky, 2009) use one-vs-rest setting that we select class “T-shirt” and “Airplane” as the normal class and the rest as anomalies, respectively.
HAM10000 (Tschandl et al., 2018) is a clinical-based dataset consisting of ∼ 10000 dermatoscopic images with skin lesions of seven classes.
The dominated class Melanocytic nevi ( > 70%) is a common benign skin lesion which is set as inlier and the rest as outliers.
BraTS20 (UPenn, 2020) is a recent version of BraTS challenge (Bakas, 2018).
Three types of anomalies are included: the GD-enhancing tumor, the peritumoral edema, and the necrotic and non-enhancing tumor core.
Here we simplify the problem to image-level disease detection motivated by (Siddiquee et al., 2019) in the AD setting.
We extract the 2D slices from T2-FLAIR volumes, where slices with anomaly annotations are considered as outliers and the rest as inliers.
Special handling and generated pseudo anomaly examples on BraTS20 can be found in Appendix D.
Labeled Anomalies for Training .
We categorize our experiments on each of the ﬁve data collections into two folds, i.e., “No anomalies available” and “Few anomalies available” (see Table 1).
For the latter fold, we include the following numbers of anomalies: MNIST , one sample per class in 3classes; Fashion-MNIST & CIFAR10 , one sample per class in classes except “T-shirt”; HAM10000 , ﬁve samples per class except “Melanocytic nevi”; BraTS20 , 300 slices with tumor from 5 scans.
Methods for Comparison .
When no anomalies are available, the benchmark methods include
OC-SVM (Sch¨olkopf et al., 2001)
(shallow AD model), Deep SSVD (Ruff et al., 2018), F-AnoGAN (Schlegl et al., 2019)
(reconstruction-error-based model), original badGAN (Dai et al., 2017), and
FCDD (Liznerski et al., 2021).
When few anomalies are available, representative methods using outlier exposure or semi-supervised learning are included for comparison.
FCDD+OE (Liznerski et al., 2021) integrates outlier exposure (OE) (Hendrycks et al., 2019) technique to utilize available real anomalies.
Deep SAD (Ruff et al., 2020b) generalizes the Deep SVDD to semi-supervised setting.
Two other naive approaches are included for benchmarking: (1) training a classiﬁcation model using BCE regardless of limited anomalies, and (2) involving the available anomalies in the
Bad-GAN discriminator training, i.e., Bad-GAN (semi).
Variants of Taichi-GAN .
We perform experiments on the following settings: 1 ) Bad-GAN only uses
FenceGAN, 2 ) Bad-GAN+ L orth includes orthogonal loss regularization, 3 ) Bad-GAN(semi) trains the discriminator with few labeled anomalies besides the normal samples and generated samples, 4 ) Bad-GAN(semi)+Good-GAN involves the Good-GAN training for sample generation on top of setting 3), 5 ) Taichi-GAN is our ultimate approach, equivalent to Bad-GAN(semi)+Good-GAN+ L orth .
Different settings serve as an approach-level ablation study.
4. B ENCHMARK R ESULTS
The AD performances on ﬁve datasets are reported in Table 1 across all benchmark methods and approach-level ablation settings described in Section 4.1.
The proposed methods achieve the highest AUCs in both folds where No and Few anomalies available.
Across all ﬁve datasets, we observe consistently that 1) the improvement from introducing orthogonal loss to Bad-GAN, 2) the improvement from leveraging few anomaly samples with a Good-GAN, and 3) Taichi-GAN including Good-GAN,
Bad-GAN, and orthogonal loss achieves the best performances.
Generated pseudo anomalies are shown in Fig.
4 and appendix Fig.
6 (bottom left).
With our orthogonal regularization, the generated samples are more diversiﬁed (3rd row vs. 2nd row).
When few anomalies are available, by incorporating the Good-GAN, the generated samples look closer to real anomalies and maintain reasonable diversity (indicated by green boxes in the fourth row).
Benchmark Analyses .
When no anomalies are available, increasing the diversity of generated samples with the proposed L orth effectively address Dis1 (e.g., +5.6% AUC in MNIST and visual contrast of 3rd row vs. 2nd row in Fig. 4).
Our proposed model achieves even better performance by integrating the Good-GAN to guide the pseudo anomaly generation in the Bad-GAN framework, and demonstrates the best effectiveness of consuming the limited labeled anomalies.
By doing so, Dis and Dis3 are effectively addressed.
[Table]
[Figure]
[Figure]
4. A BLATION S TUDIES
In addition to the approach-level ablation study mentioned in Variants of Taichi-GAN , three more ablation studies have been conducted: 1) different weights δ between the Good-GAN and Bad-GAN, 2) different deﬁnitions of inlier/outlier, and 3) different availabilities of anomaly samples.
Fig.
5 shows results using different weights δ on MNIST and Fashion-MNIST.
Note compared to
Bad-GAN (semi) , the Bad-GAN represents that the real anomalies (even when available) are not included in training D bd , thus the comparison between Bad-GAN+Good-GAN and Bad-GAN can better highlight the contribution of Good-GAN to AD tasks.
Table 2 shows results of different deﬁnitions on inlier/outlier.
The results of different available anomaly numbers/styles are shown in
Table 3.
Based on those ablation studies, we have further ﬁndings and analyses as follows:
(1) As in
Fig.
both too large and too
small δ
decrease the performance
of the Taichi-GAN.
Generated pseudo anomalies can over-ﬁt to few real anomalies (with limited patterns) with too large δ .
Contrastingly, too small δ decreases the efﬁcacy of the Good-GAN (converge to Bad-GAN only).
(2) Bad-GAN(semi) includes real anomalies in training D bd where the discrimination performance can be considerably affected by real anomalies, which does not directly show the efﬁcacy comparison of generated pseudo anomalies across methods.
By contrast, the value of the Good-GAN are more
[Table] [Table]
clearly highlighted in settings with Bad-GAN as in Fig.
5 (e.g., +9.0% AUC in MNIST when adding
Good-GAN to Bad-GAN, i.e., δ = 0 .
1 vs. δ = {+
+} in Bad-GAN+Good-GAN ).
(3) Results from Table 2 prove that our contributions of the orthogonal loss and the integration of Good-GAN make improvements to the baseline Bad-GAN consistently, while the degree of improvement varies in different settings and datasets (also supported by Table 1).
(4) When fewer anomalies are available (e.g., settings of “[3-6]*1” and “[3-9]*1” in Table 3), the performance gain from L orth and Good-GAN are more substantial (+ > 4% AUCs).
(5) As in Table 3, with increasing number of real anomalies (e.g., “[3-9]*20”), we ﬁnd 1) Bad-GAN (semi) can be less effective than BCE , and 2) the L orth does not necessarily improve the performance.
This indicates when available anomalies can already cover a reasonable number of relevant patterns, the generated samples from pure Bad-GAN could introduce noise and thus decrease the discrimination power of D bd .
The L orth is built upon Bad-GAN by increasing the angular diversity of generated samples, and therefore also less effective in this scenario.
This could be a limitation of the full-blown
Taichi-GAN when sufﬁcient diversity is already covered by the real anomalies.
Yet, as a variant of
Taichi-GAN, Bad-GAN(semi)+Good-GAN , remains most effective in this experiment.
C ONCLUSION
In this paper, we address two key aspects in the Bad-GAN framework for AD that 1) generated pseudo anomalies from the Bad-GAN should have high diversity, 2) available anomalies (even few) can be used to guide pseudo anomaly generation.
We propose a new Taichi-GAN that balances a “Good-GAN” with a “Bad-GAN” during training.
Evaluated on ﬁve datasets, our model achieves the most promising performance in AD tasks compared with representative state-of-the-art methods.
Instead of simply combine two types of GANs, Taichi-GAN value lies in the data efﬁciency as below.
Further Discussion .
The key point of end-to-end anomaly scoring is to train an effective classiﬁer (i.e., the discriminator of Bad-GAN) to distinguish unseen inliers and outliers, under the contexts that inliers are relatively sufﬁcient while no or few real outliers are available during training.
Therefore, the management of pseudo outlier generation is critical.
When no outliers are available, the Bad-GAN is trained to generate peripheral samples of the inlier distribution as pseudo outliers.
We validate in our experiments that higher sampling diversity achieved by the proposed orthogonal loss improves the quality of pseudo outliers towards a better classiﬁer in inference.
When few outliers are available, we demonstrate that the most effective way (compared with existing benchmarks with empirical experiments) of leveraging the available outliers is through our proposed Taichi-GAN, which enable the guidance from real outliers to the generation of pseudo outliers (e.g., the pseudo outlier boundary gets “thicker” near real outliers in Fig. 2(d)).
We believe the core ideas of this work can be extended to other unsupervised or highly imbalanced classiﬁcation tasks.
Ethics Statement.
The concepts and information presented in this paper are based on research results that are not commercially available.
Future commercial availability cannot be guaranteed.
R A B ASELINES AND H YPER -P ARAMETERS
For baselines of benchmark Table 1, we adapt their ofﬁcial public code into our datasets/settings:
OC-SVM: https://github.com/lukasruff/Deep-SVDD
Deep SSVD: https://github.com/lukasruff/Deep-SVDD-PyTorch
Original BadGAN: https://github.com/kimiyoung/ssl_bad_gan
FCDD, FCDD + OE: https://github.com/liznerski/fcdd
Deep SAD: https://github.com/lukasruff/Deep-SAD-PyTorch
FenceGAN: https://github.com/phuccuongngo99/Fence_GAN
For the Variants of Taichi-GAN mentioned in Section 4.1, we share the same network structure and hyper-parameter for the fair comparison.
We did not include additional data augmentation across all compared methods.
Our experiments are conducted with PyTorch 1.1.
Our hyper-parameters are highly motivated from FenceGAN (Ngo et al., 2019), as we use FenceGAN as the “Bad-GAN” in our model.
We follow the hyper-parameters of FenceGAN paper in MNIST, i.e., α = 0 .
9 , β = 30 , γ = 0 .
5 for Eq.(6-9).
Note that FenceGAN set α = 0 .
1 for MNIST since the normal cases are deﬁned as 0 and anomalies are deﬁned as 1 in their paper, which is equivalent to α = 0 .
9 in this paper.
For the balance hyper-parameter δ between “Bad-GAN” and “Good-GAN”, we set δ = 1 for MNIST, δ = 0 .
1 for Fashion-MNIST, HAM10000 and BraTS20.
An ablation study of different δ has conducted in Section 4.3.
If not speciﬁcally noted, the hyper-parameter η is set to 0.1.
B D ATA S PLITS
We use the same data splits and the same evaluation criteria for all compared methods for fair comparison.
Note that the splits and criteria in some of original ofﬁcial Github are different, we have made necessarily adaptions about the data loader and evaluation checkpoint.
The AUC results are reported on test sets.
Note that all normal samples in the training set will be used for training, while no or few anomalies are included depending on settings.
The general introduction of datasets can be found in Section 4.1.
The following is about data splits:
MNIST & Fashion-MNIST : Original training set of MNIST contains 60000 samples fromclasses.
We randomly split the original training set as 90% / 10% for training and validation splits.
We use the original test set as our test set, which contains 10000 samples.
The AUCs reported on test set and the model selected based on the performance of validation set. CIFAR10 : Original training set of MNIST contains 50000 samples from 10 classes. We randomly split the original training set as 90% / 10% for training and validation splits.
We use the original test set as our test set, which contains 10000 samples.
HAM10000 : The HAM10000 consists of 10015 dermatoscopic images can be used for academic machine learning purposes.
We split the HAM10000 dataset into training/validation/test split is 7001/1001/2013 samples for the AD task.
BraTS20 : All the data in our experiments are from 369 patients of original BraTS20 training set.
The training/validation/test splits are 12534/1351/2694 slices extracted from 280/30/59 patients.
C U SED METRIC DISCUSSION IN THIS PAPER
We use the Area Under receiver operating characteristic Curve (AUC) to evaluate the model’s performance.
We want to have an overall discrimination performance measurement to benchmark.
AUC is known for the discrimination comparison across models and widely used in related references such as Deep SVDD and FCDD.
When working on a speciﬁc application (which is not the target of this paper), for example, when there is a preference on less false positive rate or false negative rate, then precision / recall based metrics might be more preferred.
D S PECIAL H ANDLING OF B RA TS
Different from other three datasets, the intra-class variations can be larger than inter-class variations at pixel-level in BraTS20 (as the case in upper left Fig. 6), which increase the difﬁculty to learn a compact normal representation.
Instead of feeding original image to AD detection models, we create processed different maps with F-AnoGAN (Schlegl et al., 2019).
The advantages of creating the difference map include that all normal samples have the same ideal difference map (i.e., all-zero matrix), without the need to capture patterns of original images.
E N ETWORK S TRUCTURES
We adapt the demonstration style of Liznerski et al.
(2021) to show network structures in different datasets.
Table 4, 5 show the generator and discriminator of MNIST and Fashion-MNST.
Table 6,show
the generator and discriminator of HAM10000.
Table 8, 9 show the generator and discriminator of BraTS20.
F-anoGAN
Diff map Postprocess ! " #$ − ! Taichi-GAN
Anomalies are not used in training
F-anoGAN
Inference ! "
#$
G
Anomalies areused when the Good-GAN is included ! "
#$ : Original Image !
#&' : Reconstructed Image ! "
#$
[Table]
BatchNorm1d
[Table]
Linear
[Table]
BatchNorm1d [Table] Reshape- [-
[Table] [Table] ConvTranspose2d- [- [Table]
ReLU- 64, 14, 14]
BatchNorm2d- [-1, 64, 14, 14] ConvTranspose2d- [-1, 1, 28, 28]
Tanh- [-1, 1, 28, 28] Input shape: [-1, 200]
Total Params: 3.5M
Trainable Params: 3.5M
[Table] [Table]
BatchNorm2d- [-1, 64, 12, 12]
ConvTranspose2d- 24, 24]
ReLU- 24, 24] BatchNorm2d- 64, 24, 24]
ConvTranspose2d- 3, 48, 48]
Tanh- 3, 48, 48] Input shape: 200]
Total Params: 2.8M
Trainable Params: 2.8M
[Table]
[Table]
[Table]
ReLU- [-1, 64, 24, 24] ConvTranspose2d- [-1, 32, 48, 48]
BatchNorm2d- 32, 48, 48]
ReLU- 32, 48, 48]
ConvTranspose2d- 32, 96, 96]
BatchNorm2d- 32, 96, 96]
ReLU- 32, 96, 96]
Upsample- 32, 192, 192]
Conv2d- 192, 192]
Tanh- 192, 192]
Input shape: 256, 3,3]
Total Params: 2.7M
Trainable Params: 2.7M
[Table]