从 Google Vision API 获取标签百分比
Get label percentages from Google Vision API
我想使用 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 库实现此目的?
注解有一个 Score
(进一步查看 C# example page),它落在 [0,1] 范围内。
if (annotation.Description != null)
{
Console.WriteLine($"{annotation.Description} ({annotation.Score}");
}
我想使用 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 库实现此目的?
注解有一个 Score
(进一步查看 C# example page),它落在 [0,1] 范围内。
if (annotation.Description != null)
{
Console.WriteLine($"{annotation.Description} ({annotation.Score}");
}