Skip to content

Conversation

@glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Oct 24, 2025

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Refactors and cleans up YOLOv3 codebase for readability, logging consistency, and modern Python typing, with minimal behavior changes but a likely bump to Python 3.10+ due to new type hint syntax. ✨

📊 Key Changes

  • Code hygiene: renamed unused variables (prefixed with “_”) across modules to silence linters and clarify intent.
  • Logging/printing polish:
    • Consistent f-string formatting using !s for safe string conversion.
    • Clearer layer/model parse logs in TensorFlow and PyTorch models.
    • Improved CSV logging headers/rows using iterable unpacking.
  • Type hints and imports:
    • Adopted modern union types (e.g., dict | None, torch.Tensor | tuple[...]) and added from __future__ import annotations.
    • Removed unnecessary noqa comments; minor import cleanup (e.g., OpenVINO).
  • Minor API/utility tweaks:
    • hubconf.py: use next(iter(rglob(...))) to fetch model YAML.
    • letterbox: simplified rounding without changing behavior.
    • Safer and clearer list/tuple construction with iterable unpacking (e.g., [*types, triton], [*names, "background"]).
    • Plotting/utilities: avoid unused variables (underscore naming), small formatting updates.

🎯 Purpose & Impact

  • Cleaner, more maintainable code ✅
    • Easier to read and debug with improved logs and consistent formatting.
  • Fewer linter warnings and reduced noise 🧹
    • Unused variables and redundant comments removed.
  • Modern typing improves developer ergonomics 🧠
    • Clearer function contracts; better IDE support.
  • Potential Python version impact ⚠️
    • Use of union types (|) likely requires Python 3.10+.
  • Minimal runtime behavior change for users 🧪
    • Inference, training, and exports should behave the same, with slightly clearer logs and CSV outputs.

@UltralyticsAssistant UltralyticsAssistant added exports Model exports (ONNX, TensorRT, TFLite, etc.) python Pull requests that update python code labels Oct 24, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @contributor, thank you for submitting an ultralytics/yolov3 🚀 PR! This is an automated message; an engineer will review and assist shortly. To ensure a seamless integration of your work, please review the following checklist:

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/yolov3 main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@glenn-jocher glenn-jocher merged commit 5ebeb2a into master Oct 24, 2025
6 checks passed
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-1 branch October 24, 2025 10:05
@UltralyticsAssistant
Copy link
Member

🎉 Merged! Huge thanks, @glenn-jocher, for the thoughtful refactor in PR #2357. As Antoine de Saint-Exupéry said, “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away”—this cleanup embodies that spirit.

Your improvements—consistent logging, modern Python typing, clearer parsing logs, and leaner utilities—make YOLOv3 easier to read, debug, and maintain, with minimal behavior changes for users. The move toward Python 3.10+ typing will pay dividends for developer ergonomics and long-term sustainability. This is the kind of polish that keeps our tools sharp and our community productive.

Appreciate the care and craft you put into this. Onward! 🚀

Copy link
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Thanks for the tidy-up—everything looks good to me and I didn’t spot any issues. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exports Model exports (ONNX, TensorRT, TFLite, etc.) python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants