May 2018
Beginner
490 pages
13h 16m
English
Developers like to see the result first to decide how to approach a problem.
Let's take a quick, tangible shortcut to understand kernels through Edge_detection_Kernel.py with an edge detection kernel.
#I.An edge detection kernelkernel_edge_detection = np.array([[0.,1.,0.],[1.,-4.,1.],[0.,1.,0.]])
The Kernel is a 3 x 3 matrix, like the cat example. But the values are preset, and not trained with weights. There is no learning here; only a matrix needs to be applied. The major difference with a CNN network is that it will learn how to optimize kernels itself through weights and biases.
imp.bmp is loaded, and the 3 x 3 matrix is applied to the pixels of the loaded image, area by area:
#II.Load image and convolutionimage=mpimg.imread('img.bmp')[:,:,0] ...Read now
Unlock full access