banner
hughie

hughie

热爱技术的小菜鸟, 记录一下所学所感

MobileSAM - SAM faster than FastSAM

Tool Sharing#

MobileSAM is smaller and faster than FastSAM, and its processing flow is closer to SAM.

20-mobilesam-logo

Features#

MobileSAM is about 7 times smaller and 5 times faster than the current FastSAM, and its key feature is being fast and good.

Deployment#

  • Install the project

    git clone git@github.com:ChaoningZhang/MobileSAM.git && cd MobileSAM
    pip install -e .
    
  • Usage

    from mobile_sam import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
    
    model_type = "vit_t"
    sam_checkpoint = "./weights/mobile_sam.pt"
    
    device = "cuda" if torch.cuda.is_available() else "cpu"
    
    mobile_sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
    mobile_sam.to(device=device)
    mobile_sam.eval()
    
    predictor = SamPredictor(mobile_sam)
    predictor.set_image(<your_image>)
    # Input prompt
    masks, _, _ = predictor.predict(<input_prompts>)
    

Platform#

Official demo


Disclaimer#

This article is only intended as a tool sharing record.

This article is synchronized with HBlog.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.