Closed RaresAmbrus closed 3 years ago
Hi @RaresAmbrus,
Do you have a more descriptive error log? You don't need to trim the interior triangles of your mesh for NGLOD to work, it just helps a bit since the SDF to learn becomes "simpler". You can just return mesh.contiguous()
in that function and the code should normalize properly. AFAIK, the Armadillo mesh is already a 2-manifold so compute_trimmesh()
should return a dense vector of True
in that case (i.e. no triangles are removed).
Hope this helps, Joey
Thanks @joeylitalien for the quick response! This is the error I get when running the original code:
Traceback (most recent call last):
File "app/main.py", line 62, in <module>
model = Trainer(args, args_str, 'mesh')
File "/workspace/nglod/sdf-net/lib/trainer.py", line 122, in __init__
self.set_dataset()
File "/workspace/nglod/sdf-net/lib/trainer.py", line 161, in set_dataset
self.train_dataset = globals()[self.args.mesh_dataset](self.args)
File "/workspace/nglod/sdf-net/lib/datasets/MeshDataset.py", line 71, in __init__
self.ids, self.p, self.d, self.nrm = self._sample()
File "/workspace/nglod/sdf-net/lib/datasets/MeshDataset.py", line 81, in _sample
pts = point_sample(self.mesh, self.sample_mode, self.num_samples)
File "/workspace/nglod/sdf-net/lib/torchgp/point_sample.py", line 39, in point_sample
distrib = area_weighted_distribution(mesh)
File "/workspace/nglod/sdf-net/lib/torchgp/area_weighted_distribution.py", line 40, in area_weighted_distribution
return torch.distributions.Categorical(areas.view(-1))
File "/usr/local/lib/python3.6/dist-packages/torch/distributions/categorical.py", line 64, in __init__
super(Categorical, self).__init__(batch_shape, validate_args=validate_args)
File "/usr/local/lib/python3.6/dist-packages/torch/distributions/distribution.py", line 53, in __init__
raise ValueError("The parameter {} has invalid values".format(param))
ValueError: The parameter probs has invalid values
For some reason all the triangles are removed and data/armadillo_normalized.obj
is just an empty file. Maybe just a local issue with my setup.
Returning directly mesh.contiguous()
as you suggested seems to work - it's training now! Maybe as a follow-up, I'm getting very low losses:
[27/07 20:38:39] [INFO] Loaded mesh dataset
[27/07 20:38:39] [INFO] Total number of parameters: 10146213
[27/07 20:38:39] [INFO] Model configured and ready to go
[27/07 20:38:54] [INFO] EPOCH 1/251 | total loss: 6.702E-03 | l2 loss: 1.071E-03
[27/07 20:38:54] [INFO] Saving model checkpoint to: _results/models/armadillo.pth
[27/07 20:39:15] [INFO] EPOCH 2/251 | total loss: 5.059E-04 | l2 loss: 7.187E-05
[27/07 20:39:15] [INFO] Saving model checkpoint to: _results/models/armadillo.pth
Does that look good? Thanks again for the help!
Yes, these types of losses are typical. Honestly I wouldn't worry too much about the interior triangle trimming; in practice it does little to no difference if you have a high quality mesh.
Ok great, thanks again @joeylitalien!
Hi, thank you for releasing the code! I've been looking into replicating your results, however, I'm running into an issue when preprocessing the input mesh and specifically while running the trimmesh operation here (it returns only False elements).
I'm using the armadillo mesh as input and running pytorch 1.8, CUDA 11.1, and as far as I can tell I managed to build all the extensions successfully. Have you seen this before? And would it be possible to upload the "normalized" version of the mesh so I can check if the rest of the pipeline works? Thanks a lot for the help and for your work!