undefined

最近使用 Keras 進行深度學習的模型訓練,所以需要將訓練好的模型進行紀錄並且讀取出後使用,所以紀錄一下過程;

在使用前請先安裝 h5py 套件到 Python中。

接下來在訓練完畢模型後,只要呼叫:

model.save("filePath+fileName.h5")

就可以記錄模型了~

 

讀取模型則是使用:

from keras.models import load_model
from keras.models import Sequential
model = Sequential()
model = load_model("filePath+fileName.h5")

然後就可以進行預測。

 

[Reference]

https://keras.io/getting-started/faq/#how-can-i-save-a-keras-model

arrow
arrow
    全站熱搜

    葛瑞斯肯 發表在 痞客邦 留言(0) 人氣()