- HTTP request
- Path parameters
- Request body
- Response body
- Authorization Scopes
- ExamplePayload
- Image
- TextSnippet
- Document
- DocumentInputConfig
- Layout
- TextSegment
- BoundingPoly
- NormalizedVertex
- TextSegmentType
- DocumentDimensions
- DocumentDimensionUnit
- Row
- AnnotationPayload
- TranslationAnnotation
- ClassificationAnnotation
- ImageObjectDetectionAnnotation
- VideoClassificationAnnotation
- TimeSegment
- VideoObjectTrackingAnnotation
- TextExtractionAnnotation
- TextSentimentAnnotation
- TablesAnnotation
- DoubleRange
Perform an online prediction. The prediction result will be directly returned in the response. Available for following ML problems, and their expected request payloads: * Image Classification - Image in .JPEG, .GIF or .PNG format, imageBytes up to 30MB. * Image Object Detection - Image in .JPEG, .GIF or .PNG format, imageBytes up to 30MB. * Text Classification - TextSnippet, content up to 60,000 characters, UTF-8 encoded. * Text Extraction - TextSnippet, content up to 30,000 characters, UTF-8 NFC encoded. * Translation - TextSnippet, content up to 25,000 characters, UTF-8 encoded. * Tables - Row, with column values matching the columns of the model, up to 5MB. Not available for FORECASTING
predictionType
. * Text Sentiment - TextSnippet, content up 500 characters, UTF-8 encoded.
HTTP request
POST https://automl.googleapis.com/v1beta1/{name}:predict
Path parameters
Parameters | |
---|---|
name |
Name of the model requested to serve the 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 | |
---|---|
{
"payload": {
object ( |
Fields | |
---|---|
payload |
Required. Payload to perform a prediction on. The payload must match the problem type that the model was trained to solve. |
params |
Additional domain-specific parameters, any string must be up to 25000 characters long.
[feature_importance][ [TablesAnnotation(-s)][ |
Response body
If successful, the response body contains data with the following structure:
Response message for PredictionService.Predict
.
JSON representation | |
---|---|
{ "payload": [ { object ( |
Fields | |
---|---|
payload[] |
Prediction result. Translation and Text Sentiment will return precisely one payload. |
preprocessedInput |
The preprocessed example that AutoML actually makes prediction on. Empty if AutoML does not preprocess the input example. * For Text Extraction: If the input is a .pdf file, the OCR'ed text will be provided in |
metadata |
Additional domain-specific prediction response metadata.
|
Authorization Scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
ExamplePayload
Example data used for training or prediction.
JSON representation | |
---|---|
{ // Union field |
Fields | ||
---|---|---|
Union field payload . Required. Input only. The example data. payload can be only one of the following: |
||
image |
Example image. |
|
textSnippet |
Example text. |
|
document |
Example document. |
|
row |
Example relational table row. |
Image
A representation of an image. Only images up to 30MB in size are supported.
JSON representation | |
---|---|
{ "thumbnailUri": string, // Union field |
Fields | ||
---|---|---|
thumbnailUri |
Output only. HTTP URI to the thumbnail image. |
|
Union field data . Input only. The data representing the image. For Predict calls image_bytes must be set, as other options are not currently supported by prediction API. You can read the contents of an uploaded image by using the content_uri field. data can be only one of the following: |
||
imageBytes |
Image content represented as a stream of bytes. Note: As with all A base64-encoded string. |
|
inputConfig |
An input config specifying the content of the image. |
TextSnippet
A representation of a text snippet.
JSON representation | |
---|---|
{ "content": string, "mimeType": string, "contentUri": string } |
Fields | |
---|---|
content |
Required. The content of the text snippet as a string. Up to 250000 characters long. |
mimeType |
Optional. The format of |
contentUri |
Output only. HTTP URI where you can download the content. |
Document
A structured text document e.g. a PDF.
JSON representation | |
---|---|
{ "inputConfig": { object ( |
Fields | |
---|---|
inputConfig |
An input config specifying the content of the document. |
documentText |
The plain text version of this document. |
layout[] |
Describes the layout of the document. Sorted by [pageNumber][]. |
documentDimensions |
The dimensions of the page in the document. |
pageCount |
Number of pages in the document. |
DocumentInputConfig
Input configuration of a Document
.
JSON representation | |
---|---|
{
"gcsSource": {
object ( |
Fields | |
---|---|
gcsSource |
The Google Cloud Storage location of the document file. Only a single path should be given. Max supported size: 512MB. Supported extensions: .PDF. |
Layout
Describes the layout information of a textSegment
in the document.
JSON representation | |
---|---|
{ "textSegment": { object ( |
Fields | |
---|---|
textSegment |
Text Segment that represents a segment in |
pageNumber |
Page number of the |
boundingPoly |
The position of the
|
textSegmentType |
The type of the |
TextSegment
A contiguous part of a text (string), assuming it has an UTF-8 NFC encoding.
JSON representation | |
---|---|
{ "content": string, "startOffset": string, "endOffset": string } |
Fields | |
---|---|
content |
Output only. The content of the TextSegment. |
startOffset |
Required. Zero-based character index of the first character of the text segment (counting characters from the beginning of the text). |
endOffset |
Required. Zero-based character index of the first character past the end of the text segment (counting character from the beginning of the text). The character at the endOffset is NOT included in the text segment. |
BoundingPoly
A bounding polygon of a detected object on a plane. On output both vertices and normalizedVertices are provided. The polygon is formed by connecting vertices in the order they are listed.
JSON representation | |
---|---|
{
"normalizedVertices": [
{
object ( |
Fields | |
---|---|
normalizedVertices[] |
Output only . The bounding polygon normalized vertices. |
NormalizedVertex
A vertex represents a 2D point in the image. The normalized vertex coordinates are between 0 to 1 fractions relative to the original plane (image, video). E.g. if the plane (e.g. whole image) would have size 10 x 20 then a point with normalized coordinates (0.1, 0.3) would be at the position (1, 6) on that plane.
JSON representation | |
---|---|
{ "x": number, "y": number } |
Fields | |
---|---|
x |
Required. Horizontal coordinate. |
y |
Required. Vertical coordinate. |
TextSegmentType
The type of TextSegment in the context of the original document.
Enums | |
---|---|
TEXT_SEGMENT_TYPE_UNSPECIFIED |
Should not be used. |
TOKEN |
The text segment is a token. e.g. word. |
PARAGRAPH |
The text segment is a paragraph. |
FORM_FIELD |
The text segment is a form field. |
FORM_FIELD_NAME |
The text segment is the name part of a form field. It will be treated as child of another FORM_FIELD TextSegment if its span is subspan of another TextSegment with type FORM_FIELD. |
FORM_FIELD_CONTENTS |
The text segment is the text content part of a form field. It will be treated as child of another FORM_FIELD TextSegment if its span is subspan of another TextSegment with type FORM_FIELD. |
TABLE |
The text segment is a whole table, including headers, and all rows. |
TABLE_HEADER |
The text segment is a table's headers. It will be treated as child of another TABLE TextSegment if its span is subspan of another TextSegment with type TABLE. |
TABLE_ROW |
The text segment is a row in table. It will be treated as child of another TABLE TextSegment if its span is subspan of another TextSegment with type TABLE. |
TABLE_CELL |
The text segment is a cell in table. It will be treated as child of another TABLE_ROW TextSegment if its span is subspan of another TextSegment with type TABLE_ROW. |
DocumentDimensions
Message that describes dimension of a document.
JSON representation | |
---|---|
{
"unit": enum ( |
Fields | |
---|---|
unit |
Unit of the dimension. |
width |
Width value of the document, works together with the unit. |
height |
Height value of the document, works together with the unit. |
DocumentDimensionUnit
Unit of the document dimension.
Enums | |
---|---|
DOCUMENT_DIMENSION_UNIT_UNSPECIFIED |
Should not be used. |
INCH |
Document dimension is measured in inches. |
CENTIMETER |
Document dimension is measured in centimeters. |
POINT |
Document dimension is measured in points. 72 points = 1 inch. |
Row
A representation of a row in a relational table.
JSON representation | |
---|---|
{ "columnSpecIds": [ string ], "values": [ value ] } |
Fields | |
---|---|
columnSpecIds[] |
The resource IDs of the column specs describing the columns of the row. If set must contain, but possibly in a different order, all input feature
|
values[] |
Required. The values of the row cells, given in the same order as the columnSpecIds, or, if not set, then in the same order as input feature
|
AnnotationPayload
Contains annotation information that is relevant to AutoML.
JSON representation | |
---|---|
{ "annotationSpecId": string, "displayName": string, // Union field |
Fields | ||
---|---|---|
annotationSpecId |
Output only . The resource ID of the annotation spec that this annotation pertains to. The annotation spec comes from either an ancestor dataset, or the dataset that was used to train the model in use. |
|
displayName |
Output only. The value of |
|
Union field detail . Output only . Additional information about the annotation specific to the AutoML domain. detail can be only one of the following: |
||
translation |
Annotation details for translation. |
|
classification |
Annotation details for content or image classification. |
|
imageObjectDetection |
Annotation details for image object detection. |
|
videoClassification |
Annotation details for video classification. Returned for Video Classification predictions. |
|
videoObjectTracking |
Annotation details for video object tracking. |
|
textExtraction |
Annotation details for text extraction. |
|
textSentiment |
Annotation details for text sentiment. |
|
tables |
Annotation details for Tables. |
TranslationAnnotation
Annotation details specific to translation.
JSON representation | |
---|---|
{
"translatedContent": {
object ( |
Fields | |
---|---|
translatedContent |
Output only . The translated content. |
ClassificationAnnotation
Contains annotation details specific to classification.
JSON representation | |
---|---|
{ "score": number } |
Fields | |
---|---|
score |
Output only. A confidence estimate between 0.0 and 1.0. A higher value means greater confidence that the annotation is positive. If a user approves an annotation as negative or positive, the score value remains unchanged. If a user creates an annotation, the score is 0 for negative or 1 for positive. |
ImageObjectDetectionAnnotation
Annotation details for image object detection.
JSON representation | |
---|---|
{
"boundingBox": {
object ( |
Fields | |
---|---|
boundingBox |
Output only. The rectangle representing the object location. |
score |
Output only. The confidence that this annotation is positive for the parent example, value in [0, 1], higher means higher positivity confidence. |
VideoClassificationAnnotation
Contains annotation details specific to video classification.
JSON representation | |
---|---|
{ "type": string, "classificationAnnotation": { object ( |
Fields | |
---|---|
type |
Output only. Expresses the type of video classification. Possible values:
|
classificationAnnotation |
Output only . The classification details of this annotation. |
timeSegment |
Output only . The time segment of the video to which the annotation applies. |
TimeSegment
A time period inside of an example that has a time dimension (e.g. video).
JSON representation | |
---|---|
{ "startTimeOffset": string, "endTimeOffset": string } |
Fields | |
---|---|
startTimeOffset |
Start of the time segment (inclusive), represented as the duration since the example start. A duration in seconds with up to nine fractional digits, terminated by ' |
endTimeOffset |
End of the time segment (exclusive), represented as the duration since the example start. A duration in seconds with up to nine fractional digits, terminated by ' |
VideoObjectTrackingAnnotation
Annotation details for video object tracking.
JSON representation | |
---|---|
{
"instanceId": string,
"timeOffset": string,
"boundingBox": {
object ( |
Fields | |
---|---|
instanceId |
Optional. The instance of the object, expressed as a positive integer. Used to tell apart objects of the same type (i.e. AnnotationSpec) when multiple are present on a single example. NOTE: Instance ID prediction quality is not a part of model evaluation and is done as best effort. Especially in cases when an entity goes off-screen for a longer time (minutes), when it comes back it may be given a new instance ID. |
timeOffset |
Required. A time (frame) of a video to which this annotation pertains. Represented as the duration since the video's start. A duration in seconds with up to nine fractional digits, terminated by ' |
boundingBox |
Required. The rectangle representing the object location on the frame (i.e. at the timeOffset of the video). |
score |
Output only. The confidence that this annotation is positive for the video at the timeOffset, value in [0, 1], higher means higher positivity confidence. For annotations created by the user the score is 1. When user approves an annotation, the original float score is kept (and not changed to 1). |
TextExtractionAnnotation
Annotation for identifying spans of text.
JSON representation | |
---|---|
{
"score": number,
"textSegment": {
object ( |
Fields | |
---|---|
score |
Output only. A confidence estimate between 0.0 and 1.0. A higher value means greater confidence in correctness of the annotation. |
textSegment |
An entity annotation will set this, which is the part of the original text to which the annotation pertains. |
TextSentimentAnnotation
Contains annotation details specific to text sentiment.
JSON representation | |
---|---|
{ "sentiment": integer } |
Fields | |
---|---|
sentiment |
Output only. The sentiment with the semantic, as given to the |
TablesAnnotation
Contains annotation details specific to Tables.
JSON representation | |
---|---|
{ "score": number, "predictionInterval": { object ( |
Fields | |
---|---|
score |
Output only. A confidence estimate between 0.0 and 1.0, inclusive. A higher value means greater confidence in the returned value. For
|
predictionInterval |
Output only. Only populated when
|
value |
The predicted value of the row's
|
tablesModelColumnInfo[] |
Output only. Auxiliary information for each of the model's
|
DoubleRange
A range between two double numbers.
JSON representation | |
---|---|
{ "start": number, "end": number } |
Fields | |
---|---|
start |
Start of the range, inclusive. |
end |
End of the range, exclusive. |