forked from milesial/Pytorch-UNet
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconvert_loss.py
executable file
·33 lines (28 loc) · 926 Bytes
/
convert_loss.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
#!/usr/bin/env python
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
tags = [
'model/unet-l23-cosmic500-e50',
'model/uresnet-l23-cosmic500-e50',
'model/nestedunet-l23-cosmic500-e50',
# 'uresnet-explr-l23-cosmic500',
# 'uresnet-l23-cosmic500-t1',
]
labels = [
'UNet',
'UResNet',
'NestedUNet',
# 'UResNet-ExpLR',
# 'UResNet-t1',
]
dfs = [pd.read_csv(tag+'/loss.csv', sep=' ', header=None) for tag in tags]
epoch = 50
nsample = 450
epoch_index = np.linspace(0, epoch-1, num=epoch)
mean_loss = np.zeros((len(tags),epoch))
for itag in range(len(tags)) :
for iepoch in range(epoch):
mean_loss[itag][iepoch] = dfs[itag][1][nsample*iepoch:nsample*(iepoch+1)].to_numpy().mean()
out = np.concatenate(( np.expand_dims(epoch_index,axis=1), np.expand_dims(mean_loss[itag],axis=1) ), axis=1)
np.savetxt(labels[itag]+'.csv',out,delimiter=',')