バッチ処理
クラウドインフラを用いて、大量の画像や保存済み動画に対して Workflow を実行します。
概要
バッチ処理は、実行するための費用対効果の高い方法です ワークフロー 画像のバッチや保存済み動画に対して行えます。大量のデータを非同期で処理するのに最適です。
バッチ処理は、大規模なバッチを実行するために必要なインフラを自動的にプロビジョニングします。
バッチ処理ジョブは、RoboflowのWebインターフェースまたはAPI(CLI経由)で設定できます。
ジョブを開始すると、データを処理するためのマシンがクラウド上にプロビジョニングされます。その後、実行対象として選択したワークフローの出力を含むJSONファイルを受け取ります。
ジョブはCPUまたはGPUマシンで実行されます。GPUジョブは高速ですが、費用が高くなります。参照: Roboflowの料金. ジョブにかかる時間は、処理する画像や動画の数、ワークフローの複雑さ、マシンの種類によって異なります。一般的な問題については、参照: トラブルシューティング.
次の動画ではバッチ処理を詳しく説明しています:
Webアプリ
左側のサイドバーで「Deployments」を開き、「Batch Processing」タブを選択します。

「New Batch Job」をクリックし、次の手順に従います:
選択 ワークフロー.
処理する画像または動画をアップロードします。
CPUまたはGPUのハードウェアを選択します。変更が必要な場合を除き、「Advanced Options」はデフォルトのままにしてください。
「Create Batch Job」をクリックします。

