All Projects β†’ ramprs β†’ Grad Cam

ramprs / Grad Cam

[ICCV 2017] Torch code for Grad-CAM

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Grad Cam

Cnn Interpretability
πŸ₯ Visualizing Convolutional Networks for MRI-based Diagnosis of Alzheimer’s Disease
Stars: ✭ 68 (-92.37%)
Mutual labels:  convolutional-neural-networks, interpretability
Switchable Normalization
Code for Switchable Normalization from "Differentiable Learning-to-Normalize via Switchable Normalization", https://arxiv.org/abs/1806.10779
Stars: ✭ 804 (-9.76%)
Mutual labels:  convolutional-neural-networks
Dl 4 Tsc
Deep Learning for Time Series Classification
Stars: ✭ 730 (-18.07%)
Mutual labels:  convolutional-neural-networks
Emotion Recognition Neural Networks
Emotion recognition using DNN with tensorflow
Stars: ✭ 769 (-13.69%)
Mutual labels:  convolutional-neural-networks
Sudoku
Can Neural Networks Crack Sudoku?
Stars: ✭ 742 (-16.72%)
Mutual labels:  convolutional-neural-networks
Tf Explain
Interpretability Methods for tf.keras models with Tensorflow 2.x
Stars: ✭ 780 (-12.46%)
Mutual labels:  interpretability
Addernet
Code for paper " AdderNet: Do We Really Need Multiplications in Deep Learning?"
Stars: ✭ 722 (-18.97%)
Mutual labels:  convolutional-neural-networks
Noise2noise
An unofficial and partial Keras implementation of "Noise2Noise: Learning Image Restoration without Clean Data"
Stars: ✭ 821 (-7.86%)
Mutual labels:  convolutional-neural-networks
Dalex
moDel Agnostic Language for Exploration and eXplanation
Stars: ✭ 795 (-10.77%)
Mutual labels:  interpretability
Tf cnnvis
CNN visualization tool in TensorFlow
Stars: ✭ 769 (-13.69%)
Mutual labels:  convolutional-neural-networks
Sincnet
SincNet is a neural architecture for efficiently processing raw audio samples.
Stars: ✭ 764 (-14.25%)
Mutual labels:  convolutional-neural-networks
Tensorflow Tutorial
TensorFlow and Deep Learning Tutorials
Stars: ✭ 748 (-16.05%)
Mutual labels:  convolutional-neural-networks
Poseestimationformobile
πŸ’ƒ Real-time single person pose estimation for Android and iOS.
Stars: ✭ 783 (-12.12%)
Mutual labels:  convolutional-neural-networks
Neurec
Next RecSys Library
Stars: ✭ 731 (-17.96%)
Mutual labels:  convolutional-neural-networks
Deepmedic
Efficient Multi-Scale 3D Convolutional Neural Network for Segmentation of 3D Medical Scans
Stars: ✭ 809 (-9.2%)
Mutual labels:  convolutional-neural-networks
Pyheatmagic
IPython magic command to profile and view your python code as a heat map.
Stars: ✭ 728 (-18.29%)
Mutual labels:  heatmap
Machine Learning Curriculum
πŸ’» Make machines learn so that you don't have to struggle to program them; The ultimate list
Stars: ✭ 761 (-14.59%)
Mutual labels:  convolutional-neural-networks
Pytorch Bayesiancnn
Bayesian Convolutional Neural Network with Variational Inference based on Bayes by Backprop in PyTorch.
Stars: ✭ 779 (-12.57%)
Mutual labels:  convolutional-neural-networks
Skin Cancer Image Classification
Skin cancer classification using Inceptionv3
Stars: ✭ 16 (-98.2%)
Mutual labels:  convolutional-neural-networks
Xnnpack
High-efficiency floating-point neural network inference operators for mobile, server, and Web
Stars: ✭ 808 (-9.32%)
Mutual labels:  convolutional-neural-networks

Grad-CAM: Gradient-weighted Class Activation Mapping

Code for the paper

Grad-CAM: Why did you say that? Visual Explanations from Deep Networks via Gradient-based Localization
Ramprasaath R. Selvaraju, Abhishek Das, Ramakrishna Vedantam, Michael Cogswell, Devi Parikh, Dhruv Batra
https://arxiv.org/abs/1610.02391

Demo: gradcam.cloudcv.org

Overview

Usage

Download Caffe model(s) and prototxt for VGG-16/VGG-19/AlexNet using sh models/download_models.sh.

Classification

