cugbrs / MLRSNet

A Multi-label High Spatial Resolution Remote Sensing Dataset for Semantic Scene Understanding
37 stars 5 forks source link

Can not load pre-trained models (except MLRSNet-DenseNet121.h5) #3

Open ferewi opened 3 years ago

ferewi commented 3 years ago

Hi,

thank you for creating the great dataset. Though, I have the following issue loading the pre-trained models from the "models" directory:

I have a project set up with:

When I try to load any model (except MLRSNet-DenseNet121.h5) I get the following error:

File "/home/ferdi/PycharmProjects/experiments/mlrsnet_test_tf114/venv/lib/python3.6/site-packages/tensorflow/python/keras/saving/save.py", line 146, in load_model
    return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
  File "/home/ferdi/PycharmProjects/experiments/mlrsnet_test_tf114/venv/lib/python3.6/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 200, in load_model_from_hdf5
    f = h5py.File(filepath, mode='r')
  File "/home/ferdi/PycharmProjects/experiments/mlrsnet_test_tf114/venv/lib/python3.6/site-packages/h5py/_hl/files.py", line 408, in __init__
    swmr=swmr)
  File "/home/ferdi/PycharmProjects/experiments/mlrsnet_test_tf114/venv/lib/python3.6/site-packages/h5py/_hl/files.py", line 173, 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 88, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

I used the h5debug tool to check the files and it turns out, that the model files are reported to be correupted:

$ h5debug MLRSNet-DenseNet169.h5 
HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) thread 140041774930816:
  #000: ../../../src/H5F.c line 579 in H5Fopen(): unable to open file
    major: File accessibilty
    minor: Unable to open file
  #001: ../../../src/H5Fint.c line 1208 in H5F_open(): unable to read superblock
    major: File accessibilty
    minor: Read failed
  #002: ../../../src/H5Fsuper.c line 273 in H5F__super_read(): file signature not found
    major: File accessibilty
    minor: Not an HDF5 

This is also the case for all model files except MLRSNet-DenseNet121.h5

What I also noticed is, that if I try to download the model from github, I get a "download" button for MLRSNet-DenseNet121.h5 (see: https://github.com/cugbrs/MLRSNet/blob/master/Models/MLRSNet-DenseNet121.h5), but for any other model file, no download button is available and the "content" is shown differently (e.g. see: https://github.com/cugbrs/MLRSNet/blob/master/Models/MLRSNet-DenseNet169.h5)

Would it be possible that there was an issue when saving the models? Those stackoverflow posts suggest this as an issue https://stackoverflow.com/questions/38089950/error-opening-file-in-h5py-file-signature-not-found, https://stackoverflow.com/questions/26613570/hdf5-file-created-with-h5py-cant-be-opened-by-h5py?

Thank you for your help.

Cheers, Ferdinand

cugbrs commented 3 years ago

Thank you for your interest. We have ensured that the local files are viable. As the model files are quite large, we use git lfs to upload them. Therefore, some files may not have a "download" button. We recommend that you download the zip file and try to load the model file.

ferewi commented 3 years ago

Thank you for your answer. Unfortunately, downloading the zip is what I did. Would you mind checking the model files yourself with the h5debug tool?

cugbrs commented 3 years ago

We have used the h5debug tool to check the availability of the model file. h5debug MLRSNet-ResNet101.h5 But no error message was returned. Moreover, we checked the files use import h5py f = h5py.File('MLRSNet-ResNet101.h5', 'r') print(list(f.keys())) Return ['model_weights', 'optimizer_weights'] In addition, we have uploaded a zip file to Google Cloud Drive. You can re-try to download the model file from this link: https://drive.google.com/file/d/1T9lsYsE95KV2iOYEnWV9Qj008prMT_5S/view?usp=sharing

ferewi commented 3 years ago

Thanks a lot - the models downloaded from the google drive are all working.

I also noticed that the zip archive that is available here on Github has just 1.4 GB where the archive from the google drive has about 3.2 GB - so there might be a problem with the models here on Github.

Again, thank you very much for your swift help.