forked from Andy-zhujunwen/UNET-ZOO
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot.py
31 lines (30 loc) · 1.05 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
import matplotlib.pyplot as plt
import os
def loss_plot(args,loss):
num = args.epoch
x = [i for i in range(num)]
plot_save_path = r'result/plot/'
if not os.path.exists(plot_save_path):
os.makedirs(plot_save_path)
save_loss = plot_save_path+str(args.arch)+'_'+str(args.batch_size)+'_'+str(args.dataset)+'_'+str(args.epoch)+'_loss.jpg'
plt.figure()
plt.plot(x,loss,label='loss')
plt.legend()
plt.savefig(save_loss)
def metrics_plot(arg,name,*args):
num = arg.epoch
names = name.split('&')
metrics_value = args
i=0
x = [i for i in range(num)]
plot_save_path = r'result/plot/'
if not os.path.exists(plot_save_path):
os.makedirs(plot_save_path)
save_metrics = plot_save_path + str(arg.arch) + '_' + str(arg.batch_size) + '_' + str(arg.dataset) + '_' + str(arg.epoch) + '_'+name+'.jpg'
plt.figure()
for l in metrics_value:
plt.plot(x,l,label=str(names[i]))
#plt.scatter(x,l,label=str(l))
i+=1
plt.legend()
plt.savefig(save_metrics)