Upload a Vision Event Image
import roboflow
roboflow.login()
rf = roboflow.Roboflow()
ws = rf.workspace()
# Upload an image
result = ws.upload_vision_event_image("inspection-photo.jpg")
source_id = result["sourceId"]
# You can also provide an optional name and metadata
result = ws.upload_vision_event_image(
"inspection-photo.jpg",
name="line-a-check-001",
metadata={"camera": "cam-1", "shift": "morning"},
)ws.write_vision_event({
"eventId": "d4e5f6a7-b2c3-4d4e-9f6a-7b8c9d0e1f2a",
"eventType": "quality_check",
"useCaseId": "a1b3c8e1",
"timestamp": "2024-01-15T10:30:00Z",
"images": [
{
"sourceId": source_id,
"label": "inspection-photo",
"objectDetections": [
{"class": "defect", "x": 100, "y": 200, "width": 50, "height": 30, "confidence": 0.95}
],
}
],
"eventData": {"result": "fail"},
})Last updated
Was this helpful?