Pot Hole Detection on the roads using Transfer Learning (Resnet 50)
Abstract
As we all know how pot holes play a role in causing most of the minor and some major accidents actors the globe, having potholes on the roads are very dangerous in any climate, since it can cause a very serious damage to vehicle’s and even the drivers which can make the vehicle fall apart and causing serious injuries. So, here is a pot hole detection project which allows us to solve the problem of avoiding potholes where the model which we have generated using transfer learning i.e., Resnet50 is used to detect whether there are any pot holes or not on the roads, this Pot Hole Detection model can be integrated with autopilot vehicle modes which allows the vehicle to avoid potholes.
Code Description & Execution
Algorithm Description
Resnet is a Transfer learning algorithm which is mainly known as Residual Neural Networks which helps us to solve the problem of vanishing gradients/exploding gradient descents which arises while training a neural network. Resnet50 is a 50-layer deep neural network using around 150+ layers to dig deep into the hole for the extensive training. The major breakthrough of this network is since the vanishing and exploding gradient descent problem occurs in a typical neural network due to concept of backpropagation for adjusting weights and bias, so in order to rectify this the authors have introduced this Residual network which uses Skip Connection solve the above problem.
How to Execute?
Make sure you have checked the add to path tick boxes while installing python, anaconda.
Refer to this link, if you are just starting and want to know how to install anaconda.
If you already have anaconda and want to check on how to create anaconda environment, refer to this article set up jupyter notebook. You can skip the article if you have knowledge of installing anaconda, setting up environment and installing requirements.txt
- Install the prerequisites/software’s required to execute the code from reading the above blog which is provided in the link above.
- Press windows key and type in anaconda prompt a terminal opens up.
- Before executing the code, we need to create a specific environment which allows us to install the required libraries necessary for our project.
- Type conda create -name “env_name”, e.g.: conda create -name project_1
- Type conda activate “env_name, e.g.: conda activate project_1
- Go to the directory where your requirement.txt file is present.
- cd <>. E.g., If my file is in d drive, then
- d:
7.cd d:\License-Plate-Recognition–main #CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE
8. If your project is in c drive, you can ignore step 5 and go with step 6
9. g., cd C:\Users\Hi\License-Plate-Recognition-main
10. CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE
11. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.)
12. To run .py file make sure you are in the anaconda terminal with the anaconda path being set as your executable file/folder is being saved. Then type python main.pyin the terminal, before running open the main.py and make sure to change the path of the dataset.
13. Run main_resnet50.ipynb and make sure to change the path where your executable files are located and also the model path in the code, please follow the link on how to install and set up anaconda environment to execute file
14. If you would like to run .ipynb file, Please follow the link to setup and open jupyter notebook, You will be redirected to the local server there you can select which ever .ipynb file you’d like to run and click on it and execute each cell one by one by pressing shift+enter.
Please follow the above links on how to install and set up anaconda environment to execute files.
Data Description
The dataset used in this pot hole detection project was collected form the Kaggle data repository which is basically a hub for data scientists and all the enthusiasts who wants to do some exciting things with data. The dataset is basically divided into 2 classes, normal roads and roads with potholes. The data was already labelled and segregated into normal roads and pothole roads where each class consisting of about 350 normal road images and 329 pothole roads.
Final Results
Normal Road
Pothole Road
Issues you may face while executing the code
- We might face an issue while installing specific libraries.
- Make sure you have the latest version of python, since sometimes it might cause version mismatch.
- Adding path to environment variables in order to run python files and anaconda environment in code editor, specifically in visual studio code.
- Refer to the Below link to get more details on installing python and anaconda and how to configure it.
- Loading an understanding the transfer learning concept might be tricky at the start. Please refer to the algorithm description to learn more about transfer learning.