Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small updates to Vision examples. #3227

Merged
merged 1 commit into from
Mar 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions docs/vision-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ You can call the detection method manually.
>>> features = [Feature(FeatureTypes.FACE_DETECTION, 5),
... Feature(FeatureTypes.LOGO_DETECTION, 3)]
>>> annotations = image.detect(features)
>>> len(annotations.faces)
>>> len(annotations)
2
>>> for face in annotations.faces:
... print(face.joy_likelihood)
0.94099093
0.54453093
>>> len(annotations.logos)
2
>>> for logo in annotations.logos:
>>> for face in annotations[0].faces:
... print(face.joy)
Likelihood.VERY_LIKELY
Likelihood.VERY_LIKELY
Likelihood.VERY_LIKELY
>>> for logo in annotations[0].logos:
... print(logo.description)
'google'
'github'
Expand Down Expand Up @@ -140,15 +139,15 @@ was detected.
>>> faces = image.detect_faces(limit=10)
>>> first_face = faces[0]
>>> first_face.landmarks.left_eye.landmark_type
<LandmarkTypes.LEFT_EYE: 'LEFT_EYE'>
LandmarkTypes.LEFT_EYE
>>> first_face.landmarks.left_eye.position.x_coordinate
1301.2404
>>> first_face.detection_confidence
0.9863683
>>> first_face.joy
<Likelihood.VERY_LIKELY: 'VERY_LIKELY'>
Likelihood.VERY_UNLIKELY
>>> first_face.anger
<Likelihood.VERY_UNLIKELY: 'VERY_UNLIKELY'>
Likelihood.VERY_UNLIKELY


***************
Expand Down Expand Up @@ -250,13 +249,13 @@ categorize the entire contents of the image under four categories.
... image = client.image(content=image_file.read())
>>> safe_search = image.detect_safe_search()
>>> safe_search.adult
<Likelihood.VERY_UNLIKELY: 'VERY_UNLIKELY'>
Likelihood.VERY_UNLIKELY
>>> safe_search.spoof
<Likelihood.POSSIBLE: 'POSSIBLE'>
Likelihood.POSSIBLE
>>> safe_search.medical
<Likelihood.VERY_LIKELY: 'VERY_LIKELY'>
Likelihood.VERY_LIKELY
>>> safe_search.violence
<Likelihood.LIKELY: 'LIKELY'>
Likelihood.LIKELY


**************
Expand Down Expand Up @@ -297,9 +296,9 @@ image and determine the dominant colors in the image.
>>> properties = image.detect_properties()
>>> colors = properties.colors
>>> first_color = colors[0]
>>> first_color.red
>>> first_color.color.red
244.0
>>> first_color.blue
>>> first_color.color.blue
134.0
>>> first_color.score
0.65519291
Expand Down