Package google.cloud.vision.v1

Index

ImageAnnotator

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

AsyncBatchAnnotateFiles

rpc AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest) returns (Operation)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

AsyncBatchAnnotateImages

rpc AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest) returns (Operation)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer Google Cloud Storage bucket, each json file containing BatchAnnotateImagesResponse proto.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

BatchAnnotateFiles

rpc BatchAnnotateFiles(BatchAnnotateFilesRequest) returns (BatchAnnotateFilesResponse)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most the first 10 frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

BatchAnnotateImages

rpc BatchAnnotateImages(BatchAnnotateImagesRequest) returns (BatchAnnotateImagesResponse)

Run image detection and annotation for a batch of images.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ProductSearch

Manages Products and ProductSets of reference images for use in product search. It uses the following resource model:

  • The API has a collection of ProductSet resources, named projects/*/locations/*/productSets/*, which acts as a way to put different products into groups to limit identification.

In parallel,

  • The API has a collection of Product resources, named projects/*/locations/*/products/*

  • Each Product has a collection of ReferenceImage resources, named projects/*/locations/*/products/*/referenceImages/*

AddProductToProductSet

rpc AddProductToProductSet(AddProductToProductSetRequest) returns (Empty)

Adds a Product to the specified ProductSet. If the Product is already present, no change is made.

One Product can be added to at most 100 ProductSets.

Possible errors:

  • Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

CreateProduct

rpc CreateProduct(CreateProductRequest) returns (Product)

Creates and returns a new product resource.

Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters.
  • Returns INVALID_ARGUMENT if description is longer than 4096 characters.
  • Returns INVALID_ARGUMENT if product_category is missing or invalid.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

CreateProductSet

rpc CreateProductSet(CreateProductSetRequest) returns (ProductSet)

Creates and returns a new ProductSet resource.

Possible errors:

  • Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

CreateReferenceImage

rpc CreateReferenceImage(CreateReferenceImageRequest) returns (ReferenceImage)

Creates and returns a new ReferenceImage resource.

The bounding_poly field is optional. If bounding_poly is not specified, the system will try to detect regions of interest in the image that are compatible with the product_category on the parent product. If it is specified, detection is ALWAYS skipped. The system converts polygons into non-rotated rectangles.

Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP).

Possible errors:

  • Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters.
  • Returns INVALID_ARGUMENT if the product does not exist.
  • Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected.
  • Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

DeleteProduct

rpc DeleteProduct(DeleteProductRequest) returns (Empty)

Permanently deletes a product and its reference images.

Metadata of the product and all its images will be deleted right away, but search queries against ProductSets containing the product may still work until all related caches are refreshed.

Possible errors:

  • Returns NOT_FOUND if the product does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

DeleteProductSet

rpc DeleteProductSet(DeleteProductSetRequest) returns (Empty)

Permanently deletes a ProductSet. Products and ReferenceImages in the ProductSet are not deleted.

The actual image files are not deleted from Google Cloud Storage.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

DeleteReferenceImage

rpc DeleteReferenceImage(DeleteReferenceImageRequest) returns (Empty)

Permanently deletes a reference image.

The image metadata will be deleted right away, but search queries against ProductSets containing the image may still work until all related caches are refreshed.

The actual image files are not deleted from Google Cloud Storage.

Possible errors:

  • Returns NOT_FOUND if the reference image does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

GetProduct

rpc GetProduct(GetProductRequest) returns (Product)

Gets information associated with a Product.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

GetProductSet

rpc GetProductSet(GetProductSetRequest) returns (ProductSet)

Gets information associated with a ProductSet.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

GetReferenceImage

rpc GetReferenceImage(GetReferenceImageRequest) returns (ReferenceImage)

Gets information associated with a ReferenceImage.

Possible errors:

  • Returns NOT_FOUND if the specified image does not exist.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ImportProductSets

rpc ImportProductSets(ImportProductSetsRequest) returns (Operation)

Asynchronous API that imports a list of reference images to specified product sets based on a list of image information.

The google.longrunning.Operation API can be used to keep track of the progress and results of the request. Operation.metadata contains BatchOperationMetadata. (progress) Operation.response contains ImportProductSetsResponse. (results)

The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see ImportProductSetsGcsSource.csv_file_uri.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ListProductSets

rpc ListProductSets(ListProductSetsRequest) returns (ListProductSetsResponse)

Lists ProductSets in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ListProducts

rpc ListProducts(ListProductsRequest) returns (ListProductsResponse)

Lists products in an unspecified order.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ListProductsInProductSet

rpc ListProductsInProductSet(ListProductsInProductSetRequest) returns (ListProductsInProductSetResponse)

Lists the Products in a ProductSet, in an unspecified order. If the ProductSet does not exist, the products field of the response will be empty.

Possible errors:

  • Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

ListReferenceImages

rpc ListReferenceImages(ListReferenceImagesRequest) returns (ListReferenceImagesResponse)

Lists reference images.

Possible errors:

  • Returns NOT_FOUND if the parent product does not exist.
  • Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

RemoveProductFromProductSet

rpc RemoveProductFromProductSet(RemoveProductFromProductSetRequest) returns (Empty)

Removes a Product from the specified ProductSet.

Possible errors:

  • Returns NOT_FOUND If the Product is not found under the ProductSet.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

UpdateProduct

rpc UpdateProduct(UpdateProductRequest) returns (Product)

Makes changes to a Product resource. Only the display_name, description, and labels fields can be updated right now.

If labels are updated, the change will not be reflected in queries until the next index time.

Possible errors:

  • Returns NOT_FOUND if the Product does not exist.
  • Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters.
  • Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters.
  • Returns INVALID_ARGUMENT if product_category is present in update_mask.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

UpdateProductSet

rpc UpdateProductSet(UpdateProductSetRequest) returns (ProductSet)

Makes changes to a ProductSet resource. Only display_name can be updated currently.

Possible errors:

  • Returns NOT_FOUND if the ProductSet does not exist.
  • Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters.
Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/cloud-vision

For more information, see the Authentication Overview.

AddProductToProductSetRequest

Request message for the AddProductToProductSet method.

Fields
name

string

The resource name for the ProductSet to modify.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

product

string

The resource name for the Product to be added to this ProductSet.

Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

AnnotateFileRequest

A request to annotate one single file, e.g. a PDF, TIFF or GIF file.

Fields
input_config

InputConfig

Required. Information about the input file.

features[]

Feature

Required. Requested features.

image_context

ImageContext

Additional context that may accompany the image(s) in the file.

pages[]

int32

Pages of the file to perform image annotation.

Pages starts from 1, we assume the first page of the file is page 1. At most 5 pages are supported per request. Pages can be negative.

Page 1 means the first page. Page 2 means the second page. Page -1 means the last page. Page -2 means the second to the last page.

If the file is GIF instead of PDF or TIFF, page refers to GIF frames.

If this field is empty, by default the service performs image annotation for the first 5 pages of the file.

AnnotateFileResponse

Response to a single file annotation request. A file may contain one or more images, which individually have their own responses.

Fields
input_config

InputConfig

Information about the file for which this response is generated.

responses[]

AnnotateImageResponse

Individual responses to images found within the file.

AnnotateImageRequest

Request for performing Google Cloud Vision API tasks over a user-provided image, with user-requested features, and with context information.

Fields
image

Image

The image to be processed.

features[]

Feature

Requested features.

image_context

ImageContext

Additional context that may accompany the image.

custom_label_detection_models[]

string

When making a request with a CUSTOM_LABEL_DETECTION value in the features.type field, the CustomLabelDetectionModels field must specify the custom model(s) to use. The format of the model name mimics the resource URL of the custom model: /projects/PROJECT_ID/models/MODEL_ID, or /models/MODEL_ID if the model belongs to the current project.

AnnotateImageResponse

Response to an image annotation request.

Fields
face_annotations[]

FaceAnnotation

If present, face detection has completed successfully.

landmark_annotations[]

EntityAnnotation

If present, landmark detection has completed successfully.

logo_annotations[]

EntityAnnotation

If present, logo detection has completed successfully.

label_annotations[]

EntityAnnotation

If present, label detection has completed successfully.

localized_object_annotations[]

LocalizedObjectAnnotation

If present, localized object detection has completed successfully. This will be sorted descending by confidence score.

custom_label_annotations[]

CustomEntityAnnotation

If present, custom annotation has completed successfully.

text_annotations[]

EntityAnnotation

If present, text (OCR) detection has completed successfully.

full_text_annotation

TextAnnotation

If present, text (OCR) detection or document (OCR) text detection has completed successfully. This annotation provides the structural hierarchy for the OCR detected text.

safe_search_annotation

SafeSearchAnnotation

If present, safe-search annotation has completed successfully.

image_properties_annotation

ImageProperties

If present, image properties were extracted successfully.

crop_hints_annotation

CropHintsAnnotation

If present, crop hints have completed successfully.

web_detection

WebDetection

If present, web detection has completed successfully.

product_search_results

ProductSearchResults

If present, product search has completed successfully.

error

Status

If set, represents the error message for the operation. Note that filled-in image annotations are guaranteed to be correct, even when error is set.

context

ImageAnnotationContext

If present, contextual information is needed to understand where this image comes from.

image_quality_annotation

ImageQuality

If present, image quality calculation has completed successfully.

object_attribute_annotations[]

EntityAnnotation

If present, objects attributes calculation has completed successfully. The attributes value will be filled in the EntityAnnotation.properties. Example: object_attribute_annotations { properties { name: "color" value: "blue" confidence: 0.1 } properties { name: "color" value: "white" confidence: 0.2 } properties { name: "material" value: "silk" confidence: 0.3 } }

quality_optimization_result

QualityOptimizationResult

If present, image quality optimization has completed successfully.

localized_barcode_annotations[]

LocalizedBarcodeAnnotation

If present, localized barcode detection has completed successfully.

AsyncAnnotateFileRequest

An offline file annotation request.

Fields
input_config

InputConfig

Required. Information about the input file.

features[]

Feature

Required. Requested features.

image_context

ImageContext

Additional context that may accompany the image(s) in the file.

output_config

OutputConfig

Required. The desired output location and metadata (e.g. format).

AsyncAnnotateFileResponse

The response for a single offline file annotation request.

Fields
output_config

OutputConfig

The output location and metadata from AsyncAnnotateFileRequest.

AsyncBatchAnnotateFilesRequest

Multiple async file annotation requests are batched into a single service call.

Fields
requests[]

AsyncAnnotateFileRequest

Individual async file annotation requests for this batch.

AsyncBatchAnnotateFilesResponse

Response to an async batch file annotation request.

Fields
responses[]

AsyncAnnotateFileResponse

The list of file annotation responses, one for each request in AsyncBatchAnnotateFilesRequest.

AsyncBatchAnnotateImagesRequest

Request for async image annotation for a list of images.

Fields
requests[]

AnnotateImageRequest

Individual image annotation requests for this batch.

output_config

OutputConfig

Required. The desired output location and metadata (e.g. format).

AsyncBatchAnnotateImagesResponse

Response to an async batch image annotation request.

Fields
output_config

OutputConfig

The output location and metadata from AsyncBatchAnnotateImagesRequest.

BatchAnnotateFilesRequest

A list of requests to annotate files using the BatchAnnotateFiles API.

Fields
requests[]

AnnotateFileRequest

The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.

BatchAnnotateFilesResponse

A list of file annotation responses.

Fields
responses[]

AnnotateFileResponse

The list of file annotation responses, each response corresponding to each AnnotateFileRequest in BatchAnnotateFilesRequest.

BatchAnnotateImagesRequest

Multiple image annotation requests are batched into a single service call.

Fields
requests[]

AnnotateImageRequest

Individual image annotation requests for this batch.

BatchAnnotateImagesResponse

Response to a batch image annotation request.

Fields
responses[]

AnnotateImageResponse

Individual responses to image annotation requests within the batch.

BatchOperationMetadata

Metadata for the batch operations such as the current state.

This is included in the metadata field of the Operation returned by the GetOperation call of the google::longrunning::Operations service.

Fields
state

State

The current state of the batch operation.

submit_time

Timestamp

The time when the batch request was submitted to the server.

end_time

Timestamp

The time when the batch request is finished and google.longrunning.Operation.done is set to true.

State

Enumerates the possible states that the batch request can be in.

Enums
STATE_UNSPECIFIED Invalid.
PROCESSING Request is actively being processed.
SUCCESSFUL The request is done and at least one item has been successfully processed.
FAILED The request is done and no item has been successfully processed.
CANCELLED The request is done after the longrunning.Operations.CancelOperation has been called by the user. Any records that were processed before the cancel command are output as specified in the request.

Block

Logical element on the page.

Fields
property

TextProperty

Additional information detected for the block.

bounding_box

BoundingPoly

The bounding box for the block. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example:

  • when the text is horizontal it might look like:
    0----1
    |    |
    3----2
  • when it's rotated 180 degrees around the top-left corner it becomes:
    2----3
    |    |
    1----0

and the vertex order will still be (0, 1, 2, 3).

paragraphs[]

Paragraph

List of paragraphs in this block (if this blocks is of type text).

block_type

BlockType

Detected block type (text, image etc) for this block.

confidence

float

Confidence of the OCR results on the block. Range [0, 1].

table

Table

Detected table for TABLE block_type. This field is by default not returned unless enabled via TextDetectionParams.table_detection_options. The bounding_box for this Block will be the detected boundaries for this table.

key_value_pair

KeyValuePair

Detected pair for KEY_VALUE_PAIR block_type. This field is by default not returned unless DocumentType is specified.

merged_text

string

All UTF-8 text detected in this block. This field is by default not returned unless specified in TextDetectionParams.block_filter.

BlockType

Type of a block (text, image etc) as identified by OCR.

Enums
UNKNOWN Unknown block type.
TEXT Regular text block.
TABLE Table block.
PICTURE Image block.
RULER Horizontal/vertical line box.
BARCODE Barcode block.
KEY_VALUE_PAIR A key-value pair block.

BoundingPoly

A bounding polygon for the detected image annotation.

Fields
vertices[]

Vertex

The bounding polygon vertices.

normalized_vertices[]

NormalizedVertex

The bounding polygon normalized vertices.

ColorInfo

Color information consists of RGB channels, score, and the fraction of the image that the color occupies in the image.

Fields
color

Color

RGB components of the color.

score

float

Image-specific score for this color. Value in range [0, 1].

pixel_fraction

float

The fraction of pixels the color occupies in the image. Value in range [0, 1].

CreateProductRequest

Request message for the CreateProduct method.

Fields
parent

string

The project in which the Product should be created.

Format is projects/PROJECT_ID/locations/LOC_ID.

product

Product

The product to create.

product_id

string

A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.

CreateProductSetRequest

Request message for the CreateProductSet method.

Fields
parent

string

The project in which the ProductSet should be created.

Format is projects/PROJECT_ID/locations/LOC_ID.

product_set

ProductSet

The ProductSet to create.

product_set_id

string

A user-supplied resource id for this ProductSet. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.

CreateReferenceImageRequest

Request message for the CreateReferenceImage method.

Fields
parent

string

Resource name of the product in which to create the reference image.

Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

reference_image

ReferenceImage

The reference image to create. If an image ID is specified, it is ignored.

reference_image_id

string

A user-supplied resource id for the ReferenceImage to be added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character /.

CropHint

Single crop hint that is used to generate a new crop when serving an image.

Fields
bounding_poly

BoundingPoly

The bounding polygon for the crop region. The coordinates of the bounding box are in the original image's scale.

confidence

float

Confidence of this being a salient region. Range [0, 1].

importance_fraction

float

Fraction of importance of this salient region with respect to the original image.

CropHintsAnnotation

Set of crop hints that are used to generate new crops when serving images.

Fields
crop_hints[]

CropHint

Crop hint results.

CropHintsParams

Parameters for crop hints annotation request.

Fields
aspect_ratios[]

float

Aspect ratios in floats, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.

CustomEntityAnnotation

A CustomEntityAnnotation contains annotations predicted using Vision custom models.

Fields
model

string

Identifies the custom model used to create this annotation. The format of the model name is the resource URL of the custom mode that was queried: /projects/PROJECT_ID/models/MODEL_ID, or /models/MODEL_ID if the model belongs to the current project.

label

string

The label predicted by the custom model.

score

float

The confidence score of the label by the custom model.

DeleteProductRequest

Request message for the DeleteProduct method.

Fields
name

string

Resource name of product to delete.

Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

DeleteProductSetRequest

Request message for the DeleteProductSet method.

Fields
name

string

Resource name of the ProductSet to delete.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

DeleteReferenceImageRequest

Request message for the DeleteReferenceImage method.

Fields
name

string

The resource name of the reference image to delete.

Format is:

projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID

DocumentParsingParams

Parameters for DOCUMENT_PARSING feature.

Fields
disable_orientation_detection

bool

Disables orientation detection such that rotated text will not be detected.

table_detection_options

TableDetectionOptions

Controls table detection behavior. Table detection is disabled if this field is not set.

document_type

string

Specify a known document type for deeper structure detection. Valid values are currently "invoice" or "general".

DominantColorsAnnotation

Set of dominant colors and their corresponding scores.

Fields
colors[]

ColorInfo

RGB color values with their score and pixel fraction.

EntityAnnotation

Set of detected entity features.

Fields
mid

string

Opaque entity ID. Some IDs may be available in Google Knowledge Graph Search API.

locale

string

The language code for the locale in which the entity textual description is expressed.

description

string

Entity textual description, expressed in its locale language.

score

float

Overall score of the result. Range [0, 1].

confidence
(deprecated)

float

Deprecated. Use score instead. The accuracy of the entity detection in an image. For example, for an image in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1].

topicality

float

The relevancy of the ICA (Image Content Annotation) label to the image. For example, the relevancy of "tower" is likely higher to an image containing the detected "Eiffel Tower" than to an image containing a detected distant towering building, even though the confidence that there is a tower in each image may be the same. Range [0, 1].

bounding_poly

BoundingPoly

Image region to which this entity belongs. Not produced for LABEL_DETECTION features.

locations[]

LocationInfo

The location information for the detected entity. Multiple LocationInfo elements can be present because one location may indicate the location of the scene in the image, and another location may indicate the location of the place where the image was taken. Location information is usually present for landmarks.

properties[]

Property

Some entities may have optional user-supplied Property (name/value) fields, such a score or string that qualifies the entity.

FaceAnnotation

A face annotation object contains the results of face detection.

Fields
bounding_poly

BoundingPoly

The bounding polygon around the face. The coordinates of the bounding box are in the original image's scale. The bounding box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y coordinates may not be generated in the BoundingPoly (the polygon will be unbounded) if only a partial face appears in the image to be annotated.

fd_bounding_poly

BoundingPoly

The fd_bounding_poly bounding polygon is tighter than the boundingPoly, and encloses only the skin part of the face. Typically, it is used to eliminate the face from any image analysis that detects the "amount of skin" visible in an image. It is not based on the landmarker results, only on the initial face detection, hence the

fd

(face detection) prefix.

landmarks[]

Landmark

Detected face landmarks.

roll_angle

float

Roll angle, which indicates the amount of clockwise/anti-clockwise rotation of the face relative to the image vertical about the axis perpendicular to the face. Range [-180,180].

pan_angle

float

Yaw angle, which indicates the leftward/rightward angle that the face is pointing relative to the vertical plane perpendicular to the image. Range [-180,180].

tilt_angle

float

Pitch angle, which indicates the upwards/downwards angle that the face is pointing relative to the image's horizontal plane. Range [-180,180].

detection_confidence

float

Detection confidence. Range [0, 1].

landmarking_confidence

float

Face landmarking confidence. Range [0, 1].

joy_likelihood

Likelihood

Joy likelihood.

sorrow_likelihood

Likelihood

Sorrow likelihood.

anger_likelihood

Likelihood

Anger likelihood.

surprise_likelihood

Likelihood

Surprise likelihood.

under_exposed_likelihood

Likelihood

Under-exposed likelihood.

blurred_likelihood

Likelihood

Blurred likelihood.

headwear_likelihood

Likelihood

Headwear likelihood.

Landmark

A face-specific landmark (for example, a face feature).

Fields
type

Type

Face landmark type.

position

Position

Face landmark position.

Type

Face landmark (feature) type. Left and right are defined from the vantage of the viewer of the image without considering mirror projections typical of photos. So, LEFT_EYE, typically, is the person's right eye.

Enums
UNKNOWN_LANDMARK Unknown face landmark detected. Should not be filled.
LEFT_EYE Left eye.
RIGHT_EYE Right eye.
LEFT_OF_LEFT_EYEBROW Left of left eyebrow.
RIGHT_OF_LEFT_EYEBROW Right of left eyebrow.
LEFT_OF_RIGHT_EYEBROW Left of right eyebrow.
RIGHT_OF_RIGHT_EYEBROW Right of right eyebrow.
MIDPOINT_BETWEEN_EYES Midpoint between eyes.
NOSE_TIP Nose tip.
UPPER_LIP Upper lip.
LOWER_LIP Lower lip.
MOUTH_LEFT Mouth left.
MOUTH_RIGHT Mouth right.
MOUTH_CENTER Mouth center.
NOSE_BOTTOM_RIGHT Nose, bottom right.
NOSE_BOTTOM_LEFT Nose, bottom left.
NOSE_BOTTOM_CENTER Nose, bottom center.
LEFT_EYE_TOP_BOUNDARY Left eye, top boundary.
LEFT_EYE_RIGHT_CORNER Left eye, right corner.
LEFT_EYE_BOTTOM_BOUNDARY Left eye, bottom boundary.
LEFT_EYE_LEFT_CORNER Left eye, left corner.
RIGHT_EYE_TOP_BOUNDARY Right eye, top boundary.
RIGHT_EYE_RIGHT_CORNER Right eye, right corner.
RIGHT_EYE_BOTTOM_BOUNDARY Right eye, bottom boundary.
RIGHT_EYE_LEFT_CORNER Right eye, left corner.
LEFT_EYEBROW_UPPER_MIDPOINT Left eyebrow, upper midpoint.
RIGHT_EYEBROW_UPPER_MIDPOINT Right eyebrow, upper midpoint.
LEFT_EAR_TRAGION Left ear tragion.
RIGHT_EAR_TRAGION Right ear tragion.
LEFT_EYE_PUPIL Left eye pupil.
RIGHT_EYE_PUPIL Right eye pupil.
FOREHEAD_GLABELLA Forehead glabella.
CHIN_GNATHION Chin gnathion.
CHIN_LEFT_GONION Chin left gonion.
CHIN_RIGHT_GONION Chin right gonion.

Feature

The type of Google Cloud Vision API detection to perform, and the maximum number of results to return for that type. Multiple Feature objects can be specified in the features list.

Fields
type

Type

The feature type.

max_results

int32

Maximum number of results of this type. Does not apply to TEXT_DETECTION, DOCUMENT_TEXT_DETECTION, or CROP_HINTS.

model

string

Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and "builtin/latest".

Type

Type of Google Cloud Vision API feature to be extracted.

Enums
TYPE_UNSPECIFIED Unspecified feature type.
FACE_DETECTION Run face detection.
LANDMARK_DETECTION Run landmark detection.
LOGO_DETECTION Run logo detection.
LABEL_DETECTION Run label detection.
TEXT_DETECTION Run text detection / optical character recognition (OCR). Text detection is optimized for areas of text within a larger image; if the image is a document, use DOCUMENT_TEXT_DETECTION instead.
DOCUMENT_TEXT_DETECTION Run dense text document OCR. Takes precedence when both DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are present.
SAFE_SEARCH_DETECTION Run Safe Search to detect potentially unsafe or undesirable content.
IMAGE_PROPERTIES Compute a set of image properties, such as the image's dominant colors.
CROP_HINTS Run crop hints.
WEB_DETECTION Run web detection.
CUSTOM_LABEL_DETECTION Run custom label detection.
OBJECT_LOCALIZATION Run localizer for object detection.
IMAGE_QUALITY Run quality scorer.
OBJECT_ATTRIBUTES Compute attributes of objects detected in the image. Four domains of objects are supported. Please select via Feature.model (required): "builtin/apparel", "builtin/car", "builtin/food" or "builtin/wildlife".
QUALITY_OPTIMIZATION Run quality optimization algorithms. There are three types of operations: COMPRESSION, ENHANCEMENT and QUALITY_SCORE. COMPRESSION and ENHANCEMENT parameters, and QUALITY_SCORE model choice can are specified in image_context.quality_optimization_params.
BARCODE_DETECTION Run barcode detection and recognition.
DOCUMENT_PARSING Run document parsing algorithms to extract structured data such as tables and forms. The results are found in full_text_annotation -> page -> block with type either TABLE for tables or KEY_VALUE_PAIR for key-value pairs in forms.

GcsDestination

The Google Cloud Storage location where the output will be written to.

Fields
uri

string

Google Cloud Storage URI where the results will be stored. Results will be in JSON format and preceded by its corresponding input URI. This field can either represent a single file, or a prefix for multiple outputs. Prefixes must end in a /.

Examples:

If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of the full list of AnnotateImageResponse. Multiple outputs can happen if, for example, the output JSON is too large and overflows into multiple sharded files.

GcsSource

The Google Cloud Storage location where the input will be read from.

Fields
uri

string

Google Cloud Storage URI for the input file. This must only be a Google Cloud Storage object. Wildcards are not currently supported.

GetProductRequest

Request message for the GetProduct method.

Fields
name

string

Resource name of the Product to get.

Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

GetProductSetRequest

Request message for the GetProductSet method.

Fields
name

string

Resource name of the ProductSet to get.

Format is: projects/PROJECT_ID/locations/LOG_ID/productSets/PRODUCT_SET_ID

GetReferenceImageRequest

Request message for the GetReferenceImage method.

Fields
name

string

The resource name of the ReferenceImage to get.

Format is:

projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID.

Image

Client image to perform Google Cloud Vision API tasks over.

Fields
content

bytes

Image content, represented as a stream of bytes. Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

source

ImageSource

Google Cloud Storage image location, or publicly-accessible image URL. If both content and source are provided for an image, content takes precedence and is used to perform the image annotation request.

ImageAnnotationContext

If an image was produced from a file (e.g. a PDF), this message gives information about the source of that image.

Fields
uri

string

The URI of the file used to produce the image.

page_number

int32

If the file was a PDF or TIFF, this field gives the page number within the file used to produce the image.

ImageContext

Image context and/or feature-specific parameters.

Fields
lat_long_rect

LatLongRect

Not used.

language_hints[]

string

List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting language_hints is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong). Text detection returns an error if one or more of the specified languages is not one of the supported languages.

crop_hints_params

CropHintsParams

Parameters for crop hints annotation request.

product_search_params

ProductSearchParams

Parameters for product search.

web_detection_params

WebDetectionParams

Parameters for web detection.

text_detection_params

TextDetectionParams

Parameters for document text detection.

quality_optimization_params

QualityOptimizationParams

Parameters for image quality optimizations.

document_parsing_params

DocumentParsingParams

Parameters for document parsing.

ImageProperties

Stores image properties, such as dominant colors.

Fields
dominant_colors

DominantColorsAnnotation

If present, dominant colors completed successfully.

ImageQuality

Stores image quality scores, could be aesthetic quality or technical quality.

Fields
quality_score

float

A score representing the aesthetic/technical quality of the image. The score is in range [0, 1]. Higher value corresponds to more professional looking photos. 0 means the image looks very bad, 1 means the image with very high quality.

ImageSource

External image source (Google Cloud Storage or web URL image location).

Fields
gcs_image_uri

string

Use image_uri instead.

The Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info.

image_uri

string

The URI of the source image. Can be either:

  1. A Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info.

  2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from HTTP/HTTPS URLs, Google cannot guarantee that the request will be completed. Your request may fail if the specified host denies the request (e.g. due to request throttling or DOS prevention), or if Google throttles requests to the site for abuse prevention. You should not depend on externally-hosted images for production applications.

When both gcs_image_uri and image_uri are specified, image_uri takes precedence.

ImportProductSetsGcsSource

The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line.

Fields
csv_file_uri

string

The Google Cloud Storage URI of the input csv file.

The URI must start with gs://.

The format of the input csv file should be one image per line. In each line, there are 8 columns.

  1. image-uri
  2. image-id
  3. product-set-id
  4. product-id
  5. product-category
  6. product-display-name
  7. labels
  8. bounding-poly

The image-uri, product-set-id, product-id, and product-category columns are required. All other columns are optional.

If the ProductSet or Product specified by the product-set-id and product-id values does not exist, then the system will create a new ProductSet or Product for the image. In this case, the product-display-name column refers to display_name, the product-category column refers to product_category, and the labels column refers to product_labels.

The image-id column is optional but must be unique if provided. If it is empty, the system will automatically assign a unique id to the image.

The product-display-name column is optional. If it is empty, the system sets the display_name field for the product to a space (" "). You can update the display_name later by using the API.

If a Product with the specified product-id already exists, then the system ignores the product-display-name, product-category, and labels columns.

The labels column (optional) is a line containing a list of comma-separated key-value pairs, in the following format:

"key_1=value_1,key_2=value_2,...,key_n=value_n"

The bounding-poly column (optional) identifies one region of interest from the image in the same manner as CreateReferenceImage. If you do not specify the bounding-poly column, then the system will try to detect regions of interest automatically.

At most one bounding-poly column is allowed per line. If the image contains multiple regions of interest, add a line to the CSV file that includes the same product information, and the bounding-poly values for each region of interest.

The bounding-poly column must contain an even number of comma-separated numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use non-negative integers for absolute bounding polygons, and float values in [0, 1] for normalized bounding polygons.

The system will resize the image if the image resolution is too large to process (larger than 20MP).

ImportProductSetsInputConfig

The input content for the ImportProductSets method.

Fields
gcs_source

ImportProductSetsGcsSource

The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line.

ImportProductSetsRequest

Request message for the ImportProductSets method.

Fields
parent

string

The project in which the ProductSets should be imported.

Format is projects/PROJECT_ID/locations/LOC_ID.

input_config

ImportProductSetsInputConfig

The input content for the list of requests.

ImportProductSetsResponse

Response message for the ImportProductSets method.

This message is returned by the google.longrunning.Operations.GetOperation method in the returned google.longrunning.Operation.response field.

Fields
reference_images[]

ReferenceImage

The list of reference_images that are imported successfully.

statuses[]

Status

The rpc status for each ImportProductSet request, including both successes and errors.

The number of statuses here matches the number of lines in the csv file, and statuses[i] stores the success or failure status of processing the i-th line of the csv, starting from line 0.

InputConfig

The desired input location and metadata.

Fields
gcs_source

GcsSource

The Google Cloud Storage location to read the input from.

content

bytes

File content, represented as a stream of bytes. Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

Currently, this field only works for BatchAnnotateFiles requests. It does not work for AsyncBatchAnnotateFiles requests.

mime_type

string

The type of the file. Currently only "application/pdf" and "image/tiff" are supported. Wildcards are not supported.

KeyValuePair

Proto for a key value pair.

Fields
key

string

The key string value.

key_block

Block

Key block of the pair containing the normalized bounding box and key text.

value_block

Block

Value block of the pair containing the normalized bounding box and value text, including potentially deeper structures within the value text.

value_type

string

Type of the value. Valid strings are the following:

"generic" - For generic text that is mapped to a value. "number" - for numeric types "id" - for generic identifiers. "currency" - for currency values. "date" - for dates. "time" - for time and duration values. "date_range" - for date ranges. "address" - for address values (can be long). "person" - for names of people or other personal identifiers. "phone" - for phone numbers.

normalized_key

string

(Optional) The normalized key text if the text is common and classified.

For example, 'TOTAL DUE' will be normalized to 'Total amount'.

LatLongRect

Rectangle determined by min and max LatLng pairs.

Fields
min_lat_lng

LatLng

Min lat/long pair.

max_lat_lng

LatLng

Max lat/long pair.

Likelihood

A bucketized representation of likelihood, which is intended to give clients highly stable results across model upgrades.

Enums
UNKNOWN Unknown likelihood.
VERY_UNLIKELY It is very unlikely that the image belongs to the specified vertical.
UNLIKELY It is unlikely that the image belongs to the specified vertical.
POSSIBLE It is possible that the image belongs to the specified vertical.
LIKELY It is likely that the image belongs to the specified vertical.
VERY_LIKELY It is very likely that the image belongs to the specified vertical.

ListProductSetsRequest

Request message for the ListProductSets method.

Fields
parent

string

The project from which ProductSets should be listed.

Format is projects/PROJECT_ID/locations/LOC_ID.

page_size

int32

The maximum number of items to return. Default 10, maximum 100.

page_token

string

The next_page_token returned from a previous List request, if any.

ListProductSetsResponse

Response message for the ListProductSets method.

Fields
product_sets[]

ProductSet

List of ProductSets.

next_page_token

string

Token to retrieve the next page of results, or empty if there are no more results in the list.

ListProductsInProductSetRequest

Request message for the ListProductsInProductSet method.

Fields
name

string

The ProductSet resource for which to retrieve Products.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

page_size

int32

The maximum number of items to return. Default 10, maximum 100.

page_token

string

The next_page_token returned from a previous List request, if any.

ListProductsInProductSetResponse

Response message for the ListProductsInProductSet method.

Fields
products[]

Product

The list of Products.

next_page_token

string

Token to retrieve the next page of results, or empty if there are no more results in the list.

ListProductsRequest

Request message for the ListProducts method.

Fields
parent

string

The project OR ProductSet from which Products should be listed.

Format: projects/PROJECT_ID/locations/LOC_ID

page_size

int32

The maximum number of items to return. Default 10, maximum 100.

page_token

string

The next_page_token returned from a previous List request, if any.

ListProductsResponse

Response message for the ListProducts method.

Fields
products[]

Product

List of products.

next_page_token

string

Token to retrieve the next page of results, or empty if there are no more results in the list.

ListReferenceImagesRequest

Request message for the ListReferenceImages method.

Fields
parent

string

Resource name of the product containing the reference images.

Format is projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

page_size

int32

The maximum number of items to return. Default 10, maximum 100.

page_token

string

A token identifying a page of results to be returned. This is the value of nextPageToken returned in a previous reference image list request.

Defaults to the first page if not specified.

ListReferenceImagesResponse

Response message for the ListReferenceImages method.

Fields
reference_images[]

ReferenceImage

The list of reference images.

page_size

int32

The maximum number of items to return. Default 10, maximum 100.

next_page_token

string

The next_page_token returned from a previous List request, if any.

LocalizedBarcodeAnnotation

Set of detected barcodes with bounding boxes.

Fields
format

string

Barcode format describes the format of a barcode. Supported formats are: CODE_128: Code 128 type. CODE_39: Code 39 type. CODE_93: Code 93 type. CODABAR: Codabar type. DATA_MATRIX: 2D Data Matrix type. ITF: ITF type. EAN_13: EAN-13 type. EAN_8: EAN-8 type. QR_CODE: 2D QR code type. UPC_A: UPC-A type. UPC_E: UPC-E type. PDF417: PDF417 type. AZTEC: 2D Aztec code type. DATABAR: GS1 DataBar code type.

value_format

string

Barcode value format idescribes the format of the value a barcode encodes. Supported value formats are: CONTACT_INFO: Contact information. EMAIL: Email address. ISBN: ISBN identifier. PHONE: Phone number. PRODUCT: Product. SMS: SMS message. TEXT: Text string. URL: URL address. WIFI: Wifi information. GEO: Geo-localization (long and lat). CALENDAR_EVENT: Calendar event. DRIVER_LICENSE: Driver's license.

value

string

Barcode value that is the ASCII value captured in the barcode. Barcode may encode structured values, for example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'.

confidence

float

Confidence value of the result. Range [0, 1].

bounding_poly

BoundingPoly

Image region to which this barcode belongs. This must be populated.

LocalizedObjectAnnotation

Set of detected objects with bounding boxes.

Fields
mid

string

Object ID that should align with EntityAnnotation mid.

language_code

string

The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

name

string

Object name, expressed in its language_code language.

score

float

Score of the result. Range [0, 1].

bounding_poly

BoundingPoly

Image region to which this object belongs. This must be populated.

LocationInfo

Detected entity location information.

Fields
lat_lng

LatLng

lat/long location coordinates.

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

Fields
x

float

X coordinate.

y

float

Y coordinate.

OperationMetadata

Contains metadata for the BatchAnnotateImages operation.

Fields
state

State

Current state of the batch operation.

create_time

Timestamp

The time when the batch request was received.

update_time

Timestamp

The time when the operation result was last updated.

State

Batch operation states.

Enums
STATE_UNSPECIFIED Invalid.
CREATED Request is received.
RUNNING Request is actively being processed.
DONE The batch processing is done.
CANCELLED The batch processing was cancelled.

OutputConfig

The desired output location and metadata.

Fields
gcs_destination

GcsDestination

The Google Cloud Storage location to write the output(s) to.

batch_size

int32

The max number of response protos to put into each output JSON file on Google Cloud Storage. The valid range is [1, 100]. If not specified, the default value is 20.

For example, for one pdf file with 100 pages, 100 response protos will be generated. If batch_size = 20, then 5 json files each containing 20 response protos will be written under the prefix gcs_destination.uri.

Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations.

Page

Detected page from OCR.

Fields
property

TextProperty

Additional information detected on the page.

width

int32

Page width. For PDFs the unit is points. For images (including TIFFs) the unit is pixels.

height

int32

Page height. For PDFs the unit is points. For images (including TIFFs) the unit is pixels.

blocks[]

Block

List of blocks of text, images etc on this page.

confidence

float

Confidence of the OCR results on the page. Range [0, 1].

merged_text

string

All UTF-8 text detected in this page. This field is by default not returned unless specified in TextDetectionParams.page_filter.

Paragraph

Structural unit of text representing a number of words in certain order.

Fields
property

TextProperty

Additional information detected for the paragraph.

bounding_box

BoundingPoly

The bounding box for the paragraph. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: * when the text is horizontal it might look like: 0----1 | | 3----2 * when it's rotated 180 degrees around the top-left corner it becomes: 2----3 | | 1----0 and the vertex order will still be (0, 1, 2, 3).

words[]

Word

List of words in this paragraph.

confidence

float

Confidence of the OCR results for the paragraph. Range [0, 1].

merged_text

string

All UTF-8 text detected in this paragraph. This field is by default not returned unless specified in TextDetectionParams.paragraph_filter.

Position

A 3D position in the image, used primarily for Face detection landmarks. A valid Position must have both x and y coordinates. The position coordinates are in the same scale as the original image.

Fields
x

float

X coordinate.

y

float

Y coordinate.

z

float

Z coordinate (or depth).

Product

A Product contains ReferenceImages.

Fields
name

string

The resource name of the product.

Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID.

This field is ignored when creating a product.

display_name

string

The user-provided name for this Product. Must not be empty. Must be at most 4096 characters long.

description

string

User-provided metadata to be stored with this product. Must be at most 4096 characters long.

product_category

string

The category for the product identified by the reference image. This should be either "homegoods", "apparel", or "toys".

This field is immutable.

product_labels[]

KeyValue

Key-value pairs that can be attached to a product. At query time, constraints can be specified based on the product_labels.

Note that integer values can be provided as strings, e.g. "1199". Only strings with integer values can match a range-based restriction which is to be supported soon.

Multiple values can be assigned to the same key. One product may have up to 100 product_labels.

KeyValue

A product label represented as a key-value pair.

Fields
key

string

The key of the label attached to the product. Cannot be empty and cannot exceed 128 bytes.

value

string

The value of the label attached to the product. Cannot be empty and cannot exceed 128 bytes.

ProductSearchParams

Parameters for a product search request.

Fields
bounding_poly

BoundingPoly

The bounding polygon around the area of interest in the image. Optional. If it is not specified, system discretion will be applied.

product_set

string

The resource name of a ProductSet to be searched for similar images.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

product_categories[]

string

The list of product categories to search in. Currently, we only consider the first category, and either "homegoods", "apparel", or "toys" should be specified.

filter

string

The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key.

For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but not "(color = red OR brand = Google)" or "color: red".

ProductSearchResults

Results for a product search request.

Fields
index_time

Timestamp

Timestamp of the index which provided these results. Changes made after this time are not reflected in the current results.

results[]

Result

List of results, one for each product match.

product_grouped_results[]

GroupedResult

List of results grouped by products detected in the query image. Each entry corresponds to one bounding polygon in the query image, and contains the matching products specific to that region. There may be duplicate product matches in the union of all the per-product results.

GroupedResult

Information about the products similar to a single product in a query image.

Fields
bounding_poly

BoundingPoly

The bounding polygon around the product detected in the query image.

results[]

Result

List of results, one for each product match.

object_annotations[]

ObjectAnnotation

List of generic predictions for the object in the bounding box.

ObjectAnnotation

Prediction for what the object in the bounding box is.

Fields
mid

string

Object ID that should align with EntityAnnotation mid.

language_code

string

The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

name

string

Object name, expressed in its language_code language.

score

float

Score of the result. Range [0, 1].

Result

Information about a product.

Fields
product

Product

The Product.

score

float

A confidence level on the match, ranging from 0 (no confidence) to 1 (full confidence).

image

string

The resource name of the image from the product that is the closest match to the query.

ProductSet

A ProductSet contains Products. A ProductSet can contain a maximum of 1 million reference images. If the limit is exceeded, periodic indexing will fail.

Fields
name

string

The resource name of the ProductSet.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

This field is ignored when creating a ProductSet.

display_name

string

The user-provided name for this ProductSet. Must not be empty. Must be at most 4096 characters long.

index_time

Timestamp

Output only. The time at which this ProductSet was last indexed. Query results will reflect all updates before this time. If this ProductSet has never been indexed, this timestamp is the default value "1970-01-01T00:00:00Z".

This field is ignored when creating a ProductSet.

index_error

Status

Output only. If there was an error with indexing the product set, the field is populated.

This field is ignored when creating a ProductSet.

Property

A Property consists of a user-supplied name/value pair.

Fields
name

string

Name of the property.

value

string

Value of the property.

uint64_value

uint64

Value of numeric properties.

confidence

float

Value in range [0..1]. Confidence of this property value.

mid

string

Opaque property value ID. Some IDs may be available in Google Knowledge Graph Search API. An example property for a blue coat would be: Property { name: 'color' value: 'blue' mid: '/m/01g5v' // For color blue }

QualityOptimizationParams

Parameters for image quality optimizations.

Fields
type

Type

Choose one optimization type.

compression_config

CompressionConfig

Specify compression configuration.

enhancement_config

EnhancementConfig

Specify auto enhancement configuration.

quality_score_config

QualityScoreConfig

Specify quality score configuration.

CompressionConfig

Configuration for COMPRESSION.

Fields
target_quality

float

In range [0, 1]. Target quality after compression. 1 means lossless compared to input image, 0 means no minimum quality requirement.

EnhancementConfig

Configuration for ENHANCMENT. If not specify enhancement_config, default values sharpening_level equals to 0.5, auto_hdr_level equals to 0.5 and upscale_ratio equals to 1 will be used. If you want to customize any of the three parameters, you need to specify the whole EnhancementConfig. For example, if you want to use higher auto_hdr_level, which usually will make the image brighter, and keep sharpnening level and upscale ratio the same as default, you can set the config as: enhancement_config { sharpening_level: 0.5 auto_hdr_level: 1.0 upscale_ratio: 1 }

Fields
sharpening_level

float

In range [0,1]. Level of sharpening, 0 means no sharpening, 1 means largest sharpening. Default is 0.5.

auto_hdr_level

float

In range [0,1]. Level of Auto HDR, 0 means no auto HDR, 1 means largest AutoHDR. Default is 0.5.

upscale_ratio

float

In range [1, 2]. Whether do upscaling, default value will be 1, which means no upscaling. If specified, the output height and width will be equals to original height and width times upscale_ratio.

QualityScoreConfig

Configuration for QUALITY_SCORE.

Fields
quality_model

string

Specify which model to be used. Default value is empty string, and aesthetic score will be returned. Another supported quality model is "builtin/technical-score", which will return image technical quality.

Type

Quality optimization type enum.

Enums
TYPE_UNSPECIFIED Invalid. Customer must select one Type.
COMPRESSION Reduce image file size. Detailed params specified in CompressionConfig. If customer do not specify CompressionConfig, it will reduce image file size while not reducing image quality. If customer specify CompressionConfig, we will reduce file size while keeping CompressionParams.target_quality.
ENHANCEMENT Denoise, sharpening, HDR and upscaling. Detailed params specified in EnhancementConfig. If customer do not specify EnhancmentConfig, it will do image enhancement using default values. If upscale_ratio not specified, the output image will have the same resolution as input image.
QUALITY_SCORE Query quality score for an image. Detailed params specified in QualityScoreConfig. If customer does not specify QualityScoreConfig, aesthetic score of image will be returned.

QualityOptimizationResult

Stores enhanced image bytes.

Fields
quality_optimization_type

Type

Required optimization type.

image

bytes

Optimized image bytes.

mime_type

string

Mime type of the output image.

ReferenceImage

A ReferenceImage represents a product image and its associated metadata, such as bounding boxes.

Fields
name

string

The resource name of the reference image.

Format is:

projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID.

This field is ignored when creating a reference image.

uri

string

The Google Cloud Storage URI of the reference image.

The URI must start with gs://.

Required.

bounding_polys[]

BoundingPoly

Bounding polygons around the areas of interest in the reference image. Optional. If this field is empty, the system will try to detect regions of interest. At most 10 bounding polygons will be used.

The provided shape is converted into a non-rotated rectangle. Once converted, the small edge of the rectangle must be greater than or equal to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5 is not).

RemoveProductFromProductSetRequest

Request message for the RemoveProductFromProductSet method.

Fields
name

string

The resource name for the ProductSet to modify.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID

product

string

The resource name for the Product to be removed from this ProductSet.

Format is: projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID

SafeSearchAnnotation

Set of features pertaining to the image, computed by computer vision methods over safe-search verticals (for example, adult, spoof, medical, violence).

Fields
adult

Likelihood

Represents the adult content likelihood for the image. Adult content may contain elements such as nudity, pornographic images or cartoons, or sexual activities.

spoof

Likelihood

Spoof likelihood. The likelihood that an modification was made to the image's canonical version to make it appear funny or offensive.

medical

Likelihood

Likelihood that this is a medical image.

violence

Likelihood

Likelihood that this image contains violent content.

racy

Likelihood

Likelihood that the request image contains racy content. Racy content may include (but is not limited to) skimpy or sheer clothing, strategically covered nudity, lewd or provocative poses, or close-ups of sensitive body areas.

Symbol

A single symbol representation.

Fields
property

TextProperty

Additional information detected for the symbol.

bounding_box

BoundingPoly

The bounding box for the symbol. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: * when the text is horizontal it might look like: 0----1 | | 3----2 * when it's rotated 180 degrees around the top-left corner it becomes: 2----3 | | 1----0 and the vertice order will still be (0, 1, 2, 3).

text

string

The actual UTF-8 representation of the symbol.

confidence

float

Confidence of the OCR results for the symbol. Range [0, 1].

Table

A table representation similar to HTML table structure.

Fields
header_rows[]

TableRow

Header rows of the table

body_rows[]

TableRow

Body rows of the table

TableCell

A cell representation inside of tables.

Fields
row_span

int32

How many rows this cell spans.

col_span

int32

How many columns this cell spans.

text_block

Block

Text block for this cell which also contains the normalized bounding box for the cell and deeper structures within a cell if present.

text

string

The merged text value of this cell, omitting any deeper structural information unlike text_block. This is useful for simple cells.

TableRow

A row of table cells.

Fields
cells[]

TableCell

Cells that make up this row.

TableBoundHint

A hint for a table bounding box on the page for table parsing.

Fields
page_number

int32

Optional page number for multi-paged inputs this hint applies to. If not provided, this hint will apply to all pages by default. This value is 1-indexed.

bounding_box

BoundingPoly

Bounding box hint for a table on this page. The coordinates must be normalized to [0,1] and the bounding box must be an axis-aligned rectangle.

TableDetectionOptions

Options for the table detection.

Fields
table_bound_hints[]

TableBoundHint

Optional table bounding box hints that can be provided for complex cases which our algorithm cannot locate the table(s) in.

TextAnnotation

TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. Please refer to the TextAnnotation.TextProperty message definition below for more detail.

Fields
pages[]

Page

List of pages detected by OCR.

text

string

UTF-8 text detected on the pages.

DetectedBreak

Detected start or end of a structural component.

Fields
type

BreakType

Detected break type.

is_prefix

bool

True if break prepends the element.

BreakType

Enum to denote the type of break found. New line, space etc.

Enums
UNKNOWN Unknown break label type.
SPACE Regular space.
SURE_SPACE Sure space (very wide).
EOL_SURE_SPACE Line-wrapping break.
HYPHEN End-line hyphen that is not present in text; does not co-occur with SPACE, LEADER_SPACE, or LINE_BREAK.
LINE_BREAK Line break that ends a paragraph.

DetectedLanguage

Detected language for a structural component.

Fields
language_code

string

The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

confidence

float

Confidence of detected language. Range [0, 1].

TextProperty

Additional information detected on the structural component.

Fields
detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

detected_break

DetectedBreak

Detected start or end of a text segment.

TextDetectionParams

Parameters for text detections. This is used to control TEXT_DETECTION and DOCUMENT_TEXT_DETECTION features.

Fields
disable_orientation_detection

bool

Disables orientation detection such that rotated text will not be detected. This is only supported for DOCUMENT_TEXT_DETECTION.

disable_text_annotations

bool

Disables the old text_annotations field. Only full_text_annotations will be returned.

page_filter

FieldMask

Controls what data is returned at the page level in full_text_annotation. Default when unset: All fields are included

block_filter

FieldMask

Controls what data is returned at the block level in full_text_annotation. Default when unset: All fields are included except merged_text.

paragraph_filter

FieldMask

Controls what data is returned at the paragraph level in full_text_annotation. Default when unset: All fields are included except merged_text

word_filter

FieldMask

Controls what data is returned at the word level in full_text_annotation. Default when unset: All fields are included except merged_text

symbol_filter

FieldMask

Controls what data is returned at the symbol level in full_text_annotation. Default when unset: All fields are included except bounding_box

UpdateProductRequest

Request message for the UpdateProduct method.

Fields
product

Product

The Product resource which replaces the one on the server. product.name is immutable.

update_mask

FieldMask

The FieldMask that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask paths include product_labels, display_name, and description.

UpdateProductSetRequest

Request message for the UpdateProductSet method.

Fields
product_set

ProductSet

The ProductSet resource which replaces the one on the server.

update_mask

FieldMask

The FieldMask that specifies which fields to update. If update_mask isn't specified, all mutable fields are to be updated. Valid mask path is display_name.

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Fields
x

int32

X coordinate.

y

int32

Y coordinate.

WebDetection

Relevant information for the image from the Internet.

Fields
web_entities[]

WebEntity

Deduced entities from similar images on the Internet.

full_matching_images[]

WebImage

Fully matching images from the Internet. Can include resized copies of the query image.

partial_matching_images[]

WebImage

Partial matching images from the Internet. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops.

pages_with_matching_images[]

WebPage

Web pages containing the matching images from the Internet.

visually_similar_images[]

WebImage

The visually similar image results.

best_guess_labels[]

WebLabel

The service's best guess as to the topic of the request image. Inferred from similar images on the open web.

WebEntity

Entity deduced from similar images on the Internet.

Fields
entity_id

string

Opaque entity ID.

score

float

Overall relevancy score for the entity. Not normalized and not comparable across different image queries.

description

string

Canonical description of the entity, in English.

WebImage

Metadata for online images.

Fields
url

string

The result image URL.

score

float

(Deprecated) Overall relevancy score for the image.

WebLabel

Label to provide extra metadata for the web detection.

Fields
label

string

Label for extra metadata.

language_code

string

The BCP-47 language code for label, such as "en-US" or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

WebPage

Metadata for web pages.

Fields
url

string

The result web page URL.

score

float

(Deprecated) Overall relevancy score for the web page.

page_title

string

Title for the web page, may contain HTML markups.

full_matching_images[]

WebImage

Fully matching images on the page. Can include resized copies of the query image.

partial_matching_images[]

WebImage

Partial matching images on the page. Those images are similar enough to share some key-point features. For example an original image will likely have partial matching for its crops.

WebDetectionParams

Parameters for web detection request.

Fields
include_geo_results

bool

Whether to include results derived from the geo information in the image.

Word

A word representation.

Fields
property

TextProperty

Additional information detected for the word.

bounding_box

BoundingPoly

The bounding box for the word. The vertices are in the order of top-left, top-right, bottom-right, bottom-left. When a rotation of the bounding box is detected the rotation is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: * when the text is horizontal it might look like: 0----1 | | 3----2 * when it's rotated 180 degrees around the top-left corner it becomes: 2----3 | | 1----0 and the vertex order will still be (0, 1, 2, 3).

symbols[]

Symbol

List of symbols in the word. The order of the symbols follows the natural reading order.

confidence

float

Confidence of the OCR results for the word. Range [0, 1].

merged_text

string

All UTF-8 text detected in this word. This field is by default not returned unless specified in TextDetectionParams.word_filter.