T OWARDS U NKNOWN - AWARE L EARNING WITH V IRTUAL O UTLIER S YNTHESIS
Anonymous authors
Paper under double-blind review
A BSTRACT
Out-of-distribution (OOD) detection has received much attention lately due to its importance in the safe deployment of neural networks.
One of the key challenges is that models lack supervision signals from unknown data, and as a result, can produce overconﬁdent predictions on OOD data.
Previous approaches rely on real outlier datasets for model regularization, which can be costly and sometimes infeasible to obtain in practice.
In this paper, we present VOS , a novel framework for OOD detection by adaptively synthesizing virtual outliers that can meaningfully regularize the model’s decision boundary during training.
Specifically, VOS samples virtual outliers from the low-likelihood region of the classconditional distribution estimated in the feature space.
Alongside, we introduce a novel unknown-aware training objective, which contrastively shapes the uncertainty space between the ID data and synthesized outlier data.
VOS achieves stateof-the-art performance on both object detection and image classiﬁcation models, reducing the FPR95 by up to 10.9% compared to the previous best method.
I NTRODUCTION
Modern deep neural networks have achieved unprecedented success in known contexts for which they are trained, yet they do not necessarily know what they don’t know (Nguyen et al., 2015).
In particular, neural networks have been shown to produce high posterior probability for out-ofdistribution (OOD) test inputs, which should not be predicted by the model.
Taking self-driving car as an example, an object detection model trained to recognize in-distribution objects ( e.g., cars, stop signs) can produce a high-conﬁdence prediction for an unseen object of a moose (see Figure 1(a)).
Such a failure case raises concerns in model reliability, and worse, may lead to a catastrophic effect when deployed in safety-critical applications.
What makes OOD detection particularly challenging?
To explain this, modern neural networks are commonly optimized on the in-distribution (ID) data only, and lack explicit knowledge of unknowns during training time.
The resulting decision boundary, despite being useful on ID tasks such as classiﬁcation, can undesirably cover OOD data.
We illustrate this in Figure 1.
The ID data (gray) consists of three class-conditional Gaussians, on which a three-way softmax classiﬁer is trained.
The resulting classiﬁer is overconﬁdent for regions far away from the ID data (see the red shade in Figure 1(b)).
When such models are directly employed, the decision boundary can be ill-fated for OOD detection.
Ideally, a model should learn a more compact decision boundary that produces low uncertainty for the ID data, with high OOD uncertainty elsewhere ( e.g. , Figure 1(c)).
However, achieving this goal is non-trivial due to the lack of supervision signal of unknowns.
It is hard to comprehensively anticipate unknown data in advance under a large space of OOD uncertainty.
This prompts the following question: How can we enable unknown-aware deep neural networks without explicit knowledge of the unknowns in advance?
Motivated by this, we propose a novel unknown-aware learning framework dubbed VOS ( V irtual
O utlier S ynthesis), which optimizes the dual objectives of both ID task and OOD detection performance.
In a nutshell, VOS consists of three components tackling challenges of outlier synthesis and effective model regularization with synthesized outliers.
First, we estimate the class-conditional distribution in the feature space , and propose to sample outliers from the low-likelihood region that is on the decision boundary of ID classes (Section 3.1).
Key to our method, we show that sampling in the feature space is more tractable than synthesizing images in the high-dimensional pixel space (Lee
[Figure]
et al., 2018a).
Alongside, we propose a novel unknown-aware training objective, which contrastively shapes the uncertainty surface between the ID data and synthesized outliers (Section 3.2).
During training, VOS simultaneously performs the ID task ( e.g. , classiﬁcation or object detection) as well as the OOD uncertainty regularization.
During inference time, the uncertainty estimation branch produces a larger probabilistic score for ID data and vice versa, which enables effective OOD detection (Section 3.3).
VOS offers several compelling advantages compared to existing solutions.
(1) VOS is a general learning framework that is effective for both object detection and image classiﬁcation tasks, whereas previous methods were primarily driven by image classiﬁcation.
Image-level detection can be limiting as an image could be OOD in certain regions while being in-distribution elsewhere.
Our work bridges a critical research gap since OOD detection for object detection is particularly underexplored in literature.
(2) VOS enables adaptive outlier synthesis, which can be ﬂexibly and conveniently used for any ID data without manual data collection or cleaning.
In contrast, previous methods using outlier exposure (Hendrycks et al., 2019) require an auxiliary image dataset that is sufﬁciently diverse, which can be arguably prohibitive to obtain.
Moreover, one needs to perform careful data cleaning to ensure the auxiliary outlier dataset does not overlap with ID data.
(3) VOS synthesizes outliers that can meaningfully improve and tighten the decision boundary between ID and OOD data.
In contrast, existing solutions use outliers that are either too trivial to regularize the OOD estimator, or too hard to be separated from ID data, resulting in sub-optimal performance.
Our key contributions and results are summarized as follows
: • We propose a new framework VOS addressing a pressing issue—unknown-aware deep learning that optimizes for both ID and OOD performance.
VOS establishes state-of-the-art results on both object detection and classiﬁcation tasks.
Compared to the best method, VOS reduces the FPR95 by up to 10.9% while preserving the accuracy on the ID task.
• We conduct extensive ablations and reveal important insights by contrasting different outlier synthesis approaches.
We show that VOS is more advantageous than generating outliers directly in the high-dimensional pixel space ( e.g. , using GAN (Lee et al., 2018a)) or using noise as outliers.
• We comprehensively evaluate our method on common OOD detection benchmarks, along with a more challenging yet underexplored task in the context of object detection.
Our effort facilitates future research to evaluate OOD detection in a setting closer to real-world applications.
Code and dataset will be released for reproducible research.
P ROBLEM S ETUP
We start by formulating the problem of OOD detection in the setting of object detection.
Our framework can be easily generalized to image classiﬁcation when the bounding box is the entire image (see Section 4.2).
Most previous formulations of OOD detection treat entire images as anomalies, which can lead to ambiguity shown in Figure 1.
In particular, natural images are not monolithic entities, but instead are composed of numerous objects and components.
Knowing which regions of an image are anomalous could allow for safer handling of unfamiliar objects. This setting is
[Figure]
more realistic in practice, yet also more challenging as it requires reasoning OOD uncertainty at the ﬁne-grained object level.
Speciﬁcally, we denote the input and label space by X = R d
and Y = { 1 , 2 , ..., K } , respectively.
Let x ∈
X be the input image, b ∈ R 4 be the bounding box coordinates associated with object instances in the image, and y ∈ Y be the semantic label for K -way classiﬁcation.
An object detection model is trained on in-distribution data D = { ( x i , b i , y i ) } Ni =1 drawn from an unknown joint distribution P .
We use neural networks with parameters θ to model the bounding box regression p θ ( b | x , y ) and the classiﬁcation p θ ( y | x ) .
The OOD detection can be formulated as a binary classiﬁcation problem, which distinguishes between the in- vs. out-of-distribution objects.
Let P X denote the marginal probability distribution on
X .
Given a test input x ∗ ∼ P X , as well as an object instance b ∗ predicted by the object detector, the goal is to predict p θ ( g | x ∗ , b ∗ ) .
We use g = 1 to indicate a detected object being in-distribution, and g = 0 being out-of-distribution, with semantics outside the support of Y .
M ETHOD
Our novel unknown-aware learning framework is illustrated in Figure 2.
Our framework encompasses three novel components and addresses: (1) how to synthesize the virtual outliers (Section 3.1), (2) how to leverage the synthesized outliers for effective model regularization (Section 3.2), and (3) how to perform OOD detection during inference time (Section 3.3)?
3. VOS: V IRTUAL O UTLIER S YNTHESIS
Our framework VOS generates virtual outliers for model regularization, without relying on external data.
While a straightforward idea is to train generative models such as GANs (Goodfellow et al., 2014; Lee et al., 2018a), synthesizing images in the high-dimensional pixel space can be difﬁcult to optimize.
Instead, our key idea is to synthesize virtual outliers in the feature space , which is more tractable given lower dimensionality.
Moreover, our method is based on a discriminatively trained classiﬁer in the object detector, which circumvents the difﬁcult optimization process in training generative models.
Speciﬁcally, we assume the feature representation of object instances forms a class-conditional multivariate Gaussian distribution (which is veriﬁed using embeddings of a real network, see Figure 3):
[Equation]
where µ k is the Gaussian mean of class k ∈ { 1 , 2 , .., K } , Σ is the tied covariance matrix, and h ( x , b ) ∈
R m is the latent representation of an object instance ( x , b ) .
To extract the latent representation, we use the penultimate layer of the neural network.
The dimensionality m is signiﬁcantly smaller than the input dimension d .
To estimate the parameters of the class-conditional Gaussian, we compute empirical class mean (cid:98) µ k and covariance (cid:98) Σ of training samples
[Equation]
where N k is the number of objects in class k , and N is the total number of objects.
We use online estimation during training, where we construct a class-conditional queue with | Q k | object instances from each class.
We enqueue the embeddings of objects in the each minibatch (to each class-conditional queue) and accordingly dequeue the same number of object embeddings to update the queue.
Sampling from the feature representation space.
We propose sampling the virtual outliers from the feature representation space, using the multivariate distributions estimated above.
Ideally, these virtual outliers should help estimate a more compact decision boundary between ID and OOD data.
To achieve this, we propose sampling the virtual outliers V k from the (cid:15) -likelihood region of the estimated class-conditional distribution:
[Equation]
where v k ∼ N ( (cid:98) µ k , (cid:98) Σ ) denotes the sampled virtual outliers for class k , which are in the sublevel set based on the likelihood.
(cid:15) is sufﬁciently small so that the sampled outliers are near class boundary.
Ablation study on the effect of (cid:15) is provided in Appendix C.
Classiﬁcation outputs for virtual outliers.
For a given sampled virtual outlier v ∈ R m , the output in the classiﬁcation branch can be derived through a linear transformation:
[Equation]
(4) where θ k cls is the weight vector of the fully connected layer corresponding to class k .
We proceed with describing how to regularize the output of virtual outliers for improved OOD detection.
3. U NKNOWN - AWARE T RAINING O BJECTIVE
We now introduce a new training objective for unknown-aware learning, leveraging the virtual outliers in Section 3.1.
The key idea is to perform visual recognition task while regularizing the model to produce a low uncertainty score for ID data, and a high uncertainty score for the synthesized outlier.
In the case of object detection, the overall training objective combines the standard object detection loss, along with a regularization loss in terms of uncertainty: [Equation]
[Equation]
where D is the training data.
L cls and L loc are losses for classiﬁcation and bounding box regression, respectively.
This can be simpliﬁed to classiﬁcation task without considering L loc .
Uncertainty score.
To measure the uncertainty, we propose a generalized energy score , which is derived from the output of the classiﬁcation branch.
For ID object ( x , b ) , the energy is deﬁned as:
[Equation]
where w k are learnable weight coefﬁcients, and f k ( h ( x , b ); θ cls ) is the logit output for class k in the classiﬁcation branch.
Similarly, the energy score for the virtual outliers is:
[Equation]
In particular, we show in Section 4 that a learnable w is more ﬂexible than a constant w , given the inherent class imbalance in object detection datasets.
Additional visualization and analysis of the learned weight coefﬁcient w k is shown in Appendix G.
Uncertainty regularization.
The uncertainty score is then passed into a logistic regression classiﬁer with weight coefﬁcient θ u , which predicts high probability for ID object ( x , b ) and low probability for virtual outliers v :
[Equation]
The learning process allows greater ﬂexibility in contrastively shaping the uncertainty surface, resulting in more distinguishable in- and out-of-distribution objects.
Liu et al.
(2020a)
employed energy for model uncertainty regularization, however, the loss function is based on the squared hinge loss and requires tuning two margin hyperparameters.
In contrast, our uncertainty regularization loss is completely hyperparameter-free and is much easier to use in practice.
Moreover, VOS produces probabilistic score for OOD detection, whereas Liu et al.
(2020a) relies on non-probabilistic energy score.
We provide ablation studies in Section 4.1 demonstrating the superiority of our loss function.
3. I NFERENCE - TIME OOD D ETECTION
During inference, we use the output of the logistic regression uncertainty branch for OOD detection.
In particular, given a test input x ∗ , the object detector produces a bounding box prediction b ∗ .
The
OOD uncertainty score for the predicted object ( x ∗ , b ∗ ) is given by:
[Equation]
For OOD detection, one can exercise the common thresholding mechanism to distinguish between
ID and OOD objects:
[Equation]
The threshold γ is typically chosen so that a high fraction of ID data (e.g., 95%) is correctly classiﬁed.
Our framework VOS is summarized in Algorithm 1.
Algorithm
Input: ID data D = { ( x i , b i , y i ) } Ni =1 , randomly initialized detector with parameter θ , queue size | Q k | for Gaussian density estimation, weight for uncertainty regularization β and likelihood (cid:15) .
Output: Object detector with parameter θ ∗ , and OOD detector G . while train do
Update the ID queue Q k with the training objects { ( x , b , y ) } .
Estimate the multivariate distributions based on ID training objects using Equation 1 and 2.
Sample virtual outliers v using Equation 3.
Calculate the regularization loss using Equation 8, update the parameters θ based on Equation 5.
endwhile eval do
Calculate the OOD uncertainty score using Equation 9.
Perform thresholding comparison using Equation 10. end
3. E FFECT OF V IRTUAL O UTLIERS : A N I LLUSTRATIVE E XAMPLE
We illustrate the effect of training with and without virtual outliers in Figure 1.
In particular, we consider a toy example of Gaussian mixtures, where X = R 2 , Y = { 1 , 2 , 3 } .
The simplicity of the example allows us to see the changes of uncertainty surface straightforwardly.
The tied covariance matrix is set to Σ = (cid:20) 0 .
0 .(cid:21) , (cid:107) µ i − µ j (cid:107) =
12 for i (cid:54) =
j .
The data distribution with three classes is shown in gray.
Speciﬁcally, the model is trained with ID data only, on a 3-layer perceptron using the standard cross-entropy loss.
Figure 1(b) shows the uncertainty in R 2 , measured [Table] by the negative energy (Liu et al., 2020a).
The model trained without outliers is unable to capture the uncertainty that is far away from the ID data (red).
In contrast, training with virtual outliers signiﬁcantly improves the OOD uncertainty estimation, as shown in Figure 1(c).
E XPERIMENTAL R ESULTS
In this section
[Table]
we present empirical evidence to validate the effectiveness of VOS on several realworld tasks, including both object detection (Section 4.1) and image classiﬁcation (Section 4.2).
4. E VALUATION ON O BJECT D ETECTION
Experimental details.
We use PASCAL VOC
(Everingham et al., 2010) and Berkeley DeepDrive ( BDD-100k 2 ) (Yu et al., 2020) datasets as the ID training data.
For both tasks, we evaluate on two
OOD datasets containing diverse visual categories: MS-COCO (Lin et al., 2014) and OpenImages (validation set)
(Kuznetsova et al., 2020).
We use the Detectron2 library (Girshick et al., 2018) and train on two backbone architectures: ResNet-50 (He et al., 2016) and RegNetX-4.0GF (Radosavovic et al., 2020).
For each in-distribution class, we use 1,000 samples to estimate the class-conditional
Gaussians.
Since the threshold (cid:15) can be inﬁnitesimally small, we instead choose (cid:15) based on the t -th smallest likelihood in a pool of 10,000 samples (per-class), generated from the class-conditional
Gaussian distribution.
A larger t corresponds to a larger threshold (cid:15) .
As shown in Table 6, a smaller t yields good performance.
We set t = 1 for all our experiments.
Extensive details on the datasets are described in Appendix A, along with a comprehensive sensitivity analysis of each hyperparameter (including the queue size | Q k | , coefﬁcient β , and threshold (cid:15) ) in Appendix C .
Metrics.
For evaluating the OOD detection performance, we report: (1) the false positive rate (FPR95) of OOD samples when the true positive rate of ID samples is at 95%; (2) the area under the receiver operating characteristic curve (AUROC).
For evaluating the object detection performance on the ID task, we report the common metric of mAP.
Comparison with existing approaches.
In Table 1, we compare VOS with competitive OOD detection methods in literature.
For a fair comparison, all the methods only use ID data without using
[Table]
auxiliary outlier dataset.
Our proposed method, VOS , outperforms competitive baselines, including
Maximum Softmax Probability (Hendrycks & Gimpel, 2017), ODIN (Liang et al., 2018), Mahalanobis distance (Lee et al., 2018b), Generalized ODIN (Hsu et al., 2020), energy score (Liu et al., 2020a), CSI (Tack et al., 2020) and Gram matrices (Sastry & Oore, 2020).
These baselines can be naturally extended to the object detection model due to the existence of classiﬁcation head.
We also compare with GAN-based approach for synthesizing outliers (Lee et al., 2018a), where VOS effectively improves the OOD detection performance (FPR95) by 11.41 % on BDD-100k and 13.5 % on
Pascal VOC (COCO as OOD).
Moreover, we show in Table 1 that VOS achieves stronger OOD detection performance while preserving a high accuracy on the original in-distribution task (measured by mAP).
This is in contrast with CSI, which displays signiﬁcant degradation, with mAP decreased by 0.7% on BDD-100k.
Details of reproducing baselines are in Appendix D .
Additional results using a different OOD detection metric are in Appendix H.
Ablation on outlier synthesis approaches.
We compare VOS with different synthesis approaches in
Table 2.
Speciﬁcally, we consider three types of synthesis approach: (i (cid:5) ) synthesizing outliers in the pixel space, (ii (cid:92) ) using noise as outliers, and (iii ♣ ) using negative proposals from RPN as outliers.
For type I, we consider GAN-based (Lee et al., 2018a) and mixup (Zhang et al., 2018) methods.
The outputs of the classiﬁcation branch for outliers are forced to be closer to a uniform distribution.
For mixup, we consider two different beta distributions Beta(0 . 4) and Beta(1) , and interpolate ID objects in the pixel space.
For Type II, we use noise perturbation to create virtual outliers.
We consider adding ﬁxed Gaussian noise to the ID features, adding trainable noise to the ID features where the noise is trained to push the outliers away from ID features, and using ﬁxed Gaussian noise as outliers.
Lastly, for type III, we directly use the negative proposals in the ROI head as the outliers for Equation 8, similar to Joseph et al.
We consider three variants: randomly sampling n negative proposals ( n is the number of positive proposals), sampling n negative proposals with a larger probability, and using all the negative proposals.
All methods are trained under the same setup, with PASCAL-VOC as in-distribution data and ResNet-50 as the backbone.
The loss function is the same as Equation 5 for all variants, with only difference being synthesis method.
The results are summarized in Table 2, where VOS outperforms alternative synthesis approaches both in the feature space ( ♣ , (cid:92) ) or the pixel space ( (cid:5) ).
Generating outliers in the pixel space ( (cid:5) ) is either unstable (GAN) or harmful for the object detection performance (mixup).
Introducing noise ( (cid:92) ), especially using Gaussian noise as outliers is promising.
However, Gaussian noise outliers are relatively simple, and may not effectively regularize the decision boundary between ID and OOD as
VOS does.
Exploiting the negative proposals ( ♣ ) is not effective, because they are distributionally close to the ID data.
Ablation on different architecture and different feature layers.
Lastly, we demonstrate that VOS is effective on alternative neural network architectures.
In particular, using RegNet (Radosavovic et al., 2020) as backbone yields both better ID accuracy and OOD detection performance.
We also explore using intermediate layers for outlier synthesis, where we show using VOS on the penultimate layer is the most effective.
This is expected since the feature representations are the most discriminative at deeper layers.
We provide detailed results in Appendix E .
Ablation on the uncertainty loss.
We perform ablation on several variants of VOS , trained with different uncertainty loss L uncertainty .
Particularly, we consider: (1) using the squared hinge loss for regularization as in Liu et al.
, (2) using constant weight w =
[1 , 1 , ..., 1] (cid:62) for energy score in
Equation 6, and (3) classifying the virtual outliers as an additional K + 1 class in the classiﬁcation [Table] branch.
The performance comparison is summarized in Table 3.
Compared to the hinge loss, using our proposed logistic loss for regularizing the energy reduces the FPR95 by 8.42% on BDD-100k.
While the squared hinge loss in Liu et al. requires tuning the hyperparameters, our uncertainty loss is completely hyperparameter free .
In addition, we ﬁnd that a learnable w for energy score is more desirable than a constant w , given the inherent class imbalance in object detection datasets.
Additional visualization of the learned weight coefﬁcient w k is shown in Appendix G, which aligns with the class frequency.
Finally, classifying the virtual outliers as an additional class increases the difﬁculty of object classiﬁcation, which does not outperform either.
This ablation demonstrates the superiority of the uncertainty loss employed by VOS .
Comparison with training on real outlier data.
We also compare with Outlier Exposure (Hendrycks et al., 2019)
(OE), an approach that relies on the real outlier data for model regularization.
For a fair comparison, we train the object detector on PASCAL-VOC using the same architecture ResNet-50, and use the OE objective for the classiﬁcation branch.
The real outliers for OE training are sampled from the OpenImages dataset (Kuznetsova et al., 2020).
We perform careful deduplication to ensure there is no overlap between the outlier training data and PASCAL-VOC.
Our method achieves OOD detection performance on COCO (AUROC: 88.44%) that favorably matches
OE (AUROC: 89.41%), and does not impose strong data assumption.
Note that OE takes 274 minutes on 4 GPUs while VOS takes 240 minutes, which is faster to train.
4. E VALUATION ON I MAGE C LASSIFICATION
[Table]
Going beyond object detection [Table] we show that VOS is also suitable and effective on common image classiﬁcation benchmark.
We use CIFAR-10 (Krizhevsky & Hinton, 2009) as the ID training data, with standard train/val splits.
We train on WideResNet40 (Zagoruyko & Komodakis, 2016) and DenseNet101 (Huang et al., 2017), where we substitute the object detection loss in Equation 5 with the crossentropy loss.
Following the common benchmark, we evaluate on six OOD datasets: Textures (Cimpoi et al., 2014), SVHN (Netzer et al., 2011),
Places365 (Zhou et al., 2018), LSUN-C (Yu et al., 2015), LSUN-Resize (Yu et al., 2015), and iSUN (Xu et al., 2015).
The comparisons are shown in Table 4, with results averaged over six test datasets.
VOS demonstrates competitive OOD detection results on both architectures without sacriﬁcing the ID test classiﬁcation accuracy (94.84% on pre-trained WideResNet vs. 94.68% using
VOS ).
Additionally, we provide comparative results with generative-based methods in Appendix F .
4. Q UALITATIVE A NALYSIS
In Figure 4, we visualize the prediction on several OOD images, using object detection models trained without virtual outliers (top) and with VOS (bottom), respectively.
The in-distribution data is BDD-100k.
VOS performs better in identifying OOD objects (in green) than a vanilla object detector, and reduces false positives among detected objects.
Moreover, the conﬁdence score of the false-positive objects of VOS is lower than that of the vanilla model (see the truck in the 3rd column).
We visualize the synthesized virtual outliers in Appendix Section I.
R ELATED WORK
OOD detection for classiﬁcation can be broadly categorized into post hoc, generative-based and outlier exposure (OE)-based approaches.
For post hoc methods, the softmax conﬁdence score is a common baseline (Hendrycks & Gimpel, 2017), which can be arbitrarily high for OOD inputs (Hein et al., 2019).
Several improvements have been proposed, such as ODIN (Liang et al., 2018;
Hsu et al., 2020), Mahalanobis distance (Lee et al., 2018b), energy score (Liu et al., 2020a), and Gram matrices based score (Sastry & Oore, 2020).
Different from Lee et al.
(2018b), VOS performs dynamic estimation of class-conditional Gaussian during training, which shapes the uncertainty surface over time using a novel uncertainty regularization loss.
Outlier Exposure-based methods exploited model regularization using natural images (Hendrycks et al., 2019; Mohseni et al., 2020; Zhang et al., 2021) or images synthesized by GANs (Lee et al., 2018a).
However, real outlier data is often infeasible to obtain.
In contrast, VOS automatically synthesizes virtual outliers which allows greater ﬂexibility and generality.
Generative models directly estimate the in-distribution density (Kingma & Dhariwal, 2018; Schirrmeister et al., 2020), which makes them natural alternatives for OOD detection.
However, they are in general less competitive compared to discriminative-based methods and typically harder to optimize (Hinz et al., 2019; Kirichenko et al., 2020; Nalisnick et al., 2019).
Tack et al.
(2020) applied self-supervised learning for OOD detection, which we compare in Section 4.
Jung et al.
(2021) proposed a standardized max-logit approach for detecting outliers in semantic segmentation, which is a post-hoc approach. Zhao et al. ; Grcic et al. (2021) trained a generative model and synthesize outliers in the pixel space, which cannot be applied to object detection where a scene consists of both known and unknown objects.
Their regularization terms are based on entropy maximization, which is different from VOS .
OOD detection for object detection is currently underexplored.
Joseph et al.
(2021) used energy score (Liu et al., 2020a) to identify the OOD data and then labeled them for incremental object detection.
In contrast, VOS focuses on OOD detection and adopts a new unknown-aware training objective with a new test-time detection score, which is applicable to both object detectors and classiﬁers.
Moreover, Joseph et al.
(2021) used the negative proposals as unknown samples for model regularization, which is suboptimal as we show in Table 2.
Harakeh & Waslander (2021) focused on uncertainty estimation for the localization regression, rather than OOD detection for classiﬁcation problems.
Several works (Dhamija et al., 2020; Miller et al., 2019; 2018; Hall et al., 2020; Deepshikha et al., 2021) used approximate Bayesian methods, such as MC-Dropout (Gal & Ghahramani, 2016) for OOD detection.
They require multiple inference passes to generate the uncertainty score, which are computationally expensive on larger datasets and models.
Open-world object detection includes out-of-domain generalization (Kim et al., 2021;
Wang et al., 2021), zero-shot object detection (Gu et al., 2021; Rahman et al., 2020) and incremental object detection (Liu et al., 2020b; P´erez-R´ua et al., 2020).
Most of them either developed measures to mitigate catastraphic forgetting (Joseph et al., 2020) or used auxiliary information (Rahman et al., 2020), such as class attributes to perform object detection on unseen data, which is different from our focus of OOD detection.
C ONCLUSION
In this paper, we proposed VOS , a novel unknown-aware training framework for OOD detection.
Different from methods that require real outlier data, VOS adaptively synthesizes outliers during training by sampling virtual outliers from the low-likelihood region of the class-conditional distributions.
The synthesized outliers meaningfully improve the decision boundary between the ID data and OOD data, resulting in state-of-the-art OOD detection performance while preserving the performance of the ID task.
VOS is effective and suitable for both object detectors and classiﬁers.
We hope our work will inspire future research towards unknown-aware deep learning in real-world settings.
R EPRODUCIBILITY S TATEMENT
Authors of the paper recognizes the importance and value of reproducible research.
We summarize our efforts below to facilitate reproducible results:
Datasets.
We use publicly available datasets, which are described in detail in Section 4.1 , Section 4.2 , and Appendix A . 2.
Baselines.
The description and hyperparameters of the OOD detection baselines are explained in Appendix D . 3.
Model training.
Our model training on object detection is based on the publicly available Detectron2 codebase: https://github.com/facebookresearch/ detectron2 .
Hyperparamters are speciﬁed in Section 4.1 , with a thorough ablation study provided in Appendix C . 4.
Methodology.
Our method is fully documented in Section 3, with the pseudo algorithm detailed in Algorithm 1 . 5.
Open Source.
The codebase and the dataset will be released for reproducible research.
E THICS STATEMENT
Our project aims to improve the reliability and safety of modern machine learning models.
Our study can lead to direct beneﬁts and societal impacts, particularly for safety-critical applications such as autonomous driving.
Our study does not involve any human subjects or violation of legal compliance.
We do not anticipate any potentially harmful consequences to our work.
Through our study and releasing our code, we hope to raise stronger research and societal awareness towards the problem of out-of-distribution detection in real-world settings.
Supplementary Material A E XPERIMENTAL DETAILS
We summarize the OOD detection evaluation task in Table 5.
The OOD test dataset is selected from
MS-COCO and OpenImages dataset, which contains disjoint labels from the respective ID dataset.
The PASCAL model is trained for a total of 18,000 iterations, and the BDD-100k model is trained for 90,000 iterations.
We add the uncertainty regularizer (Equation 8) starting from 2/3 of the training.
The weight β is set to 0 .
See detailed ablations on the hyperparameters in Appendix C .
[Table]
B S OFTWARE AND HARDWARE
We run all experiments with Python 3.8.5 and PyTorch 1.7.0, using NVIDIA GeForce RTX 2080Ti
GPUs.
C E FFECT OF HYPERPARAMETERS
Below we perform sensitivity analysis for each important hyperparameter 1 .
We use ResNet-50 as the backbone, trained on in-distribution dataset PASCAL-VOC.
Effect of (cid:15) .
Since the threshold (cid:15) can be inﬁnitesimally small, we instead choose (cid:15) based on the t -th smallest likelihood in a pool of 10,000 samples (per-class), generated from the class-conditional
Gaussian distribution.
A larger t corresponds to a larger threshold (cid:15) .
As shown in Table 6, a smaller t yields good performance.
We set t = 1 for all our experiments.
[Table]
Effect of queue size | Q k | .
We investigate the effect of ID queue size | Q k | in Table 7, where we vary | Q k | = { 50 , 100 , 200 , 400 , 600 , 800 , 1000 } .
Overall, a larger | Q k | is more beneﬁcial since the estimation of Gaussian distribution parameters can be more precise.
In our experiments, we set the queue size | Q k | to 1 , 000 for PASCAL and 300 for BDD-100k.
The queue size is smaller for BDD because some classes have a limited number of object boxes.
Effect of β .
As shown in Table 8, a mild value of β generally works well.
As expected, a large value (e.g., β = 0 . 5 ) will over-regularize the model and harm the performance.
[Table] [Table]
Effect of starting iteration for the regularizer .
Importantly, we show that uncertainty regularization should be added in the middle of the training.
If it is added too early, the feature space is not sufﬁciently discriminative for Gaussian distribution estimation.
See table 9 for the effect of starting iteration Z .
We use Z = 12 , 000 for the PASCAL-VOC model, which is trained for a total of 18, iterations.
[Table]
D B ASELINES
To evaluate the baselines, we follow the original methods in MSP (Hendrycks & Gimpel, 2017),
ODIN (Liang et al., 2018), Generalized ODIN (Hsu et al., 2020), Mahalanobis distance (Lee et al., 2018b), CSI (Tack et al., 2020), energy score (Liu et al., 2020a) and gram matrices (Sastry & Oore, 2020) and apply them accordingly on the classiﬁcation branch of the object detectors.
For ODIN, the temperature is set to be T = 1000 following the original work.
For both ODIN and Mahalanobis distance, the noise magnitude is 0 . 0005 .
For GAN (Lee et al., 2018a), we follow the original paper and use a GAN to generate OOD images.
The prediction of the OOD images/objects is regularized to be close to a uniform distribution, through a KL divergence loss with a weight of 0.1.
We set the shape of the generated images to be 100 × 100 and resize them to have the same shape as the real images.
We optimize the generator and discriminator using Adam (Kingma & Ba, 2015), with a learning rate of 0.001.
For CSI (Tack et al., 2020), we use the rotations (0 ◦ , 90 ◦ , 180 ◦ , 270 ◦ ) as the self-supervision task.
We set the temperature in the contrastive loss to 0.5.
We use the features right before the classiﬁcation branch (with the dimension to be 1024) to perform contrastive learning.
The weights of the losses that are used for classifying shifted instances and instance discrimination are both set to 0.1 to prevent training collapse.
E V IRTUAL OUTLIER SYNTHESIS USING EARLIER LAYER
In this section, we investigate the effect of using VOS on an earlier layer within the network.
Our main results in Table 1 are based on the penultimate layer of the network.
Here, we additionally evaluate the performance using the layer before the penultimate layer, with a feature dimension of 1 , 024 .
The results are summarized in Table 10.
As observed, synthesizing virtual outliers in the penultimate layer achieves better OOD detection performance than the earlier layer, since the feature representations are more discriminative at deeper layers.
[Table]
F C OMPARISON WITH GENERATIVE - BASED METHODS
[Table]
In Table
[Table]
we also compare with state-of-the-art methods using generative modeling (Du & Mordatch, 2019; Grathwohl et al., 2020; Kingma & Dhariwal, 2018; Serr`a et al., 2020).
We follow the same evaluation protocols as in prior literature.
Using CIFAR-10 as ID data, VOS demonstrates competitive performance compared to the best method (Serr`a et al., 2020) on different OOD datasets
[Table]
Note that generative modeling and density estimation are less feasible for object detection with multiple objects in the scene.
In contrast, VOS is suitable for both object detection (Section 4.1) and image classiﬁcation (Section 4.2) tasks.
G V ISUALIZATION OF THE LEARNABLE WEIGHT COEFFICIENT w IN GENERALIZED ENERGY SCORE
To observe whether the learnable weight coefﬁcient w k in Equation 6 and 7 captures dataset-speciﬁc statistics during uncertainty regularization, we visualize w k w.r.t each in-distribution class and the number of training objects of that class in Figure 5.
We use the BDD-100k dataset (Yu et al., 2020) as the in-distribution dataset and the RegNetX-4.0GF (Radosavovic et al., 2020) as the backbone network.
As can be observed, the learned weight coefﬁcient displays a consistent trend with the number of training objects per class, which indicates the advantage of using learnable weights rather than constant weight vector with all 1s. H OOD DETECTION RESULTS UNDER A DIFFERENT METRIC
There are two average precision metrics in literature: AUPR-In (by treating in-distribution data as positives) vs. AUPR-Out (by treating OOD as positives).
From a practical perspective, the score threshold needs to be selected based on the in-distribution data (due to the impossibility to anticipate unknown data ahead of time).
For this reason, metrics such as AUPR-Out are less applicable.
We have reported the average precision (AUPR-In) of the baselines and our approach in Table 12.
The in-distribution data is the BDD100k dataset and the OOD data are COCO and OpenImages dataset.
We use a backbone of ResNet-50.
The reason for high AP scores is the sample imbalance between the in-distribution and OOD objects.
Our evaluation contains signiﬁcantly more indistribution objects.
For this reason, we believe FPR95 and AUROC are more meaningful metrics to report, which are shown in Table 1 of the main paper.
I V ISUALIZATION OF THE VIRTUAL OUTLIERS
In this section, we visualize the synthesized virtual outliers by VOS using UMAP in Figure 6.
The in-distribution dataset is the Pascal VOC dataset with the backbone of ResNet-50.
Note that we cannot visualize virtual outliers in the pixel space since they are synthesized in low-dimensional feature space.
From Figure 6, the virtual outliers reside in the near-boundary region of the in-distribution feature cluster, which helps the model to learn a compact decision boundary between ID and OOD objects.
[Table]
[Figure]
J D ISCUSSION ON THE DETECTED , REJECTED AND IGNORED OOD OBJECTS DURING INFERENCE
The focus of VOS is to mitigate the undesirable cases when an OOD object is detected and classiﬁed as in-distribution with high conﬁdence.
In other words, our goal is to ensure that “if the box is detected, it should be faithfully an in-distribution object rather than OOD”.
Although generating the bounding box for OOD data is not the focus of this paper, we do notice that VOS can improve the number of boxes detected for OOD data (+25% on BDD trained model compared to the vanilla
Faster-RCNN).
The number of OOD objects ignored by RPN can largely depend on the conﬁdence score threshold and the NMS threshold.
Hence, we found it more meaningful to compare relatively with the vanilla
Faster-RCNN under the same default thresholds.
Using BDD100K as the in-distribution dataset and the ResNet as the backbone, VOS can improve the number of detected OOD boxes by 25% (compared to vanilla object detector).
VOS also improves the number of rejected OOD samples by 63%.