84 lines
2.3 KiB
Python
84 lines
2.3 KiB
Python
import os
|
|
import sys
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
|
|
|
|
import importlib
|
|
import argparse
|
|
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('-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
|
|
else:
|
|
config_module = importlib.import_module(args['config'])
|
|
config_1 = config_module.config
|
|
|
|
|
|
import time
|
|
import argparse
|
|
import tqdm
|
|
import random
|
|
import numpy as np
|
|
import plotly.graph_objects as go
|
|
import plotly.express as ex
|
|
from data.utils import Frame
|
|
|
|
|
|
|
|
|
|
def calculate(type=''):
|
|
errors = dict()
|
|
errors_mean = dict()
|
|
|
|
with open(f'{folder}/{hood_csv}', 'r') as f:
|
|
lines_hood = f.readlines()
|
|
with open(f'{folder}/{ours_csv}', 'r') as f:
|
|
lines_ours = f.readlines()
|
|
|
|
for line in lines_hood:
|
|
line = line.split(',')
|
|
category = line[2]
|
|
|
|
if category not in errors:
|
|
errors[category] = []
|
|
errors[category].append(float(line[3]))
|
|
|
|
for category in errors:
|
|
errors_mean[category] = round(np.mean(errors[category]), 5)
|
|
print(errors_mean)
|
|
|
|
mean = round(np.mean(list(errors_mean.values())), 5)
|
|
print(f'Final HOOD error{type}: {mean}')
|
|
|
|
for line in lines_ours:
|
|
line = line.split(',')
|
|
category = line[2]
|
|
|
|
if category not in errors:
|
|
errors[category] = []
|
|
errors[category].append(float(line[3]))
|
|
|
|
for category in errors:
|
|
errors_mean[category] = round(np.mean(errors[category]), 5)
|
|
print(errors_mean)
|
|
|
|
mean = round(np.mean(list(errors_mean.values())), 5)
|
|
print(f'Final OURS error{type}: {mean}')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
folder = '/data-local/127_2/results/hood'
|
|
hood_csv = 'hood_2_hood.csv'
|
|
ours_csv = 'hood_2_ours.csv'
|
|
|
|
calculate() |