Reputation: 10946
The following minimal example code
#!/usr/bin/env python3
from tensorflow.contrib.keras.api import keras
model = keras.applications.xception.Xception(input_shape=(299, 299, 3))
fails with
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/_impl/keras/applications/xception.py", line 307, in Xception
model.load_weights(weights)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/_impl/keras/engine/topology.py", line 1101, in load_weights
f = h5py.File(filepath, mode='r')
File "/usr/local/lib/python3.5/dist-packages/h5py/_hl/files.py", line 269, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/usr/local/lib/python3.5/dist-packages/h5py/_hl/files.py", line 99, 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 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = 'imagenet', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
even when doing this before running:
rm -r ~/.keras/models/
Then it successfully downloads https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels.h5
again, but comes up with the same error afterwards. What am I missing?
I'm using TensorFlow version 1.5.0 (tensorflow-gpu from pip3
) on Ubuntu 16.04.
Upvotes: 0
Views: 769
Reputation: 14619
It's an issue specific to TF-Keras. It's discussed in this GitHub issue and has been fixed. According to the author,
It was introduced in PR #15146 and it applies to both Xception and MobileNet.
However, it has been fixed since. If you upgrade to TF 1.6, you will no longer see this issue. For instance, you can
pip install
the TF 1.6 release candidate1.6.0rc0
as of now.
Upvotes: 1