Skip to main content

Roboflow object detection plugin for Vision Agents

Project description

Roboflow Plugin

Object detection using Roboflow's hosted inference API for vision-agents.

Installation

uv add vision-agents-plugins-roboflow

Quick Start

from vision_agents.plugins import roboflow
from vision_agents.core import Agent

# A Roboflow processor for cloud inference and
# pre-trained models from Roboflow Universe https://universe.roboflow.com/.
processor = roboflow.RoboflowCloudDetectionProcessor(
    api_key="your_api_key",  # or set ROBOFLOW_API_KEY env var
    api_url="https://detect.roboflow.com",  # or set ROBOFLOW_API_URL env var
    model_id="football-players-detection-3zvbc/20",
    classes=["player"],
    conf_threshold=0.5,
    fps=3,
)

# You can also use a Roboflow processor with local inference and RF-DETR models.
processor = roboflow.RoboflowLocalDetectionProcessor(
    model_id="rfdetr-seg-preview",
    conf_threshold=0.5,
    classes=["person"],
    fps=3,
    # You can pass a custom model as "model" parameter here.
    # The model must be an instance of `rfdetr.RFDETR()` class.
    # model=MyRF_DETRModel()
)

# Use in an agent
agent = Agent(
    processors=[processor],
    llm=your_llm,
    # ... other components
)

Full Example

See example/roboflow_example.py for a complete working example with a video call agent that uses Roboflow detection.

RoboflowCloudDetectionProcessor Configuration

  • model_id: Roboflow Universe model id. Example - "football-players-detection-3zvbc/20".
  • api_key: Roboflow API key. If not provided, will use ROBOFLOW_API_KEY env variable.
  • api_url: Roboflow API url. If not provided, will use ROBOFLOW_API_URL env variable.
  • conf_threshold: Confidence threshold for detections (0 - 1.0). Default - 0.5.
  • fps: Frame processing rate. Default - 5.
  • classes: an optional list of class names to be detected. Example - ["person", "sports ball"] Verify that the classes a supported by the given model. Default - None (all classes are detected). annotate: if True, annotate the detected objects with boxes and labels. Default - True.
  • dim_background_factor: how much to dim the background around detected objects from 0 to 1.0. Effective only when annotate=True. Default - 0.0 (no dimming).
  • client: an optional custom instance of inference_sdk.InferenceHTTPClient.

RoboflowLocalDetectionProcessor Configuration

  • model_id: identifier of the model to be used. Available models are: "rfdetr-base", "rfdetr-large", "rfdetr-nano", "rfdetr-small", "rfdetr-medium", " rfdetr-seg-preview". Default - "rfdetr-seg-preview".

  • conf_threshold: Confidence threshold for detections (0 - 1.0). Default - 0.5.

  • fps: Frame processing rate. Default - 10.

  • classes: optional list of class names to be detected. Example: ["person", "sports ball"] Verify that the classes a supported by the given model. Default - None (all classes are detected).

  • annotate: if True, annotate the detected objects with boxes and labels. Default - True.

  • dim_background_factor: how much to dim the background around detected objects from 0 to 1.0. Effective only when annotate=True. Default - 0.0 (no dimming).

  • model: optional instance of RFDETRModel to be used for detections. Use it provide a model of choosing with custom parameters.

Testing

# Run all tests
pytest plugins/roboflow/tests/ -v

# Run specific tests
pytest plugins/roboflow/tests/test_roboflow.py -v

Dependencies

  • vision-agents - Core framework
  • numpy>=2.0.0 - Array operations
  • rfdetr>=1.3.0 - RF-DETR models for local object detection
  • inference-sdk>=0.26.1 - Roboflow SDK for cloud inference

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vision_agents_plugins_roboflow-0.3.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vision_agents_plugins_roboflow-0.3.2-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file vision_agents_plugins_roboflow-0.3.2.tar.gz.

File metadata

  • Download URL: vision_agents_plugins_roboflow-0.3.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vision_agents_plugins_roboflow-0.3.2.tar.gz
Algorithm Hash digest
SHA256 4730607612f02aef9b19b42b854055ba9228f8adce913713a947a7da697780c8
MD5 a5a51f716b263ee0b1affe499f4e3f73
BLAKE2b-256 ab58bf657121da5327faf9a6d1fd3c1d537929cbdfdb0761f830e63647be0f44

See more details on using hashes here.

File details

Details for the file vision_agents_plugins_roboflow-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: vision_agents_plugins_roboflow-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vision_agents_plugins_roboflow-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f600cd1a443d9a465fe0df88d730602baaebb62693f7e82264c4e505a7c536c
MD5 2826fb2684d560b48ffd775e7a2a84c5
BLAKE2b-256 70df37af4c4160da3d85f103f6cd8ba7843beb78e85c2038dd52292c37ff9614

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page