多维度图像维度变换
- 当图像对应的矩阵的维度为[64, 64, 1, 4000],其中64×64表示图像的大小,1表示图像的通道数;4000表示图像的张数;为了将矩用于Tensorflow的输入格式,即4000×64×64×1,使用np.transpose((3, 0,1, 2))来进行变换:
sc_test = sc_test.transpose((3, 0, 1, 2))
slope_test = slope_test.transpose((3, 0, 1, 2))
- 如果将两个多为矩阵拼接,使用 np.concatenate((a,b), axis = 3)
数组的维度a=[64, 64, 1, 5000]; b=[64, 64, 1, 5000];
在axis= 3 将a, b合并起来c=[64, 64, 1, 10000]
c = np.concatenate((a,b), axis = 3)