This package exposes GroundingDINO with local_comm.
This allows GroundingDINO to be isolated into a conda environment and called from another with minimal dependancies.
- Clone repository (make sure to use the
--recursiveflag) - Change directory:
cd lc_GroundingDINO - Create conda environment:
conda create -n lc_groundingdino python=3.10(only tested with Python 3.10) - Activate conda environment:
conda activate lc_groundingdino - Install dependencies
- GroundingDINO:
cd extern/GroundingDINOand follow instructions, here (note, this may be tricky). - Change directory:
cd /path/to/lc_GroundingDINO local_comm:pip install extern/local_comm
- Install
lc_groundingdino:pip install .
You can start the server using
conda activate lc_groundingdino
python -m lc_groundingdino.image_inference_server
Note, the client will require lc_groundingdino to be installed but this does not require GroundingDINO to be installed.
Check pyproject.toml for the minimal list of dependancies (note, local_comm is dependency-free).
- Change directory:
cd /path/to/lc_GroundingDINO - Create and activate your conda environment, for example called
lc_groundingdino_client. - Install
local_comm:pip install extern/local_comm - Install
lc_groundingdino:pip install .
Run the following basic example to check that GroundingDINO is working.
conda activate lc_groundingdino
python scripts/basic_example.py /path/to/image_filename PROMPT1 PROMPT2
Open a terminal and start the server.
conda activate lc_groundingdino
python -m lc_groundingdino.image_inference_server
Open another terminal and test the client.
conda activate lc_groundingdino_client
python scripts/test_client.py scripts/image.jpg person containers bowl stove
You should expect to see the following output.
[info] Sending request on channel 'groundingdino'
[info] Call took 0.192s (5.20 Hz)
[info] Received 15 detections
00: person logit=0.912 box=[0.17006513476371765, 0.5478484034538269, 0.33907875418663025, 0.9008976221084595]
01: bowl logit=0.673 box=[0.43435776233673096, 0.7306913137435913, 0.13680307567119598, 0.1269308179616928]
02: containers logit=0.409 box=[0.37393122911453247, 0.08947072178125381, 0.03197794407606125, 0.09651652723550797]
03: containers logit=0.410 box=[0.3437686860561371, 0.08994346857070923, 0.03408919647336006, 0.0959039255976677]
04: containers logit=0.418 box=[0.2570761442184448, 0.09374231100082397, 0.029447609558701515, 0.08323606848716736]
05: stove logit=0.404 box=[0.8802738785743713, 0.8256462216377258, 0.23787285387516022, 0.34573885798454285]
06: containers logit=0.368 box=[0.7540533542633057, 0.09397221356630325, 0.05794242024421692, 0.18710771203041077]
07: containers logit=0.358 box=[0.5850163102149963, 0.09245003759860992, 0.05671674385666847, 0.18306756019592285]
08: containers logit=0.351 box=[0.7260599732398987, 0.28970515727996826, 0.03193245455622673, 0.11721739917993546]
09: containers logit=0.367 box=[0.7578036189079285, 0.3053896427154541, 0.03669160604476929, 0.08268167823553085]
10: containers logit=0.354 box=[0.47004619240760803, 0.09349002689123154, 0.05757146328687668, 0.18494975566864014]
11: containers logit=0.398 box=[0.2103295773267746, 0.09442437440156937, 0.06749828904867172, 0.08302118629217148]
12: containers logit=0.365 box=[0.6964897513389587, 0.0910215899348259, 0.054258622229099274, 0.18105098605155945]
13: containers logit=0.364 box=[0.5256297588348389, 0.0929589495062828, 0.05548851564526558, 0.1840696483850479]
14: containers logit=0.364 box=[0.6415461897850037, 0.09309326112270355, 0.0557854026556015, 0.1850593537092209]
[info] Wrote annotated image to test_output.png
The test_output.png should be the same as the figure above.
