Source-linked AI summary

Unsupervised Out-of-Distribution Detection by Maximum Classifier Discrepancy

Qing Yu, Kiyoharu Aizawa

arXiv:1908.04951v1cs.CV

TL;DR

OOD detection is needed because real-world inputs can differ from training data and lead neural networks to make wrong predictions. The paper uses a two-head CNN and unlabeled data to maximize classifier discrepancy, reporting stronger performance across architectures and dataset pairs, with a classification-accuracy trade-off after fine-tuning.

  • Problem

    Real-world inputs may differ from training data, causing incorrect predictions and creating a need for accurate OOD detection.

  • Method

    A two-head CNN shares a feature extractor between two classifiers and uses unlabeled, potentially ID or OOD data to maximize their decision-boundary discrepancy without labeled OOD samples.

  • Results

    The method significantly outperformed current state-of-the-art methods across DNN architectures and varied ID/OOD dataset pairs, including benchmarks and real-world simulations.

  • Takeaways & Limitations

    Classifier discrepancy and unlabeled data provide an OOD detection approach that can identify samples far from the support of ID samples.

  • Takeaways & Limitations

    Fine-tuning the classifier caused a 5% drop in classification accuracy compared with the original classifier before fine-tuning.

Abstract

from arXiv · show

Since deep learning models have been implemented in many commercial applications, it is important to detect out-of-distribution (OOD) inputs correctly to maintain the performance of the models, ensure the quality of the collected data, and prevent the applications from being used for other-than-intended purposes. In this work, we propose a two-head deep convolutional neural network (CNN) and maximize the discrepancy between the two classifiers to detect OOD inputs. We train a two-head CNN consisting of one common feature extractor and two classifiers which have different decision boundaries but can classify in-distribution (ID) samples correctly. Unlike previous methods, we also utilize unlabeled data for unsupervised training and we use these unlabeled data to maximize the discrepancy between the decision boundaries of two classifiers to push OOD samples outside the manifold of the in-distribution (ID) samples, which enables us to detect OOD samples that are far from the support of the ID samples. Overall, our approach significantly outperforms other state-of-the-art methods on several OOD detection benchmarks and two cases of real-world simulation.

1. Introduction

OOD detection matters because user-provided inputs can come from distributions different from training data and cause incorrect predictions. The paper introduces unsupervised training with unlabeled data and detects OOD samples through disagreement between two classifiers.

  • User-uploaded inputs may come from distributions different from training data, causing DNNs to provide wrong predictions.
  • The proposed setting uses labeled ID data together with unlabeled data whose class membership and ID/OOD status are unknown.
  • Existing confidence-based methods classify low-confidence samples as OOD, but performance degrades when the ID dataset has many classes.
  • A two-head CNN uses one shared feature extractor and two classifiers with different decision boundaries, whose discrepancy helps identify OOD samples.
  • The method fine-tunes the network to classify labeled ID samples correctly while maximizing discrepancy between the classifiers without labeled OOD training data.
  • The approach is evaluated across multiple OOD benchmarks, real-world simulation datasets, and modern architectures, where it outperforms other methods by a large margin in many settings.

2. Related Work

Prior OOD methods use confidence scores, generated boundary samples, feature-based detectors, label hierarchies, or classifier ensembles, each with stated limitations or added requirements. This paper instead fine-tunes the network using unlabeled data, including all or part of the test data.

  • Softmax-confidence detection relies on lower predicted probabilities for OOD samples, but some OOD inputs remain overconfidently classified.
  • Generative methods train classifiers to assign uniform probabilities to generated boundary OOD samples near the ID data manifold.
  • ODIN improves score separation using temperature scaling and input perturbations based on the loss gradient.
  • Feature-based detectors require 1,000 labeled OOD samples for stable performance, while hierarchical-classifier methods require a label hierarchy.
  • The leave-out classifier ensemble uses partitions of ID data as self-supervised OOD examples and combines multiple classifiers with ODIN procedures.
  • Compared with previous studies, the proposed method fine-tunes the neural network using unlabeled data, which consists of all or part of the test data.

3. Method

The method uses a two-head CNN and unlabeled data to distinguish ID from OOD samples by maximizing disagreement between two classifiers while preserving ID classification.

  • Overall Concept: The two-head CNN contains one feature extractor and two classifiers that produce separate class-probability outputs for each input.The classifiers have different parameters and decision boundaries while sharing the feature extractor.
  • Overall Concept: OOD samples tend to produce larger classifier discrepancy than unlabeled ID samples after supervised training on labeled ID data.The discrepancy is measured using the L1 distance between classifier outputs.
  • Discrepancy Loss: The method maximizes classifier disagreement on unlabeled data to separate OOD samples from the ID manifold without using labeled OOD samples.The discrepancy between the two softmax distributions is used to separate ID and OOD samples.
  • Discrepancy Loss: Maximizing the discrepancy increases F1 entropy toward uniform class probabilities while decreasing F2 entropy toward a single high-probability class.The discrepancy loss is defined using the entropy of the two softmax distributions.
  • Training Procedure: Training first uses labeled ID samples for supervised classification, then repeatedly fine-tunes with supervised ID classification and unsupervised discrepancy objectives.Fine-tuning alternates Step A, which preserves ID classification, and Step B, which increases discrepancy using unlabeled data and labeled ID samples.
  • Inference: A margin makes the unsupervised loss zero once average unlabeled-sample discrepancy exceeds m, helping prevent overfitting.At inference, samples whose classifier-output L1 distance exceeds threshold δ are assigned as OOD.

