Change data shape

I’m trying to change my data shape from:
[array([[[
…,
, dtype=float32),
array([[[
…,
, dtype=float32),
…]

to array([[[[ … ]]],
[[[ … ]]],
…]]]])

This is how I’m loading the images

import torchvision.transforms as T
preprocess = T.Compose([
   T.ToPILImage(),
   T.ToTensor(),
   #T.Resize(32),
   T.Normalize(
       mean=[0.485, 0.456, 0.406],
       std=[0.229, 0.224, 0.225]
   ),
   T.Grayscale(num_output_channels=1)
   
])

def NormalizeData(data):
    return (data - np.min(data)) / (np.max(data) - np.min(data))

import glob
image_list = []
for filename in glob.glob(path+'*.tif'): 
    im=cv2.imread(filename)
    im=preprocess(im)
    im= np.array(im)
    im = NormalizeData(im)
    image_list.append(im)

The next step is to load this into a data loader

imgset_test =image_list.astype(np.float64)
imgset_test = imgset_test/ (2**14)

imgset_test = imgset_test.reshape(imgset_test.shape[0],1,32,32)
imgset_loader  = DataLoader(dataset=imgset_test,  batch_size=batch_size, shuffle=False)

imgset_test shape should be (number of images,1,32,32)
my images are already greyscale now and 32x32 pixels

Could you describe what issue you are hitting using the approach?
I guess one of the posted operation fails or would you like to check if your approach sounds reasonable (it does)?

Just wanted to check. turns out there was a small error I made and everything works now! thanks a lot.