Search code examples
pythontensorflowobject-detection-api

Is there a convenient way to get class-specific Average Precision scores for a TensorFlow Object Detection model?


The TensorFlow Object Detection API has a very convenient way to get performance metrics for trained models (described in their tutorial here). Unfortunately, the Average Precision scores for each class are not provided.

Does anyone know of a convenient way to get class-specific AP scores for TensorFlow Object Detection models without having to write your own script to do it?

The same question was asked in 2019 but was not answered.

Thanks!


Solution

  • After some more searching, I found a couple solutions.

    1. Use a different evaluation configuration

    Simply change the metrics_set value in the *.config file for your model to "pascal_voc_detection_metrics".

    The TensorFlow Object Detection API supports a variety of evaluation metrics, detailed in the documentation here. The PASCAL VOC 2010 detection metric gives AP scores for each class.

    2. Edit the cocoeval.py file in your pycocotools package

    This method involves pasting 8 lines of code into the cocoeval.py file. It is well explained and documented in this post.