Spaces:
Paused
Paused
get metrics for user edits
Browse files- evaluate.py +10 -8
- main.py +5 -2
evaluate.py
CHANGED
|
@@ -116,14 +116,6 @@ def compute_fid(img1, img2):
|
|
| 116 |
|
| 117 |
def get_score(item, image_paths, video_path, train_steps=100, inference_steps=10, fps=12, bg_remove=False):
|
| 118 |
images = []
|
| 119 |
-
if not isinstance(image_paths[0], str):
|
| 120 |
-
images = image_paths
|
| 121 |
-
else:
|
| 122 |
-
for path in image_paths:
|
| 123 |
-
print(path)
|
| 124 |
-
img = Image.open(path)
|
| 125 |
-
images.append([img])
|
| 126 |
-
|
| 127 |
results = []
|
| 128 |
results_base = []
|
| 129 |
gt_frames = []
|
|
@@ -143,6 +135,16 @@ def get_score(item, image_paths, video_path, train_steps=100, inference_steps=10
|
|
| 143 |
#gt_frames = gt_frames[:max_frame_count]
|
| 144 |
|
| 145 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
gt_frames = extract_frames(video_path, fps)
|
| 147 |
gt_frames = gt_frames[:max_frame_count]
|
| 148 |
for f in gt_frames:
|
|
|
|
| 116 |
|
| 117 |
def get_score(item, image_paths, video_path, train_steps=100, inference_steps=10, fps=12, bg_remove=False):
|
| 118 |
images = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
results = []
|
| 120 |
results_base = []
|
| 121 |
gt_frames = []
|
|
|
|
| 135 |
#gt_frames = gt_frames[:max_frame_count]
|
| 136 |
|
| 137 |
else:
|
| 138 |
+
|
| 139 |
+
if not isinstance(image_paths[0], str):
|
| 140 |
+
images = image_paths
|
| 141 |
+
else:
|
| 142 |
+
for path in image_paths:
|
| 143 |
+
print(path)
|
| 144 |
+
img = Image.open(path)
|
| 145 |
+
images.append([img])
|
| 146 |
+
|
| 147 |
+
|
| 148 |
gt_frames = extract_frames(video_path, fps)
|
| 149 |
gt_frames = gt_frames[:max_frame_count]
|
| 150 |
for f in gt_frames:
|
main.py
CHANGED
|
@@ -86,6 +86,7 @@ save_model = True
|
|
| 86 |
should_gen_vid = False
|
| 87 |
max_batch_size = 8
|
| 88 |
max_frame_count = 200
|
|
|
|
| 89 |
|
| 90 |
def save_temp_imgs(imgs):
|
| 91 |
os.makedirs('temp', exist_ok=True)
|
|
@@ -1196,7 +1197,8 @@ def run_inference_impl(images, video_path, frames, train_steps=100, inference_st
|
|
| 1196 |
|
| 1197 |
|
| 1198 |
# postprocessing
|
| 1199 |
-
|
|
|
|
| 1200 |
#results = [img_pad(img, img_width, img_height, True) for img in results]
|
| 1201 |
|
| 1202 |
print("Done!")
|
|
@@ -1233,7 +1235,8 @@ def generate_frame(images, target_poses, train_steps=100, inference_steps=10, mo
|
|
| 1233 |
#urls = save_temp_imgs(results)
|
| 1234 |
|
| 1235 |
# postprocessing
|
| 1236 |
-
|
|
|
|
| 1237 |
#results = [img_pad(img, img_width, img_height, True) for img in results]
|
| 1238 |
|
| 1239 |
print("Done!")
|
|
|
|
| 86 |
should_gen_vid = False
|
| 87 |
max_batch_size = 8
|
| 88 |
max_frame_count = 200
|
| 89 |
+
no_bg_final = True
|
| 90 |
|
| 91 |
def save_temp_imgs(imgs):
|
| 92 |
os.makedirs('temp', exist_ok=True)
|
|
|
|
| 1197 |
|
| 1198 |
|
| 1199 |
# postprocessing
|
| 1200 |
+
if no_bg_final:
|
| 1201 |
+
results = [removebg(img, rembg_session, True) for img in results]
|
| 1202 |
#results = [img_pad(img, img_width, img_height, True) for img in results]
|
| 1203 |
|
| 1204 |
print("Done!")
|
|
|
|
| 1235 |
#urls = save_temp_imgs(results)
|
| 1236 |
|
| 1237 |
# postprocessing
|
| 1238 |
+
if no_bg_final:
|
| 1239 |
+
results = [removebg(img, rembg_session, True) for img in results]
|
| 1240 |
#results = [img_pad(img, img_width, img_height, True) for img in results]
|
| 1241 |
|
| 1242 |
print("Done!")
|