以下最小示例代码
#!/usr/bin/env python3
from tensorflow.contrib.keras.api import keras
model = keras.applications.xception.Xception(input_shape=(299, 299, 3))
失败了
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)
即使在运行之前这样做:
rm -r ~/.keras/models/
然后它https://github.com/fchollet/deep-learning-models/releases/download/v0.4/xception_weights_tf_dim_ordering_tf_kernels.h5
再次成功下载,但之后出现相同的错误。我错过了什么?
我pip3
在 Ubuntu 16.04 上使用 TensorFlow 版本 1.5.0(来自 tensorflow-gpu)。