Lightning-AI / Lightning-AI/torchmetrics

MeanAveragePrecision for custom area definitions

Open
#3,231 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
2.5k
Forks
526
Avg merge
6d 11h
Merged PRs (30d)
5

Description

## 🚀 Feature

MeanAveragePrecision metric computes mAP and mAR for the following area definition:
```
self.bbox_area_ranges = {
"all": (float(0**2), float(1e5**2)),
"small": (float(0**2), float(32**2)),
"medium": (float(32**2), float(96**2)),
"large": (float(96**2), float(1e5**2)),
}
```
I would like to provide a different definition, like:
```
MeanAveragePrecision(areas={
"all": (float(0**2), float(1e5**2)),
"xsmall": (float(0**2), float(16**2)),
"small": (float(16**2), float(32**2)),
"medium": (float(32**2), float(96**2)),
"large": (float(96**2), float(1e5**2)),
})
```

### Motivation

The default does not necessarily make sense for datasets other than COCO.

### Pitch

Instead of returning the metrics of the default areas, return the summarized metrics for the provided area definition.

### Alternatives

-

### Additional context

-

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the MeanAveragePrecision entry point and trace how the default area definitions are stored and summarized. Define the expected behavior for a caller-provided areas mapping, then update the relevant metric tests so custom categories such as xsmall are included in the returned summaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.