I trained a tensorflow model that i\'d like to run predictions on from numpy arrays. This is for image processing within videos. I will pass the images to the model as they happ
Your code creates a scope which is exited after it leaves init.
def __init__(self):
with tf.Session(graph=tf.Graph()) as self.sess:
tf.saved_model.loader.load(self.sess[tf.saved_model.tag_constants.SERVING], "model")
The following should work for you if you have everything else working properly.
def __init__(self):
self.sess=tf.Session(graph=tf.Graph())
tf.saved_model.loader.load(self.sess[tf.saved_model.tag_constants.SERVING], "model")
When I do something like this I also usually create the option of passing the session to the class by a parameter, then when I call the class I pass in a session create by with