Career skills to jumpstart your future.

LightSpeed Intro to ConvNets

LightSpeed intro to ConvNets

________________________________________________
Unless you're experienced or have read the LightSpeed intro to DL, please see here before reading this.
---------------------------------------------------------------------------------
In this post, you'll learn about-
  1. What are Convolutions?
  2. Why Convolutions work great (optional)
  3. Keras and TensorFlow (compulsory)
  4. How to make a Neural Network that can classify pictures depending on objects!

What are ConvNets?

Now, what are ConvNets? They are Neural Networks having Convolutions. Okay, so what are Convolutions
Convolutions, informally, are mathematical functions.
Now, to convolve the above matrices, we take the second smaller matrix, then we imprint it on the first possible 2 by 2 chunk of the other as shown below.

So, this will be the first value in the output matrix-
= (4*1) + (2*0) + (0*0) + (3*1) = 7

Similarly, you may be able to calculate that the next output(Hint: Go one step right) shall also be 7, and the next one will be 12 and then, going one level down, we will get 6,12, and 7 as our values and so on.

Main points-

  1. We moved 1 block at a time, sideways and downwards. Thus, we used a stride of 1.
  2. We did not increase the size of the first matrix. Thus, we used valid padding.
  3. Also, we used a 2-by-2 filter (small matrix). Thus, we used the filter size of 2.
Thus-
s = 1
p = 0
f = 2

Why are ConvNets so good? (Optional)

There are two main widely accepted reasons why these ConvNets or Convolutional Neural Networks, work as well as they do.

  1. Parameter Sharing - For 1280 * 720 pixels picture (HD), with the usual three channels (Red Green Blue) a one-layer shallow Neural Network, will have the number of parameters running deep into the millions, with a single layer having exactly 2,746,800 parameters needed for a direct Fully Connected layer (excluding bias). A ConvNet, however, can have as less as 75 * x parameters (f = 5, excluding bias, only one convolution), x may ideally be about 32 or 64, in which case there will be 2400 or 4800 parameters, which is still exponentially lesser than a fully connected layer.
  2. The sparsity of connections- Each output value depends on very few input values. 
Done!

Keras and Tensorflow 

TensorFlow is a relatively high-level machine learning programming framework made by Google. The later versions of TensorFlow included a library that was previously individually used. This was an even-higher-level deep learning programming framework- Keras. TensorFlow v1 and TensorFlow v2 had significant changes, which are beyond the scope of this blog post. Yay! We're done with the second part!



How to make a NN that classifies pictures

Like last time, we will use the GPU available on Colaboratory.
  • Download the notebook here on GitHub
  • Please star the Git if you liked the code explanation.
  • Upload notebook on Google Colab, and Enable GPU Hardware Accelerator.
  • Understand the code first. Ever welcome to ask doubts. Run both cells.
  • Play around with the code. Tune the values.
  • Try to achieve the highest accuracy possible!!! Above 90% is an achievement, so please comment below.
  • You are now a CNN programmer!!! Do write Feedback on both the GitHub Repository and the Blog.
  • Tell the LightSpeedMaster bot for what you want to learn next!!

I hope you enjoyed it!!


    Comments

    Popular posts from this blog

    LightSpeed Basic Animation for Beginners in Flash 8 | Part-2

    LightSpeed Basic Animation for Beginners in Flash 8 | Part-1

    A honest review of the Data and Deployment Specialization

    LightSpeed intro to Deep Learning