-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.
Description
The amount of data that Vision can return can be pretty deep and processing more than one image at a time adds another level to that.
Here's my proposed approach to work with multiple images with multiple feature types.
>>> images = client.batch()
>>> for i in range(10):
... images.add_image(client.image(source_uri='gs://%s.jpg' % (i,)))
>>> images.detect_faces()
{'0.jpg': [], '1.jpg': [],}
>>>
>>> # With multiple feature types.
>>> features = [Feature(FeatureTypes.FACE_DETECTION, 5),
... Feature(FeatureTypes.LOGO_DETECTION, 3)]
>>> for i in range(10):
... image = client.image(source_uri='gs://%s.jpg' % (i,))
... images.add_image(image=image, features=features)
>>> images.detect()
With a context manager it could look something like this...
>>> features = [Feature(FeatureTypes.FACE_DETECTION, 5),
... Feature(FeatureTypes.LOGO_DETECTION, 3)]
>>> with client.images() as images:
... for i in range(10):
... image = client.image(source_uri='gs://%s.jpg' % (i,))
... images.add_image(image=image, features=features)
... results = images.detect()
Metadata
Metadata
Assignees
Labels
api: visionIssues related to the Cloud Vision API.Issues related to the Cloud Vision API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.