Skip to main content
QUICK REVIEW

[Paper Review] Efficient Graph-Friendly COCO Metric Computation for Train-Time Model Evaluation

Luke Wood, François Chollet|arXiv (Cornell University)|Jul 21, 2022
Advanced Neural Network ApplicationsComputer Science6 citations
TL;DR

This paper presents a graph-friendly, differentiable algorithm for computing COCO Mean Average Precision (mAP) and recall directly within deep learning computation graphs, enabling real-time training-time evaluation. The method achieves near-identical results to pycocotools (mean error <0.016 for mAP) while supporting distributed training and mini-batch processing, significantly improving model iteration and visualization via training curves.

ABSTRACT

Evaluating the COCO mean average precision (MaP) and COCO recall metrics as part of the static computation graph of modern deep learning frameworks poses a unique set of challenges. These challenges include the need for maintaining a dynamic-sized state to compute mean average precision, reliance on global dataset-level statistics to compute the metrics, and managing differing numbers of bounding boxes between images in a batch. As a consequence, it is common practice for researchers and practitioners to evaluate COCO metrics as a post training evaluation step. With a graph-friendly algorithm to compute COCO Mean Average Precision and recall, these metrics could be evaluated at training time, improving visibility into the evolution of the metrics through training curve plots, and decreasing iteration time when prototyping new model versions. Our contributions include an accurate approximation algorithm for Mean Average Precision, an open source implementation of both COCO mean average precision and COCO recall, extensive numerical benchmarks to verify the accuracy of our implementations, and an open-source training loop that include train-time evaluation of mean average precision and recall.

Motivation & Objective

  • To enable real-time, train-time evaluation of COCO mAP and recall metrics within static computation graphs of frameworks like TensorFlow and JAX.
  • To address the limitations of post-training evaluation using pycocotools, which hinders model comparison and slows prototyping.
  • To develop a differentiable, mini-batch compatible implementation that supports distributed training and accurate metric tracking throughout training.
  • To provide a numerically robust approximation of mAP that closely matches the standard pycocotools implementation.
  • To release an open-source, KerasCV-native implementation for seamless integration into modern training pipelines.

Proposed method

  • Propose a differentiable, graph-compatible algorithm for COCO mAP and recall that avoids dynamic state and global statistics, enabling in-graph computation.
  • Implement a differentiable approximation of mAP using sorted confidence scores and IoU-based matching, with per-image and global aggregation.
  • Apply IoU thresholding and class-specific matching to identify true positives and false positives across multiple IoU thresholds (e.g., 0.5–0.95).
  • Filter bounding boxes by area using the bounding box dimensions themselves, rather than segmentation map areas, for practicality and consistency with bounding box detection workflows.
  • Support distributed evaluation by aggregating metrics across devices using differentiable operations and tensor-based state management.
  • Integrate the metrics into a full KerasCV training loop to enable end-to-end training with real-time metric logging.

Experimental results

Research questions

  • RQ1Can COCO mAP and recall be computed accurately and efficiently within a static computation graph during training?
  • RQ2How close can a differentiable, graph-friendly approximation of mAP come to the standard pycocotools implementation?
  • RQ3What are the numerical differences introduced by using bounding box area instead of segmentation map area for filtering?
  • RQ4Can train-time evaluation of mAP and recall improve model development speed and insight through learning curve visualization?
  • RQ5How does the implementation scale across distributed training setups with mini-batches of varying box counts?

Key findings

  • The proposed mAP approximation achieves a mean absolute error of 0.015 ± 0.011 compared to pycocotools across all standard COCO metric configurations.
  • For non-area-filtered configurations, the maximum error across all runs was below 0.046, with median error below 0.015, indicating high numerical fidelity.
  • The largest error increase (up to 0.202) occurred in area-filtered settings, primarily due to differing area computation methods: KerasCV uses bounding box area, while pycocotools uses segmentation map area.
  • The implementation supports distributed training and mini-batch processing, enabling scalable, real-time metric logging during training.
  • The method enables full training curve visualization for mAP and recall, significantly reducing iteration time and improving model comparison.
  • The authors conclude that their approach is more practical and user-friendly than pycocotools' segmentation-based area filtering, especially for users without segmentation maps.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.