# DScanNet: Packaging Defect Detection Algorithm Based on Selective State Space Models
## 5 Experiments
### Experimental Analysis  
We used the same experimental setup to train the two models before and after the improvement, respectively. The specific performance metrics are shown in Table 2.  
The experimental results show that the improved DScanNet algorithm improves the detection precision by 4.3 percentage points compared to the original YOLOv5 algorithm, the detection speed reaches 97.1 FPS, and the number of parameters and computation amount also decrease significantly. Overall, DScanNet's model is lighter, requires less computational resources, is easier to deploy, and can realize the accurate and real-time detection requirements in real detection scenarios. In addition, the DScanNet algorithm was able to improve its detection precision with a 2.9 percentage point increase in recall, which means that fewer defective samples were missed, while not introducing more false detections (false positives) due to the increase in recall. This suggests that the algorithm is able to improve its sensitivity to defects while still maintaining better discrimination. In order to further compare the model performance of DScanNet and YOLOv5, we compared the [EMAIL_ADDRESS] and [EMAIL_ADDRESS]:0.95 variations between the two. Since there is often uncertainty in the target boundary in the actual defect detection scenario, it is more practical to adopt the evaluation standard of an IoU threshold of 0.5. That is, if there is a 50% overlap between the prediction box and the real target, the target is considered to have been detected. This index can objectively reflect the recognition ability of the model when it tolerates a certain positioning error, which is more in line with the needs of actual industrial inspection scenarios. The [EMAIL_ADDRESS]:0.95 is the average accuracy of the average calculation using the threshold from 0.5 to 0.95 in 0.05 steps, considering the different overlap degrees, which is more comprehensive and accurate [33]. As shown in Figure 7, in the early stage of training, the [EMAIL_ADDRESS] values of both models rise rapidly, indicating that both models are learning data features quickly. In the middle stage, DScanNet rises more steadily, and YOLOv5 is more volatile and less stable. In the later stage, both models tend to be stable, but the improved DScanNet model fluctuates relatively less, and the model shows a more stable convergence trend and significant stability, and [EMAIL_ADDRESS] also reaches 95.1%, which is 2% higher than the original YOLOv5 model. Overall, the [EMAIL_ADDRESS] of most rounds of DScanNet is higher. This indicates that under the same training conditions, the DScanNet model has better learning ability to learn the key features in the dataset. This gives DScanNet better performance in defect detection task. As shown in Figure 8, DScanNet consistently outperforms YOLOv5. DScanNet rose rapidly at [EMAIL_ADDRESS]:0.95 in the early stage, fluctuating in a small range, but quickly stabilized at a higher level. Although YOLOv5 has improved in the early stage, the overall accuracy is lower than that of DScanNet, and the fluctuations are relatively more obvious. DScanNet is even more advantageous when it comes to packaging defect detection tasks. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Algorithm** & **Precision** & **Recall** & \
\begin{tabular}{c} **mAP** \\ **@0.5** \\ \end{tabular} &
\begin{tabular}{c} **mAP** \\ **@0.5** \\ \end{tabular} & **FPS** & **Param (M)** & **FLOPs (B)** \\ \hline YOLOv5 & 92.5 & 91.7 & 93.1 & 61.3 & 83.1 & 7.02 & 16.1 \\
**DScanNet** & **96.8** & **94.6** & **95.1** & **66.1** & **97.1** & **3.68** & **9.4** \\ \hline \hline \end{tabular} Note: Bold values indicate the best performance.  
\end{table} 
Table 2: Specific performance comparison of the model before and after improvement. Figures 9 and 10 show the detection results of YOLOv5 and DScanNet, respectively.