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

Clean and bump dvc callback: settings, stacked images #4343

Merged

Conversation

shcheklein
Copy link
Contributor

@shcheklein shcheklein commented Aug 13, 2023

A few updates to the DVC tracker and around.

  • Use new SETTINGS to enable / disable it (vs some ad-hoc env var)
  • Stack batch image samples to use slider in the UX
  • Minor cleanup - docs and ensure that we use Path object as a key always in the plots dictionary
Screen.Recording.2023-08-12.at.2.28.15.PM.mov

🤖 Generated by Copilot at 11afc7d

Summary

🔗🛠️🎨

This pull request improves the DVCLive callback for image visualization and configuration, updates the documentation for using DVC with YOLOv5, and refactors the plot name handling in the trainer and validator classes. These changes enhance the user experience and the code quality of the ultralytics library.

Sing, O Muse, of the valiant code reviewers who scrutinized the pull request
And of the skillful programmers who improved the dvc setting and the plot methods
They made the Path objects rule over the strings, as Zeus rules over the gods
And they enhanced the DVCLive callback, like Hephaestus forging splendid artifacts

Walkthrough

  • Update dvc setting description in docs/quickstart.md to link to DVC documentation for DVCLive (link)
  • Use Path objects instead of strings for plot names in on_plot methods of BaseTrainer and BaseValidator classes in ultralytics/engine/trainer.py and ultralytics/engine/validator.py (link, link)
  • Import re and pathlib modules in ultralytics/utils/callbacks/dvc.py for file name and path manipulation (link)
  • Group images by batch and remove batch number from file stem in _log_images function in dvc.py to enable slider functionality in DVCLive UI (link)
  • Remove check for ULTRALYTICS_DVC_DISABLED environment variable and rely on dvc setting in settings.yaml in on_pretrain_routine_start method in dvc.py to simplify logic and consistency (link)

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved DVC integration and enhanced image logging for machine learning experiment tracking.

📊 Key Changes

  • Added a hyperlink to the DVC documentation in the quickstart guide, clarifying its use for experiment tracking and version control.
  • Updated plot registration in trainer.py and validator.py to utilize the Path module for better path handling.
  • Refined the image logging function in dvc.py to group images by batch, facilitating slider functionality in the DVCLive UI.
  • Removed the environment variable check for disabling DVCLive logging, instead directing users to disable it through the SETTINGS.file.

🎯 Purpose & Impact

  • 🔗 The hyperlink provides easy access to information on how DVC can be used, making it friendlier for new users.
  • 🖼️ Enhanced image logging organizes images more efficiently, providing a smoother experience when reviewing batches of images in DVCLive.
  • 📁 Using Path enables more robust handling of filesystem paths, which can improve cross-platform compatibility.
  • ⚙️ The shift from environment variables to configuration file for disabling DVCLive simplifies user interaction with settings and makes the process more transparent.

🎉 These changes aim to improve the user experience when tracking machine learning experiments, making data more accessible and the tool more intuitive to use.

@codecov
Copy link

codecov bot commented Aug 13, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@b5d1af4). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head 11afc7d differs from pull request most recent head eb5e0cf. Consider uploading reports for the commit eb5e0cf to get more accurate results

@@           Coverage Diff           @@
##             main    #4343   +/-   ##
=======================================
  Coverage        ?   53.58%           
=======================================
  Files           ?      118           
  Lines           ?    13469           
  Branches        ?        0           
=======================================
  Hits            ?     7218           
  Misses          ?     6251           
  Partials        ?        0           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@glenn-jocher
Copy link
Member

glenn-jocher commented Aug 13, 2023

@shcheklein looks good! BTW if you'd like to contribute a page to https://docs.ultralytics.com/integrations/ that would be welcome :)

EDIT: To add a page to the docs you'd just create a Markdown file in the relevant docs folder, i.e. you could create a docs/integrations/dvc.md file that explains how the integration works for users to understand.

https://github.com/ultralytics/ultralytics/tree/main/docs/integrations

@shcheklein
Copy link
Contributor Author

@glenn-jocher thanks for such quick turn around it a real pleasure folks to see this! 🙏

BTW if you'd like to contribute a page to https://docs.ultralytics.com/integrations/ that would be welcome :)

yes, it's on me iterative/dvclive#603 and it is p1 - we'd like to stabilize the workflow a bit first.

Aside from this PR - a bit tricky part that we found, that is specific to DVC workflow is that since callback is so magical and automatic - it's great to start, but it's a bit tricky to integrate into the existing repos - YOLO +DVC and in mode advanced setups (where DVC manages data, etc, etc). So, it's on our radar and I'll make a tactical decision on when is the best time to document it.

pistonly added a commit to pistonly/ultralytics that referenced this pull request Aug 17, 2023
Signed-off-by: Onuralp SEZER <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <[email protected]>

Clean and bump dvc callback: settings, stacked images (ultralytics#4343)

Co-authored-by: Glenn Jocher <[email protected]>

Improve tests coverage and speed (ultralytics#4340)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

`ultralytics 8.0.154` add `freeze` training argument (ultralytics#4329)

Omit `ultralytics/utils/callbacks` from coverage (ultralytics#4345)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Fix PIL Image `exif_size()` function (ultralytics#4355)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

Add `data/utils.py` to tests (ultralytics#4363)
0iui0 pushed a commit to 0iui0/ultralytics that referenced this pull request Jan 3, 2024
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