Mixture Outlier Exposure: Towards Out-of-Distribution Detection in Fine-grained Environments

Jingyang Zhang†, Nathan Inkawhich*, Randolph Linderman†, Yiran Chen†, Hai Li†

†Duke University,
*Air Force Research Laboratory

Many real-world scenarios in which DNN-based recognition systems are deployed have inherently fine-grained attributes (, bird-species recognition, medical image classification).
In addition to achieving reliable accuracy, a critical subtask for these models is to detect Out-of-distribution (OOD) inputs.
Given the nature of the deployment environment, one may expect such OOD inputs to also be fine-grained w.r.t. the known classes (, a novel bird species), which are thus extremely difficult to identify.
Unfortunately, OOD detection in fine-grained scenarios remains largely underexplored.
In this work, we aim to fill this gap by first carefully constructing four large-scale fine-grained test environments, in which existing methods are shown to have difficulties.
Particularly, we find that even explicitly incorporating a diverse set of auxiliary outlier data during training does not provide sufficient coverage over the broad region where fine-grained OOD samples locate.
We then propose Mixture Outlier Exposure (MixOE), which mixes ID data and training outliers to expand the coverage of different OOD granularities, and trains the model such that the prediction confidence linearly decays as the input transitions from ID to OOD.
Extensive experiments and analyses demonstrate the effectiveness of MixOE for building up OOD detector in fine-grained environments. The code is available at <https://github.com/zjysteven/MixOE>.

§ INTRODUCTION

Real-world scenarios in which DNN recognition systems are deployed are often fine-grained in nature, wherein the data coming from such environments share a high level of semantic/visual similarity.
Examples include fine-grained visual classification [49, 13, 46], medical image classification [23, 7], and remote sensing applications [50, 45, 44].

In addition to achieving accurate classification, a critical problem for DNN models is to identify out-of-distribution (OOD) samples during inference time which do not belong to one of the DNN's known classes.
Such detection is crucial for building safe and reliable intelligent systems that operate in the open world.
However, we posit that OOD detection is particularly challenging in fine-grained scenarios because one may expect the OOD inputs to be highly granular w.r.t. the in-distribution (ID) data (, novel bird species to a bird classifier), given the nature of the deployment environment.
Such fine-grained OOD samples can make detection much difficult because they may use very similar feature sets to the ID data [16].

Unfortunately, despite being inherently motivated by many real-world scenarios, OOD detection in fine-grained environments remains largely underexplored/underconsidered in current research.
This in part has to do with (overly) simplistic [1, 37] and coarse-grained benchmarks that are currently being used to evaluate OOD detection methods [25, 22, 36, 26, 14, 43, 38] (, CIFAR-10/100 v.s. SVHN/LSUN).
An illustrative comparison between OOD detection in fine- and coarse-grained environments is shown in Fig. <ref>.
A few recent works [31, 1, 39] did consider fine-grained settings but did not carefully/thoroughly investigate why and how they are difficult.
Besides, these works either operated at a rather limited scale, , very few ID classes were considered [1, 39], or made unrealistic practices such as training on a labeled outlier dataset that overlaps with testing OOD data distribution [31].

Left: A comparison of OOD detection in coarse- and fine-grained environments. Intuitively, fine-grained detection is much more challenging.
Right: A conceptual illustration of MixOE. A Standard model with no OOD considerations tends to be over-confident on OOD samples. OE is able to calibrate the prediction confidence on coarse-grained OOD, but the outputs on fine-grained OOD are not explicitly controlled (marked by “?”). MixOE aims for a smooth decay of the confidence as the inputs transition from ID to OOD, and thus enables detection of both coarse/fine-grained OOD.

In this work, our goal is to fill the gap and present (to our knowledge) the first study that specifically targets OOD detection in fine-grained environments.
We start by building four large-scale, fine-grained test environments to approximate real-world scenarios (Sec. <ref>).
We find that several state-of-the-art OOD detection methods struggle to detect fine-grained novelties, which highlights the challenging nature of OOD detection in fine-grained settings.
Then, through analysis we identify that fine-grained OOD samples span a much broader region and are closer to the ID clusters in the DNN's feature space (Sec. <ref>).
In addition, we find that including a large/diverse set of outlier data during training  [12, 2, 26] does not help cover the area where fine-grained OOD data locate.

Finally, we design a novel training algorithm named Mixture Outlier Exposure () to address the observed issue in fine-grained OOD detection (Sec. <ref>).

Specifically, we propose to perform mixing operations (in this work we adopt Mixup [48] or CutMix [47]) between ID data and outlier data to get “virtual” outlier samples which can be both near to and far away from the ID clusters.
The model is then trained such that the prediction confidence linearly decays as the input transitions from ID to OOD (see Fig. <ref> for illustration).
As such, MixOE induces regularization over a larger OOD region and has clear implications for both coarse- and fine-grained OOD samples.
Experimental results on the four test benches show that a simple fine-tuning with MixOE can lead to consistently higher or competitive detection rates against both coarse- and fine-grained OOD data (Sec. <ref>).
We also conduct careful ablation study to further understand why and how MixOE works.
Our contributions are summarized as follows:

* We construct four large-scale test environments for fine-grained OOD detection, which can be easily generated from existing public datasets and facilitate future studies;

* We propose MixOE, a novel OOD detection methodology that has effect across a spectrum of OOD granularities;

* We show that MixOE leads to notable improvements on all four benchmarks, in particular against fine-grained OOD where few current methods have any impacts.

§ RELATED WORK

OOD detection approaches.
Many popular works in OOD detection research use a pre-trained DNN classifier as a base model, and design an OOD scoring mechanism that leverages some signal from this model.
Several methods utilize the output space of the classifier, , MSP [12], ODIN [25], and Energy [26], while other works such as Mahalanobis detector [22] and Gram Matrices [36] focus on the intermediate feature space of DNNs.
Recent works also start to explore the potential of gradient information [15].

Another line of research modifies the base DNN's training phase to enable better detection.
Lee [21] proposed to synthesize OOD samples with a GAN [32] and force the classifier to be less confident on the generated OOD data.
Hendrycks [12] later showed that a diverse and realistic outlier distribution is more proficient than synthetic samples at encouraging low confidence predictions on unseen OOD data.
More recently there comes the idea of VOS [6], which does not use real data but generates virtual outliers by sampling from class-conditional Gaussian distribution.
However, the assumption that ID data follow class-conditional Gaussian may not hold especially when the number of classes is large, and VOS has shown to even have trouble scaling to CIFAR-100 [18].
To conclude, incorporating auxiliary outlier data in training is still one of the most effective methods to date [12, 2, 26].

Our work is most closely related to [12] in that we too use unlabeled auxiliary outlier data.
However, our method uniquely formulates the learning procedure that has explicit consideration of operating in a fine-grained setting where highly granular OOD inputs are expected.

We also remark that the above works all consider relatively coarse-grained settings in their experiments.

Mixing operations for OOD detection.
Our work also relates to, but differs significantly from a few works that utilized mixing operations in the context of OOD detection.
The work of [40] and [4] both directly evaluated Mixup's effect on OOD detection.
In this work, instead of plainly applying Mixup or CutMix as a regular ID training strategy, we leverage them to construct the virtual outlier distribution to expand the coverage over OOD region.

Ravikumar [33] proposed to apply Mixup either between ID samples or between the training outliers.
In contrast, in our framework the mixing operations are performed between ID and outlier data, which has explicit implication in characterizing the transition from ID to OOD region.
In Sec. <ref>, we will demonstrate the superiority of the proposed MixOE over these methods through careful ablation study.

OOD detection in fine-grained settings.
As aforementioned, there are a few works that lightly considered OOD detection in fine-grained environments, yet they all have significant limitations.
In the work of [31], a labeled outlier dataset was used for training, which we believe is a prohibitive assumption in reality.
Even more concerning, in its experiments the training outlier dataset (ImageNet [5]) overlapped with the testing OOD data (CUB [42] and Stanford Dogs [19]), which makes the detection (arguably) trivial.
The work of [1] and [39] are limited in that the scale of the fine-grained detection problems in their experiments is rather small, , only tens of or even fewer ID classes were considered, whereas we operate at a much larger scale with hundreds of ID classes.
Later, we will also show that the method studied in [1] is not yet effective for detecting fine-grained OOD examples.

