I MPROVING D IRICHLET P RIOR N ETWORK FOR O UTOF -D ISTRIBUTION E XAMPLE D ETECTION
Anonymous authors
Paper under double-blind review
A BSTRACT
Determining the source of uncertainties in the predictions of AI systems are important.
It allows the users to act in an informative manner to improve the safety of such systems, applied to the real-world sensitive applications.
Predictive uncertainties can originate from the uncertainty in model parameters, data uncertainty or due to distributional mismatch between training and test examples.
While recently, signiﬁcant progress has been made to improve the predictive uncertainty estimation of deep learning models, most of these approaches either conﬂate the distributional uncertainty with model uncertainty or data uncertainty.
In contrast, the Dirichlet Prior Network (DPN) can model distributional uncertainty distinctly by parameterizing a prior Dirichlet over the predictive categorical distributions.
However, their complex loss function by explicitly incorporating KL divergence between Dirichlet distributions often makes the error surface ill-suited to optimize for challenging datasets with multiple classes.
In this paper, we present an improved DPN framework by proposing a novel loss function using the standard cross-entropy loss along with a regularization term to control the sharpness of the output Dirichlet distributions from the network.
Our proposed loss function aims to improve the training efﬁciency of the DPN framework for challenging classiﬁcation tasks with a large number of classes.
In our experiments using synthetic and real datasets, we demonstrate that our DPN models can distinguish the distributional uncertainty from other uncertainty types.
Our proposed approach signiﬁcantly improves DPN frameworks and outperform the existing OOD detectors on CIFAR-10 and CIFAR-100 dataset while also being able to recognize distributional uncertainty distinctly.
I NTRODUCTION
Deep neural networks (DNNs) have achieved impeccable success to address various real world tasks (Simonyan & Zisserman, 2014a; Hinton et al., 2012;
Litjens et al., 2017).
However, despite impressive, and ever-improving performance in various supervised learning tasks, DNNs tend to make over-conﬁdent predictions for every input.
Predictive uncertainties of DNNs can be confronted from three different factors such as model uncertainty, data uncertainty and distributional uncertainty (Malinin & Gales, 2018).
Model or epistemic uncertainty captures the uncertainty in estimating the model parameters, conditioning on training data (Gal, 2016).
This uncertainty can be explained away given enough training data.
Data or aleatoric uncertainty is originated from the inherent complexities of the training data, such as class overlap, label noise, homoscedastic and heteroscedastic noise (Gal, 2016).
Distributional uncertainty or dataset shift arises due to the distributional mismatch between the training and test examples (Quionero-Candela et al., 2009; Malinin & Gales, 2018).
In this case, as the network receives unfamiliar out-of-distribution (OOD) test data, it should not conﬁdently make predictions.
The ability to separately model these three types of predictive uncertainty is important, as it enables the users to take appropriate actions depending on the source of uncertainty.
For example, in the active learning scenario, distributional uncertainty indicates that the classiﬁer requires additional data for training.
On the other hand, for various real-world applications where the cost of an error is high, such as in autonomous vehicle control, medical, ﬁnancial and legal ﬁelds, the source of uncertainty informs whether an input requires manual intervention.
Recently notable progress has been made to detect OOD images.
Bayesian neural network based approaches conﬂate the distributional uncertainty through model uncertainty (Hernandez-Lobato &
Adams, 2015; Gal, 2016).
However, since obtaining the true posterior distribution for the model parameters are intractable, the success of these approaches depends on the chosen prior distribution over parameters and the nature of approximations.
Here, the predictive uncertainties can be measured by using an an ensemble of multiple stochastic forward passes using dropouts from a single
DNN (Monti-Carlo Dropout or MCDP) (Gal & Ghahramani, 2016) or by ensembling results from multiple DNNs (Lakshminarayanan et al., 2017) and computing their mean and spread.
On the other hand, most of the non-Bayesian approaches model their distributional uncertainty with data uncertainty.
These approaches can explicitly train the network in a multi-task fashion incorporating both in-domain and OOD examples to produce sharp and ﬂat predictive posteriors respectively (Lee et al., 2018a; Hendrycks et al., 2019).
However, none of these approaches can robustly determine the source of uncertainty.
Malinin & Gales (2018) introduced Dirichlet Prior Network (DPN) to distinctly model the distributional uncertainty from the other uncertainty types.
A DPN classiﬁer aims to produce sharp distributions to indicate low-order uncertainty for the in-domain examples and ﬂat distributions for the OOD examples.
However, their complex loss function, using the Kullback-Leibler (KL) divergence between Dirichlet distributions, results in the error surface to become poorly suited for optimization and makes it difﬁcult efﬁciently train the DNN classiﬁers for challenging datasets with a large number of classes (Malinin & Gales, 2019).
In this work, we aim to improve the training efﬁciency of the DPN framework by proposing a novel loss function that also allows the distributional uncertainty to be modeled distinctly from both data uncertainty and model uncertainty.
Instead of explicitly using Dirichlet distributions in the loss function, we propose to apply the standard cross-entropy loss on the softmax outputs along with a novel regularization term for the logit (pre-softmax activation) outputs.
We train the models in a multi-task function by leveraging both in-domain training images and OOD training images.
The proposed loss function can be also viewed from the perspective of the non-Bayesian frameworks (Lee et al., 2018a;
Hendrycks et al., 2019) where the proposed regularizer presents an additional term to control the sharpness of the output Dirichlet distributions.
In our experiments, we demonstrate that our proposed regularization term can effectively control the sharpness of the output Dirichlet distributions from the DPN to detect distributional uncertainties along with making the framework scalable for more challenging datasets.
We also ﬁnd that the OOD detection performance of our DPN models often improves by augmenting Gaussian noises with the OOD training images to train the
DPN. Our experimental results on CIFAR-10 and CIFAR-100 suggest that our proposed approach signiﬁcantly improves the performance of the DPN framework for OOD detection and out-performs the recently proposed OOD detection techniques.
R ELATED WORKS
In Bayesian frameworks, the predictive uncertainty of a classiﬁcation model, trained on a ﬁnite dataset, D in = { x i , y i } Ni =1 ∼ P in ( x , y ) , is expressed in terms of data (aleatoric) and model (epistemic) uncertainty (Gal, 2016).
For an input x ∗ , the predictive uncertainty is expressed as:
[Equation]
Here, x and y represents the images and the corresponding class labels, sampled from an underlying probability distribution p in ( x , y ) .
Here, the data uncertainty, p ( ω c | x ∗ , θ ) is described by the posterior distribution over class labels given model parameters, θ and model uncertainty, p ( θ |D in ) , is given by the posterior distribution over parameters given the data, D in .
The expected distribution for predictive uncertainty, p ( ω c | x ∗ , D in ) is obtained by marginalizing out θ .
However, true posterior for p ( θ |D in ) is intractable.
Approaches such as Monte-Carlo dropout (MCDP) (Gal & Ghahramani, 2016), Langevin Dynamics (Welling & Teh, 2011), explicit ensembling (Lakshminarayanan et al., 2017) approximate the integral in eq.
1 as:
[Equation]
where, θ ( m ) is sampled from an explicit or implicit variational approximation, q ( θ ) of the true posterior p ( θ |D in ) .
Each p ( ω c | x ∗ , θ ( m ) ) represents a categorical distribution, µ = [ µ 1 , · · · , µ k ] =
[ p ( y = ω 1 ) , · · · , p ( y = ω K )] over the class labels and the ensemble can be visualized as a collection of points on the simplex.
While for a conﬁdent prediction, the ensemble is expected to sharply
[Figure]
appear in one corner of the simplex, the ﬂatly spread ensembles cannot determine whether the uncertainty is due to data or distributional uncertainty.
Furthermore, for standard DNNs, with millions of parameters, it becomes even harder to ﬁnd an appropriate prior distribution and inference scheme to estimate the posterior distribution of the model.
Dirichlet Prior Network (DPN) is introduced to explicitly model the distributional uncertainty by parameterizing a Dirichlet distribution over a simplex (Malinin & Gales, 2018).
More discussions about DPN is presented in section 3.1.
Alternatively, non-Bayesian frameworks derive their measure of uncertainties using the predictive posteriors obtained from DNNs.
Lee et al.
(2018a)
and Hendrycks et al.
(2019) introduce new components in their loss functions to explicitly incorporate OOD data for training.
DeVries & Taylor (2018) append an auxiliary branch onto a pre-trained classiﬁer to derive the OOD score.
Shalev et al.
(2018) uses multiple semantic dense representations as the target label to train the OOD detection network.
Several recent works such as (Lee et al., 2018b; Liang et al., 2018) have demonstrated that by tweaking the input images during inference using adversarial perturbations can enhance the performance of a DNN for OOD detection (Goodfellow et al., 2014b).
However, their discriminative scores are achieved by tailoring the parameters for each OOD distributions during test time, which is not possible for real-world OOD examples.
Hein et al.
(2019) propose an adversarial training (Madry et al., 2018) like approach to produce lower conﬁdent predictions for OOD examples.
However, while these models can identify the total predictive uncertainties, they can not robustly determine whether the source of uncertainty is due to an in-domain input in a region of class overlap or an
OOD example far away from the training distribution.
P ROPOSED M ETHODOLOGY
This section ﬁrst describes the DPN framework and the difﬁculties of the existing modeling techniques to scale DPNs for challenging datasets.
We then present our improved version DPN by proposing a novel loss function to address these difﬁculties while allowing to model the distributional uncertainty distinctly from the model and data uncertainty.
3. D IRICHLET P RIOR N ETWORK
A DPN for classiﬁcation directly parametrizes a prior Dirichlet distribution over the categorical output distributions on a simplex (Malinin & Gales, 2018).
For in-domain examples, a DPN attempts to produce sharp Dirichlet in one corner of the simplex, when it is conﬁdent in its predictions (Figure 1a).
It should produce a sharp distribution in the middle of the simplex to indicate the data (loworder) uncertainty for the in-domain example with a high degree of noise or belongs to a class overlapping region (Figure 1b).
In contrast, for OOD examples, a DPN should produce a Dirichlet that spreads over the simplex or across the edge of the simplex to indicate the distributional uncertainty (Figure1c).
Here, the data uncertainty is expressed by the point-estimate categorical distribution µ while the distributional uncertainty is described using the distribution over the predictive categorical i.e p ( µ | x ∗ , θ ) .
The overall predictive uncertainty is expressed as:
[Equation]
This expression forms a three layered hierarchy of uncertainties: a large model uncertainty, p ( θ |D ) would induce a large variation in distributional uncertainty in p ( µ | x ∗ , θ ) and a large degree of uncertainty for µ leads to higher data uncertainty.
DPN framework is consistent with the existing approaches, where an additional layer of uncertainty is included to capture the distributional uncertainty.
For example, marginalization of µ in Eqn. 3 will reproduce Eqn.
1 while loose the control over the sharpness of the output Dirichlet distributions.
The marginalization of θ produces the expected estimation of data and distributional uncertainty given model uncertainty as:
[Equation]
However, similar to eq.
1 marginalizing θ is eq.
4 is also intractable.
Since the model uncertainty is reducible given large training data, for simplicity, here we assume a dirac delta estimation, ˆ θ for θ :
[Equation]
Constructing a DPN.
A DPN constructs a Dirichlet distribution as a prior over the categorical distributions, which is parameterized by the concentration parameters, α = α 1 , · · · , α K .
[Equation]
where, α 0 is called the precision of the Dirichlet.
A larger value of α 0 produces sharper distributions to indicate low order uncertainties (ﬁg 1a and 1b).
A DPN, f
ˆ θ produces the concentration parameters, α and the posterior over class labels, p ( ω c | x ∗ ; ˆ θ ) , is given by the mean of the Dirichlet.
α = f ˆ
[Equation]
x
[Equation] [Equation]
A standard DNN with the softmax activation function can be represented as a DPN where the concentration parameters are α c =
e z c ( x ∗ ) ; z c ( x ∗ ) is the pre-softmax (logit) output corresponding to the class, c for an input x ∗ .
The expected posterior probability of class label ω c is given as:
[Equation]
However, the mean of the Dirichlet is now insensitive to any arbitrary scaling of α c .
Hence, the precision of the Dirichlet, α 0 , degrades under the standard cross-entropy loss.
Malinin & Gales (2018) instead introduced a new loss function that explicitly minimizes the KL divergence between the output Dirichlet and a target Dirichlet to produce a predeﬁned target precision value for the output Dirichlet distributions.
For in-domain examples , the target distribution is chosen to be a sharp Dirichlet, Dir ( µ | ˆ α y ) , focusing on their ground truth classes.
While for OOD examples , a ﬂat Dirichlet, Dir ( µ | ˜ α ) is selected that spreads over the whole simplex.
[Equation]
where, P in and P out are the underlying distribution of in-domain and OOD training examples respectively.
However, learning the model using sparse 1-hot continuous distributions for class labels, which are effectively a delta function, is challenging due to their complex loss function (eq. 9).
Here, the error surface becomes poorly suited for optimization using the back-propagation algorithm (Malinin & Gales, 2019).
Malinin & Gales (2018) tackle this problem by using label smoothing (Szegedy et al., 2016) or teacher-student training (Hinton et al., 2015a) to redistribute a small amount of probability density to each corner of the Dirichlet.
This technique is found to work well for datasets with a fewer number of class labels.
However, for more challenging datasets with a large number of classes, even these techniques cannot efﬁciently redistribute the probability densities at each corner and results in the target distribution to tend to a delta function.
Hence, it becomes difﬁcult to train the DPN to achieve competitive performances.
Malinin & Gales (2019) have recently proposed to reverse the terms within the KL divergence in eq.
9 to improve the training efﬁciency of
DPN models.
This approach still requires to explicitly constrain the precision of the output Dirichlet distributions using an appropriately chosen hyper-parameter for training.
3. I MPROVED D IRICHLET P RIOR N ETWORK
We now propose an improved technique to model DPN by proposing a novel loss function using the standard cross-entropy loss along with a regularization term to control the precision of the output
Dirichlet distribution from the network.
As we have seen in equation 8, the precision of a Dirichlet distribution produced by the standard DNN is given as (cid:80) K c =1 exp z c ( x ∗ ) .
Hence, we can control the sharpness of the distribution by designing a regularization term that increases the sum of logit (presoftmax) outputs for the in-domain examples to produce sharp distributions to indicate their lower uncertainties.
For the OOD examples, the regularization term aims to decrease the sum of logit (presoftmax) outputs to produce ﬂat distributions to indicate distributional (higher-order) uncertainties.
Hence, instead of explicitly constraining the precision the output Dirichlet with a speciﬁc hyperparameter, we allow the network to appropriately produce the precision values for different input. [Figure]
In this paper, we propose the regularization term as 1 K (cid:80)
Kc =1 sigmoid ( z c ( x )) to control the sharpness of the output Dirichlet distribution along with the standard cross-entropy loss for classiﬁcation.
Here, the sigmoid function is chosen for the regularization term as it always produces a value within the range of (0 , 1) for any z c ( x ) .
For in-domain training examples, the loss function is given as:
[Equation]
For OOD training examples, the loss function is given as:
[Equation]
where, U denotes the uniform distribution over the class labels. H c is the cross-entropy function.
We train the network in a multi-task fashion with the overall loss function as:
[Equation]
In this loss function, we have incorporated three user-deﬁned hyper-parameters: λ in , λ out and λ in Eq.
10, Eq. 11, and Eq.
12 respectively.
λ balances between the loss values for in-domain examples and OOD examples.
The hyper-parameters λ in and λ out controls the sharpness of the output Dirichlet from a DPN.
By choosing λ in > 0 , we enforce the network to produce positive logit values for in-domain examples that lead to producing sharper Dirichlet distributions (Fig. 2(a)).
We choose λ in > λ out to ensure that the density is either spread over the the simplex or across the boundary (Fig 1c).
The choice of λ in > λ out > 0 will lead the network to produce comparatively ﬂatter Dirichlet distributions for OOD examples (Fig. 2b).
In contrast, by choosing λ out < 0 , we enforce the network to produce negative values for z c ( x ∗ ) and hence fractional values for α c ’s (i.e α c ∈ (0 , 1) ) for OOD examples.
This will cause the densities of the Dirichlet to be distributed in the edges of the simplex and produces an extremely sharp distribution, as shown in Fig 2c.
The proposed loss function in Eq.
12 is also very closely related to non-Bayesian approaches, where by choosing λ in , λ out to zero we re-obtain similar loss functions as proposed by Lee et al.
(2018a);
Hendrycks et al.
However, by setting λ in , λ out to zero, we lose control over the precision of the Dirichlet distribution that distinguishes distributional uncertainty from data uncertainty.
Our multi-task loss function (eq. 12) requires training samples from the in-domain distribution,
P in as well as from OOD P out .
However, since P out is unknown, Lee et al.
(2018a) propose to synthetically generate the OOD training samples from the boundary of in-domain region, P in using generative models such as GAN (Goodfellow et al., 2014a).
Alternatively, a different, easily available, real datasets can be used as OOD training examples.
In practice, the latter approach is to found to be more effective for training the OOD detectors and has been applied for our experiments on vision datasets (Hendrycks et al., 2019).
E XPERIMENTAL S TUDY
We demonstrate the effectiveness of the DPN framework using the proposed loss function by conducting two sets of experiments.
First, we experiment on a synthetic dataset.
Next, we present a comparative study of our proposed framework with the existing approaches on CIFAR10 and CIFAR100, and show the advantages over the original DPN framework (Malinin & Gales, 2018).
4. S YNTHETIC D ATASET
We construct a simple dataset with three classes where the instances are sampled from three different isotropic Gaussian distributions as shown in Figure 3(a).
We select isotropic co-variances, σ 2 I with σ = 4 , to ensure that the classes are overlapping.
We train a small DPN with 2 hidden layers of [Figure] nodes each for the synthetic dataset.
For our loss function, we set λ as 1 . 0 .
We choose both positive and negative values for λ out in our experiments.
Here, λ in and λ out are chosen as λ in = (1 − β ) and λ out = ( 1 # class − β ) .
We train two different sets of DPN models using β = 0 .
(i.e positive λ out ) and 0 .
5 (i.e negative λ out ), denoted as DPN ( β = 0 . 0) and DPN ( β = 0 . 5) , respectively (See
Appendix B for additional details).
An uncertainty measure can be computed as the probability of the predicted class or max probability , max P = max c p ( ω c | x ∗ , D in ) , in the expected predictive categorical distribution, p ( ω c | x ∗ , D in ) (Figure 3(b) and 3(c) for DPN ( β = 0 . 0) and DPN ( β = 0 . 5) , respectively). Entropy of the predicted distribution, H [ p ( ω c | x ∗ , D in )]
= − (cid:80)
Kc =1 p ( ω c | x ∗ , D in ) ln p ( ω c | x ∗ , D in ) , can be also applied as a total uncertainty measure that produces low scores when the model is conﬁdent in its prediction (Figure 3(d) and 3(e) for DPN ( β = 0 . 0) and DPN ( β = 0 . 5) respectively).
Max probability and entropy are the most frequently used uncertainty measures used by the existing OOD detection models.
However, since the predicted distribution is obtained by marginalizing µ (eq. 3), these mea- sures cannot capture the sharpness of the output Dirichlet for a DPN. Hence, they cannot distinguish between misclassiﬁed examples and OOD examples.
This observation also indicates the limitation of the existing non- DPN approachesto differentiate between data and distributional uncertainties (Malinin & Gales, 2018).
A DPN framework address this limitation by using the differential entropy (D-Ent) as an uncertainty measure that pro- duces lower scores for sharper Dirichlet distributions (eq. 13). Appendix D presents the expression to compute D.Ent scores for a given data point.
[Equation] [Equation]
Figure 3(f) and 3(g) demonstrate that D.Ent can distinguish between in-domain and OOD examples.
DPN ( β = 0 . 0) produces smaller positive logit values, resulting in ﬂat Dirichlet distributions for OOD examples.
Hence, we obtain relatively lower D.Ent scores for OOD examples compared to the in-domain examples (ﬁg 3 (d)).
Subsequently, DPN ( β = 0 . 5) produces negative logit values, resulting in sharp Dirichlet distributions across the edge of the simplex for OOD examples (Fig. 2(c)).
As we can see in Figure 3(g), the D.Ent scores for OOD examples are even smaller than the in-domain conﬁdent predictions, indicating that the output Dirichlet distributions for OOD examples are even sharper.
Since we explicitly constrain the logit outputs to produce smaller values for OOD examples, it is meaningful to deﬁne the sum of the exponential of logits , (cid:80)
Kc =1 e z c ( x ∗ ) , as a new measure of predictive uncertainty.
In Figure 3(d) and 3(h), we visualize this uncertainty measure for our DPN ( β = 0 . 0) and DPN ( β = 0 . 5) , respectively.
We found that our DPN models produce very high logit values.
Hence, we scaled down these values by a factor of 100 before computing this uncertainty measure for better visualization.
We can see, (cid:80)
Kc =1 e z c ( x ∗ ) produces high scores for all in-domain data points to distinguish them from OOD examples.
4. E XPERIMENTS ON CIFAR-10 AND CIFARExperimental setup.
In this section, we present our experiments on CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009).
CIFAR-10 images belong to 10 different classes while CIFAR-100 is a more challenging dataset, containing 100 image classes. Both of these datasets contain 32 × 32 natural colored images of 50 ,training and 10 , 000 testing examples.
In Appendix-A, we have also experimented on TinyImageNet (TIM) that consists of 64 × 64 natural images from 200 classes.
The CIFAR-10 classiﬁers are trained using CIFAR-10 training images as in-domain and CIFAR-100 training images as OOD dataset (Simonyan & Zisserman, 2014b). We use VGG-16 architecture for this case. For
[Table]
CIFAR-100, we use CIFAR-100 training images as in-domain and CIFAR-10 training images as the OOD dataset. Here, we consider a DenseNet with depth = 55 and growth rate = 12 (Huang et al., 2017).
We present in-domain misclassiﬁcation detection and OOD detection experiments to evaluate the performance of our models.
For our misclassiﬁcation detection experiments, we take the in-domain test set and attempt to distinguish the correctly classiﬁed examples from misclassiﬁed examples (see Table 2).
The OOD detection experiments attempt to distinguish the in-domain test images from unknown OOD images.
In Table 3, we present a smaller set of results where we consider TinyImageNet (TIM) as the OOD dataset and attempt to distinguish them from in-domain test data points.
In Appendix A, we present an expanded version of this comparative table for a wide range of OOD examples.
Note that, the OOD test images are selected from datasets different from the datasets used for training. The description of our training and test datasets are presented in Table 1. Please refer to Appendix C for further details.
Evaluation of Predictive Uncertainty Estimation.
To evaluate the performance of our model for misclassi- ﬁcation detection, we consider the misclassiﬁed examples as the positive class and correctly classiﬁed examples as the negative class.
For the OOD detection task, we treat the OOD examples as the positive class and in-domain examples as a negative class.
The detection performance for these tasks are measured using two metrics: area under the receiver operating characteristic curve (AUROC) and area under the precision-recall curve (AUPR) (Hendrycks & Gimpel, 2016).
The AUROC can be interpreted as the probability of an OOD example to produce a higher detection score than an in-domain example (Davis & Goadrich, 2006).
Hence, a higher AUROC is desirable, and an uninformative detector produces an AUROC
≈ 50% .
The AUPR is more informative when the positive class and negative class have greatly differing base rates. It can take these base rates into account (Manning & Sch¨utze, 1999). [Table]
Hyper-parameters for Training Loss.
Unlike Liang et al.
; Lee et al.
(2018a), and similar toMalinin & Gales (2018);
Hendrycks et al.
(2019), we do not require to tune any hyper-parameters during testing for different datasets.
In other words, the OOD test examples remain unknown to our DPN classiﬁers, as in a real-world scenario.
During training, we set λ = 0 .
5 (eq. 12), similar to Hendrycks et al.
We train multiple DPN models for CIFAR-10 and CIFAR-100 classiﬁers using both positive and negative values for λ out .
We choose λ in and λ out as λ in = (1 − β ) and λ out = ( 1 # class − β ) .
We train two different sets of DPN models using 0 .
(i.e positive λ out ) and β = 0 .
5 (i.e negative λ out ), denoted as DPN soft ( β : 0 . 0) and DPN soft ( β : 0 . 5) , respectively.
Detecting the source of uncertainty.
[1] DPN model with λ out > 0 :
By choosing a positive value for λ out , we enforce the network to produce ﬂat Dirichlet distributions over the simplex for OOD examples.
Hence, the D.Ent measure should produce higher scores for OOD examples and lower scores for in-domain examples.
Therefore, given a test example with high scores for both entropy as well as D-Ent, it indicates distributional uncertainty .
In contrast, if the test example achieves high entropy scores and lower D-Ent score, it indicates data uncertainty .
Our DPN soft ( β : 0 . 0) models achieve high AUROC and AUPR scores using D-Ent to detect OOD examples for both CIFAR-10 and CIFAR-100 (see Table 3) while achieves lower AUROC and AUPR scores for D-Ent while detecting misclasiﬁcation for CIFAR-100 (see Table 2). However for CIFAR-
[Table]
10, our DPN soft ( β : 0 . 0) models fail to produce low AUROC and AUPR scores under D-Ent measure for misclassiﬁcation detection. This indicates that these models achieve high D.Ent scores for both misclassiﬁed and OOD examples and make it difﬁcult to distinguish distributional uncertainty from data uncertainty for CIFAR-10.
Note that, similar to our DPN soft ( β : 0 . 0) , DPN Dir (Malinin & Gales, 2018) also produces high AUPR and AUROC scores under D.Ent measure for for both misclassiﬁed examples and OOD examples for CIFARmodel (Table 2 and 3).
This indicates that both DPN Dir and our DPN soft ( β : 0 . 0) models may be ineffective to detect distributional uncertainty for CIFAR-10. In contrast, our DPN soft ( β : 0 . 5) models are always found to be effective to identify the source of uncertainties. [2] DPN model with λ out < 0 :
In contrast, if we choose a negative value for λ out , our DPN network produces very sharp Dirichlet distributions across the edge of the simplex for OOD examples. Hence, it produces very low D.Ent scores.
Notably, these distributions are even sharper than the Dirichlet distributions obtained for conﬁdently predicted examples.
Hence, for a test example, we can detect distributional uncertainty if it achieves high entropy and low D.Ent scores.
As we can see, our DPN soft ( β : 0 . 5) models produce very low AUROC and AUPR scores for D.Ent measure to detect OOD examples (Table 3) while achieve relatively higher AUROC and AUPR scores for detecting misclassiﬁed examples (Table 2).
Data Augmentation with white-noise for Training.
After training our DPN models using clean training images, we also ﬁne-tune them using noisy OOD training images for a few epochs.
We add minor Gaussian noise sampled from isotropic Gaussian distributions N (0 , σ 2 I ) with our OOD training images.
Here, the idea is to add minor perturbation without distorting the features of the OOD training images. It further exposes the network into the out of distribution space.
Note that, the DPN models are ﬁne-tuned only using OOD training images. The OOD test examples remain unknown .
In practice, this technique may often further improve the OOD detection performance of our DPN soft models as we choose σ = 0 .
01 (see Table 3). However, for larger perturbation, performance degrades for the DPN soft ( σ = 0 . 05) .
Comparative Study.
In Table 2 and 3, we compare the performance of our approach with several baselines, such as standard DNN (Hendrycks & Gimpel (2016)), MCDP (Gal & Ghahramani, 2016), DPN Dir (Malinin &
Gales, 2018), ODIN (Liang et al., 2018), and OE (Hendrycks et al., 2019).
We use the same architecture as our DPN soft models for all the competitive models.
OE models are trained using the set of in-domain and OOD training images with their proposed loss function (Hendrycks et al., 2019).
Note that, since non-DPN methods do not explicitly model the logit outputs, the D-Ent or (cid:80)
Kc =1 e z c ( x ∗ ) measures are not meaningful (Malinin & Gales, 2018).
We also compare our results with the existing DPN framework, namely DPN Dir Malinin & Gales (2018) for CIFAR-10. Note that, the DPN Dir framework fails to scale for the CIFAR-100 dataset that consists ofclasses.
Due to the unavailability of codes and results (under the same settings), we could not compare our model with Malinin & Gales (2019).
Overall, our DPN soft models signiﬁcantly improved the performance of the DPN framework and consistently out-performed the existing OOD detection models. In addition, it is able to distinguish distributional uncertainty from other uncertainty types.
C ONCLUSION
In this paper, we propose a novel framework to improve the training efﬁciency of DPN models for challenging classiﬁcation tasks with large number of classes.
We also propose a novel regularization term that allows controls the sharpness of the Dirichlet distributions. We show that the proposed regularizer can be easily integrated with the standard cross-entropy loss function.
Our experiments on synthetic and real datasets demonstrate that our proposed framework can efﬁciently distinguish the distributional uncertainty from other uncertainty types.
We demonstrate that the OOD detection performance of our DPN models can be often improved by training with noisy OOD examples.
Experiments show that our proposed approach signiﬁcantly improves DPN frameworks, and outperforms the existing OOD detectors on both CIFAR-10 and CIFAR-100 datasets.
A E XPANDED R ESULTS
[Table]
[Table]
[Table]
[Table]
- - ODIN
[Table]
[Table]
[Table] [Table]
[Table]
B E XPERIMENTAL D ETAILS ON S YNTHETIC D ATASETS
The three classes of our synthetic dataset are constructed by sampling from three different isotropic Gaussian distributions with means of ( − 4 , 0) , (4 , 0) and (0 , 5) and isotropic variances of σ = 4 .
We sample 200 training [Table] [Table]
[Table]
C E XPERIMENTAL D ETAILS ON CIFAR-10 AND CIFARC. T RAINING D ETAILS
For our experiments on CIFAR-10, we train a VGG-16 model with CIFAR-10 as the in-domain and CIFAR- 100 as the OOD training data (Simonyan & Zisserman (2014b)).
For CIFAR-100, we train a DenseNet with depth = 55 , growth rate = 12 and CIFAR-100 as the in-domain and CIFAR-10 as the OOD training data (Huang et al.
We trained multiple DPN soft models using our proposed loss functions with different hyper-parameters.
For CIFAR-10, we use the VGG-16 network. Here, we use CIFAR-10 training images ( 50 , 000 images) as our in-domain training data and CIFAR-100 training images ( 50 , 000 images) as our OOD training data.
For CIFAR-100, Densenet(55, 12) is trained using the same setup as proposed by Huang et al.
Here, we use CIFAR-100 training images ( 50 , 000 images) as our in-domain training data and CIFAR-10 training images ( 50 , 000 images) as our OOD training data.
For TinyImageNet (TIM), we use the VGG-16 network.
Here, we use TIM training images (100,000 images) as our in-domain training data and ImageNet-25K images ( 25 , 000 images) as our OOD training data.
ImageNet25K is obtained by randomly selecting 25 , 000 images from the ImageNet dataset (Deng et al., 2009).
After training the models with clean in-domain and OOD images, we further ﬁne-tune the models using noisy OOD training images for 50 epochs with the learning rate of 0 . 0001 .
The noises are chosen form an isotropic Gaussian distribution, N (0 , σ 2 I ) .
We have experimented with three different values of σ as { 0 . 0 , 0 . 01 , 0 . 05 } to introduce different level of noises. [Table] [Figure] [Table]
[Figure]
[Table]
[Figure] [Table] [Figure] C. OOD T EST D ATASETS
We use a wide range of OOD dataset to evaluate the performance of our proposed OOD detection models.
For CIFAR-10 and CIFAR-100 classiﬁers, these input test images are resized to 32 × 32 , while for TinyImageNet classiﬁers, we resize them to 64 × 64 . In this task, we attempt to distinguish the unknown OOD images from the corresponding in-domain test images from different classiﬁcation tasks. We compute different uncertainty measures for these images for this purpose.
For our evaluations, we use the following OOD images as described in the following.
TinyImageNet
(TIM) (Li et al.
This is a subset of Imagenet dataset.
We use the validation set, that contains 10 , 000 test images from 200 different image classes for our evaluation during test time. This dataset is used as an OOD test dataset only for CIFAR-10 and CIFAR-100 classiﬁers. Note that, for TinyImageNet classiﬁers, this is the in-domain test set.
LSUN (Yu et al.
The Large-scale Scene UNderstanding dataset (LSUN) contains images of 10 different scene categories.
We use its validation set, containing 10 , 000 images, as an unknown OOD test set.
Places 365 (Zhou et al.
The validation set of this dataset consists of 36500 images of 365 scene categories.
Textures (Cimpoi et al.
(2014)) contains 5640 textural images in the wild belonging to 47 categories.
STL-10 contains 8 , 000 images of natural images from 10 different classes (Coates et al., 2011).
Gaussian Noise.
This is an artiﬁcially generated dataset obtained by adding Gaussian noise to the in-domain test images. The Gaussian noises are sampled from an isotropic Gaussian distribution, N (0 , σ 2 I ) with σ = 0 . 05 .
C. D ETAILS OF C OMPETITIVE S YSTEMS
We compare the performance of our models with standard DNN as baseline model (Hendrycks & Gimpel (2016)), the Bayesian framework, monti-carlo dropout (MCDP) (Gal & Ghahramani (2016)), DPN D ir using the loss function proposed by Malinin & Gales (2018), non-Bayesian frameworks such as ODIN (Liang et al.
and outlier exposure (OE) by Hendrycks et al.
We use the same architecture as DPN softmax for the competitive models.
For DPN Dirichlet , we could not reproduce the same performance as given in Malinin & Gales (2018) and hence use their reported results for CIFAR-10 for our comparison.
For MCDP, we use the standard DNN model with randomly dropping the nodes during test time.
The predictive categorical distributions are obtained by averaging the outputs for 10 iterations.
ODIN applies the standard DNN models trained only using in-domain training examples for OOD detec- tion.
During testing phase, it perturbs the input images using FGSM adversarial attack (Goodfellow et al.
(2014b))and softmax activation function by incorporating the temperature hyper-parameter (Hinton et al.
(2015b)).
The maximum Probability score is then applied for their uncertainty measure.
They propose to use different hyper-parameters for different OOD examples.
However, in practice, the source of expected OOD examples cannot be known.
Hence, for our comparisons, we always set the perturbation size to 0 .
002 and the temperature to 1000 .
OE models are trained using the proposed loss function by Hendrycks et al.
Here, we use the same training set up as applied for our DPN soft models: CIFAR-10 classiﬁers are trained using CIFAR-10 training images as in-domain examples and CIFAR-100 training images as OOD examples.
For CIFAR-100, the OE models are trained using CIFAR-10 training images as OOD examples.
D D IFFERENTIAL E NTROPY M EASURE FOR D IRICHLET P RIOR N ETWORK
Differential Entropy of a Dirichlet distribution can be calculated as follows (Malinin & Gales, 2018):
[Equation]
Note that, α c is a function of x ∗ .
Γ and ψ denotes the Gamma and digamma functions respectively.