Your code looks ok. You don’t need to resize the mean_pixel, since the Tensor could be broadcasted.
image_tensor = torch.from_numpy(image.astype(np.float32))
image_tensor = image_tensor - mean_pixel.view(1, 1, -1)
image_tensor = image_tensor.permute(2, 0, 1)

I assume spi.imread is scipy’s imread function, so that image will have [w, h, c].
You have to permute your Tensor so that the channel dimension will be at dimension 0 and feed it to your model.