I am trying to run the render_densepose.ipynb, but the error occured at below cell:
# create our verts_uv values
verts_uv = torch.cat([U_norm[None],V_norm[None]], dim=2) # (1, 7829, 2)
# There are 6890 xyz vertex coordinates but 7829 vertex uv coordinates.
# This is because the same vertex can be shared by multiple faces where each face may correspond to a different body part.
# Therefore when initializing the Meshes class,
# we need to map each of the vertices referenced by the DensePose faces (in verts, which is the "All_vertices" field)
# to the correct xyz coordinate in the SMPL template mesh.
v_template_extended = v_template[verts -1][None] # (1, 7829, 3)
IndexError Traceback (most recent call last)
Cell In[82], line 82 verts_uv = torch.cat([U_norm[None],V_norm[None]], dim=2) # (1, 7829, 2)
3 # There are 6890 xyz vertex coordinates but 7829 vertex uv coordinates.
4 # This is because the same vertex can be shared by multiple faces where each face may correspond to a different body part. 5 # Therefore when initializing the Meshes class,
6 # we need to map each of the vertices referenced by the DensePose faces (in verts, which is the "All_vertices" field)
7 # to the correct xyz coordinate in the SMPL template mesh.
----> 8 v_template_extended = v_template[verts -1][None] # (1, 7829, 3)
IndexError: tensors used as indices must be long, byte or bool tensors
Then I modified it to remove this error:
v_template_extended = v_template[verts.long() -1][None] # (1, 7829, 3)
However, it have same problem in renderer(mesh) line:
File c:\Users\ABC\anaconda3\envs\torch110\lib\site-packages\torch\nn\modules\module.py:1102, in Module._call_impl(self, *input, *kwargs)
1098 # If we don't have any hooks, we want to skip the rest of the logic in
1099 # this function, and just call forward.
1100 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
1101 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1102 return forward_call(input, **kwargs)
1103 # Do not call functions when jit is used
1104 full_backward_hooks, non_full_backward_hooks = [], []
File c:\Users\ABC\anaconda3\envs\torch110\lib\site-packages\pytorch3d\renderer\mesh\renderer.py:62, in MeshRenderer.forward(self, meshes_world, kwargs)
49 """
50 Render a batch of images from a batch of meshes by rasterizing and then
51 shading.
(...)
59 For this set rasterizer.raster_settings.clip_barycentric_coords=True
60 """
61 fragments = self.rasterizer(meshes_world, kwargs)
---> 62 images = self.shader(fragments, meshes_world, **kwargs)
...
991 ]
992 faces_verts_uvs = torch.cat(packing_list)
993 texture_maps = self.maps_padded()
IndexError: tensors used as indices must be long, byte or bool tensors
Dear Pytorch3D,
I am trying to run the render_densepose.ipynb, but the error occured at below cell:
Then I modified it to remove this error:
v_template_extended = v_template[verts.long() -1][None] # (1, 7829, 3)
However, it have same problem in renderer(mesh) line:
How can I fix that? Thank you so much!