Giter Club home page Giter Club logo

Comments (5)

marcellacornia avatar marcellacornia commented on August 31, 2024

Hi @diendepzai1998,
thanks for downloading our code.

Did you download the weight file correctly?

from mlnet.

Azzurro96 avatar Azzurro96 commented on August 31, 2024

I am facing the same error now. And the weight file has been download correctly.

from mlnet.

neoaashish avatar neoaashish commented on August 31, 2024

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
model = ml_net_model(img_cols=shape_c, img_rows=shape_r, downsampling_factor_product=10)
File "/home/aashish/mlnet/model.py", line 44, in ml_net_model
weights = get_weights_vgg16(f, 1)
File "/home/aashish/mlnet/model.py", line 26, in get_weights_vgg16
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 264, 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)"

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

from mlnet.

marcellacornia avatar marcellacornia commented on August 31, 2024

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.

from mlnet.

XXEssie avatar XXEssie commented on August 31, 2024

@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)
in ()
----> 1 model = ml_net_model(img_cols=shape_c, img_rows=shape_r, downsampling_factor_product=10)

C:\mlnet-master\model.pyc in ml_net_model(img_rows, img_cols, downsampling_factor_net, downsampling_factor_product)
24 # FEATURE EXTRACTION NETWORK #
25 #########################################################
---> 26 weights = get_weights_vgg16(f, 1)
27 conv1_1 = Convolution2D(64, 3, 3, weights=weights, activation='relu', border_mode='same')(input_ml_net)
28 weights = get_weights_vgg16(f, 3)

C:\mlnet-master\model.pyc in get_weights_vgg16(f, id)
12
13 def get_weights_vgg16(f, id):
---> 14 g = f['layer_{}'.format(id)]
15 return [g['param_{}'.format(p)] for p in range(g.attrs['nb_params'])]
16

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

c:\users\ran.conda\envs\sam\lib\site-packages\h5py_hl\group.pyc in getitem(self, name)
262 raise ValueError("Invalid HDF5 object reference")
263 else:
--> 264 oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
265
266 otype = h5i.get_type(oid)

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

h5py_objects.pyx in h5py._objects.with_phil.wrapper()

h5py\h5o.pyx in h5py.h5o.open()

KeyError: "Unable to open object (object 'layer_1' doesn't exist)"

Please help~ Thank you very much :D

from mlnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.