pytorch3d
pytorch3d copied to clipboard
PointClouds2Volumes got '_LinAlgError: linalg.inv:' error when setting grid_size = [440 500 1]
Hi, I try seting grid_size = [440 500 1] and get an error, it seems that bugs exist when performing 2D voxelization.
_LinAlgError Traceback (most recent call last)
Cell In[15], [line 16](vscode-notebook-cell:?execution_count=15&line=16)
[8](vscode-notebook-cell:?execution_count=15&line=8) initial_volumes = Volumes(
[9](vscode-notebook-cell:?execution_count=15&line=9) features = torch.zeros(1, 3, grid_size[0], grid_size[1], grid_size[2]),
[10](vscode-notebook-cell:?execution_count=15&line=10) densities = torch.zeros(1, 1, grid_size[0], grid_size[1], grid_size[2]),
[11](vscode-notebook-cell:?execution_count=15&line=11) volume_translation = [0.0, 0.0, 0.0],
[12](vscode-notebook-cell:?execution_count=15&line=12) voxel_size = VOXEL_SIZE.tolist(),
[13](vscode-notebook-cell:?execution_count=15&line=13) )
[14](vscode-notebook-cell:?execution_count=15&line=14) # add the pointcloud to the 'initial_volumes' buffer using
[15](vscode-notebook-cell:?execution_count=15&line=15) # trilinear splatting
---> [16](vscode-notebook-cell:?execution_count=15&line=16) updated_volumes = add_pointclouds_to_volumes(
[17](vscode-notebook-cell:?execution_count=15&line=17) pointclouds=pointclouds,
[18](vscode-notebook-cell:?execution_count=15&line=18) initial_volumes=initial_volumes,
[19](vscode-notebook-cell:?execution_count=15&line=19) mode="nearest",
[20](vscode-notebook-cell:?execution_count=15&line=20) )
File [d:\anaconda3\envs\env_beampy_torch\lib\site-packages\pytorch3d\ops\points_to_volumes.py:282](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:282), in add_pointclouds_to_volumes(pointclouds, initial_volumes, mode, min_weight, rescale_features, _python)
[279](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:279) mask = (mask[None, :] < n_per_pcl[:, None]).type_as(mask)
[281](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:281) # convert to the coord frame of the volume
--> [282](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:282) pcl_3d_local = initial_volumes.world_to_local_coords(pcl_3d)
[284](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:284) features_new, densities_new = add_points_features_to_volume_densities_features(
[285](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:285) points_3d=pcl_3d_local,
[286](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/ops/points_to_volumes.py:286) points_features=pcl_feats,
(...)
...
[294](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/transforms/transform3d.py:294) Return the inverse of self._matrix.
[295](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/transforms/transform3d.py:295) """
--> [296](file:///D:/anaconda3/envs/env_beampy_torch/lib/site-packages/pytorch3d/transforms/transform3d.py:296) return torch.inverse(self._matrix)
_LinAlgError: linalg.inv: (Batch element 0): The diagonal element 1 is zero, the inversion could not be completed because the input matrix is singular.