Spatial location constraint prototype loss for open set recognition

Ziheng Xia, Penghui Wang, Ganggang Dong, Hongwei Liu

TL;DR

Most Open Set Recognition (OSR) models struggle because unknown samples naturally gravitate toward the center of the feature space, overlapping with known classes. This paper introduces Spatial Location Constraint Prototype Loss (SLCPL), which forces known class prototypes toward the periphery of the feature space, effectively "clearing the center" to make unknown samples much easier to detect.

What Problem Does This Paper Address?

In traditional "Closed Set" recognition, we assume the test data will only contain classes seen during training. In the real world, this is rarely true. Open Set Recognition (OSR) requires a model to accurately classify known categories while simultaneously flagging "unknown" samples it has never encountered.

The authors identify a fundamental cause for Open Space Risk (the risk of labeling an unknown sample as a known class). They observe that Convolutional Neural Networks (CNNs) act as template matchers. When a network encounters an unknown sample that doesn't match its learned filters, the resulting feature activations are low. In a high-dimensional feature space, these low-value activations cluster near the origin (the center). If known class features also reside near the center, the model cannot distinguish between a "weak" known sample and a "novel" unknown sample.

Methods

The authors build upon Generalized Convolutional Prototype Learning (GCPL). In GCPL, the model learns "prototypes" (representative points in feature space) for each class and minimizes the distance between samples and their respective prototypes.

The core novelty is the Spatial Location Constraint (SLC) term added to the loss function:

  1. The Constraint: The SLC term calculates the variance of the distances between all class prototypes and their collective center.
  2. The Goal: By incorporating this into the loss, the model is incentivized to push prototypes away from the center and toward the "edge" region of the feature space.
  3. The Result: This creates a "hollow" center in the feature space. Known classes are clustered in the surrounding "edge" regions, while unknown samples—which naturally produce low-magnitude features—fall into the now-vacant center.

For inference, the model uses a distance-based threshold: if a sample is too far from any known prototype (i.e., it's in the center or too far out), it is labeled as unknown.

Datasets

The researchers evaluated SLCPL across several standard computer vision benchmarks:

  • MNIST, SVHN, and CIFAR10: Used with a standard split of 6 known classes and 4 unknown classes.
  • CIFAR+10 and CIFAR+50: Training on 4 classes of CIFAR10 and using 10 or 50 classes from CIFAR100 as unknowns.
  • TinyImageNet: A more challenging set with 20 known and 180 unknown classes.
  • Cross-Dataset Evaluation: Testing models trained on MNIST against "out-of-distribution" sets like Omniglot, Gaussian noise, and uniform noise.

Key Insights and Ideas

  • The Origin of Risk: The paper provides a compelling explanation for why unknowns overlap with knowns. Because CNN kernels are essentially templates, a mismatch (unknown) leads to low coordinate values, pulling the sample toward the origin.
  • Spatial Engineering: Rather than just making clusters tighter (intra-class compactness), OSR can be significantly improved by managing where those clusters live. Pushing knowns to the periphery is a simple but effective geometric solution.
  • Visual Confirmation: Using t-SNE and 2D feature visualizations, the authors demonstrate the "starburst" or "donut" effect: SLCPL successfully clears the center of the feature space, whereas standard SoftMax or GCPL leaves known classes cluttered near the origin.

Key Results

SLCPL consistently outperformed existing state-of-the-art methods (like OpenMax, CROSR, and RPL) in both classification accuracy and unknown detection (measured by AUROC).

  • TinyImageNet: SLCPL achieved an AUROC of 74.9%, a significant jump over the baseline GCPL (63.9%) and the previous state-of-the-art RPL (70.2%).
  • CIFAR10: In closed-set accuracy, SLCPL reached 94.6%, showing that adding the spatial constraint doesn't just help with unknowns—it actually helps the model learn more discriminative features for known classes as well.
  • Robustness to Noise: On the MNIST-to-Noise task, SLCPL achieved nearly perfect scores (99.6%), proving it is highly effective at filtering out non-semantic data.

Limitations and Future Work

  • Threshold Selection: While the paper uses AUROC (which is threshold-independent) for evaluation, implementing this in a real-world system still requires choosing a distance threshold $\tau$. The authors note that finding the "optimal" threshold remains a challenge.
  • Dimensionality: The experiments primarily use LeNet++ and "Plain CNN" architectures. The authors suggest that the relationship between the network's depth, the feature space's dimensionality, and the effectiveness of the spatial constraint warrants further study.
  • Scaling to Massive Class Counts: While it works on TinyImageNet (20 knowns), it is unclear how the "edge region" geometry holds up when dealing with thousands of known classes, where the periphery might become crowded.

Summary updated

BibTeX
@article{xia2023spatial,
  author = {Ziheng Xia and Penghui Wang and Ganggang Dong and Hongwei Liu},
  title = {{Spatial location constraint prototype loss for open set recognition}},
  journal = {Comput. Vis. Image Underst.},
  year = {2023},
  doi = {10.1016/j.cviu.2023.103651},
}
Figure