titu1994 / MLSTM-FCN

Multivariate LSTM Fully Convolutional Networks for Time Series Classification
492 stars 180 forks source link

OSError: Unable to open file (unable to open file: name = './weights/action_3d_weights.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0) #12

Closed joe-hu closed 5 years ago

joe-hu commented 5 years ago

Hello, First of all, thank you for your sharing ,it's a nice job. I was trying to run the action_3d_model but I'm getting the following error: Traceback (most recent call last): File "E:/program/MLSTM-FCN-master/action_3d_model.py", line 199, in evaluate_model(model, DATASET_INDEX, dataset_prefix='action_3d', batch_size=128) File "E:\program\MLSTM-FCN-master\utils\keras_utils.py", line 195, in evaluate_model model.load_weights(weight_fn) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\network.py", line 1157, in load_weights with h5py.File(filepath, mode='r') as f: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\h5py_hl\files.py", line 394, in init swmr=swmr) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\h5py_hl\files.py", line 170, in make_fid fid = h5f.open(name, flags, fapl=fapl) File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py\h5f.pyx", line 85, in h5py.h5f.open OSError: Unable to open file (unable to open file: name = './weights/action_3d_weights.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

By the way, I am not sure that I added data in a right way. i download the data from the release tab, and copied it to "MLSTM-FCN-master\data\Action3D", as shown as below: image

Could you please help me out with this? Thanks in Advance!

titu1994 commented 5 years ago

The dataset is a available, but you are trying to evaluate a model without first training it, so it cannot find the weight file.

You need to uncomment the train function and train a model first.

joe-hu commented 5 years ago

Thank you for your help! i uncommented hte train function in arem_model , however i got the same error: Train on 43 samples, validate on 39 samples Epoch 1/600

Epoch 00001: loss improved from inf to 2.13436, saving model to ./weights/AReM_weights.h5 Traceback (most recent call last): File "E:/program/MLSTM-FCN-master/arem_model.py", line 195, in train_model(model, DATASET_INDEX, dataset_prefix='AReM', epochs=600, batch_size=128) File "E:\program\MLSTM-FCN-master\utils\keras_utils.py", line 162, in train_model class_weight=class_weight, verbose=2, validation_data=(X_test, y_test)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\training.py", line 1039, in fit validation_steps=validation_steps) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\training_arrays.py", line 217, in fit_loop callbacks.on_epoch_end(epoch, epoch_logs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\callbacks.py", line 79, in on_epoch_end callback.on_epoch_end(epoch, logs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\callbacks.py", line 444, in on_epoch_end self.model.save_weights(filepath, overwrite=True) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\keras\engine\network.py", line 1120, in save_weights with h5py.File(filepath, 'w') as f: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\h5py_hl\files.py", line 394, in init swmr=swmr) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\h5py_hl\files.py", line 176, in make_fid fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl) File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper File "h5py\h5f.pyx", line 105, in h5py.h5f.create OSError: Unable to create file (unable to open file: name = './weights/AReM_weights.h5', errno = 2, error message = 'No such file or directory', flags = 13, o_flags = 302)

i am looking forward for your help

titu1994 commented 5 years ago

Try creating a directory called weights and training a model then.

joe-hu commented 5 years ago

thank you for your kind reply. i am a newbie in Python. Could you please point me to create a directory called weights in detail. i have no ideal about it.

titu1994 commented 5 years ago

The weights cannot be created because there is no weights folder at the root of the project. Just create a new folder called weights.

joe-hu commented 5 years ago

it worked for me! thank you very much!