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

Improved Profile() inference timing #9024

Merged
merged 7 commits into from
Aug 18, 2022
Merged

Conversation

glenn-jocher
Copy link
Member

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

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Implemented a more accurate and granular profiling system in YOLOv5.

πŸ“Š Key Changes

  • Replaced simple timing with Profile class instances for timing blocks.
  • Amended code to use context management (with Profile():) for precise measurements.
  • Introduced Profile class to handle timing with automatic CUDA synchronization if necessary.
  • Accumulated profiling time over the course of the program.
  • Removed explicit calls to time_sync() function in favor of Profile class.

🎯 Purpose & Impact

  • πŸ“ˆ Enhanced Profiling Accuracy: With Profile, there's fine-grained timing which should lead to better optimization decisions.
  • πŸ’‘ Clearer Code Intent: Replacing ad-hoc timing with a context manager clarifies the intent and scope of code being timed.
  • πŸ’Ύ Easier Maintenance: Centralized timing logic within Profile makes future updates to profiling easier and less error-prone.
  • πŸš€ Potential Performance Improvements: Accurate profiling could guide optimization, potentially leading to performance gains for end-users.

@glenn-jocher glenn-jocher self-assigned this Aug 18, 2022
@glenn-jocher glenn-jocher merged commit d40cd0d into master Aug 18, 2022
@glenn-jocher glenn-jocher deleted the update/Profile_class branch August 18, 2022 17:55
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
* Improved `Profile()` class

* Update predict.py

* Update val.py

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

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

* Update val.py

* Update AutoShape

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