Table of contents
1. Training to form a log file
3. Access TensorBoard in AutoPanel
1. Training to form a log file
example:
from torch.utils.tensorboard import SummaryWriter
import numpy as np
writer = SummaryWriter()
for x in range(1, 101) :
writer.add_scalar('y = 2x', x, 2 * x)
writer.close()
#单条曲线(scalar)
#add_scalar(tag, scalar_value, global_step=None, walltime=None)
#参数:
#tag ( string ) – 数据标识符
#scalar_value ( float或string/blobname ) – 要保存的值
#global_step ( int ) – 要记录的全局步长值
#walltime ( float ) – 记录训练的时间,默认 walltime (time.time()) 秒
2. Switch the logs directory
1. First end the Tensorboard process started by default and execute the command:
ps -ef | grep tensorboard | awk '{print $2}' | xargs kill -9
2. Execute the following command in the terminal to start TensorBoard
Officially, the event file of tensorboard needs to be saved to the /root/tf-logs/ path. If you don’t want to switch the save path, you only need to change the execution command.
/root/tf-logs/path
tensorboard --port 6007 --logdir tf-logs
other paths
tensorboard --port 6007 --logdir path/to/your/tf-logs/direction
#path/to/your/tf-logs/direction为你的logs文件前的路径,不需要带logs的文件名