Yes, you could use ImageFolder for this, just make sure your data is stored in the needed folder structure.
Alternatively, you could write your own Dataset and load/preprocess the images in the __getitem__ function.
Here 21 is a nice tutorial on data loading.