You don’t need to load all your images into memory, but can lazily load each sample of needed.
Therefore just pass the image paths to your Dataset and load each image in __getitem__.
Have a look at the Data loading tutorial 3 to see an example.