MiteshPuthran / Speech-Emotion-Analyzer

The neural network model is capable of detecting five different male/female emotions from audio speeches. (Deep Learning, NLP, Python)
MIT License
1.3k stars 438 forks source link

Loading and Testing #20

Closed HarshitSoni1903 closed 5 years ago

HarshitSoni1903 commented 5 years ago

The model was imported perfectly. But the LabelEncoder did not work as:

added in cell 496

from sklearn.preprocessing import LabelEncoder lb = LabelEncoder() livepredictions = (lb.inverse_transform((liveabc))) livepredictions

throws the error:

This LabelEncoder instance is not fitted yet. Call 'fit' with appropriate arguments....

If you could help with this, it will be of great help.

PS: I started by importing all files in cell 1,2,3. Then added 'opt = keras.optimizers.rmsprop(lr=0.00001, decay=1e-6)' to cell 137, since opt was not defined then executed all the blocks in Demo section.

HarshitSoni1903 commented 5 years ago

Nevermind, I wrote a rough workaround for it. Turns out, that it occurred because when model is imported, all the parameters are encoded with it except for the LabelEncoder. It worked for you because you used notebook and all the variables were reused. but when it comes to standalone execution error occurs. Hence, to reuse the variable "lb"(instance of LableEncoder) we pickle dump it in a file and load it again in the same variable name. Hence the inverse_transform method of the lb object can be reused without fit or fit_transform, but one time execution is mandatory to initialize the variable and fit it. the code for dumping is as follows: import pickle file=open('lbsave.txt','wb') pickle.dump(lb,file) file.close()

loading the file is through: import pickle file=open('lbsave.txt','rb') lb=pickle.load(file)

MiteshPuthran commented 5 years ago

Hey @HarshitSoni1903, sorry I couldn't get back as I was consumed in other tasks. Glad that you found the solution to the problem.

Best wishes.

mohammedsuhail85 commented 5 years ago

Is it possible to share the lbsave.txt file with me? my email id: suhailmsm@gmail.com Because I didn't download the audio files and trained the model. But I having the same issue when I run the system. Or are there any other solutions available?

HarshitSoni1903 commented 5 years ago

Hi, i have uploaded the file. Kindly download the file and tweak your code to load the variable from the pickle. Link:https://gofile.io/?c=bXRZ6n

HarshitSoni1903 commented 5 years ago

Moreover, other way( the actual way) is to train the model on colab or some other repo. Because thanks to Mitesh, the code is colab compatible. Hence train the model, pickle the variable in some file, use the same file to load the variable. Because the pickle file I created uses only half of dataset, so if you want higher accuracy, it won't help.

mohammedsuhail85 commented 5 years ago

Thank you very much. That's very helpful :1st_place_medal:

MK-43 commented 2 years ago

Hi, i have uploaded the file. Kindly download the file and tweak your code to load the variable from the pickle. Link:https://gofile.io/?c=bXRZ6n

Hi, could you share the saved pickle file one more time? There's no file in the link you provided here. I'd really appreciate it if you can send a file to helloworldfrommk@gmail.com Thanks!

anas2908 commented 9 months ago

Hi, i have uploaded the file. Kindly download the file and tweak your code to load the variable from the pickle. Link:https://gofile.io/?c=bXRZ6n

Hi, could you share the saved pickle file one more time? There's no file in the link you provided here. I'd really appreciate it if you can send a file to helloworldfrommk@gmail.com Thanks!

can you mail me if you have it anas290816007@gmail.com

anas2908 commented 9 months ago

can you mail me if you have it anas290816007@gmail.com

can you mail me if you have it anas290816007@gmail.com

anas2908 commented 9 months ago

Hi, i have uploaded the file. Kindly download the file and tweak your code to load the variable from the pickle. Link:https://gofile.io/?c=bXRZ6n

can you mail me if you have it anas290816007@gmail.com

HarshitSoni1903 commented 9 months ago

Hey, apologies for the delay. I have uploaded the file (use link) to download. Instructions to use the code are already given above. However, I would like to caution you. I have used only half of the dataset to train so my accuracy was lower. If you wish to utilize the full capabilities of Mitesh's code, train it again, pickle the variable, and then reuse it.

anas2908 commented 9 months ago

Thanks a lot.

On Mon, 5 Feb 2024 at 17:48, HarshitSoni @.***> wrote:

Hey, apologies for the delay. I have uploaded the file (use link https://drive.google.com/file/d/1_qlnNvwtYjHdcgsMsjQRK5rS3FgdOq4I/view?usp=sharing ) to download. Instructions to use the code are already given above. However, I would like to caution you. I have used only half of the dataset to train so my accuracy was lower. If you wish to utilize the full capabilities of Mitesh's code, train it again, pickle the variable, and then reuse it.

— Reply to this email directly, view it on GitHub https://github.com/MiteshPuthran/Speech-Emotion-Analyzer/issues/20#issuecomment-1926866533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4X6PVQPHAJ3HDWM2Q22CDYSDEYRAVCNFSM4G43YSTKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSGY4DMNRVGMZQ . You are receiving this because you commented.Message ID: @.***>

anas2908 commented 9 months ago

do u know any other code repo related to this task

On Mon, 5 Feb 2024 at 17:49, Anas Khan @.***> wrote:

Thanks a lot.

On Mon, 5 Feb 2024 at 17:48, HarshitSoni @.***> wrote:

Hey, apologies for the delay. I have uploaded the file (use link https://drive.google.com/file/d/1_qlnNvwtYjHdcgsMsjQRK5rS3FgdOq4I/view?usp=sharing ) to download. Instructions to use the code are already given above. However, I would like to caution you. I have used only half of the dataset to train so my accuracy was lower. If you wish to utilize the full capabilities of Mitesh's code, train it again, pickle the variable, and then reuse it.

— Reply to this email directly, view it on GitHub https://github.com/MiteshPuthran/Speech-Emotion-Analyzer/issues/20#issuecomment-1926866533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4X6PVQPHAJ3HDWM2Q22CDYSDEYRAVCNFSM4G43YSTKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSGY4DMNRVGMZQ . You are receiving this because you commented.Message ID: @.***>

HarshitSoni1903 commented 9 months ago

Unfortunately no. I used this repo about 4 years ago, for my major project. I'm afraid you'll have to research it on your own.

anas2908 commented 9 months ago

Thanks for the tip!

On Mon, 5 Feb 2024 at 17:52, HarshitSoni @.***> wrote:

Unfortunately no. I used this repo about 4 years ago, for my major project. I'm afraid you'll have to research it on your own.

— Reply to this email directly, view it on GitHub https://github.com/MiteshPuthran/Speech-Emotion-Analyzer/issues/20#issuecomment-1926874735, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ4X6PTZRUJ75QFJ7JAEVZTYSDFKDAVCNFSM4G43YSTKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSGY4DONBXGM2Q . You are receiving this because you commented.Message ID: @.***>