Skip to content
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

Background fn #8000

Closed
1 task done
adelchellabi opened this issue May 26, 2022 · 6 comments · Fixed by #9414
Closed
1 task done

Background fn #8000

adelchellabi opened this issue May 26, 2022 · 6 comments · Fixed by #9414
Labels
question Further information is requested Stale

Comments

@adelchellabi
Copy link

Search before asking

Question

Hello
I don't understand what is background fn and background fp in confusion matrix (in the last row )
Please can you explain to me the meaning of this two things and thank you 😊
IMG-20220417-WA0048

Additional

No response

@adelchellabi adelchellabi added the question Further information is requested label May 26, 2022
@glenn-jocher
Copy link
Member

@adelchellabi these are no different than TPs and FPs for any other class in the matrix.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 27, 2022

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.

Access additional YOLOv5 🚀 resources:

Access additional Ultralytics ⚡ resources:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐!

@hotohoto
Copy link
Contributor

hotohoto commented Aug 19, 2022

@glenn-jocher

So, you're saying background is another class? Then I believe the codes here are correct.

yolov5/utils/metrics.py

Lines 166 to 176 in d3ea0df

for i, gc in enumerate(gt_classes):
j = m0 == i
if n and sum(j) == 1:
self.matrix[detection_classes[m1[j]], gc] += 1 # correct
else:
self.matrix[self.nc, gc] += 1 # background FP
if n:
for i, dc in enumerate(detection_classes):
if not any(m1 == i):
self.matrix[dc, self.nc] += 1 # background FN

For each ground truth label, if there is no match, the model predicted it as background, so it's a false positive.

For each detection class, if there is no object hit, the model predicted it as non-background, so it's a false negative.

However, the visualization seems wrong. I mean Background FP and Background FN should be switched. Or we could drop only FP / FN. 🤔

image

@glenn-jocher
Copy link
Member

@hotohoto True object (column) predicted as background (last row) is a FN, so labels are correct.

@hotohoto
Copy link
Contributor

hotohoto commented Aug 19, 2022

@glenn-jocher
Isn't L171 for the same case when true object gc is predicted as background? And the comment at the line says "background FP". As far as I understand the case will be visualized in the last row. So I feel like something is wrong.

Then do you think the comments in L171 (and L176) should be fixed? But if we say the background is a class, then we might be able to say the model predicted the area as positive of the background class but it is a false prediction, then we would call it a background false positive like the comment says. Personally, I like this explanation a bit more.

Anyway, if I got the code correctly, there seems to be a conflict between the comments in L171/L176 and the visualization. Still, it's possible I might have misunderstood the code though. 🤔

@rbavery

@glenn-jocher
Copy link
Member

glenn-jocher commented Aug 20, 2022

@hotohoto hi, thank you for your feature suggestion on how to improve YOLOv5 🚀!

The fastest and easiest way to incorporate your ideas into the official codebase is to submit a Pull Request (PR) implementing your idea, and if applicable providing before and after profiling/inference/training results to help us understand the improvement your feature provides. This allows us to directly see the changes in the code and to understand how they affect workflows and performance.

Please see our ✅ Contributing Guide to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants