GroundingDINO
Python template · sinapsis_huggingface_grounding_dino.templates.grounding_dino
Overview
Base class for Grounding DINO models.
This module contains the foundational class for implementing object detection using the Grounding DINO model, leveraging transformers and PyTorch. It provides essential methods for running inference, formatting results, and creating annotations, which can be extended by other specialized classes related to Grounding DINO.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
Terminalbash
pip install sinapsis-huggingface-grounding-dino==1.0.0uv pip install sinapsis-huggingface-grounding-dino==1.0.0uv add sinapsis-huggingface-grounding-dino==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
deviceRequired
typing.Literal['cuda', 'cpu']
Required
Default: null
Required
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
Optional
Default: null
threshold
float
Optional
Default: 0.25
Optional
Default: 0.25
model_path
typing.Literal['IDEA-Research/grounding-dino-base']
Optional
Default: "IDEA-Research/grounding-dino-base"
Optional
Default: "IDEA-Research/grounding-dino-base"
text_inputRequired
Input text for GroundingDINO processing.
str
Required
Default: null
Required
Default: null
inference_modeRequired
typing.Literal['object_detection', 'zero_shot']
Required
Default: null
Required
Default: null
text_threshold
float
Optional
Default: 0.25
Optional
Default: 0.25
model_cache_dir
str
Optional
Default: "/home/ariel/.cache/sinapsis"
Optional
Default: "/home/ariel/.cache/sinapsis"
Configuration example
Example from the Python docstring:
yaml
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: GroundingDINO
class_name: GroundingDINO
template_input: InputTemplate
attributes:
model_path: '/path/to/model'
model_cache_dir: /path/to/cache/dir
inference_mode: 'object_detection'
threshold: 0.25
text_threshold: 0.25
device: 'cuda'
text_input: 'object to detect'Show schema-based configuration skeleton
yaml
templates:
- template_name: "GroundingDINO"
class_name: "GroundingDINO"
attributes:
device: "<required>"
threshold: 0.25
model_path: "IDEA-Research/grounding-dino-base"
text_input: "<required>"
inference_mode: "<required>"
text_threshold: 0.25
model_cache_dir: "/home/ariel/.cache/sinapsis"
Inheritance
Immediate parent:
sinapsis_core.template_base.template.TemplateEnvironment variables
Environment definitions belong to their canonical Python modules.