Skip to content

Commit 29d18bc

Browse files
authored
Merge pull request #3227 from daspecster/update-vision-examples
Small updates to Vision examples.
2 parents b01e43a + 55768c8 commit 29d18bc

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

docs/vision-usage.rst

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@ You can call the detection method manually.
8484
>>> features = [Feature(FeatureTypes.FACE_DETECTION, 5),
8585
... Feature(FeatureTypes.LOGO_DETECTION, 3)]
8686
>>> annotations = image.detect(features)
87-
>>> len(annotations.faces)
87+
>>> len(annotations)
8888
2
89-
>>> for face in annotations.faces:
90-
... print(face.joy_likelihood)
91-
0.94099093
92-
0.54453093
93-
>>> len(annotations.logos)
94-
2
95-
>>> for logo in annotations.logos:
89+
>>> for face in annotations[0].faces:
90+
... print(face.joy)
91+
Likelihood.VERY_LIKELY
92+
Likelihood.VERY_LIKELY
93+
Likelihood.VERY_LIKELY
94+
>>> for logo in annotations[0].logos:
9695
... print(logo.description)
9796
'google'
9897
'github'
@@ -140,15 +139,15 @@ was detected.
140139
>>> faces = image.detect_faces(limit=10)
141140
>>> first_face = faces[0]
142141
>>> first_face.landmarks.left_eye.landmark_type
143-
<LandmarkTypes.LEFT_EYE: 'LEFT_EYE'>
142+
LandmarkTypes.LEFT_EYE
144143
>>> first_face.landmarks.left_eye.position.x_coordinate
145144
1301.2404
146145
>>> first_face.detection_confidence
147146
0.9863683
148147
>>> first_face.joy
149-
<Likelihood.VERY_LIKELY: 'VERY_LIKELY'>
148+
Likelihood.VERY_UNLIKELY
150149
>>> first_face.anger
151-
<Likelihood.VERY_UNLIKELY: 'VERY_UNLIKELY'>
150+
Likelihood.VERY_UNLIKELY
152151
153152
154153
***************
@@ -250,13 +249,13 @@ categorize the entire contents of the image under four categories.
250249
... image = client.image(content=image_file.read())
251250
>>> safe_search = image.detect_safe_search()
252251
>>> safe_search.adult
253-
<Likelihood.VERY_UNLIKELY: 'VERY_UNLIKELY'>
252+
Likelihood.VERY_UNLIKELY
254253
>>> safe_search.spoof
255-
<Likelihood.POSSIBLE: 'POSSIBLE'>
254+
Likelihood.POSSIBLE
256255
>>> safe_search.medical
257-
<Likelihood.VERY_LIKELY: 'VERY_LIKELY'>
256+
Likelihood.VERY_LIKELY
258257
>>> safe_search.violence
259-
<Likelihood.LIKELY: 'LIKELY'>
258+
Likelihood.LIKELY
260259
261260
262261
**************
@@ -297,9 +296,9 @@ image and determine the dominant colors in the image.
297296
>>> properties = image.detect_properties()
298297
>>> colors = properties.colors
299298
>>> first_color = colors[0]
300-
>>> first_color.red
299+
>>> first_color.color.red
301300
244.0
302-
>>> first_color.blue
301+
>>> first_color.color.blue
303302
134.0
304303
>>> first_color.score
305304
0.65519291

0 commit comments

Comments
 (0)