One common problem encountered in neural network projects for image classification is that most computers do not have sufficient RAM to load the entire set of data into memory. Even for relatively modern and powerful computers, it would be far too slow to load the entire set of images into memory and to train a CNN from there.
To alleviate this problem, Keras provides a useful flow_from_directory method that takes as an input the path to the images, and generates batches of data as output. The batches of data are loaded into memory, as required before model training. This way, we can train a deep neural network on a huge number of images without worrying about memory issues. Furthermore, the flow_from_directory method allows us to perform image preprocessing steps such as resizing and other image augmentation techniques by simply passing an argument...