keras可視化模型訓練過程

來源:互聯網
上載者:User

keras在搭建神經網路模型以及訓練神經網路方面,簡單又好用,總結幾個keras的API使用,持續更新。當然也可以通過keras官網進行學習。https://keras.io/ 模型可視化

將模型結構圖儲存為圖片。

from keras.utils import plot_modelplot_model(model, to_file='model.png')

plot_model接收兩個選擇性參數:

show_shapes:指定是否顯示輸出資料的形狀,預設為Falseshow_layer_names:指定是否顯示層名稱,預設為True
訓練過程可視化
history = model.fit(Xtr_more, Ytr_more, batch_size=batch_size, epochs=50, verbose=1, callbacks=[earlyStopping, mcp_save, reduce_lr_loss], validation_split=0.25)print(history.history.keys())fig = plt.figure()plt.plot(history.history['acc'])plt.plot(history.history['val_acc'])plt.title('model accuracy')plt.ylabel('accuracy')plt.xlabel('epoch')plt.legend(['train', 'test'], loc='upper left')plt.plot(history.history['loss'])plt.plot(history.history['val_loss'])plt.title('model loss')plt.ylabel('loss')plt.xlabel('epoch')plt.legend(['train', 'test'], loc='lower left')#fig.savefig('performance.png')

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.