本文簡要介紹如何在pytorch中安裝引入tensorboardX,具體如何在代碼中使用以后有機會再更新
首先肯定是需要安裝tensorboardX,這個包使得我們可以在Pytorch中可視化訓練過程,方便調參
(base) ~>pip install tensorboardx Collecting tensorboardx Downloading tensorboardX-2.0-py2.py3-none-any.whl (195 kB) |████████████████████████████████| 195 kB 11 kB/s Requirement already satisfied: numpy in c:\anaconda3\lib\site-packages (from tensorboardx) (1.18.1) Collecting protobuf>=3.8.0 Downloading protobuf-3.11.3-cp36-cp36m-win_amd64.whl (1.1 MB) |████████████████████████████████| 1.1 MB 5.1 kB/s Requirement already satisfied: six in c:\anaconda3\lib\site-packages (from tensorboardx) (1.11.0) Requirement already satisfied: setuptools in c:\anaconda3\lib\site-packages (from protobuf>=3.8.0->tensorboardx) (38.4.0) Installing collected packages: protobuf, tensorboardx Successfully installed protobuf-3.11.3 tensorboardx-2.0
在很多網上資料中都有安裝tensorflow這一步,實際上想在PyTorch中使用tensorboardX只需要安裝tensroboard即可
pip install tensorboard
使用 tensorboard --help查看可以使用的命令參數,如果返回:'tensorboard' 不是內部或外部命令,也不是可運行的程序,說明系統變量沒設置好。
在訓練輸出日志后,cmd進入日志所在文件夾,運行命令:tensorboard --logdir=“日志所在文件夾”即可得到一個偽網址,(類似:http://localhost:6006/)
在瀏覽器中打開網址即可看見可視化日志