Car damage detection using Mask Regional Convolution Neural Network
- In this project I have developed a software that was able to detect four types of vehicle damages namely, Scratch, Dent, Dislocation and Shatter. Also I have provided a tentative repair cost for the type of damage detected. I have developed a website using Flask framework. Front end of the website is built using Bootstrap software.
- Automation is the next step in the automobile industry, and a software which is able to detect and localize damage in the car has various real world applications. In the software I have used Mask Regional Convolutional Network which is at the pinnacle of image detection techniques. Due to the complexity of the task I have used transfer learning to develop the software in three stages. Each stage added a new layer of complexity to the task, this helped the software prioritize learning the current task. I had also used Image Augmentation, which helped the model to not over fit the training data.
- Stage 1: https://www.kaggle.com/eashankaushik/car-damage-detectionstage1
- Stage 2: https://www.kaggle.com/eashankaushik/car-damage-detectionstage2
- Stage 3: https://www.kaggle.com/eashankaushik/car-damage-detection
For model training check out my medium post https://medium.com/analytics-vidhya/implement-your-own-mask-rcnn-model-65c994a0175d
- Stage 1- In stage 1, I trained the model on 'Damage' class and, used images annotated with bounding boxes.
- Stage 2- In this stage training was done using four classes: damage-1 (scratch), damage-2 (dent), damage-3 (shatter) and damage-4(dislocation), in this stage I used images annotated with bounding boxes as well.
- Stage 3- Stage 3 used images annotated with polygons, and four classes namely Scratch, Dent, Shatter and Dislocation.
- You can use the following hyper parameter values to train your model. I found these values to give the best results.
- Put your_trained_weights.m5 file in the model directory.
- Change line #22 in app/utils.py to the name of the weights of your model.
- Run main.py file and the website will be hosted on http://127.0.0.1:5000/. Following are the URL rules I developed, you can add or delete these rules according to your preference.
app.add_url_rule('/base','base',views.base)
app.add_url_rule('/','index',views.index)
app.add_url_rule('/damageapp','damageapp',views.damageapp)
app.add_url_rule('/damageapp/damage','damage',views.damage,methods=['GET','POST'])
If you don’t want to use cost assessment functionality, just change cost_for_damage variable on line #45 of app/views.py to False. Cost assessment functionality is just for visual purposes and computes cost based on size of mask to size of image ratio.
[1] matterport/Mask_RCNN. (2021). Retrieved 1 January 2021, from https://github.com/matterport/Mask_RCNN
Connect with me on linkedin if you have some doubts regarding the training and deployment of the project.