使用 Azure AI 训练自定义语音

问题描述:

我需要帮助来完成我的一项项目工作,其中说以编程方式使用 Azure AI 训练自定义语音(首选 Python)",而不是使用自定义语音门户.由于我对 ML 非常陌生,因此我需要有关如何执行此任务的端到端详细信息.任何帮助/指导将不胜感激.

I need help in completing one of my project work which says "train a custom voice using Azure AI programmatically(python preferred)", not with the custom voice portal. Since I'm very new to ML, I need an end-to-end detail on how to perform this task. Any help/guidance would be appreciated.

据我所知,Azure 还没有发布这些 API,但我尝试通过浏览器获取 HTTP 请求,下面是我的发现.

As far as I know, Azure has not released these APIs yet, but I tried to fetch HTTP requests via browser and these is my findings below.

1.上传数据集:

网址:

POST https://<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/datasets

标题:

Content-Type: application/json
Ocp-Apim-Subscription-Key: <key>

身体:

{
    "displayName": "<name>",
    "description": "<description>",
    "dataImportKind": "<dataset kind>",
    "datasetKind": "<dataset kind>",
    "kind": "<dataset kind>",
    "sourceUrl": "<dataset URL>",
    "contentUrl": "<dataset URL>",
    "locale": "<locale, ie, en-us>",
    "project": {
        "id": "<your project ID>",
        "self": "https:///<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<your project ID>"
    },
    "properties": {
        "email": "<contactor email>"
    },
    "customProperties": {
        "PortalAPIVersion": "3"
    },
    "email": "<contactor email>"
}

对于 dataset kind,如果您选择音频 + 人工标记的转录本"它的值为Acoustic,对于Plain text,它的值为language.对于Pronunciation,其值为Pronunciation.

For dataset kind, if you select "Audio + human-labeled transcript" its value is Acoustic, for Plain text its value is language. for Pronunciation its value is Pronunciation.

2. 训练模型:

网址

POST https://<NAME>.cognitiveservices.azure.com/speechtotext/v3.0/models

标题:

Content-Type: application/json
Ocp-Apim-Subscription-Key: <key>

身体:

{
    "displayName": "<name>",
    "description": "<desp>",
    "locale": "en-US",
    "project": {
        "id": "<project ID>",
        "self": "https:///<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<project ID>"
    },
    "properties": {
        "email": "<email>"
    },
    "customProperties": {
        "PortalAPIVersion": "3"
    },
    "email": "<email>",
    "datasets": [{
            "id": "<dataset id>",
            "self": "https:///<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/datasets/<dataset id>"
        }...
    ]
    }
}

您可以通过下面的 API 和 project id 获取:

You can get project id and by API below:

GET https://<YOUR SERVICE NAME>.cognitiveservices.azure.com/speechtotext/v3.0/projects

您可以通过下面的 API 获取dataset id:

You can get dataset id by API below:

GET https://<YOUR SERVICE NAME>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<project id>

您可以通过下面的API获取model id:

You can get model id by API below:

GET https://<YOUR SERVICE NAME>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<project id>

3. 部署模型:

网址:

POST https://<NAME>.cognitiveservices.azure.com/speechtotext/v3.0/endpoints

标题:

Content-Type: application/json
Ocp-Apim-Subscription-Key: <key>

身体:

{
    "displayName": "<name>",
    "description": "<description>",
    "locale": "<locale>",
    "project": {
        "id": "<project id>",
        "self": "https:///<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<project id>"
    },
    "model": {
        "id": "<model id>",
        "self": "https:///<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/models/<model id>"
    },
    "properties": {
        "email": "<email>",
        "contentLoggingEnabled": false,
        "loggingEnabled": false
    },
    "customProperties": {
        "contentLoggingEnabled": false,
        "PortalAPIVersion": "3"
    },
    "email": "<email>"
}

您可以通过下面的API获取model id:

You can get model id by API below:

GET https://<YOUR SERVICE NAME>.cognitiveservices.azure.com/speechtotext/v3.0/projects/<project id>/models