Skip to content

Conversation

@richardson-souza
Copy link

when the flask server tries to process the prediction the errors happen:
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("activation 5/Sigmoid:0", shape=(?, 1), dtype=float32) is not an element of this graph.
to get around the bug a global variable graph was created.
global model, graph
model = ResNet50(weights="imagenet")
graph = tf.get_default_graph()
And with default graph predictions were made:
with graph.as_default():
preds = model.predict(image)

when the flask server tries to process the prediction the errors happen:
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("activation 5/Sigmoid:0", shape=(?, 1), dtype=float32) is not an element of this graph.
to get around the bug a global variable graph was created.
global model, graph
	model = ResNet50(weights="imagenet")
	graph = tf.get_default_graph()
And with default graph predictions were made:
with graph.as_default():
        preds = model.predict(image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant