Skip to content

Improve plots.py robustness#5616

Merged
glenn-jocher merged 2 commits intomasterfrom
update/plots
Nov 11, 2021
Merged

Improve plots.py robustness#5616
glenn-jocher merged 2 commits intomasterfrom
update/plots

Conversation

@glenn-jocher
Copy link
Copy Markdown
Member

@glenn-jocher glenn-jocher commented Nov 11, 2021

Addresses issues #5374, #5395, #5611

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhancements to the font handling and label plotting in yolov5 utils.

📊 Key Changes

  • Introduced a try-except block for font loading to handle potential TypeError.
  • Added Timeout decorator to plot_labels function to prevent hanging issues.
  • Wrapped plot_labels with a try_except decorator for improved error handling.

🎯 Purpose & Impact

  • 🛠️ The try-except block around font loading ensures compatibility with the latest Pillow library versions, preventing crashes due to font-related issues.
  • ⏱️ The Timeout decorator can prevent long or indefinite runtimes in the plot_labels function, leading to better resource management.
  • 🛁 The try_except decorator aims to make the code more robust by handling errors gracefully during the label plotting process.

The changes should enhance user experience by improving the stability and reliability of the visualization tools in the yolov5 repository.

@glenn-jocher glenn-jocher merged commit def7a0f into master Nov 11, 2021
@glenn-jocher glenn-jocher deleted the update/plots branch November 11, 2021 11:56
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Improve plots.py robustness

Addresses issues ultralytics#5374, ultralytics#5395, ultralytics#5611

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

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

Training stucked in 'plotting labels' Terminating after "Plotting labels..." when training TypeError: expected string or bytes-like object

1 participant