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
Using the model for prediction #34
Comments
Try lb.fit() first, have a look at the sklearn label encoder docs |
I found this worked for a simple test but I think I have the labels incorrect:
|
@dlpazs version is working fine for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I am trying to use the already trained model directly for predicting the emotions.
I wrote this put this code in a python file and run it:
def predict():
lb = LabelEncoder()
Model_filename = 'saved_models/Emotion_Voice_Detection_Model.h5'
Model = load_model(Model_filename)
X, sample_rate = librosa.load('filename.wav', res_type='kaiser_fast',duration=2.5,sr=22050*2,offset=0.5)
sample_rate = np.array(sample_rate)
mfccs = np.mean(librosa.feature.mfcc(y=X, sr=sample_rate, n_mfcc=13),axis=0)
featurelive = mfccs
livedf2 = featurelive
livedf2= pd.DataFrame(data=livedf2)
livedf2 = livedf2.stack().to_frame().T
twodim= np.expand_dims(livedf2, axis=2)
livepreds = Model.predict(twodim,batch_size=32,verbose=1)
livepreds1=livepreds.argmax(axis=1)
liveabc = livepreds1.astype(int).flatten()
livepredictions = (lb.inverse_transform((liveabc)))
livepredictions
But, it displays an error in the (lb.inverse_transform), it says that the (lb) need to be trained first .. Is there a method where I can use it which returns the emotion's name, without a need for using the dataset and training the model again?
Also I have another question, Is this model a language-independent model?
Thanks,
The text was updated successfully, but these errors were encountered: