加载SAM模型 importsyssys.path.append("..")fromsegment_anythingimportsam_model_registry,SamPredictorsam_checkpoint="sam_vit_h_4b8939.pth"model_type="vit_h"device="cuda"sam=sam_model_registry[model_type](checkpoint=sam_checkpoint)sam.to(device=device)predictor=SamPredictor(sam)predictor.set_image(...
Segment Anything TaskTask使用prompt的类型:一组前景、背景标记点 粗略的标记框或者掩码 自由格式的文字(文章中提到效果并不稳定,官方demo中并未展示) 可提示分割任务(promptable segmentation task)是在给定任何提示的情况下返回有效的分割掩码。 有效掩码的要求意味着即使提示不明确,并且可能涉及多个对象,输出也应该是...