我使用来自 Gadgetron 的 Docker来实现一个带有 Keras 的 Gadget。Theano 作为后端。这是Dockerfile,结果pip list是
Package Version
-------------------- -----------
absl-py 0.7.1
astor 0.8.0
certifi 2019.6.16
chardet 3.0.4
cycler 0.10.0
Cython 0.26.1
decorator 4.4.0
dicom 0.9.9.post1
dicom-numpy 0.1.6
engineering-notation 0.6.0
gast 0.2.2
google-pasta 0.1.7
grpcio 1.21.1
h5py 2.9.0
idna 2.8
imageio 2.5.0
ismrmrd 1.6.1
加载权重时出现错误:
File "/opt/data/CNNArt/Gadgetron/gadget_cnnart.py", line 29, in process
model.load_weights('/opt/data/weight.h5')
File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1157, in load_weights
with h5py.File(filepath, mode='r') as f:
File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 391, in __init__
fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, **kwds)
File "/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py", line 108, in make_fapl
plist.set_libver_bounds(low, high)
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/h5p.pyx", line 1140, in h5py.h5p.PropFAID.set_libver_bounds
ValueError: Invalid high library version bound (invalid high library version bound)
但是,在 Docker 中,当我在终端中打开 python时,我可以加载模型及其参数。
>>> from keras.models import model_from_json
>>> with open('/opt/data/model.json', 'r') as f:
... model = model_from_json(f.read())
...
>>> model.load_weights('/opt/data/weight.h5')
>>>
我尝试使用 重新安装h5py,pip但它不起作用。
问题是它直接在 python 交互终端中工作,但在 Gadget 脚本中不起作用。
扬帆大鱼
BIG阳
HUH函数
相关分类