GroundingDINO Import Error
Opened this issue · 3 comments
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!!
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
.
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 usegrounding_dino.groundingdino
instead ofgroundingdino
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
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.