libEGL 警告:当 API 明确选择硬件设备时,不允许强制软件渲染

libEGL 警告:当 API 明确选择硬件设备时,不允许强制软件渲染

如何修复 Ubuntu 20.04 中与 EGL 和 OpenGL 相关的以下警告和错误?我对 OpenGL 的了解非常有限,我只是运行来自 GitHub repo 的代码而没有对其进行修改。

代码位于:https://github.com/vchoutas/expose

(expose) mona@goku:~/research/code/expose$ python demo.py --image-folder ~/Downloads/sample1     --exp-cfg data/conf.yaml     --show=True     --output-folder ~/Downloads/sample_out     --save-params True     --save-vis True     --save-mesh True
INFO - 2021-01-29 16:33:41,267 - acceleratesupport - No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
Processing with R-CNN: 100%|█████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.74s/it]
2021-01-29 16:33:46.356 | INFO     | __main__:main:241 - Saving results to: /home/mona/Downloads/sample_out
2021-01-29 16:33:46.359 | WARNING  | expose.models.attention.predictor:__init__:91 - Apply hand network on body: True
2021-01-29 16:33:46.359 | WARNING  | expose.models.attention.predictor:__init__:93 - Apply hand network on hands: True
2021-01-29 16:33:46.360 | WARNING  | expose.models.attention.predictor:__init__:95 - Predict hands: True
2021-01-29 16:33:46.360 | WARNING  | expose.models.attention.predictor:__init__:102 - Predict head: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:109 - Condition hand on body: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:112 - Condition hand wrist pose on body: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:117 - Condition hand finger pose on body: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:121 - Condition hand shape on body shape: False
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:169 - Condition head on body: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:170 - Condition expression on body: True
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:172 - Condition shape on body: False
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:173 - Condition neck pose on body: False
2021-01-29 16:33:46.360 | INFO     | expose.models.attention.predictor:__init__:175 - Condition jaw pose on body: True
2021-01-29 16:33:46.987 | INFO     | expose.models.attention.predictor:__init__:252 - Body model: SMPLXLayer(
  Gender: NEUTRAL
  Number of joints: 55
  Betas: 10
  Number of PCA components: 6
  Flat hand mean: False
  Number of Expression Coefficients: 10
  (vertex_joint_selector): VertexJointSelector()
)
2021-01-29 16:33:47.343 | INFO     | expose.models.backbone.hrnet:init_weights:487 - => init weights from normal distribution
2021-01-29 16:33:47.980 | WARNING  | expose.models.backbone.hrnet:load_weights:519 - => please download pre-trained models first!
2021-01-29 16:33:47.980 | WARNING  | expose.models.backbone.hrnet:load_weights:520 - data/network_weights/hrnet/imagenet/hrnet_w48-8ef0771d.pth does not exist!
2021-01-29 16:33:48.000 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-01-29 16:33:48.001 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-01-29 16:33:48.134 | INFO     | expose.models.backbone.resnet:resnet18:113 - Loading pretrained ResNet-18
2021-01-29 16:33:48.258 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-01-29 16:33:48.258 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-01-29 16:33:48.260 | INFO     | expose.models.attention.head_predictor:__init__:81 - Building head predictor with 3 stages
2021-01-29 16:33:48.398 | INFO     | expose.models.backbone.resnet:resnet18:113 - Loading pretrained ResNet-18
2021-01-29 16:33:48.471 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-01-29 16:33:48.471 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-01-29 16:33:48.472 | INFO     | expose.models.attention.predictor:__init__:490 - 2D Head crop keyps loss: KeypointLoss(Norm type: L1)
2021-01-29 16:33:48.472 | INFO     | expose.models.attention.predictor:__init__:502 - 2D Left hand crop keyps loss: KeypointLoss(Norm type: L1)
2021-01-29 16:33:48.473 | INFO     | expose.models.attention.predictor:__init__:515 - 2D Left hand crop keyps loss: KeypointLoss(Norm type: L1)
2021-01-29 16:33:48.473 | INFO     | expose.models.common.smplx_loss_modules:__init__:48 - Stages to penalize: [-1]
2021-01-29 16:33:48.473 | INFO     | expose.models.common.smplx_loss_modules:__init__:400 - Stages to regularize: [-1]
2021-01-29 16:33:48.676 | INFO     | expose.utils.checkpointer:__init__:44 - Creating directory data/checkpoints
2021-01-29 16:33:48.676 | INFO     | expose.utils.checkpointer:load_checkpoint:90 - Load pretrained: False
2021-01-29 16:33:48.676 | WARNING  | expose.utils.checkpointer:load_checkpoint:93 - Loading checkpoint from data/checkpoints/model.ckpt!
2021-01-29 16:33:49.287 | WARNING  | expose.utils.checkpointer:load_checkpoint:121 - The following keys were not found: ['smplx.head_idxs', 'smplx.body_model.left_hand_components', 'smplx.body_model.right_hand_components', 'smplx.body_model.left_hand_mean', 'smplx.body_model.right_hand_mean', 'smplx.body_model.pose_mean', 'smplx.body_model.dynamic_lmk_bary_coords']
2021-01-29 16:33:49.287 | WARNING  | expose.utils.checkpointer:load_checkpoint:124 - The following keys were not expected: ['smplx.body_model.source_idxs', 'smplx.body_model.target_idxs', 'smplx.body_model.extra_joint_regressor', 'smplx.body_model.dynamic_lmk_b_coords', 'smplx.hand_predictor.hand_offset', 'smplx.hand_predictor.hand_model.extra_joints_idxs', 'smplx.hand_predictor.hand_model.faces_tensor', 'smplx.hand_predictor.hand_model.v_template', 'smplx.hand_predictor.hand_model.shapedirs', 'smplx.hand_predictor.hand_model.J_regressor', 'smplx.hand_predictor.hand_model.posedirs', 'smplx.hand_predictor.hand_model.parents', 'smplx.hand_predictor.hand_model.lbs_weights', 'smplx.hand_predictor.pca_decoder.pca_basis', 'smplx.hand_predictor.pca_decoder.inv_pca_basis', 'smplx.hand_predictor.pca_decoder.mean', 'smplx.head_predictor.head_offset', 'smplx.head_predictor.head_vertices_ids', 'smplx.head_predictor.head_model.faces_tensor', 'smplx.head_predictor.head_model.v_template', 'smplx.head_predictor.head_model.shapedirs', 'smplx.head_predictor.head_model.expr_dirs', 'smplx.head_predictor.head_model.J_regressor', 'smplx.head_predictor.head_model.posedirs', 'smplx.head_predictor.head_model.parents', 'smplx.head_predictor.head_model.lbs_weights', 'smplx.head_predictor.head_model.lmk_faces_idx', 'smplx.head_predictor.head_model.lmk_bary_coords', 'smplx.head_predictor.head_model.dynamic_lmk_faces_idx', 'smplx.head_predictor.head_model.dynamic_lmk_b_coords', 'smplx.head_predictor.head_model.neck_kin_chain', 'smplx.body_loss.edge_loss.gt_connections', 'smplx.body_loss.edge_loss.est_connections', 'smplx.hand_loss.edge_loss.gt_connections', 'smplx.hand_loss.edge_loss.est_connections', 'smplx.head_loss.edge_loss.gt_connections', 'smplx.head_loss.edge_loss.est_connections']
libEGL warning: DRI2: failed to create dri screen
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
libEGL warning: DRI2: failed to create dri screen
Traceback (most recent call last):
  File "demo.py", line 554, in <module>
    main(
  File "/home/mona/venv/expose/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
    return func(*args, **kwargs)
  File "demo.py", line 271, in main
    hd_renderer = HDRenderer(img_size=body_crop_size)
  File "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 735, in __init__
    super(HDRenderer, self).__init__(**kwargs)
  File "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 576, in __init__
    super(OverlayRenderer, self).__init__(faces=faces, img_size=img_size)
  File "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 418, in __init__
    self.renderer = pyrender.OffscreenRenderer(
  File "/home/mona/venv/expose/lib/python3.8/site-packages/pyrender/offscreen.py", line 31, in __init__
    self._create()
  File "/home/mona/venv/expose/lib/python3.8/site-packages/pyrender/offscreen.py", line 149, in _create
    self._platform.init_context()
  File "/home/mona/venv/expose/lib/python3.8/site-packages/pyrender/platforms/egl.py", line 177, in init_context
    assert eglInitialize(self._egl_display, major, minor)
  File "/home/mona/venv/expose/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 402, in __call__
    return self( *args, **named )
  File "/home/mona/venv/expose/lib/python3.8/site-packages/OpenGL/error.py", line 228, in glCheckError
    raise GLError(
OpenGL.error.GLError: GLError(
    err = 12289,
    baseOperation = eglInitialize,
    cArguments = (
        <OpenGL._opaque.EGLDisplay_pointer object at 0x7f7565840040>,
        c_long(0),
        c_long(0),
    ),
    result = 0
)



指向 Expose 项目的 GitHub repo 的链接:https://github.com/vchoutas/expose/issues/35

$ lsb_release -a 
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

$ nvidia-smi
Fri Jan 29 16:46:27 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.32.03    Driver Version: 460.32.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 165...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   48C    P5     9W /  N/A |   1659MiB /  3911MiB |      4%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1155      G   /usr/lib/xorg/Xorg                133MiB |
|    0   N/A  N/A      1773      G   /usr/lib/xorg/Xorg               1130MiB |
|    0   N/A  N/A      1952      G   /usr/bin/gnome-shell              103MiB |
|    0   N/A  N/A      2329      G   ...gAAAAAAAAA --shared-files      158MiB |
|    0   N/A  N/A      2735      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      2923      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3204      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3324      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3456      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3501      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3572      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A      3623      G   /usr/lib/firefox/firefox            1MiB |
|    0   N/A  N/A     21024      G   ...f_3837.log --shared-files       99MiB |
+-----------------------------------------------------------------------------+

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Nov_30_19:08:53_PST_2020
Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0

$ python
Python 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0] on linux

$ pip --version
pip 20.0.2 from /home/mona/venv/expose/lib/python3.8/site-packages/pip (python 3.8)

相关内容