FastSAM
FastSAM copied to clipboard
Return Nothing With CUDA DEVICE
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',)
same issues