The reason for slowness is ImageDataGenerator
(see this). Here’s my recommendation:
- Use
image_dataset_from_directory
to iterate on model architecture. - Swap
image_dataset_from_directory
withImageDataGenerator
after finalizing the model architecture and pay the price once to please the grader.