keras-explain
keras-explain copied to clipboard
FailedPreconditionError
Loading model image and using any of the methods returns FailedPreconditionError
.
FailedPreconditionError: 2 root error(s) found.
(0) Failed precondition: Error while reading resource variable block5_conv1_2/kernel from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/block5_conv1_2/kernel)
[[{{node model_2/block5_conv1/Conv2D/ReadVariableOp}}]]
[[gradients/model_2/block1_conv1/Conv2D_grad/Conv2DBackpropInput/_11]]
(1) Failed precondition: Error while reading resource variable block5_conv1_2/kernel from Container: localhost. This could mean that the variable was uninitialized. Not found: Container localhost does not exist. (Could not find resource: localhost/block5_conv1_2/kernel)
[[{{node model_2/block5_conv1/Conv2D/ReadVariableOp}}]]
My code:
model = load_model(os.getcwd() + "/models/saved_models_for_fusion/0_FusionVGGMnistToPS.h5")
img_path = str(Path(os.getcwd() + "/models/scripts/xxx.jpg"))
img = load_img(img_path)
explainer = Saliency(model, layer=3)
exp = explainer.explain(img, 0)
I think that the resolution can be found here: https://github.com/tensorflow/tensorflow/issues/28287#issuecomment-495005162 is it possible to check whether this can fix this issue? It seems that loading model and using model.predict() fails due to not thread-safe operations.
Thanks