【发布时间】:2023-03-16 12:21:02
【问题描述】:
我已经在 Vertex AI(GCP 中 AI Platform 下的一项服务)中训练了一个 AutoML 对象检测模型。我正在尝试访问每个标签的模型评估指标(精度、召回率、准确性等),以获取不同的 Confidence Score Threshold 和 IoU Threshold。
但是,我被困在第一步,甚至是让模型的性能指标远远低于粒度级别的性能指标。我关注了this instruction,但我似乎无法弄清楚evaluation_id是什么(另见官方示例代码sn-p here),即:
def get_model_evaluation_image_object_detection_sample(
project: str,
model_id: str,
evaluation_id: str,
location: str = "us-central1",
api_endpoint: str = "us-central1-aiplatform.googleapis.com",
):
# The AI Platform services require regional API endpoints.
client_options = {"api_endpoint": api_endpoint}
# Initialize client that will be used to create and send requests.
# This client only needs to be created once, and can be reused for multiple requests.
client = aiplatform.gapic.ModelServiceClient(client_options=client_options)
name = client.model_evaluation_path(
project=project, location=location, model=model_id, evaluation=evaluation_id
)
response = client.get_model_evaluation(name=name)
print("response:", response)
一段时间后,我发现对于在欧盟训练的模型,api_endpoint 应传递为:
location: str = "europe-west4"
api_endpoint: str = "europe-west4-aiplatform.googleapis.com"
但无论我为 evaluation_id 尝试什么都会导致以下错误:
InvalidArgument: 400 List of found errors: 1.Field: name; Message: Invalid ModelEvaluation resource name.
在它说的文档中(它似乎包含我需要的东西):
对于边界框度量,Vertex AI 返回一个度量数组 不同 IoU 阈值(介于 0 和 1 之间)的值和 置信度阈值(介于 0 和 1 之间)。例如,您可以 在 IoU 阈值为 0.85 和 置信度阈值为 0.8228。通过查看这些不同的阈值 值,您可以看到它们如何影响其他指标,例如精度 并回忆。
在不知道输出数组中包含的情况下,这对每个类如何工作?基本上,我需要为每个类提供不同 IoU 阈值和置信度阈值的模型指标。
我也尝试从 AutoML API 查询,例如:
client_options = {'api_endpoint': 'eu-automl.googleapis.com:443'}
client = automl.AutoMlClient(client_options=client_options)
# Get the full path of the model.
model_full_id = client.model_path(project_id, "europe-west4", model_id)
print("List of model evaluations:")
for evaluation in client.list_model_evaluations(parent=model_full_id, filter=""):
print("Model evaluation name: {}".format(evaluation.name))
print("Model annotation spec id: {}".format(evaluation.annotation_spec_id))
print("Create Time: {}".format(evaluation.create_time))
print("Evaluation example count: {}".format(evaluation.evaluated_example_count))
print(
"Classification model evaluation metrics: {}".format(
evaluation.classification_evaluation_metrics
)
)
毫不奇怪,这也不起作用,并导致:
InvalidArgument: 400 List of found errors: 1.Field: parent; Message: The provided location ID doesn't match the endpoint. For automl.googleapis.com, the valid location ID is `us-central1`. For eu-automl.googleapis.com, the valid location ID is `eu`.
【问题讨论】:
标签: google-cloud-platform google-cloud-automl google-cloud-vertex-ai