Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -189,6 +189,7 @@ def inference_and_return_video(dilation_iterations, num_inference_steps, video_s
|
|
189 |
images = np.array(images)
|
190 |
masks = np.array(masks)
|
191 |
print(f"line 191 images shape:{images.shape},masks shape:{masks.shape}")
|
|
|
192 |
img_tensor, mask_tensor = preprocess_for_removal(images, masks)
|
193 |
mask_tensor = mask_tensor[:,:,:,:1]
|
194 |
|
@@ -271,10 +272,13 @@ def track_video(n_frames, video_state):
|
|
271 |
mask += out_mask
|
272 |
mask = np.clip(mask, 0, 1)
|
273 |
mask = cv2.resize(mask, (W_, H_))
|
|
|
274 |
mask_frames.append(mask)
|
|
|
275 |
painted = (1 - mask * 0.5) * frame + mask * 0.5 * color
|
276 |
painted = np.uint8(np.clip(painted * 255, 0, 255))
|
277 |
output_frames.append(painted)
|
|
|
278 |
video_state["masks"] = mask_frames
|
279 |
video_file = f"/tmp/{time.time()}-{random.random()}-tracked_output.mp4"
|
280 |
clip = ImageSequenceClip(output_frames, fps=15)
|
|
|
189 |
images = np.array(images)
|
190 |
masks = np.array(masks)
|
191 |
print(f"line 191 images shape:{images.shape},masks shape:{masks.shape}")
|
192 |
+
#line 191 images shape:(1, 1024, 1820, 3),masks shape:(1, 1024, 1820), which should be (16, 1024, 1820, 3) and (16, 1024, 1820, 3)
|
193 |
img_tensor, mask_tensor = preprocess_for_removal(images, masks)
|
194 |
mask_tensor = mask_tensor[:,:,:,:1]
|
195 |
|
|
|
272 |
mask += out_mask
|
273 |
mask = np.clip(mask, 0, 1)
|
274 |
mask = cv2.resize(mask, (W_, H_))
|
275 |
+
print(f"line 275 mask shape:{mask.shape}")
|
276 |
mask_frames.append(mask)
|
277 |
+
print(f"line 277 len(mask_frames)={len(mask_frames)}")
|
278 |
painted = (1 - mask * 0.5) * frame + mask * 0.5 * color
|
279 |
painted = np.uint8(np.clip(painted * 255, 0, 255))
|
280 |
output_frames.append(painted)
|
281 |
+
print(f"line 281 len(output_frames)={output_frames}, painted shape:{painted.shape}")
|
282 |
video_state["masks"] = mask_frames
|
283 |
video_file = f"/tmp/{time.time()}-{random.random()}-tracked_output.mp4"
|
284 |
clip = ImageSequenceClip(output_frames, fps=15)
|