Google Cloud Vision API 图像文件大小的当前限制是多少

What is the current limit for Google Cloud Vision API image file size

在我的 Java 项目中,我使用 Google Cloud Vision API 从图像中提取文本。对于文本提取,我使用以下 piece of code.

今天,我发现 Google 更改了最大文件大小的限制。以前是 4 MB。

现在,基于 Quotas and Limits and Supported Images,对于托管在云存储或可公开访问的 URL 的图像,最大图像文件大小应为 20 MB ].还有最大 JSON 请求对象大小 (10 MB)。

我将选项与托管在云存储上的图像一起使用。对于大于 ~7.95 MB (12000 x 6500) 的图像,我收到一条错误消息:

responses {
  error {
    code: 3
    message: "Invalid image contents: gs://... ."
  }
}

对于较小尺寸的图像,我得到了正确的响应。我知道 TEXT_DETECTION 和 DOCUMENT_TEXT_DETECTION 功能的推荐尺寸为 1024 x 768,但根据以下注释,更大的尺寸应该不是问题:

Note: generally, the Vision API requires images to be a sufficient size so that important features within the request can be easily distinguished. Sizes smaller or larger than these recommended sizes may work. However, smaller sizes may result in lower accuracy, while larger sizes may increase processing time and bandwidth usage without providing comparable benefits in accuracy.

有什么我没有注意到的吗?

注意:我在直接调用 Vision API 时遇到同样的错误(参见 Bearer tokens section)。

根据官方文档:https://cloud.google.com/vision/docs/supported-files?hl=th

File size

Image files sent to the Cloud Vision API should not exceed 20MB. Reducing your file size can significantly improve throughput; however, be careful not to reduce image quality in the process. Note that the Vision API imposes a 10MB JSON request size limit; larger files should be hosted on Cloud Storage or on the web, rather than being passed as base64-encoded content in the JSON itself.

Google 对 75M 的图像像素有未记录的限制。 12000 x 6500 的图像恰好超过了这个限制。