-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patheval_sintel.py
More file actions
73 lines (46 loc) · 1.26 KB
/
eval_sintel.py
File metadata and controls
73 lines (46 loc) · 1.26 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /usr/bin/python
# Author: Jiaao Zhang [DUT Media]
# Date: 13th Dec 2018
from lib import flowlib as fl
import numpy as np
import seaborn as sn
import matplotlib.pyplot as plt
import cv2
import os
def count_text_lines(file_path):
f = open(file_path, 'r')
lines = f.readlines()
lines = lines[:-1]
f.close()
return len(lines)
def read_path(file_path):
f = open(file_path, 'r')
gt_path = f.readlines()
print(len(gt_path))
gt_paths = []
for path in gt_path:
gt_paths.append(path.replace('\n', ''))
return gt_paths
pred_flow_txt = 'pred_sintel_final_flow_EPIC.txt'
gt_flow_txt = 'gt_sintel_flow.txt'
gt_number = count_text_lines(gt_flow_txt)
gt_paths = read_path(gt_flow_txt)
pred_number = count_text_lines(pred_flow_txt)
pred_paths = read_path(pred_flow_txt)
print(gt_number)
print(pred_number)
sum_AEE = []
count = 0
for i in range(gt_number):
pred_flow = fl.read_flow(pred_paths[i])
gt_flow = fl.read_flow(gt_paths[i])
res = fl.evaluate_flow(gt_flow, pred_flow)
# sum_AEE.append(res)
# count += 1
if res < 50:
sum_AEE.append(res)
count += 1
print('running file, aee is {}'.format(res))
AEE = np.mean(sum_AEE)
print('the averge error is {}'.format(AEE))
print(count)