facebookresearch / facebookresearch/sam2

vos开启后是怎么使用的?

Open
#697 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
19.9k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

video_predictor = build_sam2_video_predictor(
config_file=config_file,
ckpt_path=ckpt_path,
apply_postprocessing=False,
vos_optimized=True,
device=device
)
inference_state = video_predictor.init_state(
video_path=input_video_path,
offload_video_to_cpu=True,
async_loading_frames=True
)
# 添加初始box到推理状态
for frame_box_object in frame_box_list:
frame_idx = frame_box_object.get("frame_idx")
box = np.array(frame_box_object.get("box"), dtype=np.float32)
sam2_model.video_predictor.add_new_points_or_box(
inference_state,
frame_idx=frame_idx,
obj_id=frame_idx,
box=box,
)
for out_frame_idx, out_obj_ids, out_mask_logits in video_predictor.propagate_in_video(
inference_state, start_frame_idx=0):

我的代码是这么写的,init_state()的时候项目会直接崩溃,没有任何日志

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.