测试自定义语音模型的识别质量

你可以在 Speech Studio 中检查自定义语音模型的识别质量。 你可以播放上传的音频,确定提供的识别结果是否正确。 成功创建测试后,你可以查看模型对音频数据集的转录情况,或将两个模型中的结果并行进行比较。

并行模型测试可用于验证哪个语音识别模型最适合应用程序。 对准确度进行客观度量需要听录数据集输入,请参阅定量测试模型

重要

测试时,系统将执行听录。 请务必记住这一点,因为定价因服务产品和订阅级别而异。 请务必参阅官方 Azure AI 服务定价获取最新详细信息

创建测试

按这些说明创建测试:

  1. 登录 Speech Studio

  2. 导航到“Speech Studio”>“自定义语音识别”,并从列表中选择你的项目名称。

  3. 选择“测试模型”>“创建新测试” 。

  4. 选择“检查质量(仅音频数据)”>“下一步” 。

  5. 选择要用于测试的音频数据集,然后选择“下一步”。 如果没有任何可用的数据集,请取消设置,然后转到“语音数据集”菜单来上传数据集

    Screenshot of choosing a dataset dialog

  6. 选择一个或两个模型来评估和比较准确性。

  7. 输入测试名称和描述,然后选择“下一步”。

  8. 检查你的设置,然后选择“保存并关闭”。

要创建测试,请使用 spx csr evaluation create 命令。 根据以下说明构造请求参数:

  • project 参数设置为现有项目的 ID。 建议使用此参数,这样你还可以在 Speech Studio 中查看测试。 可以运行 spx csr project list 命令来获取可用项目。
  • 将所需的 model1 参数设置为要测试的模型的 ID。
  • 将所需的 model2 参数设置为要测试的另一个模型的 ID。 如果不想比较两个模型,请同时对 model1model2 使用相同的模型。
  • 将所需的 dataset 参数设置为要用于测试的数据集的 ID。
  • 设置 language 参数,否则语音 CLI 将默认设置为“en-US”。 此参数应该是数据集内容的区域设置。 以后无法更改此区域设置。 语音 CLI language 参数对应于 JSON 请求和响应中的 locale 属性。
  • 设置所需的 name 参数。 此参数是在 Speech Studio 中显示的名称。 语音 CLI name 参数对应于 JSON 请求和响应中的 displayName 属性。

下面是创建测试的语音 CLI 命令的示例:

spx csr evaluation create --api-version v3.1 --project 9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226 --dataset be378d9d-a9d7-4d4a-820a-e0432e8678c7 --model1 ff43e922-e3e6-4bf0-8473-55c08fd68048 --model2 1aae1070-7972-47e9-a977-87e3b05c457d --name "My Inspection" --description "My Inspection Description"

你应该会收到以下格式的响应正文:

{
  "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca",
  "model1": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/ff43e922-e3e6-4bf0-8473-55c08fd68048"
  },
  "model2": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/base/1aae1070-7972-47e9-a977-87e3b05c457d"
  },
  "dataset": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/datasets/be378d9d-a9d7-4d4a-820a-e0432e8678c7"
  },
  "transcription2": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/6eaf6a15-6076-466a-83d4-a30dba78ca63"
  },
  "transcription1": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/0c5b1630-fadf-444d-827f-d6da9c0cf0c3"
  },
  "project": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/projects/9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226"
  },
  "links": {
    "files": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca/files"
  },
  "properties": {
    "wordErrorRate2": -1.0,
    "wordErrorRate1": -1.0,
    "sentenceErrorRate2": -1.0,
    "sentenceCount2": -1,
    "wordCount2": -1,
    "correctWordCount2": -1,
    "wordSubstitutionCount2": -1,
    "wordDeletionCount2": -1,
    "wordInsertionCount2": -1,
    "sentenceErrorRate1": -1.0,
    "sentenceCount1": -1,
    "wordCount1": -1,
    "correctWordCount1": -1,
    "wordSubstitutionCount1": -1,
    "wordDeletionCount1": -1,
    "wordInsertionCount1": -1
  },
  "lastActionDateTime": "2022-05-20T16:42:43Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-20T16:42:43Z",
  "locale": "en-US",
  "displayName": "My Inspection",
  "description": "My Inspection Description"
}

响应正文中的顶级 self 属性是评估的 URI。 使用此 URI 获取有关项目和测试结果的详细信息。 还可以使用此 URI 更新或删除评估。

对于评估的语音 CLI 帮助,请运行以下命令:

spx help csr evaluation

