Wrapping convolution & edge effects of the CNN


I’m wondering how I can use CNNs in my actual work, and I have a question about the convolutions.

We have a time-sequence of data coming in from a handful (let’s say 7) of sensors, and I want to watch the patterns that evolve over, say 30 samples of these sensors. The time memory does not need to be very long – my suspicion is that even just the 30 samples or so of memory would be enough to see the patterns we’re looking for just fine.

So, I’m imagining using a CNN, and presenting the data to the CNN as a 2D array of 7 rows by 30 columns. The ‘problem’ I’m not sure is a problem or not is: what happens at the edges with the convolution?

The ‘pixels’ of data at the top and bottom are every bit as important as the pixels in the middle. However with convolutions, we have the behavior that edges are treated differently than non-edges.

Should I:

  1. simply allow the dimensions to shrink at each convolutional layer. So, it goes from 7x30 to 5x28 to 3x26? this kind of keeps the convolution ‘pure’.
  2. keep the dimensions the same, and use some padding value (as was done with the VGG images? (which causes edge effects at the last pixel)
    3.or in order to allow the top row to convolve with the bottom row, ‘wrap’ the data around, repeating the top row at the bottom (and bottom at the top) to allow the convolutional windows to properly interact at the very lowest level? By ‘properly interact’ I mean I’d ideally like the interactions between row 2 and row 3 to behave just like the interactions between row 0 and row 6, which is why I thought of wrapping the data.

On the other hand, it may be that wrapping the data is just unncessary becase the CNN just works it out anywyay.

Any thoughts?


You can add lots of padding - see the papers about SparseConvnet by Ben Graham for in depth discussion of this (he won the CIFAR10 competition, where this is a huge issue since the images are only 32x32).

Also look into diliated (or ‘atrous’) convolutions - there’s a good picture here: https://github.com/paarthneekhara/byteNet-tensorflow .

But first, try a simple CNN with normal padding (i.e. mode=“full”)

Thanks Jeremy. It’s gonna take a little time to digest the bytenet paper. At a brief glance, it looks to be really clearly written.

Thanks again,