Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Official PyTorch implementation of "Grounding DINO: Marrying DINO with Grounded Pre-Training for Open-Set Object Detection": the SoTA open-set object detector.
2023/04/15
: Refer to CV in the Wild Readings for those who are interested in open-set recognition!2023/04/08
: We release demos to combine Grounding DINO with GLIGEN for more controllable image editings.2023/04/08
: We release demos to combine Grounding DINO with Stable Diffusion for image editings.2023/04/06
: We build a new demo by marrying GroundingDINO with Segment-Anything named Grounded-Segment-Anything aims to support segmentation in GroundingDINO.2023/03/28
: A YouTube video about Grounding DINO and basic object detection prompt engineering. [SkalskiP]2023/03/28
: Add a demo on Hugging Face Space!2023/03/27
: Support CPU-only mode. Now the model can run on machines without GPUs.2023/03/25
: A demo for Grounding DINO is available at Colab. [SkalskiP]2023/03/22
: Code is available Now!(image, text)
pair as inputs.900
(by default) object boxes. Each box has similarity scores across all input words. (as shown in Figures below.)box_threshold
.text_threshold
as predicted labels.dogs
in the sentence two dogs with a stick.
, you can select the boxes with highest text similarities with dogs
as final outputs..
for Grounding DINO.
Note:
If you have a CUDA environment, please make sure the environment variable CUDA_HOME
is set. It will be compiled under CPU-only mode if no CUDA available.
Installation:
Clone the GroundingDINO repository from GitHub.
git clone https://github.com/IDEA-Research/GroundingDINO.git
Change the current directory to the GroundingDINO folder.
cd GroundingDINO/
Install the required dependencies in the current directory.
pip3 install -q -e .
Create a new directory called "weights" to store the model weights.
mkdir weights
Change the current directory to the "weights" folder.
cd weights
Download the model weights file.
wget -q https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
Check your GPU ID (only if you're using a GPU)
nvidia-smi
Replace {GPU ID}
, image_you_want_to_detect.jpg
, and "dir you want to save the output"
with appropriate values in the following command
CUDA_VISIBLE_DEVICES={GPU ID} python demo/inference_on_a_image.py \
-c /GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py \
-p /GroundingDINO/weights/groundingdino_swint_ogc.pth \
-i image_you_want_to_detect.jpg \
-o "dir you want to save the output" \
-t "chair"
[--cpu-only] # open it for cpu mode
See the demo/inference_on_a_image.py
for more details.
Running with Python:
from groundingdino.util.inference import load_model, load_image, predict, annotate
import cv2
model = load_model("groundingdino/config/GroundingDINO_SwinT_OGC.py", "weights/groundingdino_swint_ogc.pth")
IMAGE_PATH = "weights/dog-3.jpeg"
TEXT_PROMPT = "chair . person . dog ."
BOX_TRESHOLD = 0.35
TEXT_TRESHOLD = 0.25
image_source, image = load_image(IMAGE_PATH)
boxes, logits, phrases = predict(
model=model,
image=image,
caption=TEXT_PROMPT,
box_threshold=BOX_TRESHOLD,
text_threshold=TEXT_TRESHOLD
)
annotated_frame = annotate(image_source=image_source, boxes=boxes, logits=logits, phrases=phrases)
cv2.imwrite("annotated_image.jpg", annotated_frame)
Web UI
We also provide a demo code to integrate Grounding DINO with Gradio Web UI. See the file demo/gradio_app.py
for more details.
Notebooks
name | backbone | Data | box AP on COCO | Checkpoint | Config | |
---|---|---|---|---|---|---|
1 | GroundingDINO-T | Swin-T | O365,GoldG,Cap4M | 48.4 (zero-shot) / 57.2 (fine-tune) | GitHub link | HF link | link |
2 | GroundingDINO-B | Swin-B | COCO,O365,GoldG,Cap4M,OpenImage,ODinW-35,RefCOCO | 56.7 | GitHub link | HF link | link |
Includes: a text backbone, an image backbone, a feature enhancer, a language-guided query selection, and a cross-modality decoder.
Our model is related to DINO and GLIP. Thanks for their great work!
We also thank great previous work including DETR, Deformable DETR, SMCA, Conditional DETR, Anchor DETR, Dynamic DETR, DAB-DETR, DN-DETR, etc. More related work are available at Awesome Detection Transformer. A new toolbox detrex is available as well.
Thanks Stable Diffusion and GLIGEN for their awesome models.
If you find our work helpful for your research, please consider citing the following BibTeX entry.
@article{liu2023grounding,
title={Grounding dino: Marrying dino with grounded pre-training for open-set object detection},
author={Liu, Shilong and Zeng, Zhaoyang and Ren, Tianhe and Li, Feng and Zhang, Hao and Yang, Jie and Li, Chunyuan and Yang, Jianwei and Su, Hang and Zhu, Jun and others},
journal={arXiv preprint arXiv:2303.05499},
year={2023}
}
FAQs
open-set object detector
We found that groundingdino-py demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.