.mat文件的保存和读取
import scipy.io as scio
import numpy as np
mask = np.arange(9).reshape(3,3)
save_path = './data_130x130/'
if not os.path.isdir(save_path):
__ os.makedirs(save_path)
scio.savemat(os.path.join(save_path, mask_x6.mat), {'mask': mask})
读取:
load_path = './data_130x130/'
mask_dict = scio.loadmat(load_path)
mask = mask_dict['mask'][:]