SuyashMore / MevonAI-Speech-Emotion-Recognition

Identify the emotion of multiple speakers in an Audio Segment
https://colab.research.google.com/github/SuyashMore/MevonAI-Speech-Emotion-Recognition/blob/master/src/notebooks/Emotion_Recognition_Demo.ipynb
MIT License
165 stars 46 forks source link

Not Running speechEmotionRecognition.py #4

Closed lenoirdevinci closed 3 years ago

lenoirdevinci commented 3 years ago

When I try to run the app, I have this error : Using TensorFlow backend. /usr/local/lib/python3.6/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) Traceback (most recent call last): File "./src/speechEmotionRecognition.py", line 21, in model = tf.keras.models.load_model('model/lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5') File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py", line 146, in load_model loader_impl.parse_saved_model(filepath) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/saved_model/loader_impl.py", line 83, in parse_saved_model constants.SAVED_MODEL_FILENAME_PB)) OSError: SavedModel file does not exist at: model/lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5/{saved_model.pbtxt|saved_model.pb}

Can you help me ?

SuyashMore commented 3 years ago

src/speechEmotionRecognition.py , line 21, model = keras.models.load_model('model/lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5')

maybe try using the absolute path of the file on your system.

lenoirdevinci commented 3 years ago

Thanks for your quick response. And congratulation for your work. I already tried multiple solutions :

file_name = os.path.dirname(__file__) +'\\model\\lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5' model = tf.keras.models.load_model(file_name)

model = tf.keras.models.load_model('model/lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5')

model = tf.keras.models.load_model('lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5')

SuyashMore commented 3 years ago

Let's try some Debugging.

try Creating a New file just loading the model

import keras
model = keras.models.load_model('model/lstm_cnn_rectangular_lowdropout_trainedoncustomdata.h5')
print(model.summary())
lenoirdevinci commented 3 years ago

Hello, try Creating a New file just loading the model. I don't know how to do this

if it doesn't work , try loading other models present in /src/model directory. Do not work

$ cd src/ $ python speechEmotionRecognition.py. Ok this is working. When I launch from src/ I passed a step. I don't the same issue anymore. Now I have a GPU issue.

toolkits.initialize_GPU(args) AttributeError: module 'toolkits' has no attribute 'initialize_GPU'

I tried to install Cuda and Nvidia drivers but no success. Is it a possibility into your app to change GPU by CPU ? I didn't where I can do this. Or may be you think about another solution

lenoirdevinci commented 3 years ago

Ok when I put in comment the line #toolkits.initialize_GPU(args), it seems to work without GPU. But now I don't see the CSV generated. Any idea ?

SuyashMore commented 3 years ago
 with open('SER_'+subdir+'.csv', 'w') as csvFile:
            writer = csv.writer(csvFile)
            for i in range(len(filenames)):
                csvData = [filenames[i], 'person01',predictions[i][0],'person02',predictions[i][1]]
                print("filename:",filenames[i],",Predicted Emotion := Person1:",predictions[i][0],",Person2:",predictions[i][1])
                writer.writerow(csvData)
        csvFile.close()

check out .csv files starting with "SER_"

lenoirdevinci commented 3 years ago

Yes I saw this part of the code but I don't know why it isn't working. And I have no errors displayed

chinmaynehate commented 3 years ago

Hey @lenoirdevinci,

I think there are some dependency issues. With the last commit, we should have fixed it. Try cloning the master branch and repeat the dependency installation process with the updated setup.sh again. (We have also updated the README.md. Please refer to it if you have any doubts about installing dependencies and running the code.) Let us know if you have any other problems.

Best, Chinmay

lenoirdevinci commented 3 years ago

Thank you a lot. I will try this quickly

SuyashMore commented 3 years ago

Closing Issue for now. Let us know if you face any other issues!

Regards, Suyash