-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Custom folder for export artifacts #11817
base: main
Are you sure you want to change the base?
Conversation
β¦ current location (project root folder)
All Contributors have signed the CLA. β
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π Hello @mayorblock, thank you for submitting an Ultralytics YOLOv8 π PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- β
Verify your PR is up-to-date with
ultralytics/ultralytics
main
branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by runninggit pull
andgit merge main
locally. - β Verify all YOLOv8 Continuous Integration (CI) checks are passing.
- β Update YOLOv8 Docs for any new or updated features.
- β Reduce changes to the absolute minimum required 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
See our Contributing Guide for details and let us know if you have any questions!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11817 +/- ##
==========================================
- Coverage 70.63% 68.45% -2.18%
==========================================
Files 122 122
Lines 15631 15635 +4
==========================================
- Hits 11041 10703 -338
- Misses 4590 4932 +342
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. |
I have read the CLA Document and I sign the CLA |
@mayorblock have you investigated the idea of using the from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.model.pt_path = "yolov8n-custom-name.pt"
out = model.export(format="onnx")
print(out)
>>> 'yolov8n-custom-name.onnx' This did not work if I added a directory If possible, it would be nice to use a higher level attribute (like the previously mentioned |
@Burhan-Q thank you for the suggestions. I did notice that I had more distinct decoupling in mind but your point to avoid introduction of additional (minor) arguments is a very valid one. I will have a look at |
In some situations it can be useful to be able to specify the output location of exported artifacts (for example, training on remove and storing on some mounted storage). This is an answer to #4503 that discuss this option in the context of ONNX. It turned out that with minimal changes it can work for most (all?) the rest which are included
I somewhat arbitrarily picked
artifact_path
for the new optional configuration parameter (I am very much open for better alternatives :).I have had to split the artifact location from the input model location; they where tightly coupled before. It works with both absolute and relative (to current working directory). Currently it copies the artifact name from the input model but that could of course be adjusted, if you find that useful.
I hope you find this contribution useful and I very much looks forward to hear your opinions / comments.
I have extended and run the unit tests as much as possible but work on a mac. I was not able to run some of the LINUX-enabled only formats. Also I have not yet looked into enabling this in the cli (but will do)
Cheers
Mikael
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Improved model export functionality with temporary directories for safer file handling.
π Key Changes
tempfile
usage to create temporary directories during model exports.π― Purpose & Impact