Assessing road quality
Use image classification to automatically and effectively analyze the road condition.
Have you tried a navigation app such as Waze that helps you monitor the situation on the roads? Imagine if it allows you to upload photos of damaged roads to attract the municipality’s attention to fix them. AI can evaluate the damages and suggest where the city hall needs to put its efforts first.
In this tutorial, you will learn how to train an image classification model. In the next connected tutorial, you will build your own mobile application by using a no-code tool and connecting it with the trained model from this tutorial.
- Target audience: Beginners
- Estimated Time: - 15 minutes
You will learn to
- Build a new AI model quickly and easily.
- Use a pretrained model in an image classification problem.
The road damage dataset
For this project, you will use the Road damage dataset from Kaggle. Kaggle is a good place to find datasets if you work with deep learning. It’s also a large data scientist community where you can take courses or participate in discussions. Having an account on Kaggle and being part of the community can help your projects.
The road damage dataset contains 2,074 unique RGB images, and it is split into four folders: good, poor, satisfactory, and very_poor.
Log in to Kaggle.
Navigate to the Road damage dataset.
Click Download to get the dataset zip file on your computer.
Each folder of images represents one specific condition of the road. That means that you can train the model to solve a single-label classification problem.
The data is clean and well-sorted, so there is no need to do additional manipulations with it.
Create a project
Now, when you have data to train your machine learning model, it’s time to create a project on the Peltarion Platform.
Log in to the Peltarion Platform and click New project to create a new one. Name it, so you can easily find it in the list of your projects.
Add dataset to the platform
You’re now in the Dataset view, where you import and manage your data.
Click the Upload file button or drag and drop the zip file that you downloaded from Kaggle.
Name the dataset, for example, Road dataset, and click Done.
Change name of the features
Now, click the wrench icon . Change the name of the features that you have in your dataset. Having good names on the features makes it easier to define input and output features later. Change :
category_1 to quality
data to photo
Keep the rest of the default values.
Click Use in new experiment to open the Experiment wizard.
It can take some time to analyze the data and start the Experiment wizard.
Create an experiment
The Experiment wizard makes it easy to create an experiment.
Name the experiment.
Make sure that the Road dataset is selected.
Inputs / target tab
Select: photo as Input quality as Target
Problem type tab
Select the Single-label image classification.
Single-label image classification is when a deep learning model predicts one class for each example.
Click Create, and all blocks needed will be added to the Modeling canvas.
Inspect model and run experiment
The wizard builds a model based on the EfficientNet pretrained block. Using pre-trained blocks allows you to save training time.
Out of curiosity, you dive deeper into the model:
Click on the Dense block. The number of nodes should match the number of classes in your target feature. In our case, 4 since we have four quality classes.
Click the Target block to check if the loss function is Categorical crossentropy.
It’s the most common loss for the single-label classification, where an example can only belong to one out of many possible categories.
It’s time to train the model!
Click Run. After starting the experiment, it takes a minute or two before you see the modeling process on the screen.
The whole training time will take some time. That’s the nature of deep learning.
Analyze the experiment
When the training is complete, check the main metrics in the Evaluation view to evaluate your model’s performance.
Loss and metrics
The Loss and metrics tab show the plot of the loss function with training and validation curves. The circles on the curves mark the Best epoch, number of the Experiment, validation, and training values.
Below the plot, check the accuracy, recall, precision, and F1-score values. The closer the values are to the 1, the better.
Deploy the trained model
Click Create deployment.
Select experiment and checkpoint, and click Create to deploy the experiment.
Now you can call your deployed experiment with your own product using the Url and Token. For example, when you build an AI application using Adalo and Zapier.
Enable deployment for requests
To allow you to send the prediction results from the platform to your application.
Change deployment settings from private to public.
When your deployment is public, you can use it without providing credentials.
But it also means that it is available to anyone with the URL.
Test with deployment web app
The last remaining step is to test the model you created.
Click Open web app, and you will be directed to the Deployment web app.
Download this image of the road to evaluate its condition and test the model.
Drag and drop the image into the Input field and click Get your result. You should get a very_poor result. That makes sense! The road should be fixed as soon as possible.
In this tutorial, you have learned:
Where to find data
How to upload data to the platform
How to build an image classification model
In the second part of the tutorial, you will use this model to create an AI-enabled mobile application. You don’t need to know how to write code because you will build the application with no-coding tools.
Sounds interesting? Then follow the AI application using Adalo and Zapier tutorial.