CenterNet icon indicating copy to clipboard operation
CenterNet copied to clipboard

qt.qpa.xcb: could not connect to display

Open Ineedangoodidea opened this issue 4 years ago • 7 comments

When I run python demo.py ctdet --demo ../images/ --load_model ../models/ctdet_coco_dla_2x.pth, some error as follows:

Creating model... loaded ../models/ctdet_coco_dla_2x.pth, epoch 230 qt.qpa.xcb: could not connect to display qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/root/anaconda3/envs/CenterNet/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)

please help me, thank you.

Ineedangoodidea avatar Dec 01 '20 09:12 Ineedangoodidea

I haven't met this. Can you try re-installing opencv via pip install opencv-python?

xingyizhou avatar Dec 02 '20 02:12 xingyizhou

cd /src/lib/detectors/ctdet.py, in line 96, replace debugger.show_all_imgs(pause=self.pause) with debugger.save_all_imgs(path='/home/xxx/CenterNet/output', genID=True)

zhangmin4215 avatar Dec 03 '20 12:12 zhangmin4215

@Ineedangoodidea , did you resolve this? I am running on remote machine, and also got this display error. Reinstalling opencv-python did not fix. Edit: This the issue? https://github.com/xingyizhou/CenterNet/blob/master/src/demo.py#L29 Edit2: For images, it is in https://github.com/xingyizhou/CenterNet/blob/master/src/lib/detectors/base_detector.py#L82 Edit3: For images, it is in show_results here: https://github.com/xingyizhou/CenterNet/blob/master/src/lib/detectors/base_detector.py#L140

Solution (to save image, instead of show it):

  1. Create the directory that serves as the default destination for saved images, with mkdir $CenterNet_ROOT/src/cache/debug -p.
  2. If using ctdet, in line 96 of src/lib/detectors/ctdet.py, replace show_all_images(...) with save_all_images() <-- no arguments.

diesendruck avatar Dec 04 '20 16:12 diesendruck

For the one facing this issue: @diesendruck works just in 2nd step use debugger.save_all_imgs() not debugger.save_all_images()

hfarhidzadeh avatar Jan 28 '21 03:01 hfarhidzadeh

@Ineedangoodidea I had a similar issue lately after a fresh install of linux.

Unfortunately, none of the answers related to this same issue fixed my problem.

What seemed to fix it is

sudo apt-get install freeglut3-dev

Hope it helps

sbaio avatar Mar 11 '21 08:03 sbaio

Open your terminal just hit following command..works like charm..

$ export DISPLAY=:1.0

AbhijitManepatil avatar Jul 13 '21 10:07 AbhijitManepatil

export DISPLAY=:0.0 worked for me

ehsainit avatar Dec 16 '21 11:12 ehsainit