finer-cam

This is an official implementation for Finer-CAM: Spotting the Difference Reveals Finer Details for Visual Explanation. [CVPR'25]

https://github.com/imageomics/finer-cam

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
    Organization imageomics has institutional domain (imageomics.osu.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary

Keywords

class-activation-maps computer-vision explainable-ai fine-grained-classification saliency-maps vision-transformers visualizations xai
Last synced: 4 months ago · JSON representation ·

Repository

This is an official implementation for Finer-CAM: Spotting the Difference Reveals Finer Details for Visual Explanation. [CVPR'25]

Basic Info
  • Host: GitHub
  • Owner: Imageomics
  • License: apache-2.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 5.52 MB
Statistics
  • Stars: 31
  • Watchers: 3
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Topics
class-activation-maps computer-vision explainable-ai fine-grained-classification saliency-maps vision-transformers visualizations xai
Created 12 months ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

Finer-CAM : Spotting the Difference Reveals Finer Details for Visual Explanation [CVPR 2025]

Official implementation of "Finer-CAM [arxiv]".

CAM methods highlight image regions influencing predictions but often struggle in fine-grained tasks due to shared feature activation across similar classes. We propose Finer-CAM, which explicitly compares the target class with similar ones, suppressing shared features and emphasizing unique, discriminative details.

Finer-CAM retains CAM’s efficiency, offers precise localization, and adapts to multi-modal zero-shot models, accurately activating object parts or attributes. It enhances explainability in fine-grained tasks without increasing complexity.

images

Update

2025.3.13: Merged into jacobgil/pytorch-grad-cam, a wonderful library that supports multiple CAM-based methods.

Demo

Experience the power of Finer-CAM with our interactive demos! Witness accurate localization of discriminative features.

  • Try the multi-modal demo and see how Finer-CAM activates detailed and relevant regions for diverse concepts: Open In Colab
  • Test the classifier demo to explore class-specific activation maps with enhanced explainability: Open In Colab

Reqirements

pip install grad-cam

Preparing Datasets

Stanford Cars

  1. Download the dataset using the following command:

```bash curl -L -o datasets/stanford_cars.zip \ https://www.kaggle.com/api/v1/datasets/download/cyizhuo/stanford-cars-by-classes-folder

  1. Unzip the downloaded file ```bash unzip datasets/stanford_cars.zip -d datasets/

  2. The structure of datasets/should be organized as follows:

datasets/ ├── train/ │ ├── Acura Integra Type R 2001/ │ │ ├── 000405.jpg │ │ ├── 000406.jpg │ │ └── ... │ ├── Acura RL Sedan 2012/ │ │ ├── 000090.jpg │ │ ├── 000091.jpg │ │ └── ... │ └── ... └── test/ ├── Acura Integra Type R 2001/ │ ├── 000450.jpg │ ├── 000451.jpg │ └── ... ├── Acura RL Sedan 2012/ │ ├── 000122.jpg

Usage

Step 1. Generate CAMs for Validation Set

Run the Script:

  • Execute the generate_cams.py script with the appropriate arguments using the following command: bash python generate_cams.py \ --classifier_path <path_to_classifier_weight> \ --dataset_path <path_to_dataset_or_image_list> \ --save_path <path_to_save_results>

Step 2. Visualize Results

Run the Script:

  • Execute the visualize.py script with the appropriate arguments using the following command: bash python visualize.py --dataset_path <path_to_dataset_directory> \ --cams_path <path_to_cams_directory> \ --save_path <path_to_save_visualizations>

Acknowledgement

We utilized code from:

Thanks for their wonderful works.

Citation Paper

If you find this repository useful, please consider citing our work :pencil: and giving a star :star2: : @article{zhang2025finer, title={Finer-CAM: Fine-grained Visual Interpretability through Class-Specific Gradient Refinements}, author={Ziheng Zhang and Jianyang Gu and Arpita Chowdhury and Zheda Mai and David Carlyn and Tanya Berger-Wolf and Yu Su and Wei-Lun Chao}, journal={arXiv preprint arXiv:2501.11309}, year={2025}, }

Owner

  • Name: Imageomics Institute
  • Login: Imageomics
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: >-
  Finer-CAM : Spotting the Difference
  Reveals Finer Details for Visual Explanation
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Ziheng
    family-names: Zhang
  - given-names: Jianyang
    family-names: Gu
  - given-names: Arpita
    family-names: Chowdhury
  - given-names: Zheda
    family-names: Mai
  - given-names: David
    family-names: Carlyn
  - given-names: Tanya
    family-names: Berger-Wolf
  - given-names: Yu
    family-names: Su
  - given-names: Wei-Lun
    family-names: Chao
identifiers:
  - type: doi
    value: 10.48550/arXiv.2501.11309
repository-code: 'https://github.com/Imageomics/Finer-CAM'
keywords:
  - explainable-ai
  - imageomics
  - fine-grained-classification
  - computer-vision
license: Apache-2.0
commit: Finer-CAM
version: 1.0.0
date-released: '2025-02-25'

GitHub Events

Total
  • Watch event: 37
  • Member event: 1
  • Push event: 17
  • Fork event: 3
  • Create event: 2
Last Year
  • Watch event: 37
  • Member event: 1
  • Push event: 17
  • Fork event: 3
  • Create event: 2