FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add image.detect() for detecting multiple types. by daspecster · Pull Request #2770 · googleapis/google-cloud-python · GitHub

Add image.detect() for detecting multiple types. - #2770

Merged
daspecster merged 3 commits into
googleapis:masterfrom
daspecster:add-manual-detect-to-vision-2697
Nov 30, 2016
Merged

Add image.detect() for detecting multiple types.#2770
daspecster merged 3 commits into
googleapis:masterfrom
daspecster:add-manual-detect-to-vision-2697

Conversation

daspecster commented Nov 24, 2016
edited
Loading

Copy link
Copy Markdown
Contributor

Closes #2697, #2769

daspecster added the api: vision Issues related to the Cloud Vision API. label Nov 24, 2016
googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 24, 2016
daspecster force-pushed the add-manual-detect-to-vision-2697 branch from 5c6485d to 74eef27 Compare November 24, 2016 16:06
daspecster mentioned this pull request Nov 28, 2016
10 tasks

Copy link
Copy Markdown
Contributor Author

Bumpidy bump bump.

Comment thread docs/vision-annotations.rst Outdated
==================

Image Annotations
~~~~~~~~~~~~~~~~~

This comment was marked as spam.

Comment thread vision/unit_tests/test_client.py Outdated
self.assertEqual(items.labels[2].description, 'truck')
self.assertEqual(items.labels[2].score, 0.88429511)

image_request = client._connection._requested[0]['data']['requests'][0]

This comment was marked as spam.

Comment thread vision/unit_tests/test_client.py Outdated
from google.cloud.vision.feature import FeatureTypes
from unit_tests._fixtures import LABEL_DETECTION_RESPONSE
from unit_tests._fixtures import LOGO_DETECTION_RESPONSE
RETURNED = LABEL_DETECTION_RESPONSE

This comment was marked as spam.

Comment thread vision/unit_tests/test_client.py Outdated
from unit_tests._fixtures import LOGO_DETECTION_RESPONSE
RETURNED = LABEL_DETECTION_RESPONSE
LOGOS = LOGO_DETECTION_RESPONSE['responses'][0]['logoAnnotations']
RETURNED['responses'][0]['logoAnnotations'] = LOGOS

This comment was marked as spam.

from google.cloud.vision.entity import EntityAnnotation
from google.cloud.vision.face import Face
from google.cloud.vision.feature import FeatureTypes
from google.cloud.vision.color import ImagePropertiesAnnotation

This comment was marked as spam.


for feature_type, annotation in response.items():
annotations[feature_type].extend(
_entity_from_response_type(feature_type, annotation))

This comment was marked as spam.

texts = annotations.get(
_REVERSE_TYPES[FeatureTypes.TEXT_DETECTION], [])

return cls(faces=faces, properties=properties, labels=labels,

This comment was marked as spam.


def _entity_from_response_type(feature_type, results):
"""Convert a JSON result to an entity type based on the feature."""

This comment was marked as spam.



def _entity_from_response_type(feature_type, results):
"""Convert a JSON result to an entity type based on the feature."""

This comment was marked as spam.

"""Convert a JSON result to an entity type based on the feature."""

detected_objects = []
if feature_type == _REVERSE_TYPES[FeatureTypes.FACE_DETECTION]:

This comment was marked as spam.

Copy link
Copy Markdown
Contributor Author

Great feedback!

I was able to remove a good chunk of code from your suggestions.

daspecster force-pushed the add-manual-detect-to-vision-2697 branch from 2da9e85 to a720bff Compare November 29, 2016 21:29

Copy link
Copy Markdown
Contributor Author

Rebased to get rid of the conflict.

"""
def __init__(self, faces=None, properties=None, labels=None,
landmarks=None, logos=None, safe_searches=None, texts=None):
self.faces = faces or ()

This comment was marked as spam.

'logoAnnotations': 'logos',
'safeSearchAnnotation': 'safe_searches',
'textAnnotations': 'texts'
}

This comment was marked as spam.

:class:`~google.cloud.vision.safe.SafeSearchAnnotation`.
"""
detected_objects = []
if feature_type == 'faceAnnotations':

This comment was marked as spam.

IMAGE_PROPERTIES_ANNOTATION = 'imagePropertiesAnnotation'
SAFE_SEARCH_ANNOTATION = 'safeSearchAnnotation'

KEY_MAP = {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

dhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM after nit

daspecster force-pushed the add-manual-detect-to-vision-2697 branch from ec99e2f to 52aaf05 Compare November 30, 2016 03:14

Copy link
Copy Markdown
Contributor Author

Travis went green so I'm merging.

daspecster merged commit 5cbbcb9 into googleapis:master Nov 30, 2016
daspecster deleted the add-manual-detect-to-vision-2697 branch November 30, 2016 03:31

FACE_ANNOTATIONS = 'faceAnnotations'
IMAGE_PROPERTIES_ANNOTATION = 'imagePropertiesAnnotation'
SAFE_SEARCH_ANNOTATION = 'safeSearchAnnotation'

This comment was marked as spam.

This comment was marked as spam.

richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
…to-vision-2697

Add image.detect() for detecting multiple types.
parthea pushed a commit that referenced this pull request Oct 21, 2023
…2697

Add image.detect() for detecting multiple types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vision Issues related to the Cloud Vision API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL