在Keras中加载权重时出现h5py错误

时间:2017-12-20 10:04:34

标签: keras h5py

我正在尝试运行此脚本: https://github.com/farizrahman4u/keras-contrib/blob/master/examples/cifar10_wide_resnet.py

但是,我改变了这一行

model = WideResidualNetwork(depth=28, width=8, dropout_rate=0.0, weights=None)

model = WideResidualNetwork(depth=28, width=8, dropout_rate=0.0, weights='cifar10')

现在我收到以下错误

> Using TensorFlow backend. Traceback (most recent call last):   File
> "wide_resnet.py", line 40, in <module>
>     model = WideResidualNetwork(depth=28, width=8, dropout_rate=0.0, weights='cifar10', include_top=False)   File
> "/usr/local/lib/python3.5/dist-packages/keras_contrib/applications/wide_resnet.py",
> line 151, in WideResidualNetwork
>     model.load_weights(weights_path)   File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py",
> line 2622, in load_weights
>     load_weights_from_hdf5_group(f, self.layers)   File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py",
> line 3106, in load_weights_from_hdf5_group
>     g = f[name]   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
> "/home/derk/.local/lib/python3.5/site-packages/h5py/_hl/group.py",
> line 167, 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 'flatten_2' doesn't exist)"

0 个答案:

没有答案