实施最新的 Google Cloud Vision Api Text/Logo 识别更新 - LabelDetectionConfig - 从 2018 年 9 月 28 日开始?

Implement latest Google Cloud Vision Api Text/Logo Recognition update - LabelDetectionConfig - from Sept 28, 2018?

有人知道如何在 Google Cloud Vision api 中为 PHP 设置 LabelDetectionConfig 吗?

显然发布了新功能,描述如下:https://cloud.google.com/vision/docs/release-notes

改进的检测模型现在可用于以下功能:

标识检测 文本检测 (OCR) 在 LabelDetectionConfig 字段中指定 "builtin/latest" 以使用新模型。

我们将在接下来的 90 天内同时支持当前模型和新模型。 90 天后,当前的检测模型将被弃用,只有新的检测模型将用于所有徽标和文本 (OCR) 检测请求。

这是我的代码现在的样子:

$vision = new VisionClient([
   'projectId' => XXXX
]);
$contents = get_contents($url);
$image = $vision->image($contents, ['LOGO_DETECTION']);
$result = $vision->annotate($image);

根据我假设您正在使用的 this documentation, this parameter is set in the "Feature" object, in the "model" field, and not as indicated in the Vision API release notes (LabelDetectionConfig). Taking a look at the PHP client,它允许您设置一个“$features”数组,因此,您可以使用 "model" 参数和 "builtin/latest"值。