You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Implementation Issues:
The current implementation uses negative indexing, which can lead to confusion and incorrect results, especially at the borders of the image. This approach might not correctly apply the convolution filter, affecting the accuracy of feature extraction. Specially when i=0 and j=0 and when evaluating im_pad[i - 1, j - 1] * filter1[0, 0] we are applying the filter to pixels that are sparce in the image patch. Instead of getting the top left of the image we are getting the bottom right.
Proposed Fix:
To address these issues, I propose the following code change:
new_image = np.zeros_like(im)
im_pad = np.pad(im, 1, "constant")
for i in range(im.shape[0]):
for j in range(im.shape[1]):
patch = im_pad[i:i+3, j:j+3]
new_image[i, j] = np.sum(patch * filter1)
This implementation avoids negative indexing and ensures that the filter is correctly applied over the padded image.
The text was updated successfully, but these errors were encountered:
I am writing to suggest an improvement in the implementation of the vertical edge filter in the notebook located at:
https://github.com/davidADSP/Generative_Deep_Learning_2nd_Edition/blob/main/notebooks/02_deeplearning/02_cnn/convolutions.ipynb
Current Implementation Issues:
The current implementation uses negative indexing, which can lead to confusion and incorrect results, especially at the borders of the image. This approach might not correctly apply the convolution filter, affecting the accuracy of feature extraction. Specially when i=0 and j=0 and when evaluating im_pad[i - 1, j - 1] * filter1[0, 0] we are applying the filter to pixels that are sparce in the image patch. Instead of getting the top left of the image we are getting the bottom right.
Proposed Fix:
To address these issues, I propose the following code change:
This implementation avoids negative indexing and ensures that the filter is correctly applied over the padded image.
The text was updated successfully, but these errors were encountered: