IOError: Unable to open file (File signature not found)
2018-01-16 10:22
1131 查看
用matlab保存的文件,用h5py读取的时候出现了上述错误。
经过查资料,发现是因为matlab的.mat文件保存的时候,如果没有加
load之后的形状可能会转置,只要打印出来,根据自己的需要添加
def load_feature(features_path, name_str): print 'BasicDataProvider: reading %s' % (features_path, ) features_struct = h5py.File(features_path, 'r') features = features_struct[name_str][:] # n*d print(features.shape) return features
经过查资料,发现是因为matlab的.mat文件保存的时候,如果没有加
-v7.3(
save('data.mat','test','-v7.3')),就不是h5py格式保存,所以应该使用原始的load方法:
features_struct = scipy.io.loadmat(features_path) self.features = features_struct['test']
load之后的形状可能会转置,只要打印出来,根据自己的需要添加
np.transpose()函数即可。
相关文章推荐
- IOError: Unable to open file (File signature not found)
- SQL - Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120
- expdp ORA-39070:Unable to open the log file
- ORA-27041: unable to open file--恢复被rm意外删除数据文件
- Error: Unable to open class file R.java
- Unable to open file DESIGNWINDOWS.OBJ
- Android:Help with “Error: Unable to open class file R.java” zz
- Unable to open log device ‘/dev/log/main’: No such file or directory
- 开启手机LogCat:Unable to open log device ‘/dev/log/main’: No such file or directory
- Unable to Open User Login File
- ERROR: Unable to open class file E:\。。。\R.java: Permission denied
- Unable to open table file ..\data\model_ckpt: Unknown: NewRandomAccessFile failed to Create/Open:
- ORA-07391: sftopn: fopen error, unable to open text file.
- turboc报错:"unable to open file:c0s.obj "
- Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instanc
- sqlite3.OperationalError: unable to open database file 解决办法
- “Unable to open log device '/dev/log/main': No such file or directory”
- ERROR: Unable to open class file Permission denied错误修改方法
- OPW-00001: Unable to open password-file (10gR2)
- VSS客户端不能访问问题“unable to open user login file//服务器项目管理目录/data/logedin/用户名.log