Spaces:
Running
on
A10G
Running
on
A10G
Update evaluate.py
Browse files- evaluate.py +8 -8
evaluate.py
CHANGED
@@ -67,18 +67,18 @@ def load_json(path):
|
|
67 |
with open(path, 'r') as file:
|
68 |
return json.load(file)
|
69 |
|
70 |
-
def eval(test, standard):
|
71 |
-
test_p = "
|
72 |
-
standard_p = "
|
73 |
-
os.system('python inferencer_demo.py ' + test_p) # produce user.json
|
74 |
|
75 |
scores = []
|
76 |
|
77 |
-
align_filter('
|
78 |
|
79 |
# return None
|
80 |
-
data_00 = load_json('
|
81 |
-
data_01 = load_json('
|
82 |
cap_00 = cv2.VideoCapture(standard_p)
|
83 |
cap_01 = cv2.VideoCapture(test_p)
|
84 |
# Define keypoint connections for both videos (example indices, you'll need to customize)
|
@@ -91,7 +91,7 @@ def eval(test, standard):
|
|
91 |
frame_width = int(cap_00.get(cv2.CAP_PROP_FRAME_WIDTH))
|
92 |
frame_height = int(cap_00.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
93 |
|
94 |
-
out = cv2.VideoWriter('
|
95 |
|
96 |
cap_00.set(cv2.CAP_PROP_POS_FRAMES, 0) # 初始化视频从头开始读取
|
97 |
cap_01.set(cv2.CAP_PROP_POS_FRAMES, 0)
|
|
|
67 |
with open(path, 'r') as file:
|
68 |
return json.load(file)
|
69 |
|
70 |
+
def eval(test, standard, tmpdir):
|
71 |
+
test_p = tmpdir + "/user.mp4"
|
72 |
+
standard_p = tmpdir + "/standard.mp4"
|
73 |
+
os.system('python inferencer_demo.py ' + test_p + ' --pred-out-dir', tmpdir) # produce user.json
|
74 |
|
75 |
scores = []
|
76 |
|
77 |
+
align_filter(tmpdir + '/standard', tmpdir + '/user', tmpdir) # 帧对齐 produce aligned vedios
|
78 |
|
79 |
# return None
|
80 |
+
data_00 = load_json(tmpdir + '/standard.json') # aligned json
|
81 |
+
data_01 = load_json(tmpdir + '/user.json')
|
82 |
cap_00 = cv2.VideoCapture(standard_p)
|
83 |
cap_01 = cv2.VideoCapture(test_p)
|
84 |
# Define keypoint connections for both videos (example indices, you'll need to customize)
|
|
|
91 |
frame_width = int(cap_00.get(cv2.CAP_PROP_FRAME_WIDTH))
|
92 |
frame_height = int(cap_00.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
93 |
|
94 |
+
out = cv2.VideoWriter(tmpdir + '/output.mp4', cv2.VideoWriter_fourcc(*'H264'), 5, (frame_width*2, frame_height*2))
|
95 |
|
96 |
cap_00.set(cv2.CAP_PROP_POS_FRAMES, 0) # 初始化视频从头开始读取
|
97 |
cap_01.set(cv2.CAP_PROP_POS_FRAMES, 0)
|