簡體   English   中英

導出和使用 TensorFlow model 的最有效和/或最簡單的方法是什么

[英]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運行它並預測一個小范圍的值,我將如何 go 這樣做? 我試圖查看 SavedModel 的東西,但我不確定在導出 model 后如何實現它。

使用日志保存很容易,檢查點格式可以直接保存和恢復,但需要通過目標負載 model 來指定模型。 用簡單的方法做,以后不會頭疼。

: 打回來

cp_callback = tf.keras.callbacks.ModelCheckpoint(checkpoint_path, monitor='val_loss', verbose=0, save_best_only=True, mode='min')

:加載權重

if exists(checkpoint_path): model_highscores.load_weights(checkpoint_path) print("model load:" + checkpoint_path) input("Press Any Key!")

: 用法

預測 = model_highscores.predict(img_array)

從內部屏幕范圍預測 來自外部輸入的預測 語言的可能性 再次通過語言的可能性

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM