Vision Events

Record, query, and manage time-series vision events from your computer vision deployments using the Python SDK.

The Roboflow Python SDK provides methods for working with vision events on the Workspace object. You can create events, query them with filters and pagination, upload images, and manage use cases.

For full details on event schemas, filtering options, and response formats, see the Vision Events REST API documentation.

Quick Start

import roboflow

roboflow.login()

rf = roboflow.Roboflow()
ws = rf.workspace()

# Create a use case
result = ws.create_vision_event_use_case("manufacturing-qa")
use_case_id = result["id"]

# Upload an image
img = ws.upload_vision_event_image("photo.jpg")

# Create an event with the uploaded image
ws.write_vision_event({
    "eventId": "c3d4e5f6-a1b2-4c3d-8e5f-6a7b8c9d0e1f",
    "eventType": "quality_check",
    "useCaseId": use_case_id,
    "timestamp": "2024-01-15T10:30:00Z",
    "images": [{"sourceId": img["sourceId"]}],
    "eventData": {"result": "pass"},
})

# Query events
for page in ws.query_all_vision_events(use_case_id):
    for evt in page:
        print(evt["eventId"], evt["eventType"])

Available Methods

Method
Description

Upload an image for use in events

Create a single vision event

Create up to 100 events in one request

Query events with filters and pagination

Auto-paginating query across all matching events

List use cases in your workspace

Create a new use case

Get discovered custom metadata field types

Last updated

Was this helpful?