I used MinkownskiConvolution with a stride of 2 and kernel size 7. My input is a 2D image where every 3rd pixel is zeroed out. The input size is [224, 224] and sparsity looks something as follows:
4 4 0 6
4 4 0 6
0 0 0 0
6 6 0 9 ..
...
I am not sure what is happening here. In my understanding, if the kernel center is non-active element, no computation is performed, and zeros are fitted between elements/pixels. But here it seems that some of the elements (e.g. in first row of the returned matrix 4 4 0 6, second 4 is returned when 0 is centre in first row of original matrix i.e. [1 0 {0} 1] ). Kindly let me know what is going on here.
To Reproduce
a = torch.zeros((224,224))
a = torch.unsqueeze(a,0).unsqueeze(0).to(0)
a[:, :,::3,::3] = 1
with torch.no_grad():
me_dwconv.kernel[:] = torch.ones((49)).unsqueeze(1).unsqueeze(2).to(0)
forward analytic test
output = me_dwconv(input)
out = output.dense()[0]
print(out[0,0,0:4,0:4])
Expected behavior
A clear and concise description of what you expected to happen.
4 0 0 6
0 0 0 0
0 0 0 0
6 0 0 9
Python version: [e.g. 3.8.18]
==========System==========
Linux-6.2.0-39-generic-x86_64-with-glibc2.17
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"
3.8.18 (default, Sep 11 2023, 13:40:15)
[GCC 11.2.0]
==========Pytorch==========
1.8.0+cu111
torch.cuda.is_available(): True
==========NVIDIA-SMI==========
/usr/bin/nvidia-smi
Driver Version 535.129.03
CUDA Version 12.2
VBIOS Version 95.02.18.80.55
Image Version G002.0000.00.03
GSP Firmware Version N/A
==========NVCC==========
/usr/bin/nvcc
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
==========CC==========
/usr/bin/c++
c++ (Ubuntu 10.5.0-1ubuntu1~22.04) 10.5.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
==========MinkowskiEngine==========
0.5.4
MinkowskiEngine compiled with CUDA Support: True
NVCC version MinkowskiEngine is compiled: 11050
CUDART version MinkowskiEngine is compiled: 11050
Additional context
Add any other context about the problem here.
I used MinkownskiConvolution with a stride of 2 and kernel size 7. My input is a 2D image where every 3rd pixel is zeroed out. The input size is [224, 224] and sparsity looks something as follows:
1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 . . I was expecting the output to be:
4 0 0 6 0 0 0 0 0 0 0 0 6 0 0 9 .. ...
But the output is :
4 4 0 6 4 4 0 6 0 0 0 0 6 6 0 9 .. ... I am not sure what is happening here. In my understanding, if the kernel center is non-active element, no computation is performed, and zeros are fitted between elements/pixels. But here it seems that some of the elements (e.g. in first row of the returned matrix 4 4 0 6, second 4 is returned when 0 is centre in first row of original matrix i.e. [1 0 {0} 1] ). Kindly let me know what is going on here.
To Reproduce
a = torch.zeros((224,224)) a = torch.unsqueeze(a,0).unsqueeze(0).to(0) a[:, :,::3,::3] = 1
input = to_sparse(a) me_dwconv = MinkowskiConvolution( in_channels, out_channels, kernel_size=7, stride=2, bias=False, dimension=D ).to(0)
with torch.no_grad(): me_dwconv.kernel[:] = torch.ones((49)).unsqueeze(1).unsqueeze(2).to(0)
forward analytic test
output = me_dwconv(input)
out = output.dense()[0] print(out[0,0,0:4,0:4])
Expected behavior A clear and concise description of what you expected to happen.
4 0 0 6 0 0 0 0 0 0 0 0 6 0 0 9
==========MinkowskiEngine========== 0.5.4 MinkowskiEngine compiled with CUDA Support: True NVCC version MinkowskiEngine is compiled: 11050 CUDART version MinkowskiEngine is compiled: 11050
Additional context Add any other context about the problem here.