When a dataset is huge, what do you do to train with all the images on i t?
A couple of options:

Rent a bigger computer on a cloud service.
Move to a distributed computing framework (e.g., Spark).
Use a data loading function that only loads the needed data.

Option #3 is the simplest. Most training does not need all of the data in memory at the same time.
Dask can be used for this type of image loading .