首页 > 解决方案 > 使用 Azure AI 训练自定义语音

问题描述

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

标签: pythonazureapimachine-learningtext-to-speech

解决方案


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

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

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

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

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

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

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

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

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

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

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

推荐阅读