Road Line detection using python deep learning
Project detail
i want a python code that can detect how many roads line exists on a random image for example the middle, right, and left line of a highway, by using CNN on a dataset of images and its labels(middle, left, right shown on the image) where 80% of the images are used for training and the remaining 20% are used for testing. We should then pass the model to CNN and check its accuracy.
In case the image entered shows a 2 ways road, the code should predict that there are two lines: left and right. If the image shows 4 ways the code should also predict 4 ways: left, middle left, middle right, and right.
In case the image entered is showing a railway, or a runway, the code should write “misprediction” on the image.
Results: we need to compare the actual labels of each image vs their predictions to visualize the accuracy of our model.
A confusion matrix should be shown.
PS: if you couldn’t find a dataset with its labels you need to input a dataset preprocess it to have then the labels(middle, left, right) on each image of the dataset for the training to be done properly.
1. Prepare the dataset with labels for training and testing: To prepare the dataset, you can use the following steps: a. Collect a set of images that contain different types of road lines, such as highways, streets, etc. b. Label each image with the corresponding number and type of road lines present in it, such as “2-way road” with left, middle and right lane, “3-way road” with “highway middle left”, “highway left”, “highway right” and “highway middle right” a “4-way road” with “highway left”, “highway right”, “highway middle”, “highway middle right”, “highway middle left”. Split the dataset into training and testing sets, with 80% of the images used for training and 20% for testing.
2. Build a CNN model to classify the images based on the presence of road lines.
3. Train the model using the prepared dataset: You can train the model using the fit() method of the Sequential class.
4. Evaluate the trained model’s accuracy on the test dataset: You can evaluate the model’s accuracy using the evaluate() method of the Sequential class.
5. Write a code to detect and predict the number of road lines on a given image
6. Compare the actual labels of each image vs their predictions to visualize the accuracy of the model: You can visualize the accuracy of the model by comparing the predicted and actual labels of the images in the test dataset.
7. Create a confusion matrix to summarize the classification performance