Semi-supervised Image Classification with Grad-CAM Consistency

Juyong Lee, Seunghyuk ChoarXiv 2021

Abstract

Consistency training, which exploits both supervised and unsupervised learning with different augmentations on image, is an effective method of utilizing unlabeled data in semi-supervised learning (SSL) manner. Here, we present another version of the method with Grad-CAM consistency loss, so it can be utilized in training model with better generalization and adjustability. We show that our method improved the baseline ResNet model with at most 1.44 % and 0.31 $\pm$ 0.59 %p accuracy improvement on average with CIFAR-10 dataset. We conducted ablation study comparing to using only psuedo-label for consistency training. Also, we argue that our method can adjust in different environments when targeted to different units in the model.

Introduction

Semi-supervised learning (SSL) aims to leverage a small amount of labeled data alongside a large pool of unlabeled data. A prevalent strategy is consistency training, which encourages the model to produce invariant predictions for an image under various perturbations. However, standard consistency training typically focuses only on the final output label. This approach risks ignoring the model's internal reasoning; a model might predict the same class for two versions of an image while focusing on entirely different features. This paper addresses the need for "explanation-level" consistency to ensure robust feature representation.

Methods

The proposed method introduces a Grad-CAM consistency loss ($L_G$) into the standard SSL pipeline. Grad-CAM (Gradient-weighted Class Activation Mapping) is utilized during training to generate saliency maps that highlight influential image regions for a given prediction.

Overview of the Grad-CAM consistency training framework, showing the processing paths for labeled and unlabeled data.

For an unlabeled image and its augmented counterpart, the model computes Grad-CAM maps for the predicted class. The $L_G$ loss is defined as the squared difference between these maps. This approach allows for "Layer Adjustability," as Grad-CAM can be applied to any convolutional layer. The authors experimented with targeting different blocks of a ResNet50, finding that later layers (e.g., Layer 3) often provide a better global guide for the model than early layers focused on local textures. The total objective function is a weighted sum of supervised cross-entropy loss, pseudo-label consistency loss, and the new Grad-CAM consistency loss.

Results and Discussion

The method was evaluated on the CIFAR-10 dataset using a ResNet50 architecture with 5,000 labeled images and varying ratios of unlabeled data.

Performance Gains

The Grad-CAM consistency method improved the baseline ResNet50 model by up to 1.44% in specific configurations, with an average improvement of 0.31 ± 0.59 %p. Ablation studies confirmed that including Grad-CAM consistency consistently outperformed models using only standard pseudo-label consistency. For instance, at an unlabeled data ratio of 2.0, the proposed method achieved 90.99% accuracy compared to 90.56% for the ablation baseline.

Qualitative Analysis

Qualitative results demonstrate that training with Grad-CAM consistency leads to sharper and more aligned attention maps between original and augmented images compared to the initial state.

Qualitative comparison of Grad-CAM maps before and after training, illustrating improved alignment between original and augmented images.

The authors suggest that this consistency acts as a form of "weakly-supervised semantic segmentation," teaching the model to focus on relevant objects without explicit segmentation masks. The performance gap between the baseline and the proposed method widened as more unlabeled data was introduced, indicating strong scalability.

Conclusion

This work demonstrates that enforcing explanation-level consistency via Grad-CAM significantly enhances semi-supervised learning performance. While the method introduces some computational overhead due to gradient calculations during training, it offers a tunable mechanism for improving model generalization. Future work will explore more diverse datasets and alternative loss functions to further refine the synergy between pseudo-labeling and saliency-based consistency.

Summary updated

BibTeX
@misc{lee2021semi,
  author = {Juyong Lee and Seunghyuk Cho},
  title = {{Semi-supervised Image Classification with Grad-CAM Consistency}},
  year = {2021},
  eprint = {2108.13673},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.13673},
}
Figure