Repository navigation
Convolution as equation 21.8 (kernel not flipped, same length) - #1393
Merged
Merged
Conversation
np.convolve flips the kernel, so an asymmetric kernel gave the opposite
result of the book, and a kernel longer than the input gave max(n, l)
values. conv1D now computes z_i = sum_j k_j x_{j+i-(l+1)/2} with zero
padding, always n values; for an even l the kernel covers one element
more to the right of x_i. The [1, 0, -1] expectations of the ConvLayer1D
test change sign, and the long kernel gives [6, 6, 6] instead of
[3, 6, 6, 6, 5].
The edge detectors used scipy.signal.convolve2d, which flips the kernel. conv2D applies equation 21.8 along both dimensions with the conventions of conv1D. With the 4 columns of the derivative of gaussian not flipped, the uniform region right of the step is compared at column 5 instead of column 6, which the kernel reaches from the padding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
conv1D and the edge detectors now follow equation 21.8: the kernel is not flipped (footnote 4 of chapter 21), zero padding as in figure 21.5, output as long as the input also for a kernel longer than the input, and for an even kernel the extra element on the right, as the 'same' padding of Keras and PyTorch
expected values that change: