Skip to content

Commit

Permalink
ignore update -- li
Browse files Browse the repository at this point in the history
  • Loading branch information
memoryunreal committed May 26, 2023
1 parent 322ae43 commit e23c444
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ debug_images/
images/
test_sample/
result/
vots/
vots.py
10 changes: 6 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e23c444

Please sign in to comment.