- HTTP request
- Path parameters
- Request body
- Response body
- Authorization Scopes
- ExamplePayload
- Image
- TextSnippet
- Document
- DocumentInputConfig
- Layout
- TextSegment
- BoundingPoly
- NormalizedVertex
- TextSegmentType
- DocumentDimensions
- DocumentDimensionUnit
- AnnotationPayload
- TranslationAnnotation
- ClassificationAnnotation
- ImageObjectDetectionAnnotation
- TextExtractionAnnotation
- TextSentimentAnnotation
Perform an online prediction. The prediction result is directly returned in the response. Available for following ML scenarios, and their expected request payloads:
AutoML Vision Classification | An image in .JPEG, .GIF or .PNG format, imageBytes up to 30MB. |
AutoML Vision Object Detection | An image in .JPEG, .GIF or .PNG format, imageBytes up to 30MB. |
AutoML Natural Language Classification | A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in .PDF, .TIF or .TIFF format with size upto 2MB. |
AutoML Natural Language Entity Extraction | A TextSnippet up to 10,000 characters, UTF-8 NFC encoded or a document in .PDF, .TIF or .TIFF format with size upto 20MB. |
AutoML Natural Language Sentiment Analysis | A TextSnippet up to 60,000 characters, UTF-8 encoded or a document in .PDF, .TIF or .TIFF format with size upto 2MB. |
AutoML Translation | A TextSnippet up to 25,000 characters, UTF-8 encoded. |
AutoML Tables | A row with column values matching the columns of the model, up to 5MB. Not available for FORECASTING `predictionType`. |
HTTP request
POST https://automl.googleapis.com/v1/{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. AutoML Vision Classification
AutoML Vision Object Detection
AutoML Tables
[featureImportance][google.cloud.automl.v1.TablesModelColumnInfo.feature_importance] is populated in the returned list of [TablesAnnotation][google.cloud.automl.v1.TablesAnnotation] objects. The default is false. |
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. AutoML Translation and AutoML Natural Language Sentiment Analysis return precisely one payload. |
preprocessedInput |
The preprocessed example that AutoML actually makes prediction on. Empty if AutoML does not preprocess the input example. For AutoML Natural Language (Classification, Entity Extraction, and Sentiment Analysis), if the input is a document, the recognized text is returned in the |
metadata |
Additional domain-specific prediction response metadata. AutoML Vision Object Detection
AutoML Natural Language Sentiment Analysis
|
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. The example data. payload can be only one of the following: |
||
image |
Example image. |
|
textSnippet |
Example text. |
|
document |
Example document. |
Image
A representation of an image. Only images up to 30MB in size are supported.
JSON representation | |
---|---|
{ "thumbnailUri": string, "imageBytes": string } |
Fields | |
---|---|
thumbnailUri |
Output only. HTTP URI to the thumbnail image. |
imageBytes |
Image content represented as a stream of bytes. Note: As with all A base64-encoded string. |
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. |
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. |
|
textExtraction |
Annotation details for text extraction. |
|
textSentiment |
Annotation details for text sentiment. |
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. |
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 |