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

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

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

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

使用案例Use case 数据类型Data type
提高特定于行业的词汇和语法(例如医疗术语或 IT 行话)的识别准确度Improve recognition accuracy on industry-specific vocabulary and grammar, like medical terminology or IT jargon 相关的文本(句子/言语)Related text (sentences/utterances)
定义发音不标准的字词或术语(例如产品名或首字母缩写)的语音和显示形式Define the phonetic and displayed form of a word or term that has nonstandard pronunciation, like 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. 请参阅准备和测试数据以获取分步说明,了解如何准备人为标记的听录内容和相关文本(言语和发音)。See Prepare and test your data for step-by-step instructions to prepare human-labeled transcriptions and related text (utterances and pronunciations). 上传训练数据以后,请按以下说明开始训练模型:After you upload training data, follow these instructions to start training your model:

  1. 登录到自定义语音识别门户Sign in to the Custom Speech portal.
  2. 转到“语音转文本” > “自定义语音识别” > [项目名称] > “训练” 。Go to Speech-to-text > Custom Speech > [name of project] > Training.
  3. 选择“训练模型”。Select Train model.
  4. 为训练提供“名称”和“描述” 。Give your training a Name and Description.
  5. 在“方案和基线模型”列表中,选择最适合你的领域的方案。In the Scenario and Baseline model list, select the scenario that best fits your domain. 如果不确定要选择哪个方案,请选择“通用”。If you're not sure which scenario to choose, select General. 该基线模型是训练的起点。The baseline model is the starting point for training. 最新的模型通常是最佳选择。The latest model is usually the best choice.
  6. 在“选择训练数据”页中,选择一个或多个要用于训练的音频和人为标记的听录内容数据集。On the Select training data page, choose one or more audio + human-labeled transcription datasets that you want to use for training.
  7. 完成训练后,可以对新训练的模型执行准确度测试。After training is complete, you can do 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 the new model. 该表还会显示以下状态:“正在处理”、“成功”或“失败” 。The table also displays the status: Processing, Succeeded, or Failed.

请参阅操作说明,了解如何评估和提高自定义语音识别模型准确度。See the how-to on evaluating and improving Custom Speech model accuracy. 如果选择测试准确度,则选择的声学数据集必须不同于你对自己的模型使用的数据集,这样才能获得真正有意义的模型性能。If you choose 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 upload and inspect data, evaluate accuracy, and train a custom model, you can deploy a custom endpoint to use with your apps, tools, and products.

要创建自定义终结点,请登录到自定义语音识别门户To create a custom endpoint, sign in to the Custom Speech portal. 在页面顶部的“自定义语音识别”菜单中选择“部署” 。Select Deployment in 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 create 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 want to associate with the endpoint. 也可以通过此页启用日志记录。You can also enable logging from this page. 可以通过日志记录监视终结点流量。Logging allows you to monitor endpoint traffic. 在禁用日志记录的情况下,不会存储流量。If logging is 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 和示例代码。Select the link to see information specific to your endpoint, like the endpoint key, endpoint URL, and sample code.

查看日志记录数据View logging data

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

备注

日志记录数据在 Microsoft 拥有的存储上可供使用 30 天。Logging data is available for 30 days on Microsoft-owned storage. 之后会被删除。It will be removed afterwards. 如果客户拥有的存储帐户已关联到认知服务订阅,则不会自动删除日志记录数据。If a customer-owned storage account is linked to the Cognitive Services subscription, the logging data won't be automatically deleted.

后续步骤Next steps

其他资源Additional resources