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

Fix det.summary() bug for ultralytics>=8.2.10 #13024

Merged
merged 23 commits into from
May 22, 2024

Conversation

hdnh2006
Copy link
Contributor

@hdnh2006 hdnh2006 commented May 22, 2024

Hello!

I feel embarrassed to upload this PR 🤣🤣🤣. I literally changed one line of code but here you have the PR to fix this issue: #13023

When len(self.bboxes)==0 the value of post processing data is set to None here:

data = self.boxes or self.obb

So I just added [] in the end and that's all:
https://github.com/hdnh2006/ultralytics/blob/35fb8f72c50a7e803f3cf083304f0ac6a9d591ab/ultralytics/engine/results.py#L405

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved data handling in result summaries for better clarity and efficiency.

📊 Key Changes

  • Data Selection Simplified: The choice between bounding boxes (boxes) and oriented bounding boxes (obb) is now more straightforward with a cleaner, more readable conditional assignment.
  • Refinement in Data Processing: The process for handling either type of data (boxes or obb) now explicitly checks for the presence of obb first, before defaulting to boxes, enhancing the code's logic flow.

🎯 Purpose & Impact

  • Clearer Logic for Developers: This change simplifies the understanding of how data types are chosen and handled within the code, making it easier for future developers to follow and modify.
  • Efficiency in Code Execution: By streamlining the decision process for which data to process (obb vs. boxes), the code might execute slightly faster under certain conditions, potentially improving overall performance.
  • Enhanced Readability: The modification enhances the readability of the code, making maintenance and debugging simpler, which indirectly benefits users by ensuring more robust and reliable software.

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 37.44%. Comparing base (f0b7c51) to head (49ddbf6).

Files Patch % Lines
ultralytics/engine/results.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #13024       +/-   ##
===========================================
- Coverage   70.96%   37.44%   -33.53%     
===========================================
  Files         123      123               
  Lines       15566    15566               
===========================================
- Hits        11047     5829     -5218     
- Misses       4519     9737     +5218     
Flag Coverage Δ
Benchmarks ?
GPU 37.44% <0.00%> (ø)
Tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Laughing-q
Copy link
Member

-data = self.boxes or self.obb
-is_obb = self.obb is not None
+is_obb = self.obb is not None
+data = self.obb if is_obb else self.boxes

@hdnh2006 Thanks for the PR! how about we settle data by is_obb? which seems more logical to me, since data would either be boxes or obb.

@hdnh2006
Copy link
Contributor Author

hdnh2006 commented May 22, 2024

+is_obb = self.obb is not None
+data = self.obb if is_obb else self.boxes

Absolutely! your way to manage self.boxes and self.obb looks more professional.

Your suggested changes have been done, please check once the CI pipeline finishes @Laughing-q .

@glenn-jocher glenn-jocher merged commit d5aff5c into ultralytics:main May 22, 2024
16 checks passed
@glenn-jocher
Copy link
Member

@hdnh2006 @Laughing-q thank you guys, PR merged!

gkinman pushed a commit to Octasic/ultralytics that referenced this pull request May 30, 2024
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: hdnh2006 <henry.matucv@gmail.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

4 participants