roboflow / notebooks

Examples and tutorials on using SOTA computer vision models and techniques. Learn everything from old-school ResNet, through YOLO and object-detection transformers like DETR, to the latest models like Grounding DINO and SAM.
https://roboflow.com/models
5.26k stars 809 forks source link

ModuleNotFoundError: No module named 'sam2' #299

Closed eddy961206 closed 1 month ago

eddy961206 commented 1 month ago

Search before asking

Notebook name

grounded-sam-2-auto-label.ipynb

Bug

I didn't modify 'grounded-sam-2-auto-label.ipynb'.

When I execute 'from autodistill_grounded_sam_2 import GroundedSAM2' cell,

I get an error like this :


ModuleNotFoundError Traceback (most recent call last) in <cell line: 1>() ----> 1 from autodistill_grounded_sam_2 import GroundedSAM2

2 frames /usr/local/lib/python3.10/dist-packages/autodistill_grounded_sam_2/helpers.py in load_SAM() 77 urllib.request.urlretrieve(url, SAM_CHECKPOINT_PATH) 78 ---> 79 from sam2.build_sam import build_sam2 80 from sam2.sam2_image_predictor import SAM2ImagePredictor 81

ModuleNotFoundError: No module named 'sam2'

I exectued 'pip install git+https://github.com/autodistill/autodistill-grounded-sam-2 rf_groundingdino -q' this cell before. but I can't find why it can't find module named 'sam2'.

Environment

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

SkalskiP commented 1 month ago

Hi @capjamesg 👋🏻 could you take a look at this?

capjamesg commented 1 month ago

@eddy961206 I have just pushed a fix to the autodistill-grounded-sam-2 package. This issue should now be fixed. Can you try to run the notebook again?

Please note that installation may take several minutes as SAM 2 is a large package that takes a while to build in development environments.

eddy961206 commented 1 month ago

@capjamesg It works perfectly. Thanks for your great work!!!