折磨了半天,刚开始以为是h5py和其他lib包的版本不兼容导致的。
问题:
OCR文本检测ctpn训练时,做一个空的权重文件,然后开始训练数据,把训练结果写入到权重文件时报错:
OSError: Unable to open file (truncated file
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 (truncated file: eof = 96, sblock->base_addr = 0, stored_eof = 2048)
解决方法:
我是在windows环境运行的,那么制作hdf5文件时,也应该在windows环境下(python IDE下,而不是dos或者copy linux下的文件),执行
import h5py
g=h5py.File("hd.hdf5", 'w')
生成的【hd.hdf5】文件,即可使用。