Giovanni Carnovale
Giovanni Carnovale

Reputation: 1

Can't load keras model

I previously trained and saved a keras model for a Neural Network, but whenever I try to load it I get this error.

Traceback (most recent call last):
File "<input>", line 1, in <module>
  File "C:\Users\gio-c\PycharmProjects\NN\venv\lib\site-packages\keras\models.py", line 260, in load_model
    f = h5py.File(filepath, mode='r')
  File "C:\Users\gio-c\PycharmProjects\NN\venv\lib\site-packages\h5py\_hl\files.py", line 269, in __init__
    self._swmr_mode = True
  File "C:\Users\gio-c\PycharmProjects\NN\venv\lib\site-packages\h5py\_hl\files.py", line 99, in make_fid
    else:
  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 78, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

In the code, I just load keras and import the file. I already tried to recreate the file and nothing happened. Any ideas on how to solve the problem?

Upvotes: 0

Views: 2793

Answers (1)

Cristea Bogdan
Cristea Bogdan

Reputation: 126

Probably your *.h5 file format is wrong or not recognised by h5py

Upvotes: 1

Related Questions