Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantization handles conflicting labels incorrectly #609

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asbe
Copy link

@asbe asbe commented Nov 6, 2024

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)

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant