Search code examples
pythonnumpyimage-processingimage-resizing

How do I stack the color planes of multiple images and run inference on that?


as a part of my project, i choosed remote sensing and deep learning topic. I obtained few images using remote sensing techniques and loaded them into the colab. image shape

The above picture describes the shape of each image

Now my model requires it in different format as it is trained on image size requirement

where 3039 denotes the number of training samples. so i have to change (2583,1900),(2411,2571),(2583,1900),(2583,1900,3) into a single array with dimensions (1,128,128,6)

The problem is how do i make 3 one-dimensional arrays and 1 three-dimensional arrays into 1 six-dimensional array.

How do i do it. Please help me.


Solution

  • you can first resize the arrays to 128x128, then concat them along the last dim:

    x = np.concatenate((
        np.resize(dem,(1,128,128,1)),
        np.resize(slope,(1,128,128,1)),
        np.resize(nvdi,(1,128,128,1)),
        np.resize(rgb,(1,128,128,3))), -1)