def minDistance(features, codebooks):
    speaker = 0
    distmin = np.inf
    for k in range(np.shape(codebooks)[0]):
        D = EUDistance(features, codebooks[k, :, :])
        dist = np.sum(np.min(D, axis=1)) / (np.shape(D)[0])
        if dist < distmin:
            distmin = dist
            speaker = k

    return speaker
Esempio n. 2
0
def distance_min(feature, codebook):
    distmini = np.inf
    speakernum = 0
    for l in range(np.shape(codebook)[0]):
        Dis = EUDistance(feature, codebook[l, :, :])
        dista = np.sum(np.min(Dis, axis=1)) / (np.shape(Dis)[0])
        if dista < distmini:
            speakernum = l
            distmini = dista

    return speakernum