File "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 831, in __call__ valid_mask = (color[3] > 0)[np.newaxis] IndexError: index 3 is out of bounds for axis 0 with size 3

It just occured to me that this could be a PyTorch incompatibility problem. Could you please guide how to fix it?

I am trying to run the demo code in this repository. I haven’t changed the code. How can I fix this error? GitHub - vchoutas/expose: ExPose - EXpressive POse and Shape rEgression

(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-02-04 16:06:35,899 - acceleratesupport - No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
Processing with R-CNN: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:01<00:00,  1.94s/it]
2021-02-04 16:06:41.101 | INFO     | __main__:main:241 - Saving results to: /home/mona/Downloads/sample_out
2021-02-04 16:06:41.105 | WARNING  | expose.models.attention.predictor:__init__:91 - Apply hand network on body: True
2021-02-04 16:06:41.105 | WARNING  | expose.models.attention.predictor:__init__:93 - Apply hand network on hands: True
2021-02-04 16:06:41.105 | WARNING  | expose.models.attention.predictor:__init__:95 - Predict hands: True
2021-02-04 16:06:41.105 | WARNING  | expose.models.attention.predictor:__init__:102 - Predict head: True
2021-02-04 16:06:41.105 | INFO     | expose.models.attention.predictor:__init__:109 - Condition hand on body: True
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:112 - Condition hand wrist pose on body: True
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:117 - Condition hand finger pose on body: True
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:121 - Condition hand shape on body shape: False
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:169 - Condition head on body: True
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:170 - Condition expression on body: True
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:172 - Condition shape on body: False
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:173 - Condition neck pose on body: False
2021-02-04 16:06:41.106 | INFO     | expose.models.attention.predictor:__init__:175 - Condition jaw pose on body: True
2021-02-04 16:06:41.718 | 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-02-04 16:06:42.066 | INFO     | expose.models.backbone.hrnet:init_weights:487 - => init weights from normal distribution
2021-02-04 16:06:42.686 | WARNING  | expose.models.backbone.hrnet:load_weights:519 - => please download pre-trained models first!
2021-02-04 16:06:42.687 | WARNING  | expose.models.backbone.hrnet:load_weights:520 - data/network_weights/hrnet/imagenet/hrnet_w48-8ef0771d.pth does not exist!
2021-02-04 16:06:42.707 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-02-04 16:06:42.707 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-02-04 16:06:42.839 | INFO     | expose.models.backbone.resnet:resnet18:113 - Loading pretrained ResNet-18
2021-02-04 16:06:42.909 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-02-04 16:06:42.909 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-02-04 16:06:42.910 | INFO     | expose.models.attention.head_predictor:__init__:81 - Building head predictor with 3 stages
2021-02-04 16:06:43.062 | INFO     | expose.models.backbone.resnet:resnet18:113 - Loading pretrained ResNet-18
2021-02-04 16:06:43.133 | INFO     | expose.models.common.networks:__init__:267 - Building iterative regressor with 3 stages
2021-02-04 16:06:43.133 | INFO     | expose.models.common.networks:__init__:282 - Detach mean: False
2021-02-04 16:06:43.135 | INFO     | expose.models.attention.predictor:__init__:490 - 2D Head crop keyps loss: KeypointLoss(Norm type: L1)
2021-02-04 16:06:43.135 | INFO     | expose.models.attention.predictor:__init__:502 - 2D Left hand crop keyps loss: KeypointLoss(Norm type: L1)
2021-02-04 16:06:43.135 | INFO     | expose.models.attention.predictor:__init__:515 - 2D Left hand crop keyps loss: KeypointLoss(Norm type: L1)
2021-02-04 16:06:43.135 | INFO     | expose.models.common.smplx_loss_modules:__init__:48 - Stages to penalize: [-1]
2021-02-04 16:06:43.136 | INFO     | expose.models.common.smplx_loss_modules:__init__:400 - Stages to regularize: [-1]
2021-02-04 16:06:43.329 | INFO     | expose.utils.checkpointer:__init__:44 - Creating directory data/checkpoints
2021-02-04 16:06:43.329 | INFO     | expose.utils.checkpointer:load_checkpoint:90 - Load pretrained: False
2021-02-04 16:06:43.329 | WARNING  | expose.utils.checkpointer:load_checkpoint:93 - Loading checkpoint from data/checkpoints/model.ckpt!
2021-02-04 16:06:43.947 | 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-02-04 16:06:43.947 | 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']
  0%|                                                                                                        | 0/2 [00:01<?, ?it/s]
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 361, in main
    hd_orig_overlays = hd_renderer(
  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 "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 831, in __call__
    valid_mask = (color[3] > 0)[np.newaxis]
IndexError: index 3 is out of bounds for axis 0 with size 3

Also, these are the list of packages I installed in my virtual environment:

(expose) mona@goku:~/research/code/expose$ pip freeze
addict==2.4.0
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.3.0
backcall==0.2.0
bleach==3.2.3
cffi==1.14.4
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
freetype-py==2.2.0
fvcore==0.1.2.post20210128
imageio==2.9.0
iopath==0.1.3
ipykernel==5.4.3
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==2.11.2
joblib==1.0.0
jsonschema==3.2.0
jupyter-client==6.1.11
jupyter-core==4.7.0
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
kiwisolver==1.3.1
loguru==0.5.3
MarkupSafe==1.1.1
matplotlib==3.3.4
mistune==0.8.4
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.1.2
nest-asyncio==1.5.1
networkx==2.5
notebook==6.2.0
numpy==1.19.5
open3d==0.12.0
opencv-python==4.5.1.48
opengles==0.0.1
packaging==20.8
pandas==1.2.1
pandocfilters==1.4.3
parso==0.8.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.1.0
plyfile==0.7.2
portalocker==2.1.0
prometheus-client==0.9.0
prompt-toolkit==3.0.14
ptyprocess==0.7.0
pycparser==2.20
pyglet==1.5.14
Pygments==2.7.4
PyOpenGL==3.1.0
pyparsing==2.4.7
pyrender==0.1.43
pyrsistent==0.17.3
python-dateutil==2.8.1
pytz==2020.5
PyYAML==5.4.1
pyzmq==22.0.2
scikit-learn==0.24.1
scipy==1.6.0
Send2Trash==1.5.0
six==1.15.0
sklearn==0.0
smplx==0.1.26
tabulate==0.8.7
termcolor==1.1.0
terminado==0.9.2
testpath==0.4.4
threadpoolctl==2.1.0
torch==1.7.1
torchgeometry==0.1.2
torchvision==0.8.2
tornado==6.1
tqdm==4.56.0
traitlets==5.0.5
trimesh==3.9.1
typing-extensions==3.7.4.3
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1
yacs==0.1.8

and

(expose) mona@goku:~/research/code/expose$ python
Python 3.8.5 (default, Jul 28 2020, 12:59:40)

This code:

File "/home/mona/research/code/expose/expose/utils/plot_utils.py", line 831, in __call__
    valid_mask = (color[3] > 0)[np.newaxis]

expects color to have 4 values, as it indexes it with 3. Based on the error message color contains only 3 values, which is why the error is raised.
I don’t know, which package plot_utils.py defines, but don’t think it’s an internal PyTorch issue.

1 Like