Abstract
Class Activation Mapping (CAM) is a pivotal technique for interpreting Convolutional Neural Networks (CNNs). However, existing CAM variants are often "one-size-fits-all" and may not align with specific domain requirements. We present SyCAM, a framework that leverages Syntax-Guided Synthesis (SyGuS) to automatically discover optimal CAM formulas tailored to specific datasets and evaluation metrics. By searching a grammar of mathematical operations and feature map weights, SyCAM identifies custom explainability expressions that outperform traditional methods like GradCAM and ScoreCAM across diverse domains, including medical imaging.
Introduction
Class Activation Mapping (CAM) has become the standard for visualizing the internal decision-making of CNNs. By generating heatmaps that highlight influential pixels, CAM methods allow researchers to verify if a model is focusing on relevant features (e.g., identifying a dog by its ears). Over the years, numerous variants like GradCAM, GradCAM++, and ScoreCAM have been proposed, each employing a different heuristic to weight feature maps.
The primary limitation of these methods is their rigid nature. A formula optimized for general object detection in ImageNet may perform poorly in specialized fields like radiology. Currently, practitioners must manually select a method, with no systematic way to optimize the explainability formula for a specific dataset or goal, such as matching a human expert's ground truth. SyCAM addresses this by treating the creation of CAM methods as a search problem.
Methodology
SyCAM treats the generation of a CAM method as a Syntax-Guided Synthesis (SyGuS) problem. The framework consists of four core components:
- The Grammar: A defined "language" of CAM expressions including building blocks like gradients, activation scores, and mathematical operators (addition, multiplication, ReLU, and top-n filtering).
- Oracle-Guided Inductive Synthesis (OGIS): A search strategy that starts with simple expressions and iteratively builds complexity to find the formula that maximizes a chosen evaluation metric.
- Oracles: To ensure efficiency, SyCAM uses an Equivalence Oracle to prune redundant formulas that produce identical heatmaps and a Correctness Oracle to validate candidates against performance thresholds.
- Class-based Decomposition: The system can synthesize unique formulas for different classes, recognizing that the logic for explaining a "Springer Spaniel" may differ from that of a "Chain Saw."
Experiments and Datasets
The researchers evaluated SyCAM across three distinct domains to test its versatility:
- PASCAL VOC 2007: Used for initial sanity checks and grammar validation.
- Imagenette: A 10-class subset of ImageNet used for benchmarking against standard CAM variants.
- COVID-QU-Ex: A specialized dataset of chest X-rays with expert-annotated infection masks, used to evaluate SyCAM's ability to incorporate expert knowledge by optimizing for ground-truth similarity.
Key Results
SyCAM consistently outperformed traditional methods in both quantitative and qualitative assessments. In head-to-head tests on ResNet50 and VGG models, SyCAM discovered expressions that surpassed GradCAM, ScoreCAM, and AblationCAM on standard metrics like "Deletion" and "Insertion."
Notably, on the COVID-19 dataset, SyCAM synthesized expressions that were significantly more concentrated on actual infected regions compared to standard methods, which often highlighted irrelevant areas outside the lungs. For the mGT metric (similarity to ground truth), SyCAM achieved a score of 0.1972, outperforming the next best method, AblationCAM (0.1876).
Discussion and Conclusion
The core insight of SyCAM is that explainability should be treated as a search problem rather than a design problem. By defining a grammar, the authors demonstrate that existing methods like GradCAM++ are merely specific points in a vast space of possible explanations. SyCAM allows users to bake their "intent" into the process by selecting the optimization metric, whether it be robustness or medical accuracy.
While the computational cost of searching millions of formulas is high (taking up to 24 hours in some experiments), it represents a one-time offline cost. Future work may explore multi-objective optimization to balance multiple goals, such as robustness and ground-truth alignment, simultaneously.
Summary updated