The Need
Hello, I am experimenting the usage of CNNs on images which come from a cylindric domain, so I am interested to apply the Convolution layer in a circular (or cyclic) way. I mean a convolution layer that instead of padding the image with zeros would just wrap around the image (or the kernel around the image).
Thoughts, Searches and Ideas
Coming from a signal processing background I expected it were already covered: in fact when calculations are performed in the frequency domain (i.e. by means of DFT) this circularity comes from free, and rather extra effort (there called "zero padding") is required to avoid circular equivocation.
Well, ok: I learned that, because of kernel size being normally quite small, calculations can be done more conveniently in the base domain. I can't figure out any good reason why this should be unfeasible, so I hoped that some direct way to do a cyclic convolution existed.
But I found no coverage for this function, neither in Keras nor in TensorFlow docs. Moreover, I found little or no really relevant discussion about this around: Torch7 discussion
So I am left with the following options:
- implement my own
CyclicConv2D
layer by subclassing Keras'layer.Layer
class, as described here - submit my own pull request for an experimental new feature, as described here. Shortly, I would think of adding some "wrap" value for the "padding=" parameter, or adding a new "wrap=" parameter. It should specify along which axes the image should wrap around. This in fact would likely be needed only along one dimension, the circular one, not both.
The Questions
Is there any more straightforward option, or source of information that I should address first?
Otherwise, where can I find any advice how to implement the former?
For the latter I must admit that I described it more to stimulate some collective thinking how it should be implemented from a user standpoint, but I don't really feel able to contribute a good pull request (i.e. one including good code). Anyway I will appreciate any advice where to start from.