Vision Entity#

Entity#

Entity class for holding information returned from annotating an image.

class google.cloud.vision.entity.EntityAnnotation(bounds, description, locale, locations, mid, score)[source]#

Bases: object

Representation of an entity returned from the Vision API.

Parameters:
  • bounds (dict) – Dictionary of bounary information of detected entity.
  • description (str) – Description of entity detected in an image.
  • locale (str) – The language code for the locale in which the entity textual description (next field) is expressed.
  • locations (list of LocationInformation.) – List of LocationInformation instances.
  • mid (str) – Opaque entity ID.
  • score (float) – Overall score of the result. Range [0, 1].
bounds#

Bounding polygon of detected image feature.

Return type:Bounds
Returns:Instance of Bounds with populated vertices.
description#

Description of feature detected in image.

Return type:str
Returns:String description of feature detected in image.
classmethod from_api_repr(response)[source]#

Factory: construct entity from Vision API response.

Parameters:response (dict) – Dictionary response from Vision API with entity data.
Return type:EntityAnnotation
Returns:Instance of EntityAnnotation.
classmethod from_pb(response)[source]#

Factory: construct entity from Vision gRPC response.

Parameters:response (AnnotateImageResponse) – gRPC response from Vision API with entity data.
Return type:EntityAnnotation
Returns:Instance of EntityAnnotation.
locale#

The language code for text discovered in an image.

Return type:str
Returns:String language code of text found in the image.
locations#

Location coordinates landmarks detected.

Return type:LocationInformation
Returns:LocationInformation populated with latitude and longitude of object detected in an image.
mid#

MID of feature detected in image.

Return type:str
Returns:String MID of feature detected in image.
score#

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

Return type:float
Returns:Overall score of the result. Range [0, 1].