
Figure 1: The t-SNE visualization of the positive, generated hard negative and out-of-distribution samples for
the MNIST dataset. Distributions of generated hard negative examples are very close to those of positive samples.
With proper training of the classifier using positive and generated negative samples, the classifier learns the accurate
boundaries to distinguish between positive and out-of-distribution samples. As a result, out-of-distribution samples can
be recognized with a higher probability in the evaluation phase.
of a model is closely related to its ability to learn the representation of the positive class. One approach is using a
one-class classifier that learns the representation of the positive class such as one class SVM [
1
,
2
,
3
] and GAN-based
methods [
4
,
5
,
6
]. In the test phase, query samples with low classification scores for the positive class will be labeled as
negative. Another interesting direction is leveraging autoencoder to reconstruct the training examples in a GAN-based
model [
7
,
8
,
9
,
10
,
11
,
12
]. In this methods, the reconstructor tries to generate an authentic version of the input, and the
classifier attempts to distinguish between actual and reconstructed samples. A critical property of this variation of a
one-class classifier is that as the reconstructor is trained using positive samples, it will destroy negative examples in the
test phase, making it easier for the classifier to discriminate between two classes.
Our proposed model is close to the latter approach in terms of using reconstruction to make the negative samples more
distinguishable from the positive ones; however, there are several downsides that we addressed in a new formulation
of the problem by using a binary classifier in a non-GAN setting. The motivation behind this modification comes
from the fact that the significant performance improvement of these approaches comes from destroying the negative
samples in the reconstruction phase. In addition, training a GAN model is entangled with specific challenges. In order
to formulate the method as a GAN model, the input of a classifier will be reconstructed image, limiting learning the
representation of the positive class to the accurateness of generated images. Therefore we model a reconstructor as a
denoising autoencoder (Unet [
13
]) by customizing vanilla Unet to the task in a way that this new version improves the
reconstruction process for the positive samples and deteriorates it for negative ones. Also, the denoising version makes
it robust to noise. In the case of the traditional one-class classifier, the model only distinguishes the sample of two
classes based on their similarity to the learned positive class’ characteristics, as it is only trained on positive samples.
However, if the model has access to the negative class, it would develop a more accurate classification boundary and
classify a test image by considering the learned properties of both classes. We introduce a procedure to create negative
samples via manipulating the positive samples. While forcing them to differentiate from the positive instances, the
proposed method keeps negative samples close enough to positive ones in order to create hard negative examples,
enabling the model to form a more accurate boundary between the classes. Therefore we leverage a binary classifier
that is trained on two positive and generated negative examples.
Negative samples are created by applying data augmentation techniques to the reconstructed positive samples.To make
the negative examples “hard”, the resulting image is combined with the original one by a weighted summation, creating
“connective negative examples”. As the reconstructor is trained separately, the reconstruction error for the positive
examples might propagate to training the classifier; reconstructed positive samples are also combined with original
images, in the same way, forming “connective positive samples” to mitigate error propagation. By creating connective
positive and negative examples, we also incorporate reconstruction error in the training of the classifier. For positive
2