ジョブ一覧には各ジョブの進捗がリアルタイムで表示されます。このタブから開始したジョブはActivity Centerにも表示され、そこではあなただけが見ることができます。ジョブをクリックすると詳細が開きます。「Source and type」には、どの画像で実行されたかが表示されます: アセットライブラリ それらを選択した検索クエリ、「Open in Asset Library」リンク、または手動で選択した画像数です。
アセットライブラリから
の中で アセットライブラリ、画像を選択するか、検索条件に一致するすべての画像を選択してから、「Run Workflow」をクリックします。参照: ワークフローの実行 結果を画像に書き戻す方法を含む全体の流れについて。
エージェントから
指示する Roboflow Agent に、公開済みワークフローをアセットライブラリの画像に対して実行させます。選択した画像、検索条件に一致する画像、またはライブラリ全体を対象にできます。ジョブの状況を報告することもでき、ジョブが完了するとチャットで通知します。開始したジョブはBackground Tasksにも表示されます。
Agentは、Batch Processingをチャットタブとして開くこともできます。新しいジョブフォームでは、Agentが同意したワークフローと設定を入力しますが、ファイルの選択はご自身のコンピュータから行います。
Datasourceがミラーリングされるたびに自動で
たびに毎回 データソース ミラーリングされると、バッチ処理ジョブは取り込んだ新しい画像に対してワークフローを実行できます(例: タグや事前ラベルを最新に保つため)。「Workflow runs」セクションの データソース ページで「Add workflow run」をクリックします。「Run when」で「On Sync」を選択し、トリガーとなるデータソースを選択します。ワークフローにはちょうど1つの 画像 入力が必要です。
結果を検索可能にするには、参照: 結果をアセットライブラリに書き戻す.
HTTP API
クイックリンク:
データを取り込む (動画、単一画像、画像)
バッチのステータスを確認 (アイテム数、シャードの詳細)
ジョブの進捗を監視 (ジョブの状態、ステージ、タスク)
結果をエクスポート (出力パーツ、ダウンロードURL)
データを取り込む
動画をアップロード
Request a signed URL to upload a video file. After receiving the response, PUT the video to the uploadURL with the provided extensionHeaders.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Name of the video file (e.g. my_video.mp4).
Signed URL details for uploading the video.
okPOST /data-staging/v1/external/{workspace}/batches/{batch_id}/upload/video?fileName=text HTTP/1.1
Host: api.roboflow.com
Accept: */*
Signed URL details for uploading the video.
{
"status": "ok",
"signedURLDetails": {
"uploadURL": "text",
"method": "PUT",
"extensionHeaders": {
"Content-Type": "application/octet-stream",
"x-goog-content-length-range": "1,1073741824"
},
"maxFileSize": 1073741824
}
}画像をアップロード
Upload a single image via multipart form data. Best for batches up to 5,000 images.
Note: Single-image and bulk uploads cannot be combined for the same batch.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Name of the image file.
The image file to upload.
Image uploaded successfully.
okPOST /data-staging/v1/external/{workspace}/batches/{batch_id}/upload/image?fileName=text HTTP/1.1
Host: api.roboflow.com
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17
{
"file": "binary"
}Image uploaded successfully.
{
"status": "ok"
}画像を一括アップロード
Request a signed URL for uploading a .tar archive of images. Recommended for batches exceeding 5,000 images. Bundle up to 500 images per archive.
The response contains a signed URL and extension headers. Pack images into a .tar archive and PUT it to the signed URL.
Note: Bulk and single-image uploads cannot be combined for the same batch.
When performing bulk ingestion, data is indexed in the background. There may be a short delay before all data is available.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Signed URL details for uploading a tar archive.
okPOST /data-staging/v1/external/{workspace}/batches/{batch_id}/bulk-upload/image-files HTTP/1.1
Host: api.roboflow.com
Accept: */*
Signed URL details for uploading a tar archive.
{
"status": "ok",
"signedURLDetails": {
"shardId": "123e4567-e89b-12d3-a456-426614174000",
"uploadURL": "text",
"method": "PUT",
"extensionHeaders": {
"Content-Type": "application/x-tar",
"x-goog-content-length-range": "1,536870912"
},
"maxNumberOfImages": 500,
"maxShardSize": 536870912
}
}バッチのステータスを確認
Returns the count of ingested items in a batch. Use this to verify all data has been ingested before starting a job.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Batch item count.
okNumber of items in the batch.
42GET /data-staging/v1/external/{workspace}/batches/{batch_id}/count HTTP/1.1
Host: api.roboflow.com
Accept: */*
Batch item count.
{
"status": "ok",
"count": 42
}シャードのアップロード詳細を確認
Returns shard details for a bulk-upload batch. Paginated — use nextPageToken from the response to fetch subsequent pages.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Pagination token from a previous response.
Paginated list of batch shards.
okList of shard objects.
Token for fetching the next page of results. null if no more pages.
GET /data-staging/v1/external/{workspace}/batches/{batch_id}/shards HTTP/1.1
Host: api.roboflow.com
Accept: */*
Paginated list of batch shards.
{
"status": "ok",
"shards": [
{}
],
"nextPageToken": "text"
}ジョブを開始
Start a batch processing job that runs a Workflow against staged data.
Job ID constraints: Lowercase letters, digits, hyphens, and underscores only. Maximum 20 characters.
Your Roboflow API key.
Your Roboflow workspace identifier.
Job identifier. Lowercase, max 20 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Job type.
Maximum cumulative machine runtime in seconds across all parallel workers.
3600Webhook URL for job completion notifications. Custom webhook headers are not yet supported. The only header sent is Authorization: Bearer rf_{workspace_id}.
Job started successfully.
okPOST /batch-processing/v1/external/{workspace}/jobs/{job_id} HTTP/1.1
Host: api.roboflow.com
Content-Type: application/json
Accept: */*
Content-Length: 415
{
"type": "simple-image-processing-v1",
"jobInput": {
"type": "staging-batch-input-v1",
"batchId": "text"
},
"computeConfiguration": {
"type": "compute-configuration-v2",
"machineType": "cpu",
"workersPerMachine": 4
},
"processingTimeoutSeconds": 3600,
"processingSpecification": {
"type": "workflows-processing-specification-v1",
"workspace": "text",
"workflowId": "text",
"aggregationFormat": "jsonl"
},
"notificationsURL": "https://example.com"
}Job started successfully.
{
"status": "ok"
}ジョブの進捗を監視
ジョブのステータスを取得
Returns the current status of a batch processing job.
Your Roboflow API key.
Your Roboflow workspace identifier.
Job identifier. Lowercase, max 20 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Job status details.
okCurrent job status (e.g. pending, processing, completed, failed).
Processing progress as a fraction between 0 and 1.
GET /batch-processing/v1/external/{workspace}/jobs/{job_id} HTTP/1.1
Host: api.roboflow.com
Accept: */*
Job status details.
{
"status": "ok",
"jobStatus": "text",
"progress": 1
}ジョブのステージを一覧表示
Returns the list of stages for a job. Each job typically has processing and export stages, each producing an output batch.
Your Roboflow API key.
Your Roboflow workspace identifier.
Job identifier. Lowercase, max 20 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$List of job stages.
okList of stage objects. Each stage has an ID and an output batch ID.
GET /batch-processing/v1/external/{workspace}/jobs/{job_id}/stages HTTP/1.1
Host: api.roboflow.com
Accept: */*
List of job stages.
{
"status": "ok",
"stages": [
{}
]
}ステージのタスクを一覧表示
Returns the list of tasks for a specific job stage. Paginated — use nextPageToken from the response to fetch subsequent pages.
Your Roboflow API key.
Your Roboflow workspace identifier.
Job identifier. Lowercase, max 20 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$The stage identifier.
Pagination token from a previous response.
Paginated list of tasks.
okList of task objects.
Token for fetching the next page of results. null if no more pages.
GET /batch-processing/v1/external/{workspace}/jobs/{job_id}/stages/{stage_id}/tasks HTTP/1.1
Host: api.roboflow.com
Accept: */*
Paginated list of tasks.
{
"status": "ok",
"tasks": [
{}
],
"nextPageToken": "text"
}結果をエクスポート
出力パーツを一覧表示
Lists the parts of an output batch. Use the export stage output batch for compressed results.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$List of batch parts.
okGET /data-staging/v1/external/{workspace}/batches/{batch_id}/parts HTTP/1.1
Host: api.roboflow.com
Accept: */*
List of batch parts.
{
"status": "ok",
"parts": [
{
"partName": "text"
}
]
}ダウンロードURLを一覧表示
Returns paginated download URLs for files in a batch part.
Your Roboflow API key.
Your Roboflow workspace identifier.
Batch identifier. Lowercase, max 64 chars: letters, digits, hyphens, underscores.
^[a-z0-9_-]+$Pagination token from a previous response.
Filter by part name (from the list parts response).
Paginated list of download URLs.
okToken for fetching the next page of results. null if no more pages.
GET /data-staging/v1/external/{workspace}/batches/{batch_id}/list HTTP/1.1
Host: api.roboflow.com
Accept: */*
Paginated list of download URLs.
{
"status": "ok",
"filesMetadata": [
{
"downloadURL": "text",
"fileName": "text",
"partName": "text",
"shardId": "text",
"contentType": "text",
"nestedContentType": "text"
}
],
"nextPageToken": "text"
}Webhook通知
ステータスをポーリングする代わりに、取り込みまたは処理が完了したときに通知を受け取るためにWebhookを使用できます。参照: CLIの使用方法 Webhookの設定とペイロード形式について。
CLI
使用する inference rf-cloud すでにあなたの アセットライブラリ、使用するには roboflow batch.
ローカルおよびクラウドファイル
セットアップ
ローカルまたはクラウドのファイルについては、Inference CLIをインストールします:
クラウドストレージのサポートについては:
APIキーの見つけ方については、こちらの 認証ガイド.
データを取り込む
画像
動画
クラウドストレージ
データがすでにクラウドストレージ(S3、Google Cloud Storage、またはAzure)にある場合、ファイルをローカルにダウンロードせずに直接処理できます。
画像の場合:
動画の場合:
この --bucket-path パラメータは次のプロバイダーをサポートしています。globパターンは、取り込むファイルを絞り込みます:
S3
s3://bucket-name/path/
s3://my-bucket/training-data/**/*.jpg: 再帰的にすべてのJPG
Google Cloud Storage
gs://bucket-name/path/
gs://my-bucket/videos/2024-*/*.mp4: のMP4 2024-* フォルダ
Azure Blob Storage
az://container-name/path/
az://container/images/*.png: imagesフォルダ内のPNG
大規模なデータセットでは、システムが画像を自動的に20,000ファイルずつのチャンクに分割します。動画は1,000件未満のバッチで最適に動作します。
署名付きURLによる取り込み
高度な自動化では、ローカルファイルの代わりに署名付きURL経由でデータを取り込むことができます:
--data-source references-file
署名付きURLで参照されるファイルを処理します。
--references <path_or_url>
ファイルURLを含むJSONLファイルへのパス、またはそのようなファイルを指す署名付きURL。
参照ファイルは JSONL:
ステージング済みデータを確認
ジョブを開始
画像を処理
動画を処理
ジョブの進捗を監視
開始コマンドはジョブIDを出力します。ステータスの確認に使用します:
結果をエクスポート
ジョブ詳細には出力バッチIDが含まれます。結果をエクスポートするにはそれを使用します:
Webhook自動化
ステータスをポーリングする代わりに、取り込みまたは処理が完了したときに通知を受け取るためにWebhookを使用できます。
データ取り込みWebhook
CLIコマンド create-batch-of-images と create-batch-of-videos は次をサポートしています:
--notifications-url <webhook_url>
通知用のWebhookエンドポイント。
--notification-category ingest-status
取り込みプロセス全体のステータス。デフォルト。
--notification-category files-status
個々のファイル処理ステータス。
通知は、 Authorization ヘッダーにRoboflowの公開キーを含めたHTTP POSTで送信されます。
取り込みステータス通知
ファイルステータス通知
ジョブ完了Webhook
追加 --notifications-url を、ジョブ開始時に指定します:
ジョブ完了通知
クラウドストレージ認証
AWS S3およびS3互換ストレージ
認証情報は次から自動的に検出されます:
環境変数:
AWS認証情報ファイル(
~/.aws/credentials,~/.aws/config)IAMロール(EC2、ECS、Lambda)
名前付きプロファイル:
S3互換サービスの場合(例: Cloudflare R2、MinIO):
Google Cloud Storage
認証情報は次から検出されます:
サービスアカウントキーのファイル(自動化には推奨):
gcloud CLIからのユーザー認証情報(
gcloud auth login)GCPメタデータサービス(Google Cloud Platform上で実行している場合)
Azure Blob Storage
SASトークン(推奨):
アカウントキー:
Azure CLIでSASトークンを生成します。 <expiry-utc> を、将来のUTC時刻の YYYY-MM-DDTHH:MMZ 形式で置き換えます:
カスタムスクリプト
高度なユースケースでは、署名付きURLファイルを生成するためのスクリプトを参照してください:
AWS S3: generateS3SignedUrls.sh
Google Cloud Storage: generateGCSSignedUrls.sh
Azure Blob Storage: generateAzureSasUrls.sh
すべてのオプションを確認
アセットライブラリの画像
置き換える <workspace-url> をワークスペースのスラッグ(例: my-workspace)に置き換えます。1つの 画像 入力を持つ公開済みワークフローを選択します。 source_idを除き、必要な他の入力にはデフォルト値を設定してください。Batch Processingが各画像ごとに入力します。
Roboflow CLIをインストールまたは更新し、 Roboflow CLIサインインして、ワークフローを一覧表示します:
公開済みワークフローの id をJSON出力から使用します。RoboQL検索で処理対象の画像を見つけます: RoboQL 検索:
検索結果の画像IDを --image-ids:
構造化フィルタに一致するすべての画像を処理するには、 --image-ids を --query "tag:night-shift"に置き換えます。 --all を使用して、アセットライブラリ全体を処理します。選択オプションは1つだけ選んでください。
作成レスポンスには taskId, jobId、 requestIdが含まれます。task ID を使って完了を待ち、job ID を使ってジョブを確認します:
使用する batch abort <job-id> ジョブを停止するには、または batch restart <job-id> 既存の設定で再試行します。どちらのコマンドも確認を求めます。次を追加してください --yes スクリプトでは使用します。再起動によりクレジットが消費される場合があります。
最終更新
役に立ちましたか?