You could write a custom Dataset and return the image names in the __getitem__. This tutorial might be a good starter.
Dataset
__getitem__