Skip to content

agis09/grad_cam_1d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

1D-Grad-CAM

The implementation of Grad-CAM for 1d data.

Original implementation in Keras : https://github.com/vense/keras-grad-cam

Usage

import numpy as np
from keras.models import Model
from grad_cam import grad_cam

pred = model.predict(data_vector)
category_index = np.argmax(pred)
for layer in model.layers:
    if 'conv1d' in layer.name:
        conv_name = layer.name
heatmap = grad_cam(model, data_vector, category_index, conv_name, nb_classes)

Arguments

  • data_vector : Input data (1D)
  • category_index : the index of predicted category
  • conv_name : the last convolutional layer of your model
  • nb_classes : the number of categories

Output

The vector of heatmap value (same shape as data_vector)

About

The implementation of Grad-CAM for 1d data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages