In view of the characteristics of complex action types and large action ranges in the normal operation of many people in the operation environment of deep foundation pits in electric power, and the problems of missing detection and misdetection of small targets are easy to occur in the process of conventional target detection, a method is proposed to add SE attention module to the backbone network, which can improve the degree of attention to the target by adjusting the weight of channel features adaptively. And use GIoU instead of default CIoU to calculate regression box losses. The experimental simulation shows that when the intersection ratio threshold of the improved algorithm is 0.5, the average precision of the improved algorithm is 1.3% higher than that of the YOLOv5s algorithm. These improved measures are used in the complex environment of electric power deep foundation pit operation, especially when the detection target and the background color are confused. It is helpful to improve the performance and robustness of target detection algorithm and reduce the occurrence of missing and false detection.