As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Vision v1 API

class google.cloud.vision_v1.types.AddProductToProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the AddProductToProductSet method.

name

Required. The resource name for the ProductSet to modify.

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

Type

str

product

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

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

Type

str

class google.cloud.vision_v1.types.AnnotateFileRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

input_config

Required. Information about the input file.

Type

google.cloud.vision_v1.types.InputConfig

features

Required. Requested features.

Type

Sequence[google.cloud.vision_v1.types.Feature]

image_context

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

Type

google.cloud.vision_v1.types.ImageContext

pages

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.

Type

Sequence[int]

class google.cloud.vision_v1.types.AnnotateFileResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

input_config

Information about the file for which this response is generated.

Type

google.cloud.vision_v1.types.InputConfig

responses

Individual responses to images found within the file. This field will be empty if the error field is set.

Type

Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]

total_pages

This field gives the total number of pages in the file.

Type

int

error

If set, represents the error message for the failed request. The responses field will not be set in this case.

Type

google.rpc.status_pb2.Status

class google.cloud.vision_v1.types.AnnotateImageRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

image

The image to be processed.

Type

google.cloud.vision_v1.types.Image

features

Requested features.

Type

Sequence[google.cloud.vision_v1.types.Feature]

image_context

Additional context that may accompany the image.

Type

google.cloud.vision_v1.types.ImageContext

class google.cloud.vision_v1.types.AnnotateImageResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to an image annotation request.

face_annotations

If present, face detection has completed successfully.

Type

Sequence[google.cloud.vision_v1.types.FaceAnnotation]

landmark_annotations

If present, landmark detection has completed successfully.

Type

Sequence[google.cloud.vision_v1.types.EntityAnnotation]

logo_annotations

If present, logo detection has completed successfully.

Type

Sequence[google.cloud.vision_v1.types.EntityAnnotation]

label_annotations

If present, label detection has completed successfully.

Type

Sequence[google.cloud.vision_v1.types.EntityAnnotation]

localized_object_annotations

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

Type

Sequence[google.cloud.vision_v1.types.LocalizedObjectAnnotation]

text_annotations

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

Type

Sequence[google.cloud.vision_v1.types.EntityAnnotation]

full_text_annotation

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

Type

google.cloud.vision_v1.types.TextAnnotation

safe_search_annotation

If present, safe-search annotation has completed successfully.

Type

google.cloud.vision_v1.types.SafeSearchAnnotation

image_properties_annotation

If present, image properties were extracted successfully.

Type

google.cloud.vision_v1.types.ImageProperties

crop_hints_annotation

If present, crop hints have completed successfully.

Type

google.cloud.vision_v1.types.CropHintsAnnotation

web_detection

If present, web detection has completed successfully.

Type

google.cloud.vision_v1.types.WebDetection

product_search_results

If present, product search has completed successfully.

Type

google.cloud.vision_v1.types.ProductSearchResults

error

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.

Type

google.rpc.status_pb2.Status

context

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

Type

google.cloud.vision_v1.types.ImageAnnotationContext

class google.cloud.vision_v1.types.AsyncAnnotateFileRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

An offline file annotation request.

input_config

Required. Information about the input file.

Type

google.cloud.vision_v1.types.InputConfig

features

Required. Requested features.

Type

Sequence[google.cloud.vision_v1.types.Feature]

image_context

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

Type

google.cloud.vision_v1.types.ImageContext

output_config

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

Type

google.cloud.vision_v1.types.OutputConfig

class google.cloud.vision_v1.types.AsyncAnnotateFileResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for a single offline file annotation request.

output_config

The output location and metadata from AsyncAnnotateFileRequest.

Type

google.cloud.vision_v1.types.OutputConfig

class google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

requests

Required. Individual async file annotation requests for this batch.

Type

Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]

parent

Optional. Target project and location to make a call.

Format: projects/{project-id}/locations/{location-id}.

If no parent is specified, a region will be chosen automatically.

Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union.

Example: projects/project-A/locations/eu.

Type

str

class google.cloud.vision_v1.types.AsyncBatchAnnotateFilesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to an async batch file annotation request.

responses

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

Type

Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileResponse]

class google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for async image annotation for a list of images.

requests

Required. Individual image annotation requests for this batch.

Type

Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]

output_config

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

Type

google.cloud.vision_v1.types.OutputConfig

parent

Optional. Target project and location to make a call.

Format: projects/{project-id}/locations/{location-id}.

If no parent is specified, a region will be chosen automatically.

Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union.

Example: projects/project-A/locations/eu.

Type

str

class google.cloud.vision_v1.types.AsyncBatchAnnotateImagesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to an async batch image annotation request.

output_config

The output location and metadata from AsyncBatchAnnotateImagesRequest.

Type

google.cloud.vision_v1.types.OutputConfig

class google.cloud.vision_v1.types.BatchAnnotateFilesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

requests

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

Type

Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]

parent

Optional. Target project and location to make a call.

Format: projects/{project-id}/locations/{location-id}.

If no parent is specified, a region will be chosen automatically.

Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union.

Example: projects/project-A/locations/eu.

Type

str

class google.cloud.vision_v1.types.BatchAnnotateFilesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A list of file annotation responses.

responses

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

Type

Sequence[google.cloud.vision_v1.types.AnnotateFileResponse]

class google.cloud.vision_v1.types.BatchAnnotateImagesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

requests

Required. Individual image annotation requests for this batch.

Type

Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]

parent

Optional. Target project and location to make a call.

Format: projects/{project-id}/locations/{location-id}.

If no parent is specified, a region will be chosen automatically.

Supported location-ids: us: USA country only, asia: East asia areas, like Japan, Taiwan, eu: The European Union.

Example: projects/project-A/locations/eu.

Type

str

class google.cloud.vision_v1.types.BatchAnnotateImagesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to a batch image annotation request.

responses

Individual responses to image annotation requests within the batch.

Type

Sequence[google.cloud.vision_v1.types.AnnotateImageResponse]

class google.cloud.vision_v1.types.BatchOperationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

state

The current state of the batch operation.

Type

google.cloud.vision_v1.types.BatchOperationMetadata.State

submit_time

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

Type

google.protobuf.timestamp_pb2.Timestamp

end_time

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

Type

google.protobuf.timestamp_pb2.Timestamp

class State(value)[source]

Bases: proto.enums.Enum

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

CANCELLED = 4
FAILED = 3
PROCESSING = 1
STATE_UNSPECIFIED = 0
SUCCESSFUL = 2
class google.cloud.vision_v1.types.Block(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Logical element on the page.

property

Additional information detected for the block.

Type

google.cloud.vision_v1.types.TextAnnotation.TextProperty

bounding_box

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).

Type

google.cloud.vision_v1.types.BoundingPoly

paragraphs

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

Type

Sequence[google.cloud.vision_v1.types.Paragraph]

block_type

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

Type

google.cloud.vision_v1.types.Block.BlockType

confidence

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

Type

float

class BlockType(value)[source]

Bases: proto.enums.Enum

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

BARCODE = 5
PICTURE = 3
RULER = 4
TABLE = 2
TEXT = 1
UNKNOWN = 0
class google.cloud.vision_v1.types.BoundingPoly(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A bounding polygon for the detected image annotation.

vertices

The bounding polygon vertices.

Type

Sequence[google.cloud.vision_v1.types.Vertex]

normalized_vertices

The bounding polygon normalized vertices.

Type

Sequence[google.cloud.vision_v1.types.NormalizedVertex]

class google.cloud.vision_v1.types.ColorInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

color

RGB components of the color.

Type

google.type.color_pb2.Color

score

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

Type

float

pixel_fraction

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

Type

float

class google.cloud.vision_v1.types.CreateProductRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the CreateProduct method.

parent

Required. The project in which the Product should be created.

Format is projects/PROJECT_ID/locations/LOC_ID.

Type

str

product

Required. The product to create.

Type

google.cloud.vision_v1.types.Product

product_id

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

Type

str

class google.cloud.vision_v1.types.CreateProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the CreateProductSet method.

parent

Required. The project in which the ProductSet should be created.

Format is projects/PROJECT_ID/locations/LOC_ID.

Type

str

product_set

Required. The ProductSet to create.

Type

google.cloud.vision_v1.types.ProductSet

product_set_id

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

Type

str

class google.cloud.vision_v1.types.CreateReferenceImageRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the CreateReferenceImage method.

parent

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

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

Type

str

reference_image

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

Type

google.cloud.vision_v1.types.ReferenceImage

reference_image_id

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

Type

str

class google.cloud.vision_v1.types.CropHint(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

bounding_poly

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

Type

google.cloud.vision_v1.types.BoundingPoly

confidence

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

Type

float

importance_fraction

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

Type

float

class google.cloud.vision_v1.types.CropHintsAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

crop_hints

Crop hint results.

Type

Sequence[google.cloud.vision_v1.types.CropHint]

class google.cloud.vision_v1.types.CropHintsParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Parameters for crop hints annotation request.

aspect_ratios

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.

Type

Sequence[float]

class google.cloud.vision_v1.types.DeleteProductRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the DeleteProduct method.

name

Required. Resource name of product to delete.

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

Type

str

class google.cloud.vision_v1.types.DeleteProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the DeleteProductSet method.

name

Required. Resource name of the ProductSet to delete.

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

Type

str

class google.cloud.vision_v1.types.DeleteReferenceImageRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the DeleteReferenceImage method.

name

Required. The resource name of the reference image to delete.

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

Type

str

class google.cloud.vision_v1.types.DominantColorsAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Set of dominant colors and their corresponding scores.

colors

RGB color values with their score and pixel fraction.

Type

Sequence[google.cloud.vision_v1.types.ColorInfo]

class google.cloud.vision_v1.types.EntityAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Set of detected entity features.

mid

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

Type

str

locale

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

Type

str

description

Entity textual description, expressed in its locale language.

Type

str

score

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

Type

float

confidence

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].

Type

float

topicality

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].

Type

float

bounding_poly

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

Type

google.cloud.vision_v1.types.BoundingPoly

locations

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.

Type

Sequence[google.cloud.vision_v1.types.LocationInfo]

properties

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

Type

Sequence[google.cloud.vision_v1.types.Property]

class google.cloud.vision_v1.types.FaceAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A face annotation object contains the results of face detection.

bounding_poly

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.

Type

google.cloud.vision_v1.types.BoundingPoly

fd_bounding_poly

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.

Type

google.cloud.vision_v1.types.BoundingPoly

landmarks

Detected face landmarks.

Type

Sequence[google.cloud.vision_v1.types.FaceAnnotation.Landmark]

roll_angle

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].

Type

float

pan_angle

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].

Type

float

tilt_angle

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

Type

float

detection_confidence

Detection confidence. Range [0, 1].

Type

float

landmarking_confidence

Face landmarking confidence. Range [0, 1].

Type

float

joy_likelihood

Joy likelihood.

Type

google.cloud.vision_v1.types.Likelihood

sorrow_likelihood

Sorrow likelihood.

Type

google.cloud.vision_v1.types.Likelihood

anger_likelihood

Anger likelihood.

Type

google.cloud.vision_v1.types.Likelihood

surprise_likelihood

Surprise likelihood.

Type

google.cloud.vision_v1.types.Likelihood

under_exposed_likelihood

Under-exposed likelihood.

Type

google.cloud.vision_v1.types.Likelihood

blurred_likelihood

Blurred likelihood.

Type

google.cloud.vision_v1.types.Likelihood

headwear_likelihood

Headwear likelihood.

Type

google.cloud.vision_v1.types.Likelihood

