hamidreza_hayatjou:

io.loadmat('/dataset/Train48d48.mat')


Ah, I see.
First, I don’t think you can load specific element from *.mat file by providing [index]. You are loading whole dataset every time, that’s why I recommended to move loading part to __init__ to do that only once.
Second, self.mat_paths[index] in io.loadmat(self.mat_paths[index]) will be processed as a string and return you letter at position index. Since your path is '/dataset/Train48d48.mat', dataloader requested item with index 1 or 17, which is letter d, then loadmat function appended .mat as file extension.
It should be something like this
class MYDATASET(Dataset):
    def __init__(self, mat_paths):
        self.data = io.loadmat(mat_paths)
    def __getitem__(self, index):
        x = self.data['image_data'][index]
        y = np.squeeze(self.data['image_labels'])[index]
        x = torch.from_numpy(x)
        y = torch.from_numpy(y)       
        return x, y
    def __len__(self):
        return len(self.data['image_data'])