Improving Context-Shift Robustness of Convolutional Networks via Context-Regularized Cross-Entropy
Abstract
Image classification models often encounter objects in diverse and unpredictable contexts at test time, which may differ substantially from those seen during training. This phenomenon, termed context shift, exposes a key fragility in neural networks: when models rely on non-causal contextual cues for prediction, shifts in context can lead to significant performance degradation. In this paper, we propose a novel training framework to improve the robustness of convolutional neural networks under context shift. Our approach leverages spatial feature attribution to guide models toward making predictions that rely less on contextual regions and more on object-relevant features. As a first step, recognizing a theoretical limitation of existing feature attribution methods we introduce a new variant, ContrastiveCAMs, which produces more faithful attribution maps of model predictions. Building on ContrastiveCAMs, we further propose Context-Regularized Cross-Entropy (CR-CE), a modification of the standard cross-entropy loss that regularizes the model's attention by suppressing the influence of contextual regions, thereby improving robustness to context shift. We evaluate the effectiveness of our approach on several medium-to-large scale datasets (Waterbirds, Spawrious, ImageNet/ImageNet-BG, Hard-ImageNet), and report consistent improvements in context-shift robustness.
Create a lesson
Metadata
- Categories
- cs.CV, cs.LG
- Journal
- NeurIPS 2026
- Comments
- accepted to NeurIPS 2026
Related papers
Contrastive fine-tuning against stain and scanner bias improves robustness and downstream performance across pathology foundation models
Shared title terminologycs.CVRyan Kim, Hassan Muhammad, Anish Dulal et al.
Graded convolutional networks: scale invariance without the scale and robustness to unknown blur
Shared title terminologycs.CVTanush Shaska
STAGE: Structured Test-Time Adaptation with Global Entropic Soft-coupling for Cross-Subject Brain-to-Image Retrieval
Shared title terminologycs.CVYihang Zou, Ruixi Liang, Chunmei Qing et al.
CAR: Reducing Decoder Output Shift in Visual Token Pruning via Coverage Selection and Attention Reallocation
Shared title terminologycs.CVXixi Jiang, Pingcheng Dong, Chen Yang et al.
RSWP: Robust SO(3)-Equivariant Watermarking for Panoramic Images
Shared title terminologycs.CVPengzhen Chen, Yanwei Liu, Xiaoyan Gu et al.
Beyond Attention Maps: Understanding and Improving Medical MLLMs via Visual Values
Shared title terminologycs.CVYichen Zhao, Fenghe Tang, Wenxin Ma et al.