labelmeai / labelme

Image Polygonal Annotation with Python (polygon, rectangle, circle, line, point and image-level flag annotation).
https://labelme.io
Other
13.17k stars 3.37k forks source link

Fix ONNX providers with SAM #1340

Closed Erotemic closed 8 months ago

Erotemic commented 11 months ago

Fixes #1334

The latest version of onnxruntime.InferenceSession seems to require providers are specified. This is a small patch that adds them in. I'm not sure if the values I specified were correct or optimal, but it allows SAM to work on my machine rather than crash.

hubutui commented 11 months ago

I think it would be better to change the providers to ["CUDAExecutionProvider", "CPUExecutionProvider"], so we could use cuda first, if failed, then CPU. This also fixes #1317.

hubutui commented 11 months ago

I try it but failed. Maybe we still need to check if CUDA is available, and then update the provider list.

Erotemic commented 11 months ago

Adding the CUDA provider seemed to work fine for me. What's the best way to check for cuda within the dependencies of this repo? Normally I would just use torch.cuda.is_available().

wkentaro commented 8 months ago

Thanks for the report. Fixed via https://github.com/labelmeai/labelme/pull/1364