Deep Learning, Sin categoría

From 0 to Convolutional Neural Networks

In this post, we are going to understand what a convolutional neural network is and how it works. I’ll be explaining how all the layers are stacked together to form specific architectures. At the end of this post, you will be able to train and test your own convolutional neural network in your own dataset.

I grouped all the information needed to understand what a Convolutional Neural Network is and how it works. This post answers all the questions that I once had when I first started to study CNN and I decided to put them all together.

In the end, I attached the code needed to train your own CNN using Keras. The code is very intuitive and you will easily understand after reading the entire post.

Convolutional neural networks 

Convolutional neural networks or just CNNs are a type of deep learning used for image recognition (more correctly “image classification” because it classifies the image into probabilistic classes) and object detection (detecting the coordinates of an object in an image), different architectures are used depending on the aim, for object classification we use Google Inception Net, VGG Net, Let Net, etc. For object detection, we use Single Shot Detectors or YOLO.

 

Continue reading

Deep Learning, Python

Real Time Object Recognition with OpenCV | Python | Deep Learning – Caffe Model

In this tutorial, we are going to build an application which is going to be able to recognize certain objects.

First of all, we are going to use a pretrained model that was trained using Cafee. Caffe is a Deep Learning Framework created by Facebook which allows us to create Deep Learning models. The model that was used is a Convolutional Neural Network.

A Convolutional Neural Network is a Deep Learning Architecture that is used for image recognition. This architecture has several variants some are better than others recognizing objects. You will choose a certain architecture depending on your needs, but basically, all have the same architecture.

Resultado de imagen para convolutional neural network

Continue reading

Deep Learning

Stochastic Gradient Descent – Python

If you read the second part of the introduction to neural networks you know that gradient descent has a disadvantage when we want to train large datasets because it needs to use all the dataset to calculate the gradient.

Also as you can see we have specifically chosen a convex cost function. In essence, this only has one minimum and it is the global minima.
But what if our function is not convex. Well, first of all, it can happen if we choose a cost function which does not have a convex function or it can happen in a multidimensional space it can actually turn into something that is not convex.multidmensional.PNG

And if we try to use gradient descent to find the global minima we can get stuck in local minima of the cost function rather than the global minima.

localminima.PNG

To solve this problem we use Stochastic Gradient Descent which does not require the cost function to be convex.

In both gradient descent (GD) and stochastic gradient descent (SGD), you update a set of parameters in an iterative manner to minimize an error function.

Continue reading

Deep Learning

Linear Regression -Gradient Descent with Python

Gradient descent for linear regression

We already talk about linear regression which is a method used to find the relation between 2 variables. It will try to find a line that best fit all the points and with that line, we are going to be able to make predictions in a continuous set (regression predicts a value from a continuous set, for example, the price of a house depending on the size). How we are going to accomplish that? Well, we need to measure the error between each point to the line, find the slope and the b (b is the intersection with the y-axis) value to get the linear regression equation.

We talk about how we can find the best line using concepts as covariance, variance and the method of least squares.

Now we are going to find the line that best fits our data using Gradient Descent which is a method for optimization used in machine learning.

Gradient Descent

Gradient descent is a first order optimization method that means that it uses the first derivate to find local minima. In more detail, it uses partial derivate to find it.

The first derivate shows us the slope of the function. We need to move against of the direction of the slope to find the minima.(To get to the minima, we need to go against the gradient so we multiply the gradient by the negative value of alpha. Alpha is also called as the steeper size of the learning rate.) In order to find the minima, we select a small value called alpha. This alpha value is going to help us to find the minima by multiplying the gradient by the alpha value, taking us to the function`s minima.

We stop when the gradient changing is too small or when our gradient is sufficiently small.

1.PNG

Continue reading

Deep Learning

Machine Learning – Configuring our Linux (Debian) environment

In this tutorial, I am going to show you how to configure your Debian environment to start developing machine learning.

We are going to install miniconda which is a package manager who helps us create virtual environments and download the package necessary.

debina.PNGIn my VirtualBox machine, I installed Debian Jessie amd64.

First, install miniconda.

To install miniconda you will need to go to https://conda.io/miniconda.html and download the 64 bits bash installer for Linux.

Continue reading