Hi,
What is the problem? Your dataset looks mostly good.
The reason why you might not get matching images is because you walk each subdirectory one by one and the order the images are returned is very OS/directory dependent. You might have to be more careful. Maybe iterating one directory (the 20x) and reconstructing the path of the images in the others directories that match the one you are currently reading in this one.