An Empirical Exploration of Open-Set Recognition via Lightweight Statistical Pipelines

1 INTRODUCTION . Embodied perception and autonomy require systems to be self-aware and reliably know their unknowns . This requirement is often formulated as the open set recognition problem ( Scheirer et al. , 2012 ) , meaning that the system , e.g. , a K-way classification model , should recognize anomalous examples that do not belong to one of K closed-world classes . This is a significant challenge for machine-learned systems that notoriously over-generalize to anomalies and unknowns on which they should instead raise a warning flag ( Amodei et al. , 2016 ) . Open-world benchmarks : Curating open-world benchmarks is hard ( Liu et al. , 2019 ) . One common strategy re-purposes existing classification datasets into closed vs open examples – e.g. , declaring MNIST digits 0-5 as closed and 6-9 as open ( Neal et al. , 2018 ; Oza & Patel , 2019 ; Geng et al. , 2020 ) . In contrast , anomaly/out-of-distribution ( OOD ) benchmarks usually generate anomalous samples by adding examples from different datasets - e.g. , declaring CIFAR as anomalous for MNIST ( Ge et al. , 2017 ; Oza & Patel , 2019 ; Liu et al. , 2019 ) . Most open-world protocols assume open-world data is not available during training ( Liang et al. , 2018 ; Oza & Patel , 2019 ) . Interestingly , Dhamija et al . ( 2018 ) ; Hendrycks et al . ( 2019b ) find that , if some open examples are available during training , one can learn simple open-vs-closed binary classifiers that are remarkably effective . However , Shafaei et al . ( 2019 ) comprehensively compare various well-known open-world methods through rigorous experiments , and empirically show that none of the compared methods generalize to high-dimensional open-world images . Intuitively , classifiers can easily overfit to the available set of open-world images , which won ’ t likely exhaustively span the open world outside the K classes of interest . In this paper , we carry out a rigorous empirical exploration of open-set recognition of highdimensionial images . We explore simple statistical models such as Nearest Class Means ( NCMs ) , kmeans and Gaussian Mixture Models ( GMMs ) . Our hypothesis is that such classic statistical methods can reliably model the closed-world distribution ( through the closed-world training data ) , and help avoid overfitting ( an issue in open-vs-closed classifiers ) . Traditionally , such simple models have been used to address the open-world ( Chandola et al. , 2009 ; Geng et al. , 2020 ) , but are largely neglected in the recent literature . We revisit these simple methods , and find them quite effective once crucial techniques are considered , as summarized by contributions below . Contribution 1 : We build classic statistical models on top of off-the-shelf ( OTS ) features computed by the underlying K-way classification network . We find it crucial to use OTS features that have been pre-trained and post-processed appropriately ( discussed further below ) . Armed with such features , we find classic statistical models such as kmeans and GMMs ( Murphy , 2012 ) can outperform prior work . We describe two core technical insights below . Insight-1 Pre-training networks ( e.g. , on ImageNet ( Deng et al. , 2009 ) ) is a common practice for traditional closed-world tasks . However , to the best of our knowledge , open-world methods do not sufficiently exploit pre-training ( Oza & Patel , 2019 ) . Hendrycks et al . ( 2019a ) report that pre-training improves anomaly detection using softmax confidence thresholding ( Hendrycks & Gimpel , 2017 ) . We find pretraining to be a crucial factor in learning better representations that support more sophisticated open-world reasoning . Intuitively , pre-trained networks expose themselves to diverse data that may look similar to open-world examples encountered at test-time . We operationalize this intuition by building statistical models on top of existing discriminative networks , which tend to make use of pre-training by design . We demonstrate this significantly outperforms features trained from scratch , as most prior open-set work does . Insight-2 Low-dimensional normalized features . While some existing open-world methods also exploit OTS features ( Lee et al. , 2018 ) , we find it crucial to make use of insufficiently well-known best practices for feature extraction . Specifically , to reduce dimensionality , we pool spatially ( Gong et al. , 2014 ) and use principle component analysis ( PCA ) ( Turk & Pentland , 1991 ) . Then , to ensure features are invariant to scalings , we adopt L2 normalization ( Gong et al. , 2014 ; Gordo et al. , 2017 ) . While these are somewhat standard practices for deep feature extraction in areas such as retrieval , their combination is not well explored in the open-set literature ( Bendale & Boult , 2016 ; Grathwohl et al. , 2019 ) . Given a particular OTS K-way classification network , we determine the “ right ” feature processing through validation . In particular , we find that L2-normalization greatly boosts open-world recognition performance ; spatial pooling and PCA altogether reduce feature dimension by three orders of magnitude without degrading performance , resulting in a lightweight pipeline . Contribution 2 : We re ( introduce ) the problem of open-set semantic segmentation . Interestingly , classic benchmarks explicitly evaluate background pixels outside the set of K classes of interest ( Everingham et al. , 2015 ) . However , contemporary benchmarks such as Cityscapes ( Cordts et al. , 2016 ) ignore such pixels during evaluation . As a result , most contemporary segmentation networks also ignore such pixels during training . Perhaps surprisingly , such ignored pixels include vulnerable objects like strollers and wheelchairs . Misclassifying such objects may have serious implications for real-world autonomous systems ( see Figure 1 ) . Instead of ignoring these pixels , we use them to explore open-world recognition by repurposing them as open-world examples . Interestingly , this setup naturally allows for open-pixels in the train-set , a protocol advocated by ( Dhamija et al. , 2018 ; Hendrycks et al. , 2019b ) . We benchmark various open-world methods on this setup , and show that our suggested simple statistical models still outperform typical open-world methods . Similar to past work , we also find that simple open-vs-closed binary classifiers serve as strong baselines , provided one has enough training examples of open pixels that span the open-world . 2 RELATED WORK . Open-set recognition . There are multiple lines of work addressing the open-world problems in the context of K-way classification , such as anomaly/out-of-distribution detection ( Chandola et al. , 2009 ; Zong et al. , 2018 ; Hendrycks et al. , 2019b ) , novelty/outlier detection ( Pidhorskyi et al. , 2018 ) . Defined on K-way classification , these problems can be crisply formulated as open-set recognition ( Scheirer et al. , 2012 ; Bendale & Boult , 2016 ; Lee et al. , 2018 ; Geng et al. , 2020 ) . Given a testing example , these methods compute the likelihood that it belongs to the open-world via post-hoc functions like density estimation ( Zong et al. , 2018 ) , uncertainty modeling ( Gal & Ghahramani , 2016 ; Liang et al. , 2018 ; Kendall & Gal , 2017 ) and reconstruction error of the testing example ( Pidhorskyi et al. , 2018 ; Dehaene et al. , 2020 ) . Different from the above sophisticated methods , we train simple statistical models ( e.g. , GMM ) which can work much better by following our proposed pipeline . Feature extraction . Off-the-shelf ( OTS ) features can be extracted from the discriminative network and act as powerful embeddings ( Donahue et al. , 2014 ) . Using OTS features for open-set recognition has been explored in prior work ( Oza & Patel , 2019 ; Grathwohl et al. , 2019 ; Lee et al. , 2018 ) . OTS features can be logits , softmax and other intermediate feature activations computed by the discriminative network . Early open-set methods modify the softmax ( Hendrycks & Gimpel , 2017 ; Bendale & Boult , 2016 ) . Grathwohl et al . ( 2019 ) learn an energy-based model over the logit features for anomaly detection . Oza & Patel ( 2019 ) reconstruct input images from penultimate-layer features and use the reconstruction error as the open-set likelihood . Most related to our work is Lee et al . ( 2018 ) , who build Gaussian models over OTS features for anomaly detection , but relies on input image perturbation for better open-set classification performance . In contrast , we study even simpler statistical models such as kmeans and GMM , and show that proper feature processing ( via L2-normalization and PCA ) greatly boosts the efficacy and efficiency of open-set recognition . 3 OPEN-SET RECOGNITION VIA LIGHTWEIGHT STATISTICAL PIPELINES . In this section , we discuss various design choices in our pipeline , including ( 1 ) training schemes for the underlying closed-world task , ( 2 ) methods for extracting and repurposing closed-world feature descriptors for open-world recognition , and ( 3 ) the statistical density estimation models built on such extracted features . We conclude with ( 4 ) an analysis of the additional compute required for self-aware processing ( via the addition of an open-world `` head '' on top of the closed-world network ) , pointing out that minimal additional processing is needed . 1 . Network training strategies . Virtually all state-of-the-art deep classifiers make use of large-scale pre-training , e.g. , on ImageNet ( Deng et al. , 2009 ) , which seems to consistently improve towards the state-of-the-art performance on the closed-world data ( Sun et al. , 2017 ; Mahajan et al. , 2018 ) . However , many , if not all , open-world methods trains the discriminant network purely on the closedworld data without pre-training ( Oza & Patel , 2019 ; Hendrycks & Gimpel , 2017 ) . We argue that a pre-trained network also serves as an abstraction of the ( pseudo ) open world . Intuitively , such a pre-trained model has already seen diverse data that may look similar to the open-world examples that will be encountered at test-time , particularly if ImageNet does not look similar to the ( closed ) training set for the task of interest . Recently , Hendrycks et al . ( 2019a ) show that pre-training improves open-world robustness with a simplistic method that thresholds softmax confidence ( Hendrycks & Gimpel , 2017 ) . Our diagnostic study shows that our explored statistical models , as well as prior methods , do perform much better when built on a pre-trained network than a network trained from scratch ! 2 . Feature extraction . OTS features generated at different layers of the trained discriminative model can be repurposed for open-set recognition ( Lee et al. , 2018 ) . Most methods leverage softmax ( Hendrycks & Gimpel , 2017 ) and logits ( Bendale & Boult , 2016 ; Grathwohl et al. , 2019 ) which can be thought of as features extracted at top layers . Similar to ( Lee et al. , 2018 ) , we find it crucial to analyze features from intermediate layers for open-set recognition , for which logits and softmax may be too invariant to be effective for open-set recognition ( see Figure 3 ) . One immediate challenge to extract features from an intermediate layer is their high dimensionality , e.g. , of size 512x7x7 from ResNet18 ( He et al. , 2016 ) . To reduce feature dimension , we simply ( max or average ) pool the feature activations spatially into a 512-dim feature vectors ( Yang & Ramanan , 2015 ) . We further use PCA , which can reduce dimension by 10× ( from 512-dim to 50-dim ) without sacrificing performance . We find this dimensionality particularly important for learning second-order covariance statistics as in GMMs , described below . Finally , following ( Gong et al. , 2014 ; Gordo et al. , 2017 ) , we find it crucial to L2-normalize extracted features ( see Figure 2 ) . 3 . Statistical models . Given the above extracted features , we can learn various generative statistical models to capture the confidence/probability that a test example belongs to the closed-world distribution . We explore simple parametric models such as Nearest Class Means ( NCMs ) ( Mensink et al. , 2013 ) and class-conditional Gaussian models ( Lee et al. , 2018 ; Grathwohl et al. , 2019 ) , as well as non-parametric models such has nearest neighbors ( NN ) ( Boiman et al. , 2008 ; Júnior et al. , 2017 ) . We finally explore an intermediate regime of mixture models , including ( class-conditional ) GMMs and kmeans ( Chandola et al. , 2009 ; ? ; Cao et al. , 2016 ; Geng et al. , 2020 ) . Our models label a test example as open-world when the inverse probability ( e.g. , of the most-likely class-conditional GMMs ) or distance ( e.g. , to the closest class centroid ) is above a threshold . One benefit of such simple statistical models is that they are interpretable and relatively easier to diagnose failures . For example , one failure mode is an open-world sample being misclassified as a closed-world class . This happens when open-world data lie close to a class-centroid or Gaussian component mean ( see Figure 3-left ) . Note that a single statistical model may have several hyperparameters – GMMs can have multiple Gaussian components and different structures of second-order covariance , e.g. , either a single scalar , a vector or a full-rank general covariance per component , as denoted by “ spherical ” , “ diag ” and “ full ” , respectively . We make use of a validation set to determine the hyperparameters ( as well as feature processing steps listed above ) . 4 . Lightweight Pipeline . We re-iterate that the above feature extraction and statistical models result in a lightweight pipeline for open-set recognition . We now analyze the number of additional parameters in our pipeline . Naively learning a GMM over features from the last convolutional layer result in massive second-order statistics , on the order of ( 512× 7× 7 ) 2 for a 512x7x7 Res18 feature map . We find that spatial pooling and PCA can reduce dimensionality to 50 , which requires only 502 covariance parameters ( a reduction of 105 ) . We find linear dimensionality reduction more effective than sparse covariance matrices ( e.g. , assuming diagonal structure ) . The appendix includes additional experiments . Given a class-conditional five-component GMM ( the largest found to be effective through cross validation ) , this requires 128KB storage per class , or 594KB for all 19 classes in Cityscapes . This is less than 0.1 % of the compute of the underlying closed-world network ( e.g. , HRNet at 250 MB ) , making it a quite practical addition that enables self-aware processing on real-time autonomy stacks .

Summary: of Paper: The main claim of the paper is that out of distribution (OOD) detection can be done by use of pre-training and appropriately deriving a feature space from SOTA activations  via pooling, PCA based dimensionality reduction, L2 normalization.  Classical methods such as GMMs, k-means etc. can then be used to estimate the probability density function of features for use in OOD detection.  Several alternative schemes are compared against many OOD detection schemes.