th classification.lua -input_image_path images/cat_dog.jpg -label 243 -gpuid 0
th classification.lua -input_image_path images/cat_dog.jpg -label 283 -gpuid 0
Options
  • proto_file: Path to the deploy.prototxt file for the CNN Caffe model. Default is models/VGG_ILSVRC_16_layers_deploy.prototxt
  • model_file: Path to the .caffemodel file for the CNN Caffe model. Default is models/VGG_ILSVRC_16_layers.caffemodel
  • input_image_path: Path to the input image. Default is images/cat_dog.jpg
  • input_sz: Input image size. Default is 224 (Change to 227 if using AlexNet)
  • layer_name: Layer to use for Grad-CAM. Default is relu5_3 (use relu5_4 for VGG-19 and relu5 for AlexNet)
  • label: Class label to generate grad-CAM for (-1 = use predicted class, 283 = Tiger cat, 243 = Boxer). Default is -1. These correspond to ILSVRC synset IDs
  • out_path: Path to save images in. Default is output/
  • gpuid: 0-indexed id of GPU to use. Default is -1 = CPU
  • backend: Backend to use with loadcaffe. Default is nn
  • save_as_heatmap: Whether to save heatmap or raw Grad-CAM. 1 = save heatmap, 0 = save raw Grad-CAM. Default is 1
Examples

'border collie' (233)

'tabby cat' (282)

'boxer' (243)

'tiger cat' (283)

Visual Question Answering

Clone the VQA (http://arxiv.org/abs/1505.00468) sub-repository (git submodule init && git submodule update), and download and unzip the provided extracted features and pretrained model.

th visual_question_answering.lua -input_image_path images/cat_dog.jpg -question 'What animal?' -answer 'dog' -gpuid 0
th visual_question_answering.lua -input_image_path images/cat_dog.jpg -question 'What animal?' -answer 'cat' -gpuid 0

Options
  • proto_file: Path to the deploy.prototxt file for the CNN Caffe model. Default is models/VGG_ILSVRC_19_layers_deploy.prototxt
  • model_file: Path to the .caffemodel file for the CNN Caffe model. Default is models/VGG_ILSVRC_19_layers.caffemodel
  • input_image_path: Path to the input image. Default is images/cat_dog.jpg
  • input_sz: Input image size. Default is 224 (Change to 227 if using AlexNet)
  • layer_name: Layer to use for Grad-CAM. Default is relu5_4 (use relu5_3 for VGG-16 and relu5 for AlexNet)
  • question: Input question. Default is What animal?
  • answer: Optional answer (For eg. "cat") to generate Grad-CAM for ('' = use predicted answer). Default is ''
  • out_path: Path to save images in. Default is output/
  • model_path: Path to VQA model checkpoint. Default is VQA_LSTM_CNN/lstm.t7
  • gpuid: 0-indexed id of GPU to use. Default is -1 = CPU
  • backend: Backend to use with loadcaffe. Default is cudnn
  • save_as_heatmap: Whether to save heatmap or raw Grad-CAM. 1 = save heatmap, 0 = save raw Grad-CAM. Default is 1
Examples

What animal? Dog

What animal? Cat

What color is the fire hydrant? Green

What color is the fire hydrant? Yellow

What color is the fire hydrant? Green and Yellow

What color is the fire hydrant? Red and Yellow

Image Captioning

Clone the neuraltalk2 sub-repository. Running sh models/download_models.sh will download the pretrained model and place it in the neuraltalk2 folder.

Change lines 2-4 of neuraltalk2/misc/LanguageModel.lua to the following:

local utils = require 'neuraltalk2.misc.utils'
local net_utils = require 'neuraltalk2.misc.net_utils'
local LSTM = require 'neuraltalk2.misc.LSTM'
th captioning.lua -input_image_path images/cat_dog.jpg -caption 'a dog and cat posing for a picture' -gpuid 0
th captioning.lua -input_image_path images/cat_dog.jpg -caption '' -gpuid 0

Options
  • input_image_path: Path to the input image. Default is images/cat_dog.jpg
  • input_sz: Input image size. Default is 224 (Change to 227 if using AlexNet)
  • layer: Layer to use for Grad-CAM. Default is 30 (relu5_3 for vgg16)
  • caption: Optional input caption. No input will use the generated caption as default
  • out_path: Path to save images in. Default is output/
  • model_path: Path to captioning model checkpoint. Default is neuraltalk2/model_id1-501-1448236541.t7
  • gpuid: 0-indexed id of GPU to use. Default is -1 = CPU
  • backend: Backend to use with loadcaffe. Default is cudnn
  • save_as_heatmap: Whether to save heatmap or raw Grad-CAM. 1 = save heatmap, 0 = save raw Grad-CAM. Default is 1
Examples

a dog and cat posing for a picture

a bathroom with a toilet and a sink

License

BSD

3rd-party

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].