Closed 00001101-xt closed 6 years ago
Hi, To create this file either retrain from scratch or create a file manually that contains a list with the class names. (ie. [Speech,Music]). The file should be in pickle format.
Thanks, Michalis
On Mon, Sep 10, 2018, 01:04 xtluo-ai notifications@github.com wrote:
It seems that file _classNames is not provided which has to be loaded at line 144* in file "ClassifyWav.py".
I got the following error using the model downloaded from Dropbox https://www.dropbox.com/sh/3fuxhit6h28dnk4/AAAxuRwCGDj6PeUub4znLWAaa?dl=0&lst= :
- CMD:
python ClassifyWav.py evaluate audio_dir SM_imagenet_10000_aug_iter_3500.caffemodel cnn 1 ""
- ERROR:
File "ClassifyWav.py", line 144, in loadCNN classNamesAll = pickle.load(open(classNamesFileName, 'rb')) FileNotFoundError: [Errno 2] No such file or directory: 'SM_imagenet_10000_aug_classNames'
Am I missing something ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MikeMpapa/CNNs-Speech-Music-Discrimination/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AMB79pHaZE7kH7RzL_CdVXzzqDQSf8JHks5uZgDagaJpZM4Wgwq6 .
Solved, ['Music', 'Speech']
works for me, thanks to @MikeMpapa :
class_names = ['Music', 'Speech']
import pickle
with open('SM_imagenet_10000_aug_classNames', 'wb') as f:
pickle.dump(class_names, f)
But still not so clear how to use for classifying an audio clip to speech or music, saying if I have only an audio clip temp.wav
. It seems that temp_true.mat
has to be provided, otherwise, the predicted result is empty, but what I really want is something like:
python classifyWav.py evaluate temp.wav SM_imagenet_10000_aug_iter_3500.caffemodel cnn 1 ""
Music: 0.2
Speech: 0.8
Can I achieve this according to those code provided ?
Please read the readme carefully. Did you run ClassifyWav.py as explained in the readme and got an error? If yes please post your error.
Thanks, Michalis
On Mon, Sep 10, 2018, 21:00 xtluo-ai notifications@github.com wrote:
Solved, thanks to @MikeMpapa https://github.com/MikeMpapa :
class_names = ['Speech', 'Music'] import pickle with open('SM_imagenet_10000_aug_classNames', 'wb') as f: pickle.dump(class_names, f)
But still not so clear how to use for classifying an audio clip to speech or music, say if I have only an audio clip temp.wav. It seems that temp_true.mat has to be provided, otherwise, the predicted result is empty, but what I really want is something like:
- CMD:
python classify.py temp.wav
- Result:
Music: 0.2 Speech: 0.8
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MikeMpapa/CNNs-Speech-Music-Discrimination/issues/5#issuecomment-420120677, or mute the thread https://github.com/notifications/unsubscribe-auth/AMB79vXpElWRx23j11EhaNnrrv1thN53ks5uZxk1gaJpZM4Wgwq6 .
You must be able to classify any wav file exactly as you want to with the code provided. Not sure what you are missing there. The mat files were used only for testing on a specific dataset for the purposes of the journal. They are not mandatory.
@MikeMpapa
In your paper, you are using 16k sampling rate, but your code at line 314~315 in file classifyWav.py
, it uses the default sampling rate which may cause problems:
[Fs, x] = io.readAudioFile(fileName)
x = io.stereo2mono(x)
I end up replacing those code above to:
import librosa
x, Fs = librosa.load(fileName, sr=None)
x = librosa.resample(x, Fs, 16000)
Fs = 16000
And then it works, at least for now. I think maybe you should state these issues in your README.md
if I'm right about this.
Thanks xtluo
Resolved : Manually create *_classNames
file and change the sampling rate to 16K
.
Thanks for the update! Will do that.😉 Michalis
On Tue, Sep 11, 2018, 02:51 xtluo-ai notifications@github.com wrote:
Resolved : Manually create *_classNames file and change the sampling rate to 16K.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MikeMpapa/CNNs-Speech-Music-Discrimination/issues/5#issuecomment-420181322, or mute the thread https://github.com/notifications/unsubscribe-auth/AMB79hHcXUGwvtxZ_UZ75Ynypoz06qn5ks5uZ2t4gaJpZM4Wgwq6 .
It seems that file
*_classNames
is not provided which has to be loaded at line 144 in file"ClassifyWav.py"
.I got the following error using the model downloaded from Dropbox:
python ClassifyWav.py evaluate audio_dir SM_imagenet_10000_aug_iter_3500.caffemodel cnn 1 ""
Am I missing something ?