Let`s discuss padding and its types in convolution layers. In the convolution layer, we have kernels, and to make the final filter more informative, we use padding in the image matrix or any kind of input array. We have three types of padding:
Let`s assume the kernel is a sliding window. We have to come up with a solution to padding zeros on the input array. This is a very famous implementation, and it will be easier to show how it works with a simple example, consider x as a filter and h as an input array.
x [i] = [6, 2]
h [ i] = [1, 2, 5, 4]
Using zero padding, we can compute convolution.
You must invert the filter x, otherwise the operation will be cross-correlation. First step (now with zero padding):
= 2 * 0 + 6 * 1 = 6
= 2 * 1 + 6 * 2 = 14
= 2 * 2 + 6 * 5 = 34
= 2 * 5 + 6 * 4 = 34
= 2 * 4 + 6 * 0 = 8 p >
The result of the convolution for this case listing all the above steps will be: Y = [6 14 34 34 8]
[6 14 34 34 8]
In this type of filling, we add zero only to the left of array and up the input matrix is 2D.
Output: p >
[6 14 34 34]
In this padding type, we get a smaller output matrix as the size of the output array decreases. We only used the kernel when we had a compatible position in the h array, in some cases you want to reduce the dimension.
[14 34 34]
I remember one day, when I was about 15, my little cousin had come over. Being the good elder sister that I was, I spent time with her outside in the garden, while all the adults were inside having a ...
Grokking Deep Learning teaches you to build deep learning neural networks from scratch! In his immersive style, deep learning expert Andrew Trask shows you the hidden science so you can uncover every ...
90 SPECIFIC WAYS TO WRITE BETTER PYTHON. The Python programming language has unique strengths and charms that can be hard to grasp. Many programmers familiar with other languages often approach Pyt...
Big data is, admittedly, an overhyped buzzword used by software and hardware companies to boost their sales. Behind the hype, however, there is a real and extremely important technology trend with imp...