An example of how to use the multiprocessing
package along with PyTorch.
Code pertaining to this Medium post.
- A processes [R] reads images from a folder [Fo] and multiple detection processes [D#] are used to obtain the class wise count of objects in the images and write it to a file [Fi].
- It uses
torch.multiprocessing
for multiprocessing,PIL.Image
to read the images andtqdm
to keep track of the queue.
- Basic usage :
$ python count_objects.py -f input_folder -o output_file.log
- For other options :
$ python count_objects.py -h