Vision Web Annotations#

Web Annotations#

Web image search.

class google.cloud.vision.web.WebDetection(web_entities=(), full_matching_images=(), partial_matching_images=(), pages_with_matching_images=())[source]#

Bases: object

Representation of a web detection sent from the Vision API.

Parameters:
  • web_entities (list) – List of google.cloud.proto.vision.v1.                         web_detection_pb2.WebDetection.WebEntity.
  • full_matching_images (list) – List of google.cloud.proto.vision.v1.                                 web_detection_pb2.WebDetection.WebImage.
  • partial_matching_images (list) – List of google.cloud.proto.vision.v1.                                    web_detection_pb2.WebDetection.WebImage.
  • pages_with_matching_images (list) – List of google.cloud.proto.vision.v1.                                       web_detection_pb2.WebDetection.                                       WebPage.
classmethod from_api_repr(detection)[source]#

Factory: construct WebDetection from Vision API response.

Parameters:detection (dict) – Dictionary representing a WebDetection.
Return type:WebDetection
Returns:Populated instance of WebDetection.
classmethod from_pb(detection)[source]#

Factory: construct WebDetection from Vision API response.

Parameters:detection (WebDetection) – Dictionary representing a WebDetection.
Return type:WebDetection
Returns:Populated instance of WebDetection.
full_matching_images#

Return the full matching images.

Return type:list
Returns:A list of WebImage instances.
pages_with_matching_images#

Return the web pages with matching images.

Return type:list
Returns:A list of WebPage instances.
partial_matching_images#

Return the partially matching images.

Return type:list
Returns:A list of WebImage instances.
web_entities#

Return the web entities.

Return type:list
Returns:A list of WebEntity instances.
class google.cloud.vision.web.WebEntity(entity_id, score, description)[source]#

Bases: object

Object containing a web entity sent from the Vision API.

Parameters:
  • entity_id (str) – ID string for the entity.
  • score (float) – Overall relevancy score for the entity.
  • description (str) – Description of the entity.
description#

Canonical description of the entity, in English.

Return type:str
Returns:Description of the entity.
entity_id#

The entity ID.

Return type:str
Returns:String representing the entity ID. Opaque.
classmethod from_api_repr(web_entity)[source]#

Factory: construct WebImage from Vision API response.

Parameters:web_entity (dict) – Dictionary representing a web entity
Return type:WebEntity
Returns:Populated instance of WebEntity.
classmethod from_pb(web_entity)[source]#

Factory: construct WebEntity from Vision API response.

Parameters:web_entity (WebEntity) – Dictionary representing a web entity
Return type:WebEntity
Returns:Populated instance of WebEntity.
score#

Overall relevancy score for the image.

Note

Not normalized nor comparable between requests.

Return type:float
Returns:Relevancy score as a float.
class google.cloud.vision.web.WebImage(url, score)[source]#

Bases: object

Object containing image information elsewhere on the web.

Parameters:
  • url (str) – URL of the matched image.
  • score (float) – Overall relevancy score of the image.
classmethod from_api_repr(web_image)[source]#

Factory: construct WebImage from Vision API response.

Parameters:web_image (dict) – Dictionary representing a web image
Return type:WebImage
Returns:Populated instance of WebImage.
classmethod from_pb(web_image)[source]#

Factory: construct WebImage from Vision API response.

Parameters:web_image (WebImage) – Dictionary representing a web image
Return type:WebImage
Returns:Populated instance of WebImage.
score#

Overall relevancy score for the image.

Note

Not normalized nor comparable between requests.

Return type:float
Returns:Relevancy score as a float.
url#

The URL of the matched image.

Return type:str
Returns:URL of matched image.
class google.cloud.vision.web.WebPage(url, score)[source]#

Bases: object

Web page that may contain this image or a similar one.

Parameters:
  • url (str) – URL of the matched image.
  • score (float) – Overall relevancy score of the image.
classmethod from_api_repr(web_page)[source]#

Factory: construct WebPage from Vision API response.

Parameters:web_page (dict) – Dictionary representing a web page
Return type:WebPage
Returns:Populated instance of WebPage.
classmethod from_pb(web_page)[source]#

Factory: construct WebPage from Vision API response.

Parameters:web_page (WebPage) – Dictionary representing a web image
Return type:WebPage
Returns:Populated instance of WebPage.
score#

Overall relevancy score for the image.

Note

Not normalized nor comparable between requests.

Return type:float
Returns:Relevancy score as a float.
url#

The page URL.

Return type:str
Returns:String representing a URL.