avewells / audio-sentiment-analysis-pipeline

An end-to-end Python pipeline for performing sentiment analysis on audio files of call-center conversations.
36 stars 9 forks source link

can not find file #2

Open janhavi028 opened 6 years ago

janhavi028 commented 6 years ago

python AudioSentimentPipeline.py -i data/input.csv -o outputs/ --hmm Splitting provided audio files into chunks and then extracting features. data/audio1.wav didn't find file Traceback (most recent call last): File "AudioSentimentPipeline.py", line 73, in main() File "AudioSentimentPipeline.py", line 63, in main process_raw_data.main(args, pipe=True) File "/home/janhavi/Documents/audio-sentiment-analysis-pipeline-master/audio_sentiment_analysis/process_raw_data.py", line 193, in main process_csv_input(args.csv_loc, args.out_loc, args.split_flag, args.extract_flag) File "/home/janhavi/Documents/audio-sentiment-analysis-pipeline-master/audio_sentiment_analysis/process_raw_data.py", line 157, in process_csv_input split_call_into_speakers(call_path + '.wav', out_loc) File "/home/janhavi/Documents/audio-sentiment-analysis-pipeline-master/audio_sentiment_analysis/process_raw_data.py", line 57, in split_call_into_speakers diarized = aS.speakerDiarization(temp_out_loc, 2, mtSize=0.5, mtStep=0.1) File "/home/janhavi/Documents/audio-sentiment-analysis-pipeline-master/pyAudioAnalysis/audioSegmentation.py", line 703, in speakerDiarization [Classifier1, MEAN1, STD1, classNames1, mtWin1, mtStep1, stWin1, stStep1, computeBEAT1] = aT.loadKNNModel(os.path.join("data","knnSpeakerAll")) TypeError: 'NoneType' object is not iterable

zsn900503 commented 6 years ago

Did you figure this out? I'm having the same problem here

avewells commented 6 years ago

Looks like pyAudioAnalysis is unable to find the kNNModel in its own data directory. I'm guessing you didn't update the DATA_DIR as shown here?

zsn900503 commented 6 years ago

Thanks avewells. That works. I'm having another problem when facing the classify step.

(MSG) [2] in cComponentManager : successfully finished createInstances (25 component instances were finalised, 1 data memories were finalised) (MSG) [2] in cComponentManager : starting single thread processing loop (MSG) [2] in cComponentManager : Processing finished! System ran for 1127 ticks. Split 1 out of 4 Traceback (most recent call last): File "AudioSentimentPipeline.py", line 73, in main() File "AudioSentimentPipeline.py", line 65, in main classify.main(args, pipe=True) File "/home/audio-sentiment-analysis-pipeline/audio_sentime nt_analysis/classify.py", line 135, in main chunk_scores, call_score = train_and_test(hmm_model, data_train, data_test, labels_train, labels_test) File "/home/audio-sentiment-analysis-pipeline/audio_sentime nt_analysis/classify.py", line 35, in train_and_test pred_labels = model.predict(data_test) File "/home/audio-sentiment-analysis-pipeline/audio_sentime nt_analysis/hmm_morency.py", line 42, in predict res.append(0 if self.hmm_0.score(x) > self.hmm_1.score(x) else 1) File "/home/env/local/lib/python2.7/site-packages/hmmlearn/ base.py", line 243, in score X = check_array(X) File "/home/env/local/lib/python2.7/site-packages/sklearn/u tils/validation.py", line 441, in check_array "if it contains a single sample.".format(array)) ValueError: Expected 2D array, got 1D array instead: array=[ 6.831521e-02 3.545912e-04 6.796062e-02 3.250000e+02 5.000000e+00 7.703746e-03 ...] Reshape your data either using array.reshape(-1, 1) if your data has a single fe ature or array.reshape(1, -1) if it contains a single sample.

zsn900503 commented 6 years ago

I guess in the hmm_morency.py predict function def predict(self, x_test): ''' Predicts labels on an unseen test set. Label from HMM with highest score is chosen. ''' res = [] for x in x_test: res.append(0 if self.hmm_0.score(x) > self.hmm_1.score(x) else 1) return np.array(res)

should be something like res.append(0 if self.hmm_0.score(x.reshape(1,-1)) > self.hmm_1.score(x.reshape(1,-1)) else 1) for the test case?