4. Experiments

The experiments evaluate the method across diverse ID/OOD dataset pairs, architectures, and metrics, and report significant improvements over state-of-the-art methods.

  • Experimental Settings: The evaluation uses a diverse set of in-distribution and out-of-distribution dataset pairs.
  • Experimental Settings: The experiments cover multiple neural network architectures and evaluation metrics.
  • Results: The method significantly outperforms current state-of-the-art methods in the reported comparisons.All experiments were run using PyTorch 0.4.1.

4.1. OOD Detection on benchmarks

The benchmark evaluation compares the proposed OOD detector with established methods across multiple dataset pairs, architectures, and metrics. Results show strong separation of ID and OOD samples, including challenging settings, while revealing a classification-accuracy trade-off after fine-tuning.

  • Benchmark setup: The evaluation compares the method with ODIN and ELOC on OOD benchmark dataset pairs using DenseNet and Wide ResNet architectures.The benchmark setup includes CIFAR-10 and CIFAR-100 as ID datasets, with TinyImageNet, LSUN, and iSUN variants as OOD datasets.
  • Benchmark results: The method significantly outperforms ODIN and ELOC across all evaluated neural network architectures and dataset pairs.Table 2 reports comparisons using standard OOD detection metrics, with larger or smaller values preferred according to each metric.
  • Benchmark results: The method performs accurately on more challenging full-object datasets, including TinyImageNet-resize, LSUN-resize, and iSUN.These datasets are described as more difficult to detect than cropped-object variants.
  • Benchmark results: The detector nearly perfectly distinguishes ID and OOD samples on most dataset pairs, with less score overlap than ELOC.For CIFAR-100 versus TinyImageNet-resize, the visualization shows substantially less overlap between ID and OOD samples for the proposed method.
  • Interpretability: A simple threshold of 1.0 separates ID and OOD samples, whereas ELOC lacks an interpretable threshold at that value.The threshold comparison is reported for the visualization in Figure 5a.
  • Ablation studies: Performance remains better than prior methods under varied unlabeled-data sizes and balances, including settings with 9,000 ID and 500 OOD training samples.Evaluation used completely unseen samples, including 9,000 ID and 9,000 OOD samples.
  • Ablation studies: The method continues to work when multiple OOD datasets are used or when the OOD dataset for unsupervised training differs from the evaluation dataset.These experiments examine robustness to the relationship between unsupervised-training and evaluation data.
  • Mechanism: The discrepancy loss separates ID and OOD samples because ID samples have smaller loss than OOD samples, with lower detection error when their loss difference is larger.After fine-tuning, OOD samples produce divergent maximum softmax scores across the two classifiers, while ID scores are nearly matched.

4.2. OOD Detection on real-world simulation

The method was evaluated in food and fashion real-world simulations using FOOD-101 and DeepFashion as ID datasets, with TinyImageNet-crop and LSUN-crop as OOD datasets. It significantly outperformed ODIN and ELOC across these datasets and nearly perfectly detected non-food and non-fashion images.

  • The study evaluated OOD detection in two real-world simulations covering food and fashion applications.The simulations were motivated by services focusing on these domains.
  • FOOD-101 served as the ID dataset, while TinyImageNet-crop and LSUN-crop served as OOD datasets for food recognition.FOOD-101 contains 101 dish classes, with 750 training and 250 testing images per class.
  • DeepFashion served as the ID dataset, while TinyImageNet-crop and LSUN-crop served as OOD datasets for fashion recognition.The selected DeepFashion benchmark contains 289,222 clothing images and 50 clothing classes.
  • Images were resized to 32 × 32, and held-out data were used for validation, unsupervised training, and evaluation.The dataset-specific splits assigned original training data to Xin and separate held-out data to validation or Xul.
  • The proposed method significantly outperformed ODIN and ELOC on all real-world simulation datasets and nearly perfectly detected non-food and non-fashion images.The comparison was reported in Table 5.

5. Conclusion

The paper proposes a two-classifier approach for detecting OOD samples, including samples far from the ID support, without labeled OOD training data. Extensive evaluations across architectures, dataset pairs, benchmarks, and real-world simulations report significant improvements over current state-of-the-art methods.

  • The proposed approach uses two classifiers to detect OOD samples far from the support of ID samples.
  • The method does not require labeled OOD samples to train the neural network.
  • Evaluations covered OOD detection benchmarks and real-world simulation datasets across different DNN architectures and dataset pairs.
  • The method significantly outperformed current state-of-the-art methods across the evaluated architectures and in- and out-of-distribution dataset pairs.
Loading 1908.04951v1…