Skip to content

GradCAM++ implementation for SegFormer (Landsat dataset)#5

Open
samrat-rm wants to merge 7 commits intoOrion-AI-Lab:mainfrom
samrat-rm:feat/explainability_grad_cam
Open

GradCAM++ implementation for SegFormer (Landsat dataset)#5
samrat-rm wants to merge 7 commits intoOrion-AI-Lab:mainfrom
samrat-rm:feat/explainability_grad_cam

Conversation

@samrat-rm
Copy link
Copy Markdown

@samrat-rm samrat-rm commented Mar 15, 2026

This PR introduces a prototype implementation of GradCAM++ for model explainability.

The current implementation is limited to the Landsat dataset and the SegFormer model. It generates activation maps for a specified target class and compares them with selected Landsat bands to analyze how the model attends to different inputs.

Current Implementation :

  • GradCAM++ is applied to the SegFormer model trained on the Landsat dataset.
  • Activation maps are generated for a specified target class.
  • The number of batches processed is controlled through the saved_models_run.json configuration.
  • The generated heatmap is compared with three fixed bands:
    • cloudy_Radiance_B10_B11_mean
    • clear_Radiance_B10_B11_mean
    • dem
  • Results are visualized as a 2×2 grid:
    • GradCAM++ heatmap
    • Each of the selected bands
  • The grid images are saved to the configured output directory.

Pictures :
image
image

Limitations:

  • Development and testing were performed using a subset of the Landsat test dataset (100–500 images).
  • Because of this, the evaluation metrics do not match the metrics reported in results.csv, which were computed on the full dataset.
  • The limited dataset size may also affect the quality and reliability of the activation maps.

Next Step :

-After reviewing the GradCAM++ implementation:

  • Run experiments on the full Landsat test dataset.
  • Recompute metrics and compare results withresults.csv.
  • Improve the explainability pipeline and visualization outputs.

Discussion / Help Needed

  • Issue link: Contains questions and discussions related to the GradCAM++ implementation and design decisions.




AI Disclosure:

  • ChatGPT was used to review portions of the code, spell-check, and improve wording in PR and issue descriptions.
  • AI was also used to help write some function descriptions and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant