## 1 Introduction
[32] predicted the instance-level masks for each insulator object presented from the RoI align layer. However, minor local changes in complex image targets, such as partial occlusion, could result in image segmentation or edge extraction failure, leading to inefficiency and weak robustness in multi-stage segmentation networks. Besides, due to multiple iterations, they exhibit high time complexity, which does not meet the requirements for real-time segmentation during insulator inspections. Due to the complexity of working conditions and the enormous computational cost of multi-stage segmentation algorithms, current methods for insulator surface defect detection and segmentation still face some challenges in practical applications [33]. As illustrated in Table 1, signal analysis methods shine for their versatility in detecting various surface defects, but they suffer from low robustness and slow inspection speeds. Traditional image processing methods have shown certain capabilities in inspection speed and robustness, yet they still harbor limitations. Deep learning methods, however, represent the cutting edge in insulator defect detection. Despite their high computational resource demands, their robust performance and rapid inspection speeds make them the most promising approach currently available. Therefore, how to balance the accuracy and speed of power facility inspection is a problem worth studying. To sum up, this paper proposes an insulator surface defect detection and segmentation model based on the You Only Look Once (YOLO) v5 model, incorporating self-attention and transformation techniques, named HST-Net. It replaces the original backbone network with a transformer cross-stage partial (Transformer CSP) network, enhancing its ability to capture information across different depth feature maps. It particularly focuses on complex insulator surface defect types and degrees, as real-world insulator surfaces often suffer from issues such as lighting angles, environmental factors, and occlusion, causing defects to appear unobvious or incomplete. Furthermore, an insulator defect segmentation head network is proposed for segmenting defect regions such as insulator loss and flashover. This approach assists in achieving instance-level mask prediction for each insulator object, greatly reducing the impact of complex backgrounds. Additionally, HST-Net is based on a single-stage detection segmentation network, reducing model complexity and computational and storage resources, thus accelerating model training and detection. This effectively resolves the contradiction between speed and accuracy in traditional insulator defect detection methods. The main novelties and contributions of the proposed model are as follows. We introduce a novel Transformer-CSP as the backbone, which, enriched with a self-attention module, achieves superior feature reuse and gradient information retention. A new insulator defect segmentation head network is proposed, effectively enhancing the precision of defect region segmentation, thereby reducing the impact of complex backgrounds. Comparative experiments demonstrate that the proposed method outperforms existing models in accuracy and robustness, notably in high-altitude insulator equipment detection, signifying an optimal balance between accuracy and speed.