Update app.py
Browse files
app.py
CHANGED
@@ -395,16 +395,16 @@ def track(
|
|
395 |
colors.extend(frame_colors)
|
396 |
colors = np.array(colors)
|
397 |
|
398 |
-
|
399 |
|
400 |
-
|
401 |
# segm_mask = torch.zeros(queries.shape[1])
|
402 |
# segm_mask[:num_tracks] = 1
|
403 |
# print('segm_mask',segm_mask.shape, segm_mask)
|
404 |
# segm_mask=segm_mask,
|
405 |
-
|
406 |
|
407 |
-
painted_video = paint_point_track(video_preview,tracks,pred_occ,colors)
|
408 |
|
409 |
# save video
|
410 |
video_file_name = uuid.uuid4().hex + ".mp4"
|
|
|
395 |
colors.extend(frame_colors)
|
396 |
colors = np.array(colors)
|
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=0)
|
401 |
# segm_mask = torch.zeros(queries.shape[1])
|
402 |
# segm_mask[:num_tracks] = 1
|
403 |
# print('segm_mask',segm_mask.shape, segm_mask)
|
404 |
# segm_mask=segm_mask,
|
405 |
+
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)[0].permute(0, 2, 3, 1).cpu().numpy()
|
406 |
|
407 |
+
# painted_video = paint_point_track(video_preview,tracks,pred_occ,colors)
|
408 |
|
409 |
# save video
|
410 |
video_file_name = uuid.uuid4().hex + ".mp4"
|