# Enhanced Detection of Subway Insulator Defects Based on Improved YOLOv5
## 5 Discussion  
This study introduces an enhanced, lightweight algorithm for insulator detection and defect identification based on a modified YOLOv5 framework, addressing the challenges posed by limited sample availability and validating the algorithm's efficacy in real-world conditions. Initially, a detailed model reflecting the specific network structure and dimensions of subway lines is established, facilitating the generation of artificial samples, including both intact and damaged insulators, to mitigate sample scarcity. Addressing the need for sample equilibrium, the study advocates for a BL function, allocating distinct weights to positive, negative, and particularly challenging samples throughout the training phase, thereby augmenting the model's sensitivity to positive and hard-to-identify samples. Furthermore, the algorithm innovates by restructuring YOLOv5's backbone network into GhostNet, enabling more streamlined feature extraction from input images. During the feature fusion phase, the algorithm employs depth-wise separable convolution to optimize the computational efficiency while integrating the ECA-Net attention mechanism, ensuring that critical information is effectively discerned. To equip the model for performance in foggy conditions, the dataset undergoes fog simulation processing. Experimental results indicate that the proposed modifications enhance the mAP from 95.46% to 96.57%, reduce the model size from 15 MB to 9 MB, and boost the detection speed from 30 FPS to 90 FPS in experimental settings, compared to the original YOLOv5 framework. In real-world applications, the mAP witnesses an approximate 2.5 pp increase, demonstrating the practicality of utilizing experimentally derived datasets for real-world detection tasks. Since it is difficult to obtain an insulator defect dataset in real scenarios, the effectiveness of this paper's  
Figure 10: Comparative detection performance of different models in real-world scenarios (red box denotes insulator): (**a**) YOLOv5; (**b**) YOLOv5-GhostNet-ECA.  
method in detecting defects needs to be further tested. The developed algorithm fulfills the accuracy and velocity criteria necessary for insulator defect detection in inspection vehicles, exhibits adaptability to diverse inspection environments, and is suitable for real-time deployment on inspection vehicles. Future investigations will extend to the recognition of other insulator anomalies, including pollution and flashover occurrences.  
Conceptualization, L.H., W.W. and Z.H.; methodology, L.H.; software, L.H.; validation, L.H. and Y.L.; formal analysis, L.H.; investigation, L.H.; resources, W.W. and Z.H.; data curation, L.H. and Y.L.; writing--original draft preparation, L.H.; writing--review and editing, L.H. and W.W.; visualization, L.H.; supervision, W.W. and Z.H.; project administration, W.W. and Z.H.; funding acquisition, Z.H. All authors have read and agreed to the published version of the manuscript.  
This research was funded by the project 'Intelligent Inspection Vehicle for Contact Grid Suspension Devices', grant number: H220781.  
Not applicable.  
Dataset is available at GitHub at: [[https://github.com/[PERSON]/YOLOv5--GhostNet--ECA](https://github.com/[PERSON]/YOLOv5--GhostNet--ECA)]([https://github.com/[PERSON]/YOLOv5--GhostNet--ECA](https://github.com/[PERSON]/YOLOv5--GhostNet--ECA)), accessed on 1 December 2023.  
Author [PERSON] was employed by the company ZKROT Technology Co., Ltd. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.