训练和部署自定义语音识别模型Train and deploy a Custom Speech model

本文介绍如何训练和部署自定义语音识别模型。In this article, you learn how to train and deploy Custom Speech models. 训练语音转文本模型可以提高 Microsoft 的基线模型的识别准确度。Training a speech-to-text model can improve recognition accuracy for Microsoft's baseline model. 模型使用人为标记的听录和相关的文本进行训练。A model is trained using human-labeled transcriptions and related text. 这些数据集以及以前上传的音频数据用于优化和训练语音转文本模型。These datasets along with previously uploaded audio data, are used to refine and train the speech-to-text model.

通过训练解决准确度问题Use training to resolve accuracy issues

如果遇到基本模型识别问题,那么使用人为标记的脚本和相关数据来训练自定义模型可帮助提高准确度。If you're encountering recognition issues with a base model, using human-labeled transcripts and related data to train a custom model can help to improve accuracy. 使用此表可确定应使用哪个数据集来解决问题:Use this table to determine which dataset to use to address your issue(s):

使用案例Use case 数据类型Data type
提高特定于行业的词汇和语法(例如医疗术语或 IT 行话)的识别准确度。Improve recognition accuracy on industry-specific vocabulary and grammar, such as medical terminology or IT jargon. 相关的文本(句子/言语)Related text (sentences/utterances)
定义发音不标准的字词或术语(例如产品名或首字母缩写)的语音和显示形式。Define the phonetic and displayed form of a word or term that has nonstandard pronunciation, such as product names or acronyms. 相关的文本(发音)Related text (pronunciation)
提高说话风格、口音或特定背景杂音的识别准确度。Improve recognition accuracy on speaking styles, accents, or specific background noises. 音频和人为标记的听录内容Audio + human-labeled transcripts

训练和评估模型Train and evaluate a model

训练模型的第一步是上传训练数据。The first step to train a model is to upload training data. 请参阅准备和测试数据以获取分步说明,了解如何准备人为标记的听录和相关的文本(言语和发音)。Use Prepare and test your data for step-by-step instructions to prepare human-labeled transcriptions and related text (utterances and pronunciations). 上传训练数据以后,请按以下说明开始训练模型:After you've uploaded training data, follow these instructions to start training your model:

  1. 登录到自定义语音识别门户Sign in to the Custom Speech portal.
  2. 导航到“语音转文本”>“自定义语音识别”> [项目名称] >“训练”。Navigate to Speech-to-text > Custom Speech > [name of project] > Training.
  3. 单击“训练模型”。Click Train model.
  4. 接下来,为训练提供 名称说明Next, give your training a Name and Description.
  5. 从“方案和基线模型”下拉菜单中,选择最适合你的领域的方案。From the Scenario and Baseline model drop-down menu, select the scenario that best fits your domain. 如果不确定要选择哪个方案,请选择“通用”。If you're unsure of which scenario to choose, select General. 该基线模型是训练的起点。The baseline model is the starting point for training. 最新的模型通常是最佳选择。The latest model is usually the best choice.
  6. 在“选择训练数据”页中,选择一个或多个要用于训练的音频和人为标记的听录数据集。From the Select training data page, choose one or multiple audio + human-labeled transcription datasets that you'd like to use for training.
  7. 完成训练后,可以选择对新训练的模型执行准确度测试。Once the training is complete, you can choose to perform accuracy testing on the newly trained model. 此步骤是可选的。This step is optional.
  8. 选择“创建”,生成自定义模型。Select Create to build your custom model.

“训练”表将显示对应于此新建模型的新条目。The Training table displays a new entry that corresponds to this newly created model. 该表还会显示以下状态:“正在处理”、“成功”、“失败”。The table also displays the status: Processing, Succeeded, Failed.

请参阅操作说明,了解如何评估和提高自定义语音识别模型准确度。See the how-to on evaluating and improving Custom Speech model accuracy. 如果选择测试准确度,则选择的声学数据集必须不同于你对自己的模型使用的数据集,这样才能获得真正有意义的模型性能。If you chose to test accuracy, it's important to select an acoustic dataset that's different from the one you used with your model to get a realistic sense of the model's performance.

部署自定义模型Deploy a custom model

上传并检查数据、评估准确度以及训练自定义模型以后,即可部署可以与应用、工具和产品配合使用的自定义终结点。After you've uploaded and inspected data, evaluated accuracy, and trained a custom model, you can deploy a custom endpoint to use with your apps, tools, and products.

若要新建自定义终结点,请登录到自定义语音识别门户,选择页面顶部“自定义语音识别”菜单中的“部署”。 To create a new custom endpoint, sign in to the Custom Speech portal and select Deployment from the Custom Speech menu at the top of the page. 如果是第一次运行,你会注意到表中未列出任何终结点。If this is your first run, you'll notice that there are no endpoints listed in the table. 创建一个终结点后,即可使用此页面跟踪每个已部署的终结点。After you've created an endpoint, you use this page to track each deployed endpoint.

接下来,选择“添加终结点”,并输入自定义终结点的 名称说明Next, select Add endpoint and enter a Name and Description for your custom endpoint. 然后选择要与此终结点关联的自定义模型。Then select the custom model that you'd like to associate with this endpoint. 也可以通过此页启用日志记录。From this page, you can also enable logging. 可以通过日志记录监视终结点流量。Logging allows you to monitor endpoint traffic. 在禁用的情况下,流量不存储。If disabled, traffic won't be stored.

如何部署模型

备注

请勿忘记接受有关使用和定价详细信息的条款。Don't forget to accept the terms of use and pricing details.

接下来,选择“创建”。 Next, select Create. 执行此操作后会返回到“部署” 页。This action returns you to the Deployment page. 表中现在有自定义终结点的对应条目。The table now includes an entry that corresponds to your custom endpoint. 终结点的状态显示其当前状态。The endpoint’s status shows its current state. 使用自定义模型实例化新终结点最长可能需要 30 分钟才能完成。It can take up to 30 minutes to instantiate a new endpoint using your custom models. 当部署状态更改为“完成” 时,终结点便可供使用。When the status of the deployment changes to Complete, the endpoint is ready to use.

部署终结点后,其名称将以链接的形式显示。After your endpoint is deployed, the endpoint name appears as a link. 单击此链接可显示特定于该终结点的信息,例如终结点密钥、终结点 URL 和示例代码。Click the link to display information specific to your endpoint, such as the endpoint key, endpoint URL, and sample code.

查看日志记录数据View logging data

可以在“终结点”>“详细信息”下下载日志记录数据。 Logging data is available for download under Endpoint > Details.

备注

日志记录数据在 Microsoft 拥有的存储上可以使用 30 天,之后会被删除。The logging data is available for 30 days on Microsoft owned storage and will be removed afterwards. 如果客户拥有的存储帐户已关联到认知服务订阅,则不会自动删除日志记录数据。In case a customer owned storage account is linked to the cognitive services subscription, the logging data will not be automatically deleted.

后续步骤Next steps

其他资源Additional resources