Closed diennv98 closed 4 years ago
Hi @diendepzai1998, thanks for downloading our code.
Did you download the weight file correctly?
I am facing the same error now. And the weight file has been download correctly.
Exactly the same problem and I have Keras 1.1 with theano 0.9.
Traceback (most recent call last):
File "main.py", line 43, in
Could it be possibly somehow related to this warning:
/home/aashish/mlnet/model.py:18: H5pyDeprecationWarning: The default file mode will change to 'r' (read-only) in h5py 3.0. To suppress this warning, pass the mode you need to h5py.File(), or set the global default h5.get_config().default_file_mode, or set the environment variable H5PY_DEFAULT_READONLY=1. Available modes are: 'r', 'r+', 'w', 'w-'/'x', 'a'. See the docs for details.
Please help. Regards, Aashish Neupane
This is probably due to a too recent version of the h5py package.
Please try to replace line 19 of the model.py
file with:
f = h5py.File("vgg16_weights.h5", mode="r")
Otherwise, you can try to downgrade the h5py package.
Note: be sure to have correctly downloaded the vgg16_weights.h5
under the code root folder.
@marcellacornia I also have the exact same problem. I think the problem is in the line 43 of the file main.py. Where the line "model = ml_net_model(img_cols=shape_c, img_rows=shape_r, downsampling_factor_product=10)" would generate following error: KeyError Traceback (most recent call last)
Using Theano backend. Traceback (most recent call last): File "main.py", line 43, in
model = ml_net_model(img_cols=shape_c, img_rows=shape_r, downsampling_factor_product=10)
File "/content/mlnet/model.py", line 26, in ml_net_model
weights = get_weights_vgg16(f, 1)
File "/content/mlnet/model.py", line 14, in get_weightsvgg16
g = f['layer{}'.format(id)]
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 "/usr/local/lib/python2.7/dist-packages/h5py/_hl/group.py", line 177, in getitem
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
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/h5o.pyx", line 190, in h5py.h5o.open
KeyError: "Unable to open object (object 'layer_1' doesn't exist)"
I am using keras 1.1.0 Theano 0.9.0 help me