IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
https://arxiv.org/abs/2401.14159
Apache License 2.0
14.85k stars 1.37k forks source link

Cannot run grounded_sam_colab_demo.ipynb, failed when installing (may relate to the update of pyproject.toml?) #394

Open lanlanyan0817 opened 10 months ago

lanlanyan0817 commented 10 months ago

Hi, I have been using GroudedSAM for some time, but I encountered an error today when running the first cell to install in grounded_sam_colab_demo.ipynb:

/content/Grounded-Segment-Anything/GroundingDINO Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done error: subprocess-exited-with-error

× Building wheel for groundingdino (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. Building wheel for groundingdino (pyproject.toml) ... error ERROR: Failed building wheel for groundingdino ERROR: Could not build wheels for groundingdino, which is required to install pyproject.toml-based projects /content/Grounded-Segment-Anything/segment_anything Preparing metadata (setup.py) ... done Building wheel for segment-anything (setup.py) ... done /content/Grounded-Segment-Anything

Also another error when generating the boxes:

NameError Traceback (most recent call last)

in () ----> 1 annotated_frame, detected_boxes = detect(image, text_prompt="bench", model=groundingdino_model) 2 Image.fromarray(annotated_frame) 24 frames /content/Grounded-Segment-Anything/GroundingDINO/groundingdino/models/GroundingDINO/ms_deform_attn.py in forward(ctx, value, value_spatial_shapes, value_level_start_index, sampling_locations, attention_weights, im2col_step) 51 ): 52 ctx.im2col_step = im2col_step ---> 53 output = _C.ms_deform_attn_forward( 54 value, 55 value_spatial_shapes, NameError: name '_C' is not defined **Is the problem related to the update of the pyproject.toml two days ago because this problem didn't exist several days ago. Or other explanations for the problems? Maybe anyone else has the same problem currently when running this code on Google Colab?**
imiraoui commented 10 months ago

same bug here

crapthings commented 10 months ago

try remove build and reinstall

pip install torch==2.0.1 torchvision==0.15.2

then

pip install -e .