- 输出错误信息
- 试错过程
- 解决方法
- 参考链接
(mmlab) xxx@xxx-Desktop:~/HardDisk/Codes/code_deeplearning/mmdetection$ python demo/image_demo.py \
> /home/zth/HardDisk/Datasets/weld/weldRGB615/test/110_0.png \
> configs/_my_configs/weld/mask_rcnn_r50_fpn_1x_weld.py exps/exp1/latest.pth \
> --out-file /home/zth/HardDisk/Datasets/weld/weldRGB615/output
load checkpoint from local path: exps/exp1/latest.pth
/home/zth/HardDisk/Codes/code_deeplearning/mmdetection/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file.
warnings.warn(
QObject::moveToThread: Current thread (0x559ea130dea0) is not the object's thread (0x559ea4a93ae0).
Cannot move to target thread (0x559ea130dea0)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/anaconda3/envs/mmlab/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, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
Aborted (core dumped)
试错过程
终端执行以设置环境变量,会输出更多QT相关信息:
export QT_DEBUG_PLUGINS=1
此时输出信息的最后一部分如下,与很多博客提到的缺失库文件并不相同:
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/usr/local/anaconda3/envs/mmlab/bin/platforms" ...
loaded library "/usr/local/anaconda3/envs/mmlab/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"
QObject::moveToThread: Current thread (0x555d31a08260) is not the object's thread (0x555d31de0840).
Cannot move to target thread (0x555d31a08260)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/anaconda3/envs/mmlab/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, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
Aborted (core dumped)
解决方法
此时我的 opencv-python 版本是 4.5.5.64,降低版本即可解决我的问题。
from versions: 3.4.0.14, 3.4.8.29, 3.4.9.31, 3.4.9.33, 3.4.10.35, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.14.51, 3.4.14.53, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 4.1.2.30, 4.2.0.32, 4.2.0.34, 4.3.0.36, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.2.52, 4.5.2.54, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64)
pip install opencv-python==4.2.0.34
参考链接
[1] 【有效】解决方案:QObject::moveToThread: Current thread (***) is not the object‘s thread
[2] 【无效】PyQt5:解决qt.qpa.plugin: Could not load the Qt platform plugin "xcb"错误
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)