Spaces:
Paused
Paused
limit number of frames
Browse files- evaluate.py +1 -1
- main.py +5 -2
evaluate.py
CHANGED
|
@@ -66,7 +66,7 @@ def get_score(item, image_paths, video_path, metrics, train_steps=100, inference
|
|
| 66 |
images.append([img])
|
| 67 |
|
| 68 |
gt_frames = extract_frames(video_path, fps)
|
| 69 |
-
|
| 70 |
for f in gt_frames:
|
| 71 |
f.thumbnail((512,512))
|
| 72 |
|
|
|
|
| 66 |
images.append([img])
|
| 67 |
|
| 68 |
gt_frames = extract_frames(video_path, fps)
|
| 69 |
+
gt_frames = gt_frames[:1000]
|
| 70 |
for f in gt_frames:
|
| 71 |
f.thumbnail((512,512))
|
| 72 |
|
main.py
CHANGED
|
@@ -85,7 +85,7 @@ debug = False
|
|
| 85 |
save_model = True
|
| 86 |
should_gen_vid = False
|
| 87 |
max_batch_size = 8
|
| 88 |
-
|
| 89 |
|
| 90 |
def save_temp_imgs(imgs):
|
| 91 |
os.makedirs('temp', exist_ok=True)
|
|
@@ -245,6 +245,9 @@ def extract_frames(video_path, fps):
|
|
| 245 |
if not success: break
|
| 246 |
index_in += 1
|
| 247 |
|
|
|
|
|
|
|
|
|
|
| 248 |
out_due = int(index_in / fps_in * fps_out)
|
| 249 |
if out_due > index_out:
|
| 250 |
success, frame = video_capture.retrieve()
|
|
@@ -1271,7 +1274,7 @@ def run_eval(images_orig, video_path, train_steps=100, inference_steps=10, fps=1
|
|
| 1271 |
in_img, in_pose, train_imgs, train_poses = prepare_inputs_train(images, bg_remove, dwpose, rembg_session)
|
| 1272 |
in_img, target_poses, in_pose, _, _ = prepare_inputs_inference(in_img, video_path, [], fps, dwpose, rembg_session, bg_remove, resize_inputs, is_app)
|
| 1273 |
|
| 1274 |
-
|
| 1275 |
#train_steps = 3
|
| 1276 |
|
| 1277 |
finetune = False
|
|
|
|
| 85 |
save_model = True
|
| 86 |
should_gen_vid = False
|
| 87 |
max_batch_size = 8
|
| 88 |
+
max_frame_count = 1000
|
| 89 |
|
| 90 |
def save_temp_imgs(imgs):
|
| 91 |
os.makedirs('temp', exist_ok=True)
|
|
|
|
| 245 |
if not success: break
|
| 246 |
index_in += 1
|
| 247 |
|
| 248 |
+
if frame_count > max_frame_count:
|
| 249 |
+
break
|
| 250 |
+
|
| 251 |
out_due = int(index_in / fps_in * fps_out)
|
| 252 |
if out_due > index_out:
|
| 253 |
success, frame = video_capture.retrieve()
|
|
|
|
| 1274 |
in_img, in_pose, train_imgs, train_poses = prepare_inputs_train(images, bg_remove, dwpose, rembg_session)
|
| 1275 |
in_img, target_poses, in_pose, _, _ = prepare_inputs_inference(in_img, video_path, [], fps, dwpose, rembg_session, bg_remove, resize_inputs, is_app)
|
| 1276 |
|
| 1277 |
+
target_poses = target_poses[:max_frame_count]
|
| 1278 |
#train_steps = 3
|
| 1279 |
|
| 1280 |
finetune = False
|