For example, I want to cut an image of (1, 1028, 2052, 3) into 16 parts (4 * 4). Now I use the following codes:
for i in range(4):
for j in range(4):
part = input_image[0:1,i*257:i*257+257,j*513:j*513+513,0:3]
input_image_split.append(part)
input_image = np.concatenate(input_image_split, axis=0)
or
input_image = np.reshape(input_image, [4, 257, 2052, 3])
input_image = np.transpose(input_image, [0, 2, 1, 3])
input_image = np.reshape(input_image, [16, 513, 257, 3])
input_image = np.transpose(input_image, [0, 2, 1, 3])
but this will cost me about 10ms per image. This happens the same when i use the way before in tensorflow. Is there any way faster can i split an image or an tensor? (tf.split will cost more time)