Aiming at the shortage of intelligent inspection such as daily maintenance and defect detection of high-voltage power insulators in complex background environment, an algorithm for detection and identification of power insulators in complex background environment is proposed. Firstly, this paper addresses the problem of high false detection rate of similar insulators in YOLOv5 algorithm by adding a channel module to improve the focus of the algorithm on the target features and adding a spatial attention parallel module to obtain insulator location information; then, to address the issue of multiple defect targets, a suppression algorithm based on area ratio is proposed , and by using improvement measures based on loss function and post-processing further the screen defect prediction boxes is used also. Finally, for the problem of missing insulators due to complex background occlusion, CIoU Loss regression loss is used in the detector. Experimental tests show that the proposed algorithm not only solves the problems of false detection of similar objects and missed detection of occluded insulators, but also improves the accuracy and speed of the model, with the accuracy mAP and inference speed of 0.886 and 65.2 FPS, respectively, which are 11.4 and 5.8 FPS higher than the traditional YOLOv5 classical algorithm.