parameter_evolution.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:DT2118-Speech-and-Speaker-Recognition 作者: Morikko 项目源码 文件源码
def getParameter(models):
    """
    Get through the folder models and analyse each hmm
    Take the phone m ans the state s
    Get the mean and the variance of the first gaussian
    Return all the mean and var
    """
    m = 2
    s =1

    mean = []
    var = []

    # Get the values of the 3rd phones for each hmm
    for i in range(8):
        hfile = open(models + "/hmm" + str(i) + "/hmmdefs.mmf")
        data = hfile.read()
        hmms = yacc.parse(data)
        if i == 0:
            m = 10
        else:
            m = 2
        thishmm = hmms[m]        

        print('Iteration: ' + str(i))
        print('model number '+str(m+1)+' is called '+thishmm.name+' and state '+str(s+1))

        thisstate = thishmm.states[s][1]
        thiscomponent = thisstate.mixtures[0][2]

        mean.append(thiscomponent.mean.vector)
        var.append(thiscomponent.var.vector)

    return mean, var
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号