Example of Convolution Operation
Specifications
- Input Neuron (image): a 5×5 matrix
- Kernel (Filter): a 3×3 matrix
- Stride: 2 (the kernel moves 2 steps at a time)
- Padding: 0 (no extra border of zeros around the input)
Step by Step
Input Matrix
Kernel Matrix
Stride
The kernel moves 2 steps horizontally or vertically at each step.
Padding
Since padding = 0, the output size is determined as:
Output Size = [(Input Size - Kernel Size) / Stride] + 1 = [(5 - 3) / 2] + 1 = 2
So the output is a 2×2 matrix.
Convolution Steps
Region 1 (Top-left corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Region 2 (Top-right corner)
Selected input region:
Computation:
(3×1)+(0×0)+(1×-1)+(2×1)+(3×0)+(0×-1)+(1×1)+(2×0)+(3×-1) = 3 + 0 - 1 + 2 + 0 + 0 + 1 + 0 - 3 = 2
Region 3 (Bottom-left corner)
Selected input region:
Computation:
(1×1)+(0×0)+(1×-1)+(2×1)+(1×0)+(0×-1)+(3×1)+(2×0)+(1×-1) = 1 + 0 - 1 + 2 + 0 + 0 + 3 + 0 - 1 = 4
Region 4 (Bottom-right corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Output (Feature Map)
Example of Convolution Operation
Specifications
- Input Neuron (image): a 5×5 matrix
- Kernel (Filter): a 3×3 matrix
- Stride: 2 (the kernel moves 2 steps at a time)
- Padding: 0 (no extra border of zeros around the input)
Step by Step
Input Matrix
Kernel Matrix
Stride
The kernel moves 2 steps horizontally or vertically at each step.
Padding
Since padding = 0, the output size is determined as:
Output Size = [(Input Size - Kernel Size) / Stride] + 1 = [(5 - 3) / 2] + 1 = 2
So the output is a 2×2 matrix.
Convolution Steps
Region 1 (Top-left corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Region 2 (Top-right corner)
Selected input region:
Computation:
(3×1)+(0×0)+(1×-1)+(2×1)+(3×0)+(0×-1)+(1×1)+(2×0)+(3×-1) = 3 + 0 - 1 + 2 + 0 + 0 + 1 + 0 - 3 = 2
Region 3 (Bottom-left corner)
Selected input region:
Computation:
(1×1)+(0×0)+(1×-1)+(2×1)+(1×0)+(0×-1)+(3×1)+(2×0)+(1×-1) = 1 + 0 - 1 + 2 + 0 + 0 + 3 + 0 - 1 = 4
Region 4 (Bottom-right corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Output (Feature Map)
Example of Convolution Operation
Specifications
- Input Neuron (image): a 5×5 matrix
- Kernel (Filter): a 3×3 matrix
- Stride: 2 (the kernel moves 2 steps at a time)
- Padding: 0 (no extra border of zeros around the input)
Step by Step
Input Matrix
Kernel Matrix
Stride
The kernel moves 2 steps horizontally or vertically at each step.
Padding
Since padding = 0, the output size is determined as:
Output Size = [(Input Size - Kernel Size) / Stride] + 1 = [(5 - 3) / 2] + 1 = 2
So the output is a 2×2 matrix.
Convolution Steps
Region 1 (Top-left corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Region 2 (Top-right corner)
Selected input region:
Computation:
(3×1)+(0×0)+(1×-1)+(2×1)+(3×0)+(0×-1)+(1×1)+(2×0)+(3×-1) = 3 + 0 - 1 + 2 + 0 + 0 + 1 + 0 - 3 = 2
Region 3 (Bottom-left corner)
Selected input region:
Computation:
(1×1)+(0×0)+(1×-1)+(2×1)+(1×0)+(0×-1)+(3×1)+(2×0)+(1×-1) = 1 + 0 - 1 + 2 + 0 + 0 + 3 + 0 - 1 = 4
Region 4 (Bottom-right corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Output (Feature Map)
Example of Convolution Operation
Specifications
- Input Neuron (image): a 5×5 matrix
- Kernel (Filter): a 3×3 matrix
- Stride: 2 (the kernel moves 2 steps at a time)
- Padding: 0 (no extra border of zeros around the input)
Step by Step
Input Matrix
Kernel Matrix
Stride
The kernel moves 2 steps horizontally or vertically at each step.
Padding
Since padding = 0, the output size is determined as:
Output Size = [(Input Size - Kernel Size) / Stride] + 1 = [(5 - 3) / 2] + 1 = 2
So the output is a 2×2 matrix.
Convolution Steps
Region 1 (Top-left corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4
Region 2 (Top-right corner)
Selected input region:
Computation:
(3×1)+(0×0)+(1×-1)+(2×1)+(3×0)+(0×-1)+(1×1)+(2×0)+(3×-1) = 3 + 0 - 1 + 2 + 0 + 0 + 1 + 0 - 3 = 2
Region 3 (Bottom-left corner)
Selected input region:
Computation:
(1×1)+(0×0)+(1×-1)+(2×1)+(1×0)+(0×-1)+(3×1)+(2×0)+(1×-1) = 1 + 0 - 1 + 2 + 0 + 0 + 3 + 0 - 1 = 4
Region 4 (Bottom-right corner)
Selected input region:
Computation:
(1×1)+(2×0)+(3×-1)+(0×1)+(1×0)+(2×-1)+(1×1)+(0×0)+(1×-1) = 1 + 0 - 3 + 0 + 0 - 2 + 1 + 0 - 1 = -4