'What's the most efficient and/or easy way of exporting and using a TensorFlow model

Ive created a time series forecasting model (RNN) which is heavily based off this tutorial, If I wanted to export this model and use it with, say, a kivy UI in python, where I feed it some new data every time the program is run and it predicts a small range of values, how would I go about doing that? I tried to look into the SavedModel stuff but im not sure how to implement the model after exporting it.



Solution 1:[1]

It is easy you saved using the log, checkpoint format where you can save and restore directly but the models you need to be specific by target load model. Do it the easy way you will not headaches later.

# Callback
cp_callback = tf.keras.callbacks.ModelCheckpoint(checkpoint_path, monitor='val_loss', 
                            verbose=0, save_best_only=True, mode='min' ) 
tb_callback = tf.keras.callbacks.TensorBoard(log_dir, update_freq=15)
 
# Loads the weights
if exists(checkpoint_path) :
   model_highscores.load_weights(checkpoint_path)
   print("model load: " + checkpoint_path)
   input("Press Any Key!")

# Usage
predictions = model_highscores.predict(img_array)

Prediction from inside screens scopes Prediction from input external Possiblities by language Posibilities by language again

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 George