-
-
Notifications
You must be signed in to change notification settings - Fork 15.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
results.show() does not work #9819
Comments
👋 Hello @kiristern, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. If this is a 🐛 Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you. If this is a custom training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
It looks like an issue with PIL(LOW) because the results.show() uses a PIL image.show function. You can add these lines to your script:
Be aware that the render function will draw on your image, so if you want to do something with the image afterwards, you need to store a copy somewhere. |
@kiristern works for me in PyCharm. I don't think remote notebooks will be able to show popup windows though. |
@kiristern @MartinPedersenpp I've opened PR #9825 to add notebook support for results.show() |
Unfortunately check_imshow() in PR seems to crash CI. Not sure what the most reliable way to determine if imshow is available in that case. |
@glenn-jocher Not sure if this helps, but it looks like the cv.imshow method in general does not work on jupyter notebooks, so if you can add a detector to the check_imshow(), you could switch to pyplot instead which should work. |
@MartinPedersenpp right, building a solution based off of a new is_notebook() function. |
@MartinPedersenpp PR works now with is_notebook() and import torch
# PyTorch Hub Model
model = torch.hub.load('ultralytics/yolov5:results/display', 'yolov5s') # or yolov5n - yolov5x6, custom
# Images
img = ['https://ultralytics.com/images/zidane.jpg', 'https://ultralytics.com/images/bus.jpg'] # or file, Path, PIL, OpenCV, numpy, list
# Inference
results = model(img)
# Results
results.print() # or .show(), .save(), .crop(), .pandas(), etc.
results.show() |
@kiristern good news 😃! Your original issue may now be fixed ✅ in PR #9825. To receive this update:
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀! |
@glenn-jocher Glad to be of help 🙂 |
@MartinPedersenpp awesome! I basically just try to make daily small incremental changes that improve the most aggregate UI/UX painpoints among the most users/use cases. It adds up over time :) |
Thank you so much for your prompt resolution, it works now! |
You're welcome, @kiristern! I'm glad to hear that the issue is resolved for you. If you have any further questions or run into any more issues, feel free to reach out. Happy coding with YOLOv5! |
Search before asking
YOLOv5 Component
No response
Bug
I created a new conda env and downloaded the requirements as per the instructions; then tried running the tutorial as is but cannot display the results with
results.show()
I get the following message:
Environment
YOLOv5 🚀 2022-10-16 Python-3.10.6 torch-1.12.1+cu102 CUDA:0 (Tesla V100-PCIE-16GB, 16160MiB)
Minimal Reproducible Example
following #36 (comment) exactly.
Additional
interestingly, the images save in the
runs/detect/exp
folder, but i'd like to be able to display the results. I am working in a jupyter notebook.... been trying to find a work around for hours:(Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: