An intuition of CNN

A basic implementation of the CNN with numpy and matplotlib.

An intuition of CNN

Summary: A basic implementation of CNN with numpy, matplotlib.Tried the CNN on images when object is shifted, rotated and object image with noise.

Lets try an example of CNN by taking a 6 x 6 pixel image of a triangle.

  • Apply CNN to the triangle image with the kernel of 2x3 pixel (generally you will find a square kernels)
  • Result:

As the result, the kernel detects the triangle in the image.

  • Now lets try when triangle is shift in the image.

Now lets apply the same kernel to this image.

Perfect, it detects the triangle in the other portion of the image.

Now, Lets try when we rotate the image 180 degree and 90 degree.

180 degree rotated triangle
cnn on rotated triangle
90 degree rotated triangle
CNN on 90 degree rotated triangle image
  • Our kernel detects triangle perfectly even when when our object (triangle) is rotated.
  • Lets try go some more practical, add some noise to the image.
Noisy image of the 90 degree rotated triangle image

Now,lets apply our same kernel to the noisy image.

CNN on the noisy image of the 90 degree rotated triangle image

There is some noise in the result,but our kernel successfully detect the triangle in the noisy image.

Note: It is a basic implementation of the CNN to get the idea of it and to make you more curious about it.

Best way is to implement it by our own.Here the the source.