[The log file is converted into a file used by tensorboard]

Today, I want to see how the various losses recorded in the log file have changed, but I am worried that there are some characters in it (as shown in the figure below). He wanted to use tensorboard for visualization~
So, we wrote a simple code to realize this function~


This is what it looks like in the log file~
insert image description here
Before looking at the code, let's talk about the code logic first! (Learn logic to change it, smirk ~)

In fact, it is to read the log file line by line, then convert str into a dictionary, then take the value, and finally perform add_add_scalar operation through SummaryWriter. (It's that simple~~)

Above code:::

import json
from  tensorboardX import SummaryWriter
from torch.utils.tensorboard import SummaryWriter


if __name__ == <

Guess you like

Origin blog.csdn.net/vibration_xu/article/details/126393721