Open jawoods opened 5 years ago
Hi, @jawoods. Thank you for your report and I'm sorry to be late response despite you emailed me.
I am not sure about the first problem (i.e., tensorflow.python.framework.errors_impl.FailedPreconditionError
).
I have been never facing the Error.
Sorry that I can't help you.
I will able to help with the second problem (i.e.,
ValueError
).Will you please to try to modify layer_idx
variable from 0
to len(model.layers)
.
visualize_cam
does not support layer_idx < 0
when penultimate_layer_idx is None
.It seems a bug. We will improve to support it.
( MODIFIED on 29 Jan 2019 )
Thanks!
@jawoods, I'm sorry, I misunderstood.
Perhaps, Is your model cascading?
That is, it include the code such as model.add(other_model)
.
Could you please past the result of model.summary()
here?
For the FailedPreconditionError
, I figured out it was because the model I trained with was using keras
whilst for using keras-vis I was using tensorflow.keras
. Removing tensorflow.
in the import solved the issue.
Hi, I am trying to use a 3d cnn in keras for classification and I am trying to visualize my network. Here is my network:
My model consists of 5 3d conv layers, each followed by batch normalization and max pooling. These are followed by flattening, two fully connected layers each followed by batch normalization and finally an output layer with softmax. The model is working and has been trained.
This is my code for visualization:
for i in range(0, len(x_valid)): cam = vz.visualize_cam(model=model, filter_indices=np.argmax(model.predict(x_valid[i:i+1]), axis=1), layer_idx=-1, seed_input=x_valid[i:i+1], penultimate_layer_idx=-2 )
However, this produces the following error: tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable batch_normalization_6/beta from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/batch_normalization_6/beta) [[{{node batch_normalization_6/batchnorm/ReadVariableOp}} = ReadVariableOpdtype=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]
I also tried running the same without a specified penultimate layer, however that resulted in the following error:
ValueError: Unable to determine penultimate
Conv
orPooling
layer for layer_idx: -1Any help would be appreciated, thanks.