QUVA-Lab / e2cnn

E(2)-Equivariant CNNs Library for Pytorch
https://quva-lab.github.io/e2cnn/
Other
596 stars 75 forks source link

Learning of kernels #59

Closed danushv07 closed 1 year ago

danushv07 commented 1 year ago

Thank you for this wonderful implementation of equivariant models. I'm currently using them to investigate segmentation problems. I have a question, which I'm really cannot find a clear answer to. What is the difference between the parameters weights and filter in R2Conv? I'm confused as to how to connect the terms: if a regular square kernel is sampled on a PolarBasis, we obtain rotated versions of the filter. These are in turn used to in R2Conv. Does that mean, they are learnt directly in the back propagation phase?

Gabri95 commented 1 year ago

Hi @danushv07

I'm happy you liked our work :)

The attribute weights stores the learnable parameters while filter stores the expanded convolution filter.

In the forward pass, the learnable weights are used to construct the convolutional filters which are then used in a standard conv2d. Yes, by backpropagation, the gradient is then passed through the built filters to the learnable weights. Since the weights are updated at each iteration, the convolutional filter need to be re-generated every time during training. At test time, we only generate the filter once and store it in the filter attribute.

See also this issue https://github.com/QUVA-Lab/e2cnn/issues/2 if you are having issues with storing / loading the weights of a model.

Best, Gabriele

danushv07 commented 1 year ago

Thank you @Gabri95 for the prompt reply and the explanation. I will close the issue.