Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GroundingDINO Import Error #24

Open
cremebrule opened this issue Aug 19, 2024 · 3 comments
Open

GroundingDINO Import Error #24

cremebrule opened this issue Aug 19, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@cremebrule
Copy link

Hi Grounded-SAM-2 team,

Huge thanks for this fantastic error!

I believe there's some bad imports with regards to grounding dino -- e.g., in groundingdino/utils/util.py, imports use grounding_dino.groundingdino instead of groundingdino as in the original Grounded SAM repo (see here).

Is there a reason for this? This causes imports to fail unless the current working directory is in the root Grounded-SAM-2 directory.

Thanks!!

@rentainhe
Copy link
Collaborator

Sorry, I'm not very familiar with this import error either. On our side, we placed the entire grounding_dino repository under Grounded SAM 2 and then made the necessary adaptations. That's why we need to import the relevant code functions using from grounding_dino.groundingdino.

@ShuoShenDe
Copy link
Contributor

Hi Grounded-SAM-2 team,

Huge thanks for this fantastic error!

I believe there's some bad imports with regards to grounding dino -- e.g., in groundingdino/utils/util.py, imports use grounding_dino.groundingdino instead of groundingdino as in the original Grounded SAM repo (see here).

Is there a reason for this? This causes imports to fail unless the current working directory is in the root Grounded-SAM-2 directory.

Thanks!!

Hi dear cremebrule,

The difference you noticed is due to a naming convention change in Grounded-SAM-2. In our repository, we've renamed the path to grounding_dino, whereas in the original GroundingDINO repo, it's named groundingdino. When Python attempts to import modules, it requires the exact path match, which is why this discrepancy exists.

Hope this clarifies the situation!

Best regards,
Susan

@cremebrule
Copy link
Author

Hi @rentainhe and @ShuoShenDe ,

Huge thanks for the rapid response! This is interesting -- as far as I understand, when you run the pip install --no-build-isolation -e grounding_dino call, it goes into the grounding_dino directory, looks for setup.py, and then runs that. So I'm a bit confused as to why the grounding_dino is necessary during imports when the source module directory within the grounding_dino is named groundingdino (and so the latter should be the only thing required).

For what it's worth, when I modify all the internal imports to be groundingdino instead of grounding_dino.groundingdino, everything works properly, independent of my current working directory. The latter only works when I'm in the source directory of Grounded-SAM-2, presumably because the grounding_dino module directory exists relative to that working directory.

@rentainhe rentainhe added the documentation Improvements or additions to documentation label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants