-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_yolo.py
66 lines (41 loc) · 1.3 KB
/
plot_yolo.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
######################################
# Plotting of the learning rate for yolo
######################################
###python plot_yolo.py C:\darknet\build\darknet\x64\temp.log 0
import argparse
import sys
import matplotlib.pyplot as plt
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument(
"log_file",
help = "path to log file"
)
parser.add_argument(
"option",
help = "0 -> loss vs iter"
)
args = parser.parse_args()
f = open(args.log_file)
lines = [line.rstrip("\n") for line in f.readlines()]
# skip the first 3 lines
lines = lines[3:]
numbers = {'1','2','3','4','5','6','7','8','9','0'}
iters = []
loss = []
for line in lines:
if line[0] in numbers:
args = line.split(" ")
args_length = len(args)
if (args_length ==1):continue
print(len(args))
iters.append(int(args[0][:-1]))
loss.append(float(args[2]))
#plt.plot(iters[:70],loss[:70])
plt.plot(iters,loss)
plt.xlabel('iters')
plt.ylabel('loss')
plt.grid()
plt.show()
if __name__ == "__main__":
main(sys.argv)