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

Using -1 to represent background causes error #20

Open
LambdaGuard opened this issue Jan 21, 2024 · 0 comments
Open

Using -1 to represent background causes error #20

LambdaGuard opened this issue Jan 21, 2024 · 0 comments

Comments

@LambdaGuard
Copy link

num_pts_per_inst_src = pts_instance_mask_one_hot.sum(axis=0)
pts_instance_mask = torch.cat((torch.tensor(input_dict['pts_instance_mask'][new_idxs]), inst_idxs))
idxs_sum = (pts_instance_mask == -1).sum()
pts_instance_mask[pts_instance_mask == -1] = torch.max(pts_instance_mask) + 1
pts_instance_mask_one_hot = torch.nn.functional.one_hot(pts_instance_mask)
if idxs_sum > 0:
pts_instance_mask_one_hot = pts_instance_mask_one_hot[:, :-1]
pts_instance_mask_one_hot = pts_instance_mask_one_hot[:-len(inst_idxs), :]
num_pts_per_inst = pts_instance_mask_one_hot.sum(axis=0)
good_insts = num_pts_per_inst / num_pts_per_inst_src > self.remaining_points_thr

Here, if one uses -1 to represent background, the calculation of good_insts will raises error for the shapes of these two tensors does not fit. This is because pts_instance_mask_one_hot is cut in line 531 and 'num_pts_per_inst' will have an extra element.

The solution is to move line 524 to 532, after 'if'.

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

No branches or pull requests

1 participant