Update app.py
Browse files
app.py
CHANGED
@@ -371,6 +371,10 @@ def track(
|
|
371 |
|
372 |
else:
|
373 |
queries = query_points_tensor
|
|
|
|
|
|
|
|
|
374 |
add_support_grid=True
|
375 |
|
376 |
model(video_chunk=video_input, is_first_step=True, grid_size=0, queries=queries, add_support_grid=add_support_grid)
|
@@ -393,8 +397,11 @@ def track(
|
|
393 |
|
394 |
pred_tracks = (pred_tracks * torch.tensor([video_preview.shape[2], video_preview.shape[1]]).to(device) / torch.tensor([VIDEO_INPUT_RESO[1], VIDEO_INPUT_RESO[0]]).to(device))
|
395 |
|
396 |
-
vis = Visualizer(save_dir="./saved_videos", pad_value=
|
397 |
-
|
|
|
|
|
|
|
398 |
|
399 |
# painted_video = paint_point_track(video_preview,tracks,pred_occ,colors)
|
400 |
|
|
|
371 |
|
372 |
else:
|
373 |
queries = query_points_tensor
|
374 |
+
xy = get_points_on_a_grid(15, video_input.shape[3:], device=device)
|
375 |
+
queries__ = torch.cat([torch.zeros_like(xy[:, :, :1]), xy], dim=2).to(device) #
|
376 |
+
num_tracks = queries.shape[1]
|
377 |
+
queries = torch.cat([queries,queries__],dim=1)
|
378 |
add_support_grid=True
|
379 |
|
380 |
model(video_chunk=video_input, is_first_step=True, grid_size=0, queries=queries, add_support_grid=add_support_grid)
|
|
|
397 |
|
398 |
pred_tracks = (pred_tracks * torch.tensor([video_preview.shape[2], video_preview.shape[1]]).to(device) / torch.tensor([VIDEO_INPUT_RESO[1], VIDEO_INPUT_RESO[0]]).to(device))
|
399 |
|
400 |
+
vis = Visualizer(save_dir="./saved_videos", pad_value=0, linewidth=1, tracks_leave_trace=-1)
|
401 |
+
segm_mask = torch.zeros(queries.shape[1]).to(device)
|
402 |
+
segm_mask[:num_tracks] = 1
|
403 |
+
print('segm_mask',segm_mask.shape, segm_mask)
|
404 |
+
painted_video = vis.visualize(torch.tensor(video_preview).permute(0, 3, 1, 2)[None].to(pred_tracks.device), pred_tracks, pred_visibility, save_video=False, segm_mask=segm_mask, compensate_for_camera_motion=True)[0].permute(0, 2, 3, 1).cpu().numpy()
|
405 |
|
406 |
# painted_video = paint_point_track(video_preview,tracks,pred_occ,colors)
|
407 |
|