Skip to content

hiteshK03/gradcamplusplus-cats-v-dogs

Repository files navigation

GradCam & GradCam++ Keras

Table of Contents

Overview

This is the Keras implementation of GradCam & GradCam++ for explainability of Deep Learning model applied to the kaggle playground competition Dogs vs. Cats Redux: Kernels Edition

Grad-CAM++: Generalized Gradient-based Visual Explanations for Deep Convolutional Networks(https://arxiv.org/abs/1710.11063) by Aditya Chattopadhyay, Anirban Sarkar, Prantik Howlader, Vineeth N Balasubramanian

cat55 cat152 dog196 dog333

Installation

Some of the important dependencies required are:

  • python 3.5
  • tensorflow
  • Keras
  • numpy
  • pandas
  • matplotlib
  • CUDA (for using GPU)

Dataset

The original dataset can be downloaded from the kaggle competitions page.
After downloading it can be extracted at the current directory (same as that of the zip file downloaded above) by running:

python3 create_data.py

The structure of the working directory is shown below:

.
├── cats-v-dogs
│   ├── testing
│   │   └── test [12500 entries]
│   ├── train
│   │   ├── cats [11250 entries]
│   │   └── dogs [11250 entries]
│   └── validation
│       ├── cats [1250 entries]
│       └── dogs [1250 entries]
├── create_data.py
├── dogs-vs-cats-redux-kernels-edition.zip
└── sample_submission.csv

(or) For using with Google Colab the you can simply use the zipped working directory from here
For using this data, refer jupyter notebook

Usage

For directly viewing the GradCam visualisations with the already pretrained model (can be downloaded from this link), simply run python3 apply_gradcam.py -i <input-image-path> -m <pre-trained-model>

To train and test the model, simply run python3 train.py.
Once trained, you can view the gradcam visualisations with your trained model by running python3 apply_gradcam.py -i <input-image-path> -m <saved-model>

(or) Simply run the jupyter notebook file in google colab.

Credits

Grad-Cam codes for keras were adopted from https://github.com/totti0223/gradcamplusplus

About

Keras implementation of GradCam & GradCam++ to Dogs vs. Cats classification model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published