当前位置: 首页 > 知识库问答 >
问题:

谷歌云视觉API文本检测谷歌。加克斯。错误。RetryError:GaxError

田焕
2023-03-14

我是谷歌API的新手。最近,我使用了Google Vision API,但遇到了以下问题:

google.gax.errors.RetryError: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.RESOURCE_EXHAUSTED, Insufficient tokens for quota 'DefaultGroup' and limit 'USER-100s' of service 'vision.googleapis.com' for consumer 'project_number:XXX'.)>)

我尝试了“创建服务帐户”的解决方案,以生成服务json键并在py中调用它。脚本,它将在几乎3~4个url中首先工作,但在下一个url中会出错。这是我的检测代码:

import argparse
import io
from google.cloud import vision
vision_client = vision.Client.from_service_account_json('/Users/bruce0621/Downloads/esun-bank-adc1897dba67.json')
...
def detect_text_uri(uri):
    """Detects text in the file located in Google Cloud Storage or on the Web.
    """
    vision_client = vision.Client()
    image = vision_client.image(source_uri=uri)

    texts = image.detect_text()
    print('Texts:')

    for text in texts:
        print('\n"{}"'.format(text.description))

        vertices = (['({},{})'.format(bound.x_coordinate, bound.y_coordinate)
                    for bound in text.bounds.vertices])

        print('bounds: {}'.format(','.join(vertices)))

我在另一个py中调用“detect.py”。脚本:

detect.detect_text_uri('...')

共有1个答案

史高阳
2023-03-14

电话:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/credentials.json

gcloud auth application-default login

这将配置您的环境以使用您下载的服务帐户凭据。

 类似资料:
  • 我想从谷歌云视觉应用编程接口中获取数据,并看到输入可以以Base64和图像uri格式给出。但是Base64似乎太长了,以uri上传图像需要一些额外的时间。请让我知道,如果有人知道这方面的任何其他工作。

  • 我正在尝试Google Cloud Vision API(测试版),它返回“权限被拒绝”消息。但该项目启用了“云视觉API”。感谢您的帮助。 谷歌API浏览器中的错误详细信息

  • 我使用这个API来进行测试https://cloud.google.com/vision/docs/ocr测试引擎。 请求机构: 结果就是 我错过什么了吗?非常感谢。

  • 我正在使用谷歌云视觉应用编程接口来搜索类似的图像(网络检测),它工作得很好。谷歌检测完全匹配的图像和部分匹配的图像(裁剪版本)。 我正在寻找一种方法来检测更多不同的版本。例如,当我寻找一个标志时,我想检测这个标志的大、小、方形、矩形...版本。目前,我检测到与我上传和裁剪版本完全匹配的图像。 你知道这是否可能,我该怎么做?

  • 我知道可以使用谷歌API视觉在网上找到类似的图片。我的目标是根据我的图像数据库找到类似的图像。我不想在网上看到类似的图片。 可能吗? 如果是,你能给我一些链接或建议吗? 谢谢