FastSAM icon indicating copy to clipboard operation
FastSAM copied to clipboard

Return Nothing With CUDA DEVICE

Open FlynnSpace opened this issue 1 year ago • 1 comments

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:

  • Return 0 and the console is blank. No result is saved.
  • The program keeps running and returns nothing.
  • Return error: python: ../nptl/pthread_mutex_lock.c:428: __pthread_mutex_lock_full: Assertion e != ESRCH || !robust failed.
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',)

FlynnSpace avatar Mar 07 '24 09:03 FlynnSpace

same issues

Fatih-Haslak avatar Aug 29 '24 11:08 Fatih-Haslak