google-cloud-platform - 如何获取 Google Cloud Vision API 徽标检测的置信度分数?
问题描述
如何找到 Google Vision API 的徽标检测方法的概率或可能性(置信度分数)?
我有一张图片,它为徽标提供了这些,而没有一个是正确的。我想在置信度得分方面为它使用一个阈值。
Logos:
Sogndal Fotball
Tequila Herradura
代码:
# Performs logo detection on the image file
response_logo = client.logo_detection(image=image)
logos = response_logo.logo_annotations
print('Logos:')
for logo in logos:
print(logo.description)
if response_logo.error.message:
raise Exception(
'{}\nFor more info on error messages, check: '
'https://cloud.google.com/apis/design/errors'.format(
response_logo.error.message))
解决方案
# Performs logo detection on the image file
response_logo = client.logo_detection(image=image)
logos = response_logo.logo_annotations
print('Logos:')
logos_dict = {}
for logo in logos:
print(logo.description)
print('logo type: ', type(logo))
print(logo)
logos_dict.update({'logo': logo.description,
'logo_score': logo.score})
print(logos_dict)
推荐阅读
- java - 在循环中使用迭代器而不会导致任何异常
- html - 有没有一种简单的方法可以使用 html/css 在文本旁边显示一行
- android - Imageview 动画在滑动手势上开始
- python - 如何在没有 __call__ 函数的情况下调用 torchaudio.transform.Resample?
- angular - e2e 错误:进程以错误代码 135 退出
- javascript - 我们可以用 Cookie 替换本地存储以在基于 NGRX 的身份验证中存储令牌吗?
- php - 如何在 ApiController 的 Yii 1.1 中使用 CORS 过滤器?
- angularjs - Angular js光标中的Contenteditable div在键入时跳到开头
- javascript - 相反的反应组件状态改变
- android - 导入 volley 库后,我的 gradle 构建失败