calculate-flops.pytorch icon indicating copy to clipboard operation
calculate-flops.pytorch copied to clipboard

On the calculation of FLOPs for SAM/MobileSAM

Open BeliverK opened this issue 8 months ago • 0 comments

SAM model requires multiple inputs, image, point_prompt or boxes_prompt, how do you pass these parameters to the calculate_flops?For example, in the following code, how to set parameters?

from mobile_sam import MobileSAM, SamPredictor
import torch

model = MobileSAM.from_pretrained("nielsr/mobilesam")

# perform inference
device = "cuda" if torch.cuda.is_available() else "cpu"
model.to(device=device)

predictor = SamPredictor(model)
predictor.set_image(<your_image>)
masks, _, _ = predictor.predict(<input_prompts>)

BeliverK avatar Jun 20 '24 02:06 BeliverK