我需要帮助完成我的一个项目,该项目要求“使用Azure AI以编程方式(优先使用Python)训练自定义语音”,而不是通过自定义语音门户进行。由于我对机器学习非常新手,我需要从头到尾的详细指导来完成这项任务。任何帮助/指导都将不胜感激。
回答:
据我所知,Azure尚未发布这些API,但我在浏览器中尝试获取HTTP请求,以下是我的发现。
1. 上传数据集:
URL:
POST https://<your service name>.cognitiveservices.azure.com/speechtotext/v3.0/datasets
Header:
Content-Type: application/jsonOcp-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
,如果您选择“音频 + 人工标记的转录”,其值为Acoustic
;对于Plain text
,其值为language
;对于Pronunciation
,其值为Pronunciation
。
2. 训练模型:
URL
POST https://<NAME>.cognitiveservices.azure.com/speechtotext/v3.0/models
Headers:
Content-Type: application/jsonOcp-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>" }... ] }}
您可以通过以下API获取project id
:
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/jsonOcp-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