Skip to main content

Posts

Showing posts from 2017

Self Balancing Bot with PID

In my previous project, I dealt with self-balancing robot without PID controller in this version of embedded the PID control on the same boat and the results are a better than the previous version obviously I am using the control systems part where our main objective is to achieve a critically damped robot. It should reach the steady state as it should have fewer oscillations and it should also recover from light to medium push.

In my previous bot without PID, I had to face problems where the robot will run away with a certain angle. Let's said it x and the Motors will move forward to balance the boat, however, the force or better say pseudo force that acts on the bot will be equal to the force that is pulling the robot downloads at a certain time. When these two forces balance the Robot full neither fall down nor it attain its vertical position. In this Mod, the robot will keep moving forward and forward in forward and finally, it will fall down
Obviously controlling this robot …

Self-Balancing Bot without PID

Self Balancing robot is one awesome form of the subject Control Systems. It relies on the topic "Feedback Controller".It always feels awesome to work on these projects and to calibrate your bot according to your needs. Although calibration my bot took less time than to work with PIDs which can take ages and ages also. Auto-Tune PID is also available to manipulate your bot but still, hard work deserves more reward and peace.

In this project, I haven't used PID control to control the motion of bot. That doesn't mean that my bot is unstable or it will wobble around here and there. It is indeed stable and can recover from sudden jerks and movements too. I am not using the enable pins of L293D IC which is used to control the motors using PWM signal I am using here a soft coded PWM signal and decoding part of Arduino to determine the speed of the motor with the respect to the angle. Also, I coded a virtual encoder that can help my bot to return to its original place from …

Detecting Objects using Machine Learning I

Detecting Objects using YOLOThis post deals with my small project on YOLO. It is a great project which if linked with an Arduino will certainly make you win Google Science Fair. Pardon 😁

It also enables to localize the object. If you lost your specs then maybe this will certainly work.

So YOLO stands for "You Only Look Once". Yes, YOLO looks at the image only once. It works by dividing the image into K x K cells


A bit like this
Fig 1 - Image divided into cells
Before working on YOLO have a look at its output like this when I ran an edited version of YOLO over the above image. Fig 2 - YOLO Output using classification.

Each of these yellow boxes is called bounding box in YOLO language. Each cell in Fig 1  will generate bounding boxes. Treat each image cell as an individual cell and a CNN is run over that image to extract out the features from it. If that feature is significant then a bounding box is drawn over that portion of a particular cell with a bounding information or confiden…

Build a Neural Network Classifier in 5 minutes

Hola Amigos,

I actually faced a lot of issues while building my own classifier to build my own neural network classifier. Step - by - Step explanations are hardly available coz everyone here thinks that we already know 30% approx about the subject but what about a beginner? Let's face it it's very difficult to understand these available examples, especially for new fledglings. Therefore I decided to follow the new way of learning and that is Reverse Engineering. Take an example and crack it down and then use that example as a reference to crack every other example. I did a similar thing a long time ago to learn to programme and did it again to make my own classifier that can identify a man and a woman.

To learn about CNN Click Here

The blueprint of a neural network classifier is as follows


Specify a directory of your images for trainingSpecify a directory of your images for validationMake a Convolutional Neural Network with input dimensions according to image dimensions.Add t…

Convolutional Neural Networks IV

In this post, I will deal with back propagation, gradient descent etc. Do check out my previous posts regarding Max Pooling, filters, dropout layers, fully connected layers and CNN. To begin click here.
So
What is Back Propagation? Backpropagation is done whenever we find some error. After obtaining the probabilities of the images the CNN subtracts the actual answer with the obtained answer. Clearly, this is an error. So our first objective is too reduce this error. While I was working with the probabilities with the image of the letter 'R' (click here to know about the image 'R'), I got the probability of R as 0.911 and the probability of some other is 0.42.

Actual probability of getting a 'R' is 1 thus, the error is |1 - 0.911| = 0.081
The actual probability of not getting a 'R' is 0 thus, the error is   |0 - 0.42| = 0.42.
Thus the total error is 0.501. Now comes the power of weights. These weights are used in the gradient descent optimization algori…

Convolutional Neural Networks III

In this post, I'll deal with dense layer, fully connected layer and backpropagation. If you have missed my previous post click here.
Before moving further, let us have a view on the filter's working on an image. I made a pixelated image of the letter 'R' and applied a 3 X 3 filter one time and 3 times. One must remember greater is the number of times a filter is applied on the same image, lessened will be the features. The pixelated image of the letter 'R' and the filter is below

Fig 1- Filter (Left) and the image (Right)


So when this filter is moved across the image we get feature extracted according to the filter like this below
Fig 2- Filtering applied on image(once and twice)
One can clearly see how the filter has faded the pixels that aren't in phase with the filter. The term 'phase' seems to fit here 😊. The darkened cells are ones in phase with the filter. Even if the reference image is a bit distorted or rotated or flipped or sheared the f…

Convolutional Neural Networks II

This is my second post in CNN regarding max pooling, strides and padding.

In the previous post we extracted the features from the image of '3'. Although the dimensions of the image were 4 X 24 which is quite small. But what to do when the size of the image is big having a very high resolution. Greater is the size of image more are the parameters which the CNN has to extract from the image and hence it will take a longer time to identify the class of that image so how do we reduce the size of an image without losing any details from it and also maintaining the spatial arrangement. The only thing that comes at this position to solve this problem is Max pooling or Average pooling. Pooling is basically a technique by which you reduce the size of the image but also maintain the details and features within it in order to lessen the parameters. However, with pooling in the images might guesstimate updated started but still gets picked up by this CNN so that good news

Max Pooling In …

Convolutional Neural Networks I

Every time I imagine CNN something spills out from my brain and forces me to restart my learning. I guess it was because I wasn't doing practicals on CNN. Many guys basically look on CNN as a theory and that is where even I lost my way of learning. However, Coursera, Edx, and Udacity helped me to amplify my knowledge about CNN and those big words like pooling, strides etc. I am not a genius in CNN but yes I know something about CNN.


So What is CNN?

Convolution Neural Network is a branch of AI where features from images are gathered up and compared with the input data. It is basically a voting system where every pixel votes for the outcome and as usual the one with maximum votes win in this game and we get a result like this


So how does this happen is what comes in my mind first.

A CNN takes an image as input and converts them into arrays. Yes those numpy arrays are for the same !! Do remember that a CNN never matches the whole image instead it matches small features of images wit…

Deep Reinforcement Learning -Write an AI to play Pong with Q learning

In this post, we will implement Q learning to play Pong.
By the end of this post, you will be able to


Design your own game in Python Pygame library. Learn the basics of Q learningImplement an efficient Policy for the agent


Important
To follow this tutorial it is highly recommended to have even a little bit of experience in

PythonBackpropagation Linear algebra Matrices. 
If you know the basics of these then we can move on.

I am using Python 3.5 and the software I am using for the coding part is Sublime Text 3 but you can even use the default Python IDLE editor

Before starting we need to install the pygame library. To do that just open the Python folder where it is installed then go to the scripts folder, and open command prompt from that location.

Now type this below

pip install pygame 

Let it download first then type

pip install numpy 

Let's go to the problem solving

The pong game basically has a rectangular bar with which we will have to bounce the ball everytime it tries to hit. If…