Fool Me Once: Robust Selective Segmentation via
Out-of-Distribution Detection with Contrastive Learning

David S. W. Williams, Matthew Gadd\(^*\), Daniele De Martini\(^*\), and Paul Newman
Oxford Robotics Institute, Dept. Engineering Science, University of Oxford, UK.
{dw,mattgadd,daniele,pnewman}@robots.ox.ac.uk
1


Abstract

In this work, we train a network to simultaneously perform segmentation and pixel-wise ood detection, such that the segmentation of unknown regions of scenes can be rejected. This is made possible by leveraging an ood dataset with a novel contrastive objective and data augmentation scheme. By combining data including unknown classes in the training data, a more robust feature representation can be learned with known classes represented distinctly from those unknown. When presented with unknown classes or conditions, many current approaches for segmentation frequently exhibit high confidence in their inaccurate segmentations and cannot be trusted in many operational environments. We validate our system on a real-world dataset of unusual driving scenes, and show that by selectively segmenting scenes based on what is predicted as ood, we can increase the segmentation accuracy by an iou of 0.2 with respect to alternative techniques.

Segmentation, Scene Understanding, Introspection, Performance Assessment, Deep Learning, Autonomous Vehicles, Novelty Detection

1 Introduction↩︎

A key task for a perception system is to segment the objects present in a scene; yet, machines deployed in environments with open-set conditions [1] are likely to eventually encounter objects which have never been seen before or which are well-known but have unusual appearance. By implication, the data used to train the system is not fully representative of the data seen after deployment – a deficiency often referred to as distributional shift. For a segmentation network to operate reliably under these conditions, it must assess its pixel-wise segmentation confidence, such that inaccurate segmentations of hitherto unseen objects and conditions can be rejected and perhaps flagged downstream in an autonomy stack. This introspective capacity is a key requirement for the safe and reliable deployment of autonomous systems as presented in [2], [3] and will have an important role to play in satisfying the requirements in the international standards for functional safety in autonomous driving [4] – this sotif standard requires the minimisation of unknown unknowns by design. We argue identifying likely performance via introspection measures is part of the answer.

nns, which are nowadays the sota representatives for such tasks, are typically trained for segmentation with cross-entropy loss and yield a categorical distribution over classes via softmax. A reasonable entry-level introspective facility for nns is the identification of that which is not known by assessing this distribution. Unfortunately, segmentation networks are “poorly calibrated” as the entropy of the categorical distribution is a bad predictor of inaccurate segmentation. Such overconfidence is often observed under data subject to distributional shift – i.e. ood – or when “attacked” with adversarial examples. This may occur because of: the extra degree of freedom in the softmax function [5], insufficient regularisation leading to overfitting [6], the ReLU activation functions [7], and the cross-entropy objective [6], [8].

Figure 1: Demonstration of ood detection being used to mitigate misclassification. The RGB frame is shown inset top left. Top row shows segmentation and uncertainty prediction from a baseline segmentation network from Hendrycks and Gimpel [9]. The baseline is highly confident in its classification of a pedestrian’s shirt as sky. Bottom row shows the segmentation and ood prediction from our proposed system. It detects the pedestrian as ood having never seen one so close before, thereby mitigating misclassification.

In order to prevent false predictions from propagating out of the perception system and into autonomous decision-making, uncertainty estimation or ood detection (also known as novelty or anomaly detection) can be employed. While uncertainty estimation aims to directly predict the likelihood of error in the nn output, ood detection relates to predicting whether data belongs to the distribution of the training data. As nns have a limited capacity to generalise, ood data is very likely to result in error.

Uncertainty in nns is typically split into aleatoric and epistemic. Aleatoric uncertainty is due to inherent ambiguity in the data – e.g. caused by environmental factors such as heavy rain, fog, darkness or motion and noise artefacts. Epistemic uncertainty, by contrast, relates to model parameter uncertainty, caused for instance by an imperfect training procedure or an insufficient quantity of suitable training data. Often considered a subset of epistemic uncertainty [10], distributional uncertainty can be defined as uncertainty due to ood data.

We believe that a requirement for a segmentation network operating in open-set conditions is the selective segmentation of a scene such that regions of high distributional or aleatoric uncertainty are detected and thereafter rejected. We do not focus on epistemic uncertainty as it is reducible with an appropriate training procedure and large and diverse training datasets. By contrast, distributional and aleatoric uncertainty are largely irreducible i.e. it is not possible to reduce the uncertainty in the segmentation of objects of unknown class or objects of known class in heavy darkness, thus demonstrating the need for rejection.

