使用 Azure AI 训练自定义语音

Train custom voice using Azure AI

我需要帮助来完成我的一项项目工作,该工作说“以编程方式使用 Azure AI 训练自定义语音(python 首选)”,而不是使用自定义语音门户。 由于我是 ML 的新手,我需要有关如何执行此任务的端到端详细信息。任何 help/guidance 将不胜感激。

据我所知,Azure 尚未发布这些 API,但我尝试通过浏览器获取 HTTP 请求,这些是我的发现。

1.上传数据集:

URL:

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

Header:

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

Body:

{
    "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,如果您select“音频+human-labeled成绩单”其值为Acoustic,对于Plain text其值为language.对于 Pronunciation,其值为 Pronunciation

2.训练模型:

URL

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

Headers:

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

Body:

{
    "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>"
        }...
    ]
    }
}

您可以获得 project id 并通过以下 API:

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

您可以通过以下API获得dataset id

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

您可以通过以下API获得model id

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

3. 部署模型:

URL :

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

Headers:

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

Body:

{
    "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

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