Tracking-Anything-with-DEVA icon indicating copy to clipboard operation
Tracking-Anything-with-DEVA copied to clipboard

How to use deva in python code

Open RichardQin1 opened this issue 7 months ago • 4 comments
trafficstars

I expect to use DEVA in my Python tasks, but I am a novice and have tried to modify it from the demo, but it seems that the demo has expired. How to introduce usage in the code now. Help, thank you

RichardQin1 avatar Apr 15 '25 05:04 RichardQin1

I want to achieve recognition of objects in videos after frame extraction, and I have already completed frame extraction and video object list.

RichardQin1 avatar Apr 15 '25 06:04 RichardQin1

Which part of the demo does not work for you?

hkchengrex avatar Apr 15 '25 17:04 hkchengrex

演示的哪一部分对您不起作用?

run demo_gradio or demo_with_text print

Traceback (most recent call last):
  File "/home/phoenix/python_project/videoQuestionAnswer/Tracking-Anything-with-DEVA/demo/demo_with_text.py", line 15, in <module>
    from deva.ext.grounding_dino import get_grounding_dino_model
  File "/home/phoenix/anaconda3/envs/VQA/lib/python3.10/site-packages/deva/ext/grounding_dino.py", line 16, in <module>
    from segment_anything import sam_model_registry, SamPredictor, sam_hq_model_registry
ImportError: cannot import name 'sam_hq_model_registry' from 'segment_anything' 

or

Traceback (most recent call last):
  File "/home/phoenix/python_project/videoQuestionAnswer/Tracking-Anything-with-DEVA/demo/demo_gradio.py", line 16, in <module>
    from deva.ext.grounding_dino import get_grounding_dino_model
  File "/home/phoenix/anaconda3/envs/VQA/lib/python3.10/site-packages/deva/ext/grounding_dino.py", line 18, in <module>
    from deva.ext.LightHQSAM.setup_light_hqsam import setup_model as setup_light_hqsam
  File "/home/phoenix/anaconda3/envs/VQA/lib/python3.10/site-packages/deva/ext/LightHQSAM/setup_light_hqsam.py", line 2, in <module>
    from segment_anything.modeling import MaskDecoderHQ, PromptEncoder, Sam, TwoWayTransformer
ImportError: cannot import name 'MaskDecoderHQ' from 'segment_anything.modeling' (/home/phoenix/anaconda3/envs/VQA/lib/python3.10/site-packages/segment_anything/modeling/__init__.py)

I don't know if there are any other things behind

RichardQin1 avatar Apr 16 '25 02:04 RichardQin1

Thanks, and sorry for the late reply. I believe this is a dependency error coming from HQSAM -- I have added some import guards. Please let me know if it works now.

hkchengrex avatar Apr 26 '25 20:04 hkchengrex