-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Over-estimated map value #1793
Comments
Hi! thanks for your contribution!, great first issue! |
Hi @leomrtinez and thanks for your question. |
Hi @leomrtinez, thanks for raising this issue. TLDR: Long answer: I highly recommend going through a tutorial like this on how to manually calculate map metric, but let me try to do it.
I plotted the resulting precision recall curve based on the values in table as the blue curve below: The next step is calculating the average precision = the area under the curve. This is done through interpolation, because this is a non-smooth function. You can read more about how the interpolation is done here but in this specific case it corresponds to the green curve (the two straight lines). The area under the interpolated curve is simply the average of the two values:
which corresponds to What messes with your intuition is probably the interpolation in the end which in some sense over estimates the the area under the curve. But it is the official way to calculate the metric :] Hope this explains everything. |
Precision problem
Firstly, thanks for your tool.
For my PhD research project I want to make object detection on planetary surface images. So I implemented a FasterRCNN object detection code which I evaluated with torchmetrics.detection.mean_ap. I try to understand how does the map is really computed and, in order to do so I made a little code with arbitrary ground truth and prediction bounding_boxes. The thing is that the map calculated is far from what I expected.
I implemented the mean_ap function as follow :
here a figure of what I do :
Expected behavior
I understood that for a single ground truth value, it's the highest predicted score which is choose as True Positive detection but here I don't understand the recall value.
Following the definition of the precision and the recall found here : https://en.wikipedia.org/wiki/Precision_and_recall , in this situation, I would except to have a precision of 0.5 (or 0.66 if the 0.5 score prediction box is uncounted) and a recall of 1.0.
But when I print the precision value it gave me this :
print(map50)
0.8350
I really don't understand where the 0.835 come from.
Environment
Thanks for reading my problem :)
The text was updated successfully, but these errors were encountered: