From e23c4444eb306da179213fb8b9db5a7bdac4f9a3 Mon Sep 17 00:00:00 2001 From: memoryunreal <814514103@qq.com> Date: Fri, 26 May 2023 11:14:40 +0000 Subject: [PATCH] ignore update -- li --- .gitignore | 2 ++ app.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 27dbf8a..029399d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ debug_images/ images/ test_sample/ result/ +vots/ +vots.py diff --git a/app.py b/app.py index 8965cc4..870fae0 100644 --- a/app.py +++ b/app.py @@ -125,7 +125,7 @@ def get_frames_from_video(video_input, video_state): def run_example(example): return video_input # get the select frame from gradio slider -def select_template(image_selection_slider, video_state, interactive_state): +def select_template(image_selection_slider, video_state, interactive_state, mask_dropdown): # images = video_state[1] image_selection_slider -= 1 @@ -139,8 +139,11 @@ def select_template(image_selection_slider, video_state, interactive_state): # update the masks when select a new template frame # if video_state["masks"][image_selection_slider] is not None: # video_state["painted_images"][image_selection_slider] = mask_painter(video_state["origin_images"][image_selection_slider], video_state["masks"][image_selection_slider]) + if mask_dropdown: + print("ok") operation_log = [("",""), ("Select frame {}. Try click image and add mask for tracking.".format(image_selection_slider),"Normal")] + return video_state["painted_images"][image_selection_slider], video_state, interactive_state, operation_log # set the tracking end frame @@ -217,7 +220,6 @@ def remove_multi_mask(interactive_state, mask_dropdown): def show_mask(video_state, interactive_state, mask_dropdown): mask_dropdown.sort() select_frame = video_state["origin_images"][video_state["select_frame_number"]] - for i in range(len(mask_dropdown)): mask_number = int(mask_dropdown[i].split("_")[1]) - 1 mask = interactive_state["multi_mask"]["masks"][mask_number] @@ -375,8 +377,8 @@ def generate_video_from_frames(frames, output_path, fps=30): SAM_checkpoint = download_checkpoint(sam_checkpoint_url, folder, sam_checkpoint) xmem_checkpoint = download_checkpoint(xmem_checkpoint_url, folder, xmem_checkpoint) e2fgvi_checkpoint = download_checkpoint_from_google_drive(e2fgvi_checkpoint_id, folder, e2fgvi_checkpoint) -# args.port = 12212 -# args.device = "cuda:1" +args.port = 12212 +args.device = "cuda:3" # args.mask_save = True # initialize sam, xmem, e2fgvi models