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

Unable to open model #32

Closed Arafat4341 closed 3 years ago

Arafat4341 commented 3 years ago

I have trained model on my custom dataset that only contains English and Japanese audios. The model training stops early. And but no h5f file gets generated. I only get weight files like: weights.12.model. That's why receiving error: IOError: Unable to open file (Unable to open file: name = 'models/logs/2020-07-29-05-05-31/weights.12.model', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

full error:

Traceback (most recent call last):
  File "predict.py", line 45, in <module>
    predict(cli_args)
  File "predict.py", line 23, in predict
    model = load_model(cli_args.model_dir)
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 133, in load_model
    f = h5py.File(filepath, mode='r')
  File "/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.py", line 271, in __init__
    fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
  File "/usr/local/lib/python2.7/dist-packages/h5py/_hl/files.py", line 101, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2840)
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2798)
  File "h5py/h5f.pyx", line 78, in h5py.h5f.open (/tmp/pip-nCYoKW-build/h5py/h5f.c:2117)
IOError: Unable to open file (Unable to open file: name = 'models/logs/2020-07-29-05-05-31/weights.12.model', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)
Bartzi commented 3 years ago

It seems again that the script is not able to find your model. Did you double check that the path models/logs/2020-07-29-05-05-31/weights.12.model is the a correct relative path from your current working directory?

Arafat4341 commented 3 years ago

@Bartzi Yes. It is the correct relative path from my cwd.

Bartzi commented 3 years ago

hmm, the resulting file should be a correct hdf5 file, according to the Keras documentation. You could try to check that by loading it by yourself in an interactive python shell. My guess is that the script is just not able to locate the file. That's at least what the error tells me.

Arafat4341 commented 3 years ago

I have tried to load the model in an interactive shell. Getting error: TypeError: __init__() missing 2 required positional arguments: 'filters' and 'kernel_size'

BTW I have given the correct relative path.

Arafat4341 commented 3 years ago

Ah I solved the problem. I gave incorrect path! Thanks for being co-operative!