We also notice some recent works that purposefully consider cases where the test OOD samples are semantically related to the ID classes [43, 17].
The critical difference here is that they did not consider the ID classes to be granular.
We argue that without such ID granularity, it may be debatable whether a model should be asked to detect granular OOD samples!
For example, consider an experiment in [43] that regards “leopard” (in CIFAR-100) as a granular OOD sample for a CIFAR-10 model (which contains a “cat” class).
This situation begs the question: given a model trained on cats, is it more desirable to generalize to the notion of a leopard[This is actually the desired behaviour in the problem of subpopulation shift robustness [35].], or to identify leopards as OOD?

In our work, since we consider ID classes that are themselves highly granular (, unique bird species), such ambiguity is avoided and the fine-grained novelties (, novel bird species) should be considered OOD.

§ CHALLENGES OF OOD DETECTION IN FINE-GRAINED SETTINGS

This section describes a detailed study on OOD detection in fine-grained settings and serves to further motivate our goal of improving detection explicitly in fine-grained scenarios.
In Sec. <ref> we describe the construction of the four fine-grained test environments, which is necessary because those presented in prior works are limited in scale.
In Sec. <ref>, through initial evaluations we show that fine-grained OOD detection presents distinct challenges for existing methods.

§.§ Test environments

The test environments are curated from four public fine-grained visual classification (FGVC) datasets, namely FGVC-Aircraft [28], Stanford Cars [20], Butterfly [3], and North American Birds [41].
We refer to them as , , , and , respectively.
For each dataset, we create ID/OOD splits using a holdout class method, , we keep some of the categories as ID and the rest are held out from the training set and considered OOD at test time.
Note, to avoid implicit bias that might exist in each single split [1], we randomly produce three ID/OOD splits for each dataset with equal counts of ID/OOD categories.
See Appendix <ref> for more details including exact splits and number of train/test images.

In Tab. <ref> we present a comparison between our constructed environments and previous ones.
By considering 100+ ID classes we are operating at a larger scale which better represents a wide variety of complex real-world tasks and avoids putting any restrictive assumptions about the complexity of the ID classification task that would make our findings less scalable.
We also leave a reasonable number of classes as OOD to reflect the diversity of the open world.

Besides fine-grained novel inputs, a reliable detector should also be able to identify coarse-grained OOD data.
Here, for each dataset, we take the images from the other datasets as coarse-grained OOD samples (, when  is ID, , , and  will be considered OOD).
The detection performance is then evaluated against both fine- and coarse-grained novelties.

§.§ Evaluating existing methods

