facebookresearch / segment-anything

The repository provides code for running inference with the SegmentAnything Model (SAM), links for downloading the trained model checkpoints, and example notebooks that show how to use the model.
Apache License 2.0
46.73k stars 5.54k forks source link

Inference Time for Generating Mask on CPU #488

Closed Heidar-An closed 1 year ago

Heidar-An commented 1 year ago

Just wanted to know, how long is it taking you guys for generating the masks, I'm using the SamAutomaticMaskGenerator class (maybe that's the issue) but it takes just over 2 minutes on ViT-b with a 250x250 image.

I need to test it on my CPU for a specific reason, so please do not suggest get a GPU, but is it meant to take that long? The website says it takes 0.15s on an A100, is a Intel i7 really that much worse? Is there a way to make it run in less than 10seconds ish (for bigger images).

heyoeyo commented 1 year ago

It takes about 30 seconds for me on a Ryzen 7600 cpu. My previous cpu (Ryzen 1500) was around 3x slower, so I can imagine an older i7 could take around 2 minutes without there being anything wrong.

There are faster variants now (for example, FastSAM and MobileSAM) that might be a better option if you need it to run faster.

Heidar-An commented 1 year ago

ooh, cool, thanks. I'll close the issue now.