起因:
votenet调试过程中:
python sunrgbd_data.py --gen_v1_data
Traceback (most recent call last):
File "sunrgbd_data.py", line 332, in <module>
save_votes=True, num_point=50000, use_v1=True, skip_empty_scene=False)
File "sunrgbd_data.py", line 231, in extract_sunrgbd_data
pc_upright_depth = dataset.get_depth(data_idx)
File "sunrgbd_data.py", line 70, in get_depth
return sunrgbd_utils.load_depth_points_mat(depth_filename)
File "/d/v/sunrgbd/sunrgbd_utils.py", line 196, in load_depth_points_mat
depth = sio.loadmat(depth_filename)['instance']
File "/usr/local/lib/python3.6/dist-packages/scipy/io/matlab/mio.py", line 142, in loadmat
matfile_dict = MR.get_variables(variable_names)
File "/usr/local/lib/python3.6/dist-packages/scipy/io/matlab/mio5.py", line 272, in get_variables
hdr, next_position = self.read_var_header()
File "/usr/local/lib/python3.6/dist-packages/scipy/io/matlab/mio5.py", line 219, in read_var_header
raise ValueError("Did not read any bytes")
ValueError: Did not read any bytes
matlab版本:
我用的是R2019a
R: release的意思, 每年发布几次
Version才是版本号
In matlab comand lind:
>> save('wf_1.mat', 'p', '-v6')
in python:
wf = scipy.io.matlab.loadmat('./wf_1.mat')
Why the '_header_' is 5.0 MAT-file, instead of 6.0 MAT-file when I save('wf_1.mat', 'p', '-v6') ?
5.0 MAT-file是Level 5 MAT-file format的意思,
'-v5','-v6' and '-v7' refer to different capabilities on the same format.
Version 7.3 MAT-files :
use an HDF5 based format that requires some overhead storage to describe the contents of the file.
HDF5 based format 比 Level 5 MAT-file format(应该就是下图说的own binary form) 先进
Error with loadmat in scipy: could not read bytes
The Level 5 MAT-file format
supports all the array types supported in MATLAB Versions 5 and up, including multidimensional
numeric arrays, character arrays, sparse arrays, cell arrays, structures, and objects.
The Level 4 MAT-file format is a simpler format, but it only supports two-dimensional matrices and
character strings.
最后发现这货损坏
(但文件大小看着和其他mat文件差不多)
matlab命令行读mat文件最直接
python读mat文件:
HDF5格式 :
>>> import h5py
>>> f = h5py.File('test.mat')
>>> list(f.keys())
level 5 MAT格式:
my_variable = scipy.io.matlab.loadmat('/v/sunrgbd/sunrgbd_trainval/depth/007454.mat')