NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Biased Binary Attribute Classifiers Ignore the Majority Classes

Xinyi Zhang, Johanna Sophie Bieri, Manuel Günther · Submission to ICLR 2024 · Withdrawn

TL;DR

When training a neural network on an imbalanced binary dataset, standard wisdom suggests the model learns the majority class best. By adapting gradient-based Class Activation Mapping (CAM) to binary classifiers, the authors discover the opposite: biased models virtually ignore image features for the majority class—relying instead on classifier bias and uninformative image corners—while only learning meaningful spatial features for the minority class. Re-balancing the loss restores sensible attention across both classes.

What Problem Does This Paper Address?

Most real-world computer vision tasks—such as detecting skin lesions, recognizing facial attributes, or flagging fraud—are binary classification problems with severe class imbalances. Conventional intuition suggests that because a model sees far more samples of the majority class during training, it must learn high-quality, discriminative visual features for that class.

However, verifying what a binary classifier actually "looks at" has historically been difficult. Standard explainability techniques like Class Activation Mapping (CAM) were engineered for categorical multi-class classifiers with SoftMax outputs. In a single-output binary classifier (where a logit $z$ is thresholded at zero), standard CAM only explains why an image is predicted as the positive class, leaving researchers unable to visualize what drives negative predictions.

Methods

  1. Extending CAM to Single-Output Binary Classifiers:
    Standard gradient CAM aggregates gradients of a class score with respect to feature maps. The authors adapt this for binary models by using the magnitude of the logit $|z|$: $$\alpha_k = \sum_{(i,j)} \frac{\partial |z|}{\partial f_k(i, j)} = \sum_{(i,j)} \begin{cases} \frac{\partial z}{\partial f_k(i, j)} & \text{if } z > 0 \\ \frac{\partial (-z)}{\partial f_k(i, j)} & \text{otherwise} \end{cases}$$ When the model predicts the negative class ($z < 0$), gradients push in the direction that makes the prediction more negative. This modification works across multiple CAM variants (Grad-CAM, Grad-CAM++, HiResCAM, Element-wise Grad-CAM).

  2. Model Training & Comparison:
    The authors evaluate two ResNet-50 multi-attribute models predicting 40 attributes concurrently:

  3. AFFACT-u: An unbalanced baseline trained with standard Euclidean loss.

  4. AFFACT-b: A balanced network using Mixed Objective Optimization (MOON), which applies class-frequency inverse weights $w_m(t)$ directly to the loss.
  5. Quantitative Saliency Evaluation:
    To evaluate heatmap fidelity beyond visual inspection, the authors measure Proportional Energy ($E$)—the proportion of CAM activation energy that falls inside predefined anatomical ground-truth bounding masks for each attribute.

Datasets

  • CelebA: A benchmark containing over 200,000 celebrity face images annotated with 40 binary facial attributes ranging from balanced (e.g., Attractive at 51% positive) to heavily skewed (e.g., Bald at 2% positive).
  • Frontal Test Subset: From the 19,962 CelebA test images, the authors filtered a subset of 10,458 frontal faces using facial landmark geometry. This eliminates head-pose variability so that activation heatmaps can be cleanly averaged across thousands of test subjects.

Key Insights and Ideas

  • High Accuracy $\neq$ Meaningful Features:
    The unbalanced classifier (AFFACT-u) achieved exceptionally low False Positive Rates on rare attributes, but CAM heatmaps revealed it learned no facial features for the majority class. Instead, heatmaps either showed zero activation (relying purely on the scalar bias neuron $b$) or targeted the extreme corners of the image.

  • Image Corners as "Surrogate" Bias Neurons:
    Because background image corners contain no facial information, the network learned to use corner activations as pseudo-bias units to artificially drive predictions toward the majority class.

  • Multi-Task Bleed-Through:
    Because all 40 attributes were trained jointly on a shared feature backbone, corner activations learned from rare attributes bled into balanced attributes like Attractive and Wearing Lipstick.

  • The Minority Paradox:
    Even when AFFACT-u performed worse than random guessing on minority classes (e.g., False Negative Rate of 65.1% on Big Lips), its visualizations localized accurately on the relevant facial regions. The minority class is what actually forces feature extractors to learn semantic landmarks.

Key Results

  • Classification Error vs. Imbalance:
    On Bald ($p_m = 0.023$), the unbalanced AFFACT-u achieves a low False Positive Rate of 0.5% on the majority class but an error of 19.1% on the minority class. Balancing the loss (AFFACT-b) levels error rates to 3.2% FPR and 2.5% FNR.

  • Proportional Energy Collapse:
    For AFFACT-u, whenever attribute imbalance exceeded 60/40, majority class proportional energy plummeted. For Bald, the majority class proportional energy under Grad-CAM was 0.001 (virtually no relevant facial activation) compared to 0.744 for the minority class.

  • Restoring Attention with AFFACT-b:
    Re-balancing raised the majority class proportional energy for Bald from 0.001 to 0.431, completely eliminating corner activations.

  • CAM Technique Differences:
    HiResCAM and Element-wise Grad-CAM yielded consistently clearer, higher proportional energy scores on negative classes than standard Grad-CAM and Grad-CAM++.

