## 3 Inspection Robot Platform and Data Resources
### Loss Function and Evaluation Metrics  
SFA-YOLO employs specific loss functions and evaluation metrics to evaluate the effectiveness of the detection model and ensure robust performance under varying Intersection over Union (IoU) thresholds. These optimization strategies synergistically enhance the precision and generalization capability of SFA-YOLO in object detection tasks [12; 13; 14; 15; 16; 17; 18]. The loss function in object detection algorithms generally consists of the following components:  
1. Localization Loss \[L_{\text{loc}}=\sum_{i}\lambda_{\text{coord}}\bigg{[}1_{\text{obj}}\bigg{(} \bigg{(}x_{i}\cdot\hat{-x_{i}}\bigg{)}^{2}+\bigg{(}y_{i}-\hat{y_{i}}\bigg{)}^{ 2}+\bigg{(}w_{i}-\hat{w_{i}}\bigg{)}^{2}+\bigg{(}h_{i}-\hat{h_{i}}\bigg{)}^{2} \bigg{)}\bigg{]}\] (1)  
where \(\lambda_{\text{coord}}\) represents the indicator, and the four parameters of the bounding box: \(x_{i}\) and \(y_{i}\) denote the center coordinates, \(w_{i}\) denotes the width and \(h_{i}\) denotes the height. 2. Confidence Loss \[L_{\text{conf}}=\sum_{i}1_{\text{obj}}\bigg{(}C_{i}-\hat{C_{i}}\bigg{)}^{2}+ \lambda_{\text{noobj}}1_{\text{noobj}}\bigg{(}C_{i}-\hat{C_{i}}\bigg{)}^{2}\] (2)  
where \(C_{i}\) denotes the confidence score of the predicted bounding box, and \(\hat{C_{i}}\) represents the confidence score of the ground truth box. 3. Classification Loss \[L_{\text{cls}}=\sum_{i}1_{\text{obj}}\sum_{c}\big{(}P_{i,c}-\hat{P}_{i,c} \big{)}^{2}\] (3)  
where \(P_{i,c}\) denotes the predicted probability that the \(i\)-th bounding box belongs to class \(C\), while \(P_{i,c}\) represents the ground truth probability for the corresponding class. The evaluation metrics commonly used in object detection algorithms typically include the following components:  
1. Precision Curve The precision curve represents the proportion of correctly predicted positive samples among all samples predicted as positive. It is defined as follows: \[\text{Precision}=\frac{\text{True Positive (TP)}}{\text{True Positive (TP)}+\text{False Positive (FP)}}\] (4)  
Precision represents the accuracy of the model in detecting true objects. Many false positives (FP) can lead to low precision in object detection tasks. The precision of the SFA-YOLO model can be visualized using the precision (P) curve. A high precision indicates that the model effectively distinguishes true objects from background noise or false detections. 2. Recall Curve The recall curve represents the proportion of correctly identified positive samples relative to the total number of actual positive samples. It is defined as follows: \[\text{Recall}=\frac{\text{True Positive (TP)}}{\text{True Positive (TP)}+\text{False Negative (FN)}}\] (5)  
Recall represents the model's capability to detect all actual objects. The recall (R) curve helps reveal the comprehensiveness and robustness of the SFA-YOLO model in detection tasks. Particularly in scenarios involving complex backgrounds or small objects, evaluating the model's ability to comprehensively identify as many targets as possible is essential. F1 Score Curve  
The F1 score is the harmonic mean of precision and recall. It is defined as follows:  
\[\text{F1 Score}=2\cdot\frac{\text{Precision}\cdot\text{Recall}}{\text{ Precision}+\text{Recall}} \tag{6}\]  
The F1 score provides a comprehensive evaluation by considering both precision and recall. It is beneficial for imbalanced datasets or when false positives and negatives must be minimized. The F1 score curve demonstrates how the balance between precision and recall changes under different thresholds, offering insight into the overall performance of the SFA-YOLO model in complex detection tasks--especially where both precision and completeness are critical. Precision-Recall (PR) Curve:  
The PR curve illustrates the relationship between precision and recall at various confidence thresholds. Typically, recall is plotted on the x-axis and precision on the y-axis. This curve demonstrates the combined variation in precision and recall under different detection thresholds.