The implementation of Grad-CAM for 1d data.
Original implementation in Keras : https://github.com/vense/keras-grad-cam
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)
The vector of heatmap value (same shape as data_vector)