若要创建测试,请使用语音转文本 REST APIEvaluations_Create 操作。 根据以下说明构造请求正文:

  • project 属性设置为现有项目的 URI。 建议使用此属性,这样你还可以在 Speech Studio 中查看测试。 可以发出 Projects_List 请求来获取可用项目。
  • 将所需的 model1 属性设置为要测试的模型的 URI。
  • 将所需的 model2 属性设置为要测试的另一个模型的 URI。 如果不想比较两个模型,请同时对 model1model2 使用相同的模型。
  • 将所需的 dataset 属性设置为要用于测试的数据集的 URI。
  • 设置所需的 locale 属性。 此属性应该是数据集内容的区域设置。 以后无法更改此区域设置。
  • 设置所需的 displayName 属性。 此属性是在 Speech Studio 中显示的名称。

使用 URI 发出 HTTP POST 请求,如以下示例所示。 将 YourSubscriptionKey 替换为语音资源密钥,将 YourServiceRegion 替换为语音资源区域,并按前面所述设置请求正文属性。

curl -v -X POST -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey" -H "Content-Type: application/json" -d '{
  "model1": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/ff43e922-e3e6-4bf0-8473-55c08fd68048"
  },
  "model2": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/base/1aae1070-7972-47e9-a977-87e3b05c457d"
  },
  "dataset": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/datasets/be378d9d-a9d7-4d4a-820a-e0432e8678c7"
  },
  "project": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/projects/9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226"
  },
  "displayName": "My Inspection",
  "description": "My Inspection Description",
  "locale": "en-US"
}'  "https://YourServiceRegion.api.cognitive.azure.cn/speechtotext/v3.1/evaluations"

你应该会收到以下格式的响应正文:

{
  "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca",
  "model1": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/ff43e922-e3e6-4bf0-8473-55c08fd68048"
  },
  "model2": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/base/1aae1070-7972-47e9-a977-87e3b05c457d"
  },
  "dataset": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/datasets/be378d9d-a9d7-4d4a-820a-e0432e8678c7"
  },
  "transcription2": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/6eaf6a15-6076-466a-83d4-a30dba78ca63"
  },
  "transcription1": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/0c5b1630-fadf-444d-827f-d6da9c0cf0c3"
  },
  "project": {
    "self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/projects/9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226"
  },
  "links": {
    "files": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca/files"
  },
  "properties": {
    "wordErrorRate2": -1.0,
    "wordErrorRate1": -1.0,
    "sentenceErrorRate2": -1.0,
    "sentenceCount2": -1,
    "wordCount2": -1,
    "correctWordCount2": -1,
    "wordSubstitutionCount2": -1,
    "wordDeletionCount2": -1,
    "wordInsertionCount2": -1,
    "sentenceErrorRate1": -1.0,
    "sentenceCount1": -1,
    "wordCount1": -1,
    "correctWordCount1": -1,
    "wordSubstitutionCount1": -1,
    "wordDeletionCount1": -1,
    "wordInsertionCount1": -1
  },
  "lastActionDateTime": "2022-05-20T16:42:43Z",
  "status": "NotStarted",
  "createdDateTime": "2022-05-20T16:42:43Z",
  "locale": "en-US",
  "displayName": "My Inspection",
  "description": "My Inspection Description"
}

响应正文中的顶级 self 属性是评估的 URI。 使用此 URI 获取有关评估的项目和测试结果的详细信息。 还可以使用此 URI 更新删除评估。

获取测试结果

应获取测试结果并检查与每个模型的听录结果对比的音频数据集。

按照以下步骤获取测试结果:

  1. 登录 Speech Studio
  2. 选择“自定义语音识别”> 你的项目名称 >“测试模型”。
  3. 按测试名称选择链接。
  4. 测试完成后,状态设置为“成功”指示,应会看到包含每个测试模型的 WER 数字的结果。

此页面会列出数据集中的所有语句和识别结果,以及提供的数据集中的听录。 可以切换各种错误类型,包括插入、删除和替换。 通过听音频并比较每个列中的识别结果,你可以确定哪个模型符合自己的需求,以及确定需要在哪些方面进行更多的训练和改进。

若要获取测试结果,请使用 spx csr evaluation status 命令。 根据以下说明构造请求参数:

  • 将所需的 evaluation 参数设置为要获取测试结果的评估的 ID。

下面是获取测试结果的示例语音 CLI 命令:

spx csr evaluation status --api-version v3.1 --evaluation 8bfe6b05-f093-4ab4-be7d-180374b751ca

响应正文中会返回模型、音频数据集、听录和更多详细信息。

应采用以下格式接收响应正文:

{
	"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca",
	"model1": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/ff43e922-e3e6-4bf0-8473-55c08fd68048"
	},
	"model2": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/base/1aae1070-7972-47e9-a977-87e3b05c457d"
	},
	"dataset": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/datasets/be378d9d-a9d7-4d4a-820a-e0432e8678c7"
	},
	"transcription2": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/6eaf6a15-6076-466a-83d4-a30dba78ca63"
	},
	"transcription1": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/0c5b1630-fadf-444d-827f-d6da9c0cf0c3"
	},
	"project": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/projects/9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226"
	},
	"links": {
		"files": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca/files"
	},
	"properties": {
		"wordErrorRate2": 4.62,
		"wordErrorRate1": 4.6,
		"sentenceErrorRate2": 66.7,
		"sentenceCount2": 3,
		"wordCount2": 173,
		"correctWordCount2": 166,
		"wordSubstitutionCount2": 7,
		"wordDeletionCount2": 0,
		"wordInsertionCount2": 1,
		"sentenceErrorRate1": 66.7,
		"sentenceCount1": 3,
		"wordCount1": 174,
		"correctWordCount1": 166,
		"wordSubstitutionCount1": 7,
		"wordDeletionCount1": 1,
		"wordInsertionCount1": 0
	},
	"lastActionDateTime": "2022-05-20T16:42:56Z",
	"status": "Succeeded",
	"createdDateTime": "2022-05-20T16:42:43Z",
	"locale": "en-US",
	"displayName": "My Inspection",
	"description": "My Inspection Description"
}

对于评估的语音 CLI 帮助,请运行以下命令:

spx help csr evaluation

要获取测试结果,首先使用语音转文本 REST APIEvaluations_Get 操作。

使用 URI 发出 HTTP GET 请求,如以下示例所示。 将 YourEvaluationId 替换为评估 ID,将 YourSubscriptionKey 替换为语音资源密钥,将 YourServiceRegion 替换为语音资源区域。

curl -v -X GET "https://YourServiceRegion.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/YourEvaluationId" -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey"

响应正文中会返回模型、音频数据集、听录和更多详细信息。

应采用以下格式接收响应正文:

{
	"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca",
	"model1": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/ff43e922-e3e6-4bf0-8473-55c08fd68048"
	},
	"model2": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/models/base/1aae1070-7972-47e9-a977-87e3b05c457d"
	},
	"dataset": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/datasets/be378d9d-a9d7-4d4a-820a-e0432e8678c7"
	},
	"transcription2": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/6eaf6a15-6076-466a-83d4-a30dba78ca63"
	},
	"transcription1": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/transcriptions/0c5b1630-fadf-444d-827f-d6da9c0cf0c3"
	},
	"project": {
		"self": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/projects/9f8c4cbb-f9a5-4ec1-8bb0-53cfa9221226"
	},
	"links": {
		"files": "https://chinanorth2.api.cognitive.azure.cn/speechtotext/v3.1/evaluations/8bfe6b05-f093-4ab4-be7d-180374b751ca/files"
	},
	"properties": {
		"wordErrorRate2": 4.62,
		"wordErrorRate1": 4.6,
		"sentenceErrorRate2": 66.7,
		"sentenceCount2": 3,
		"wordCount2": 173,
		"correctWordCount2": 166,
		"wordSubstitutionCount2": 7,
		"wordDeletionCount2": 0,
		"wordInsertionCount2": 1,
		"sentenceErrorRate1": 66.7,
		"sentenceCount1": 3,
		"wordCount1": 174,
		"correctWordCount1": 166,
		"wordSubstitutionCount1": 7,
		"wordDeletionCount1": 1,
		"wordInsertionCount1": 0
	},
	"lastActionDateTime": "2022-05-20T16:42:56Z",
	"status": "Succeeded",
	"createdDateTime": "2022-05-20T16:42:43Z",
	"locale": "en-US",
	"displayName": "My Inspection",
	"description": "My Inspection Description"
}

将听录与音频进行比较

可以针对音频输入数据集对每个受测模型检查听录输出。 如果在测试中包含了两个模型,可以并排比较它们的听录质量。

要检查听录的质量,请执行以下操作:

  1. 登录 Speech Studio
  2. 选择“自定义语音识别”> 你的项目名称 >“测试模型”。
  3. 按测试名称选择链接。
  4. 在模型读取相应听录的同时播放音频文件。

如果测试数据集包含多个音频文件,你将在表中看到多个行。 如果在测试中包含了两个模型,听录会显示在并排的列中。 模型之间的听录差异以蓝色文本字体显示。

Screenshot of comparing transcriptions by two models

音频测试数据集、听录和受测模型是在测试结果中返回的。 如果只测试了一个模型,model1 值将匹配 model2,并且 transcription1 值将匹配 transcription2

要检查听录的质量,请执行以下操作:

  1. 下载音频测试数据集,除非你已经有一个副本。
  2. 下载输出听录。
  3. 在模型读取相应听录的同时播放音频文件。

如果要比较两个模型之间的质量,请特别注意每个模型的听录之间的差异。

音频测试数据集、听录和受测模型是在测试结果中返回的。 如果只测试了一个模型,model1 值将匹配 model2,并且 transcription1 值将匹配 transcription2

要检查听录的质量,请执行以下操作:

  1. 下载音频测试数据集,除非你已经有一个副本。
  2. 下载输出听录。
  3. 在模型读取相应听录的同时播放音频文件。

如果要比较两个模型之间的质量,请特别注意每个模型的听录之间的差异。

后续步骤