In this work, as demonstrated in 1, the effects of distributional uncertainty are mitigated by simultaneously performing segmentation and pixel-wise ood detection. Our proposed contrastive loss leverages an ood dataset and a novel data augmentation scheme, with the aim to learn a feature representation in which ood and in-distribution data are reliably separable. Unlike many techniques, our proposed technique also adds very little computational expense to the overall perception system, another important requirement for deployed mobile robotic systems.

This paper proceeds as follows. 2 places the contribution in the available literature. 3 describes our system. 4 details our experimental setup and 5 analyses the findings. 6 summarises the contribution and suggests further avenues for investigation.

2 Related Work↩︎

This section discusses our contribution in the context of the wealth of literature and treatments of deep uncertainty.

2.1 Uncertainty Estimation↩︎

On account of exact Bayesian inference being intractable, variational inference is used for epistemic uncertainty estimation by approximating the model parameter distribution, seen in Bayes-by-Backprop [11] and Monte Carlo dropout sampling [12]. Alternatively, [13] performs epistemic uncertainty estimation with the parameter distribution defined over an ensemble of uniquely parameterised networks.

However, in both cases, multiple passes through a network are required. This is prohibitively expensive to compute, particularly for a task such as segmentation with larger memory requirements and operating at a high frequency. Therefore, the distillation of both dropout sampling and ensemble techniques into a single network has been proposed in [14], [15].

Nevertheless, [16] describes uncertainty estimation failure and worsening ood detection performance as the distributional shift increases and the data becomes less familiar.

2.2 Deep Generative Models↩︎

Recently, deep generative models have shown the capacity to learn complex data distributions, allowing ood samples to be detected. This work includes vaes [17], gans [18] and ebms [19].

However, scaling ood detection with deep generative models to high resolution images is non-trivial. Furthermore, as for uncertainty estimation, the robustness of deep generative models to distributional shift is concerning [20].

2.3 Contrastive Learning for OoD Detection↩︎

Noise-contrastive estimation leverages explicit negative samples in order to learn better representations of data [21]. Inspired by this, contrastive learning aims to learn a feature representation in which similar examples are close and dissimilar examples are farflung. This is similar to deep generative modelling, except in its use of negatives instead of predefining the representation shape with probabilistic constraints (e.g. in vaes, isotropic Gaussian latent distributions). Additionally, the contrastive loss is computed on lower-dimensional intermediate feature maps as opposed to pixel-wise at the (high resolution) output (e.g. in vaes, pixel-wise reconstruction).

A swathe of objective functions with differing similarity metrics and numbers of positive and negative examples have been presented. In SimCLR [22], an anchor image is augmented as a positive example and both are contrasted against many negative examples with dot product similarity. In [23] it is shown that in a supervised setting, such a contrastive objective leads to a more robust representation, which can outperform standard cross-entropy.

Contrastive learning has had recent application to ood detection [24], [25], albeit for image-wise classification and without direct use of ood data during training.

2.4 Novelty and Anomaly Detection↩︎

Unsupervised techniques include using a proxy task to learn a useful feature representation [26], learning a one-class classifier in an adversarial manner [27], and an isolation forest model with a large cnn [28].

It is, however, unclear if image-wise techniques will scale to pixel-wise treatments. Anomaly detection has been performed pixel-wise in video [29]. This, however, requires a rarely available specialist labelled dataset to achieve good results.

Additionally, many of these techniques are so specialised for their task, that they would require a separate encoder from the segmentation task. Unfortunately, this results in significantly larger memory requirements for the perception system.

Our approach solves both problems, leveraging a general ood dataset and using the same encoder for both decoders.

2.5 Softmax Calibration for Image-wise ood Detection↩︎

As a natural baseline, [9] uses the maximum softmax score as a measure of confidence for detecting ood images in an image-wise classification context. [30] proposes ODIN, which uses temperature scaling and adversarial input preprocessing in order to improve the discriminative capacity of using softmax for ood detection. This line of research relies on the assumption that classification network’s naturally represent in-distribution and ood data in a reliably distinct way. In this paper, we show that this is not the case by extending [9] to segmentation and using it as a baseline, and show that improvements can be made by using ood data.

2.6 Data-Driven OoD Detection↩︎

With the use of an ood dataset, more robust feature detectors can be trained such that the learned representations of ood data and in-distribution data are more separable.

