Open cyborgdennett opened 9 months ago
Add
!pip install timm
to the import and install of the notebook to fix this issue
On colab you get one more error, when loading the model. Fix with the following code:
import sys
sys.path.append("..")
from mobile_sam import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
if 'google.colab' in sys.modules:
sam_checkpoint = "/content/mobile_sam.pt"
else:
sam_checkpoint = "../weights/mobile_sam.pt"
model_type = "vit_t"
device = "cuda" if torch.cuda.is_available() else "cpu"
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
sam.to(device=device)
sam.eval()
mask_generator = SamAutomaticMaskGenerator(sam)
Hi, I try to run the notebook https://github.com/ChaoningZhang/MobileSAM/blob/master/notebooks/automatic_mask_generator_example.ipynb on colab, and I get this error.![image](https://github.com/ChaoningZhang/MobileSAM/assets/40475862/edb7565d-25b9-4844-8f20-2ad7c873e643)