raghakot/keras-vis

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

mukund0911 opened this issue · 2 comments

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?

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

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