<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hadi N. Abu-Snineh on Medium]]></title>
        <description><![CDATA[Stories by Hadi N. Abu-Snineh on Medium]]></description>
        <link>https://medium.com/@hadinabusnineh?source=rss-8b790cc246b9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vwPKaV9EJmu81hEu.</url>
            <title>Stories by Hadi N. Abu-Snineh on Medium</title>
            <link>https://medium.com/@hadinabusnineh?source=rss-8b790cc246b9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 02:45:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hadinabusnineh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What i have learned from the first term of Udacity Self driving car nanodegree program.]]></title>
            <link>https://medium.com/data-science/what-i-have-learned-from-the-first-term-of-udacity-self-driving-car-nanodegree-program-7d36b011f300?source=rss-8b790cc246b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d36b011f300</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[udacity]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Hadi N. Abu-Snineh]]></dc:creator>
            <pubDate>Sat, 13 May 2017 11:45:17 GMT</pubDate>
            <atom:updated>2017-05-13T11:54:18.816Z</atom:updated>
            <content:encoded><![CDATA[<p>My name is Hadi Abu-Snineh from Amman, Jordan. I have studied Mechatronics engineering at the German Jordanian University. I decided to take the challenge and go for the Udacity self driving car program. Having lived for one and a half year in Germany, has pushed me to search for alternatives and think of solutions for the accidents and driving mentality that we have here in Jordan. In this article, i will write a brief explanation of what my projects were about and what i have learned during the first term.</p><p><strong>Note:</strong> all the code written was in Python programming language using some helpful libraries such as OpenCV.</p><p><strong>Project 1: Finding Lane Lines On The Road:</strong></p><p>The first project was a basic intro to machine vision and basic image processing methods. The aim of this project was to detecting lane lines in a video using a basic algorithm. The goal of this project was to provide a good understanding of important algorithms and methods that are used in image processing and computer vision such as:</p><ol><li>Canny Edge detection: This is an algorithm that is used to detect the edges in an image. For more information about this method please click <a href="http://docs.opencv.org/trunk/da/d22/tutorial_py_canny.html"><strong>here</strong></a>.</li><li>Region masking: This function is used to fit polynomials in a way that masks the unwanted parts of the image so that only the region of interest (ROI) appears. ex:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hZT7fYPSLUai8jD0bzLF0Q.png" /><figcaption>Unmasked image on the left vs. the ROI image on the right</figcaption></figure><p>3. Hough space: Normally, an image is plotted in the image space which represent each point on the image as X vs. Y. In 1962, Paul hough has found a new way to represent an image. The new space is called the hough space which represent each image in m vs. b in the cartesian form or r vs. theta in the polar form. A line in the image space is represented by Y=mX+b. This means that each line in an image space is represented by a point. This transform helps finding relationship between lines in an image. In order to successfully perform hough transform and detect the right lines, there are different parameters that need to be taken care of. for further information about this transform click <a href="http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html"><strong>here</strong></a> and to check the function in OpenCV click <a href="http://docs.opencv.org/2.4/modules/imgproc/doc/feature_detection.html?highlight=houghlinesp#houghlinesp"><strong>here</strong></a>.</p><p>4. Before implementing the code, the image need to be converted to grayscale image instead of Red Green Blue (RGB) colorspace. A Gaussian blur is also used to blur the image and remove some of the noise that exist in the image.</p><p>After finding the Hough lines using hough transform, the lines are filtered based on their slope and the position to make sure that the detected lines are only the lane lines. You can see this in the function draw_lines in the pipeline.</p><p>The code for the first project can be seen in my Github repository <strong>here</strong>.</p><p>Here is the final result for the first project:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3De50cWJXaUrM&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fe50cWJXaUrM&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cb23746d7155719f8b3f579b6a745f8/href">https://medium.com/media/2cb23746d7155719f8b3f579b6a745f8/href</a></iframe><p><strong>Project 2: Traffic Sign Recognition Classifier:</strong></p><p>The second project focuses on a different principle, That is neural networks (NN). I will try to explain it briefly here but i will also provide you with useful links to check.</p><p>First of all deep learning is using algorithms and multiple of layers in order to extract features and learn and predict results. NN is one of deep learning methods that are used to teach computers predict specific results.</p><p>A neural network consist of different parallel layers. Each layer consists of one or multiple nodes. A node contains a specific mathematical operation. The inputs of a neural network are called features. They represent chosen information extracted from lets say an image. Ex: pixel values from an image. The outputs are the result of the image and are called labels. Ex: Specify what the object in the image is (Dog, Cat…etc). The pixels values enter the nodes and get multiplied by random weights to create mathematical equations which represent the relationship between the pixels of the image. The features enter different nodes which results in different equations and thus different relationships.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*NeRo40VwnRLl2UsPKecotA.jpeg" /><figcaption>This is an example of a simple Neural Network.</figcaption></figure><p>Nodes also contains activation functions to determine wether or not to trigger the next node in the network Ex: if the result is &gt;0 then activate the next node and if &lt;0 say -0.5 then turn it to 0 and don’t activate the next node.</p><p>At the beginning, the network will finish one forward pass. The result will not be very accurate because the weights of the equations are random which means that we might end up amplifying features that are not very important and decreasing the ones that are of more importance (w=2 doubles the feature in an equation whereas w=0.5 divide it to half). So calculating the error or mean squared error would show how far the predicted result is from the real result. In order to get a smaller error we will need to update the weights in a way to get the smallest error. In other words, the aim is to decrease the gradient by going deeper in the image below until reaching the point where the gradient is almost zero. This is the gradient descent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*YS5MmlmtMM7IUh0foUFHTQ.jpeg" /><figcaption>Example of the gradient descent to reduce error. The goal is to reach the bottom (Gradient of almost Zero).</figcaption></figure><p>In order to update the weights, there is a process called back propagation. It uses the error that is obtained at the end of the network and mainly uses the chain rule to find errors and gradients at each node. So the network goes forward, finds the error then it goes backward to update the weights and it keeps doing this until reaching the least mean squared error.</p><p>In more advanced networks, The result of any prediction would be multiple labels. Each has a probability and an error of the correct result. so the highest probability and hence the lowest error should be the right guess among the other labels. There are different procedures and algorithms used to enhance the efficiency and accuracy of the NN such as the softmax function that converts the output of the network into probabilities.</p><p>So the labels of the NN which are represented by the label matrix Y is the result of the equation Y=Xw+b where b is the bias, X is the features matrix and w is the weight matrix of the whole network. During the training process, each row in X would represent image pixels. To train the network, there must be a large dataset with known labels so that you can feed the network with X. First, weights will be random and when calculating the error comparing to the known Y the weights get updated and so on. After training the network, it gets tested by providing the network with new image (X) and using the updated weights the network should be able to successfully predict the result or (label Y). After this operation, the accuracy is calculated.</p><p>Because the dataset is very large the matrix X would be huge. This means that training the network using normal computer CPU would take a lot of time and using a GPU is much faster.</p><p>The goal for training the network is generalization. We need to create a network that is general enough to predict any new observation and give the right result . One important situation that needs to be avoided is overfitting. You can think of overfitting as a network that performs really good in similar observations (images) as the trained ones. But as soon as a new slightly different image is given, the result becomes wrong. So the network is not generalized to successfully predict different givens. It also means that the training error is very low while the test error is high. This should be prevented and it could happen in many cases such as increasing the number of epochs. Epoch is one pass forward and one pass backward in the training of a NN. Another reason is by using the same data as the training data to test the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*JPDGwWB0EHSpad-GZHCwsw.png" /><figcaption>A plot shows how overfitting affects the test results.</figcaption></figure><p>NN has a lot of parameters that are tuned to achieve the best accuracy. Ex: changing the number of epochs or the learning rate. The learning rate is the rate of updating the weights in each epoch.</p><p>For further information about Neural Networks NNs or even the very similar Convolutional Neural Networks CNNs i would recommend these links:</p><ol><li><a href="http://cs231n.github.io/convolutional-networks/"><strong>Convolutional Neural Networks for Visual Recognition</strong></a></li></ol><p>2. <a href="https://www.youtube.com/playlist?list=PL16j5WbGpaM0_Tj8CRmurZ8Kk1gEBc7fg"><strong>CS231N — Convolutional Neural Networks</strong></a></p><p>There are different companies and organizations that created CNN architectures with a combination of nodes that are connected in a way that give the best results. I implemented my project using LeNet architecture which is a very simple CNN that can give reasonable accuracy.</p><p>The project was about creating a traffic sign classifier that is able to recognize different traffic signs that are detected by the car’s front camera and differentiate between them. As you can see from the image below, the classifier was able to classify traffic sign images that i randomly chose from the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*mR9KY-IG3HE9kjbOclpwEQ.png" /><figcaption>Result of the traffic sign classifier in predicting traffic sign images.</figcaption></figure><p>To check the report of my project where i explained all steps that were implemented and what the results are press <a href="https://drive.google.com/open?id=0BzYT14AYWSA8ZUVuNlZVbVNmNjQ"><strong><em>here</em></strong></a>. And click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8aEEtWmtTNzR0SnM"><strong><em>here</em></strong></a> to see my project pipeline.</p><p><strong>Project 3: Behavioral cloning:</strong></p><p>The goal of this project was to build a CNN that is able to clone a car’s behavior. Through a simulator, a car is driven on a track. A camera is built in the car’s front window. The steering angle and an image of the camera can be recorded at any position and is saved. The Classifier takes the image as features and the steering angles as labels for the CNN. After training the network using all the dataset (recorded images and steering angles on the track) that is saved by the user, the car should be able to drive itself on the same track by predicting steering angles when taking the images from the camera as an input.</p><p>To be able to built an efficient CNN, Keras, which is a high level neural network API that is built on top of Tensorflow, was used. If you click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8Z3U4eTgyZWFHRUU"><strong>here</strong></a>, you can see the code that i used to implement the make the car drive itself.</p><p>Below is a video of the car in the autonomous mode:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D8SStL7vSKVw&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F8SStL7vSKVw&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/66053bde807bd14f92038b59515b1a1a/href">https://medium.com/media/66053bde807bd14f92038b59515b1a1a/href</a></iframe><p>To have a look on the report i wrote about the project please click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8QVo3SWNyaFE2bk0"><strong>here</strong></a>.</p><h4><strong>Project 4: Advanced Lane Line Finding:</strong></h4><p>The first project in Udacity was about lane lines finding. This project uses advanced algorithms to be able to predict lane lines in critical situations such as shadows.</p><p>To be able to do this, the car’s camera should be calibrated to make sure there is no distortion in the image. This is done by computing the camera matrix and distortion coefficients. This is explained in the report that i will be positing at the end of the section.</p><p>A very important thing to learn is color spaces. It is a mathematical model that represents color systems that are used in each image. A famous color system is RGB (Red,Green,Blue) that uses red, green and blue colors with different intensity values to represent and form any color. There are different color spaces that are used in each image such as HSV (Hue, Value and Saturation).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*v4HQnikMzxxxeKismnrgRw.png" /><figcaption>RGB color space vs. HSV color space.</figcaption></figure><p>So to extract specific information, we can use different color spaces or even different channels. As an example, If we extract the red channel and the S channel from both RGB and HSV color spaces, lane lines with yellow paint are more likely to appear than in different channels. Combining best channels can help increasing the probability of finding the desired information in an image.</p><p>Another way to find line or edges in an image is using Canny edge detection method. The heart and the core of this algorithm relies in the so called Sobel operator. Applying these operators to an image is similar to taking the derivative of an image in both X and Y. This can be used to find magnitudes of the edges and even their direction which would help finding them. This can also be combined with color spaces to increase the efficiency of our detection algorithm. (In my case i combined Red channel, S channel and the gradient in the X direction with specific thresholds to detect lane lines). This will be also explained in the report at the end of this section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D9b_H8CwjMcKJK5o6Wzveg.png" /><figcaption>A binary image resulting from combining images from (Gradient X, S channel and the Red channel)</figcaption></figure><p>After converting the colored image to a binary image, the image is warped to a bird’s eye view image. Warping the image is done through perspective transform, that is transforming an object from one perspective to another. In our case we want to transform a part of the image from the normal perspective where we see objects close to us bigger than the others to a bird’s eye view where we see the objects from above. This is done by specifying four points in the image (should create a trapezoid). The two points that are located close to each other will be taken further which would transform the trapezoid to a square/rectangle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vZr2XedswQ4zU6dM9YXqfA.jpeg" /><figcaption>Warped image (right) vs. an original image with trapezoidal shape (left)</figcaption></figure><p>This warping would help finding the curvature of the lines on the street. So after warping the image we will be able to fit a polynomial on the lane lines. This is done manly by finding the peaks in the histogram (White lines would represent peaks in a binary image), and then slide windows in the image to cover the lines. After that a polynomial is fitted in the line. This is how the windows and the polynomial would look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*03wDvyGer1pltdrKQLgXzA.png" /><figcaption>Polynomial fit on the lane lines that are covered by the sliding windows. (they are colored for demonstration)</figcaption></figure><p>This would make it easier to calculate the radius of the lines and highlight them on the video. The video below shows the result plotted with the lane lines highlighted.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIGCKFouaQdg&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIGCKFouaQdg&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3da965d4c89b190c44c9948bab512bcf/href">https://medium.com/media/3da965d4c89b190c44c9948bab512bcf/href</a></iframe><p>To have a look on the project’s report. Please click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8eDV0c1JBSVk5TUU"><strong>here</strong></a>. And press <a href="https://drive.google.com/open?id=0BzYT14AYWSA8WWw0aXhQSWxTOVU"><strong>here</strong></a> to have a look on the code pipeline.</p><p><strong>Project 5: Vehicle Detection:</strong></p><p>The last and fifth project of the first term is to write a program to detect vehicles by drawing a bounding box on each detected vehicle. the project is done using a Support Vector Machine SVM that is a kind of classifier that is used to classify and differentiate between different classes. In this case, the classifier takes multiple features of images as inputs and learns to classify them into two classes, cars and non cars.</p><p>There are different ways used to extract images features. The first HOG features that is Histogram Of Gradients looks for the gradient orientation of the image pixels. The second is to calculate the color histogram of each channel. By computing this, you will be having a histogram of each channel from 0 to 255.</p><p>Because vehicles have special characteristics, such as shiny paint. It is always better to check what is the best color space that could give the optimum result in extracting features and identifying each image. The feature extraction is applied on both, cars image dataset and non cars image dataset and after this they are saved in two arrays. Then SVM is applied and the accuracy of the new trained classifier is calculated.</p><p>No we are able to identify car images. The next step is to be able to find the car in an image that contains multiple objects. An easy way to do this is to slide a window of specific size across the image and search if there is a car inside it. The best efficient way to do this is to extract the HOG features for the whole image and then subsampling the image and search for cars. To make sure that the detected objects are cars, it is better to create windows of different sizes. This would increase the probability of detecting a car. In other words, a car would be detected multiple times whereas a non car object would be detected once. This would help remove all unwanted objects. These are called false positives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ep88PaRlhVhohKF3wRulOw.png" /><figcaption>False positives (left) vs. Cars successfully detected by different windows (right)</figcaption></figure><p>If you can see the shadow of the tree in the image made the software think there is the car right there. Eliminating false positives would help increase the accuracy of the software and will only keep objects that are detected by multiple windows. This is done by applying a heat-map to the classifier that adds heat to each pixel that is inside the window. Heat will increase where multiple windows are found and will stay the same where only one window exists. This is used in the pipeline to get rid of all false positives.</p><p>To have a look on the report of the project please click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8dXIwd3FNWjE5ZVU"><strong>here</strong></a>. And also click <a href="https://drive.google.com/open?id=0BzYT14AYWSA8OG90UUxicTBkQkk"><strong>here</strong></a> to check the pipeline.</p><p>Below is the video of the result i could get:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzsUtfhNBUeI&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzsUtfhNBUeI&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ffc9fb482adec4d3e055dfc9ee99a2c2/href">https://medium.com/media/ffc9fb482adec4d3e055dfc9ee99a2c2/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d36b011f300" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/what-i-have-learned-from-the-first-term-of-udacity-self-driving-car-nanodegree-program-7d36b011f300">What i have learned from the first term of Udacity Self driving car nanodegree program.</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>