Vision Event 画像をアップロード
ワークスペースレベルの画像をアップロードし、Vision Event を作成するときにその sourceId を参照します。
概要
このエンドポイントは、 ビジョンイベントで使用する画像をワークスペースにアップロードします。アップロードはワークスペースレベルで行われ、特定のプロジェクトには紐付けられません。返された sourceId は、 images 配列で参照でき、 イベントを作成するときに使用できます。モデルが処理した元のフレームや出力フレームを添付すると、イベントとともに表示できます。
HTTP API
ビジョンイベントで使用する画像をアップロードします。これはワークスペースレベルのアップロードであり、特定のプロジェクトには関連付けられません。返された sourceId は、イベントの作成時に images 配列で参照できます。
必須スコープ: vision-events:write または device:update
Upload an image for use in vision events. The image is stored in the workspace, not in a project. Requires the vision-events:write or device:update scope.
Roboflow API key passed as a Bearer token.
Custom name for the image. The name form field wins when you send both.
The image file to upload. Supported formats are JPEG, PNG, WebP, GIF, TIFF, BMP, HEIC, and AVIF. Any form field name works for the file.
Custom name for the image.
inspection-photo.jpgJSON object string of custom metadata for the image. Same limits as event customMetadata. Max 100 keys. Keys must match [a-zA-Z0-9_ -]+, max 100 characters. Values are a string (max 1000 characters), a number, or a boolean. Keys that start with rf_internal are reserved for Roboflow and are rejected.
{"camera": "cam-1", "shift": "morning"}Image uploaded successfully.
Reference ID. Put it in images[].sourceId when you create an event.
Public URL of the uploaded image.
The body is not multipart/form-data, it has no file, or metadata is not valid JSON or breaks its limits.
Insufficient permissions for this resource.
POST /vision-events/upload HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: multipart/form-data
Accept: */*
Content-Length: 108
{
"file": "binary",
"name": "inspection-photo.jpg",
"metadata": "{\"camera\": \"cam-1\", \"shift\": \"morning\"}"
}{
"success": true,
"sourceId": "Pq7sV2kWx9LmN4rT6yZb",
"url": "https://storage.googleapis.com/roboflow-platform-sources/Xk2mP9qLr4TzW8vN1bYc/Pq7sV2kWx9LmN4rT6yZb/original.jpg"
}返された sourceId を images[].sourceId に指定して、 ビジョンイベントを作成します.
Python SDK
ビジョンイベントで使用するローカル画像をアップロードします。返された sourceId は、イベントの作成時に images 配列で参照できます。
レスポンスの sourceId は、 images 配列で、 ビジョンイベントを作成する際に使用します:
サポートされている画像形式とメタデータの制約については、 REST APIリファレンスを参照してください.
最終更新
役に立ちましたか?