PyTorch Grad-CAM
General Information
| Field | Value |
|---|---|
| Package Name | grad-cam (pytorch-grad-cam) |
| Manufacturer / Vendor | Jacob Gildenblat and contributors |
| Software Category | Library |
| Primary Documentation | Documentation, GitHub |
| Programming Language(s) | Python |
| License | MIT License |
| Deployed Version(s) | >=1.5.0 |
| Most Recent Available Version | 1.5.5 |
| Last Review Date | 2026-01-26 |
Overview
grad-cam (pytorch-grad-cam) is a Python library that provides state-of-the-art methods for Explainable AI (XAI) in computer vision applications. It implements various Class Activation Mapping (CAM) techniques that generate visual explanations of deep learning model predictions by highlighting the image regions that most influenced the model's decision.
Within the medical device software, this library is used exclusively in the Clinical Condition Classifier module to generate saliency maps that explain why the AI model predicts specific skin conditions. This explainability capability is essential for:
- Regulatory compliance: Meeting requirements for AI/ML transparency in medical devices
- Clinical trust: Enabling clinicians to understand and validate AI predictions
- Quality assurance: Supporting verification that the model focuses on clinically relevant image features
The library was selected for its comprehensive support of multiple CAM methods, compatibility with various neural network architectures (including those used in the device), active maintenance, and permissive MIT licensing suitable for commercial medical device software.
Functional Requirements
The following functional capabilities of this SOUP are relied upon by the medical device software.
| Requirement ID | Description | Source / Reference |
|---|---|---|
| FR-001 | Compute GradCAM++ activation maps for classification models | GradCAMPlusPlus class |
| FR-002 | Generate overlay visualizations combining heatmaps with original images | show_cam_on_image() function |
| FR-003 | Support target-specific explanations for multi-class classifiers | ClassifierOutputTarget class |
| FR-004 | Automatic target layer detection for common neural network architectures | Built-in layer detection |
Performance Requirements
The following performance expectations are relevant to the medical device software.
| Requirement ID | Description | Acceptance Criteria |
|---|---|---|
| PR-001 | Saliency map computation shall complete within acceptable inference latency | Computation completes within the overall API timeout |
| PR-002 | Memory usage shall not cause GPU out-of-memory errors during normal operation | Single-image processing without batch accumulation |
Hardware Requirements
The following hardware dependencies or constraints are imposed by this SOUP component.
| Requirement ID | Description | Notes / Limitations |
|---|---|---|
| HR-001 | CUDA-compatible GPU recommended for optimal performance | CPU execution supported but slower |
| HR-002 | Sufficient GPU memory for model + gradient computation | Memory requirements scale with model size and input resolution |
Software Requirements
The following software dependencies and environmental assumptions are required by this SOUP component.
| Requirement ID | Description | Dependency / Version Constraints |
|---|---|---|
| SR-001 | Python runtime environment | Python >=3.8 |
| SR-002 | PyTorch deep learning framework | Compatible with torch >=2.0.0 |
| SR-003 | NumPy for array operations | Required by pytorch-grad-cam |
| SR-004 | OpenCV for image processing (overlay generation) | cv2 module |
| SR-005 | torchvision for image transformations | Compatible versions with torch |
Known Anomalies Assessment
This section evaluates publicly reported issues, defects, or security vulnerabilities associated with this SOUP component and their relevance to the medical device software.
| Anomaly Reference | Status | Applicable | Rationale | Reviewed At |
|---|---|---|---|---|
| PyTorch CVE-2025-32434 (torch.load RCE) | Fixed | No | The device does not use torch.load() with untrusted model files; all models are pre-deployed | 2026-01-26 |
| PyTorch CVE-2025-2953 (DoS) | Open | No | Affects mkldnn_max_pool2d function not used by grad-cam or the device's explainability pipeline | 2026-01-26 |
No security vulnerabilities have been reported directly against the pytorch-grad-cam library itself. According to Snyk's security analysis, the package has been scanned and deemed safe to use. The library does not maintain a formal security policy (no SECURITY.md file), which is common for academic/research-originated open-source projects.
The vulnerabilities documented above are framework-level issues in PyTorch rather than in pytorch-grad-cam specifically. CVE-2025-32434 (critical RCE via torch.load()) was fixed in PyTorch 2.6.0; the device mitigates this by using only pre-deployed, trusted model files. CVE-2025-2953 affects a pooling function not utilized in the explainability pipeline.
Functional issues reported in the pytorch-grad-cam GitHub issue tracker include edge cases with two-class classifiers, 3D CNN shape mismatches, and specific architecture compatibility (CLIP, Swin Transformer). These do not affect the device's use case, which employs standard CNN architectures with multi-class classification using the GradCAM++ method.
Risk Control Measures
The following risk control measures are implemented to mitigate potential security and operational risks associated with this SOUP component:
- GPU memory management guards prevent resource exhaustion during saliency map computation
- Only trusted, internally validated data is processed through the explainability pipeline
- The explainability module is isolated from external inputs
- Version locking ensures reproducible deployments with known-stable versions
- All models are pre-deployed and verified; no external model loading occurs
Assessment Methodology
The following methodology was used to identify and assess known anomalies:
- Sources consulted: National Vulnerability Database (NVD), GitHub Security Advisories, PyPI security reports, and the pytorch-grad-cam GitHub repository issue tracker
- Criteria for determining applicability: Vulnerabilities were assessed based on whether the affected functionality is used by the device, whether the attack vector is reachable in the deployment environment, and whether mitigating controls exist
Signature meaning
The signatures for the approval process of this document can be found in the verified commits at the repository for the QMS. As a reference, the team members who are expected to participate in this document and their roles in the approval process, as defined in Annex I Responsibility Matrix of the GP-001, are:
- Author: Team members involved
- Reviewer: JD-003, JD-004
- Approver: JD-001