Distance Based Image Classification: A solution to generative classification's conundrum?

Wen-Yan Lin, Siying Liu, Bing Tian Dai, Hongdong Li

TL;DR

This paper introduces Distance Classification, a generative approach that matches the accuracy of traditional discriminative models while overcoming the "conundrum" of instance-specific noise. By defining classes by "what they are" rather than "what they are not," the authors enable strictly incremental learning that avoids catastrophic forgetting and scales efficiently to large numbers of classes.

What Problem Does This Paper Address?

Most modern image classifiers are discriminative: they draw boundaries to separate one class from everything else. Conceptually, this means an AI defines an "apple" as something that is not an orange, not a banana, and not a pear. While effective, this approach has a major flaw: whenever you want to teach the AI a new class (e.g., "persimmon"), you have to retrain the entire model to redefine all those "not" boundaries. Failure to do so leads to catastrophic forgetting, where the model loses its ability to recognize old classes.

Generative classifiers define classes by their own internal properties ("what they are"), which should theoretically make incremental learning easy. However, they have historically been much less accurate. The authors argue this is because standard generative models fail to account for "non-semantic" factors—like lighting, background, and pose—that vary for every single image.

Methods

The authors build upon Shell Theory, a statistical framework for high-dimensional data, to create a model that explicitly handles noise.

  1. Noise Modeling: They model an image feature as an "ideal" semantic generator plus an instance-specific noise term.
  2. Noise Cancellation: The core innovation is a mathematical proof showing that while raw distance is a poor metric for validating class membership (due to noise), comparing distances to a reference vector (like the global mean of the data) cancels out the dominant noise magnitude.
  3. Generator-Means: Instead of representing a class with a single average, they use K-Means clustering to represent each class as an ensemble of "generator-means." For example, a "church" class might have separate means for "interiors" and "facades."
  4. Distance Classification Algorithm: During inference, a test image is compared against these stored means. The model uses a modified nearest-neighbor approach that incorporates noise cancellation to determine both the most likely class and the likelihood that the image belongs to that class at all.
Fig. 1: The distance paradox. Raw distance (left) is good for picking the best class but fails to separate in-class from out-of-class instances. Noise cancellation (right) fixes this.

Datasets

The researchers evaluated their method across a wide range of benchmarks:

  • Simple Datasets: MNIST (handwritten digits) and Fashion-MNIST.
  • Natural Images: STL-10, Internet STL-10 (crawled data with outliers), and ASSIRA (dogs vs. cats).
  • Large-Scale & Scene Recognition: ImageNet-1000, SUN-397, Food-101, and Flower-102.
  • Novelty Detection: They used Flickr11k as a source of "unknown" images to test the model's ability to recognize anomalies.

Key Insights and Ideas

  • The "What-They-Are" Advantage: Because each class is learned independently, adding a new class is as simple as appending new means to a list. There is no need to retrain on old data, making the model "strictly incremental."
  • Distance vs. Validation: A surprising finding is that raw distance is a great metric for classification (choosing the best match) but a terrible one for validation (deciding if a match is actually valid). Figure 3 in the paper illustrates how noise cancellation creates a clear separation between in-class and out-of-class distributions.
  • Agnostic to Overlap: Traditional classifiers struggle when class definitions overlap (e.g., "cat" and "feline"). Distance classifiers are agnostic to these overlaps because they don't rely on mutually exclusive boundaries.

Key Results

  • Accuracy: Distance Classification achieved 91.7% top-5 accuracy on ImageNet-1000 (using ResNet-50 features), nearly matching the 94.7% of a jointly-trained discriminative model.
  • Incremental Learning: In head-to-head tests against state-of-the-art incremental learners (like BiC and REMIND), Distance Classification showed significantly less "accuracy decline" as more classes were added. On the SUN-397 dataset, it maintained much higher accuracy than competitors after 9 increments.
  • Efficiency: Training is remarkably fast. For the SUN-397 dataset, Distance Classification was over 100x faster to update than traditional methods like BiC.
  • Scalability: Because it uses nearest-neighbor logic, inference can be optimized to $O(\log N)$ complexity, potentially allowing for systems with millions of classes.

Limitations and Future Work

  • Feature Dependency: The method currently relies on high-quality, pre-trained features (like those from a ResNet). It lacks a built-in mechanism for "feature refinement"—improving the underlying representation as new data arrives.
  • Local Ratios: The ratio-based noise cancellation is most effective for "local" comparisons between similar distances; its performance may vary for very distant outliers.
  • Future Directions: The authors suggest this framework could lead to "very large inference engines" and better anomaly detection systems that don't require explicit training on "negative" examples.

Summary updated

BibTeX
@article{lin2023distance,
  author = {Wen-Yan Lin and Siying Liu and Bing Tian Dai and Hongdong Li},
  title = {{Distance Based Image Classification: A solution to generative classification's conundrum?}},
  journal = {Int. J. Comput. Vis.},
  year = {2023},
  doi = {10.1007/s11263-022-01675-9},
}
Figure