2017-08-01 194 views
1

我使用Python客戶端的谷歌雲願景API,基本相同的代碼作爲文檔http://google-cloud-python.readthedocs.io/en/latest/vision/解析響應

>>> from google.cloud import vision 
>>> client = vision.ImageAnnotatorClient() 
>>> response = client.annotate_image({ 
... 'image': {'source': {'image_uri': 'gs://my-test-bucket/image.jpg'}}, 
... 'features': [{'type': vision.enums.Feature.Type.FACE_DETECTOIN}], 
... }) 

問題是,響應沒有場「註釋」(因爲它是文檔),但基於文檔的每個「類型」都有字段。所以當我嘗試獲得response.face_annotations時,我得到了 ,基本上我不知道如何從響應(AnnotateImageResponse)中提取Vision API的結果以獲得像json/dictionary這樣的數據。 google-cloud-vision版本是0.25.1,它被安裝爲完整的google-cloud庫(pip install google-cloud)。 我想今天是不是我的 一天我明白任何澄清/幫助

回答