Inabilty to show convolution filter (Coding along)

Post Reply
Joel Chan
Posts: 1
Joined: Sat May 09, 2020 7:45 am

Inabilty to show convolution filter (Coding along)

Post by Joel Chan »

Code: Select all

from PIL import Image 
!wget https://pngimage.net/wp-content/uploads/2018/06/lena-png-4.png
im = Image.open('lena-png-4.png')
gray = np.mean(im,axis=2)
x = np.linspace(-6,6,50)
fx = norm.pdf(x, loc=0, scale=-1)
filt = np.outer(fx,fx)
plt.imshow(filt, cmap='gray');
After coding this from the course (25-convolution)
It returns an empty graph + the following warnings

/usr/local/lib/python3.6/dist-packages/matplotlib/image.py:452: UserWarning: Warning: converting a masked element to nan.
dv = np.float64(self.norm.vmax) - np.float64(self.norm.vmin)
/usr/local/lib/python3.6/dist-packages/matplotlib/image.py:459: UserWarning: Warning: converting a masked element to nan.
a_min = np.float64(newmin)
/usr/local/lib/python3.6/dist-packages/matplotlib/image.py:464: UserWarning: Warning: converting a masked element to nan.
a_max = np.float64(newmax)
<string>:6: UserWarning: Warning: converting a masked element to nan.
/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py:85: UserWarning: Warning: converting a masked element to nan.
return array(a, dtype, copy=False, order=order)

Im not sure what went wrong here
lazyprogrammer
Site Admin
Posts: 50
Joined: Sat Jul 28, 2018 3:46 am

Re: Inabilty to show convolution filter (Coding along)

Post by lazyprogrammer »

I just tried the exact same image in Colab notebook and it worked, perhaps you should try there.
Post Reply

Return to “Deep Learning Prerequisites: The Numpy Stack in Python”