【问题标题】:Azure Speaker Recognition - How to add a new key/value to a users profile?Azure Speaker Recognition - 如何向用户配置文件添加新的键/值?
【发布时间】:2018-03-19 07:07:08
【问题描述】:

我正在使用python sdk 使用 Microsoft 认知服务进行说话人识别 [我在识别文件夹中工作];当我运行 CreateProfile.py 文件时,我正在尝试为配置文件提供用户名。例如,我会运行我的 main.py 文件,然后我会尝试传递语言环境和 name

import sys
sys.path.append('./Identification')
from CreateProfile import create_profile

name="Jane Doe"
subscriptionKey = "<my subscription key>"
locale = "en-us"

create_profile(name, subscriptionKey, locale)

一旦我运行获取配置文件 GetProfile.py,我希望它输出所有用户的信息,包括他们的用户名。但我在终端中返回了这个。

Profile Name = None
Profile ID = 93affed1-ceb2-4538-9e6b-f0bd22d123b0
Locale = en-us
Enrollments Speech Time = 0.0
Remaining Enrollment Time = 30.0
Created = 2017-10-07T02:03:51.956Z
Last Action = 2017-10-07T02:03:51.956Z
Enrollment Status = Enrolling

我尝试通过在类中添加 _PROFILE_NAME = 'identificationProfileName' 之类的内容来编辑 IdentificationProfile.py,我已经在很多地方添加了与此相关的更改,但我在运行时仍然没有看到名称返回GetProfile.py

这是我的 IdentificationProfile.py

import IdentificationServiceHttpClientHelper
import sys

def get_profile(subscription_key, profile_id):
    """Get a speaker's profile with given profile ID

    Arguments:
    subscription_key -- the subscription key string
    profile_id -- the profile ID of the profile to resets
    """
    helper = IdentificationServiceHttpClientHelper.IdentificationServiceHttpClientHelper(
        subscription_key)

    profile = helper.get_profile(profile_id)

    print('Profile Name = {0}\n Profile ID = {1}\nLocale = {2}\nEnrollments Speech Time = {3}\nRemaining Enrollment Time = {4}\nCreated = {5}\nLast Action = {6}\nEnrollment Status = {7}\nName\n'.format(
        profile._profile_name,
        profile._profile_id,
        profile._locale,
        profile._name,
        profile._enrollment_speech_time,
        profile._remaining_enrollment_time,
        profile._created_date_time,
        profile._last_action_date_time,
        profile._enrollment_status))


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print('Usage: python DeleteProfile.py <subscription_key> <profile_id> ')
        print('\t<subscription_key> is the subscription key for the service')
        print('\t<profile_id> the ID for a profile to delete from the sevice')
        sys.exit('Error: Incorrect usage.')
    get_profile(sys.argv[1], sys.argv[2])

【问题讨论】:

    标签: python python-3.x azure microsoft-cognitive azure-cognitive-services


    【解决方案1】:

    您不能为识别配置文件命名。 Python SDK 使用的HTTP endpoint 不接受除语音语言环境以外的任何参数。

    您必须自己将用户名映射到识别配置文件 ID。您可以为此使用数据库,也许是Azure MySQL db。或者,如果您只是在进行测试,请使用内存映射(也称为字典)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-06
      • 2021-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多