你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
可以检查自定义语音模型的识别质量。 你可以播放上传的音频,确定提供的识别结果是否正确。 成功创建测试后,你可以查看模型对音频数据集的转录情况,或将两个模型中的结果并行进行比较。
并行模型测试可用于验证哪个语音识别模型最适合应用程序。 对准确度进行客观度量需要听录数据集输入,请参阅定量测试模型。
重要
测试时,系统将执行听录。 请务必记住这一点,因为定价因服务产品和订阅级别而异。 请务必参阅官方 Azure AI 服务定价获取最新详细信息。
创建测试
上传训练和测试数据集后,可以创建测试。
若要测试微调的自定义语音模型,请执行以下步骤:
从左窗格中选择 “微调 ”,然后选择 “AI 服务微调”。
选择自定义语音识别微调任务(按模型名称),该任务是你按照“如何启动自定义语音识别微调”一文中所述启动的。
选择 “测试模型>+ 创建测试”。
在“创建新测试”向导中选择测试类型。 对于质量测试,请选择“检查质量”(仅音频数据)。 然后选择下一步。
选择要用于测试的数据。 然后选择下一步。
选择最多两个模型来评估和比较准确度。 在此示例中,我们选择了已训练的模型和基础模型。 然后选择下一步。
输入测试的名称和说明。 然后选择下一步。
查看设置,然后选择“创建测试”。 随后你将返回到“测试模型”页面。 数据状态为“正在处理”。
按这些说明创建测试:
登录 Speech Studio。
导航到“Speech Studio”>“自定义语音识别”,并从列表中选择你的项目名称。
选择“测试模型”>“创建新测试” 。
选择“检查质量(仅音频数据)”>“下一步” 。
选择要用于测试的音频数据集,然后选择“下一步”。 如果没有任何可用的数据集,请取消设置,然后转到“语音数据集”菜单来上传数据集。
选择一个或两个模型来评估和比较准确性。
输入测试名称和描述,然后选择“下一步”。
检查你的设置,然后选择“保存并关闭”。
要创建测试,请使用 spx csr evaluation create
命令。 根据以下说明构造请求参数:
- 将
project
属性设置为现有项目的 ID。 建议使用此属性,以便还可以在 Azure AI Foundry 门户中查看测试。 可以运行spx csr project list
命令来获取可用项目。 - 将所需
model1
属性设置为要测试的模型的 ID。 - 将所需
model2
属性设置为要测试的另一个模型的 ID。 如果不想比较两个模型,请同时对model1
和model2
使用相同的模型。 - 将所需
dataset
属性设置为要用于测试的数据集的 ID。 - 设置
language
属性,否则 Speech CLI 将默认设置为“en-US”。 此参数应该是数据集内容的区域设置。 以后无法更改此区域设置。 语音 CLIlanguage
属性对应于 JSON 请求和响应中的locale
属性。 - 设置所需的
name
属性。 此参数是在 Azure AI Foundry 门户中显示的名称。 语音 CLIname
属性对应于 JSON 请求和响应中的displayName
属性。
下面是创建测试的语音 CLI 命令的示例:
spx csr evaluation create --api-version v3.2 --project 0198f569-cc11-4099-a0e8-9d55bc3d0c52 --dataset 23b6554d-21f9-4df1-89cb-f84510ac8d23 --model1 13fb305e-09ad-4bce-b3a1-938c9124dda3 --model2 13fb305e-09ad-4bce-b3a1-938c9124dda3 --name "My Inspection" --description "My Inspection Description"
你应该会收到以下格式的响应正文:
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac",
"model1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"model2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"dataset": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/datasets/23b6554d-21f9-4df1-89cb-f84510ac8d23"
},
"transcription2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"transcription1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/0198f569-cc11-4099-a0e8-9d55bc3d0c52"
},
"links": {
"files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac/files"
},
"properties": {
"wordErrorRate1": -1.0,
"sentenceErrorRate1": -1.0,
"sentenceCount1": -1,
"wordCount1": -1,
"correctWordCount1": -1,
"wordSubstitutionCount1": -1,
"wordDeletionCount1": -1,
"wordInsertionCount1": -1,
"wordErrorRate2": -1.0,
"sentenceErrorRate2": -1.0,
"sentenceCount2": -1,
"wordCount2": -1,
"correctWordCount2": -1,
"wordSubstitutionCount2": -1,
"wordDeletionCount2": -1,
"wordInsertionCount2": -1
},
"lastActionDateTime": "2024-07-14T21:21:39Z",
"status": "NotStarted",
"createdDateTime": "2024-07-14T21:21:39Z",
"locale": "en-US",
"displayName": "My Inspection",
"description": "My Inspection Description"
}
响应正文中的顶级 self
属性是评估的 URI。 使用此 URI 获取有关项目和测试结果的详细信息。 还可以使用此 URI 更新或删除评估。
对于评估的语音 CLI 帮助,请运行以下命令:
spx help csr evaluation
要创建测试,请使用语音转文本 REST API 的 Evaluations_Create 操作。 根据以下说明构造请求正文:
- 将
project
属性设置为现有项目的 URI。 建议使用此属性,以便还可以在 Azure AI Foundry 门户中查看测试。 可以发出 Projects_List 请求来获取可用项目。 - 将所需的
model1
属性设置为要测试的模型的 URI。 - 将所需的
model2
属性设置为要测试的另一个模型的 URI。 如果不想比较两个模型,请同时对model1
和model2
使用相同的模型。 - 将所需的
dataset
属性设置为要用于测试的数据集的 URI。 - 设置所需的
locale
属性。 此属性应该是数据集内容的区域设置。 以后无法更改此区域设置。 - 设置所需的
displayName
属性。 此属性是在 Azure AI Foundry 门户中显示的名称。
使用 URI 发出 HTTP POST 请求,如以下示例所示。 将 YourSpeechResoureKey
替换为语音资源密钥,将 YourServiceRegion
替换为语音资源区域,并按前面所述设置请求正文属性。
curl -v -X POST -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey" -H "Content-Type: application/json" -d '{
"model1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"model2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"dataset": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/datasets/23b6554d-21f9-4df1-89cb-f84510ac8d23"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/0198f569-cc11-4099-a0e8-9d55bc3d0c52"
},
"displayName": "My Inspection",
"description": "My Inspection Description",
"locale": "en-US"
}' "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations"
你应该会收到以下格式的响应正文:
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac",
"model1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"model2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"dataset": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/datasets/23b6554d-21f9-4df1-89cb-f84510ac8d23"
},
"transcription2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"transcription1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/0198f569-cc11-4099-a0e8-9d55bc3d0c52"
},
"links": {
"files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac/files"
},
"properties": {
"wordErrorRate1": -1.0,
"sentenceErrorRate1": -1.0,
"sentenceCount1": -1,
"wordCount1": -1,
"correctWordCount1": -1,
"wordSubstitutionCount1": -1,
"wordDeletionCount1": -1,
"wordInsertionCount1": -1,
"wordErrorRate2": -1.0,
"sentenceErrorRate2": -1.0,
"sentenceCount2": -1,
"wordCount2": -1,
"correctWordCount2": -1,
"wordSubstitutionCount2": -1,
"wordDeletionCount2": -1,
"wordInsertionCount2": -1
},
"lastActionDateTime": "2024-07-14T21:21:39Z",
"status": "NotStarted",
"createdDateTime": "2024-07-14T21:21:39Z",
"locale": "en-US",
"displayName": "My Inspection",
"description": "My Inspection Description"
}
响应正文中的顶级 self
属性是评估的 URI。 使用此 URI 获取有关评估的项目和测试结果的详细信息。 还可以使用此 URI 更新或删除评估。
获取测试结果
应获取测试结果并检查与每个模型的听录结果对比的音频数据集。
当测试状态为“成功”时,你可以查看结果。 选择测试以查看结果。
按照以下步骤获取测试结果:
- 登录 Speech Studio。
- 选择“自定义语音识别”> 你的项目名称 >“测试模型”。
- 按测试名称选择链接。
- 测试完成后,状态设置为“成功”指示,应会看到包含每个测试模型的 WER 数字的结果。
此页面会列出数据集中的所有语句和识别结果,以及提供的数据集中的听录。 可以切换各种错误类型,包括插入、删除和替换。 通过听音频并比较每个列中的识别结果,你可以确定哪个模型符合自己的需求,以及确定需要在哪些方面进行更多的训练和改进。
若要获取测试结果,请使用 spx csr evaluation status
命令。 根据以下说明构造请求参数:
- 将所需的
evaluation
属性设置为想要获取测试结果的评估的 ID。
下面是获取测试结果的示例语音 CLI 命令:
spx csr evaluation status --api-version v3.2 --evaluation 9c06d5b1-213f-4a16-9069-bc86efacdaac
响应正文中会返回模型、音频数据集、听录和更多详细信息。
你应该会收到以下格式的响应正文:
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac",
"model1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"model2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"dataset": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/datasets/23b6554d-21f9-4df1-89cb-f84510ac8d23"
},
"transcription2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"transcription1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/0198f569-cc11-4099-a0e8-9d55bc3d0c52"
},
"links": {
"files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac/files"
},
"properties": {
"wordErrorRate1": 0.028900000000000002,
"sentenceErrorRate1": 0.667,
"tokenErrorRate1": 0.12119999999999999,
"sentenceCount1": 3,
"wordCount1": 173,
"correctWordCount1": 170,
"wordSubstitutionCount1": 2,
"wordDeletionCount1": 1,
"wordInsertionCount1": 2,
"tokenCount1": 165,
"correctTokenCount1": 145,
"tokenSubstitutionCount1": 10,
"tokenDeletionCount1": 1,
"tokenInsertionCount1": 9,
"tokenErrors1": {
"punctuation": {
"numberOfEdits": 4,
"percentageOfAllEdits": 20.0
},
"capitalization": {
"numberOfEdits": 2,
"percentageOfAllEdits": 10.0
},
"inverseTextNormalization": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
},
"lexical": {
"numberOfEdits": 12,
"percentageOfAllEdits": 12.0
},
"others": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
}
},
"wordErrorRate2": 0.028900000000000002,
"sentenceErrorRate2": 0.667,
"tokenErrorRate2": 0.12119999999999999,
"sentenceCount2": 3,
"wordCount2": 173,
"correctWordCount2": 170,
"wordSubstitutionCount2": 2,
"wordDeletionCount2": 1,
"wordInsertionCount2": 2,
"tokenCount2": 165,
"correctTokenCount2": 145,
"tokenSubstitutionCount2": 10,
"tokenDeletionCount2": 1,
"tokenInsertionCount2": 9,
"tokenErrors2": {
"punctuation": {
"numberOfEdits": 4,
"percentageOfAllEdits": 20.0
},
"capitalization": {
"numberOfEdits": 2,
"percentageOfAllEdits": 10.0
},
"inverseTextNormalization": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
},
"lexical": {
"numberOfEdits": 12,
"percentageOfAllEdits": 12.0
},
"others": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
}
}
},
"lastActionDateTime": "2024-07-14T21:22:45Z",
"status": "Succeeded",
"createdDateTime": "2024-07-14T21:21:39Z",
"locale": "en-US",
"displayName": "My Inspection",
"description": "My Inspection Description"
}
对于评估的语音 CLI 帮助,请运行以下命令:
spx help csr evaluation
要获取测试结果,首先使用语音转文本 REST API 的 Evaluations_Get 操作。
使用 URI 发出 HTTP GET 请求,如以下示例所示。 将 YourEvaluationId
替换为评估 ID,将 YourSpeechResoureKey
替换为语音资源密钥,将 YourServiceRegion
替换为语音资源区域。
curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/YourEvaluationId" -H "Ocp-Apim-Subscription-Key: YourSpeechResoureKey"
响应正文中会返回模型、音频数据集、听录和更多详细信息。
你应该会收到以下格式的响应正文:
{
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac",
"model1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"model2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/models/base/13fb305e-09ad-4bce-b3a1-938c9124dda3"
},
"dataset": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/datasets/23b6554d-21f9-4df1-89cb-f84510ac8d23"
},
"transcription2": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"transcription1": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/transcriptions/b50642a8-febf-43e1-b9d3-e0c90b82a62a"
},
"project": {
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/projects/0198f569-cc11-4099-a0e8-9d55bc3d0c52"
},
"links": {
"files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2/evaluations/9c06d5b1-213f-4a16-9069-bc86efacdaac/files"
},
"properties": {
"wordErrorRate1": 0.028900000000000002,
"sentenceErrorRate1": 0.667,
"tokenErrorRate1": 0.12119999999999999,
"sentenceCount1": 3,
"wordCount1": 173,
"correctWordCount1": 170,
"wordSubstitutionCount1": 2,
"wordDeletionCount1": 1,
"wordInsertionCount1": 2,
"tokenCount1": 165,
"correctTokenCount1": 145,
"tokenSubstitutionCount1": 10,
"tokenDeletionCount1": 1,
"tokenInsertionCount1": 9,
"tokenErrors1": {
"punctuation": {
"numberOfEdits": 4,
"percentageOfAllEdits": 20.0
},
"capitalization": {
"numberOfEdits": 2,
"percentageOfAllEdits": 10.0
},
"inverseTextNormalization": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
},
"lexical": {
"numberOfEdits": 12,
"percentageOfAllEdits": 12.0
},
"others": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
}
},
"wordErrorRate2": 0.028900000000000002,
"sentenceErrorRate2": 0.667,
"tokenErrorRate2": 0.12119999999999999,
"sentenceCount2": 3,
"wordCount2": 173,
"correctWordCount2": 170,
"wordSubstitutionCount2": 2,
"wordDeletionCount2": 1,
"wordInsertionCount2": 2,
"tokenCount2": 165,
"correctTokenCount2": 145,
"tokenSubstitutionCount2": 10,
"tokenDeletionCount2": 1,
"tokenInsertionCount2": 9,
"tokenErrors2": {
"punctuation": {
"numberOfEdits": 4,
"percentageOfAllEdits": 20.0
},
"capitalization": {
"numberOfEdits": 2,
"percentageOfAllEdits": 10.0
},
"inverseTextNormalization": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
},
"lexical": {
"numberOfEdits": 12,
"percentageOfAllEdits": 12.0
},
"others": {
"numberOfEdits": 1,
"percentageOfAllEdits": 5.0
}
}
},
"lastActionDateTime": "2024-07-14T21:22:45Z",
"status": "Succeeded",
"createdDateTime": "2024-07-14T21:21:39Z",
"locale": "en-US",
"displayName": "My Inspection",
"description": "My Inspection Description"
}
将听录与音频进行比较
可以针对音频输入数据集对每个受测模型检查听录输出。 如果在测试中包含了两个模型,可以并排比较它们的听录质量。
要检查听录的质量,请执行以下操作:
- 登录 Speech Studio。
- 选择“自定义语音识别”> 你的项目名称 >“测试模型”。
- 按测试名称选择链接。
- 在模型读取相应听录的同时播放音频文件。
如果测试数据集包含多个音频文件,你将在表中看到多个行。 如果在测试中包含了两个模型,听录会显示在并排的列中。 模型之间的听录差异以蓝色文本字体显示。
音频测试数据集、听录和受测模型是在测试结果中返回的。 如果只测试了一个模型,model1
值将匹配 model2
,并且 transcription1
值将匹配 transcription2
。
要检查听录的质量,请执行以下操作:
- 下载音频测试数据集,除非你已经有一个副本。
- 下载输出听录。
- 在模型读取相应听录的同时播放音频文件。
如果要比较两个模型之间的质量,请特别注意每个模型的听录之间的差异。
音频测试数据集、听录和受测模型是在测试结果中返回的。 如果只测试了一个模型,model1
值将匹配 model2
,并且 transcription1
值将匹配 transcription2
。
要检查听录的质量,请执行以下操作:
- 下载音频测试数据集,除非你已经有一个副本。
- 下载输出听录。
- 在模型读取相应听录的同时播放音频文件。
如果要比较两个模型之间的质量,请特别注意每个模型的听录之间的差异。