class Landmark(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

type_

Face landmark type.

Type

google.cloud.vision_v1.types.FaceAnnotation.Landmark.Type

position

Face landmark position.

Type

google.cloud.vision_v1.types.Position

class Type(value)[source]

Bases: proto.enums.Enum

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.

CHIN_GNATHION = 32
CHIN_LEFT_GONION = 33
CHIN_RIGHT_GONION = 34
FOREHEAD_GLABELLA = 31
LEFT_CHEEK_CENTER = 35
LEFT_EAR_TRAGION = 27
LEFT_EYE = 1
LEFT_EYEBROW_UPPER_MIDPOINT = 25
LEFT_EYE_BOTTOM_BOUNDARY = 19
LEFT_EYE_LEFT_CORNER = 20
LEFT_EYE_PUPIL = 29
LEFT_EYE_RIGHT_CORNER = 18
LEFT_EYE_TOP_BOUNDARY = 17
LEFT_OF_LEFT_EYEBROW = 3
LEFT_OF_RIGHT_EYEBROW = 5
LOWER_LIP = 10
MIDPOINT_BETWEEN_EYES = 7
MOUTH_CENTER = 13
MOUTH_LEFT = 11
MOUTH_RIGHT = 12
NOSE_BOTTOM_CENTER = 16
NOSE_BOTTOM_LEFT = 15
NOSE_BOTTOM_RIGHT = 14
NOSE_TIP = 8
RIGHT_CHEEK_CENTER = 36
RIGHT_EAR_TRAGION = 28
RIGHT_EYE = 2
RIGHT_EYEBROW_UPPER_MIDPOINT = 26
RIGHT_EYE_BOTTOM_BOUNDARY = 23
RIGHT_EYE_LEFT_CORNER = 24
RIGHT_EYE_PUPIL = 30
RIGHT_EYE_RIGHT_CORNER = 22
RIGHT_EYE_TOP_BOUNDARY = 21
RIGHT_OF_LEFT_EYEBROW = 4
RIGHT_OF_RIGHT_EYEBROW = 6
UNKNOWN_LANDMARK = 0
UPPER_LIP = 9
class google.cloud.vision_v1.types.Feature(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

type_

The feature type.

Type

google.cloud.vision_v1.types.Feature.Type

max_results

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

Type

int

model

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

Type

str

class Type(value)[source]

Bases: proto.enums.Enum

Type of Google Cloud Vision API feature to be extracted.

CROP_HINTS = 9
DOCUMENT_TEXT_DETECTION = 11
FACE_DETECTION = 1
IMAGE_PROPERTIES = 7
LABEL_DETECTION = 4
LANDMARK_DETECTION = 2
LOGO_DETECTION = 3
OBJECT_LOCALIZATION = 19
SAFE_SEARCH_DETECTION = 6
TEXT_DETECTION = 5
TYPE_UNSPECIFIED = 0
WEB_DETECTION = 10
class google.cloud.vision_v1.types.GcsDestination(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

Google Cloud Storage URI prefix where the results will be stored. Results will be in JSON format and preceded by its corresponding input URI prefix. This field can either represent a gcs file prefix or gcs directory. In either case, the uri should be unique because in order to get all of the output files, you will need to do a wildcard gcs search on the uri prefix you provide.

Examples:

  • File Prefix: gs://bucket-name/here/filenameprefix The output files will be created in gs://bucket-name/here/ and the names of the output files will begin with “filenameprefix”.

  • Directory Prefix: gs://bucket-name/some/location/ The output files will be created in gs://bucket-name/some/location/ and the names of the output files could be anything because there was no filename prefix specified.

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.

Type

str

class google.cloud.vision_v1.types.GcsSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

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

Type

str

class google.cloud.vision_v1.types.GetProductRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the GetProduct method.

name

Required. Resource name of the Product to get.

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

Type

str

class google.cloud.vision_v1.types.GetProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the GetProductSet method.

name

Required. Resource name of the ProductSet to get.

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

Type

str

class google.cloud.vision_v1.types.GetReferenceImageRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the GetReferenceImage method.

name

Required. The resource name of the ReferenceImage to get.

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

Type

str

class google.cloud.vision_v1.types.Image(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Client image to perform Google Cloud Vision API tasks over.

content

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.

Currently, this field only works for BatchAnnotateImages requests. It does not work for AsyncBatchAnnotateImages requests.

Type

bytes

source

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.

Type

google.cloud.vision_v1.types.ImageSource

class google.cloud.vision_v1.types.ImageAnnotationContext(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

uri

The URI of the file used to produce the image.

Type

str

page_number

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

Type

int

class google.cloud.vision_v1.types.ImageContext(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Image context and/or feature-specific parameters.

lat_long_rect

Not used.

Type

google.cloud.vision_v1.types.LatLongRect

language_hints

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.

Type

Sequence[str]

crop_hints_params

Parameters for crop hints annotation request.

Type

google.cloud.vision_v1.types.CropHintsParams

product_search_params

Parameters for product search.

Type

google.cloud.vision_v1.types.ProductSearchParams

web_detection_params

Parameters for web detection.

Type

google.cloud.vision_v1.types.WebDetectionParams

text_detection_params

Parameters for text detection and document text detection.

Type

google.cloud.vision_v1.types.TextDetectionParams

class google.cloud.vision_v1.types.ImageProperties(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Stores image properties, such as dominant colors.

dominant_colors

If present, dominant colors completed successfully.

Type

google.cloud.vision_v1.types.DominantColorsAnnotation

class google.cloud.vision_v1.types.ImageSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

gcs_image_uri

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.

Type

str

image_uri

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.

Type

str

class google.cloud.vision_v1.types.ImportProductSetsGcsSource(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

csv_file_uri

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][google.cloud.vision.v1.Product.display_name], the product-category column refers to [product_category][google.cloud.vision.v1.Product.product_category], and the labels column refers to [product_labels][google.cloud.vision.v1.Product.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][google.cloud.vision.v1.Product.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).

Type

str

class google.cloud.vision_v1.types.ImportProductSetsInputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The input content for the ImportProductSets method.

gcs_source

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

Type

google.cloud.vision_v1.types.ImportProductSetsGcsSource

class google.cloud.vision_v1.types.ImportProductSetsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ImportProductSets method.

parent

Required. The project in which the ProductSets should be imported.

Format is projects/PROJECT_ID/locations/LOC_ID.

Type

str

input_config

Required. The input content for the list of requests.

Type

google.cloud.vision_v1.types.ImportProductSetsInputConfig

class google.cloud.vision_v1.types.ImportProductSetsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ImportProductSets method.

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

reference_images

The list of reference_images that are imported successfully.

Type

Sequence[google.cloud.vision_v1.types.ReferenceImage]

statuses

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.

Type

Sequence[google.rpc.status_pb2.Status]

class google.cloud.vision_v1.types.InputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The desired input location and metadata.

gcs_source

The Google Cloud Storage location to read the input from.

Type

google.cloud.vision_v1.types.GcsSource

content

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.

Type

bytes

mime_type

The type of the file. Currently only “application/pdf”, “image/tiff” and “image/gif” are supported. Wildcards are not supported.

Type

str

class google.cloud.vision_v1.types.LatLongRect(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Rectangle determined by min and max LatLng pairs.

min_lat_lng

Min lat/long pair.

Type

google.type.latlng_pb2.LatLng

max_lat_lng

Max lat/long pair.

Type

google.type.latlng_pb2.LatLng

class google.cloud.vision_v1.types.Likelihood(value)[source]

Bases: proto.enums.Enum

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

LIKELY = 4
POSSIBLE = 3
UNKNOWN = 0
UNLIKELY = 2
VERY_LIKELY = 5
VERY_UNLIKELY = 1
class google.cloud.vision_v1.types.ListProductSetsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ListProductSets method.

parent

Required. The project from which ProductSets should be listed.

Format is projects/PROJECT_ID/locations/LOC_ID.

Type

str

page_size

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

Type

int

page_token

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

Type

str

class google.cloud.vision_v1.types.ListProductSetsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ListProductSets method.

product_sets

List of ProductSets.

Type

Sequence[google.cloud.vision_v1.types.ProductSet]

next_page_token

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

Type

str

property raw_page
class google.cloud.vision_v1.types.ListProductsInProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ListProductsInProductSet method.

name

Required. The ProductSet resource for which to retrieve Products.

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

Type

str

page_size

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

Type

int

page_token

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

Type

str

class google.cloud.vision_v1.types.ListProductsInProductSetResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ListProductsInProductSet method.

products

The list of Products.

Type

Sequence[google.cloud.vision_v1.types.Product]

next_page_token

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

Type

str

property raw_page
class google.cloud.vision_v1.types.ListProductsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ListProducts method.

parent

Required. The project OR ProductSet from which Products should be listed.

Format: projects/PROJECT_ID/locations/LOC_ID

Type

str

page_size

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

Type

int

page_token

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

Type

str

class google.cloud.vision_v1.types.ListProductsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ListProducts method.

products

List of products.

Type

Sequence[google.cloud.vision_v1.types.Product]

next_page_token

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

Type

str

property raw_page
class google.cloud.vision_v1.types.ListReferenceImagesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the ListReferenceImages method.

parent

Required. Resource name of the product containing the reference images.

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

Type

str

page_size

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

Type

int

page_token

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.

Type

str

class google.cloud.vision_v1.types.ListReferenceImagesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response message for the ListReferenceImages method.

reference_images

The list of reference images.

Type

Sequence[google.cloud.vision_v1.types.ReferenceImage]

page_size

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

Type

int

next_page_token

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

Type

str

property raw_page
class google.cloud.vision_v1.types.LocalizedObjectAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Set of detected objects with bounding boxes.

mid

Object ID that should align with EntityAnnotation mid.

Type

str

language_code

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.

Type

str

name

Object name, expressed in its language_code language.

Type

str

score

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

Type

float

bounding_poly

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

Type

google.cloud.vision_v1.types.BoundingPoly

class google.cloud.vision_v1.types.LocationInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected entity location information.

lat_lng

lat/long location coordinates.

Type

google.type.latlng_pb2.LatLng

class google.cloud.vision_v1.types.NormalizedVertex(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

x

X coordinate.

Type

float

y

Y coordinate.

Type

float

class google.cloud.vision_v1.types.OperationMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Contains metadata for the BatchAnnotateImages operation.

state

Current state of the batch operation.

Type

google.cloud.vision_v1.types.OperationMetadata.State

create_time

The time when the batch request was received.

Type

google.protobuf.timestamp_pb2.Timestamp

update_time

The time when the operation result was last updated.

Type

google.protobuf.timestamp_pb2.Timestamp

class State(value)[source]

Bases: proto.enums.Enum

Batch operation states.

CANCELLED = 4
CREATED = 1
DONE = 3
RUNNING = 2
STATE_UNSPECIFIED = 0
class google.cloud.vision_v1.types.OutputConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The desired output location and metadata.

gcs_destination

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

Type

google.cloud.vision_v1.types.GcsDestination

batch_size

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.

Type

int

class google.cloud.vision_v1.types.Page(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected page from OCR.

property

Additional information detected on the page.

Type

google.cloud.vision_v1.types.TextAnnotation.TextProperty

width

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

Type

int

height

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

Type

int

blocks

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

Type

Sequence[google.cloud.vision_v1.types.Block]

confidence

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

Type

float

class google.cloud.vision_v1.types.Paragraph(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

property

Additional information detected for the paragraph.

Type

google.cloud.vision_v1.types.TextAnnotation.TextProperty

bounding_box

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).

Type

google.cloud.vision_v1.types.BoundingPoly

words

List of all words in this paragraph.

Type

Sequence[google.cloud.vision_v1.types.Word]

confidence

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

Type

float

class google.cloud.vision_v1.types.Position(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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.

x

X coordinate.

Type

float

y

Y coordinate.

Type

float

z

Z coordinate (or depth).

Type

float

class google.cloud.vision_v1.types.Product(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A Product contains ReferenceImages.

name

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.

Type

str

display_name

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

Type

str

description

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

Type

str

product_category

Immutable. The category for the product identified by the reference image. This should be one of “homegoods-v2”, “apparel-v2”, “toys-v2”, “packagedgoods-v1” or “general-v1”. The legacy categories “homegoods”, “apparel”, and “toys” are still supported, but these should not be used for new products.

Type

str

product_labels

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 500 product_labels.

Notice that the total number of distinct product_labels over all products in one ProductSet cannot exceed 1M, otherwise the product search pipeline will refuse to work for that ProductSet.

Type

Sequence[google.cloud.vision_v1.types.Product.KeyValue]

class KeyValue(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A product label represented as a key-value pair.

key

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

Type

str

value

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

Type

str

class google.cloud.vision_v1.types.ProductSearchParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Parameters for a product search request.

bounding_poly

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

Type

google.cloud.vision_v1.types.BoundingPoly

product_set

The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to be searched for similar images.

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

Type

str

product_categories

The list of product categories to search in. Currently, we only consider the first category, and either “homegoods-v2”, “apparel-v2”, “toys-v2”, “packagedgoods-v1”, or “general-v1” should be specified. The legacy categories “homegoods”, “apparel”, and “toys” are still supported but will be deprecated. For new products, please use “homegoods-v2”, “apparel-v2”, or “toys-v2” for better product search accuracy. It is recommended to migrate existing products to these categories as well.

Type

Sequence[str]

filter

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. An ‘=’ should be used to connect the key and value. For example, “(color = red OR color = blue) AND brand = Google” is acceptable, but “(color = red OR brand = Google)” is not acceptable. “color: red” is not acceptable because it uses a ‘:’ instead of an ‘=’.

Type

str

class google.cloud.vision_v1.types.ProductSearchResults(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Results for a product search request.

index_time

Timestamp of the index which provided these results. Products added to the product set and products removed from the product set after this time are not reflected in the current results.

Type

google.protobuf.timestamp_pb2.Timestamp

results

List of results, one for each product match.

Type

Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]

product_grouped_results

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.

Type

Sequence[google.cloud.vision_v1.types.ProductSearchResults.GroupedResult]

class GroupedResult(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

bounding_poly

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

Type

google.cloud.vision_v1.types.BoundingPoly

results

List of results, one for each product match.

Type

Sequence[google.cloud.vision_v1.types.ProductSearchResults.Result]

object_annotations

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

Type

Sequence[google.cloud.vision_v1.types.ProductSearchResults.ObjectAnnotation]

class ObjectAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Prediction for what the object in the bounding box is.

mid

Object ID that should align with EntityAnnotation mid.

Type

str

language_code

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.

Type

str

name

Object name, expressed in its language_code language.

Type

str

score

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

Type

float

class Result(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about a product.

product

The Product.

Type

google.cloud.vision_v1.types.Product

score

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

Type

float

image

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

Type

str

class google.cloud.vision_v1.types.ProductSet(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

name

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.

Type

str

display_name

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

Type

str

index_time

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.

Type

google.protobuf.timestamp_pb2.Timestamp

index_error

Output only. If there was an error with indexing the product set, the field is populated. This field is ignored when creating a ProductSet.

Type

google.rpc.status_pb2.Status

class google.cloud.vision_v1.types.ProductSetPurgeConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Config to control which ProductSet contains the Products to be deleted.

product_set_id

The ProductSet that contains the Products to delete. If a Product is a member of product_set_id in addition to other ProductSets, the Product will still be deleted.

Type

str

class google.cloud.vision_v1.types.Property(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

name

Name of the property.

Type

str

value

Value of the property.

Type

str

uint64_value

Value of numeric properties.

Type

int

class google.cloud.vision_v1.types.PurgeProductsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the PurgeProducts method.

product_set_purge_config

Specify which ProductSet contains the Products to be deleted.

Type

google.cloud.vision_v1.types.ProductSetPurgeConfig

delete_orphan_products

If delete_orphan_products is true, all Products that are not in any ProductSet will be deleted.

Type

bool

parent

Required. The project and location in which the Products should be deleted.

Format is projects/PROJECT_ID/locations/LOC_ID.

Type

str

force

The default value is false. Override this value to true to actually perform the purge.

Type

bool

class google.cloud.vision_v1.types.ReferenceImage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

name

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.

Type

str

uri

Required. The Google Cloud Storage URI of the reference image.

The URI must start with gs://.

Type

str

bounding_polys

Optional. Bounding polygons around the areas of interest in the reference image. 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).

Type

Sequence[google.cloud.vision_v1.types.BoundingPoly]

class google.cloud.vision_v1.types.RemoveProductFromProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the RemoveProductFromProductSet method.

name

Required. The resource name for the ProductSet to modify.

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

Type

str

product

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

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

Type

str

class google.cloud.vision_v1.types.SafeSearchAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

adult

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

Type

google.cloud.vision_v1.types.Likelihood

spoof

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

Type

google.cloud.vision_v1.types.Likelihood

medical

Likelihood that this is a medical image.

Type

google.cloud.vision_v1.types.Likelihood

violence

Likelihood that this image contains violent content.

Type

google.cloud.vision_v1.types.Likelihood

racy

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.

Type

google.cloud.vision_v1.types.Likelihood

adult_confidence

Confidence of adult_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

spoof_confidence

Confidence of spoof_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

medical_confidence

Confidence of medical_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

violence_confidence

Confidence of violence_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

racy_confidence

Confidence of racy_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

nsfw_confidence

Confidence of nsfw_score. Range [0, 1]. 0 means not confident, 1 means very confident.

Type

float

class google.cloud.vision_v1.types.Symbol(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A single symbol representation.

property

Additional information detected for the symbol.

Type

google.cloud.vision_v1.types.TextAnnotation.TextProperty

bounding_box

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 vertex order will still be (0, 1, 2, 3).

Type

google.cloud.vision_v1.types.BoundingPoly

text

The actual UTF-8 representation of the symbol.

Type

str

confidence

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

Type

float

class google.cloud.vision_v1.types.TextAnnotation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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][google.cloud.vision.v1.TextAnnotation.TextProperty] message definition below for more detail.

pages

List of pages detected by OCR.

Type

Sequence[google.cloud.vision_v1.types.Page]

text

UTF-8 text detected on the pages.

Type

str

class DetectedBreak(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected start or end of a structural component.

type_

Detected break type.

Type

google.cloud.vision_v1.types.TextAnnotation.DetectedBreak.BreakType

is_prefix

True if break prepends the element.

Type

bool

class BreakType(value)[source]

Bases: proto.enums.Enum

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

EOL_SURE_SPACE = 3
HYPHEN = 4
LINE_BREAK = 5
SPACE = 1
SURE_SPACE = 2
UNKNOWN = 0
class DetectedLanguage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detected language for a structural component.

language_code

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.

Type

str

confidence

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

Type

float

class TextProperty(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Additional information detected on the structural component.

detected_languages

A list of detected languages together with confidence.

Type

Sequence[google.cloud.vision_v1.types.TextAnnotation.DetectedLanguage]

detected_break

Detected start or end of a text segment.

Type

google.cloud.vision_v1.types.TextAnnotation.DetectedBreak

class google.cloud.vision_v1.types.TextDetectionParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

enable_text_detection_confidence_score

By default, Cloud Vision API only includes confidence score for DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence score for TEXT_DETECTION as well.

Type

bool

class google.cloud.vision_v1.types.UpdateProductRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the UpdateProduct method.

product

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

Type

google.cloud.vision_v1.types.Product

update_mask

The [FieldMask][google.protobuf.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.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.vision_v1.types.UpdateProductSetRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request message for the UpdateProductSet method.

product_set

Required. The ProductSet resource which replaces the one on the server.

Type

google.cloud.vision_v1.types.ProductSet

update_mask

The [FieldMask][google.protobuf.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.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.vision_v1.types.Vertex(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

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

x

X coordinate.

Type

int

y

Y coordinate.

Type

int

class google.cloud.vision_v1.types.WebDetection(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Relevant information for the image from the Internet.

web_entities

Deduced entities from similar images on the Internet.

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebEntity]

full_matching_images

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

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]

partial_matching_images

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.

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]

pages_with_matching_images

Web pages containing the matching images from the Internet.

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebPage]

visually_similar_images

The visually similar image results.

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]

best_guess_labels

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

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebLabel]

class WebEntity(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Entity deduced from similar images on the Internet.

entity_id

Opaque entity ID.

Type

str

score

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

Type

float

description

Canonical description of the entity, in English.

Type

str

class WebImage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for online images.

url

The result image URL.

Type

str

score

(Deprecated) Overall relevancy score for the image.

Type

float

class WebLabel(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Label to provide extra metadata for the web detection.

label

Label for extra metadata.

Type

str

language_code

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.

Type

str

class WebPage(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata for web pages.

url

The result web page URL.

Type

str

score

(Deprecated) Overall relevancy score for the web page.

Type

float

page_title

Title for the web page, may contain HTML markups.

Type

str

full_matching_images

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

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]

partial_matching_images

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.

Type

Sequence[google.cloud.vision_v1.types.WebDetection.WebImage]

class google.cloud.vision_v1.types.WebDetectionParams(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Parameters for web detection request.

include_geo_results

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

Type

bool

class google.cloud.vision_v1.types.Word(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A word representation.

property

Additional information detected for the word.

Type

google.cloud.vision_v1.types.TextAnnotation.TextProperty

bounding_box

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).

Type

google.cloud.vision_v1.types.BoundingPoly

symbols

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

Type

Sequence[google.cloud.vision_v1.types.Symbol]

confidence

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

Type

float