Skip to main content

sp




Sinapsis Hugging Face Grounding DINO

Templates for seamless integration with Grounding DINO models

🐍 Installation • 📦 Features • ▶️ Example Usage • 🌐 Webapp • 📙 Documentation • 🔍 License

🐍 Installation

Install using your package manager of choice. We encourage the use of uv

Example with uv:

  uv pip install sinapsis-huggingface-grounding-dino --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-huggingface-grounding-dino --extra-index-url https://pypi.sinapsis.tech

[!IMPORTANT] Templates may require extra optional dependencies. For development, we recommend installing the package with all the optional dependencies:

with uv:

  uv pip install sinapsis-huggingface-grounding-dino[all] --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-huggingface-grounding-dino[all] --extra-index-url https://pypi.sinapsis.tech

📦 Features

The templates in this package include functionality for different Grounding DINO-based tasks:

  • GroundingDINO: Detect objects with bounding boxes based on text prompts (zero-shot object detection).
  • GroundingDINOClassification: Classify images using predefined classes or text prompts, handling as many classes as possible within token limits.
  • GroundingDINOFineTuning: Fine-tune Grounding DINO checkpoints on custom datasets.

▶️ Example Usage

Below is an example YAML configuration for zero-shot object detection using Grounding DINO.

Config
agent:
  name: grounding_dino_detection

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  - template_name: FolderImageDatasetCV2
    class_name: FolderImageDatasetCV2
    template_input: InputTemplate
    attributes:
      data_dir: my_dataset

  - template_name: GroundingDINO
    class_name: GroundingDINO
    template_input: FolderImageDatasetCV2
    attributes:
      model_path: IDEA-Research/grounding-dino-base
      inference_mode: zero_shot
      text_input: a person.
      device: cuda
      threshold: 0.2
      text_threshold: 0.3

  - template_name: BBoxDrawer
    class_name: BBoxDrawer
    template_input: GroundingDINO
    attributes:
      overwrite: true
      randomized_color: false

  - template_name: ImageSaver
    class_name: ImageSaver
    template_input: BBoxDrawer
    attributes:
      save_dir: ./output_dir
      extension: png

[!IMPORTANT] The FolderImageDatasetCV2, BBoxDrawer and ImageSaver templates correspond to the sinapsis-data-readers, sinapsis-data-visualization and sinapsis-data-writers packages respectively. If you want to use the example, please make sure you install these packages.

To run the config, use the CLI:

sinapsis run name_of_config.yml

🌐 Webapp

Th Sinapsis web applications provide an interactive way to explore and experiment with AI models. They allow users to generate outputs, test different inputs, and visualize results in real time, making it easy to experience the capabilities of each model. Below are the available webapps and instructions to launch them.

[!IMPORTANT] To run any of the apps, you first need to clone this repo:

git clone git@github.com:Sinapsis-ai/sinapsis-huggingface.git
cd sinapsis-huggingface

[!NOTE] If you'd like to enable external app sharing in Gradio, export GRADIO_SHARE_APP=True.

[!NOTE] Agent configuration can be changed through the AGENT_CONFIG_PATH env var. You can check the available configurations in each package configs folder.

🐳 Build with Docker

IMPORTANT The docker image depends on the sinapsis-nvidia:base image. To build it, refer to the [official sinapsis documentation](https://

  1. Build the sinapsis-huggingface image:
docker compose -f docker/compose.yaml build
  1. Start the container:
docker compose -f docker/compose_vision.yaml up sinapsis-huggingface-vision-gradio -d
  1. Check the status:
docker logs -f sinapsis-huggingface-vision-gradio
  1. The logs will display the URL to access the webapp, e.g.,:
Running on local URL:  http://127.0.0.1:7860

NOTE: The local URL can be different, please check the logs

  1. To stop the app:
docker compose -f docker/compose_vision.yaml down
📦 UV
  1. Create the virtual environment and sync the dependencies:
uv sync --frozen
  1. Install the dependencies:
uv pip install sinapsis-huggingface[all] --extra-index-url https://pypi.sinapsis.tech
  1. Run the webapp.
uv run webapps/vision_demo.py
  1. The terminal will display the URL to access the webapp, e.g., :
Running on local URL:  http://127.0.0.1:7860

📙 Documentation

Documentation is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

Metadata

Release files for sinapsis-huggingface-grounding-dino 0.1.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sinapsis-huggingface-grounding-dino 0.1.12
File Size Uploaded
sinapsis_huggingface_grounding_dino-0.1.12.tar.gz 25.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sinapsis-huggingface-grounding-dino 0.1.12
File Interpreter ABI Platform
sinapsis_huggingface_grounding_dino-0.1.12-py3-none-any.whl Python 3 none any Details

Total release size: 50.4 kB

Release files / sinapsis_huggingface_grounding_dino-0.1.12.tar.gz

Download URL sinapsis_huggingface_grounding_dino-0.1.12.tar.gz
Size 25.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3e4601ee24bbfb1ee00b834ad115ed470780562fb4a312dfb21a66d0ff42622a
BLAKE2b-256 checksum
How to use checksums
9208bda7663b71c62f92606cf41e6f45d631b2e6a382774ea2c3b394b739565d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release files / sinapsis_huggingface_grounding_dino-0.1.12-py3-none-any.whl

Download URL sinapsis_huggingface_grounding_dino-0.1.12-py3-none-any.whl
Size 25.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f65a7603a39ff2116f278a50172aaee652d87e2f7ff6f66e97061b0196a7781b
BLAKE2b-256 checksum
How to use checksums
f2ea2c6539d31f1160d3b3ed34cc646a66c05aaa68518b82c4b76ede97f723c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.16

Release history Release notifications | RSS feed

This release

0.1.12 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page