-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Allow PyTorch Hub results to display in notebooks #9825
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
β¦splay # Conflicts: # .github/workflows/ci-testing.yml
for more information, see https://pre-commit.ci
@@ -18,16 +18,20 @@ | |||
import requests | |||
import torch | |||
import torch.nn as nn | |||
from IPython.display import display |
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.
Shouldn't ipython be an optional dependency ? IMO, it would make sense to remove it for a minimal setup without "displaying" results.
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.
@vfdev-5 ipython is only used for checking if environment is notebook, clearing notebook cells and showing images in notebook cells. We have in requirements due to the popularity of your Colab notebook.
Does it conflict with anything or is it installing significant other dependencies in your environment?
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.
Thanks for the response, @glenn-jocher
Does it conflict with anything or is it installing significant other dependencies in your environment?
well, in terms of space, ipython + deps does not take much space (~1-2MB), I agree. I start to understand better all the context of this work. For demos in colab etc it totally makes sense. In terms of headless server usage (probably less frequent?), it feels weird to install ipython, matplotlib, seaborn (it is just my opinion).
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.
@vfdev-5 got it. Much of this is the difference between training support, visualization support, export support etc. We try to strike the right balance but it's impossible to please everyone.
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Enhancements for image display checks and error handling in various environments.
π Key Changes
warn=True
argument tocheck_imshow
calls when initializing webcam inclassify/predict.py
,detect.py
, andsegment/predict.py
.CHECK_IMSHOW
global variable inmodels/common.py
and conditional display methods based on environment compatibility.@TryExcept
decorator for image showing regardless of the environment inmodels/common.py
.utils/__init__.py
andutils/autoanchor.py
.is_notebook
utility function inutils/general.py
to detect Jupyter notebook environments.check_imshow
inutils/general.py
to consider more environment types and optionally warn if display is not supported.π― Purpose & Impact