导出模型的标签和置信度
Export a Model's Labels and Confidence
我已经通过 Google Cloud Vision 训练了一个模型。在 Evaluate 选项卡上,它向我显示了它所训练的标签列表以及置信度值(见下文)。有什么方法可以将此信息下载为 CSV 格式? EXPORT DATA 不幸的是,它不会这样做,它只会导出图像位置以及一些元数据,没有置信度信息。
要提取评价数据,可以向projects.locations.models.modelEvaluations.list发送GET请求。为此,您将需要 locationId
和 modelId
。
要获取 locationId
,请向 projects.locations.list 发送 GET 请求。获取请求:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations
projects.locations.list returns:
{
"locations": [
{
"name": "projects/your-project-id/locations/eu",
"locationId": "eu"
},
{
"name": "projects/your-project-id/locations/us-central1",
"locationId": "us-central1"
}
]
}
要获取 modelId
,请向 projects.locations.models.list 发送 GET 请求。获取请求:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations/us-central1/models
name:
包含 modelId
在这个例子中它是 ICN1234567890。 projects.locations.models.list returns:
{
"model": [
{
"name": "projects/your-project-id/locations/us-central1/models/ICN1234567890",
"displayName": "flowers_20201217111947",
"datasetId": "ICN8001048258791079936",
"createTime": "2020-12-17T03:20:27.198250Z",
"deploymentState": "UNDEPLOYED",
"updateTime": "2021-09-07T08:59:02.243603Z",
"imageClassificationModelMetadata": {
"stopReason": "MODEL_EARLY_STOPPED",
"modelType": "mobile-versatile-1",
"nodeQps": 3.2,
"trainBudgetMilliNodeHours": "4000",
"trainCostMilliNodeHours": "1882"
}
},...
现在构建评估数据的 GET 请求。使用 projects.locations.models.modelEvaluations.list:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations/us-central1/models/ICN1234567890/modelEvaluations
modelEvaluations.listreturns。请参阅下面的回复片段:
{
"name": "projects/your-project-id/locations/us-central1/models/ICN1234567890/modelEvaluations/8145357881766117082",
"annotationSpecId": "5162564433687347200",
"createTime": "2020-12-17T05:49:10.557128Z",
"classificationEvaluationMetrics": {
"auPrc": 0.99306494,
"confidenceMetricsEntry": [
{
"recall": 1,
"precision": 0.17166212
},
{
"confidenceThreshold": 0.05,....
您可以参考 this 查看为 modelEvaluation 返回的完整字段。通过 modelEvaluations.list 查看 UI 和值的比较:
我已经通过 Google Cloud Vision 训练了一个模型。在 Evaluate 选项卡上,它向我显示了它所训练的标签列表以及置信度值(见下文)。有什么方法可以将此信息下载为 CSV 格式? EXPORT DATA 不幸的是,它不会这样做,它只会导出图像位置以及一些元数据,没有置信度信息。
要提取评价数据,可以向projects.locations.models.modelEvaluations.list发送GET请求。为此,您将需要 locationId
和 modelId
。
要获取 locationId
,请向 projects.locations.list 发送 GET 请求。获取请求:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations
projects.locations.list returns:
{
"locations": [
{
"name": "projects/your-project-id/locations/eu",
"locationId": "eu"
},
{
"name": "projects/your-project-id/locations/us-central1",
"locationId": "us-central1"
}
]
}
要获取 modelId
,请向 projects.locations.models.list 发送 GET 请求。获取请求:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations/us-central1/models
name:
包含 modelId
在这个例子中它是 ICN1234567890。 projects.locations.models.list returns:
{
"model": [
{
"name": "projects/your-project-id/locations/us-central1/models/ICN1234567890",
"displayName": "flowers_20201217111947",
"datasetId": "ICN8001048258791079936",
"createTime": "2020-12-17T03:20:27.198250Z",
"deploymentState": "UNDEPLOYED",
"updateTime": "2021-09-07T08:59:02.243603Z",
"imageClassificationModelMetadata": {
"stopReason": "MODEL_EARLY_STOPPED",
"modelType": "mobile-versatile-1",
"nodeQps": 3.2,
"trainBudgetMilliNodeHours": "4000",
"trainCostMilliNodeHours": "1882"
}
},...
现在构建评估数据的 GET 请求。使用 projects.locations.models.modelEvaluations.list:
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) https://automl.googleapis.com/v1/projects/your-project-id/locations/us-central1/models/ICN1234567890/modelEvaluations
modelEvaluations.listreturns。请参阅下面的回复片段:
{
"name": "projects/your-project-id/locations/us-central1/models/ICN1234567890/modelEvaluations/8145357881766117082",
"annotationSpecId": "5162564433687347200",
"createTime": "2020-12-17T05:49:10.557128Z",
"classificationEvaluationMetrics": {
"auPrc": 0.99306494,
"confidenceMetricsEntry": [
{
"recall": 1,
"precision": 0.17166212
},
{
"confidenceThreshold": 0.05,....
您可以参考 this 查看为 modelEvaluation 返回的完整字段。通过 modelEvaluations.list 查看 UI 和值的比较: