jiupinjia / stylized-neural-painting

Official Pytorch implementation of the preprint paper "Stylized Neural Painting", in CVPR 2021.
https://jiupinjia.github.io/neuralpainter/
Creative Commons Zero v1.0 Universal
1.57k stars 262 forks source link

Unable run demo on remote machine without desktop environment #2

Closed zerollzeng closed 3 years ago

zerollzeng commented 3 years ago

Hi @jiupinjia, good job! the result of your repo seems fantastic! I try to run your demo on my remote GPU server which doesn't have a desktop environment(no x11 installed). and get the following error

initialize network with normal
loading renderer from pre-trained checkpoint...
begin to draw...
iteration step 0, G_loss: 0.00000, step_psnr: 3.38946, strokes: 25 / 500
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/shir/miniconda3/envs/tf1.15/lib/python3.6/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)

Is there any way to solve this problem?

jiupinjia commented 3 years ago

Hi, thanks for your valuable feedback! Since you are running on a remote machine, I believe the problem is in the image display during the runtime. Can you try "ctrl + f" and remove all the "cv2.imshow" code lines in the painter.py? Please tell me whether it works fine. Thank you!

zerollzeng commented 3 years ago

Thanks for your fast response. I comment all lines contain cv2.imshow and cv2.waitkey in painter.py, now I can run normally and get the correct output. it might be a good idea to comment these functions by default since most people doing research or development on the remote server, Already created a PR to your repo, you may merge to the main branch if it's helpful.

Stocastico commented 3 years ago

Maybe it's better to add a parameter show_output which, when set to true, displays the images, instead of just switching off image display functionality?

jiupinjia commented 3 years ago

Yes, I will be adding a parameter in the config file to control the displays. Thank Stocastico for the suggestion.

jiupinjia commented 3 years ago

Yes, I will be adding a parameter in the config file to control the displays. Thank Stocastico for the suggestion.

Sorry, no config file here... I mixed up this project with another one. This parameter will be added to the arg parser.

jiupinjia commented 3 years ago

Hi @zerollzeng and @Stocastico, the above feature has been added. Please check "Running through SSH" in the README file for details. I'm closing this issue. Please feel free the reach out to me if you have further questions. Thanks again for your valuable feedback.

Stocastico commented 3 years ago

Thank you for the quick fix! I will check and let you know if I spot any issues :-)