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

New TryExcept decorator #9154

Merged
merged 2 commits into from
Aug 25, 2022
Merged

New TryExcept decorator #9154

merged 2 commits into from
Aug 25, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Aug 25, 2022

Includes threaded plots for PR and Confidence curves.

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

This PR introduces a more structured exception handling and threading decorators to improve robustness and concurrency in YOLOv5.

πŸ“Š Key Changes

  • Introduced TryExcept class, a context manager and decorator for handling exceptions with custom messages.
  • Replaced try_except decorator with TryExcept context manager and decorator.
  • Replaced threaded function with a threaded decorator from utils/__init__.py for improved thread handling.
  • Improved plotting functions with TryExcept for better error management and threaded for possible asynchronous execution.
  • Minor refactoring in plot methods to use the matplotlib object-oriented API.

🎯 Purpose & Impact

  • πŸ› οΈ Enhances error reporting by printing custom messages when exceptions occur, resulting in better debugging experiences for developers.
  • 🧡 Provides a more elegant way to handle multi-threaded operations, making code cleaner and potentially improving performance.
  • πŸ“ˆ Improves the reliability of plotting methods through structured exception handling, resulting in fewer unhandled errors and better user experience.
  • 🧹 Codebase refactoring leads to improved maintainability and sets a precedent for future contributions.

@glenn-jocher glenn-jocher self-assigned this Aug 25, 2022
@glenn-jocher glenn-jocher merged commit d07ddc6 into master Aug 25, 2022
@glenn-jocher glenn-jocher deleted the update/TryExcept branch August 25, 2022 12:34
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* New TryExcept decorator

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.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

1 participant