In [31], it is shown how this improves both image-wise ood detection and density estimation with generative models. In [5], a more calibrated image-wise classification network with a Dirichlet-distributed output is trained. In [32], pixel-wise ood detection with a multi-head network is performed – treating ood detection as binary segmentation and using a simple bce objective. In [33], the calibration of the softmax prediction of a classifier is improved with the use of generated ood data.

Our work also leverages an ood dataset in order to perform ood detection. However, it scales up the problem to pixel-wise ood detection unlike many approaches for much simpler image-wise ood detection. In doing so, we propose a novel contrastive loss function coupled with a data augmentation scheme designed to train an encoder suited to both segmentation and robust pixel-wise ood detection. We show that these changes lead to an improvement in the network’s ability to perform selective segmentation on a dataset that contains data at (and beyond) the limit of the training distribution.

3 Proposed System Design↩︎

Our segmentation network architecture is shown in 2.

Figure 2: Overview of the proposed architecture with input-output examples same as shown in 1.The encoder and segmentation decoder are jointly trained (\CMcal{L}^{Stage1}) to learn a feature representation suitable for both segmentation and pixel-wise ood detection.The ood detection decoder is then trained (\CMcal{L}^{Stage2}) to output the final ood prediction.

The encoder, \(E: \mathbb{R}^{3 \times H \times W} \rightarrow \mathbb{R}^{C \times \hat{H} \times \hat{W}}\), maps an image to a high-dimensional feature map, where, \(H,W\) and \(\hat{H},\hat{W}\) are respectively the original and reduced spatial dimensions. The segmentation decoder, \(D^s: \mathbb{R}^{C \times \hat{H} \times \hat{W}} \rightarrow \mathbb{R}^{K \times H \times W}\), produces the final segmentation map, \(x_{seg}\), where \(K\) is the number of classes, \(y\). We view segmentation and ood detection as distinct tasks and include a separate decoder for ood detection, \(D^o: \mathbb{R}^{\hat{H}\hat{W} \times C} \rightarrow \mathbb{R}^{1 \times H \times W}\), which takes a reshaped feature map and maps it to an ood prediction, \(x_{ood}\).

3.1 Using OoD Data↩︎

The in-distribution dataset for segmentation, \(T^{ID}\), can be seen as the set, \(T^{ID} \in \{i \in N| y_i \in K\}\), where \(N\) is the set of all natural images, \(y_i\) is the label for pixel \(i\) and \(K\) is the set of classes for the task. Conversely, an ood dataset for this task is then defined as \(T^{OoD} \in \{i \in N| y_i \not\in K\}\). The ood dataset chosen for this task must therefore approximate the set of all natural images that does not contain the in-distribution segmentation classes – implying significant scale and diversity. Furthermore, pixel-wise ood detection requires the separation of in-distribution and ood within images.

The use of a pixel-wise labelled dataset such as COCO [34] is severely limiting. We thus opt for a dataset uncurated for ood detection, ImageNet [35], requiring no labels. To combine the datasets, crops of images from each dataset are pasted into images of the other in the style of [36], followed by a novel data augmentation scheme in 3.4.

When using an uncurated ood dataset, it is important to consider label noise – i.e. that it contains pixels that are not truly ood. This problem is ameliorated with a novel contrastive objective in 3.3.

3.2 OoD Detection via Contrastive Learning↩︎

Extending a contrastive loss from image-wise classification to segmentation means the encoder yields a feature map with reduced spatial dimensions, \(\mathbb{R}^{3 \times H \times W} \rightarrow \mathbb{R}^{C \times \hat{H} \times \hat{W}}\), instead of a single feature vector per image, \(\mathbb{R}^{3 \times H \times W} \rightarrow \mathbb{R}^{C}\). In order to perform pixel-wise ood detection, the feature map is reshaped to produce \((\hat{H}*\hat{W})\) vectors of shape, \(z \in \mathbb{R}^{C}\).

Our contrastive objective is designed to train an encoder that represents pixels from the training distribution with reliable separability from ood data. We start with the objective of [23] and define two classes: in-distribution and ood. Thus, we define \(\CMcal{L}^{SupCon}\) as the total supervised contrastive loss over the batch \(B, |B| = N\), as: \[\CMcal{L}^{SupCon} = \sum_{a\in B} \frac{1}{N_{y_a}-1} \: \CMcal{L}_a^{SupCon}\] where the loss \(\CMcal{L}_a^{SupCon}\) related to anchor point \(a\in B\) is: \[\CMcal{L}_a^{SupCon} = \sum\limits_{b \in B: b \neq a, y_b = y_a} -\log{\frac{\exp{(z^{\prime\top}_a z'_b/\tau)}}{\sum\limits_{c\in B: c \neq a}\exp{(z^{\prime\top}_a z'_c/\tau)}}}\]

