I am having nine large images of size (3001,401,5) and a corresponding label of the same size. I have been trying to split the images into small patches of 64*64. Subsequently, combine the nine small pieces to make up a sample input (which will be an input with 9 channels). My codes are as follows:
ind = 0
smallD1 = {}
smallD2 = {}
smallD3 = {}
smallD4 = {}
smallD5 = {}
smallD6 = {}
smallD7 = {}
smallD8 = {}
smallD9 = {}
smallD10 = {}
cutSize=64
data = [];label = []
for sliceI in range(0, data1.shape[2]):
for i in range(0, data1.shape[0], cutSize):
for j in range(0, data1.shape[1], cutSize):
smallD1[ind] = data1[i:i + cutSize, j:j + cutSize, sliceI]
smallD2[ind] = data2[i:i + cutSize, j:j + cutSize, sliceI]
smallD3[ind] = data3[i:i + cutSize, j:j + cutSize, sliceI]
smallD4[ind] = data4[i:i + cutSize, j:j + cutSize, sliceI]
smallD5[ind] = data5[i:i + cutSize, j:j + cutSize, sliceI]
smallD6[ind] = data6[i:i + cutSize, j:j + cutSize, sliceI]
smallD7[ind] = data7[i:i + cutSize, j:j + cutSize, sliceI]
smallD8[ind] = data8[i:i + cutSize, j:j + cutSize, sliceI]
smallD9[ind] = data9[i:i + cutSize, j:j + cutSize, sliceI]
sample_total= np.stack((smallD1, smallD2,smallD3,smallD4,smallD5,smallD6,smallD7,smallD8,smallD9))
#sample_total= np.concatenate((smallD1, smallD2,smallD3,smallD4,smallD5,smallD6,smallD7,smallD8,smallD9),axis=2)
#sample_total=np.transpose(sample_total,(1,2,0))
#sample_total=np.expand_dims(sample_total, axis=-1)
smallD10 [ind] = data10[i:i + cutSize, j:j + cutSize, sliceI]
smallD10=np.expand_dims(smallD10, axis=0)
data.append(sample_total.tolist())
label.append(smallD10.tolist())
ind = ind + 1
When I run the codes, the following error occurs
smallD10 [ind] = data10[i:i + cutSize, j:j + cutSize, sliceI]
IndexError: index 1 is out of bounds for axis 0 with size 1
Please, how can I make it run?
Thank you very much for your time and patience