HPI-DeepLearning / crnn-lid

Code for the paper Language Identification Using Deep Convolutional Recurrent Neural Networks
GNU General Public License v3.0
105 stars 48 forks source link

numpy.AxisError: axis 1 is out of bounds for array of dimension 1 #18

Open Bini55 opened 4 years ago

Bini55 commented 4 years ago

While running the evaluate.py code I'm getting the following error. I'm using ubuntu (18.04) terminal

Traceback (most recent call last): File "evaluate.py", line 66, in evaluate(cli_args) File "evaluate.py", line 53, in evaluate y_pred = np.argmax(probabilities, axis=1) File "<__array_function__ internals>", line 6, in argmax File "/home/bini/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1153, in argmax return _wrapfunc(a, 'argmax', axis=axis, out=out) File "/home/bini/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc return _wrapit(obj, method, *args, *kwds) File "/home/bini/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 47, in _wrapit result = getattr(asarray(obj), method)(args, **kwds) numpy.AxisError: axis 1 is out of bounds for array of dimension 1

Bartzi commented 4 years ago

Hmm, difficult to tell what's wrong. What did you do exactly?

Bini55 commented 4 years ago

I trained the network using train.py and saved the weight model ,also predicted an audio file .But when I'm trying to run the evaluate code the above error is showing .I don't understand what's wrong .

Bartzi commented 4 years ago

I also don't know what's wrong. I can only advise you to do some debugging and determine why the array probabilities seems to have only one axis instead of the expected two axes.

Bini55 commented 4 years ago

Mmmm....When I check shape of probabilities using np.shape(probabilities) it gives (0,) .

Bartzi commented 4 years ago

Seems, that your model does not return any predictions. You could check that your are using the correct model and that your model gets some input at all.

Bini55 commented 4 years ago

I found that it's not loading test_data_dir in to the evaluate.py....no issues with the validation_data_dir .Can you please help me to solve this issue?

Bartzi commented 4 years ago

did you adapt your config accordingly?

Bini55 commented 4 years ago

yes...

Bini55 commented 4 years ago

I have another doubt...If we trying to normalize the audio loudness using neg23.py (which is in tools folder) is it change the duration of the audio files? Because when I'm trying to normalize my audio files of duration 10sec each using neg23.py after running the code the duration of each audio files changes to 6sec. I have no idea whats happening ....Can you please tell where I should change so that I could get audio files of duration 10sec.

Bini55 commented 4 years ago

Can you please share me what is the purpose of loudness normalization in this language identification task or why we use it?What happens if we skip that step? (advantage and disadvantage of using loudness normalization) ...I don't have any idea about it that's why..._

Actually when I tried to obtain spectrogram of audio files after normalization and segmentation (first I did normalization and then segmentation) I'm unable to process it ,shows Index error:list index out of range .But when I tried to obtain spectrogram after segmentation and normalization (first I did segmentation and then normalization )I'm able to obtain the spectrogram images....I'm unable find the logic behind that could you please help me..

nikhil031294 commented 4 years ago

Can you check your numpy version once, whether it matches the requirements. If that is correct, try changing the code for evaluating the argmax of the array,which suits your probabilities variable.