KPConv-PyTorch icon indicating copy to clipboard operation
KPConv-PyTorch copied to clipboard

Initialization of kernel points in KPConv

Open josafatburmeister opened this issue 2 years ago • 2 comments

Hello @HuguesTHOMAS,

thank you for providing a PyTorch implementation of KPConv. When comparing the PyTorch implementation with the Tensorflow implementation, I noticed the following difference in the initialization of kernel points:

In the Tensorflow implementation, the kernel is rescaled so that the average distance between the center point and surrounding points is $1.5 \sigma$ as described in your paper.

In the PyTorch implementation, the convolution radius (which is $2.5 \sigma$ per default) is used as the scaling factor instead.

Is there any particular reason for this? I would expect the first approach to work better (at least for the rigid convolution) since the kernel points in this case cover a larger range of the kernel radius.

Thank you, Josafat

josafatburmeister avatar Jun 23 '22 13:06 josafatburmeister

Hi,

In the Pytorch implementation, I added another level of customization, where you can choose both KP_extent (or $\sigma$) and the convolution radius. In TensorFlow, the ratio between both was fixed to 1.5, which seems a reasonable value, but maybe other ratios would be interesting to test to.

So in Tensorflow, I had

        # Starting radius of convolutions
        r_normal = config.first_subsampling_dl * config.KP_extent * 2.5

which was hard coded. So the radius of the convolution was 2.5, while the distance between center point and the other was 1.5. And the influence distance of each kernel point was also 1.5.

Now in PyTorch, the convolution radius can be changed (2.5 is still the default). The distance between the center point and the other is fixed to 66% of the convolution radius (so around 1.66 if radius is 2.5). But the big change is that now, the KP_extend value can be modified, without changing this convolution size, and we can experiment with larger or smaller influence area of each kernel point.

I would expect the first approach to work better (at least for the rigid convolution) since the kernel points in this case cover a larger range of the kernel radius.

This is not true, because both are very similar, the only slight difference is the placement of the kernel points in the convolution sphere which is at 3/5 of the radius in Tensorflow, and 2/3 in Pytorch. Other than that, with standard parameters, everything is the same

HuguesTHOMAS avatar Jun 27 '22 13:06 HuguesTHOMAS

Hi, thank you very much for the clarification! I had overlooked the line where the kernel points are rescaled in the PyTorch version. Now I understand how the kernel initialization works in PyTorch.

josafatburmeister avatar Jun 27 '22 15:06 josafatburmeister