Closed mhaeming closed 8 months ago
The texture_image supplied to TexturesUV should be shape [B=1,H,W,C]. read_image from torchvision gives you [C,H,W] so you need to permute it.
Thanks a lot, that was the problem! Now I'm experiencing the same weird behavior as mentioned in #1601. But I think this issue can be closed.
Hello @mhaeming, you can have a look at the SMPLitex repository on how to render textures SMPL meshes with PyTorch3D. I have it implemented here:
I'm trying to render a textured SMPL bodymodel using pytorch3d. The texture is taken from the SMPLitex repository, the mesh is the official "smpl_uv.obj" from https://smpl.is.tue.mpg.de/.
The size mismatch occurs when the renderer calls https://github.com/facebookresearch/pytorch3d/blob/7566530669203769783c94024c25a39e1744e4ed/pytorch3d/renderer/mesh/shading.py#L96
Throwing a
RuntimeError: The size of tensor a (3) must match the size of tensor b (4096) at non-singleton dimension 4
,where 4096 is the width and height of the texture.
Am I overlooking a preprocessing step during
TextureUV
? The issue does not arise when using aTexturesVertex
as in the commented out line. I would appreciate any idea what might be going wrong here. Thanks in advance!