Single-Label Multi-Class Image Classification by Deep Logistic Regression

Qi Dong, Xiatian Zhu, Shaogang Gong

TL;DR

Softmax Regression (SR) is the undisputed standard for single-label image classification, but it can artificially distort the underlying geometric relationships between classes. This paper demonstrates that Logistic Regression (LR)—typically reserved for multi-label tasks—can actually outperform SR if we fix its "Negative Class Distraction" problem using novel hard-mining techniques.

What Problem Does This Paper Address?

In deep learning, we almost exclusively use Softmax Regression (SR) (often via Cross-Entropy Loss) for single-label classification. SR forces a competition among classes because the output probabilities must sum to 1. While this creates strong decision boundaries, it treats all non-ground-truth classes identically, pushing them away from the target class in a homogeneous way. This can distort the natural manifold structure of the data (e.g., a model learns to push "dog" away from "cat" with the exact same force it pushes "dog" away from "car").

Logistic Regression (LR), commonly used for multi-label classification, avoids this by treating every class as an independent binary classification task. Theoretically, this allows natural inter-class correlations to emerge. However, in practice, vanilla LR performs poorly on single-label tasks.

The Negative Class Distraction (NCD) Problem

The authors identify the Negative Class Distraction (NCD) problem as the primary reason LR fails. In a $K$-class dataset, every training image has 1 positive class and $K-1$ negative classes. Early in training, the sheer volume of negative classes generates a massive cumulative loss and gradient that completely drowns out the learning signal from the single positive class.

Comparison of loss components and gradient ratios between vanilla LR and SS-LR during training.

As shown in the training curves above, vanilla LR (blue) suffers from a positive class loss that fails to converge because the model is overwhelmed by negative class gradients. The model gets "distracted" by trying to push down the scores of hundreds of negative classes and ignores learning the positive one. Crucially, NCD is a per-sample optimization problem in the class space, meaning it occurs even if the training dataset is perfectly balanced.

Methods: Rectifying the Focus

To solve the NCD problem, the authors propose two "focus rectified" LR objective functions that apply the principle of hard negative mining to the class space:

  1. HS-LR (Hard Selection LR): This method explicitly drops easy negative classes from the loss calculation. It ranks the $K-1$ negative classes by their predicted probability and only computes the loss for the top $m\%$ most confusing (hardest) negative classes.
  2. SS-LR (Soft Selection LR): Instead of a hard cutoff, this method applies a probability-adaptive weight, $(p_k)^r$, to each negative class. If the network is already confident a class is negative (low probability $p_k$), its weight drops to near zero. If the network is confused (high $p_k$), the weight increases, forcing the model to pay attention.

Visualizing the Class Manifold

The impact of these methods is most visible when looking at the feature space. Vanilla LR fails to form distinct clusters, whereas the proposed SS-LR recovers the clustering capability of SR while potentially preserving more nuanced class relationships.

t-SNE visualizations of feature distributions for (a) SR, (b) vanilla LR, and (c) the proposed SS-LR.

Key Results

The proposed LR variants proved highly competitive, often beating the standard SR baseline across various tasks:

  • Tiny ImageNet (200 classes): Using a ResNet-32, standard SR achieved 50.2% accuracy. While vanilla LR dropped to 45.9%, the proposed SS-LR jumped to 56.0%—a massive 5.8% absolute improvement over the SR baseline.
  • Person Re-ID (DukeMTMC): Using ResNet-50, standard SR achieved 73.7% Rank-1 accuracy. HS-LR achieved 77.9%, showing that mining hard negative classes is highly effective for fine-grained recognition.
  • DeepFashion (Multi-label): SS-LR improved per-image accuracy to 73.9%, compared to vanilla LR's 64.8%, proving the NCD problem also plagues sparse multi-label tasks.

Conclusion

LR isn't fundamentally unsuited for single-label classification; it just suffers from a severe gradient imbalance that scales with the number of classes. By addressing the NCD bottleneck through hard or soft selection, researchers can leverage the benefits of independent class modeling without the optimization failures of vanilla LR. This approach is particularly potent for datasets with high class counts or fine-grained categories where inter-class relationships are complex.

Summary updated

BibTeX
@inproceedings{dong2019single,
  author = {Qi Dong and Xiatian Zhu and Shaogang Gong},
  title = {{Single-Label Multi-Class Image Classification by Deep Logistic Regression}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33013486},
}
Figure