Car damage assessment

Transfer learning with pretrained blocks

Save training time and create well-performing models with small datasets. Sounds good?
This tutorial will teach you how.

By using transfer learning with our pretrained blocks, you can create a well-performing model even though you have a small dataset. You will do what your insurance company does, build a model that classifies damages.

Person - Target audience: Beginners

You will learn to
Peltarion logo - Build a new AI model quick and easy.
Peltarion logo - Use a pretrained model in a classification problem.


Create project

First, click New project to create a project. Name it, so you know what kind of project it is. Naming is important.

New project button

A project combines all of the steps in solving a problem, from preprocessing of datasets to model building, evaluation, and deployment. Using projects makes it easy to collaborate with others.


Add dataset to the project

After creating the project, you will be taken to the Datasets view, where you can import data.

Click the Import free datasets button.

Import free datasets button

Look for the Car damage - tutorial data dataset in the list. Click on it to get more information.

If you agree with the license, click Accept and import.

This will import the dataset in your project, and you can now edit it.

The car damage dataset

The car damage dataset contains approximately 1,500 unique RGB images with the dimensions 224 x 224 pixels, and is split into a training- and a validation subset.

Classes

The illustration show sample images from the various classes in the dataset. Note that the unknown class contains images of cars that are in either pristine or wrecked condition.

Each collected image represents one car with one specific type of damage. This means that the dataset can be used to solve a single-label classification problem.

Example images from each class
Figure 1. Example images from each class; Broken headlamp, Broken tail lamp, Glass shatter, Door scratch, Door dent, Bumper dent, Bumper scratch, Unknown

Keep the default values

Keep these default values that are shown here in the Datasets view. They’re all set for this project.
Later you can change the subsets split, feature encoding, and more. If you want to dig deeper into all the things you see in this view, you should navigate to the Datasets view articles in the Knowledge center.

Click Use in new experiment to open the Experiment wizard.

Use in new experiment button

Build a model in the Experiment wizard

Name the experiment in the Experiment wizard.

  • Dataset tab
    Make sure that the Car Damage dataset with subset is selected.

  • Inputs / target tab
    Select image as Input feature and class as Target feature.

  • 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

Run experiment

Before you run the experiment, click the Settings tab and change the Learning rate to 0.0005.

Now, everything is set up, so just click Run.

Run button

Analyze the experiment

Navigate to the Predictions inspection tab in the Datasets view.
Since the model solves a classification problem, a confusion matrix is displayed. The top-left to bottom-right diagonal shows correct predictions. Everything outside this diagonal are errors.
It looks good!

Confusion matrix
Figure 2. Model evaluation — Normalized confusion matrix

Note that metrics are based on the validation subset, which only consists of 10% of the original dataset.


Deploy the trained model

In the Evaluation view, click Create deployment.

Create deployment button

Select experiment and checkpoint.

Click Enable to deploy the experiment. You can now call your deployed experiment with your own product using the Url and Token. For example, when you build your own app with Bubble.

Make the deployment public

Toggle the switch to make your deployment public. This will allow you to share your results with friends and colleagues on, e.g., with the link, Twitter, LinkedIn.

Private to public

Test with deployment web app

We’ve also made it super easy for you to test the deployment.

Click on Open web app, and you will be directed to the Deployment web app.

Now, you just need an image to test. Try to download this image of a seriously damaged car or take your own photo.

Damaged car
Figure 3. Seriously damaged window. Photo by Prateek Katyal on Pexels.

Add the image to the app and click Get your result.

Result? Yes, the model prediction is glass_shatter.


Tutorial recap

Using transfer learning with pretrained weights, you have saved hours of training time and created a better performance than would have been possible if you had trained the model from scratch.


Was this page helpful?
YesNo