August 2018
Intermediate to advanced
522 pages
12h 45m
English
Even if we're not building a complete deep learning model, we can test how convolution works with a simple example. The input image we're using is already provided by SciPy:
from scipy.misc import faceimg = face(gray=True)
The original picture is shown as follows:

We're going to apply a Laplacian filter (that is, it is equivalent to a discrete Laplacian operator), which emphasizes the boundary of each shape:
import numpy as npkernel = np.array( [[0, 1, 0], [1, -4, 0], [0, 1, 0]], dtype=np.float32)cfilter = np.zeros((3, 3, 1, 1), dtype=np.float32)cfilter[:, :, 0, 0] = kernel ...
Read now
Unlock full access