We now evaluate six state-of-the-art detectors in the constructed fine-grained environments, including three post-training scorers[We also evaluated Mahalanobis detector [22] but simply got NaN error, which aligns with [10]'s finding  that it has scalability issue.] (MSP [11], ODIN [25], and Energy [26]) and three that incorporate training-time regularizations using auxiliary outlier data (OE [12], OE with hard example mining (OE-M) [2], and EnergyOE [26]).
In addition, we consider the method Rotation [1] which was studied in a related work that mentioned fine-grained detection.
We leave implementation details of the detection methods to Sec. <ref> and Appendix <ref>.

To measure detector performance, we use two common metrics [22, 21, 14]: true negative rate at a 95% true positive rate (TNR95) and area under the receiver operating characteristic curve (AUROC).
While AUROC is a holistic measurement obtained by varying the threshold, TNR95 indicates what portion of OOD samples could be detected when the recall of ID data is 95%.
TNR95 is known to better separate different detectors since achieving a high TNR95 is much harder than achieving a high AUROC [14].

TNR95 of existing methods against coarse-grained (first row) and fine-grained OOD data (second row). The gray dashed line is the baseline performance (MSP). Fine-grained novelties are significantly harder to detect in all datasets for all methods. Also note how the methods that utilize outlier data ( coral ones) help with coarse-grained OOD but barely improve fine-grained detection rates.

Fig. <ref> shows the TNR95 results on one of the three splits in each dataset (other splits present similar patterns; see Appendix <ref> Fig. <ref>).
Also see the full result table including AUROC statistics in Appendix <ref> Tab. <ref>.
From these results we make two important observations.
First, fine-grained OOD samples are significantly more difficult to detect than coarse-grained ones.
Specifically, while most methods can achieve more than around 80% TNR95 when detecting coarse-grained OOD samples (Fig. <ref> first row), the TNR95 drops to below 30% for all methods on 3 of the 4 datasets when facing fine-grained OOD (Fig. <ref> second row).
This observation is in line with recent findings that detection becomes more challenging when OOD data are semantically similar to ID classes [14, 43, 17].

Our second observation is more surprising: on the holdout fine-grained data, even the methods that explicitly include outlier data during the training (OE, OE-M, and EnergyOE) do not reliably outperform MSP, which trains the model using ID data only.

This finding directly contrasts the results on coarse-grained data, where OE/OE-M/EnergyOE consistently lead to improvements (compared with MSP).
In all, these trends clearly demonstrate that OOD detection in fine-grained settings with highly granular OOD inputs is particularly challenging for existing detectors.

Visualization of the data samples (second row) and their representations in the DNN's feature space (first row). The color lightness in (d)/(e) indicates the prediction confidence encoded in the soft target of each corresponding outlier sample.
Note, (b) and (c) are test OOD samples and are never seen during the training.
The empirical training outliers (d) enclose the region where coarse OOD data (b) locate but does not cover the much broader area the fine OOD samples (c) span.
MixOE mixes the ID (a) and training outliers (d) to induce larger coverage which accounts for both coarse- and fine-grained novelties.
Moreover, the soft targets of the mixed data will calibrate the model's prediction confidence to smoothly decay from ID to OOD.

§ METHODOLOGY

§.§ Motivating analysis

An immediate question that arises from our initial results is why using auxiliary outlier data to explicitly regularize the model helps with detecting coarse-grained OOD samples but not fine-grained ones?
In fact, the training outlier data we use do not characterize/model the test coarse- or fine-grained OOD at all (see Fig. <ref>; we manually ensure this via filtering as discussed in Sec. <ref>).
Next, we conduct analysis to provide an explanation to this question, which also directly motivates our methodology.

The idea of our analysis is to reveal the relationship between the training outliers and test OOD samples by projecting them into the DNN's feature space.
Specifically, we forward pass the train/test OOD data into a “standard” pre-trained model, take the outputs of the penultimate layer as their features, and visualize them in a 2D space using the technique in [30] (see Appendix <ref> for details).
Critically, the visualization process is uniquely formed by ID data and thus remains agnostic to OOD data.
The standard model here is trained using cross-entropy loss on ID data only.
Since OE-based methods typically fine-tune the standard model using the outlier data [12, 26, 2], by visualizing in the standard model's feature space we can anticipate/explain how the training outliers may help regularize the model.

Fig. <ref> shows the results on one of the test benches (see Appendix <ref> Fig. <ref>-<ref> for more), from which we make two key observations.
First, as shown in Fig. <ref> (b), coarse-grained OOD data locate in a rather compact region, with a small portion of samples intersecting with one of the ID clusters and others being relatively far away from the ID region.
According to Fig. <ref> (c), however, fine-grained OOD samples span a much broader area, with many of them being very close to or even within the ID clusters, due to their semantic similarity to the ID images.

This observation reinforces the TNR95 detection results in Fig. <ref>, where fine-grained novelties are significantly more difficult to detect than coarse-grained ones.

Second, comparing Fig. <ref> (d) and (b), the auxiliary outlier data “enclose” the coarse OOD data region.
As a result, although  the outliers do not have any concepts related to the test coarse OOD samples (, no cars/butterflies/aircrafts in Fig. <ref> (d) second row), their regularization still generalize to the test coarse OOD inputs.
On the other hand, clearly the training outliers fail to cover the larger area where many fine-grained OOD data locate, which explains why methods utilizing the outlier data have limited effect in detecting fine-grained novelties.

§.§ Mixture Outlier Exposure

To explicitly regularize the model's behaviour in a broader region to improve detection against both coarse- and fine-grained OOD data, we would like to create a “virtual” outlier distribution $\Dio$ which can provide a more comprehensive coverage over the OOD region than the empirical outlier distribution $\mathcal{D}_\text{out}$.

Generating mixed outliers. Specifically, given an ID sample $(x_\text{in},y_\text{in})\sim\Din$ and an outlier sample $x_\text{out}\sim\mathcal{D}_\text{out}$, we propose to perform mixing operations to generate the virtual outliers:

\begin{equation}
\tilde{x}=\text{mix}(x_\text{in},x_\text{out},\lambda),
\label{eq:mix_input}
\end{equation}

where $\lambda\in[0,1]$ is a coefficient controlling the contribution of each sample to the mixed one (, $\lambda$ and $1-\lambda$ are the weight for $x_\text{in}$ and $x_\text{out}$, respectively).
The intuition here is directly based on our observations in Fig. <ref>: If we “interpolate” the ID samples (Fig. <ref> (a)) and outlier data (Fig. <ref> (d)), the resulting samples are likely to span a larger area and cover the region where fine-grained OOD data locate (Fig. <ref> (c)).

We find that simple pixel-level operations, , linear interpolation [48] and cut-paste operation [47], can already result in samples that cover the fine-grained OOD region.
Thus in this work we instantiate Eqn. <ref> with these operations and denote them as linear mixing and cut mixing, respectively.
However, we remark that this operation may be as simple or as complex as desired; it is not constrained to [48, 47] and allows possible extension in the future.

To demonstrate the effect of mixed samples $\tilde{x}$, we again visualize them in the DNN model's feature space in Fig. <ref> (e) (here we use linear mixing as an example; see Appendix <ref> Fig. <ref>-<ref> for more).
Importantly, unlike the empirical outlier distribution $\mathcal{D}_\text{out}$ in Fig. <ref> (d), our virtual outlier samples can span a larger area (being both near to and far away from the ID clusters) by varying the coefficient $\lambda$.

As a result, we anticipate that when training with the samples from $\Dio$, the model's behaviour on both fine- and coarse-grained OOD data can be regularized.

Assigning training targets.
Now that we have generated mixed outliers for training, the next important step is to decide the corresponding training targets.
Our key insight here is to regularize the model such that its prediction confidence can smoothly decay as the input transitions from ID to OOD.
To this end, we assign soft target $\tilde{y}$ corresponding to the mixed sample $\tilde{x}$ as follows:

\begin{equation}
\tilde{y}=\lambda y_\text{in} + (1-\lambda)\mathcal{U},
\label{eq:mix_output}
\end{equation}

where $y_\text{in}$ is the one-hot label of the ID sample $x_\text{in}$, and $\mathcal{U}$ represents the uniform distribution over the ID categories.
The prediction confidence (, maximum softmax probability [11]) encoded in $\tilde{y}$ is $\tilde{y}_\text{pred. conf.}=\lambda+(1-\lambda)\frac{1}{K}$, where $K$ is the number of ID categories.
Concretely, when the mixed sample is OOD (, $\lambda=0$), we force the model to be least confident/maximally uncertain on that sample (, $\tilde{y}_\text{pred. conf.}=\frac{1}{K}$); when the mixed sample is ID (, $\lambda=1$), the model is trained to make a confident prediction (, $\tilde{y}_\text{pred. conf.}=1$).
The confidence of the intermediate mixed samples (, $\lambda\in(0,1)$) is smoothly modulated by $\lambda$.
A visualization of such effect can be seen in Fig. <ref> (e), where darker points correspond to a higher confidence that is encoded in their soft targets $\tilde{y}$.
Unlike previous methods, we remark that this formulation uniquely enables the model to have better calibration over a wider range of confidence levels.
As a result, our method can have effects across a spectrum of OOD granularities, which is crucial for detectors in fine-grained environments as the OOD samples could be highly granular.

Training objective.
The above two technical insights make up our training algorithm, Mixture Outlier Exposure (MixOE), whose objective is formulated as

\begin{equation}
\label{eq:mixoe}
\mathbb{E}_{(x,y)\sim\Din} \big[\mathcal{L}(f(x),y)\big]+
\beta\mathbb{E}_{(\tilde{x},\tilde{y})\sim\Dio}\big[\mathcal{L}(f(\tilde{x}),\tilde{y})\big].
\end{equation}

Here, $\mathcal{L}(f(x),y)$ is the cross-entropy loss between the DNN's predicted distribution $f(x)$ and the ground truth distribution $y$, and $\beta$ is a weighting term.
During training, at each iteration the $\lambda$ in Eqn. <ref> and Eqn. <ref> is sampled from a Beta distribution $\text{Beta}(\alpha, \alpha)$ for an introduced hyperparameter $\alpha$.
Both $\alpha$ and $\beta$ can be determined using validation data (details are in Sec. <ref>).

We also remark here that the outlier dataset used to construct $\Dio$ is unlabeled and does not need to contain any data related to the test OOD data distribution.
After training, the detection will be performed by thresholding the prediction confidence since MixOE explicitly calibrates the confidence on outliers during the training.

Relationship with prior methods.
The training objective of the vanilla OE [12] is $\mathbb{E}_{(x,y)\sim\Din} \big[\mathcal{L}(f(x),y)\big]+
\beta\mathbb{E}_{x_\text{out}\sim\mathcal{D}_\text{out}}\big[\mathcal{L}(f(x_\text{out}),\mathcal{U})\big]$, which encourages the model's output to resemble uniform distribution $\mathcal{U}$ on the empirical outliers from $\mathcal{D}_\text{out}$.
What separates MixOE from OE is the novel idea of using generated virtual outliers to expand the regularization over a broader region and controlling how the confidence decay from ID to OOD.
Also, note that MixOE can degenerate to vanilla OE if $\lambda$ is fixed to $0$ during the training.
The other two methods, OE-M [2] and EnergyOE [26], share the same idea as OE except that [2] uses the “hardest” outliers from $\mathcal{D}_\text{out}$ and [26] adopts a different scoring function for detection.
They still uses only the empirical outliers and has no control over the confidence decay.
Thus we believe they share similar shortcomings to OE, which we will confirm with experimental results shortly.

§ EXPERIMENTS

§.§ Setup

Same as in Sec. <ref>, we consider a total of seven baseline methods, including six state-of-the-art methods [11, 25, 26, 12, 2] and one that was studied in a previous fine-grained setting [1].
We also re-emphasize that there are very few methods that have considerations for operating in fine-grained environments as this is an underexplored topic.

Training details.
For the post-training scoring methods, we train ResNet-50 models [9] in the standard fashion, , by minimizing the cross-entropy loss over the ID-only training dataset.
Specifically, we train the model for 90 epochs using SGD with the batch size being 32.
Following common practices in fine-grained classification research [49, 13, 46], the model is initialized with ImageNet pre-trained weights.
The initial learning rate is 0.001 and is decayed by cosine learning rate schedule [27].

For Rotation [1], we train the model using its objective with the same setup as the standard training.

For methods that utilize auxiliary outlier data (OE, OE-M, EnergyOE, and MixOE), we only fine-tune the trained standard model with the corresponding objective for 10 epochs, following [12, 26].
Therefore, MixOE and other OE-based methods only induce marginal computation overhead.
The fine-tuning also adopts cosine schedule with the initial learning rate being 0.001.
The batch size of ID data is still 32.
For OE/OE-M/EnergyOE, as suggested in their papers, we set the batch size of outlier data to be twice as the ID batch size, which is 64.
In the case of MixOE, we keep outlier batch size same as the ID batch size.
As a result, MixOE actually uses only half of the outliers used by other methods.

The auxiliary outlier set.
The training outlier set $\mathcal{D}_\text{out}$ we consider is WebVision 1.0 [24], which contains natural images crawled from Flickr and Google by querying with the 1,000 categories of ImageNet.
We believe this dataset represents a realistic and practical construction of $\mathcal{D}_\text{out}$ for many ID tasks in the natural imagery domain.

Importantly, to avoid arguments of “cheating”, we filter out images that are relevant to the considered OOD tasks from the outlier set based on WordNet ID [29].
Specifically, a total of 491K images related to aircraft/car/butterfly/bird are removed.
Thus, the training outliers reveal no information about the test coarse- or fine-grained OOD data (see Fig. <ref> for visualization).
After the filtering, there are 1948K images left in the outlier set.
However, since MixOE just fine-tunes the model for 10 epochs, at most 70K images are actually used during the training.

Hyperparameter tuning.
We take great care to ensure that the hyperparameter tuning is fair.
Concretely, we randomly holdout a portion of samples from the ID and outlier training set to serve as ID/OOD validation data.
Critically, note that the OOD validation data reveals no information about the test-time OOD distribution since we already filter out all relevant images from $\mathcal{D}_\text{out}$.

With the selected ID and OOD validation samples, we tune the hyperparameters such that the OOD detection performance is maximized and the ID classification accuracy is minimally affected.
To test the method robustness, in each of the four environments we only tune the hyperparameter once for each approach using a single split; the determined hyperparameter is then applied to all splits from the same dataset.
In Appendix <ref> we present a detailed list of the candidate hyperparameter values and the final deteremined values we use for each method in our experiments.

The evaluation procedure follows the one described in Sec. <ref> and Sec. <ref>.
For each dataset, we consider the holdout classes as fine-grained OOD data and the samples from other datasets as coarse-grained OOD data.
Following [14, 22, 21], we consider ID as positive and OOD as negative, and use TNR95 and AUROC as the metrics.

§.§ Results

Detection performance.
Tab. <ref> shows the TNR95 results across the four test benches.
The AUROC statistics yield similar patterns to TNR95 and are left in the expanded Tab. <ref> in Appendix <ref>.

Our first observation is that MixOE consistently achieves the best detection performance against fine-grained OOD samples.
Specifically, averaged across the three splits on the [, , , ] tasks, MixOE-linear and MixOE-cut improve the TNR95 over MSP by [+6.1%, +6.9%, +5.7%, +4.3%] and [+8.0%, +12.8%, +7.4%, +4.3%], respectively.
In comparison, vanilla OE's relative improvement over MSP is [–1.3%, –3.6%, –1.8%, –1.0%].
Similar to OE, the other baseline methods also result in performance degradation in the face of fine-grained OOD on many (if not all) datasets.
We also remark that MixOE-linear and MixOE-cut both lead to significant improvements, demonstrating that the validity of the idea behind MixOE is independent of the specific mixing operations being used.

Our second observation is that MixOE can perform on par with state-of-the-art methods in detecting coarse-grained OOD samples.
On the four tasks MixOE-linear and MixOE-cut improve the TNR95 over MSP by [+20.0%, +12.2%, +6.4%, +17.6%] and [+28.0%, +12.5%, +5.4%, +23.2%], respectively.
OE, whose effect is exclusively towards coarse-grained OOD data, leads to improvements of [+27.6%, +12.5%, +4.9%, +29.3%].

Finally, we note that MixOE is the only method that consistently improves upon MSP against both fine- and coarse-grained novelties across all the datasets.
This unique capability of MixOE to remain effective across a spectrum of OOD granularities is critical for systems that operate in fine-grained environments, as the novel inputs during inference can be either coarse or fine.
Overall, these evaluation results display the effectiveness of MixOE for building up reliable OOD detectors in real-world fine-grained settings.

Prediction confidences.
To more closely understand how MixOE improves the OOD detection, we monitor the confidence distributions of the models on ID/OOD samples as MixOE functions by calibrating the predication confidence.

Fig. <ref> shows the probability density plots of prediction confidence on Standard, OE, OE-M, and MixOE models on one of the splits from each dataset (see Appendix <ref> Fig. <ref>-<ref> for more).
From Fig. <ref> we can clearly identify that, regardless of the mixing operation, the MixOE models consistently produce lower confidence predictions on fine-grained OOD samples, making them more distinguishable from ID inputs.
This observation confirms that the virtual outlier data and their corresponding soft targets introduced in MixOE indeed help regularize the model's outputs on fine-grained OOD samples.

Comparison of the prediction confidence's distribution between methods. MixOE leads to clearer separation between the confidence of ID and OOD samples (especially fine-grained ones) and thus enables better detection.

ID classification accuracy.
Lastly, we examine how the training methods can affect the ID classification accuracy because we do not intend to tradeoff accuracy for detection performance.
In Tab. <ref> we show the accuracy on each dataset averaged across the three splits (see Appendix <ref> Tab. <ref> for unaveraged results).
Interestingly, unlike other training strategies, MixOE-linear and MixOE-cut can improve the accuracy by 0.9% and 1.1% on average across the four environments, respectively.

Our hypothesis here is that since the fine-grained datasets often have relatively small number of training samples (, tens of images per class), some of the training “outliers” generated by MixOE that are close to the ID clusters actually serve as augmented data and thus contribute to the ID accuracy.

§.§ Ablation study

MixOE v.s. Mix.
Recall that the core idea of MixOE is to mix ID and outlier data for DNN training.
In Sec. <ref> we have shown that this concept is more beneficial than using the outlier data alone without mixing (vanilla OE).
Here we ablate MixOE along another direction: We contrast MixOE with vanilla Mix training [48, 47] which does not use the auxiliary outlier data, , mixing only ID data.

Concretely, for Mix training the generation of virtual outlier samples in Eqn. <ref> is changed to $(\tilde{x},\tilde{y})=(\text{mix}(x_1,x_2,\lambda),\lambda y_1+(1-\lambda)y_2)$, where $(x_1,y_1),(x_2,y_2)\sim\Din$.
The hyperparameter tuning procedure and training setup is the same as those for MixOE.

The comparison is presented in Fig. <ref>, where we show the methods' average improvements in TNR95 relative to the baseline MSP across the three splits on each dataset.
We find that Mix training is able to provide performance gains in detecting fine-grained OOD data, but the gains are smaller than those brought by MixOE;
meanwhile, Mix training rarely improves the coarse-grained OOD detection rates.

MixOE v.s. Mix + OE.
Finally, we investigate whether naively combining the Mix and OE objective together can achieve similar effect to MixOE.
A detailed analysis is given in Appendix <ref>.
The takeaway here is that Mix + OE will lead to manifold intrusion [8], where the training will assign distinct targets to inputs that are close to each other in the DNN's feature space, causing significant learning difficulty for the model.
Indeed, we find that when combining Mix and OE together, the model's accuracy can decrease by up to 10%, and the TNR95 can be worse than MSP by 10% and 20% against coarse- and fine-grained OOD samples, respectively.
The results clearly demonstrate that MixOE's formulation is unique, effective, and cannot be replaced by a simple/naive combination of two existing objectives.

Comparison between MixOE and vanilla Mix training (without using outlier data) in terms of average difference in TNR95 relative to MSP. MixOE outperforms Mix against both coarse-/fine-grained OOD data.

§ CONCLUSION

In this work, we propose Mixture Outlier Exposure, a DNN training algorithm for OOD detection in fine-grained environments.
MixOE explicitly expand the coverage over the broad OOD region by mixing ID data and training outlier samples.
The mixed samples are used to regularize the model's behaviour such that the prediction confidence smoothly decays when the inputs transition from ID to OOD.
Experimental results in the four newly constructed large-scale fine-grained environments demonstrate that MixOE is able to improve detection rates against both coarse- and fine-grained OOD samples, while other methods hardly help with fine-grained detection.
We hope that this work will facilitate and inspire future research on OOD detection in the challenging fine-grained settings.

§ ACKNOWLEDGEMENT

This work is supported by FA8750-21-1-1015 and NSF-2140247.

[1]
Faruk Ahmed and Aaron Courville.
Detecting semantic anomalies.
In Proceedings of the AAAI Conference on Artificial
Intelligence, volume 34, pages 3154–3162, 2020.

[2]
Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha.
Atom: Robustifying out-of-distribution detection using outlier
In Joint European Conference on Machine Learning and Knowledge
Discovery in Databases, pages 430–445. Springer, 2021.

[3]
Tianshui Chen, Wenxi Wu, Yuefang Gao, Le Dong, Xiaonan Luo, and Liang Lin.
Fine-grained representation learning and recognition by exploiting
hierarchical semantic embedding.
In Proceedings of the 26th ACM international conference on
Multimedia, pages 2023–2031, 2018.

[4]
Sanghyuk Chun, Seong Joon Oh, Sangdoo Yun, Dongyoon Han, Junsuk Choe, and
Youngjoon Yoo.
An empirical evaluation on robustness and uncertainty of
regularization methods.
arXiv preprint arXiv:2003.03879, 2020.

[5]
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei.
Imagenet: A large-scale hierarchical image database.
In 2009 IEEE conference on computer vision and pattern
recognition, pages 248–255. Ieee, 2009.

[6]
Xuefeng Du, Zhaoning Wang, Mu Cai, and Sharon Li.
Towards unknown-aware learning with virtual outlier synthesis.
In International Conference on Learning Representations, 2022.

[7]
Mengran Fan, Tapabrata Chakraborti, I Eric, Chao Chang, Yan Xu, and Jens
Microscopic fine-grained instance classification through deep
In International Conference on Medical Image Computing and
Computer-Assisted Intervention, pages 490–499. Springer, 2020.

[8]
Hongyu Guo, Yongyi Mao, and Richong Zhang.
Mixup as locally linear out-of-manifold regularization.
In Proceedings of the AAAI Conference on Artificial
Intelligence, volume 33, pages 3714–3722, 2019.

[9]
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun.
Deep residual learning for image recognition.
In Proceedings of the IEEE conference on computer vision and
pattern recognition, pages 770–778, 2016.

[10]
Dan Hendrycks, Steven Basart, Mantas Mazeika, Mohammadreza Mostajabi, Jacob
Steinhardt, and Dawn Song.
Scaling out-of-distribution detection for real-world settings.
arXiv preprint arXiv:1911.11132, 2019.

[11]
Dan Hendrycks and Kevin Gimpel.
A baseline for detecting misclassified and out-of-distribution
examples in neural networks.
In International Conference on Learning Representations, 2017.

[12]
Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich.
Deep anomaly detection with outlier exposure.
In International Conference on Learning Representations, 2018.

[13]
Yen-Chi Hsu, Cheng-Yao Hong, Ding-Jie Chen, Ming-Sui Lee, Davi Geiger, and
Tyng-Luh Liu.
Fine-grained visual recognition with batch confusion norm.
arXiv preprint arXiv:1910.12423, 2019.

[14]
Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira.
Generalized odin: Detecting out-of-distribution image without
learning from out-of-distribution data.
In Proceedings of the IEEE/CVF Conference on Computer Vision and
Pattern Recognition, pages 10951–10960, 2020.

[15]
Rui Huang, Andrew Geng, and Yixuan Li.
On the importance of gradients for detecting distributional shifts in
the wild.
arXiv preprint arXiv:2110.00218, 2021.

[16]
Nathan Inkawhich, Eric Davis, Matthew Inkawhich, Uttam Majumder, and Yiran
Training sar-atr models for reliable operation in open-world
IEEE Journal of Selected Topics in Applied Earth Observations
and Remote Sensing, 14:3954–3966, 2021.

[17]
Ramneet Kaur, Susmit Jha, Anirban Roy, Oleg Sokolsky, and Insup Lee.
Are all outliers alike? on understanding the diversity of outliers
for detecting oods.
arXiv preprint arXiv:2103.12628, 2021.

[18]
Umar Khalid.
The method is not scalable., 2022.

[19]
Aditya Khosla, Nityananda Jayadevaprakash, Bangpeng Yao, and Fei-Fei Li.
Novel dataset for fine-grained image categorization: Stanford dogs.
In Proc. CVPR Workshop on Fine-Grained Visual Categorization
(FGVC), volume 2. Citeseer, 2011.

[20]
Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei.
3d object representations for fine-grained categorization.
In 4th International IEEE Workshop on 3D Representation and
Recognition (3dRR-13), Sydney, Australia, 2013.

[21]
Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin.
Training confidence-calibrated classifiers for detecting
out-of-distribution samples.
In International Conference on Learning Representations, 2018.

[22]
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin.
A simple unified framework for detecting out-of-distribution samples
and adversarial attacks.
In NeurIPS, 2018.

[23]
Qing Li, Weidong Cai, Xiaogang Wang, Yun Zhou, David Dagan Feng, and Mei Chen.
Medical image classification with convolutional neural network.
In 2014 13th international conference on control automation
robotics & vision (ICARCV), pages 844–848. IEEE, 2014.

[24]
Wen Li, Limin Wang, Wei Li, Eirikur Agustsson, and Luc Van Gool.
Webvision database: Visual learning and understanding from web data.
arXiv preprint arXiv:1708.02862, 2017.

[25]
Shiyu Liang, Yixuan Li, and R Srikant.
Enhancing the reliability of out-of-distribution image detection in
neural networks.
In International Conference on Learning Representations, 2018.

[26]
Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li.
Energy-based out-of-distribution detection.
Advances in Neural Information Processing Systems, 33, 2020.

[27]
Ilya Loshchilov and Frank Hutter.
Sgdr: Stochastic gradient descent with warm restarts.
arXiv preprint arXiv:1608.03983, 2016.

[28]
S. Maji, J. Kannala, E. Rahtu, M. Blaschko, and A. Vedaldi.
Fine-grained visual classification of aircraft.
Technical report, 2013.

[29]
George A Miller.
Wordnet: a lexical database for english.
Communications of the ACM, 38(11):39–41, 1995.

[30]
Tianyu Pang, Kun Xu, Yinpeng Dong, Chao Du, Ning Chen, and Jun Zhu.
Rethinking softmax cross-entropy loss for adversarial robustness.
In International Conference on Learning Representations, 2019.

[31]
Pramuditha Perera and Vishal M Patel.
Deep transfer learning for multiple class novelty detection.
In Proceedings of the IEEE/CVF Conference on Computer Vision and
Pattern Recognition, pages 11544–11552, 2019.

[32]
Alec Radford, Luke Metz, and Soumith Chintala.
Unsupervised representation learning with deep convolutional
generative adversarial networks.
arXiv preprint arXiv:1511.06434, 2015.

[33]
Deepak Ravikumar, Sangamesh Kodge, Isha Garg, and Kaushik Roy.
Exploring vicinal risk minimization for lightweight
out-of-distribution detection.
arXiv preprint arXiv:2012.08398, 2020.

[34]
Ryne Roady, Tyler L Hayes, Ronald Kemker, Ayesha Gonzales, and Christopher
Are open set classification methods effective on large-scale
Plos one, 15(9):e0238302, 2020.

[35]
Shibani Santurkar, Dimitris Tsipras, and Aleksander Madry.
{BREEDS}: Benchmarks for subpopulation shift.
In International Conference on Learning Representations, 2021.

[36]
Chandramouli Shama Sastry and Sageev Oore.
Detecting out-of-distribution examples with gram matrices.
In International Conference on Machine Learning, pages
8491–8501. PMLR, 2020.

[37]
Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin.
Csi: Novelty detection via contrastive learning on distributionally
shifted instances.
Advances in Neural Information Processing Systems, 33, 2020.

[38]
Engkarat Techapanurak, Anh-Chuong Dang, and Takayuki Okatani.
Bridging in-and out-of-distribution samples for their better
arXiv preprint arXiv:2101.02500, 2021.

[39]
Engkarat Techapanurak and Takayuki Okatani.
Practical evaluation of out-of-distribution detection methods for
image classification.
arXiv preprint arXiv:2101.02447, 2021.

[40]
Sunil Thulasidasan, Gopinath Chennupati, Jeff A Bilmes, Tanmoy Bhattacharya,
and Sarah Michalak.
On mixup training: Improved calibration and predictive uncertainty
for deep neural networks.
In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural
Information Processing Systems, volume 32. Curran Associates, Inc., 2019.

[41]
Grant Van Horn, Steve Branson, Ryan Farrell, Scott Haber, Jessie Barry, Panos
Ipeirotis, Pietro Perona, and Serge Belongie.
Building a bird recognition app and large scale dataset with citizen
scientists: The fine print in fine-grained dataset collection.
In Proceedings of the IEEE Conference on Computer Vision and
Pattern Recognition, pages 595–604, 2015.

[42]
C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie.
The Caltech-UCSD Birds-200-2011 Dataset.
Technical Report CNS-TR-2011-001, California Institute of Technology,

[43]
Jim Winkens, Rudy Bunel, Abhijit Guha Roy, Robert Stanforth, Vivek Natarajan,
Joseph R Ledsam, Patricia MacWilliams, Pushmeet Kohli, Alan Karthikesalingam,
Simon Kohl, et al.
Contrastive training for improved out-of-distribution detection.
arXiv preprint arXiv:2007.05566, 2020.

[44]
Gui-Song Xia, Xiang Bai, Jian Ding, Zhen Zhu, Serge Belongie, Jiebo Luo, Mihai
Datcu, Marcello Pelillo, and Liangpei Zhang.
Dota: A large-scale dataset for object detection in aerial images.
In Proceedings of the IEEE Conference on Computer Vision and
Pattern Recognition, pages 3974–3983, 2018.

[45]
Gui-Song Xia, Jingwen Hu, Fan Hu, Baoguang Shi, Xiang Bai, Yanfei Zhong,
Liangpei Zhang, and Xiaoqiang Lu.
Aid: A benchmark data set for performance evaluation of aerial scene
IEEE Transactions on Geoscience and Remote Sensing,
55(7):3965–3981, 2017.

[46]
Shaokang Yang, Shuai Liu, Cheng Yang, and Changhu Wang.
Re-rank coarse classification with local region enhanced features for
fine-grained image recognition.
arXiv preprint arXiv:2102.09875, 2021.

[47]
Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and
Youngjoon Yoo.
Cutmix: Regularization strategy to train strong classifiers with
localizable features.
In Proceedings of the IEEE/CVF International Conference on
Computer Vision, pages 6023–6032, 2019.

[48]
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz.
mixup: Beyond empirical risk minimization.
In International Conference on Learning Representations, 2018.

[49]
Heliang Zheng, Jianlong Fu, Tao Mei, and Jiebo Luo.
Learning multi-attention convolutional neural network for
fine-grained image recognition.
In Proceedings of the IEEE international conference on computer
vision, pages 5209–5217, 2017.

[50]
Xiao Xiang Zhu, Devis Tuia, Lichao Mou, Gui-Song Xia, Liangpei Zhang, Feng Xu,
and Friedrich Fraundorfer.
Deep learning in remote sensing: A comprehensive review and list of
IEEE Geoscience and Remote Sensing Magazine, 5(4):8–36, 2017.

§ DETAILS OF THE CONSTRUCTED ID/OOD SPLITS

In Tab. <ref> we list the number of train/validation/test images in each ID split and the number of holdout images in each holdout (fine-grained) OOD split.
The exact classes in each split is presented below.
Note, the  and  dataset do not have explicit class identifier, so we create numerical index ourselves.
Please see our code for details.

* Split 1

* ID: 26, 86, 2, 55, 75, 93, 16, 73, 54, 95, 53, 92, 78, 13, 7, 30, 22, 24, 33, 8, 43, 62, 3, 71, 45, 48, 6, 99, 82, 76, 60, 80, 90, 68, 51, 27, 18, 56, 63, 74, 1, 61, 42, 41, 4, 15, 17, 40, 38, 5, 91, 59, 0, 34, 28, 50, 11, 35, 23, 52, 10, 31, 66, 57, 79, 85, 32, 84, 14, 89, 19, 29, 49, 97, 98, 69, 20, 94, 72, 77, 25, 37, 81, 46, 39, 65, 58, 12, 88, 70;

* OOD: 9, 21, 36, 44, 47, 64, 67, 83, 87, 96;

* Split 2

* ID: 80, 84, 33, 81, 93, 17, 36, 82, 69, 65, 92, 39, 56, 52, 51, 32, 31, 44, 78, 10, 2, 73, 97, 62, 19, 35, 94, 27, 46, 38, 67, 99, 54, 95, 88, 40, 48, 59, 23, 34, 86, 53, 77, 15, 83, 41, 45, 91, 26, 98, 43, 55, 24, 4, 58, 49, 21, 87, 3, 74, 30, 66, 70, 42, 47, 89, 8, 60, 0, 90, 57, 22, 61, 63, 7, 96, 13, 68, 85, 14, 29, 28, 11, 18, 20, 50, 25, 6, 71, 76;

* OOD: 1, 5, 9, 12, 16, 37, 64, 72, 75, 79;

* Split 3

* ID: 83, 30, 56, 24, 16, 23, 2, 27, 28, 13, 99, 92, 76, 14, 0, 21, 3, 29, 61, 79, 35, 11, 84, 44, 73, 5, 25, 77, 74, 62, 65, 1, 18, 48, 36, 78, 6, 89, 91, 10, 12, 53, 87, 54, 95, 32, 19, 26, 60, 55, 9, 96, 17, 59, 57, 41, 64, 45, 97, 8, 71, 94, 90, 98, 86, 80, 50, 52, 66, 88, 70, 46, 68, 69, 81, 58, 33, 38, 51, 42, 4, 67, 39, 37, 20, 31, 63, 47, 85, 93;

* OOD: 7, 15, 22, 34, 40, 43, 49, 72, 75, 82;

* Split 1

* ID: 83, 12, 33, 113, 171, 134, 163, 124, 74, 18, 7, 5, 125, 161, 170, 181, 123, 60, 44, 141, 56, 173, 136, 89, 63, 55, 110, 166, 175, 45, 22, 155, 66, 37, 4, 80, 178, 106, 160, 26, 139, 143, 71, 8, 61, 130, 122, 101, 118, 92, 185, 24, 30, 109, 40, 137, 150, 90, 19, 149, 180, 54, 159, 16, 51, 177, 135, 108, 86, 96, 183, 146, 193, 14, 27, 97, 156, 46, 191, 190, 62, 2, 59, 111, 112, 43, 10, 98, 73, 188, 179, 144, 129, 93, 107, 154, 187, 50, 0, 94, 145, 95, 64, 138, 41, 69, 49, 48, 85, 13, 164, 23, 182, 131, 20, 15, 78, 104, 52, 100, 76, 3, 116, 194, 126, 6, 68, 75, 84, 121, 157, 167, 152, 91, 168, 11, 119, 102, 35, 57, 65, 1, 120, 158, 42, 105, 132, 169, 17, 38;

* OOD: 9, 21, 25, 28, 29, 31, 32, 34, 36, 39, 47, 53, 58, 67, 70, 72, 77, 79, 81, 82, 87, 88, 99, 103, 114, 115, 117, 127, 128, 133, 140, 142, 147, 148, 151, 153, 162, 165, 172, 174, 176, 184, 186, 189, 192, 195;

* Split 2

* ID: 127, 11, 110, 124, 18, 165, 44, 28, 171, 136, 51, 29, 105, 56, 53, 174, 16, 164, 143, 99, 27, 130, 78, 168, 108, 191, 31, 35, 173, 4, 113, 112, 116, 82, 186, 69, 169, 40, 102, 182, 58, 14, 47, 19, 81, 39, 95, 118, 73, 67, 59, 33, 176, 154, 181, 195, 138, 117, 161, 90, 42, 17, 5, 159, 66, 48, 54, 190, 98, 89, 163, 107, 12, 120, 119, 114, 151, 84, 145, 123, 13, 188, 175, 45, 93, 36, 158, 183, 150, 97, 94, 193, 103, 170, 75, 21, 91, 155, 2, 70, 85, 147, 6, 106, 0, 152, 77, 65, 55, 122, 88, 179, 46, 62, 74, 92, 189, 184, 194, 87, 180, 177, 132, 10, 34, 32, 162, 38, 83, 153, 100, 125, 23, 126, 9, 167, 104, 148, 135, 111, 185, 64, 15, 41, 160, 109, 80, 52, 26, 76;

* OOD: 1, 3, 7, 8, 20, 22, 24, 25, 30, 37, 43, 49, 50, 57, 60, 61, 63, 68, 71, 72, 79, 86, 96, 101, 115, 121, 128, 129, 131, 133, 134, 137, 139, 140, 141, 142, 144, 146, 149, 156, 157, 166, 172, 178, 187, 192;

* Split 3

* ID: 10, 79, 165, 143, 163, 134, 35, 137, 25, 2, 12, 128, 180, 3, 48, 29, 14, 119, 6, 23, 108, 144, 130, 175, 45, 120, 174, 125, 9, 164, 54, 13, 109, 169, 78, 114, 44, 82, 159, 123, 161, 94, 57, 41, 66, 98, 5, 53, 111, 11, 183, 24, 147, 64, 8, 195, 171, 28, 131, 71, 42, 65, 135, 113, 173, 189, 106, 140, 155, 187, 126, 92, 1, 85, 188, 146, 156, 184, 89, 36, 176, 100, 62, 0, 27, 153, 172, 178, 20, 154, 152, 139, 77, 30, 150, 17, 59, 186, 112, 166, 127, 158, 93, 115, 21, 55, 16, 142, 91, 99, 118, 193, 74, 122, 157, 141, 192, 87, 90, 84, 18, 97, 101, 160, 133, 61, 81, 138, 68, 129, 56, 19, 86, 70, 60, 34, 40, 76, 149, 26, 32, 191, 96, 83, 110, 105, 73, 117, 145, 151;

* OOD: 4, 7, 15, 22, 31, 33, 37, 38, 39, 43, 46, 47, 49, 50, 51, 52, 58, 63, 67, 69, 72, 75, 80, 88, 95, 102, 103, 104, 107, 116, 121, 124, 132, 136, 148, 162, 167, 168, 170, 177, 179, 181, 182, 185, 190, 194;

* Split 1

* ID: 018, 170, 107, 098, 177, 182, 005, 146, 012, 152, 061, 125, 180, 154, 080, 007, 033, 130, 037, 074, 183, 145, 045, 159, 060, 123, 179, 185, 122, 044, 016, 055, 150, 111, 022, 189, 129, 004, 083, 106, 134, 066, 026, 113, 168, 063, 008, 075, 118, 143, 071, 124, 184, 097, 149, 024, 030, 160, 040, 056, 131, 096, 181, 019, 153, 092, 054, 163, 051, 086, 139, 090, 137, 101, 144, 089, 109, 014, 027, 141, 187, 046, 138, 195, 108, 062, 002, 059, 136, 197, 043, 010, 194, 073, 196, 178, 175, 126, 093, 112, 158, 191, 050, 094, 110, 095, 064, 167, 041, 069, 049, 048, 085, 013, 161, 023, 186, 135, 020, 015, 078, 104, 052, 100, 076, 003, 116, 164, 198, 006, 068, 084, 121, 155, 171, 156, 091, 199, 011, 119, 102, 035, 057, 065, 001, 120, 162, 042, 105;

* OOD: 009, 017, 021, 025, 028, 029, 031, 032, 034, 036, 038, 039, 047, 053, 058, 067, 070, 072, 077, 079, 081, 082, 087, 088, 099, 103, 114, 115, 117, 127, 128, 132, 133, 140, 142, 147, 148, 151, 157, 165, 166, 169, 172, 173, 174, 176, 188, 190, 192, 193;

* Split 2

* ID: 058, 040, 034, 102, 184, 198, 095, 004, 029, 168, 171, 018, 011, 089, 110, 118, 159, 035, 136, 059, 051, 016, 044, 094, 031, 162, 038, 028, 193, 027, 047, 165, 194, 177, 176, 097, 174, 073, 069, 172, 108, 107, 189, 014, 056, 019, 114, 039, 185, 124, 098, 123, 119, 053, 033, 179, 181, 106, 199, 138, 116, 067, 078, 042, 017, 005, 127, 105, 048, 066, 054, 084, 183, 158, 166, 113, 012, 117, 093, 120, 154, 090, 081, 122, 191, 013, 082, 132, 187, 045, 099, 036, 161, 186, 153, 103, 195, 197, 148, 173, 075, 021, 091, 152, 002, 070, 085, 150, 006, 112, 155, 077, 065, 055, 167, 088, 130, 046, 062, 074, 092, 147, 160, 143, 087, 180, 145, 164, 010, 032, 083, 182, 100, 125, 023, 126, 009, 170, 104, 151, 135, 111, 188, 064, 015, 041, 163, 109, 080;

* OOD: 001, 003, 007, 008, 020, 022, 024, 025, 026, 030, 037, 043, 049, 050, 052, 057, 060, 061, 063, 068, 071, 072, 076, 079, 086, 096, 101, 115, 121, 128, 129, 131, 133, 134, 137, 139, 140, 141, 142, 144, 146, 149, 156, 157, 169, 175, 178, 190, 192, 196;

* Split 3

* ID: 112, 029, 182, 199, 193, 085, 010, 054, 115, 035, 012, 092, 013, 126, 174, 002, 044, 003, 113, 014, 023, 025, 006, 134, 165, 173, 045, 065, 048, 122, 178, 064, 009, 057, 078, 071, 128, 176, 131, 053, 137, 163, 111, 123, 109, 141, 041, 130, 140, 005, 159, 100, 011, 187, 024, 089, 066, 008, 172, 175, 028, 133, 094, 042, 169, 082, 184, 106, 108, 143, 180, 166, 146, 079, 001, 119, 192, 149, 160, 188, 147, 036, 171, 179, 062, 027, 157, 098, 118, 020, 158, 156, 142, 077, 030, 154, 017, 059, 181, 114, 127, 139, 191, 093, 151, 021, 055, 016, 152, 091, 099, 120, 197, 074, 190, 161, 144, 196, 087, 090, 084, 018, 097, 101, 125, 164, 135, 061, 081, 068, 129, 056, 019, 086, 070, 060, 034, 040, 138, 076, 153, 026, 032, 195, 096, 083, 110, 105, 073;

* OOD: 004, 007, 015, 022, 031, 033, 037, 038, 039, 043, 046, 047, 049, 050, 051, 052, 058, 063, 067, 069, 072, 075, 080, 088, 095, 102, 103, 104, 107, 116, 117, 121, 124, 132, 136, 145, 148, 150, 155, 162, 167, 168, 170, 177, 183, 185, 186, 189, 194, 198;

* Split 1

* ID: 0518, 0400, 0530, 0461, 0510, 0560, 0478, 0626, 0371, 0495, 0509, 0631, 0469, 0549, 0513, 0381, 0604, 0531, 0517, 0457, 0548, 0353, 0638, 0498, 0470, 0651, 0316, 0363, 0618, 0345, 0556, 0486, 0471, 0558, 0528, 0505, 0547, 0313, 0330, 0551, 0485, 0320, 0546, 0539, 0450, 0489, 0619, 0352, 0372, 0542, 0379, 0522, 0519, 0393, 0367, 0612, 0628, 0326, 0620, 0323, 0512, 0382, 0315, 0449, 0544, 0645, 0341, 0468, 0516, 0625, 0642, 0611, 0452, 0324, 0456, 0392, 0467, 0536, 0299, 0476, 0369, 0484, 0360, 0374, 0334, 0630, 0514, 0623, 0348, 0321, 0298, 0466, 0332, 0338, 0624, 0368, 0364, 0499, 0482, 0327, 0550, 0496, 0362, 0601, 0397, 0359, 0297, 0616, 0464, 0494, 0446, 0318, 0504, 0541, 0634, 0349, 0322, 0335, 0358, 0632, 0328, 0540, 0354, 0533, 0647, 0483, 0609, 0538, 0370, 0607, 0526, 0490, 0515, 0497, 0351, 0559, 0506, 0521, 0472, 0603, 0458, 0520, 0453, 0561, 0640, 0473, 0295, 0454, 0455, 0377, 0357, 0356, 0402, 0649, 0501, 0331, 0621, 0503, 0395, 0460, 0491, 0602, 0650, 0314, 0376, 0401, 0481, 0635, 0615, 0637, 0643, 0554, 0451, 0614, 0629, 0319, 0479, 0462, 0343, 0365, 0529, 0373, 0296, 0480, 0600, 0350, 0465, 0492, 0617, 0325, 0346, 0493, 0361, 0524, 0646, 0488, 0342, 0336, 0543, 0474;

* OOD: 0317, 0329, 0333, 0337, 0339, 0340, 0344, 0347, 0355, 0366, 0375, 0378, 0380, 0394, 0396, 0398, 0399, 0447, 0448, 0459, 0463, 0475, 0477, 0487, 0500, 0502, 0507, 0508, 0511, 0523, 0525, 0527, 0532, 0534, 0535, 0537, 0545, 0552, 0553, 0555, 0557, 0599, 0605, 0606, 0608, 0610, 0613, 0622, 0627, 0633, 0636, 0639, 0641, 0644, 0648;

* Split 2

* ID: 0542, 0342, 0470, 0472, 0623, 0467, 0519, 0335, 0642, 0546, 0651, 0370, 0299, 0625, 0352, 0529, 0492, 0359, 0487, 0498, 0381, 0477, 0548, 0528, 0626, 0448, 0346, 0505, 0462, 0490, 0375, 0320, 0453, 0395, 0402, 0459, 0347, 0551, 0644, 0608, 0512, 0607, 0479, 0339, 0326, 0616, 0527, 0327, 0534, 0366, 0341, 0533, 0343, 0319, 0337, 0295, 0518, 0544, 0641, 0510, 0541, 0629, 0633, 0336, 0324, 0618, 0648, 0355, 0603, 0348, 0450, 0649, 0377, 0474, 0480, 0550, 0635, 0605, 0540, 0367, 0451, 0650, 0628, 0523, 0455, 0482, 0322, 0521, 0530, 0329, 0449, 0364, 0615, 0363, 0476, 0401, 0361, 0637, 0539, 0466, 0627, 0350, 0325, 0313, 0547, 0483, 0356, 0478, 0640, 0374, 0378, 0620, 0646, 0537, 0543, 0362, 0645, 0458, 0630, 0520, 0468, 0561, 0457, 0549, 0399, 0557, 0465, 0610, 0454, 0604, 0398, 0484, 0524, 0532, 0321, 0621, 0531, 0353, 0507, 0463, 0344, 0602, 0638, 0555, 0508, 0392, 0514, 0617, 0554, 0297, 0643, 0314, 0611, 0599, 0394, 0473, 0373, 0511, 0354, 0382, 0452, 0545, 0447, 0503, 0536, 0318, 0522, 0340, 0496, 0526, 0400, 0559, 0525, 0515, 0460, 0485, 0331, 0486, 0317, 0614, 0464, 0513, 0553, 0495, 0471, 0636, 0372, 0323, 0349, 0631, 0469, 0397, 0360, 0334, 0393, 0351, 0332, 0556, 0298, 0613;

* OOD: 0296, 0315, 0316, 0328, 0330, 0333, 0338, 0345, 0357, 0358, 0365, 0368, 0369, 0371, 0376, 0379, 0380, 0396, 0446, 0456, 0461, 0475, 0481, 0488, 0489, 0491, 0493, 0494, 0497, 0499, 0500, 0501, 0502, 0504, 0506, 0509, 0516, 0517, 0535, 0538, 0552, 0558, 0560, 0600, 0601, 0606, 0609, 0612, 0619, 0622, 0624, 0632, 0634, 0639, 0647;

* Split 3

* ID: 0361, 0321, 0504, 0454, 0519, 0379, 0402, 0343, 0298, 0478, 0550, 0362, 0451, 0394, 0373, 0318, 0643, 0349, 0382, 0636, 0625, 0543, 0453, 0469, 0626, 0609, 0488, 0401, 0332, 0338, 0372, 0611, 0487, 0328, 0336, 0541, 0491, 0450, 0486, 0461, 0620, 0619, 0331, 0621, 0627, 0322, 0337, 0531, 0326, 0529, 0557, 0640, 0333, 0475, 0480, 0542, 0511, 0500, 0521, 0624, 0617, 0374, 0352, 0490, 0314, 0320, 0515, 0313, 0603, 0297, 0616, 0525, 0473, 0553, 0471, 0533, 0524, 0493, 0459, 0523, 0449, 0628, 0317, 0547, 0648, 0353, 0472, 0560, 0647, 0502, 0356, 0350, 0507, 0539, 0645, 0365, 0629, 0513, 0396, 0474, 0605, 0642, 0630, 0514, 0633, 0482, 0296, 0319, 0614, 0535, 0623, 0316, 0526, 0622, 0512, 0548, 0501, 0494, 0466, 0518, 0458, 0618, 0516, 0329, 0520, 0479, 0551, 0637, 0499, 0395, 0552, 0612, 0468, 0540, 0599, 0532, 0399, 0495, 0602, 0549, 0638, 0517, 0344, 0452, 0370, 0295, 0335, 0460, 0632, 0600, 0561, 0544, 0503, 0325, 0367, 0536, 0641, 0509, 0483, 0363, 0324, 0604, 0546, 0606, 0447, 0506, 0457, 0485, 0369, 0398, 0651, 0376, 0489, 0364, 0327, 0446, 0378, 0497, 0368, 0342, 0348, 0498, 0393, 0613, 0334, 0340, 0646, 0456, 0400, 0470, 0465, 0545, 0381, 0477, 0510, 0505, 0559, 0650, 0538, 0496;

* OOD: 0299, 0315, 0323, 0330, 0339, 0341, 0345, 0346, 0347, 0351, 0354, 0355, 0357, 0358, 0359, 0360, 0366, 0371, 0375, 0377, 0380, 0392, 0397, 0448, 0455, 0462, 0463, 0464, 0467, 0476, 0481, 0484, 0492, 0508, 0522, 0527, 0528, 0530, 0534, 0537, 0554, 0555, 0556, 0558, 0601, 0607, 0608, 0610, 0615, 0631, 0634, 0635, 0639, 0644, 0649;

§ HYPERPARAMETERS OF THE METHODS

In Tab. <ref> we list the candidate values and final determined values for each method's hyperparameters.
We make a few notes on the meaning of each symbol.
For ODIN and Energy, $\tau$ is the temperature factor used to scale the model logits.
Note, we do not use input pre-processing for ODIN as it is known that the perturbation hyperparameter may need exact test OOD distribution to tune [12, 14], and ODIN's performance is largely attributed to the temperature scaling rather than the pre-processing
For Rotation, OE, and OE-M, $\beta$ is the weighting term that controls the contribution of their regularization objective.

For EnergyOE, $m_{\text{in}}$ and $m_{\text{out}}$ is the energy threshold for ID and training outlier data, respectively.
We use $\beta=0.1$ for EnergyOE, as we find that a larger $\beta$ can hurt ID accuracy.
For Mix and MixOE training, $\beta$ again weights the regularization strength (see Eqn. <ref>).
$\alpha$ is used to parameterize the Beta distribution for the mixing operations.

§ VISUALIZATION PROCEDURE

Following [30], the visualization is enabled by training a “visualization” layer (denoted as vis layer for brevity).
Specifically, the vis layer is a fully-connected layer that maps the output of DNN's penultimate layer (in our case with ResNet-50 the output is a 2048-dimensional vector) to a 2D space.
When training such vis layer, we concatenate it to the penultimate layer of the ResNet and add another consequent linear layer that maps the 2D output of the vis layer to the class logits.
Critically, the vis layer is trained by minimizing the cross-entropy loss on ID training data only; no OOD data are ever involved.
This ensures that the process remains agnostic to any OOD samples.
Also, during the training the preceding layers of the DNN model are freezed, so the visualization is faithful to the model.
After the training, the visualization is performed by simply passing inputs into the model and taking the 2D outputs of the vis layer.

§ ANALYSIS ON ABLATION STUDY

In this section, we conduct further analysis to explain the ablation study results presented in Fig. <ref>.

Why MixOE is better than Mix training.
To explain these results, using the same idea as Fig. <ref>, in Fig. <ref> we visualize the training outliers used by Mix and MixOE in the feature space of a standardly trained model (see Fig. <ref>-<ref> for more).

Similar to MixOE, Mix training's data can also cover a broader space of the OOD region, which accounts for their improved performance against fine-grained OOD data.
However, one problem we notice is that the confidence encoded in the soft targets of Mix training is still relatively high (above 50%) even when the corresponding inputs are already far away from the ID clusters.

This is because when interpolating between two one-hot labels (as Mix does), the minimum confidence that can be achieved is 50%.
Consequently, during Mix training the prediction confidence of the OOD samples that are relatively far away from the ID clusters may not be pushed towards the lowest level (, resembling uniform distribution as in MixOE; see Fig. <ref>).
Such consequence can be confirmed by the distribution plots of Mix training's prediction confidence in Fig. <ref>-<ref>.
This reasoning explains why Mix training underperforms MixOE (especially its little effect on coarse OOD data) and further validates MixOE's idea of using ID and outlier data together to regularize the prediction confidence over the OOD region.

MixOE v.s. Mix + OE.
Upon the previous discussion, one may wonder if naively combining the Mix and OE objective together can achieve similar effect to MixOE.
Yet, a crucial problem with such combined objective is that it will assign distinct training targets to two overlapped groups of samples.
Specifically, from the blue regions in Fig. <ref> (a)/(b)/(c), one can see that the auxiliary outlier data can overlap with the mixed samples generated by the Mix training.
However, their corresponding soft targets are very different: mixed samples are coupled with “two-hot” targets that result from the interpolation between two one-hot labels, yet the auxiliary outlier data are trained to match uniform distribution.
This inconsistency is similar to the problem of manifold intrusion [8] and may cause learning difficulty for the model.
Indeed, like we stated in the main text, when combining Mix and OE together, the model's accuracy can decrease by up to 10%, and the TNR95 can be worse than MSP by 10% and 20% against coarse- and fine-grained OOD samples, respectively.

2D Visualization of the data representations in the DNN's feature space.
The color lightness indicates the confidence encoded in the soft target of the corresponding outlier sample. The numbers below the figures are the prediction confidence each method assigns to the outliers within the  blue region during training.
Compared with Mix training, our MixOE will enforce a more desirable confidence decay (from the  highest level to the  lowest level) as the inputs transitions from ID to OOD.
This explains why MixOE outperforms Mix.
Also, blindly combining Mix and OE will not work because of manifold intrusion [8].
See the text for detailed analysis.

§ ADDITIONAL PLOTS AND RESULTS

Here we provide additional plots and results that are not shown in the main document due to space limit.
Tab. <ref> presents the full detection results in terms of both TNR95 and AUROC for all methods on all splits/datasets.
Fig. <ref> includes the bar plots that visualize the TNR95 statistics of existing methods on all splits/datasets.
The corresponding numerical results can be found in Tab. <ref>.
Fig. <ref>-<ref> show the confidence distributions of the Standard, OE, Corruption, Mix, and MixOE models on all splits/datasets.
Fig. <ref>-<ref> show the 2D visualization of ID/OOD/training outlier data on all datasets.
Tab. <ref> presents the accuracy results of all methods on all splits/datasets.

TNR95 statistics of existing methods on all of the three splits in each dataset. Each two rows correspond to one split.

Confidence density plots on the three splits in the  dataset.

Confidence density plots on the three splits in the  dataset.

Confidence density plots on the three splits in the  dataset.

Confidence density plots on the three splits in the  dataset.

2D visualization of ID/OOD/training outlier data in the feature space for the  dataset.

2D visualization of ID/OOD/training outlier data in the feature space for the  dataset.

2D visualization of ID/OOD/training outlier data in the feature space for the  dataset.

2D visualization of ID/OOD/training outlier data in the feature space for the  dataset.