NVlabs / FoundationPose

[CVPR 2024 Highlight] FoundationPose: Unified 6D Pose Estimation and Tracking of Novel Objects
https://nvlabs.github.io/FoundationPose/
Other
1.01k stars 112 forks source link

QT could not connect to display inside Docker container #38

Closed Nikhil-Shenoy closed 1 month ago

Nikhil-Shenoy commented 1 month ago

Hi, I've set up the docker container and am now trying to run the run_demo.py example, but I'm getting the following error:

qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/opt/conda/envs/my/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb.

Aborted (core dumped)

I've tried setting export DISPLAY=0 and re-running, but I'm still getting the error about xcb not being loaded and the application getting aborted. What is the fix for this?

savidini commented 1 month ago

Hi @Nikhil-Shenoy,

I assume you maybe are running on a remote machine without x11 forwarding, can you try running the demo with the debug argument set to 0 instead?

python run_demo.py --debug 0

Let me know if this helps.

Nikhil-Shenoy commented 1 month ago

Yes, I'm on SSH'd on a remote system. I did set the flag as you showed, and the script does run to completion, but I don't get any result in the debug directory afterwards.

imerino95 commented 1 month ago

Same problem here.

I quick fixed commenting lines 72-73 from run_demo.py

      # cv2.imshow('1', vis[...,::-1])
      # cv2.waitKey(1)
savidini commented 1 month ago

Hi @Nikhil-Shenoy,

if debug is set to 0, only the predicted poses will be saved in the ob_in_cam folder.

If you want images, do what @imerino95 has already mentioned. This will prevent the script from trying to create a window to show the predictions (same as like setting debug to 0). Now you can run the demo again with debug set to 2:

python run_demo.py --debug 2

This will save all visualization images to the track_vis folder, which you can then copy from the remote to your local machine.

wenbowen123 commented 1 month ago

if you are using a headless server, you cannot visualize. Also see above answers.

Nikhil-Shenoy commented 1 month ago

Yes, disabling the imshows worked. Thanks!