Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset has no attribute 'data' in find_best_model in line 190 #17

Open
AdamarisAinsley opened this issue Jul 2, 2019 · 10 comments
Open

Comments

@AdamarisAinsley
Copy link

Dataset is not loaded into the file, when i try another speech dataset (SAVEE/CASIA.IEMOCAP), help me to know ,how to solve this issue?

@WakeUpYoimiya
Copy link

Dataset is not loaded into the file, when i try another speech dataset (SAVEE/CASIA.IEMOCAP), help me to know ,how to solve this issue?

Were there any error messages? I just solved these data problems and ran the program successfully, so maybe i can help u with these stuff.

@AdamarisAinsley
Copy link
Author

AdamarisAinsley commented Sep 2, 2019 via email

@WakeUpYoimiya
Copy link

Have u modified the dataset.py? I think the validation in find_best_model.py is based on the file name of the data. Would you post the name of the data u used here as a sample?

@AdamarisAinsley
Copy link
Author

I made changes in dataset.py file as follows:
import os
import subprocess as sp
import itertools
import librosa
import glob
import wave
import numpy as np
import python_speech_features as ps
import cPickle
import csv

class Dataset:

def __init__(self, path, dataset, decode=False):
    self.dataset = dataset
    if dataset == "IEMOCAP":
        self.classes = {0: 'ang', 1: 'sad', 2: 'hap', 3: 'neu', 4: 'fea', 5: 'fru', 6:'exc' }
        self.get_IEMOCAP_dataset(path)
def get_IEMOCAP_dataset(self, path):
    males = ['Ses01M','Ses02M','Ses03M','Ses04M','Ses05M']
    females = ['Ses01F','Ses02F','Ses03F','Ses04F','Ses05F']
    try:
        classes = {v: k for k, v in self.classes.iteritems()}
    except AttributeError:
        classes = {v: k for k, v in self.classes.items()}
    self.targets = []
    self.data = []
    self.train_sets = []
    self.test_sets = []
    get_data = True
    for speak_test in itertools.product(males, females):
        i = 0
        train = []
        test = []
        for audio in os.listdir(path):
         if(audio[0] == 'S'):
            sub_dir = os.path.join(path,audio,'sentences/wav')
            emoevl = os.path.join(path,audio,'dialog/EmoEvaluation')
            for sess in os.listdir(sub_dir):
                if(sess[7] == 'i'):
                    emotdir = emoevl+'/'+sess+'.txt'
                    emot_map = {}
                    with open(emotdir,'r') as emot_to_read:
                        while True:
                            line = emot_to_read.readline()
                            if not line:
                                break
                            if(line[0] == '['):
                                t = line.split()
                                emot_map[t[3]] = t[4]

                    file_dir = os.path.join(sub_dir, sess, '*.wav')
                    files = glob.glob(file_dir)
                    for filename in files:
                         wavname = filename.split("/")[-1][:-4]
                         f = open("Audio3.csv","a")
                         f.write(wavname)
                         f.write("\n")
                         emotion = emot_map[wavname]
                         f = open("features3.csv","a")
                         f.write(filename)
                         f.write("\n")
            with open('features3.csv') as csvfile:
                readCSV = csv.reader(csvfile, delimiter=' ')
                for row in readCSV:
                    audio_path = row[0]
                    y, sr = librosa.load(audio_path, sr=16000)
                    if get_data:
                        self.data.append((y, sr))
                        self.targets.append(classes[emotion])

                    with open('Audio3.csv') as csvfile:
                        readCSV = csv.reader(csvfile, delimiter=' ')
                        for row in readCSV:
                            audio1 = row[0]
                    if audio1[:6] in speak_test:
                        test.append(i)
                    else:
                        train.append(i)
                    i = i + 1
                self.train_sets.append(train)
                self.test_sets.append(test)
                get_data = False

@WakeUpYoimiya
Copy link

"if audio1[:6] in speak_test: test.append(i) ....... train.append(i)"
I think you can print out test[] and train[] here to check the data at first.

@AdamarisAinsley
Copy link
Author

AdamarisAinsley commented Sep 9, 2019 via email

@WakeUpYoimiya
Copy link

Your image file seems can't be shown here :(

@AdamarisAinsley
Copy link
Author

IEMOCAP: 1
Berlin: 2

@WakeUpYoimiya
Copy link

you can add my discord. if u like

@AdamarisAinsley
Copy link
Author

you can add my discord. if u like

what is your discord tag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants