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

Add confidence score to label txt files #994

Merged
merged 9 commits into from
Oct 20, 2020
Merged

Add confidence score to label txt files #994

merged 9 commits into from
Oct 20, 2020

Conversation

oakhtar147
Copy link
Contributor

@oakhtar147 oakhtar147 commented Sep 18, 2020

Added a feature where any user is able to optionally save the confidence scores of each bounding box in txt files during inference. Sometimes the user may need to acquire the bounding box confidence scores and they did not have an option before.

I hope this PR is helpful! πŸ‘ πŸ˜ƒ ✌️

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced detection output with confidence scores in saved text files πŸ”βœ¨

πŸ“Š Key Changes

  • Added an option to include confidence scores in saved text files (--save-conf option).
  • Modified the text file writing process to accommodate the new confidence score format.

🎯 Purpose & Impact

  • Purpose: Enables users to save the detection confidence scores alongside the detected class and bounding box coordinates, providing more detailed detection information.
  • Impact: Users who require detailed prediction results for analysis or post-processing gain an insightful new feature, potentially improving use cases such as data analysis and model performance evaluation. πŸ“ˆ

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Oct 19, 2020
@olehb
Copy link
Contributor

olehb commented Oct 19, 2020

πŸ‘

@glenn-jocher
Copy link
Member

@oakhtar147 I'll merge the save-conf argument, but I'll leave the colors alone, as I think we want some uniformity in the label colors.

@glenn-jocher
Copy link
Member

rebase/

@glenn-jocher
Copy link
Member

/rebase

1 similar comment
@glenn-jocher
Copy link
Member

/rebase

@glenn-jocher
Copy link
Member

rebase/

@oakhtar147
Copy link
Contributor Author

Rebased my branch with the main branch. I hope it has went smooth because I am new to contributing and there was quite a learning curve to this. Thanks!

@glenn-jocher glenn-jocher merged commit 83deec1 into ultralytics:master Oct 20, 2020
@glenn-jocher
Copy link
Member

glenn-jocher commented Oct 20, 2020

@oakhtar147 thanks for the rebase!

Yes everything's good. I took the liberty of cleaning up the changes a bit.

It looks like you inspired another PR #1175

@oakhtar147
Copy link
Contributor Author

@glenn-jocher you're welcome! It was quite a subtle yet important feature that was going to be needed sooner or later. I'm glad PR #1175 was inspired.

@glenn-jocher
Copy link
Member

I just had an idea.

Maybe we could output confidence as a 6th value by default, and make the dataloader robust to 6 element labels. This might be very useful for active learning etc. in the future, where you are mixing human labelled and autolabelled data, and it would allow you to gradually introduce more autolabelled data starting with the highest confidence labels as you train.

@glenn-jocher
Copy link
Member

The current approach is a bit 'dumber', as it only provides for setting a --conf threshold at autolabel time, and never again. Then afterwards of course, there is no autolabel confidence information retained for techniques that would choose to try to exploit that.

@oakhtar147
Copy link
Contributor Author

That's actually a good thought. It would make use of the confidence scores instead of just saving them in the output files. I do not see a reason for this to be an option; I mean, what's the harm of outputting the score by default anyway? Definitely you could use it for active learning!

@glenn-jocher
Copy link
Member

@oakhtar147 yeah. I don't know exactly how one would best exploit the info, but having it available for future algorithms might be nice, and then we could remove a few lines of code here and in test.py, which is also outputting labels.

I'd have to take a look at the dataloader though, it might be easier said than done. I'll leave a TODO here to investigate this option.

TODO: consider outputting confidence on all autolabels, and then have dataloader check 5 or 6 column label format and handle each appropriately. Purpose is to make way for future active learning techniques that may exploit label confidence.

@oakhtar147 oakhtar147 deleted the add-conf_score-to-label branch October 25, 2020 13:09
burglarhobbit pushed a commit to burglarhobbit/yolov5 that referenced this pull request Jan 1, 2021
* add contrast to conf/class against bbox rectangle color

* added feature to save conf in txt labels

* Update general.py

* Update detect.py

* Update detect.py

* Update detect.py

save_conf variable removed as only used once, so we can use opt.save_conf instead.

* Update detect.py

* Update detect.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
KMint1819 pushed a commit to KMint1819/yolov5 that referenced this pull request May 12, 2021
* add contrast to conf/class against bbox rectangle color

* added feature to save conf in txt labels

* Update general.py

* Update detect.py

* Update detect.py

* Update detect.py

save_conf variable removed as only used once, so we can use opt.save_conf instead.

* Update detect.py

* Update detect.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher
Copy link
Member

Removing TODO as this is now implemented in detect.py and test.py with --save-conf.

@glenn-jocher glenn-jocher removed the TODO label May 21, 2021
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* add contrast to conf/class against bbox rectangle color

* added feature to save conf in txt labels

* Update general.py

* Update detect.py

* Update detect.py

* Update detect.py

save_conf variable removed as only used once, so we can use opt.save_conf instead.

* Update detect.py

* Update detect.py

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants