加载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(...