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 detect.py arguments #3559

Merged
merged 4 commits into from
Jun 9, 2021
Merged

Refactor detect.py arguments #3559

merged 4 commits into from
Jun 9, 2021

Conversation

glenn-jocher
Copy link
Member

@glenn-jocher glenn-jocher commented Jun 9, 2021

@SkalskiP @kalenmike

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Refactored detect.py for readability and default argument setup.

πŸ“Š Key Changes

  • πŸ”§ Changed detect function parameters to have default values, streamlining command-line argument parsing.
  • 🧹 Cleaned up the argument processing to use function arguments directly, instead of an opt object.
  • βœ‚οΈ Removed conditional update logic from main execution block to a more appropriate location within the detect function.

🎯 Purpose & Impact

  • πŸ“ˆ Enhanced Readability: The refactor makes the code easier to read and understand, improving maintainability.
  • πŸ›  Default Function Parameters: Users can now call detect with or without specific arguments, facilitating easier integration as a module.
  • 🧩 Modularity: Direct use of arguments in the detect function makes it more self-contained and modular, benefiting users who import it as a library.
  • πŸ”„ Smoother Updates: Integrating the update check into the detect function simplifies the main code structure and helps in keeping models up-to-date seamlessly.

@glenn-jocher glenn-jocher self-assigned this Jun 9, 2021
@glenn-jocher
Copy link
Member Author

@fcakyon before you submitted a PR for explicit passing of the opt class to detect(), this updates detect.py so that detect() uses arguments explicitly, with matching default values to the argparser defaults.

We're doing this for easier testing and also in preparation for further pip package work.

@fcakyon
Copy link
Member

fcakyon commented Jun 9, 2021

@glenn-jocher a very good update πŸ‘

@glenn-jocher
Copy link
Member Author

@fcakyon oh great, glad you approve!

It makes the file a bit longer, but now detect() is more functional in python workflows, not just as a bash command.

@glenn-jocher glenn-jocher merged commit 66cf5c2 into master Jun 9, 2021
@glenn-jocher glenn-jocher deleted the glenn-jocher-patch-4 branch June 9, 2021 20:19
Lechtr pushed a commit to Lechtr/yolov5 that referenced this pull request Jul 20, 2021
* Refactor detect.py arguments

@SkalskiP @kalenmike

* unused ok

* comment arguments

(cherry picked from commit 66cf5c2)
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Refactor detect.py arguments

@SkalskiP @kalenmike

* unused ok

* comment arguments
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.

2 participants