def read_data_from_pkl(datafile):
"""
read file in joblib.dump pkl
:param datafile: filename of pkl
:return:
"""
datas = joblib.load(datafile)
for i in range(10):
datas = np.random.permutation(datas)
inputs, labels = [], []
for data in datas:
inputs.append(data["input"])
labels.append(data["label"])
inputs = np.array(inputs).reshape(-1, 15, 101, 101, 3).astype(np.float32)
inputs -= np.mean(inputs, axis=(2, 3), keepdims=True)
inputs /= np.std(inputs, axis=(2, 3), keepdims=True)
labels = np.array(labels).reshape(-1, 1).astype(np.float32)
return inputs, labels
评论列表
文章目录