Spaces:
Paused
Paused
fix bugs
Browse files- evaluate.py +8 -3
evaluate.py
CHANGED
|
@@ -120,6 +120,7 @@ def get_score(item, image_paths, video_path, metrics, train_steps=100, inference
|
|
| 120 |
results = []
|
| 121 |
results_base = []
|
| 122 |
gt_frames = []
|
|
|
|
| 123 |
if os.path.isdir('/data/out/'+item):
|
| 124 |
for filename in os.listdir('/data/out/'+item):
|
| 125 |
img = Image.open('/data/out/'+item+'/'+filename)
|
|
@@ -129,10 +130,14 @@ def get_score(item, image_paths, video_path, metrics, train_steps=100, inference
|
|
| 129 |
results_base.append(img)
|
| 130 |
elif filename.startswith('frame_'):
|
| 131 |
gt_frames.append(img)
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
else:
|
| 134 |
gt_frames = extract_frames(video_path, fps)
|
| 135 |
-
gt_frames = gt_frames[:
|
| 136 |
for f in gt_frames:
|
| 137 |
f.thumbnail((512,512))
|
| 138 |
|
|
@@ -228,7 +233,7 @@ def run_evaluate():
|
|
| 228 |
|
| 229 |
with open('/data/metrics.json', 'r') as file:
|
| 230 |
metrics = json.load(file)
|
| 231 |
-
|
| 232 |
|
| 233 |
items = os.listdir('test')
|
| 234 |
items = [it for it in items if not it[0]=='.' and not os.path.isfile('test/'+it)]
|
|
|
|
| 120 |
results = []
|
| 121 |
results_base = []
|
| 122 |
gt_frames = []
|
| 123 |
+
max_frame_count = 200
|
| 124 |
if os.path.isdir('/data/out/'+item):
|
| 125 |
for filename in os.listdir('/data/out/'+item):
|
| 126 |
img = Image.open('/data/out/'+item+'/'+filename)
|
|
|
|
| 130 |
results_base.append(img)
|
| 131 |
elif filename.startswith('frame_'):
|
| 132 |
gt_frames.append(img)
|
| 133 |
+
|
| 134 |
+
results = gt_frames[:max_frame_count]
|
| 135 |
+
results_base = gt_frames[:max_frame_count]
|
| 136 |
+
gt_frames = gt_frames[:max_frame_count]
|
| 137 |
+
|
| 138 |
else:
|
| 139 |
gt_frames = extract_frames(video_path, fps)
|
| 140 |
+
gt_frames = gt_frames[:max_frame_count]
|
| 141 |
for f in gt_frames:
|
| 142 |
f.thumbnail((512,512))
|
| 143 |
|
|
|
|
| 233 |
|
| 234 |
with open('/data/metrics.json', 'r') as file:
|
| 235 |
metrics = json.load(file)
|
| 236 |
+
metrics = {'aaa': metrics['aaa']}
|
| 237 |
|
| 238 |
items = os.listdir('test')
|
| 239 |
items = [it for it in items if not it[0]=='.' and not os.path.isfile('test/'+it)]
|