File “h5py\h5f.pyx“, line 78, in h5py.h5f.open OSError: Unable to open file

问题:

win7(64位)+ tensorflow1.5 + keras2.1.6 + h5py2.8.0 运行moblienet读取模型权重image时出错。以下是代码和报错:
File “h5py\h5f.pyx“, line 78, in h5py.h5f.open OSError: Unable to open file

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)

解决:

困扰了我好几天,解决用了好多办法,查询了好多资料,最后自己总结出了一些方法。

1.tensorflow版本问题,把tensorflow和对应的keras版本往上升级可以解决问题,升级到tensorflow1.8以上,同时注意要对应好keras的版本,但是我要在低配置的硬件上面跑,升级了框架之后我跑不动。

2.h5py的问题,把这个往上升级,升级到最高版本,但是我升级后却出现了其他问题。

3.改权重,查询官网的API资料后,我weights选了None随机初始化后可以解决问题,但是效果太差。File “h5py\h5f.pyx“, line 78, in h5py.h5f.open OSError: Unable to open file
4.通过在官网看了API资料后自己指定权重位置,最后成功解决了问题。
File “h5py\h5f.pyx“, line 78, in h5py.h5f.open OSError: Unable to open file

上一篇:迭代器Iterator


下一篇:Wireshark 查看监控包的HTML通讯