Deep-Viz is an interactive web application that makes AI interpretability accessible to everyone! Ever wondered what a neural network "sees" when it looks at an image? This tool pulls back the curtain on deep learning models, revealing the hidden patterns and decision-making processes that drive AI predictions.
- Class Activation Maps (CAM) using SmoothGradCAM++ ๐จ
- Integrated Gradients for pixel-level feature attribution ๐
- Real-time visualization of model predictions ๐
- Multi-model support (ResNet18 & ResNet50) โ๏ธ
- Drag-and-drop image upload ๐ค
- Layer-wise exploration of neural network activations ๐ฌ
- Top-5 predictions with confidence scores ๐
- Side-by-side comparison of different visualization techniques ๐
graph TD
A[๐ท Upload Image] --> B[๐ Preprocessing]
B --> C[๐ค ResNet Model]
C --> D[๐ Predictions]
C --> E[๐จ SmoothGradCAM++]
C --> F[๐ Integrated Gradients]
D --> G[๐ Top-5 Results]
E --> H[๐บ๏ธ Class Activation Map]
F --> I[โก Attribution Heatmap]
G --> J[๐ฑ Interactive Dashboard]
H --> J
I --> J
style A fill:#ff6b6b
style C fill:#4ecdc4
style J fill:#45b7d1
Make sure you have Python 3.7+ installed on your system.
- Clone the repository
git clone https://github.com/nevrohelios/deep-viz.git
cd deep-viz- Install dependencies
pip install -r requirements.txt- Launch the application
streamlit run main.py- Open your browser and navigate to
http://localhost:8501๐
CAMs highlight the regions in an image that are most important for the model's prediction. Think of it as the model's "attention map" - where is it looking when making decisions?
๐ผ๏ธ Original Image โ ๐ฅ Heat Map โ ๐ฏ Important Regions
This technique provides pixel-level attributions, showing how much each pixel contributes to the final prediction. It's like having X-ray vision into the model's decision process!
๐ Pixel Analysis โ ๐ Attribution Scores โ ๐จ Visualization
| Component | Purpose | Technology |
|---|---|---|
| ๐จ Frontend | Interactive UI | Streamlit |
| ๐ค Model Backend | Deep Learning | PyTorch + TorchVision |
| ๐ Interpretability | CAM Generation | TorchCAM |
| โก Attribution | Gradient Analysis | Captum |
| ๐ผ๏ธ Image Processing | Preprocessing | PIL + Transforms |
Input Image (224ร224ร3)
โ
ResNet18/50 Backbone
โ
Feature Extraction
โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโ
โ CAM Extraction โ Gradient Flow โ
โ (TorchCAM) โ (Captum) โ
โโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโ
โ
Visualization Pipeline
โ
Interactive Dashboard
Upload a photo of your pet and see which features the model uses to identify the animal!
Try landscape photos to understand how the model recognizes different environments.
Upload images with vehicles to see how the model focuses on distinctive features.
Explore different layers of the neural network to understand how features evolve from simple edges to complex patterns:
- Early Layers: Edge detection, basic shapes ๐
- Middle Layers: Textures, patterns ๐
- Deep Layers: Complex objects, semantic features ๐๏ธ
Switch between ResNet18 and ResNet50 to see how model depth affects interpretation:
| Model | Parameters | Speed | Accuracy |
|---|---|---|---|
| ResNet18 | 11.7M | โก Fast | ๐ฏ Good |
| ResNet50 | 25.6M | ๐ Slower | ๐ฏ Better |
- Clean, intuitive interface designed for both beginners and experts
- Real-time processing with smooth animations
- High-quality visualizations that reveal model insights
- Perfect for students learning about AI interpretability
- Demonstrates cutting-edge explainable AI techniques
- Bridges the gap between theory and practice
- Robust error handling and user feedback
- Optimized for performance
- Extensible architecture for adding new models
# Core ML Framework
torch # PyTorch deep learning framework
torchvision # Computer vision utilities
torchcam # Class Activation Mapping
# Interpretability
captum # Model interpretability library
# Web Framework
streamlit # Interactive web applications
# Image Processing
pillow # Python Imaging Library
numpy # Numerical computing
matplotlib # Plotting library- ๐ฏ More Models: Add support for Vision Transformers, EfficientNet
- ๐จ Advanced Visualizations: GradCAM, LIME, SHAP
- ๐ฑ Mobile Support: Responsive design for mobile devices
- ๐ API Integration: REST API for programmatic access
- ๐ฅ Video Analysis: Extend to video classification
- ๐ Multi-language: Support for multiple languages
We welcome contributions! Whether it's:
- ๐ Bug fixes
- โจ New features
- ๐ Documentation improvements
- ๐จ UI/UX enhancements
Please feel free to open issues and pull requests!
This project is licensed under the MIT License - see the LICENSE file for details.
- PyTorch Team for the amazing deep learning framework ๐ฅ
- Streamlit for making web apps incredibly simple ๐
- Captum for state-of-the-art interpretability tools ๐
- TorchCAM for excellent CAM implementations ๐จ
Made with โค๏ธ and lots of โ
Star โญ this repo if you found it helpful!