【问题标题】:AutoML Language Entity Extraction score_threshold not accepted as a parameter不接受 AutoML 语言实体提取 score_threshold 作为参数
【发布时间】:2021-06-14 00:44:18
【问题描述】:
环境细节
  • 操作系统类型和版本:Windows 10、WSL 2、Ubuntu 16.04
  • Python 版本:3.7.5
  • pip 版本:19.3.1
  • google-cloud-automl 版本:2.2.0
重现步骤
  1. 以 score_threshold 作为参数调用 AutoML 语言实体提取
代码示例
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)
堆栈跟踪
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.

【问题讨论】:

    标签: python google-cloud-automl google-cloud-automl-nl


    【解决方案1】:

    参数params -> score_threshold 不适用于 AutoML NL 实体提取。这仅适用于 AutoML 视觉分类和 AutoML 视觉对象检测。请参阅python reference for predict()

    参数 (Sequence[~.prediction_service.PredictRequest.ParamsEntry]) –

    附加域特定参数,任何字符串都必须达到 25000 字符长。

    AutoML 视觉分类

    score_threshold : (float) 一个从 0.0 到 1.0 的值。当模型 对图像进行预测,它只会产生具有 至少这个置信度得分。默认值为 0.5。

    AutoML 视觉对象检测

    score_threshold : (float) 当模型检测到图像上的物体时,它 只会产生至少有这个置信度的边界框 分数。值在 0 到 1 范围内,默认为 0.5。

    max_bounding_box_count : (int64) 最大边界框数 回来。默认为 100。返回的边界框数 可能会受到服务器的限制。

    但如果您使用 AutoML NL 分类,可以使用 batch_predict() 设置 score_threshold。

    【讨论】:

      猜你喜欢
      • 2020-10-01
      • 1970-01-01
      • 2020-12-26
      • 1970-01-01
      • 2012-01-14
      • 2016-09-04
      • 1970-01-01
      • 2019-04-25
      • 1970-01-01
      相关资源
      最近更新 更多