【问题标题】:Can Google Cloud Vision return more language of label?Google Cloud Vision 能否返回更多语言的标签?
【发布时间】:2019-05-24 02:55:28
【问题描述】:

我尝试了 Google Vision API (PHP) 示例

# includes the autoloader for libraries installed with composer
require __DIR__ . '/vendor/autoload.php';

# imports the Google Cloud client library
use Google\Cloud\Vision\V1\ImageAnnotatorClient;

# instantiates a client
$imageAnnotator = new ImageAnnotatorClient();

# the name of the image file to annotate
$fileName = 'test/data/wakeupcat.jpg';

# prepare the image to be annotated
$image = file_get_contents($fileName);

# performs label detection on the image file
$response = $imageAnnotator->labelDetection($image);
$labels = $response->getLabelAnnotations();

if ($labels) {
    echo("Labels:" . PHP_EOL);
    foreach ($labels as $label) {
        echo($label->getDescription() . PHP_EOL);
    }
} else {
    echo('No label found' . PHP_EOL);
}

我可以得到图像中物体的标签,它很棒,但标签是英文。我可以配置 API 返回其他语言或多语言吗?

P/S: 对不起我的英语不好:(

【问题讨论】:

    标签: php google-api google-cloud-vision


    【解决方案1】:

    作为一种解决方法,您可以尝试使用其他 API 进行翻译,例如: https://github.com/googleapis/google-cloud-php-translate

    亲切的问候

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-01
      • 2019-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多