其他分享
首页 > 其他分享> > File “h5py\h5f.pyx“, line 78, in h5py.h5f.open OSError: Unable to open file

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时出错。以下是代码和报错:
在这里插入图片描述

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随机初始化后可以解决问题,但是效果太差。在这里插入图片描述
4.通过在官网看了API资料后自己指定权重位置,最后成功解决了问题。
在这里插入图片描述

标签:h5f,objects,file,h5py,line,open
来源: https://blog.csdn.net/qiuzitao/article/details/113879363