Convolutional Neural Networks

The following two tabs change content below.
I am a technology enthusiast and always up for challenges. Recently I have started getting hands dirty in machine learning using python and aspiring to gather everything I can.

Latest posts by Renuka Joshi (see all)

In previous articles we started learning about deep learning. We also learnt artificial neural networks which deals with the neural networks. In this article we are going to learn another part of neural networks that is Convolutional Neural Networks(CNN).

Convolutional Neural Networks

Convolutional neural network(CNN) deals with the image processing. Machine learns from the data provided and based on that machine recognizes the images. For example, if we provide a certain set of different images of dogs and cats to convolutional neural network model, it correctly recognizes the image of cat and dog.

Before creating a CNN model lets see how a computer processes the images. Let’s assume that we have provided a smiley face to computer then, the machine first divides the provided image into pixel format and then create a matrix to recognize the colours of the image on the basis of RGB combination. look at the image below.

Image Processing
Image Processing

 

In the above image we can see that machine has converted the smiley face into a multidimensional array.Here,0 represents the white colour and 1 represents the black colour. The best example of image processing with machine learning¬† in today’s world is Facebook’s facial recognition. The machine processes the photo you have shared and it automatically tags the person in the photo by recognizing his/her name from the photo.

To create a convolutional neural network model we are going to perform following 4 operations:

  • Convolution operation
  • Max pooling
  • Flattening
  • Full Connection

Convolution Operation

Convolution operation creates a feature map to reduce the size of image so that the further processing on image will be easy and faster. Every image has it’s own features so to detect the particular feature of an image convolution operation detects feature of image using feature detector.

Feature map
Feature map

Here in above image you can see that convolution operation creates a feature map by simply multiplying image matrix to the feature detector. It keeps selecting a 3*3 array from image and finds any common number between selected matrix and feature detector. Note that feature detector matrix can be of any dimension here just for calculation simplicity we are using 3*3 feature detector. The process is followed until every 3*3 combination of input image is completed. Final feature map will look like below.

Final Feature map
Final Feature map

After creating a feature map we will create max pooling for our convolutional neural network model.

 

Max Pooling

We saw that every image has it’s own certain feature. But, an image may have certain special feature than other images provided to the machine. Finding a special feature in an image is called as max pooling. We are going to build a model which will have flexibility to identify such special feature in image. From the above feature map select a 2*2 array and pick a max number from it and place it in the pooled feature map as below.

Max Pooling
Max Pooling

Here we can see that from the selected 2*2 array machine have selected max number and placed it in the pooled feature map on right hand side of the arrow. Machine continues this process and creates a final pooled feature map as above.

 

Flattening

This is the most simple operation in convolutional neural networks. In this we are simply going to flatten the pooled feature map in a single column. Reason behind doing this is that the flattened array is going to be an input layer to the future artificial neural network of the CNN model. After flattening pooled feature map will look like below.

Flattening
Flattening

Convolutional neural network model uses a fully connected artificial neural network to predict the images.

Full Connection

This is the final step of convolutional neural network model where we are going use a fully connected artificial neural network to recognize or predict the images.

Full Connection
Full Connection

 

Here, the flattened images are provided as input to input layer to neural network and all operations are performed as like we have seen in neural networks in previous articles. So, this is all about how a convolutional neural networks model works and predict the images provided. In next tutorial we will see the actual execution of convolutional neural network using python, until then enjoy machine learning!

 

References:

Share Button

Renuka Joshi

I am a technology enthusiast and always up for challenges. Recently I have started getting hands dirty in machine learning using python and aspiring to gather everything I can.

One thought on “Convolutional Neural Networks

Leave a Reply

Your email address will not be published. Required fields are marked *