Spaces:
Paused
Paused
fix bug
Browse files- evaluate.py +14 -14
- main.py +7 -7
evaluate.py
CHANGED
|
@@ -169,20 +169,20 @@ def run_evaluate():
|
|
| 169 |
continue
|
| 170 |
print(item)
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
|
| 187 |
|
| 188 |
ssim = []
|
|
|
|
| 169 |
continue
|
| 170 |
print(item)
|
| 171 |
|
| 172 |
+
try:
|
| 173 |
+
files = get_files('test/'+item)
|
| 174 |
+
images = list(filter(lambda x: not x.endswith('.mp4'), files))
|
| 175 |
+
images = ['test/'+item+'/'+img for img in images]
|
| 176 |
+
videos = [x for x in files if x.endswith('.mp4')]
|
| 177 |
+
print(images, videos)
|
| 178 |
+
|
| 179 |
+
if len(videos) == 1:
|
| 180 |
+
get_score(item, images, 'test/'+item+'/'+videos[0], metrics)
|
| 181 |
+
#get_score(item, ['test/'+item+'/1.jpg', 'test/'+item+'/2.jpg', 'test/'+item+'/3.jpg'], 'test/'+item+'/v.mp4')
|
| 182 |
+
else:
|
| 183 |
+
print('Error: mp4 not found')
|
| 184 |
+
except:
|
| 185 |
+
print("Error", item)
|
| 186 |
|
| 187 |
|
| 188 |
ssim = []
|
main.py
CHANGED
|
@@ -337,17 +337,17 @@ def prepare_inputs_inference(in_img, in_vid, frames, fps, dwpose, rembg_session,
|
|
| 337 |
target_poses_coords.append(json.dumps(coords))
|
| 338 |
progress_bar.update(1)
|
| 339 |
|
| 340 |
-
for tpose in target_poses:
|
| 341 |
-
bbox = tpose.getbbox()
|
| 342 |
-
left, top, right, bottom = bbox
|
| 343 |
-
max_left = min(max_left, left)
|
| 344 |
-
max_top = min(max_top, top)
|
| 345 |
-
max_right = max(max_right, right)
|
| 346 |
-
max_bottom = max(max_bottom, bottom)
|
| 347 |
|
| 348 |
target_poses_cropped = []
|
| 349 |
for tpose in target_poses:
|
| 350 |
if resize_inputs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
tpose = tpose.crop((max_left, max_top, max_right, max_bottom))
|
| 352 |
tpose = ImageOps.expand(tpose, border=int(tpose.width*0.2), fill=(0,0,0))
|
| 353 |
|
|
|
|
| 337 |
target_poses_coords.append(json.dumps(coords))
|
| 338 |
progress_bar.update(1)
|
| 339 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
|
| 341 |
target_poses_cropped = []
|
| 342 |
for tpose in target_poses:
|
| 343 |
if resize_inputs:
|
| 344 |
+
bbox = tpose.getbbox()
|
| 345 |
+
left, top, right, bottom = bbox
|
| 346 |
+
max_left = min(max_left, left)
|
| 347 |
+
max_top = min(max_top, top)
|
| 348 |
+
max_right = max(max_right, right)
|
| 349 |
+
max_bottom = max(max_bottom, bottom)
|
| 350 |
+
|
| 351 |
tpose = tpose.crop((max_left, max_top, max_right, max_bottom))
|
| 352 |
tpose = ImageOps.expand(tpose, border=int(tpose.width*0.2), fill=(0,0,0))
|
| 353 |
|