agis09 / grad_cam_1d

The implementation of Grad-CAM for 1d data.
MIT License
7 stars 3 forks source link

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