and \(N_{\mathit{y}_a}\) is the number of feature vectors in the batch of the same class as anchor \(a\). The feature vector \(z'\) is the mapping of \(z\) by a projection head, \(z' = P(z)\), as per [22].

This objective pulls together examples from the same class in representation space and pushes away the other class. However, we do not want to (and perhaps cannot) represent examples from the ood class similarly as it contains a set of very diverse natural images – dissimilar features are inevitable. We therefore augment the objective function to not enforce similarity between ood feature representations and use them only as negatives. This is essentially one-class contrastive learning with this class being a superset of the classes in the segmentation task. In 1 , we therefore only consider in-distribution feature vectors (with \(y=0\)) as anchor points.

Crucially, as described further in 3.3 below, we include a mask – \(\mathbb{1}_{LN}\) in 2 – to mitigate the effects of pixels incorrectly defined as ood:

\[\label{eq:oodcon1} \CMcal{L}^{OoDCon} = \sum_{a \in B: y_a = 0}^{N} \frac{1}{N_{y_a=0}-1} \: \CMcal{L}_a^{OoDCon}\tag{1}\]

\[\label{eq:oodcon2} \CMcal{L}_a^{OoDCon} = \sum\limits_{b \in B: b \neq a, y_b = 0} -\log{\frac{\exp{(z_a^{\prime\top} z_b'/\tau)}}{\sum\limits_{c\in B: c \neq a}\mathbb{1}_{LN}\exp{(z_a^{\prime\top} z_c'/\tau)}}}\tag{2}\]

Intuitively, it may seem that pulling together feature representations of the known classes would ruin segmentation performance – we would typically maximally separate them when using the cross-entropy loss for classification. However, [37] shows that encouraging similarity between the known classes can be beneficial for the downstream task as it performs a kind of regularisation that promotes learning structure independent of class and aids in identifying ood examples.

A key side effect of using the feature map from a segmentation encoder, \(E: \mathbb{R}^{3 \times H \times W} \rightarrow \mathbb{R}^{C \times \hat{H} \times \hat{W}}\), in a contrastive loss is that much smaller batch sizes are used than, for example, in [23] for image classification. This is due to each image producing \((\hat{H}*\hat{W})\) times more vectors for contrasting than in the case of image classification.

3.3 Masking Label Noise↩︎

