コンテンツへスキップ
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Vision Event を作成

HTTP API 経由で 1 件の Vision Event を記録し、デプロイしたモデルからの観測をログに残します。

概要

1つの ビジョンイベント とは、デプロイ済みのコンピュータービジョンモデルが観測した事象(検出された欠陥や在庫数など)を、タイムスタンプ付きで記録したものです。画像、予測結果、カスタムメタデータを任意で添付できます。このページでは、単一のイベントを記録し、検索やフィルタリングが可能な本番環境の履歴に追加する方法を説明します。一度に多数のイベントを取り込むには、 ビジョンイベントの一括作成を使用してください。デプロイ環境からクラウドへの経路がない場合は、 ビジョンイベントバンドルのアップロード.

HTTP API

コンピュータービジョンのデプロイ環境での観測結果を記録するには、単一のビジョンイベントを作成します。

必須スコープ: vision-events:write または device:update

Create a Vision Event

post

Create a single vision event. Only eventId, eventType, useCaseId, and timestamp are strictly checked. Problems in other fields are returned as warnings, and the event is still stored. Sending an eventId that already exists replaces the earlier event. Requires the vision-events:write or device:update scope.

認可
Authorizationstring必須

Roboflow API key passed as a Bearer token.

本文
eventIdstring · 最大: 256必須

Globally unique identifier. Use a UUID (v4). An event sent with an eventId that already exists overwrites the earlier event.

eventTypestring · enum必須可能な値:
useCaseIdstring · 最大: 256必須

The use case this event belongs to. An ID that matches no active use case in the workspace (ex: an archived one) still stores the event, with an entity_not_found warning.

timestampstring · date-time必須

ISO 8601 timestamp. A timestamp more than one year old or later than tomorrow is stored, but returns an invalid_value warning.

deviceIdstring · 最大: 256オプション

Identifier for the device that generated the event.

streamIdstring · 最大: 256オプション

Identifier for the video stream.

workflowIdstring · 最大: 256オプション

Identifier for the workflow that generated the event.

workflowVersionstring · 最大: 64オプション

Version of the workflow.

displayImagePositioninteger · 最大: 999オプション

Index in images of the image to show as the main display image (ex: 0 for the first image, 1 for the second).

autoFinalizedAtstring · date-timeオプション

Set by Edge Device Backup when the device closed the event before its video finished uploading, so the video is missing.

eventDataone of必須

Type-specific event data. Use the schema whose name matches eventType.

または
または
または
または
commentstring · 最大: 1000オプション

A note about the event. With operator_feedback, this holds the reviewer's note.

valueBaseUnitsinteger · 最小: -10000000000 · 最大: 10000000000オプション

The event's money value in the smallest unit of the use case currency (ex: cents for USD). If omitted, the use case default applies. An invalid value is dropped with an ingestion warning. operator_feedback events never carry a value.

Example: 1999
valueCurrencystring読み取り専用オプション

The currency of valueBaseUnits, taken from the use case. Returned on queried events that have a value. Events cannot set it.

Example: USD
レスポンス
201

Event created successfully.

application/json
eventIdstringオプション
createdbooleanオプション
deprecationsstring[]オプション

Deprecated field names used in the request.

post/vision-events
POST /vision-events HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 263

{
  "eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "eventType": "quality_check",
  "useCaseId": "a1b3c8e1",
  "timestamp": "2024-01-15T10:30:00Z",
  "eventData": {
    "result": "fail",
    "externalId": "batch-001"
  },
  "customMetadata": {
    "line": "A1",
    "operator": "John Doe",
    "temperature": 72.5
  }
}
{
  "eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "created": true,
  "warnings": [
    {
      "type": "invalid_value",
      "path": "eventData.result",
      "value": "failed",
      "valueType": "string"
    }
  ]
}

画像のメタデータ

使用します metadata を画像オブジェクトに指定すると、その画像だけに属する値(合否判定、シリアル番号、カメラの角度など)を記録できます。値はイベント詳細ビューで画像とともに表示されます。イベント全体を説明する値を付加するには、代わりに customMetadata を使用します。

次の条件を満たさないキーは metadata 上限を超えた値は破棄され、次の場所に報告されます。 warnings 配列に記録されます。画像の残りの部分は引き続き保存されます。

イベントで使用されているキーを確認するには、次を呼び出します。 画像メタデータスキーマを取得。これらのキーでイベントをフィルタリングするには、次を使用します。 imageMetadataFilters の イベントをクエリ.

検証と警告

Vision Events API は先行取り込み方式を採用しています。必須フィールドのうち、厳密に検証されるのは次の4つのみです(eventId, eventType, useCaseId, timestamp)。これらの検証に通れば、ほかのフィールドにエラーが含まれていても、イベントは必ず受け付けられ、保存されます。

必須ではないフィールドに問題がある場合は、リクエストが拒否されるのではなく、レスポンスの warnings 配列に返されます。これには次のものが含まれます。

  • 次の中の必須フィールドの欠落 eventData (例: relatedEventId の operator_feedback)

  • 次の値が無効です: eventData フィールド(例: severity)

  • スキーマに含まれていない未認識のフィールド

警告がある場合、無効な eventData は空のオブジェクトとして保存されます {}が、イベント自体は作成されます。

レスポンスには、非推奨のフィールド名が使用された場合、 deprecations 配列が含まれることもあります。

Python SDK

コンピュータービジョンのデプロイ環境での観測結果を記録するには、単一のビジョンイベントを作成します。

イベントのペイロードはクライアント側で検証されず、そのままサーバーに渡されるため、SDKを更新しなくても新しいイベントタイプやフィールドを使用できます。

必須フィールド:

  • eventId (文字列、最大256文字):グローバルに一意な識別子。UUID(v4)を使用します。

  • eventType (文字列):次のいずれかです。 quality_check, inventory_count, safety_alert, custom、または operator_feedback.

  • useCaseId (文字列):このイベントが属するユースケース。

  • timestamp (文字列、ISO 8601):イベントが発生した日時。

任意フィールド:

  • eventData (辞書):イベントタイプ固有のデータ。

  • deviceId, streamId, workflowId (文字列):コンテキスト識別子。

  • images (リスト):アノテーション付きの画像オブジェクト。「 Visionイベント画像をアップロード.

  • videos (リスト):動画オブジェクト。各 sourceId から取得します Vision Event Video をアップロードする.

  • customMetadata (辞書):カスタムメタデータのキーと値のペアを最大100個指定します。

  • comment (文字列):イベントに関するメモ。主に operator_feedback.

イベントの完全なスキーマ、タイプ別のイベントデータ構造、画像アノテーション形式については、 REST API リファレンスを参照してください.

最終更新

役に立ちましたか?