- HTTP request
- Path parameters
- Request body
- Response body
- Authorization Scopes
- BatchPredictInputConfig
- BatchPredictOutputConfig
- BigQueryDestination
Perform a batch prediction and return the id of a long-running operation. You can request the operation result by using the operations.get
method. When the operation has completed, you can call operations.get
to retrieve a BatchPredictResult
from the response
field.
HTTP request
POST https://automl.googleapis.com/v1beta1/{name}:batchPredict
Path parameters
Parameters | |
---|---|
name |
Name of the model requested to serve the batch prediction. Authorization requires the following Google IAM permission on the specified resource
|
Request body
The request body contains data with the following structure:
JSON representation | |
---|---|
{ "inputConfig": { object( |
Fields | |||||||||
---|---|---|---|---|---|---|---|---|---|
inputConfig |
Required. The input configuration for batch prediction. |
||||||||
outputConfig |
Required. The Configuration specifying where output predictions should be written. |
||||||||
params |
Can be one of the following:
See Annotating videos for more details. |
Response body
If successful, the response body contains an instance of Operation
.
Authorization Scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
BatchPredictInputConfig
Input configuration for models.batchPredict
action. The input is one or more CSV files stored in Google Cloud Storage where the CSV files are in the following format:
GCS_FILE_PATH,TIME_SEGMENT_START,TIME_SEGMENT_END
GCS_FILE_PATH
identifies the Google Cloud Storage path to a video up to 50GB in size and up to 3h duration. Supported extensions: .MOV, .MPEG4, .MP4, .AVI.TIME_SEGMENT_START
andTIME_SEGMENT_END
must be within the length of the video, and end has to be after the start.
Three sample rows:
gs://folder/video1.mp4,10,40
gs://folder/video1.mp4,20,60
gs://folder/vid2.mov,0,inf
See Annotating videos for more information.
JSON representation | |
---|---|
{
"gcsSource": {
object( |
Fields | |
---|---|
gcsSource |
The Google Cloud Storage location for the input content. |
BatchPredictOutputConfig
Output configuration for models.batchPredict
Action.
AutoML Video Intelligence creates a directory specified in the
. The name of the directory is "prediction-<model-display-name>-<timestamp-of-prediction-call>", where timestamp is in gcsDestination
YYYY-MM-DDThh:mm:ss.sssZ
ISO-8601 format.
AutoML Video Intelligence creates a file named videoClassification.csv in the new directory, and also a JSON file for each video classification requested. That is, each row in the input CSV file.
The format of the videoClassification.csv file is as follows:
GCS_FILE_PATH,TIME_SEGMENT_START,TIME_SEGMENT_END,JSON_FILE_NAME,STATUS
The
GCS_FILE_PATH
,TIME_SEGMENT_START
,TIME_SEGMENT_END
match the same fields from the input CSV file.JSON_FILE_NAME
is the name of the JSON file in the output directory that contains prediction responses for the video time segment.STATUS
contains "OK" if the prediction completed successfully; otherwise contains error information. IfSTATUS
is not "OK" then the JSON file for that prediction might be empty or the file might not exist.
Each JSON file where STATUS
is "OK", contains a list of AnnotationPayload protos in JSON format, which are the predictions for the video time segment the file is assigned to in the videoClassification.csv. All AnnotationPayload protos have a videoClassification
field, and are sorted by the videoClassification.type
field. The types returned are determined by the classifaction_types
parameter of BatchPredictRequest.params
.
JSON representation | |
---|---|
{ // Union field |
Fields | ||
---|---|---|
Union field destination . Required. The destination of the output. destination can be only one of the following: |
||
gcsDestination |
The Google Cloud Storage location of the directory where the output is to be written to. |
|
bigqueryDestination |
The BigQuery location where the output is to be written to. |
BigQueryDestination
The BigQuery location for the output content.
JSON representation | |
---|---|
{ "outputUri": string } |
Fields | |
---|---|
outputUri |
Required. BigQuery URI to a project, up to 2000 characters long. For example: |