When doing experiments, it is usually necessary to compare and analyze the training loss of different models. tensorboard usually draws different losses on different graphs. If we like to draw the training losses of different models on the same graph for comparison and analysis , How should we deal with it?
It can be operated through the matplotlib module.
1. Download the data of the loss curve in Tensorboard (the download method is shown in the figure)
2. use the matplotlib module to draw pictures
import csv
import matplotlib.pyplot as plt
import pandas as pd
df1 = pd.read_csv('/home/azhihong/JL-DCF-pytorch/log/run16-07/07-16-training loss.csv') # Path of csv file
step1 = df1['Step'].values.tolist()
loss1 = df1['Value'].values.tolist()
df2 = pd.read_csv('/home/azhihong/JL-DCF-pytorch/log/run17-08/08-17-training loss.csv')
step2 = df2['Step'].values.tolist()
loss2 = df2['Value'].values.tolist()
plt.plot(step1, loss1, label='JL_DCF')
plt.plot(step2, loss2, label='Ours')
plt.legend(fontsize=16) # Legend size
plt.show()