Using multiprocessing to preprocess images
1
I am trying to get my feet wet using multiprocessing in python. As such, I am trying to operate an image preprocessing pipeline using multiprocessing. I have all my images in a directory called image_files and I have a list of all the filenames that are inside this directory. I split the list into two chunks a and b and pass each to its own multiprocessing.Process where a method called preprocess_image is doing the preprocessing on each image. Following a tutorial on how to calculate square roots using multiprocessing I came up with a working code (see below). This code works, however, speed matters and I am not sure whether it is appropriate to define two methods doing basically the same or if it would be faster to use only a single method and simply pass a and b to the same target in multiprocessing....