QuestionBelow is the matrix of a 3x3 monochrome image:s = [[2, 1, 3], [4, 0, 2], [1, 5, 6]]And 2x2 weights:w = [[-1, -2], [1, 2]]Use the formula to determine the result of a two-dimensional convolution operation:
Question
QuestionBelow is the matrix of a 3x3 monochrome image:s = [[2, 1, 3], [4, 0, 2], [1, 5, 6]]And 2x2 weights:w = [[-1, -2], [1, 2]]Use the formula to determine the result of a two-dimensional convolution operation:
Solution
To perform a two-dimensional convolution operation, we slide the 2x2 weights matrix over the 3x3 image matrix and multiply the overlapping values together, then sum them up.
Here's how to do it step by step:
-
First, we align the top left corner of the weights matrix with the top left corner of the image matrix. The overlapping values are 2, 1, 4, and 0. We multiply each of these by the corresponding value in the weights matrix and sum them up:
(-12) + (-21) + (14) + (20) = -2 - 2 + 4 + 0 = 0
-
Next, we slide the weights matrix one step to the right. The overlapping values are now 1, 3, 0, and 2. We repeat the multiplication and summation process:
(-11) + (-23) + (10) + (22) = -1 - 6 + 0 + 4 = -3
-
We then slide the weights matrix one step down and to the left. The overlapping values are now 4, 0, 1, and 5. We repeat the multiplication and summation process:
(-14) + (-20) + (11) + (25) = -4 - 0 + 1 + 10 = 7
-
Finally, we slide the weights matrix one step to the right. The overlapping values are now 0, 2, 5, and 6. We repeat the multiplication and summation process:
(-10) + (-22) + (15) + (26) = - 0 - 4 + 5 + 12 = 13
So, the result of the two-dimensional convolution operation is a new 2x2 matrix:
[[0, -3], [7, 13]]
Similar Questions
1.Which library is used to demonstrate convolutions on a 2D grayscale image in the given example?
Using the concept of Transpose Convolution, fill in the values of X, Y and Z below.(padding = 1, stride = 2)Input: 2x2 1234Filter: 3x3111000-1-1-1Result: 6x6000XY4220000-3Z-4-41 point
def convolve(sequence, weights): convolution = np.zeros(len(sequence) - len(weights) + 1) for i in range(convolution.shape[0]): convolution[i] = np.sum( np.array(weights) * np.array(sequence[i : i + len(weights)]) ) return convolution
Consider the following 1-D function ‘f’ and filter ‘w’ CO 2, CO 3 (BL- 1,2,4,5)f: 0 0 1 0 1 0 0 0w: 1 4 2 2 8Illustrate the 1-D convolution of ‘w’ with ‘f’
In a convolutional neural network, the ______________ operation helps to detect edges and textures within an image.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.