--- pipeline_tag: mask-generation --- # MobileSAM model This model repository contains the weights of the MobileSAM model. ## Installation First install the M ## Usage First install the MobileSAM package: ```bash pip install git+https://github.com/ChaoningZhang/MobileSAM.git ``` The model can then be used as follows: ```python 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() masks, _, _ = predictor.predict() ```