'Write COCOeval summary to tensorboard

I am using pycocotools to evaluate my R-CNN model

coco_eval = pycocotools.cocoeval.COCOeval(coco_gt)

I perform all of the necessary computations and then call

coco_eval.accumulate()
coco_eval.summarize()

This prints a table more or less like this

 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.001
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.001
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.001
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.005

Is there some way to write this to SummaryWriter.

from torch.utils.tensorboard import SummaryWriter

writer = SummaryWriter()
for category, mAP in coco_eval.summary():
    writer.add_scalar(category, mAP)

Something more or less like this? I can only find coco_eval.stats that constains mAP values, but where are the names of their corresponding categories like Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ]?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source