1

Is there a function to initialize weights of a convolutional layer to focus more on information closer to the center of input images?

All my input images are centered, so pixels further away from the center of an image matter less than pixels closer to the center.

Emile Beukes
  • 413
  • 1
  • 5
  • 7
  • 2
    Why don't you crop your images appropriately (e.g. torchvision's `CenterCrop`)? Convolution does not work like that, it is a sliding window gathering local patterns in the image. You cannot initialize kernels to give more importance to the center of an image. – Szymon Maszke Jul 03 '19 at 19:13
  • 4
    Convolutional layers are translationally invariant so no initialization scheme will achieve this. – yhenon Jul 03 '19 at 19:37

2 Answers2

1

Please see the GIFs here for a demonstration of convolutions:

https://github.com/vdumoulin/conv_arithmetic#convolution-animations

As you can see, convolutions operate the same regardless of the position in the image, so weight initialization cannot change the focus of the image.

It is also not advisable to rush into thinking about what the net will and won't need to learn your task. There are sometimes surprising amounts of signal outside what you as a human might focus on. I would suggest training the net and seeing how it performs, and then (as others have suggested) thinking about cropping.

thedch
  • 179
  • 3
0

Is there a function to initialize weights of a convolutional layer to focus more on information closer to the center of input images?

This is not possible because, initialization is there just to trigger the process of learning. Model however, is the one that can have functions, achieving the the attention.

You don't need to initialize conv. layers also because in PyTorch this is already done automatically.

prosti
  • 42,291
  • 14
  • 186
  • 151