前言
今天基於tensorflow訓練一個檢測模型,本應看到訓練曲線的,卻只見到一個文件events.out.tfevents.1570520647.hostname,后來發現這個文件可以查看訓練曲線的一些信息。
問題1:如何基於events.out.tfevents.1570520647.hostname查看信息;
在終端使用以下命令即可
tensorboard --logdir=/home/username/xx/events_dir
可以查看tensorboard可使用的命令,此處logdir是evens文件所在的目錄。
輸出:
TensorBoard 1.14.0 at http://hostname:6006/ (Press CTRL+C to quit)
注意,
1)執行命令的同時需要在有tensorboard環境下才能運行,或者tensorflow環境;
2) 在瀏覽器打開網址
http://hostname:6006/
此處hostname對應的是host所在的IP地址,即假如host的IP為192.168.10.22,則打開的網址為
http://192.168.10.22:6006/
3) 文件所在目錄一定要正確,否則會出錯;
4) 網址的打開過程可能會比較慢,有點耐心;
另,該文件的生成代碼:
writer_train=tf.summary.FileWriter('events_path',sess.graph)
其中,logdir
指向 FileWriter
將數據序列化的目錄。如果此 logdir
目錄下有子目錄,而子目錄包含基於各個運行的序列化數據,則 TensorBoard 會將所有這些運行涉及的數據都可視化,也可以進行選擇。
問題2:No dashboards are active for the current data set;
No dashboards are active for the current data set. Probable causes: You haven’t written any data to your event files. TensorBoard can’t find your event files. If you’re new to using TensorBoard, and want to find out how to add data and set up your event files, check out the README and perhaps the TensorBoard tutorial. If you think TensorBoard is configured properly, please see the section of the README devoted to missing data problems and consider filing an issue on GitHub. Last reload: Wed Oct 09 2019 15:19:01 GMT+0800 (China Standard Time) Data location: version_1_0
這個問題可能是命令行有誤,查看命令行運行環境、指向目錄、網址等問題。
問題3. 如何保存tensorboard上的可視化文件
可以直接下載保存SVG文件,也可以下載CSV或者JSON,其中,CSV和JSON可以根據數據編寫腳本畫圖保存,CSV文件也可以直接在excel中生成圖表。
參考
完