matlab与python对h5py文件读取顺序(Reading order of h5py files by MATLAB and python)

matlab与python对于同一个h5py文件的读取顺序相反。

诸如对train.h5。

matlab

data=h5read('train.h5','/data');
label=h5read('train.h5','/label');
size(data)
size(label)

结果:
ans =

      41          41           1        1000

“/data”与”/label”为h5py中的两个set的名称。

python

hf = h5py.File(r'train.h5')
data = hf.get('data')
target = hf.get('label')

结果:
data.shape
(1000, 1, 41, 41)

————————

MATLAB and python read the same h5py file in reverse order.

Such as train h5。

matlab

data=h5read('train.h5','/data');
label=h5read('train.h5','/label');
size(data)
size(label)

result:
ans =

      41          41           1        1000

“/ data” and “/ label” are the names of two sets in h5py.

python

hf = h5py.File(r'train.h5')
data = hf.get('data')
target = hf.get('label')

result:
data. shape
(1000, 1, 41, 41)