I have to process a large amount of image data and would like to use the .map()
function from the concurrent.futures
package to speed it up. The goal is to loop over all the images in a directory, process them, and then save them in another directory. This in itself is not a problem but I would like to save 90% of the processed images in one directory and the remaining 10% in another directory. How can I do this using .map()
?
Without .map()
I enumerate the images and then say:
if enumerator < (len(directory) * 0.9):
save image in one directory
else:
save image in another directory
How can I add this to the function I call with .map()
, since I don't have access to the enumerator anymore?
Any help is very much appreciated!
All the best, snowe