How to keep tensorflow session open between predictions? Loading from SavedModel

后端 未结 3 797
庸人自扰
庸人自扰 2021-02-05 18:00

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

3条回答
  •  我寻月下人不归
    2021-02-05 18:18

    Your code does not work because in your init function you open the session and close it. So there is no session after init finishes.

    If you want to make many predictions after your model has been trained, I recommend you not to reinvent the wheel and use the tool, TF developers created for this reason: TF serving.

    TensorFlow Serving is a flexible, high-performance serving system for machine learning models, designed for production environments. TensorFlow Serving makes it easy to deploy new algorithms and experiments, while keeping the same server architecture and APIs. TensorFlow Serving provides out-of-the-box integration with TensorFlow models, but can be easily extended to serve other types of models and data

    They have a lot of tutorials starting from the very basic ones and spending a day on learning a few things will save you months later.

提交回复
热议问题