raghakot / keras-vis

Neural network visualization toolkit for keras
https://raghakot.github.io/keras-vis
MIT License
2.98k stars 664 forks source link

Issue - "ImportError: cannot import name '_Conv' from 'keras.layers.convolutional'" #230

Closed mukund0911 closed 4 years ago

mukund0911 commented 4 years ago

I having this issue - "ImportError: cannot import name '_Conv' from 'keras.layers.convolutional'" I have the latest version TensorFlow and Keras-vis. Below is the code,

import os import cv2 import numpy as np import pandas as pd import matplotlib.pyplot as plt

import tensorflow as tf import keras from keras import activations from keras.models import load_model

from vis.visualization import visualize_cam, overlay from vis.utils import utils import matplotlib.cm as cm visualization = visualize_cam(model, layer_index, filter_indices=input_class, seed_input=input_image) axes[0].imshow(input_image.squeeze(), cmap='gray') axes[0].set_title('Input') axes[1].imshow(visualization) axes[1].set_title('Grad-CAM') heatmap = np.uint8(cm.jet(visualization)[..., :3] 255) original = np.uint8(cm.gray(input_image.squeeze())[..., :3] 255) axes[2].imshow(overlay(heatmap, original)) axes[2].set_title('Overlay') fig.suptitle(f'Image Class = {CATEGORIES[input_class]}') plt.show()

I have attached the screenshot of the error. error

Can anyone please help me?

yguan1 commented 4 years ago

Hi, I'm having the same issue. Did you solve this problem?

mukund0911 commented 4 years ago

I have installed CUDA drivers. Then it worked. Don't know how they are related but it worked.