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

Miss point in MinkowskiConvolution #615

Open
zb12138 opened this issue Feb 28, 2025 · 1 comment
Open

Miss point in MinkowskiConvolution #615

zb12138 opened this issue Feb 28, 2025 · 1 comment

Comments

@zb12138
Copy link

zb12138 commented Feb 28, 2025

dimension = 2
kernel_size = 3
stride= 3
out_channels = kernel_size**dimension
conv0_1 = ME.MinkowskiConvolution(
in_channels=1,
out_channels=out_channels,
kernel_size= kernel_size,
stride=stride,
bias=False,
dimension=dimension
)
conv0_1.kernel.data = torch.eye(kernel_size**dimension,out_channels).unsqueeze(1) 
coords =np.array([[0,0],[1,1],[5,5],[0,3]])
feat =np.array([[1],[10],[100],[1000]])
a,b=ME.utils.sparse_collate([coords],[feat]) 
A = ME.SparseTensor(features=b.float(), coordinates=a)
C = conv0_1(A)
map = A.coordinate_manager.kernel_map(A.coordinate_map_key,C.coordinate_map_key,kernel_size=kernel_size,stride=stride).items()
print(map)
print(C.F)

output:

dict_items([(8, tensor([[1],
        [2]], dtype=torch.int32)), (4, tensor([[3, 0],
        [0, 2]], dtype=torch.int32))]) # [kernelID, [[Aid],[Cid]] ]
tensor([[   0.,    0.,    0.,    0., 1000.,    0.,    0.,    0.,    0.],
        [   0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.,    0.], # miss 100
        [   0.,    0.,    0.,    0.,    1.,    0.,    0.,    0.,   10.]],
       grad_fn=<MinkowskiConvolutionFunctionBackward>) 

expect there is 100 (point 2, coord 5,5) in C.F and map

Image

@zb12138
Copy link
Author

zb12138 commented Feb 28, 2025

The coords of C has [3,3] but not [6,6]. I think it is better to use round rather than floor to calculate the coords of output, so that it will has coord round([5,5]/3)*3 = [6,6]

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