首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AutoML语言实体提取score_threshold不接受为参数

AutoML语言实体提取score_threshold不接受为参数
EN

Stack Overflow用户
提问于 2021-03-16 17:21:03
回答 1查看 95关注 0票数 0

环境细节

  • 操作系统类型和版本: Windows 10,WSL 2,Ubuntu 16.04
  • Python版本: 3.7.5
  • 和平执行方案版本: 19.3.1
  • google-cloud-automl版本: 2.2.0

复制步骤

  1. 调用以AutoML为参数的score_threshold语言实体提取

代码示例

代码语言:javascript
复制
options = ClientOptions(api_endpoint='automl.googleapis.com')
prediction_client = automl_v1.PredictionServiceClient(client_options=options)
payload = {'text_snippet': {'content': 'sample text', 'mime_type': 'text/plain'} }
params = {"score_threshold": "0.04"}
request = prediction_client.predict(name=model_name, payload=payload, params=params)

堆栈跟踪

代码语言:javascript
复制
Traceback (most recent call last):
  File "/mnt/d/alexa/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/mnt/d/alexa/lib/python3.7/site-packages/grpc/_channel.py", line 923, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/mnt/d/alexa/lib/python3.7/site-packages/grpc/_channel.py", line 826, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.INVALID_ARGUMENT
        details = "List of found errors:        1.Field: params; Message: Key `score_threshold` is not supported.      "
        debug_error_string = "{"created":"@1615914477.923586200","description":"Error received from peer ipv4:172.217.4.74:***","file":"src/core/lib/surface/call.cc","file_line":1061,"grpc_message":"List of found errors:\t1.Field: params; Message: Key `score_threshold` is not supported.\t","grpc_status":3}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "google_keyword_generation.py", line 167, in <module>
    call_nlp()
  File "google_keyword_generation.py", line 137, in call_nlp
    request = prediction_client.predict(name=model_name, payload=payload, params=params)
  File "/mnt/d/alexa/lib/python3.7/site-packages/google/cloud/automl_v1/services/prediction_service/client.py", line 498, in predict
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/mnt/d/alexa/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
    return wrapped_func(*args, **kwargs)
  File "/mnt/d/alexa/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.InvalidArgument: 400 List of found errors:   1.Field: params; Message: Key `score_threshold` is not supported.
EN

回答 1

Stack Overflow用户

发布于 2021-03-17 08:01:22

参数params -> score_threshold,不能用于AutoML NL实体提取。这仅适用于AutoML视觉分类和AutoML视觉对象检测。见用于预测()的python引用

(Sequence~.prediction_service.PredictRequest.ParamsEntry) params - 附加特定于域的参数,任何字符串都必须长达25000个字符. AutoML视觉分类 score_threshold:(浮点)从0.0到1.0的值。当模型对图像进行预测时,它只会产生至少具有这个可信度的结果。缺省值为0.5。 AutoML视觉目标检测 score_threshold:(浮点)当模型检测到图像上的对象时,它只会产生至少有这个置信度的边界框。值在0到1范围内,默认值为0.5。 max_bounding_box_count:(int64)返回的边框的最大数量。缺省值为100。服务器可能会限制返回的边界框的数量。

但是,如果使用的是AutoML NL分类,则可以使用预测()设置score_threshold。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66660206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档