CASIA-IVA-Lab / FastSAM

Fast Segment Anything
GNU Affero General Public License v3.0
7.34k stars 682 forks source link

Return Nothing With CUDA DEVICE #216

Open FlynnSpace opened 6 months ago

FlynnSpace commented 6 months ago

I've used the text_prompt function from the example code, which works fine when the DEVICE is CPU. But when I replace DEVICE with CUDA (as shown below), the program returns three different exception cases:

model= FastSAM('./weights/FastSAM.pt')
IMAGE_PATH = './images/dogs.jpg'
DEVICE = torch.device(
    "cuda"
    if torch.cuda.is_available()
    else "mps"
    if torch.backends.mps.is_available()
    else "cpu"
)
everything_results = model(IMAGE_PATH, device=DEVICE, retina_masks=True, imgsz=1024, conf=0.4, iou=0.9,)
prompt_process = FastSAMPrompt(IMAGE_PATH, everything_results, device=DEVICE)

ann = prompt_process.text_prompt(text='a photo of a dog')

prompt_process.plot(annotations=ann,output_path='./output/dog.jpg',)
Fatih-Haslak commented 2 weeks ago

same issues