Skip to main content

Average Precision

Available

object_detection.average_precision

Mean Average Precision (mAP) over the whole dataset, summarising detection quality across a sweep of overlap thresholds.

Contract​

FieldValue
version1.0.0
metric_typepointwise
scorer_contractfull_dataset
directionhigher_is_better
entrypointaip_scorers_object_detection.object_detection.average_precision
target_kindNone

Required columns​

  • image_id
  • label
  • predictions

Accepted schemas​

[
{
"name": "gdi_image_v1",
"task_types": [
"detection"
]
}
]

Methodology​

  1. Deterministic - no LLM. Uses Resaro's cv-eval library (COCO-style AP, custom Jaccard IoU).
  2. Build a stable class map from the ground-truth vocabulary and convert every image's boxes.
  3. For each class and each IoU threshold (0.50 to 0.95 in ten steps), greedily match detections to ground-truth boxes in descending confidence order and compute 101-point interpolated AP.
  4. Average AP over classes using the configured average option (macro by default; weighted by class support is also supported), then average over the IoU thresholds.

Score semantics​

Scores range 0-1. A high score means detections are both well-localised and correctly classified across strict and lenient overlap thresholds; a low score means poor localisation or classification. Higher is better.

Worked example​

One class, one ground-truth box, one prediction overlapping at IoU 0.60: it matches at the 0.50/0.55/0.60 thresholds (AP 1.0) but fails the other seven -> mAP ~ 3/10 = 0.30.

Configuration schema​

{
"properties": {
"average": {
"default": "macro",
"enum": [
"macro",
"weighted"
],
"title": "Average",
"type": "string"
},
"inverted": {
"default": false,
"title": "Inverted",
"type": "boolean",
"x-aip-param-role": "scoring_metadata"
},
"iou_range": {
"default": [
0.5,
0.95,
10
],
"maxItems": 3,
"minItems": 3,
"prefixItems": [
{
"type": "number"
},
{
"type": "number"
},
{
"type": "integer"
}
],
"title": "Iou Range",
"type": "array"
},
"label_map": {
"anyOf": [
{
"additionalProperties": {
"type": "integer"
},
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Label Map"
},
"max": {
"default": 1.0,
"title": "Max",
"type": "number",
"x-aip-param-role": "scoring_metadata"
},
"max_dets": {
"default": [
1,
10,
100
],
"items": {
"type": "integer"
},
"title": "Max Dets",
"type": "array"
},
"metric_name": {
"default": "average_precision",
"title": "Metric Name",
"type": "string",
"x-aip-param-role": "scoring_metadata"
},
"min": {
"default": 0.0,
"title": "Min",
"type": "number",
"x-aip-param-role": "scoring_metadata"
},
"weight": {
"default": 1.0,
"title": "Weight",
"type": "number",
"x-aip-param-role": "scoring_metadata"
}
},
"title": "InitializationConfig",
"type": "object"
}

Execution​

{
"emits_metric_family": false,
"function_name": "object_detection.average_precision",
"max_concurrency": null,
"processing_kind": "cpu",
"stream_batch_size": null,
"timeout_seconds": 600
}

Complete manifest​

accepts:
- name: gdi_image_v1
task_types:
- detection
config_schema:
properties:
average:
default: macro
enum:
- macro
- weighted
title: Average
type: string
inverted:
default: false
title: Inverted
type: boolean
x-aip-param-role: scoring_metadata
iou_range:
default:
- 0.5
- 0.95
- 10
maxItems: 3
minItems: 3
prefixItems:
- type: number
- type: number
- type: integer
title: Iou Range
type: array
label_map:
anyOf:
- additionalProperties:
type: integer
type: object
- type: 'null'
default: null
title: Label Map
max:
default: 1.0
title: Max
type: number
x-aip-param-role: scoring_metadata
max_dets:
default:
- 1
- 10
- 100
items:
type: integer
title: Max Dets
type: array
metric_name:
default: average_precision
title: Metric Name
type: string
x-aip-param-role: scoring_metadata
min:
default: 0.0
title: Min
type: number
x-aip-param-role: scoring_metadata
weight:
default: 1.0
title: Weight
type: number
x-aip-param-role: scoring_metadata
title: InitializationConfig
type: object
dependencies: []
description: Mean Average Precision (mAP) over the full object-detection dataset.
direction: higher_is_better
display_name: Average Precision
entrypoint: aip_scorers_object_detection.object_detection.average_precision
execution:
emits_metric_family: false
function_name: object_detection.average_precision
max_concurrency: null
processing_kind: cpu
stream_batch_size: null
timeout_seconds: 600
kind: metric
manifest_version: '1'
max_prompt_slots: 0
metric_metadata:
methodology:
- Deterministic - no LLM. Uses Resaro's cv-eval library (COCO-style AP, custom Jaccard
IoU).
- Build a stable class map from the ground-truth vocabulary and convert every image's
boxes.
- For each class and each IoU threshold (0.50 to 0.95 in ten steps), greedily match
detections to ground-truth boxes in descending confidence order and compute 101-point
interpolated AP.
- Average AP over classes using the configured average option (macro by default;
weighted by class support is also supported), then average over the IoU thresholds.
score_semantics: Scores range 0-1. A high score means detections are both well-localised
and correctly classified across strict and lenient overlap thresholds; a low score
means poor localisation or classification. Higher is better.
summary: Mean Average Precision (mAP) over the whole dataset, summarising detection
quality across a sweep of overlap thresholds.
worked_example: 'One class, one ground-truth box, one prediction overlapping at
IoU 0.60: it matches at the 0.50/0.55/0.60 thresholds (AP 1.0) but fails the other
seven -> mAP ~ 3/10 = 0.30.'
metric_type: pointwise
name: object_detection.average_precision
partition_types: []
required_columns:
- image_id
- label
- predictions
required_kinds: []
scorer_contract: full_dataset
target_kind: null
unsupported_trace_shapes: []
version: 1.0.0