# Multizone Leak Detection Method for Metal Hose Based on YOLOv5 and OMD-ViBe Algorithm
## 3 Experiment and Results
### Experimental Results
#### 3.2.2 Bubble Recognition Based on OMD-ViBe  
To find suitable values for the parameters \(\alpha\), \(\beta\) and \(\gamma\), the image set with bubbles in 1000 frames under 0.4 Mpa pressure was extracted as the dataset for the optimization parameters of the particle swarm optimization algorithm (PSO), and the image frames with bubbles in the data were selected to calculate the results of the improved ViBe algorithm and the image frames using the F-measure values. The 1000 frames were used to find the optimal values of \(\alpha\), \(\beta\) and \(\gamma\). The particle swarm algorithm had 50 iterations and a population of 10, and the parameters \(\alpha\), \(\beta\) and \(\gamma\) were optimized within [0.05,0.3]. The F-measure value was a combination of accuracy and recall, which was the target of the calculation and better reflects the comprehensive evaluation of the image algorithm. Finally, \(\alpha\) = 0.188, \(\beta\) = 0.05 and \(\gamma\) = 0.05 were used as the optimized parameter values. The F-measure value obtained according to the PSO algorithm was 83.97%, as can be seen in Figure 7.  
Figure 6: YOLOv5 training results. Table 1 presents the results of comparing OMD-ViBe with other algorithms after the particle swarm optimization algorithm was applied. After the accuracy, recall, F-measure and error rate were evaluated, it was evident that the OMD-ViBe algorithm outperformed ViBe in terms of F-measure and PWC, with an improvement of 4.33% and 0.049%, respectively. These findings demonstrate that the proposed OMD-ViBe algorithm in this paper represents a significant advancement in computing dynamic thresholds using the parameter values obtained through the particle swarm optimization algorithm for optimization. To validate the efficacy of the parameters obtained from the optimization of 1000 frames in enhancing ViBe, tests were conducted on 8000 additional frames of data, which were divided into 8 intervals using every 1000 frames. The results, including the average accuracy, recall, F-measure and PWC, are presented in Table 2. The findings indicate that the approach proposed in this paper provided an improvement in the F-measure for the test dataset as compared to the other algorithms. In Figure 8, leak detection bubbles are denoted by red boxes in the diagram. When bubbles leak, the background subtraction algorithm recognizes the bubbles as former points \begin{table}
\begin{tabular}{c c c c c} \hline
**Algorithm** & **Precision** & **Recall** & **F-Measure** & **PWC** \\ \hline ViBe & 72.84\% & 87.87\% & 79.64\% & 0.113\% \\ GMM & 68.33\% & 87.88\% & 76.88\% & 0.096\% \\ DPPratMediod [30] & 74.53\% & 79.17\% & 76.78\% & 0.111\% \\ PBAS [31] & 61.89\% & 97.65\% & 75.77\% & 0.165\% \\ KNN & 74.53\% & 79.17\% & 76.78\% & 0.111\% \\ ViBeImp [32] & 86.17\% & 78.54\% & 82.18\% & 0.084\% \\ SigmaDelta & 56.69\% & 98.59\% & 71.28\% & 0.201\% \\ Adaptive Background Learning & 51.74\% & 97.30\% & 67.56\% & 0.246\% \\ Our method & 80.88\% & 87.31\% & 83.97\% & 0.081\% \\ \hline \end{tabular}
\end{table} 
Table 1: Algorithm comparison results of 1000 frames. \begin{table}
\begin{tabular}{c c c c c} \hline
**Algorithm** & **Precision** & **Recall** & **F-Measure** & **PWC** \\ \hline ViBe & 81.64\% & 66.01\% & 71.12\% & 0.08\% \\ GMM & 68.49\% & 66.48\% & 60.58\% & 0.12\% \\ DPPratMediod & 73.57\% & 85.10\% & 77.99\% & 0.08\% \\ PBAS & 62.64\% & 93.78\% & 73.21\% & 0.12\% \\ KNN & 66.48\% & 94.64\% & 76.85\% & 0.010\% \\ ViBeImp & 61.14\% & 66.75\% & 61.46\% & 0.11\% \\ SigmaDelta & 56.99\% & 97.08\% & 70.33\% & 0.15\% \\ Adaptive Background Learning & 59.22\% & 94.94\% & 71.43\% & 0.14\% \\ Our method & 85.47\% & 77.18\% & 81.11\% & 0.05\% \\ \hline \end{tabular}
\end{table} 
Table 2: Algorithm average test results. Figure 7: PSO iteration result. of interest to distinguish them from nonbubble background points. To make it easier to compare the leak detection results of each image recognition algorithm, a local comparison is used as an intuitive way to compare the algorithms.