Comments (3)
Hi @nisyad-ms, thanks for reporting this issue.
Sadly this is due to a known bug in the official pycocotools backend, that we use for computations. Specifically, this line:
https://github.com/cocodataset/cocoapi/blob/8c9bcc3cf640524c4c20a9c40e89cb6a2f2fa0e9/PythonAPI/pycocotools/cocoeval.py#L460
should have been
stats[0] = _summarize(1, maxDets=self.params.maxDets[2])
for it to work. Sadly the repo is not really maintained anymore, but is still considered the official reference for mAP.
Instead you can install the faster-coco-eval
backend (https://github.com/MiXaiLL76/faster_coco_eval) which we also supports. This backend have implemented the fix so your code calculates the correct value.
metric = MeanAveragePrecision(iou_type="bbox", max_detection_thresholds=[1, 10, 50], backend="faster_coco_eval")
metric.update(preds, target)
result = metric.compute()
print(result)
#{'map': tensor(1.), ...
Closing issue because we really cannot fix this on our side.
from torchmetrics.
Thanks @SkafteNicki for the information. How to ensure the faster-coco-eval backend is used? Just installing it will do? Thanks again.
from torchmetrics.
Thanks @SkafteNicki for the information. How to ensure the faster-coco-eval backend is used? Just installing it will do? Thanks again.
Sorry I should have specified that. You install the backend with pip install faster-coco-eval
and then when initializing the MeanAveragePrecision
class you need to set the backend
argument to "faster_coco_eval"
.
from torchmetrics.
Related Issues (20)
- Multi output functionality for MeanAbsoluteError HOT 1
- _cumsum moves the data to default GPU when deterministic flag is on HOT 1
- Retrieval metrics are misleading - here's how it should be done instead HOT 6
- Multiple threshold for Multilabel metrics HOT 1
- Cannot import the "clustering" module HOT 5
- Potentially Misleading Error Message for multiclass_precision HOT 2
- Accuracy incurs a GPU/CPU sync point HOT 3
- Support equivalent of torcheval's `merge_state` HOT 1
- Multilabel metrics based on threshold should accept a threshold per label HOT 1
- Recall and Accuracy produce different values when used with logits HOT 1
- Cloning `MultitaskWrapper` with postfix parameters results in incorrect dictionary HOT 7
- f-string should be used in exception HOT 2
- `zero_division` does not work for binary IoU (Jaccard index) calculation and returns NaN HOT 2
- `higher_is_better` for `InfoLM` should change depending on `information_measure` HOT 2
- GPL 2.0 License detected in `functional/text/chrf.py` HOT 3
- truncation cause error while using `bert_score` HOT 4
- `log_dict` to support `ClasswiseWrapper` HOT 4
- `FrechetInceptionDistance` hangs when used with multiple devices in PytorchLightning HOT 3
- Make `ignore_index` work when all batch elements are to be ignored HOT 1
- procrustes alignment HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchmetrics.