Hi everyone:)
I'm trying to use keras_explain in colab for my 3dcnn network
the visualization method I want is LRP
but I'm ending up "AttributeError: 'Tensor' object has no attribute 'output'" error
I really do need to solve this problem
my imports are like this:
import tensorflow
import keras
from keras import layers
and also I have to use tensorflow 1 because with tensorflow 2 I'm getting another error
so the versions are:
tensorflow 1.15.2
keras 2.1.6 (it's the version that installed by keras_explain)
I also have keras-vis-0.5.0
this is the model I have:
def get_model(width=80, height=80, depth=80):
"""Build a 3D convolutional neural network model."""
inputs = keras.Input((width, height, depth, 1))
x = (inputs)
x = layers.Conv3D(filters=8, kernel_size=5, activation="relu", padding="same")(x)
x = layers.MaxPool3D(pool_size=2)(x)
x = layers.BatchNormalization()(x)
x = layers.Conv3D(filters=16, kernel_size=3, activation="relu", padding="same")(x)
x = layers.MaxPool3D(pool_size=2)(x)
x = layers.BatchNormalization()(x)
x = layers.Conv3D(filters=32, kernel_size=3, activation="relu", padding="same")(x)
x = layers.MaxPool3D(pool_size=2)(x)
x = layers.BatchNormalization()(x)
x = layers.Flatten()(x)
x = layers.Dense(units=512, activation="sigmoid")(x)
x = layers.Dropout(0.05)(x)
outputs = layers.Dense(units=1, activation="sigmoid")(x)
# Define the model.
model = keras.Model(inputs, outputs, name="3dcnn")
return model
this is the error I get:
AttributeError Traceback (most recent call last)
in ()
----> 1 exp = explainer.explain(img, 0)
1 frames
/usr/local/lib/python3.6/dist-packages/keras_explain/lrp.py in explain(self, image, target_class)
31
32 # retrieve outputs of all layers
---> 33 outputs = self.get_layers_outputs(model, image)
34
35 relevances = {} # key: layer name, value: relevance of input tensor
/usr/local/lib/python3.6/dist-packages/keras_explain/lrp.py in get_layers_outputs(self, model, input)
130 #s_recon_layer = Lambda(lambda x: K.squeeze(x, 2))(recon_layer)
131
--> 132 out_fun = K.function([model.layers[0].input], [layer.output])
133 layer_output = out_fun([input[None, ...]])[0]
134 activations[layer.name] = layer_output
AttributeError: 'Tensor' object has no attribute 'output'
Hi everyone:) I'm trying to use keras_explain in colab for my 3dcnn network the visualization method I want is LRP but I'm ending up "AttributeError: 'Tensor' object has no attribute 'output'" error I really do need to solve this problem
my imports are like this: import tensorflow import keras from keras import layers
and also I have to use tensorflow 1 because with tensorflow 2 I'm getting another error so the versions are: tensorflow 1.15.2 keras 2.1.6 (it's the version that installed by keras_explain) I also have keras-vis-0.5.0
this is the model I have:
this is the error I get:
AttributeError Traceback (most recent call last)