title: Keras: keep all images in a single directory
body: <p>I work with many images (10M+) stored in a single directory (no subfolders for each class) and use a pandas DataFrame to keep track of class label. The amount of images do not fit in memory so I must read minibatches from disk. So far I have used Keras <a href="https://keras.io/preprocessing/image/" rel="nofollow noreferrer">.flow_from_directory()</a>, but it requires me to move images to one subfolder per class (and per train/validation split). It works great, but it just becomes very unpractical when I want to use differnt subsets of images and define classes in various ways. Do anyone have an alternative strategy that usees a database (e.g. pandas.DataFrame) to keep track of the reading of minibatches instead of moving images to subfolders?  </p>