forked from Oleffa/LeagueAI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_loss.py
More file actions
34 lines (27 loc) · 676 Bytes
/
plot_loss.py
File metadata and controls
34 lines (27 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This script is used to plot the loss during training with darknet
import matplotlib.pyplot as plt
import numpy as np
logfile_path = "weights/05_02_synthetic_LeagueAI/train.log"
with open(logfile_path, 'r') as f:
data=[]
for l in f:
if "avg" in l:
data.append(l)
avg1 = []
avg2 = []
for i in data:
i = i.replace(",", "")
s = i.split(" ")
avg1.append(float(s[1]))
avg2.append(float(s[2]))
print(avg1)
x = np.arange(len(avg1))
fig = plt.figure()
a = plt.plot(x, avg1, color='r')
plt.title('Average Loss')
plt.xlabel('Episodes (batch size = 64)')
plt.ylabel('Loss')
plt.xlim([0,40000])
plt.ylim([0, 300])
plt.grid()
plt.show()