aks407:

BISDDSM


Probably biggest bottleneck here is reading image from disk (you can use timeit to track if it is true).
First, I would check if I have enough RAM to pre-load all the images into dataset. If this is not an option, I’d move all data to NVMe/SSD drive. Also I would convert and save PNGs to numpy arrays anyway, even on HDD, since you don’t have to invoke cv2 file parser every time image is loaded.
Last thing is, 2500x5000 is really big size. Is there any particular reason to use images as is without scaling down?