首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何称呼谷歌视觉遗留模型?

如何称呼谷歌视觉遗留模型?
EN

Stack Overflow用户
提问于 2022-04-29 19:22:52
回答 1查看 212关注 0票数 1

我想使用遗留的text_detectiondocument_text_detection模型。(参考:https://cloud.google.com/vision/docs/service-announcements)我用features这样做

代码语言:javascript
复制
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

我得到了以下错误:

代码语言:javascript
复制
TypeError: dict() got multiple values for keyword argument 'features'

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-04 19:02:47

试试这个:

代码语言:javascript
复制
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"}]})
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72062818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档