Limitations and Future Work

  • Scope of Architectures & Losses: Experiments were restricted to ResNet-50 and Euclidean loss. The effects on binary cross-entropy, Focal Loss, and vision transformers remain to be validated.
  • CAM Compatibility: The binary $|z|$ formulation applies strictly to gradient-based CAM variants. Non-gradient approaches (like Score-CAM) and select gradient variants (like XGrad-CAM) cannot yet use this formulation directly.
  • Mask Approximations: Proportional energy depends on heuristically defined geometric masks, meaning absolute metric values cannot be directly compared across different attributes.

Summary updated

Abstract

To visualize the regions of interest that classifiers base their decisions on, different Class Activation Mapping (CAM) methods have been developed. However, all of these techniques target categorical classifiers only, though most real-world tasks are binary classification. In this paper, we extend gradient-based CAM techniques to work with binary classifiers and visualize the active regions for binary attribute classifiers. When training an unbalanced binary classifier on a biased dataset, it is well-known that the majority class is mostly predicted much better than minority class. In our experiments on the CelebA dataset, we verify these results, when training an unbalanced classifier to extract 40 facial attributes simultaneously. One would expect that the biased classifier has learned to extract features mainly for the majority classes and that the proportional energy of the activations mainly reside in certain specific regions of the image where the attribute is located. However, we find very little regular activation for samples of majority classes, while the active regions for minority classes seem mostly reasonable and overlap with our expectations. These results suggest that biased classifiers only rely on bias activation for majority classes. When training a balanced classifier on the unbalanced data by employing attribute-specific class weights, positive and negative classes are classified similarly well and show expected activations for almost all attributes.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
CelebA · Chubby (p_m=0.058AFFACT-b + HiResCAMProportional Energy (Pos)0.967Visual Explanation · attribute=Chubby · classifier=class-balanced · class-prevalence=0.058 · explanation-method=HiResCAM
Source quote
L571: HiResCAM │ 0.993 │ 0.688 │ 0.967 │ 0.951 \\*
CelebA · Chubby (p_m=0.058AFFACT-b + HiResCAMProportional Energy (Neg)0.951+0.17 vs baselineVisual Explanation · attribute=Chubby · classifier=class-balanced · class-prevalence=0.058 · explanation-method=HiResCAM
Source quote
L571: HiResCAM │ 0.993 │ 0.688 │ 0.967 │ 0.951 \\*
CelebA · Attractive (p_m=0.514AFFACT-b + HiResCAMProportional Energy (Neg)0.916+0.13 vs baselineVisual Explanation · attribute=Attractive · classifier=class-balanced · class-prevalence=0.514 · explanation-method=HiResCAM
Source quote
L416: HiResCAM │ 0.977 │ 0.784 │ 0.966 │ 0.916 \\*
Reported baseline / comparator measurements (3)
BenchmarkMethodMetricScoreProtocol / Evidence
CelebA · Chubby (p_m=0.058AFFACT-u + HiResCAM baselineProportional Energy (Pos)0.993Visual Explanation · attribute=Chubby · classifier=unbalanced · class-prevalence=0.058 · explanation-method=HiResCAM
Source quote
L571: HiResCAM │ 0.993 │ 0.688 │ 0.967 │ 0.951 \\*
CelebA · Chubby (p_m=0.058AFFACT-u + HiResCAM baselineProportional Energy (Neg)0.688Visual Explanation · attribute=Chubby · classifier=unbalanced · class-prevalence=0.058 · explanation-method=HiResCAM
Source quote
L571: HiResCAM │ 0.993 │ 0.688 │ 0.967 │ 0.951 \\*
CelebA · Attractive (p_m=0.514AFFACT-u + HiResCAM baselineProportional Energy (Neg)0.784Visual Explanation · attribute=Attractive · classifier=unbalanced · class-prevalence=0.514 · explanation-method=HiResCAM
Source quote
L416: HiResCAM │ 0.977 │ 0.784 │ 0.966 │ 0.916 \\*
BibTeX
@inproceedings{zhang2024biased,
  author = {Xinyi Zhang and Johanna Sophie Bieri and Manuel Günther},
  title = {{Biased Binary Attribute Classifiers Ignore the Majority Classes}},
  booktitle = {Sds},
  year = {2024},
  doi = {10.1109/sds60720.2024.00035},
}
Figure