-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
executable file
·41 lines (32 loc) · 1.21 KB
/
plot.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
#!/usr/bin/python3
import matplotlib.pyplot as plt
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-a', '--anime', action='store_true', help='anime model')
parser.add_argument('-n', '--names', action='store_true', help='names model')
args = parser.parse_args()
if args.anime:
with open("data/anime/loss.txt", "r") as file:
numbers = [float(line.strip()) for line in file]
with open("data/anime/step.txt", "r") as file:
step = [float(line.strip()) for line in file]
# Create the plot
plt.plot(step, numbers)
plt.xlabel( "Number of steps", fontsize=14)
plt.ylabel("Loss value", fontsize=14)
# Display the plot
plt.savefig('data/anime/plot.png', format='png')
plt.show()
else:
with open("data/names/loss.txt", "r") as file:
numbers = [float(line.strip()) for line in file]
with open("data/names/step.txt", "r") as file:
step = [float(line.strip()) for line in file]
# Create the plot
plt.plot(step, numbers)
plt.xlabel( "Number of steps", fontsize=14)
plt.ylabel("Loss value", fontsize=14)
# Display the plot
plt.savefig('data/names/plot.png', format='png')
plt.show()
# Read the numbers from the file