Quantization handles conflicting labels incorrectly #609
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes a bug where conflicting labels are handled incorrectly.
Minimal script for reproducing bug
import MinkowskiEngine as ME
import numpy as np
#-----Dummy inputs
#(Other examples without conflicting labels, and with one point at a time behaves as expected) #Case 0: 2 pairs of redundant points, 1) with same labels 2) with different labels. #Expected behaviour: coords_aug_new = [1, 0, 0], labels_new = [11, 255], feats = [0,0,101], return_index = [0, 2], return_mapping = [0, 0, ] #Result: one ignore label, but in the wrong position. coords_aug = np.float32(np.array([
[1, 0, 0],[1, 0, 0],
[2, 0, 0], [2, 0, 0]
]))
labels = np.array([
11,11,
20,21,
])
feats = np.array([
[0, 0, 101],[0, 0, 101],
[0, 0, 101], [0, 0, 101]
])
return_args_tmp = ME.utils.sparse_quantize(
coords_aug, feats, labels=labels.astype(np.int32), ignore_label=255, return_index = True, return_inverse = True), #quantization_size=1) (coords_aug_new,feats_new,labels_new,voxel_return_index, voxel_return_mapping)=return_args_tmp[0] print("New labels: ", labels_new)
print("New coords: ", coords_aug_new)
print("Return index", voxel_return_index)
print("Return mapping", voxel_return_mapping)