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.

Person - Target audience: Beginners
Clock - Estimated Time: - 15 minutes
Spaceship - Tutorial type: Learn AI & platform
Bell - Problem type: Image classification

You will learn to
Peltarion logo - Build a new AI model quickly and easily.
Peltarion logo - 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.

  1. Log in to Kaggle.

  2. Navigate to the Road damage dataset.

  3. 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.

Example images from each class
Figure 1. Example of images from each class: Good, Satisfactory, Poor, and Very Poor

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.

New project button

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.

Upload button

Name the dataset, for example, Road dataset, and click Done.

Change name of the features

Now, click the wrench icon Wrench. 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

Wrench icon
Figure 2. Wrench icon to change the settings

Keep the rest of the default values.

Click Use in new experiment to open the Experiment wizard.

Use in new experiment button

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.

  • Dataset tab
    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.

Create button

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.

Run button

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.

Prediction inspection

Switch to the Predictions inspection tab to inspect the confusion matrix. It shows you how many predictions were correct and where the model struggled to define the correct label.

Deploy the trained model

Click Create deployment.

Create deployment button

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.

Deployment API
Figure 3. URL and token for a deployed model. Keep the token safe.

Enable deployment for requests

To allow you to send the prediction results from the platform to your application.

  1. 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.

  2. Click Enable.

Enable button

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.

Road in a very poor condition
Figure 4. Road in a very poor condition. Photo from Depositphotos

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.

Tutorial recap

In this tutorial, you have learned:

  • Where to find data

  • How to upload data to the platform

  • How to build an image classification model

Next steps

Further reading

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.

Was this page helpful?