Closed lorenzocesconetto closed 2 years ago
Hi, i had the same error recently and figured out, that innvestigate doesn't support tf.keras (as far as i know). So you might need to recreate the model in keras: https://github.com/albermax/innvestigate/issues/175 and https://github.com/albermax/innvestigate/issues/159
can somebody please help .. I am still getting a similar error after installing innvestigate and trying to import the library .
I am using tensorflow 2.10.1
Error
ImportError: cannot import name 'Node' from 'keras.engine.base_layer' (/opt/conda/lib/python3.7/site-packages/keras/engine/base_layer.py)
Hi @ambitiousrahul, it looks like you're using an outdated version of iNNvestigate, which isn't compatible with TF2. Please update iNNvestigate to the latest version:
pip install innvestigate==2.0.1
I'm closing this issue as it most likely isn't relevant for iNNvestigate 2.0 anymore. Please open a new issue in case the problem persists.
I've been getting the error below, and I just can't get around it. This is my code:
import tensorflow from tensorflow.keras.models import load_model import innvestigate from vis.visualization import visualize_activation from vis.utils import utils
mobile_net = load_model('/mobile_net_v1.h5', compile=False)
img_1 = plt.imread('my_img.jpg')
img_1_array = np.expand_dims(img_1, axis=0) analyzer = innvestigate.create_analyzer("gradient", mobile_net)
Doesn't work either way below
analysis = analyzer.analyze(img_1_array) analysis = analyzer.analyze(img_1)
tensorflow.version
2.0.0
innvestigate.version
1.0.8
Error output
AttributeError Traceback (most recent call last)