ShichenLiu / SoftRas

Project page of paper "Soft Rasterizer: A Differentiable Renderer for Image-based 3D Reasoning"
MIT License
1.2k stars 156 forks source link

example/recon/test.py bug #86

Closed mlej8 closed 3 years ago

mlej8 commented 3 years ago

Hi, I am trying to run the examples/recon/test.py file with the following command: `python examples/recon/test.py -eid recon \

-d 'data/results/models/recon/checkpoint_0200000.pth.tar`

And it fails: Traceback (most recent call last): File "examples/recon/test.py", line 122, in test() File "examples/recon/test.py", line 89, in test batch_iou, vertices, faces = model(images, voxels=voxels, task='test') File "/home/user/anaconda3/envs/softras/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/home/user/Projects/SoftRas/examples/recon/models.py", line 153, in forward return self.evaluate_iou(images, voxels) File "/home/user/Projects/SoftRas/examples/recon/models.py", line 144, in evaluate_iou voxels_predict = srf.voxelization(faces_norm, 32, False).cpu().numpy() File "/home/user/anaconda3/envs/softras/lib/python3.7/site-packages/soft_renderer-1.0.0-py3.7-linux-x86_64.egg/soft_renderer/functional/voxelization.py", line 58, in voxelization voxels = voxelize_sub3(faces, voxels) File "/home/user/anaconda3/envs/softras/lib/python3.7/site-packages/soft_renderer-1.0.0-py3.7-linux-x86_64.egg/soft_renderer/functional/voxelization.py", line 31, in voxelize_sub3 voxels, visible = voxelization_cuda.voxelize_sub3(faces, voxels, visible) RuntimeError: voxels must be contiguous

Solved this issue by adding voxels = voxels.contiguous() in the voxelization function in soft_renderer/functional/voxelization.py

ShichenLiu commented 3 years ago

Fixed, thanks!