Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -242,7 +242,7 @@ def track_video(n_frames, video_state):
|
|
| 242 |
W_ = int(H_ * images[0].shape[1] / images[0].shape[0])
|
| 243 |
|
| 244 |
images = [cv2.resize(img, (W_, H_)) for img in images]
|
| 245 |
-
video_state["origin_images"] = images
|
| 246 |
images = np.array(images)
|
| 247 |
inference_state = video_predictor.init_state(images=images/255, device=device)
|
| 248 |
video_state["inference_state"] = inference_state
|
|
@@ -279,7 +279,7 @@ def track_video(n_frames, video_state):
|
|
| 279 |
painted = np.uint8(np.clip(painted * 255, 0, 255))
|
| 280 |
output_frames.append(painted)
|
| 281 |
print(f"line 281 len(output_frames)={len(output_frames)}, painted shape:{painted.shape}")
|
| 282 |
-
video_state["masks"] = mask_frames
|
| 283 |
print(f'line 283 len video_state["masks"]:{len(video_state["masks"])}')
|
| 284 |
print(f'line 284 video_state["masks"][0].shape:{video_state["masks"][0].shape}')
|
| 285 |
video_file = f"/tmp/{time.time()}-{random.random()}-tracked_output.mp4"
|
|
|
|
| 242 |
W_ = int(H_ * images[0].shape[1] / images[0].shape[0])
|
| 243 |
|
| 244 |
images = [cv2.resize(img, (W_, H_)) for img in images]
|
| 245 |
+
video_state["origin_images"] = np.array(images)##images
|
| 246 |
images = np.array(images)
|
| 247 |
inference_state = video_predictor.init_state(images=images/255, device=device)
|
| 248 |
video_state["inference_state"] = inference_state
|
|
|
|
| 279 |
painted = np.uint8(np.clip(painted * 255, 0, 255))
|
| 280 |
output_frames.append(painted)
|
| 281 |
print(f"line 281 len(output_frames)={len(output_frames)}, painted shape:{painted.shape}")
|
| 282 |
+
video_state["masks"] =np.array( mask_frames)
|
| 283 |
print(f'line 283 len video_state["masks"]:{len(video_state["masks"])}')
|
| 284 |
print(f'line 284 video_state["masks"][0].shape:{video_state["masks"][0].shape}')
|
| 285 |
video_file = f"/tmp/{time.time()}-{random.random()}-tracked_output.mp4"
|