【问题标题】:Get label percentages from Google Vision API从 Google Vision API 获取标签百分比
【发布时间】:2017-08-28 20:15:26
【问题描述】:

我想使用 Google Vision API 进行标签检测。为此,我正在使用 .NET 库。这是我的代码:

        var client = ImageAnnotatorClient.Create();
        // Load the image file into memory
        var image = Image.FromFile("trui3.jpg");
        // Performs label detection on the image file
        var response = client.DetectLabels(image);
        foreach (var annotation in response)
        {
            if (annotation.Description != null)
                Console.WriteLine(annotation.Description);
        }
        Console.ReadKey();

效果很好。它显示所有标签。但在 Google website 上,它还显示标签的百分比。示例请参见图片。

如何使用 .NET 库来实现这一点?

【问题讨论】:

    标签: c# google-cloud-vision


    【解决方案1】:

    注解有一个Score(进一步向下查看C# example page),它位于[0,1] 范围内。

    if (annotation.Description != null)
    {
      Console.WriteLine($"{annotation.Description} ({annotation.Score}");
    }
    

    【讨论】:

      猜你喜欢
      • 2018-03-17
      • 2019-11-09
      • 1970-01-01
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      相关资源
      最近更新 更多