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

Refactor modules #7823

Merged
merged 1 commit into from
May 15, 2022
Merged

Refactor modules #7823

merged 1 commit into from
May 15, 2022

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented May 15, 2022

Follows 'Refactor collections and fstrings' #7821 for python files in models/

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Refactoring and code cleanup in Ultralytics YOLOv5 models.

πŸ“Š Key Changes

  • Simplified the loop in the forward function of a neural network module using list comprehension.
  • Streamlined condition check for Detect layer initialization to improve code clarity.
  • Removed unnecessary else-clauses after return statements for cleaner code structure.
  • Enhanced TensorFlow model's layer enumeration by eliminating redundant iteration indices.
  • Optimized TensorFlow's predict function by ensuring that only relevant return values are used.
  • Improved variable naming and data processing in dataset generation for model quantization.

🎯 Purpose & Impact

  • πŸ‘ Readability: The changes made to list comprehensions and condition checks make the code easier to read and understand.
  • πŸš€ Code Efficiency: The removal of unnecessary variables and indices can lead to slight improvements in code execution efficiency.
  • πŸ’‘ Clarity in Outputs: Changes in TensorFlow prediction outputs ensure clarity on what is being returned, which benefits developers debugging the model.
  • 🧹 Cleaner Codebase: A cleaner codebase eases maintenance, further development, and lowers the barrier for new contributors to understand the code.
  • πŸ›  Better Tooling: By refining the quantization dataset generation, the models are better equipped for conversion to optimized formats compatible with various hardware for improved performance.

@glenn-jocher glenn-jocher self-assigned this May 15, 2022
@glenn-jocher glenn-jocher merged commit 8aa2085 into master May 15, 2022
@glenn-jocher glenn-jocher deleted the refactor/modules branch May 15, 2022 17:44
tdhooghe pushed a commit to tdhooghe/yolov5 that referenced this pull request Jun 10, 2022
ctjanuhowski pushed a commit to ctjanuhowski/yolov5 that referenced this pull request Sep 8, 2022
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.

1 participant