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
Enable GUI Visualization on Docker with X11 Forwarding #11729
Conversation
β¦using QT This change adds the libsm6 package as a dependency of the docker container builds. This ensures cv2.imshow() functions correctly when using QT, as this package is one of the requirements of libqxcb.
β¦LAY is properly et in docker environment This change removes the docker-specific assertion, enabling the GUI functions to run in the docker container. To enable this support, the $DISPLAY environment variable must be properly set, as well as the X11Forwarding needs to be properly configured.
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 @Jpfonseca, 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 ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #11729 +/- ##
==========================================
- Coverage 70.63% 70.56% -0.07%
==========================================
Files 122 122
Lines 15635 15636 +1
==========================================
- Hits 11043 11033 -10
- Misses 4592 4603 +11
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 |
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.
Seems like a good solution. However, I would also add to the documentation the specific arguments for launching the container in order to connect to the X server.
@ambitious-octopus hey that's a great idea! @Jpfonseca can you add an example to the Docker Quickstart Guide here with the code to visualize from a Docker image? |
@Jpfonseca PR looks but could you please update the docs with example code for remote visualization here: |
Added information on to properly visualize the Object detection from a docker container in both GNU-Linux Display Servers (Xorg and Wayland ) Co-Authored-By: Gereziher Adhane <gereziherw@gmail.com>
@glenn-jocher just added the examples for both X11 and Wayland. Tested both solutions in Xorg (gnome and xfce) and Wayland (sway and gnome) . |
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.
Thank you for your contribution. I appreciate your input, as it adds significant value to the docs. I'll integrate this section more seamlessly, ensuring clarity and accuracy. Additionally, I'll correct any typos. Thanks for including instructions on using Docker without a GPU. It would also be useful to make a small integration here:
ultralytics/docs/en/guides/docker-quickstart.md
Lines 17 to 32 in fcfc44e
## What You Will Learn | |
- Setting up Docker with NVIDIA support | |
- Installing Ultralytics Docker images | |
- Running Ultralytics in a Docker container | |
- Mounting local directories into the container | |
--- | |
## Prerequisites | |
- Make sure Docker is installed on your system. If not, you can download and install it from [Docker's website](https://www.docker.com/products/docker-desktop). | |
- Ensure that your system has an NVIDIA GPU and NVIDIA drivers are installed. | |
--- | |
Co-authored-by: Francesco Mattioli <Francesco.mttl@gmail.com>
Co-Authored-By: Gereziher Adhane <gereziherw@gmail.com>
@ambitious-octopus we addressed the comments you made. |
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.
What do you think of this solution? I tried to follow what you wrote but made it more concise and used the ultralytics documentation standard. You can test it with mkdocs serve
. What do you think @Burhan-Q?
Also, I haven't tested with wayland. Have you already tested @Jpfonseca? With what machine?
@Jpfonseca and @ambitious-octopus a few notes in general on these additions/changes. Expand the section at the bottom of this comment to see a preview of the changes.
since it's not obvious what a user should expect to see based on what's available (or when nothing is available).
- !!! example ""
+ !!! example
|
Co-authored-by: Francesco Mattioli <Francesco.mttl@gmail.com>
Updated the guide following the suggestions by @Burhan-Q and @ambitious-octopus. Co-Authored-By: Burhan <62214284+Burhan-Q@users.noreply.github.com> Co-Authored-By: Gereziher Adhane <gereziherw@gmail.com> Co-Authored-By: Francesco Mattioli <Francesco.mttl@gmail.com>
@Burhan-Q is this PR good to merge now? |
β¦new line before code bloc
β¦erminal guide, and add more docs reference links
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.
@glenn-jocher I went ahead and made a few changes, fixes. I believe it's good to go.
- capitalize all text references to Docker
- reformat citations and links
- fix warning "Revoke access" (not rendering), now not collapsible, and new line before code block
- line spacing clean up
- Reorder sections, add sub-headers, move reference to view images in terminal guide, and add more docs reference links
- add external reference links and statement about display server setup
Also, I can't speak to the functionality of this guide and have assumed it to be correct. |
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.
Tested with x11
, everything works fine. I'm testing with wayland
, I'll confirm asap!
@ambitious-octopus Thanks, if needed, I can record it now . |
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.
It might be useful, thanks @Jpfonseca !
Here is the video as requested by @ambitious-octopus. docker_ultralytics_wayland.mp4 |
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.
Hey @Jpfonseca thanks for the video, everything seems to work correctly!
@glenn-jocher I believe it is ready to be merged now. |
@Jpfonseca @ambitious-octopus @Burhan-Q awesome, thank you all, PR merged! |
@glenn-jocher @ambitious-octopus @Burhan-Q if needed, i can also share how this can be used in a K8s Deployment in a different PR |
@Jpfonseca you never have to ask permission to open a PR π however I will only be able to provide support from the docs formatting perspective, as I have only gotten as far as learning |
This PR solves the issues identified in #882 and #4885.
In specific @gadhane and me have investigated the issues related with visualizing the GUI when running the docker image with X11 Forwarding in Ubuntu.
The issue and details are thoroughly discussed here.
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Enhancements in Docker compatibility and improved display checks in environment.
π Key Changes
libsm6
installation to the Dockerfile, essential for creating QT-based windows for object visualization.checks.py
for better compatibility and error handling related to displaying images.π― Purpose & Impact
libsm6
allows Docker environments to more easily visualize detection results, aiding in debugging and development processes.π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Enhancements to Docker setup and GUI support for Ultralytics.
π Key Changes
libsm6
for creating QT-based windows, enabling visualization in Docker containers. π³DISPLAY
environment variable presence. π οΈπ― Purpose & Impact
libsm6
and detailed guide for GUI support allows users to visualize object detection results directly, significantly improving the user experience for those working in Docker environments. πThis PR facilitates a more interactive and user-friendly approach to using Ultralytics in varied environments, making it accessible to both developers and users interested in advanced object detection without sacrificing the convenience of Docker.