NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.47k stars 367 forks source link

Quantization method unweighted average returns NaN's #442

Open maxim0815 opened 2 years ago

maxim0815 commented 2 years ago

Describe the bug

NaN's appear after some time.


To Reproduce

I'm using the following to generate the sparse tensor out of some point cloud:

pts = x[:,:3]
feat = x [:,3:] / 255
in_field = ME.TensorField(
    features=feat,
    coordinates=ME.utils.batched_coordinates([pts / self.voxel_size], dtype=torch.float32),
    quantization_mode=ME.SparseTensorQuantizationMode.UNWEIGHTED_AVERAGE,
    minkowski_algorithm=ME.MinkowskiAlgorithm.SPEED_OPTIMIZED,
    device=self.device,
)
x = in_field.sparse()

Afterwards, I'm using the model for doing semantic predictions:

class MinkUNet34C(MinkUNet34):
    PLANES = (32, 64, 128, 256, 256, 128, 96, 96)

After some training steps the model returns NaN values.

Replacing: ME.SparseTensorQuantizationMode.UNWEIGHTED_AVERAGE with ME.SparseTensorQuantizationMode.RANDOM_SUBSAMPLE

Like in issue #273 resolves the problem. Nevertheless, I would be interested to know if it is really due to the QuantizationMode and why it does not appear from the beginning on. Or am I misunderstanding something else?


Expected behavior

Both QuantizationMode's should return values.


Desktop (please complete the following information):


Additional context

Thanks for sharing and supporting the code with the community. This project is really good.