Ejemplo n.º 1
0
def get_label_IEMOCAP(wavname):
    '''
    compute one hot label starting from wav filename
    '''
    wavname = wavname.split('/')[-1]
    session = int(wavname.split('_')[0][3:5])
    trans_file = '_'.join(wavname.split('_')[:-1]) + '.txt'
    ID = wavname.split('.')[0]
    trans_path = os.path.join(INPUT_IEMOCAP_FOLDER, 'Session' + str(session),
                              'dialog/EmoEvaluation', trans_file)
    #trans_path = '/home/eric/Desktop/Ses01F_impro01.txt'
    with open(trans_path) as f:
        contents = f.readlines()

    str_label = list(filter(lambda x: ID in x, contents))[0].split('\t')[2]

    #change this to have only 4 labels!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    #int_label = label_to_int[str_label]
    int_label = label_to_int[str_label]

    if int_label != None:
        output = uf.onehot(int_label, num_classes_IEMOCAP)
    else:
        output = None

    return output
Ejemplo n.º 2
0
def get_label_RAVDESS(input_soundfile, num_classes=num_classes_ravdess):
    '''
    compute label starting from soundfile
    '''
    label = input_soundfile.split('/')[-1].split('.')[0].split('-')[2]
    one_hot_label = (uf.onehot(int(label) - 1, num_classes_ravdess))

    return one_hot_label
Ejemplo n.º 3
0
def get_label_FSDD(wavname):
    '''
    compute one hot label starting from wav filename
    '''
    label = wavname.split('/')[-1].split('.')[0].split('_')[0]
    one_hot_label = (uf.onehot(int(label), num_classes_FSDD))

    return one_hot_label
Ejemplo n.º 4
0
def get_label_TESS(input_soundfile, num_classes=num_classes_tess):
    '''
    compute label starting from soundfile
    '''
    label = input_soundfile.split('/')[-1].split('.')[0].split('_')[-1]
    int_label = assoc_labels[label]
    one_hot_label = (uf.onehot(int(int_label) - 1, num_classes_tess))

    return one_hot_label
Ejemplo n.º 5
0
def get_label_EMODB(input_soundfile, num_classes=num_classes_emodb):
    '''
    compute label starting from soundfile
    '''
    label = input_soundfile.split('/')[-1].split('.')[0][-2]
    int_label = assoc_labels[label]
    one_hot_label = (uf.onehot(int(int_label) - 1, num_classes_emodb))

    return one_hot_label
Ejemplo n.º 6
0
def get_label_GSC(wavname):
    '''
    compute one hot label starting from wav filename
    '''

    label = wavname.split('/')[-2]  #string_label
    int_label = labels_dict[label]
    one_hot_label = (uf.onehot(int(int_label), num_classes_speechCmd))

    return one_hot_label