Create

Creates and returns a new ReferenceImage resource

11 variables
9 variables

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

To use this building block you will have to grant access to at least one of the following scopes:

  • View and manage your data across Google Cloud Platform services
  • Apply machine learning models to understand and label images

Input

This building block consumes 11 input parameters

  = Parameter name
  = Format

parent STRING Required

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

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

referenceImageId 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 /

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

boundingPolys[] OBJECT

A bounding polygon for the detected image annotation

boundingPolys[].normalizedVertices[] OBJECT

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

boundingPolys[].normalizedVertices[].y FLOAT

Y coordinate

boundingPolys[].normalizedVertices[].x FLOAT

X coordinate

boundingPolys[].vertices[] OBJECT

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

boundingPolys[].vertices[].x INTEGER

X coordinate

boundingPolys[].vertices[].y INTEGER

Y coordinate

Output

This building block provides 9 output parameters

  = Parameter name
  = Format

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

boundingPolys[] OBJECT

A bounding polygon for the detected image annotation

boundingPolys[].normalizedVertices[] OBJECT

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

boundingPolys[].normalizedVertices[].y FLOAT

Y coordinate

boundingPolys[].normalizedVertices[].x FLOAT

X coordinate

boundingPolys[].vertices[] OBJECT

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

boundingPolys[].vertices[].x INTEGER

X coordinate

boundingPolys[].vertices[].y INTEGER

Y coordinate