zju3dv / neuralbody

Code for "Neural Body: Implicit Neural Representations with Structured Latent Codes for Novel View Synthesis of Dynamic Humans" CVPR 2021 best paper candidate
Other
917 stars 128 forks source link

fix grid_coords in get_grid_coords #134

Closed Miles629 closed 1 year ago

Miles629 commented 1 year ago

After reviewing the source code of the F.grid_sample method in PyTorch, I believe that the code on line 57 should be modified from dhw = dhw / out_sh * 2 - 1 to dhw = dhw / (out_sh-1) * 2 - 1. The original computation can cause a slight offset in the coordinates of pts queried in F.grid_sample.

For more information about the source code, see https://github.com/pytorch/pytorch/blob/f064c5aa33483061a48994608d890b968ae53fb5/aten/src/THNN/generic/SpatialGridSamplerBilinear.c#L66-L71

I also conducted some experiments to verify whether it is necessary to divide by (shape-1) during the normalization process, and the experimental results showed that my idea was correct. You can try replacing samplepoints with vertices to query the unconvolved sparse space for verification, and I am willing to provide my validation code.

pengsida commented 1 year ago

Thank you! I agree with you. But this fix is conflicted with the pre-trained models, so I cannot merge it.