How to calculate mAP after every epoch?

Most python scripts that calculate mAP like the ones in py faster-cnn and detectron2 require writing intermediate results, Is there any correctly implemented code to calculate mAP that doesn’t require writing detections to files first?

detectron2 does not write intermediate results to files to compute mAP.