Parallelly compute the per class mAPs for each IoU threshold and save them in a temp file. (temp files are necessary because parallel processes can't use global variables of the master process, I'm all in for ideas, let me know if you there's a better way to do this.)
Once all parallel processes are finished, read the temp files and calculate and print the overall mAP and remove the temp files.
We can also save all the class-wise computed APs for each threshold in a JSON file, something like this
At the moment mAP calculation is slow. We can calculate values for different thresholds and classes in parallel.