MuhammadLab
Computer VisionBrowser-basedTensorFlow.jsMobileNetExplainability heatmapStudent lab

Grad-CAM / Explainable Vision Demo

Upload an image, classify it with MobileNet, and inspect an explainability heatmap that highlights which visual regions mattered most for the prediction.

This page uses TensorFlow.js with MobileNet for browser-based image classification, then builds an occlusion sensitivity heatmap as a practical explainability approximation. It teaches that a model responds to visual evidence in the image rather than human-like understanding.

What this demo teaches

Explainable vision asks which visual regions mattered most for a model prediction. Instead of treating the prediction as magic, students can inspect which patches changed the confidence the most.

How this heatmap works

This page uses MobileNet for classification and an occlusion-based sensitivity map for explanation. Small patches of the image are hidden one at a time, and the model is asked whether confidence drops.

Why this matters

The model does not understand an image the way a person does. It responds to visual patterns such as textures, edges, colors, and shapes. The heatmap helps students see that difference directly.

Model: Loading TensorFlow.js and MobileNet...
Image: No image selected yet
Note: Upload an image to run classification and the explainability heatmap.
Loading MobileNet...

Prediction

Upload an image to see MobileNet predictions.

Run the demo to see how MobileNet interprets the uploaded image.

Top Predictions

Prediction bars appear after classification.

Heatmap Reading

Hotter patches mean the prediction confidence dropped more when that region was hidden. In other words, the model relied more on that visual evidence.

Cooler patches mean hiding that area changed the prediction less, so the model treated that region as less important for the chosen class.

Teaching Notes

  • This is an explainability approximation, not a human explanation of meaning.
  • The heatmap reflects which visual regions changed the model score, not what the model “thought about” conceptually.
  • Some important patches may be textures, edges, or background cues the model learned during training.
  • That is exactly why explainability matters: it helps students question whether the model is using the right evidence.