inference
Use GroundingDINO for single-image open-vocabulary detection, Python inference APIs, token spans, annotation, device selection, and output interpretation.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- inference
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use GroundingDINO for single-image open-vocabulary detection, Python inference APIs, token spans, annotation, device selection, and output interpretation.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md5.3 KB
- 参考文档references/token-spans.md4.3 KB
- 参考文档references/troubleshooting.md5.6 KB
- 参考文档references/workflows.md5.7 KB
- 脚本scripts/grounding_dino_infer.py15.6 KB
03 SKILL.md 正文
GroundingDINO Inference
Use this sub-skill when a user needs single-image GroundingDINO inference with text prompts, class lists, token spans, annotated output images, or Python API integration.
Use This For
- Loading a GroundingDINO config/checkpoint and one image for open-vocabulary object detection.
- Choosing between
groundingdino.util.inferencefunctions and theModelwrapper API. - Building prompts from free-form captions or class lists such as
cat . dog . person .. - Using token spans to target exact phrases inside a sentence prompt.
- Interpreting normalized
cxcywhboxes, pixelxyxyannotations, logits/confidence, and phrases. - Running the bundled CLI helper in
scripts/grounding_dino_infer.pywith explicit input validation.
Route Elsewhere
- COCO AP and benchmark evaluation: use
../evaluation/. - Folder pseudo-label export or COCO-format dataset creation: use
../dataset-annotation/. - Gradio, Hugging Face demo, Grounded-SAM, GLIGEN, or image-editing pipelines: use
../integrations/. - Training or fine-tuning: treat as an unsupported gap because GroundingDINO training code is not released in this repo skill.
Quick Start
Prefer the bundled helper for one-off runs because it validates config, checkpoint, image, token spans, thresholds, and device before loading the model:
python sub-skills/inference/scripts/grounding_dino_infer.py \
--config-file /path/to/GroundingDINO_SwinT_OGC.py \
--checkpoint-path /path/to/groundingdino_swint_ogc.pth \
--image-path /path/to/image.jpg \
--text-prompt "chair . person . dog ." \
--output-dir outputs/grounding-dino \
--box-threshold 0.35 \
--text-threshold 0.25 \
--device cuda \
--json-output
For CPU-only checks, add --cpu-only. For class-list prompts, use --classes cat dog "traffic light" instead of --text-prompt. For span-targeted phrases, use --text-prompt plus --token-spans; see references/token-spans.md.
References
references/api-reference.md: function signatures, wrapper API, inputs, outputs, and box formats.references/workflows.md: CLI helper recipes, Python API recipes, validation commands, and output interpretation.references/token-spans.md: token span schema, offset validation, examples, and failure signals.references/troubleshooting.md: missing files, CPU/CUDA,_Ccustom op errors, no detections, and malformed prompts/spans.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).