from scipy.io import loadmat
from PIL import Image
import torchvision.transforms as t

img = loadmat(path) # path of images to be loaded
img = img['I'] # img is stored under key 'I' (Assuming)
img =  Image.fromarray(img,"L") # Assuming matfile contained np.array.
                                # we need to convert to PIL image
                                # "L" for grayscale "RGB" for color
img = t.To_Tensor(img) # convert to channelxheightxwidth

Hope this helps
Happy Coding