# Automated Car Damage Assessment Using Computer Vision: Insurance Company Use Case
## 3 Methodology
### Selected Models  
In [4], the DCN+ model is used to locate and mask vehicle damage, but this model has inference times of 12 s in a production environment, which is too slow to be supported in our setting. The DETR-type models [40; 41] have recently stood out for their high performance in detecting objects; however, they have high inference times and are currently not suitable for a production environment.  
For this reason, we approach damage verification using a fast and robust detector. In this case, we have chosen YOLOv5 as our base detector, as it has inference times from 45 to 766 ms on CPU ([[https://github.com/ultralytics/yolov5](https://github.com/ultralytics/yolov5)]([https://github.com/ultralytics/yolov5](https://github.com/ultralytics/yolov5)), accessed on 25 September 2024), and its performance is usually close to its variants, such as all of the latest YOLO versions, from v6 to v8 on general character datasets. On our vehicle damage datasets, YOLOv8 gives superior performance in terms of AUC and mAP compared to YOLOv5; however, the false positive rate is higher with respect to YOLOv5. For this reason, we focused on training YOLOv5, which has been trained on the COCO dataset [42] as a base detector.  
The YOLOv5 framework allows for fine-tuning of the model in different depths such as YOLOv5n (1.9 million parameters), YOLOv5s (7.2 million parameters), YOLOv5m (21.2 million parameters), YOLOv5l (46.5 million parameters), and YOLOv5x (46.7 million parameters). Although the differences between the previous models include the depth of the network and its number of parameters, we have found that we can take advantage of the joint inference of the aforementioned models because the behavior of each model varies enough with respect to the other models to locate new damage. However, they usually maintain similar predictions, allowing them to reinforce the presence of possible damage. The variability in the predictions can be seen in Figure 2. For this reason, we have chosen to train YOLOv5 from version n to x, with input sizes of (640 \(\times\) 480) and (1280 \(\times\) 960).  
For each YOLO-type model, we define the hyperparameters as indicated in Table 1, highlighting the most important ones.  
We start with the basic data augmentation settings, such as the use of horizontal flips, changing the image saturation, scale changes, and the application of the mosaic method, which increases the diversity of the training set and improves the robustness of the model.  
\begin{table}
\begin{tabular}{l c} \hline \hline
**Hyperparameters** & **Values** \\ \hline Initial lr (lr0) & 0.01 \\ Final lr (lrf) & 0.01 \\ Weight decay & 0.0005 \\ Warmup bias lr & 0.1 \\ Mosaic & 1 \\ Flip left–right & 0.5 \\ \hline \hline \end{tabular}
\end{table}
Table 1: YOLOv5 hyperparameters (lr stands for learning rate).  
Figure 1: General scheme of our proposal for efficient damage detection.  
We were able to identify that the YOLOv5x, YOLOv5l, and YOLOv5s models achieved a balance between the number of correct predictions and false positives by adjusting their confidence values. This allowed us to generate more balanced interactions when interacting with other models.  
To obtain an optimal number of models and avoid increasing inference times, we used the PSO algorithm [43] to perform a search and limit the number of models to be used. We defined the PSO inertia values at c1 = 2, c2 = 2, and w = 0.9 based on the work presented in [44].As a first step, we performed several rounds of training, varying the input image resolution and the size of the YOLOv5 model dimensions. Then, we performed several tests using PSO and all the trained models, varying the minimum number of predictions to discard false positives. Starting from 12 models and varying the PSO parameters, we managed to reduce the number of models to 10, providing a balance between precision and recall.