This commit is contained in:
2023-08-24 11:36:22 +00:00
parent 59f67a2495
commit afd482522d
36 changed files with 2194 additions and 291 deletions
+20 -12
View File
@@ -8,13 +8,16 @@ 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='190000')
parser.add_argument('--iteration', type=str, default='')
parser.add_argument('-g', '--gpu', type=str)
parser.add_argument('-n', '--normal', action='store_true')
parser.add_argument('-e', '--edge', action='store_true')
parser.add_argument('-cr', '--collision_ratio', action='store_true')
parser.add_argument('-a', '--all', action='store_true')
args = vars(parser.parse_args())
if args['debug']:
from configs.iccvw.pyr_64_128_256_512_cape_f_e2e import config as config_1
from configs.iccvw.pyr_64_128_256_512_e2e import config as config_1
else:
config_module = importlib.import_module(args['config'])
config_1 = config_module.config
@@ -32,7 +35,7 @@ from data.utils import Frame
def calculate():
def calculate(type=''):
all_levels = args['all']
if all_levels:
errors = {0: dict(), 1: dict(), 2: dict(), 3: dict()}
@@ -41,8 +44,7 @@ def calculate():
errors = dict()
errors_mean = dict()
with open(f'{results_folder}/errors/{name}.csv', 'r') as f:
with open(f'{results_folder}/errors/{name}{type}.csv', 'r') as f:
lines = f.readlines()
for line in lines:
@@ -50,11 +52,11 @@ def calculate():
category = line[2]
if all_levels:
level = int(line[3][-1])
if category not in errors:
if category not in errors[level].keys():
errors[level][category] = []
errors[level][category].append(float(line[4]))
else:
if category not in errors:
if category not in errors.keys():
errors[category] = []
errors[category].append(float(line[3]))
@@ -62,17 +64,18 @@ def calculate():
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(f'Level {i} error{type}: {errors_mean[i]}')
mean = np.mean(list(errors_mean[i].values()))
print(f'Final error level {i}: {mean}')
print(f'Final error{type} level {i}: {mean}')
pass
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 = round(np.mean(list(errors_mean.values())), 5)
print(f'Final error{type}: {mean}')
@@ -98,5 +101,10 @@ if __name__ == '__main__':
name = f'{name}_{args["iteration"]}'
out_folder = f'{results_folder}/{name}'
if args['normal']:
calculate('_normal')
if args['edge']:
calculate('_edge')
if args['collision_ratio']:
calculate('_collision_ratio')
calculate()