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

add an option to skip model info printing #2912

Closed
wants to merge 1 commit into from
Closed

add an option to skip model info printing #2912

wants to merge 1 commit into from

Conversation

fcakyon
Copy link
Member

@fcakyon fcakyon commented Apr 23, 2021

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced logging verbosity control in YOLOv5 model initialization.

πŸ“Š Key Changes

  • Added a verbose parameter to the Model class constructor to control the output of the initialization information.
  • Modified the parse_model function to accept a verbose argument that determines whether model details are printed during parsing.
  • Adjusted logging behavior in both Model initialization and parse_model function to conditionally display logs based on the verbose flag.

🎯 Purpose & Impact

  • πŸŽ›οΈ Enhanced Flexibility: Users can now control the amount of logging information displayed during model initialization, which is useful for keeping console output clean.
  • πŸ§‘β€πŸ’» Developer Convenience: The addition of the verbose argument helps developers by providing options to either view detailed initialization logs or minimize noise during development tasks.
  • πŸ“‰ Potential Impact: This update impacts users who prefer running YOLOv5 without extensive console logging, as they now have the option to limit output, leading to a more streamlined user experience.

@glenn-jocher
Copy link
Member

glenn-jocher commented Apr 24, 2021

@fcakyon thanks for the PR! This was discussed recently in #2862 and the consensus was that we want a global solution based on setting logger levels, i.e. when verbose=True is passed in any function then the logger levels would switch from logging.INFO to logging.WARN. Maybe something like this (the rank is there for multi-GPU DDP):

def set_logging(rank=-1, verbose=True): 
     logging.basicConfig( 
         format="%(message)s", 
         level=logging.INFO if (verbose and rank in [-1, 0]) else logging.WARN) 

One issue is that we'd want this verbose variable to really be a global variable (maybe the logger variable also?) so that's it doesn't need to be passed down to functions as an argument.

@glenn-jocher glenn-jocher added the duplicate This issue or pull request already exists label Apr 25, 2021
@glenn-jocher
Copy link
Member

@fcakyon thank you for your contributions! I'm closing this PR as the original issue has been resolved in PR #2926.

@fcakyon
Copy link
Member Author

fcakyon commented Apr 25, 2021

Its great to see being done so fast!

@fcakyon fcakyon deleted the patch-1 branch April 25, 2021 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants