def write_hdf5(file, data, label_class, label_bbox, label_landmarks):
# transform to np array
data_arr = np.array(data, dtype = np.float32)
# print data_arr.shape
# if no swapaxes, transpose to num * channel * width * height ???
# data_arr = data_arr.transpose(0, 3, 2, 1)
label_class_arr = np.array(label_class, dtype = np.float32)
label_bbox_arr = np.array(label_bbox, dtype = np.float32)
label_landmarks_arr = np.array(label_landmarks, dtype = np.float32)
with h5py.File(file, 'w') as f:
f['data'] = data_arr
f['label_class'] = label_class_arr
f['label_bbox'] = label_bbox_arr
f['label_landmarks'] = label_landmarks_arr
# list_file format:
# image_path | label_class | label_boundingbox(4) | label_landmarks(10)
评论列表
文章目录