Discriminative out-of-distribution detection for semantic segmentation

Most classification and segmentation datasets assume a closed-world scenario in which predictions are expressed as distribution over a predetermined set of visual classes . However , such assumption implies unavoidable and often unnoticeable failures in presence of out-of-distribution ( OOD ) input . These failures are bound to happen in most real-life applications since current visual ontologies are far from being comprehensive . We propose to address this issue by discriminative detection of OOD pixels in input data . Different from recent approaches , we avoid to bring any decisions by only observing the training dataset of the primary model trained to solve the desired computer vision task . Instead , we train a dedicated OOD model which discriminates the primary training set from a much larger ” background ” dataset which approximates the variety of the visual world . We perform our experiments on high resolution natural images in a dense prediction setup . We use several road driving datasets as our training distribution , while we approximate the background distribution with the ILSVRC dataset . We evaluate our approach on WildDash test , which is currently the only public test dataset that includes out-of-distribution images . The obtained results show that the proposed approach succeeds to identify out-of-distribution pixels while outperforming previous work by a wide margin . 1 INTRODUCTION . Development of deep convolutional models has resulted in tremendous advances of visual recognition . Recent semantic segmentation systems surpass 80 % mIoU ( Chen et al. , 2017 ) on demanding natural datasets such as Pascal VOC 2012 ( Everingham et al. , 2015 ) or Cityscapes ( Cordts et al. , 2015 ) . Such performance level suggests a clear application potential in exciting areas such as road safety assessment or autonomous driving . Unfortunately , most existing semantic segmentation datasets assume closed-world evaluation ( Scheirer et al. , 2013 ) , which means that they require predictions over a predetermined set of visual classes . Closed-world datasets are very useful for promoting research , however they are poor proxies for real-life operation even in a very restricted scenario such as road driving . In fact , one can easily imagine many real-life driving scenes which give rise to image regions that can not be recognized by learning on the Cityscapes ontology . Some of those regions may be projected from objects which are foreign to Cityscapes ( e.g . road works , water , animals ) . Other may appear unrelated to Cityscapes due to particular configurations being absent from the training dataset ( e.g . pedestrians lying on the ground , crashed cars , fallen trees ) . Finally , some regions may be poorly classified due to different environmental conditions , acquisition setup , or geographical location ( Tsai et al. , 2018 ) . The simplest way to approach unrecognizable data is to improve datasets . For instance , the Vistas dataset ( Neuhold et al. , 2017 ) proposes a richer ontology and addresses more factors of variation than Cityscapes . However , training on Vistas requires considerable computational resources while still being unable to account for the full variety of the recent WildDash dataset ( Zendel et al. , 2018 ) , as we show in experiments . Another way to approach this problem would be to design strategies for knowledge transfer between the training dataset and the test images ( Tsai et al. , 2018 ) . However , this is unsatisfactory for many real world applications where the same model should be directly applicable to a variety of environments . These examples emphasize the need to quantify model prediction uncertainty , especially if we wish to achieve reliable deployment in the real world . Uncertainty can be divided into two categories ( Kendall & Gal , 2017 ) . Aleatoric uncertainty is caused by limitations of the model which can not be reduced by supplying additional training data . For example , the quality of segmentation models on distant and small objects depends on the resolution on which inference is performed . On the other hand , epistemic uncertainty arises when the trained model is unable to bring the desired prediction given particular training dataset . In other words , it occurs when the model receives the kind of data which was not seen during training . Epistemic uncertainty is therefore strongly related to the probability that the model operates on an out-of-distribution sample . Recent work in image-wide out-of-distribution detection ( Kendall & Gal , 2017 ; Hendrycks & Gimpel , 2017 ; Liang et al. , 2018 ) evaluates the prediction uncertainty by analyzing the model output . We find that these approaches perform poorly in dense prediction tasks due to prominence of aleatoric uncertainty . This means that total uncertainty can be high even on in-distribution pixels ( e.g . on pixels at semantic borders , or very distant objects ) . A different approach attempts to detect out-of-distribution samples with GAN discriminators , whereby the GAN generator is used as a proxy for the out-of-distribution class ( Lee et al. , 2018 ; Sabokrou et al. , 2018 ) . However , these approaches do not scale easily to dense prediction in high resolution images due to high computational complexity and large memory requirements . Therefore , in this paper we propose to detect out-of-distribution samples on the pixel level by a dedicated ” OOD ” model which complements the ” primary ” model trained for a specific vision task . We formulate the OOD model as dense binary classification between the training dataset and a much larger ” background ” dataset . The proposed formulation requires less computational resources than approaches with GAN-generated backgrounds , and is insensitive to aleatoric uncertainty related to semantic segmentation . 2 RELATED WORK . Detection of out-of-distribution ( OOD ) examples ( together with related fields of anomaly and novelty detection ) have received a lot of attention in recent literature . Many approaches try to estimate uncertainty by analyzing entropy of the predictions . The simplest approach is to express the prediction confidence as the probability of the winning class or , equivalently , the maximum softmax ( max-softmax ) activation ( Hendrycks & Gimpel , 2017 ) . The resulting approach achieves useful results in image classification context , although max-softmax must be recalibrated ( Guo et al. , 2017 ) before being interpreted as P ( inlier|x ) . This result has been improved upon by the approach known as ODIN ( Liang et al. , 2018 ) which proposes to pre-process input images with a well-tempered antiadversarial perturbation with respect to the winning class and increase the softmax temperature . Another line of research characterizes uncertainty by a separate head of the primary model which learns either prediction uncertainty ( Kendall & Gal , 2017 ; Lakshminarayanan et al. , 2017 ) or confidence ( DeVries & Taylor , 2018 ) . The predicted variance ( or confidence ) is further employed to discount the data loss while at the same time incurring a small penalty proportional to the uncertainty ( or inversely proportional to confidence ) . This way , the model is encouraged to learn to recognize hard examples if they are present in the training dataset . Unfortunately , such modelling is able to detect only aleatoric uncertainty ( Kendall & Gal , 2017 ) , since the data which would allow us to learn epistemic uncertainty is absent by definition . A principled information-theoretic approach for calculating epistemic uncertainty has been proposed by Smith & Gal ( 2018 ) . They express epistemic uncertainty as mutual information between the model parameters and the particular prediction . Intuitively , if our knowledge about the parameters increases a lot when the ground truth prediction becomes known , then the corresponding sample is likely to be out of distribution . The sought mutual information is quantified as a difference between the total prediction entropy and the marginalized prediction entropy over the parameter distribution . Both entropies are easily calculated with MC dropout . Unfortunately , our experiments along these lines resulted in poor OOD detection accuracy . This may be caused by MC dropout being an insufficiently accurate approximation of model sampling according to the parameter distribution , however , further work would be required in order to produce a more definitive answer . Lakshminarayanan et al . ( 2017 ) show that uncertainty can be more accurately recovered by replacing MC dropout with an ensemble of several independently trained models . However , for this to be done , many models would need to be in GPU memory during evaluation . Explicit ensembles are therefore not suited for systems which have ambition to perform dense prediction in real time . A principled algorithm for recognizing OOD samples would fit a generative model PD ( x|θ ) to the training dataset D = { xi } . Such model would learn to evaluate the probability distribution of the training dataset at the given sample , which can be viewed as epistemic uncertainty . Unfortunately , evaluating probability density function for high-dimensional data is very hard . Instead Lee et al . ( 2018 ) ; Sabokrou et al . ( 2018 ) formulate OOD detection as binary classification where OOD samples are produced by a GAN generator ( Goodfellow et al. , 2014 ) . Sabokrou et al . ( 2018 ) use an autoencoder in place of the generator , which is trained to denoise images as well as to trick the discriminator . During evaluation the autoencoder enhances inliers while distorting the outliers , making the two more separable . Lee et al . ( 2018 ) train a GAN to generate images on the borders of the distribution . In both of these approaches the discriminator can be used for OOD detection . Unfortunately , these approaches have been shown to work on low dimensional samples and simple image datasets . They do not scale well to pixel level prediction of a highly complex domain such as traffic scenes , especially if we take into account memory and time restrictions of real world applications . While Lee et al . ( 2018 ) try to generate outliers , it may be simpler to just use a foreign dataset during training . Kreso et al . ( 2018 ) show that out-of-distribution samples for traffic images can be detected by joint segmentation training on Cityscapes ( road driving ) and ScanNet ( indoor ) . Outof-distribution sample is signaled whenever the prediction favours a class which is foreign to the evaluation dataset . For instance , if a bathtub region is detected in an image acquired from an intelligent vehicle , then the pixels of that region are labeled as OOD . 3 THE PROPOSED DISCRIMINATIVE OOD DETECTION APPROACH . We formulate out-of-distribution pixel detection as dense binary classification into two classes : OOD ( out-of-distribution ) and ID ( in-distribution ) . As in ( Lee et al. , 2018 ; Sabokrou et al. , 2018 ) , we take ID training pixels from the semantic segmentation dataset used to train the primary semantic segmentation model ( e.g . Vistas ) . Subsequently , we propose to take the OOD training pixels from a foreign dataset which approximates the entire diversity of the visual world . Since none of existing public datasets is able to satisfy our requirements , in this paper we propose to use the ILSVRC dataset ( Russakovsky et al. , 2015 ) as the next-best solution for this purpose ( cf . Figure 1 ) . We think that this approximation is reasonable since the ILSVRC dataset has been successfully used in many knowledge transfer experiments ( Oquab et al. , 2014 ; Garcia-Gasulla et al. , 2018 ) . Furthermore , ILSVRC images contain a variety of content around the 1000 official classes . We define the learning algorithm in a way to avoid ILSVRC images hijacking content from the primary training dataset . We observe two distinct problems : i ) ILSVRC classes which overlap classes from the primary dataset , e.g . a car in an ILSVRC image labeled as car , and ii ) primary dataset classes in the ILSVRC image background , e.g . a person playing a banjo in an ILSVRC image labeled as banjo . Currently , we address both problems by ensuring that the model is trained on indistribution ( ID ) pixels as often as on OOD ones . Due to diversity of the OOD class ( ILSVRC ) such training results in a bias towards the ID dataset . For example , there are around 10 car-like classes in ILSVRC ; therefore , cars occur in only around 1/100 ILSVRC images . On the other hand , almost every image from any road driving dataset is likely to contain at least one car . Hence , the proposed approach ensures that the model is more likely to classify car pixels as inliers ( Cityscapes ) rather than as outliers ( ILSVRC ) . We consider several improvements to this approach in the appendix . The proposed OOD model is discriminative and fully convolutional , and we train it with the dense cross-entropy loss . During evaluation , we apply the trained model to test images in order to obtain dense logit maps for the two classes . These logits reflect the epistemic uncertainty in each individual pixel . OOD detection is finally performed by thresholding the probability of the inlier class . The proposed OOD model works well in tandem with ILSVRC because it can be warmed-up with parameters pre-trained on the same dataset . This considerably speeds-up the training since the optimization starts from a model which is already able to extract useful features , and only needs to learn to distinguish between ILSVRC and the in-distribution dataset . This approach can share the common feature extractor with the primary semantic segmentation model , which results in a smaller OOD-detection overhead than in GAN-based approaches ( Lee et al. , 2018 ; Sabokrou et al. , 2018 ) .

Summary: This paper addresses the problem of out-of-distribution detection for helping the segmentation process. Therefore, the detection is performed on a pixel basis. The application of the approach is to datasets used for autonomous driving, where semantic segmentation of the view of the road is a typical application. Since in a road view there will be pixels that are projections of objects that are likely not in the set of classes known by the semantic segmentation algorithm, it makes sense to flag them as being out of distribution (OOD), or not known, or to assign to them a low confidence level. The proposed approach is trivial: train a binary classifier that distinguishes image patches from a known set of classes from image patches coming from an unknown (background class). The classifier output applied at every pixel will give the confidence value. While there are different dataset options to represent the known classes, the background class is represented by images from ILSVRC. The results show that for the segmentation application the approach works better than using an adaptation of more elaborate out-of-distribution methods.