-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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 CLI Fire for detection script #4981
Conversation
acd836e
to
15dba20
Compare
@glenn-jocher mind check? π° |
@Borda this is really interesting. Didn't know about Sequence. Is Fire and Sequence compatible with python >= 3.6? It looks like one downside is that the arguments must be full-length now. i.e. can we do |
yes, so far I know, the
I guess that the |
@glenn-jocher so how do you feel about this simification? |
@glenn-jocher can we proceed this one, it is not trivial to keep it updated :] |
@glenn-jocher ^^ π° |
@glenn-jocher ^^ π |
@Borda hey there! Thanks for submitting this and keeping it updated. Do you think this is suitable for merging into master or do you think we might want to run some more tests on this? Any significant change in the repo like this we want to be sure we are handling correctly. If you're free next week for a quick meeting please use my meeting link to set up a call. Thanks! |
@glenn-jocher I would say it is safe to merge as the detection quite straight script... for training or other, I would recommend running larger testing... π° |
@glenn-jocher Happy New Year π |
@glenn-jocher still an ongoing discussion? π° |
It would be great to have that feature! |
@glenn-jocher ay update here? π it is pending for almost half a year... |
@Borda I've been testing this, so far so good, but we've lost the capability to print the arguments as in master on this line: Line 241 in 932dc78
Lines 164 to 167 in 932dc78
I've been looking at using locals() and vars() to recreate this, but can't separate out the function/Fire variables with existing variables created by the import statements at the top of the file. |
this simple example works: import inspect
import fire
def main(a1: int, b2: str = "aaa"):
myframe = inspect.currentframe()
args, _, _, frm = inspect.getargvalues(myframe)
args = {k: v for k, v in frm.items() if k in args}
print(args)
if __name__ == '__main__':
fire.Fire(main) |
@glenn-jocher all seems fine :) |
@Borda I ran into two issues when testing: Shortened arguments
Multiple weights
|
Add the short args, yes it is a limitation |
@glenn-jocher ^^ π° |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions YOLOv5 π and Vision AI β. |
@Borda thanks for the heads-up! We'll look into adding support for shortened arguments and accommodating multiple weights as lists or tuples. Appreciate your input! |
It was a few years ago lol |
@Borda time flies! Your past insights are still valuable as we continuously improve YOLOv5. Thank you for your contributions, both then and now! π |
Resolves #4511
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Refactoring
detect.py
for improved maintainability and adding Google Fire CLI.π Key Changes
argparse
and replaced it withfire
for parsing command line arguments.run
to use type hints for better readability and static type checking.run
with descriptions of each argument.parse_opt
andmain
functions as they're replaced by the use offire
.requirements.txt
file for dependency installation.π― Purpose & Impact
run
arguments makes it clear what each parameter does, contributing to better code maintainability.fire
) to use the updateddetect.py
.