kaolin icon indicating copy to clipboard operation
kaolin copied to clipboard

The parameter probs has invalid values

Open River-Zhang opened this issue 3 years ago • 1 comments

I was using dmtet_tutoria.ipynb and changed the point cloud data to my own 3D point data. I changed the scale accordingly but after the 0 th iteration I got the error.

      8 mesh_verts, mesh_faces = kaolin.ops.conversions.marching_tetrahedra(verts_deformed.unsqueeze(0), tets, sdf.unsqueeze(0)) # running MT (batched) to extract surface mesh
      9 mesh_verts, mesh_faces = mesh_verts[0], mesh_faces[0]
---> 11 loss = loss_f(mesh_verts, mesh_faces, points, it)
     12 optimizer.zero_grad()
     13 loss.backward()

Cell In [25], line 25, in loss_f(mesh_verts, mesh_faces, points, it)
     24 def loss_f(mesh_verts, mesh_faces, points, it):
---> 25     pred_points = kaolin.ops.mesh.sample_points(mesh_verts.unsqueeze(0), mesh_faces, 50000)[0][0]
     26     chamfer = kaolin.metrics.pointcloud.chamfer_distance(pred_points.unsqueeze(0), points.unsqueeze(0)).mean()
     27     if it > iterations//2:

File ~/miniconda3/envs/iconfinal/lib/python3.8/site-packages/kaolin/ops/mesh/trianglemesh.py:215, in sample_points(vertices, faces, num_samples, areas, face_features)
    213 if areas is None:
    214     areas = _base_face_areas(face_v_0, face_v_1, face_v_2).squeeze(-1)
--> 215 face_dist = torch.distributions.Categorical(areas)
    216 face_choices = face_dist.sample([num_samples]).transpose(0, 1)
    217 _face_choices = face_choices.unsqueeze(-1).repeat(1, 1, 3)

File ~/miniconda3/envs/iconfinal/lib/python3.8/site-packages/torch/distributions/categorical.py:64, in Categorical.__init__(self, probs, logits, validate_args)
     62 self._num_events = self._param.size()[-1]
     63 batch_shape = self._param.size()[:-1] if self._param.ndimension() > 1 else torch.Size()
...
     52         if not constraint.check(getattr(self, param)).all():
---> 53             raise ValueError("The parameter {} has invalid values".format(param))
     54 super(Distribution, self).__init__()

ValueError: The parameter probs has invalid values

I found that the return of marching_tetrahedra is a tensor([ ]) of shape [0,3] which means nothing.
Can anybody help me?

River-Zhang avatar Oct 06 '22 05:10 River-Zhang

Hi @River-Zhang can you please provide the inputs that would raise this error?

Caenorst avatar Oct 21 '22 15:10 Caenorst

Closing inactive bug.

shumash avatar Jul 19 '24 19:07 shumash