Abstract
Prediction consistency is widely used to assess image classifier robustness under input transformations. When predicted labels remain unchanged, the spatial evidence supporting them can still shift. We propose the Harmonic Robustness-based Class Activation Metric (H-RCAM) to quantify such shifts under controlled background replacement. H-RCAM takes the harmonic mean of Jensen–Shannon divergence and normalized correlation distance between attribution maps generated using gradient-weighted class activation mapping (Grad-CAM) for each source image and its background-replaced counterpart. We used ResNet-18 for the primary evaluation and DenseNet-121 for supplementary experiments. We used two development datasets to select H-RCAM’s components and fusion rule. In exploratory comparisons on these datasets, H-RCAM assigned higher scores to prediction-inconsistent pairs and achieved areas under the receiver operating characteristic curve (AUROCs) of 0.8953 and 0.8066. H-RCAM retained discrimination on four independent datasets without recalibration (AUROC 0.7808–0.8739). H-RCAM also distinguished degrees of attribution change among prediction-consistent pairs and retained discrimination under photographic background replacement on the two development datasets. A sensitivity analysis on the development datasets showed that H-RCAM’s advantage over its individual components depended on whether Grad-CAM explained each image’s predicted class or the ground-truth class for both images. H-RCAM thus complements prediction consistency when evaluating classifier robustness to background changes.