Car damage assessment
Transfer learning with a pretrained snippet
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 snippets, 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.
- Target audience: Beginners
You will learn to
- Build a new AI model quick and easy.
- Use a pretrained model in a classification problem.
First, click New project to create a project. Name it, so you know what kind of project it is. Naming is important.
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 Data library button and 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 will be taken to the dataset’s details where you can edit features and subsets.
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.
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 a 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.
Create subsets of the car damage dataset
The subset column, containing a T or a V, indicates if the row should be used for training or validation. The split between training and validation data is approximately 80% and 10% (there is a 10% test set as well that you won’t use). This column was created during the preprocessing of the raw data.
Even though it is possible to use the default subsets created by the platform when you upload the data, it is more advantageous to create a conditional split based on the subset column.
Click New subset and name the training subset Training set split.
Select Add conditional filter and set:
Feature to subset
Operator to is equal to
Value to T.
Click Create subset.
Repeat the procedure. Name the new subset Validation set split.
Feature to subset
Operator to is equal to
Value to V.
Save the dataset
Click Save version and click Use in new experiment.
Build a model in the Experiment wizard
Name the experiment in the Experiment wizard.
Make sure that the Car Damage dataset is selected.
Change Subset to standalone subsets
Set Validation set split for Validation subset, and Training set split for Training subset.
Input(s) / Target tab
Select image as Input feature and class as Target feature.
Select the EfficientNet B0 snippet.
Select ImageNet for pretrained data.
Click Create, and the EfficientNet B0 blocks will be added to the Modeling canvas.
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.
Analyze the experiment
Navigate to the Evaluation 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 is errors.
Note that metrics are based on the validation subset which only consists of 10% of the original dataset.
Click the dropdown next to Cells and select Percentage. The normalized values that are now displayed correspond to the recall for each class.
The recall values clearly indicate that the model has learned the features in the images.
Deploy the trained model
In the Deployment view click New deployment and select experiment and checkpoint.
Click the Enable switch 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.
Test with Peltarion API tester
We’ve also made it super easy for you to test the deployment. Click on Test deployment, and you will be directed to our Image & Text Classifier - API tester.
All info from your deployment is prepopulated (token, URL, Input parameter).
You just need an image to test. Try to download this image of a seriously damaged car or take your own photo.
Add the photo to the bottom left corner and then click the Play button.
Result? Yes, the model predictied prediction is glass_shatter.
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.