This commit is contained in:
2023-07-14 10:12:00 +02:00
parent bb16aaf868
commit 88531da784
16 changed files with 411 additions and 299 deletions
+33 -13
View File
@@ -8,12 +8,13 @@ parser = argparse.ArgumentParser(description='')
parser.add_argument('--name', type=str)
parser.add_argument('--config', type=str)
parser.add_argument('--debug', action='store_true')
parser.add_argument('--iteration', type=str, default='')
parser.add_argument('--iteration', type=str, default='190000')
parser.add_argument('-g', '--gpu', type=str)
parser.add_argument('-a', '--all', action='store_true')
args = vars(parser.parse_args())
if args['debug']:
from configs.iccvw.pyr_64_128_cape_f_2 import config_1
from configs.iccvw.pyr_64_128_256_512_cape_f_e2e import config as config_1
else:
config_module = importlib.import_module(args['config'])
config_1 = config_module.config
@@ -32,8 +33,14 @@ from data.utils import Frame
def calculate():
errors = dict()
errors_mean = dict()
all_levels = args['all']
if all_levels:
errors = {0: dict(), 1: dict(), 2: dict(), 3: dict()}
errors_mean = {0: dict(), 1: dict(), 2: dict(), 3: dict()}
else:
errors = dict()
errors_mean = dict()
with open(f'{results_folder}/errors/{name}.csv', 'r') as f:
lines = f.readlines()
@@ -41,18 +48,31 @@ def calculate():
for line in lines:
line = line.split(',')
category = line[2]
if category not in errors:
errors[category] = []
errors[category].append(float(line[3]))
if all_levels:
level = int(line[3][-1])
if category not in errors:
errors[level][category] = []
errors[level][category].append(float(line[4]))
else:
if category not in errors:
errors[category] = []
errors[category].append(float(line[3]))
for category in errors:
errors_mean[category] = np.mean(errors[category])
if all_levels:
for i in range(4):
for category in errors[i]:
errors_mean[i][category] = round(np.mean(errors[i][category]), 5)
print(f'Level {i}: {errors_mean[i]}')
print(errors_mean)
mean = np.mean(list(errors_mean[i].values()))
print(f'Final error level {i}: {mean}')
else:
for category in errors:
errors_mean[category] = round(np.mean(errors[category]), 5)
print(errors_mean)
mean = np.mean(list(errors_mean.values()))
print(f'Final error: {mean}')
mean = np.mean(list(errors_mean.values()))
print(f'Final error: {mean}')