As per 3.3, this loss assumes significant label noise from the uncurated ood dataset. Thus, for the mask of 2 , for each ood feature vector, \(i \in B: y_i = 1:\) \[\mathbb{1}_{LN} = \begin{cases} 0 & \text{if} \quad \underset{j \in B: y_j = 0}{\max} (z_i^{\prime\top} z_j') > t_{R} \\ 1 & \text{otherwise} \end{cases}\] Where \(t_{R}\) is a threshold that rejects the proportion \(R\) of the ood features in \(B\) and where \(R\), the rejection ratio, is a hyperparameter set depending on the ood dataset used. In this work, \(R=0.2\)

This mask therefore ignores ood feature vectors most similar to the in-distribution feature vectors being considered. The metric used to rank the ood features is the maximum similarity to the other in-distribution features in \(B\).

For the original loss [23], hard negatives and positives have large gradient contributions. Without our mask, features from different classes which are nevertheless similar are considered hard negatives. With the proposed masking, however, weight updates are not dominated by false hard negatives.

3.4 Data Augmentation↩︎

As per 3.1, the in-distribution and ood datasets are combined within images. Importantly, images are not just cropped into images from the other dataset (i.e. ood into in-distribution), but also into images from the same dataset. This prevents the automatic learning of the crop’s origin and ensures that robust semantic features of the crop’s content are learned.

Additionally, in order to alleviate characteristic large image gradients around crops, images are combined with a Gaussian blur kernel. The mean hue and value of crops (in HSV) are also matched to the background region they replace, to make colour a less discriminative feature between crop and background. These steps have the effect of making crops more similar to the background, leading to a more robust feature representation and more efficient training, as seen in [33], where ood data is generated to be similar to in-distribution data but just outside of the distribution of known images.

Finally, we randomly jitter the colour space of each image in brightness, contrast, saturation, and hue in order to reduce the average distance in colour space between images from both datasets. We refer to this process as DomainMix data augmentation.

Figure 3: Samples from the training dataset using DomainMix data augmentation.Images from the in-distribution driving dataset are combined with an ood dataset, such that crops of ood images arecut into in-distribution driving images (top) and vice versa (bottom).Additionally, crops are blended in with a Gaussian kernel and colour space augmentations are performed to reduce the distance between the crop and the pixels it replaces.Finally, random colour space augmentations are used to reduce learned dependence on colour as a discriminative feature.

3.5 Training Procedure↩︎

Similarly to [23], the training of the system is split into two stages, shown in 2. In both stages, the network is presented with augmented data (see 3.4).

In Stage 1, the encoder and segmentation decoder are trained by both the segmentation and contrastive objectives. \[\CMcal{L}^{Stage 1} = \CMcal{L}^{seg} + \CMcal{L}^{OoDCon}\] Here, \(\CMcal{L}^{seg}\) is class-weighted cross-entropy, with weights calculated as in [38]. These objectives are mutually beneficial to the encoder. The segmentation objective promotes learning features that allow the detection of the in-distribution classes, which in turn helps with identifying what is not a known class. The contrastive objective promotes learning robust features of the in-distribution classes not present in the ood data, such that their representations can be separated. Additionally, by compressing the representations of the in-distribution classes, the contrastive objective provides useful regularisation [37].

Stage 2 updates only the ood decoder weights: \[\CMcal{L}^{Stage 2} = \CMcal{L}^{BCE}\] Here, \(\CMcal{L}^{BCE}\) is the bce loss function between the output of the ood decoder, \(x_{ood}\), and a binary label, \(l_{ood}\), generated as part of the data augmentation process, where for a ood pixel, \(l_{ood} = 1\) else, \(l_{ood} = 0\).

4 Experimental Setup↩︎

This section describes the experimental programme used to generate results which follow in 5.

4.1 Data↩︎

We use the Cityscapes [39] and Berkeley DeepDrive [40] datasets in order to train a cnn to segment driving scenes. These datasets both feature a “void” class which consists of all pixels that do not belong to any of the predefined classes. For this reason, we consider the void class to be ood.

With the ood dataset, we approximate the set of all natural images that does not contain the known classes (see 3.1) using the ImageNet dataset [35] due to its size and diversity of imagery. It bears repeating (see 3.3) that we treat this dataset as an uncurated set of random natural images and we do not make use of its labels – no labelling is required for the ood dataset.

In order to test the trained networks, the WildDash dataset [41] – containing many unusual real-world driving scenes – is held out. We believe it is crucial to validate networks on real-world data that is at the limit of what is seen during training. Indeed, detecting where misclassification is going to occur due to unfamiliarity is much more challenging than separating two distinct datasets combined by hand. We test on the 1000 most challenging images from this dataset, defined by those segmented least well by the baseline [9]. During testing, 5 shows that we reject predictions on image regions that are detected as ood, reduce the misclassification risk, and improve segmentation performance.

Additionally, we investigate performance during a hand-crafted ood detection task (as is more common in literature). For this task, we leverage the pixel-wise labels in the COCO dataset [34] in order to paste ood images into the test splits of Cityscapes [39] and BerkeleyDeepDrive [40].

4.2 Performance Metrics↩︎

On the ood detection task, we use the best achieved average iou across the generated dataset as a performance metric. On the misclassification prediction task, we report segmentation performance in terms of the class miou metric for a range of coverages. Coverage is defined as the fraction of pixels that are not considered ood and thus considered to be close enough to the training distribution to segment accurately. Here, a certain coverage is reached by varying a threshold on the classification score from the ood decoder.

4.3 Network Architecture↩︎

In each of our experiments, we use a DeepLabV3 segmentation network architecture [42]. It comprises a ResNet [43] encoder and an aspp module as the segmentation decoder. Specifically, we use a ResNet-18 encoder which produces a feature representation, \(E:\mathbb{R}^{3 \times H \times W} \rightarrow \mathbb{R}^{512 \times \hat{H} \times \hat{W}}\), where \(\hat{H}=H/8\), \(\hat{W}=W/8\).

The ood decoder, \(D^o\), and projection head, \(P\), are mlps with three and two hidden layers respectively. Bilinear interpolation is employed in the ood decoder to upsample to the same spatial dimensions as the input image. Both use batch normalisation and ReLU activation. The projected feature vector, \(z'\), has dimensionality, \(z' \in \mathbb{R}^{64}\). It is important to note that \(z'\) is only computed during training – not inference.

5 Results↩︎

The baseline is a segmentation network with no additional decoder, trained on only in-distribution data and uses \((1 - \operatorname{max~softmax~score})\) as a measure of uncertainty, as presented in [9]. In the two tests that follow, different objectives and data augmentation schemes used to enhance the baseline performance are investigated. In terms of objectives, we compare the baseline and the proposed contrastive objective (OoDCon) to a KL divergence loss, which enforces a flat softmax response on ood data at the end of the segmentation decoder, as seen in [33], and the bce objective, performed on the ood decoder [32]. As for data augmentation, we include both our proposed method (c.f. 3.4, named DomainMix) and an adaptation of the Cutmix method [36] to pixel-wise labelling.

Table 1: Comparison of loss functions and data augmentation schemes for ood detection task. We report detection performance with a measure of segmentation accuracy, iou.
Objective Data Augmentation IoU
Baseline - 0.16
BCE Cutmix 0.26
KL Cutmix 0.27
Cutmix 0.30
BCE 0.41
KL 0.35
0.51

First, consider 1, which reports segmentation accuracy, iou, on the ood detection task, with each technique using a threshold corresponding to best achieved performance. It shows that the network trained with the contrastive loss and our proposed data augmentation scheme segments the inserted ood data the most accurately. The baseline performs poorly on the task compared to the other methods, suggesting a lack of inherent robustness in the feature representation for a network trained on in-distribution data alone, and that this can be improved with the use of ood data.

The results for the misclassification detection task are shown in 4. With no predictions rejected, the networks trained with our proposed data augmentation scheme can be seen to segment the challenging scenes best. This suggests that DomainMix promotes greater robustness to distributional shift in the learned feature representation due to the network’s exposure to unknown classes and colour space shifts in training.

Figure 4: Segmentation accuracy (miou) plotted as a function of the proportion of segmentations accepted (coverage).Our proposed system corresponds to the objective “OoDCon” and data augmentation “DomainMix” row of 1.As the threshold on classification score increases, the coverage decreases, more inaccurate segmentations are rejected and thus the remaining segmentations become more accurate, thereby increasing the mIoU.When tested on challenging real-world data, our proposed network both segments the scenes most accurately and is better able to reject its erroneous segmentations, causing a significant increase in mIoU at a coverage of 60 %.

Upon rejecting the segmentations of 40 % of pixels, a significant increase in segmentation accuracy is seen for the network trained with our proposed contrastive objective compared to the other techniques. This means that the OoDCon objective has learned to represent unfamiliar pixels in a way that is more effectively separable from the in-distribution pixels, thus leading to the rejection of erroneous segmentations.

Indeed, the sharp knee seen at 60 % coverage results in segmentation performance for our method which is only reachable at 20 %–30 % for the other methods - i.e. when rejecting 70 %–80 % of the nn predictions.

In contrast to the ood detection task, many of the other techniques do not perform better than the baseline. This suggests that on the more challenging task of predicting misclassification on real-world data, only our proposed objective combined with our data augmentation generalises effectively from the ood dataset to the real-world test dataset.

Figure 5: Qualitative results from our proposed technique on the WildDash test dataset [41], showing left to right: original image, segmentation and the ood prediction.Each image contains regions that are beyond the limit of the training distribution (top to bottom: uncommon signage, cart of chopped wood, and a heavily vandalised wall), resulting in poor, inconsistent segmentation.By rejecting these regions based on our ood prediction, inaccuracies can be prevented from propagating out of the perception system.

Finally, consider the qualitative examples shown in 5. Regions of images from the WildDash dataset containing diverse unusualness (top to bottom: uncommon signage, cart of chopped wood, and a heavily vandalised wall) are detected as ood having been segmented poorly.

1 contains a comparison between the baseline and our proposed technique. In this instance, our proposed segmentation network inaccurately segments a pedestrian, having never seen one so close, however the poor segmentation is mitigated by detecting the pedestrian as ood. By contrast, the baseline confidently segments a pedestrian’s shirt as sky in a manner unacceptable for a safety-critical task.

6 Conclusion↩︎

In this work, we propose a segmentation network that has the capacity to mitigate misclassification by rejecting its predictions on ood data, in a manner that adds no significant computational expense. This is achieved by using a novel contrastive objective along with an ood dataset, presented with a novel data augmentation technique. Upon testing with challenging real-world data, our proposed network is able to improve its performance significantly by selectively segmenting scenes when compared to proposed alternatives, thus proving its relative suitability for deployment on mobile robotic systems operating in open-set conditions. Specifically, we show that by selectively segmenting scenes based on what is predicted as ood, we can increase the segmentation accuracy by an iou of 0.2 with respect to alternative techniques. We expect that this contribution will advance the development of introspective performance assessment in scene understanding tasks.

In the future we will integrate this work in active learning – deploying the model, querying a human user upon surprising observation, and including this feedback in further training.

Acknowledgements↩︎

This work was supported by the Assuring Autonomy International Programme, a partnership between Lloyd’s Register Foundation and the University of York, and UK EPSRC Programme Grant EP/M019918/1.

The authors are grateful to Oliver Bartlett for proofreading this manuscript.

References↩︎

[1]
W. Scheirer, A. Rocha, A. Sapkota, and T. Boult, “Toward open set recognition,” IEEE transactions on pattern analysis and machine intelligence, 2013.
[2]
N. Sünderhauf, O. Brock, W. Scheirer, R. Hadsell, D. Fox, J. Leitner, B. Upcroft, P. Abbeel, W. Burgard, M. Milford et al., “The limits and potentials of deep learning for robotics,” The International Journal of Robotics Research, 2018.
[3]
M. Gadd, D. De Martini, L. Marchegiani, P. Newman, and L. Kunze, Sense-Assess-eXplain (SAX): Building Trust in Autonomous Vehicles in Challenging Real-World Driving Scenarios,” in Proceedings of the IEEE Intelligent Vehicles Symposium (IV), Workshop on Ensuring and Validating Safety for Automated Vehicles (EVSAV), 2020.
[4]
Road vehicles — Safety of the intended functionality,” International Organization for Standardization, Standard, 2019.
[5]
A. Malinin and M. J. F. Gales, “Predictive uncertainty estimation via prior networks,” in NeurIPS, 2018.
[6]
C. Guo, G. Pleiss, Y. Sun, and K. Q. Weinberger, “On calibration of modern neural networks,” in Proceedings of the 34th International Conference on Machine Learning - Volume 70, 2017.
[7]
M. Hein, M. Andriushchenko, and J. Bitterwolf, “Why relu networks yield high-confidence predictions far away from the training data and how to mitigate the problem,” in 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
[8]
R. Müller, S. Kornblith, and G. E. Hinton, “When does label smoothing help?” in Advances in Neural Information Processing Systems 32, 2019.
[9]
D. Hendrycks and K. Gimpel, “A baseline for detecting misclassified and out-of-distribution examples in neural networks,” CoRR, 2016.
[10]
A. Kendall and Y. Gal, “What uncertainties do we need in bayesian deep learning for computer vision?” in Advances in neural information processing systems, 2017.
[11]
C. Blundell, J. Cornebise, K. Kavukcuoglu, and D. Wierstra, “Weight uncertainty in neural networks,” in Proceedings of the International Conference on Machine Learning, 2015.
[12]
Y. Gal and Z. Ghahramani, “Dropout as a bayesian approximation: Representing model uncertainty in deep learning,” in international conference on machine learning, 2016.
[13]
B. Lakshminarayanan, A. Pritzel, and C. Blundell, “Simple and scalable predictive uncertainty estimation using deep ensembles,” in Advances in Neural Information Processing Systems, 2017.
[14]
C. Gurau, A. Bewley, and I. Posner, “Dropout distillation for efficiently estimating model confidence,” arXiv preprint arXiv:1809.10562, 2018.
[15]
A. Malinin, B. Mlodozeniec, and M. Gales, “Ensemble distribution distillation,” in International Conference on Learning Representations, 2019.
[16]
Y. Ovadia, E. Fertig, J. Ren, Z. Nado, D. Sculley, S. Nowozin, J. Dillon, B. Lakshminarayanan, and J. Snoek, “Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift,” in Advances in Neural Information Processing Systems, 2019.
[17]
J. An and S. Cho, “Variational autoencoder based anomaly detection using reconstruction probability,” 2015.
[18]
H. Zenati, C. S. Foo, B. Lecouat, G. Manek, and V. R. Chandrasekhar, “Efficient gan-based anomaly detection,” arXiv preprint arXiv:1802.06222, 2018.
[19]
W. Grathwohl, K.-C. Wang, J.-H. Jacobsen, D. Duvenaud, M. Norouzi, and K. Swersky, “Your classifier is secretly an energy based model and you should treat it like one,” in International Conference on Learning Representations, 2019.
[20]
E. T. Nalisnick, A. Matsukawa, Y. Teh, D. Görür, and B. Lakshminarayanan, “Do deep generative models know what they don’t know?” arXiv preprint arXiv:1810.09136, 2019.
[21]
M. Gutmann and A. Hyvärinen, “Noise-contrastive estimation: A new estimation principle for unnormalized statistical models,” in Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, 2010.
[22]
T. Chen, S. Kornblith, M. Norouzi, and G. Hinton, “A simple framework for contrastive learning of visual representations,” arXiv preprint arXiv:2002.05709, 2020.
[23]
P. Khosla, P. Teterwak, C. Wang, A. Sarna, Y. Tian, P. Isola, A. Maschinot, C. Liu, and D. Krishnan, “Supervised contrastive learning,” arXiv preprint arXiv:2004.11362, 2020.
[24]
J. Winkens, R. Bunel, A. G. Roy, R. Stanforth, V. Natarajan, J. R. Ledsam, P. MacWilliams, P. Kohli, A. Karthikesalingam, S. Kohl et al., “Contrastive training for improved out-of-distribution detection,” arXiv preprint arXiv:2007.05566, 2020.
[25]
J. Tack, S. Mo, J. Jeong, and J. Shin, “Csi: Novelty detection via contrastive learning on distributionally shifted instances,” arXiv preprint arXiv:2007.08176, 2020.
[26]
I. Golan and R. El-Yaniv, “Deep anomaly detection using geometric transformations,” in Advances in Neural Information Processing Systems, 2018.
[27]
M. Sabokrou, M. Khalooei, M. Fathy, and E. Adeli, “Adversarially learned one-class classifier for novelty detection,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
[28]
K. Ouardini, H. Yang, B. Unnikrishnan, M. Romain, C. Garcin, H. Zenati, J. P. Campbell, M. F. Chiang, J. Kalpathy-Cramer, V. Chandrasekhar, P. Krishnaswamy, and C.-S. Foo, “Towards practical unsupervised anomaly detection on retinal images,” in Domain Adaptation and Representation Transfer and Medical Image Learning with Less Labels and Imperfect Data, 2019.
[29]
H. Park, J. Noh, and B. Ham, “Learning memory-guided normality for anomaly detection,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020.
[30]
S. Liang, Y. Li, and R. Srikant, “Principled detection of out-of-distribution examples in neural networks,” CoRR, 2017.
[31]
D. Hendrycks, M. Mazeika, and T. G. Dietterich, “Deep anomaly detection with outlier exposure,” arXiv preprint arXiv:1812.04606, 2018.
[32]
P. Bevandić, I. Krešo, M. Oršić, and S. Šegvić, “Discriminative out-of-distribution detection for semantic segmentation,” arXiv preprint arXiv:1808.07703, 2018.
[33]
K. Lee, H. Lee, K. Lee, and J. Shin, “Training confidence-calibrated classifiers for detecting out-of-distribution samples,” in International Conference on Learning Representations, 2018.
[34]
T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick, “Microsoft coco: Common objects in context,” 2014.
[35]
O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei, ImageNet Large Scale Visual Recognition Challenge,” International Journal of Computer Vision (IJCV), 2015.
[36]
S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo, “Cutmix: Regularization strategy to train strong classifiers with localizable features,” 2019 IEEE/CVF International Conference on Computer Vision (ICCV), 2019.
[37]
N. Frosst, N. Papernot, and G. Hinton, “Analyzing and improving representations with the soft nearest neighbor loss,” in International Conference on Machine Learning, 2019.
[38]
A. Paszke, A. Chaurasia, S. Kim, and E. Culurciello, “Enet: A deep neural network architecture for real-time semantic segmentation,” arXiv preprint arXiv:1606.02147, 2016.
[39]
M. Cordts, M. Omran, S. Ramos, T. Rehfeld, M. Enzweiler, R. Benenson, U. Franke, S. Roth, and B. Schiele, “The cityscapes dataset for semantic urban scene understanding,” in Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
[40]
F. Yu, W. Xian, Y. Chen, F. Liu, M. Liao, V. Madhavan, and T. Darrell, BDD100K:A diverse driving video database with scalable annotation tooling,” arXiv preprint arXiv:1805.04687, 2018.
[41]
O. Zendel, K. Honauer, M. Murschitz, D. Steininger, and G. F. Dominguez, “Wilddash - creating hazard-aware benchmarks,” in Proceedings of the European Conference on Computer Vision (ECCV), 2018.
[42]
L. Chen, G. Papandreou, F. Schroff, and H. Adam, “Rethinking atrous convolution for semantic image segmentation,” arXiv preprint arXiv:1706.05587, 2017.
[43]
K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016.

  1. \(^*\) These authors contributed equally to this work.↩︎