簡體   English   中英

如何調用谷歌視覺遺留模型?

[英]How to call google vision legacy models?

我想使用舊版text_detectiondocument_text_detection model。(參考: https://cloud.google.com/vision/docs/service-announcements )我正在嘗試使用以下features

import io
from google.cloud import vision

vision_client = vision.ImageAnnotatorClient()


with io.open("/mnt/d/snap.png", 'rb') as image_file:
    content = image_file.read()

image = vision.Image(content=content)


response = vision_client.document_text_detection(image=image)
# print(response) --> uses stable models, works fine



feature = vision.Feature(model="builtin/legacy")

response = vision_client.document_text_detection(image=image, features=feature)
# print(response) --> throws error show below

我收到以下錯誤:

TypeError: dict() got multiple values for keyword argument 'features'

我究竟做錯了什么?

嘗試這個:

import io from google.cloud import vision

vision_client = vision.ImageAnnotatorClient()

with io.open("/mnt/d/snap.png", 'rb') as image_file:
    content = image_file.read()

#image = vision.Image(content=content)

response = vision_client.annotate_image({'image': {'content': content},'features': [{'type_': vision.Feature.Type.DOCUMENT_TEXT_DETECTION,'model': "builtin/legacy"}]})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM