Lane Detection using Machine Learning

Published on . Written by

Lane Detection using Machine Learning

Machine Learning is everywhere. Nowadays, automatic driving cars are into action and being used by lots of people. These automatic driving cars need something that can detect lanes or even moving objects. Here Machine Learning comes into action. Machine learning is used in medical science too. In this case, we will be using deep learning to detect lanes.

Read more..

SLNOTE

Skyfi Labs Projects
Objective:

The goal of the project is to detect lanes. Lane detection is a boon when the craze of automatic driving cars is increasing with passing days.

People can find lanes very easily, but computers struggle to find a lane in various weather conditions, like in snowy mornings or whether in a rainy evening or even on a dark night. 

Concepts Used:

  1. Basic of Python programming language (try using Python 3 or above)
  2. Basics of Machine learning algorithms
  3. Deep Learning (optional)
There are two approaches to doing this.

  1. Hough Transform
  2. Spatial CNN

SLLATEST
What is a Hough Transform?

Most of the lanes where you drive will notice they are very much straight. This helps drivers to drive cars smoothly and maintain an average speed. So here, we will first detect straight lanes. We will feed these straight lanes through the camera through edge detection and feature extraction. We have to use computer vision techniques here. For that, we will be using OpenCV here.

What is Spatial CNN?

This method works only if the road is straight. If the lane has some curvatures or turns, this method will not work.

Implementations:

1. The first and important thing that we need is data. This will help you to create your own dataset, that in turn will lead to an accurate model. You should create a large dataset. You can collect data from your own area. 

2. Set up the environment. Install all packages and libraries that you need. The code is given below.

pip install OpenCV-python

3. Feed your video (the data that you have collected).

Video = cv.VideoCapture(“input.mp4”)

4. Now you need to detect the edges of the lane. We will have to use the canny detector to detect any edges that are present in your input dataset.

5. Canny detector can do four things. i)Noise cancellation, ii) intensity gradient, iii)non-maximum suppression and iv) Hysteresis thresholding.

6. Now we have to segment the lane area. We will discard the parts that are not needed. This will help us to create a model that can detect the roads accurately. This will help us to narrow down the area of interest and work with the only part that we need.

7. We will apply Hough transformation to detect the left line and the right line. These are the two-lane boundaries.

8. Now we need to visualize our data. 

9. Now open the terminal and run your file. That’s it. You have successfully made a model that can detect lanes.

Conclusion:

This process includes many handcrafted processes. You can also use a spatial CNN model which is helpful too. 


SLDYK
Kit required to develop Lane Detection using Machine Learning:
Technologies you will learn by working on Lane Detection using Machine Learning:


Any Questions?


Subscribe for more project ideas