[SAM2] Very slow inference speeds, even on a 3090

Experimenting with SAM2. I have a 3090 GPU, on which the sam2.1-hiera-large from the original facebook repository runs at 15FPS atleast. I was exploring the ultralytics support for it, given that it would be easier to pipeline it using them, but realized that the inference is unbelievably slow. Like, I am getting 4 seconds per frame.

Verified the following things. The model is for sure loaded onto the GPU, I can see the equivalent memory footprint. Passed the cuda:0 for the device argument.

Which version of the Ultralytics SAM2.1 models are you using and what’s the code/command you’re using for inference?