Faithful CAM evaluation, a ground-truth benchmark, and high-resolution attribution maps.
RefineCAM produces fine-grained attribution maps by combining information across multiple network layers.
This work addresses two complementary problems in the evaluation and refinement of Class Attribution Maps (CAMs):
- RefineCAM combines CAMs across multiple network layers to produce higher-resolution and better-focused attribution maps.
- ARCC is a composite metric designed for more reliable evaluation of CAM explanations.
- Synthetic CAM Benchmark provides ground-truth attributions for systematically evaluating explanation metrics.
Implementations of both RefineCAM and ARCC are integrated into the widely used pytorch-grad-cam library.
pip install grad-camRefineCAM can be imported directly with:
from pytorch_grad_cam import RefineCAMARCC is available as an evaluation metric:
from pytorch_grad_cam.metrics.ARCC import ARCCFor the maintained implementation and usage documentation, see pytorch-grad-cam.
from pytorch_grad_cam import GradCAMPlusPlus, RefineCAM
from pytorch_grad_cam.metrics.arcc import ARCC
# Load model and input image
model = ...
input_tensor = ...
target = ...
# Standard CAM
gradcam = GradCAMPlusPlus(
model=model,
target_layers=[model.layer4[-1]],
)
gradcam_result = gradcam(input_tensor, targets=target)
# RefineCAM combines CAMs from multiple layers
refinecam = RefineCAM(
model=model,
target_layers=[
model.layer1[-1],
model.layer2[-1],
model.layer3[-1],
model.layer4[-1],
],
)
refinecam_result = refinecam(input_tensor, targets=target)
# Evaluate both explanations with ARCC
gradcam_score = ARCC(base_method=gradcam)(
input_tensor, gradcam_result, targets=target, model=model
)
refinecam_score = ARCC(base_method=refinecam)(
input_tensor, refinecam_result, targets=target, model=model
)See example.py for a complete runnable example with ResNet18, image loading, visualization, and ARCC evaluation. Running example.py will produce this:
How to Evaluate and Refine Your CAM
Luca Domeniconi, Alessandra Stramiglio, Michele Lombardi, Samuele Salti
Project Website · arXiv · PDF · pytorch-grad-cam
If you use RefineCAM, ARCC, or the synthetic benchmark, please cite:
@inproceedings{domeniconi2026evaluate,
title={How to Evaluate and Refine your CAM},
author={Domeniconi, Luca and Stramiglio, Alessandra and Lombardi, Michele and Salti, Samuele},
booktitle={International Conference on Pattern Recognition},
pages={543--557},
year={2026},
organization={Springer}
}

