Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Calculates the mAP value in object detection tasks

Project description

mapcalc (mean average precision calculator)

Table of contents


For object detection in images the mAP (mean average precision) metric is often used to see how good the implementation is. As no packages that make the calculation for you were available at this time, I adapted the implementation from João Cartucho, which uses files which hold the detection results. It now can be installed as a package with pip and simply gives you the mAP value at a certain iou threshold.


The performance of your neural net will be judged using the mAP criterium defined in the PASCAL VOC 2012 competition. The code from official Matlab code was adapted into Python.


Packages needed:

  • numpy


from mapcalc import calculate_map, calculate_map_range

# calculates the mAP for an IOU threshold of 0.5
calculate_map(ground_truth, result, 0.5)

# calculates the mAP average for the IOU thresholds 0.05, 0.1, 0.15, ..., 0.90, 0.95.
calculate_map_range(ground_truth, result, 0.05, 0.95, 0.05)

The methods expect two dicts:

  • ground_truth_dict with {labels:, boxes:}
  • result_dict with {scores:, labels:, boxes:}


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mapcalc, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size mapcalc-0.1.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page