For national grid power line infrastructure construction construction, quality management and control can ensure improved safety standards, long-term reliability and cost savings through avoiding rework. In this paper, a high-definition image of a transmission line is collected from multiple viewpoints by a UAV, and a model for recognizing surface defects on infrastructure lines is proposed to reduce the computational complexity to improve the YOLOv8 algorithm. The model uses ResNet50 as the feature extraction backbone network and fuses convolution and attention mechanisms to enhance global and local feature extraction. A multi-scale feature aggregation diffusion module is added to the neck network of the model to enhance the detection of small targets on infrastructure lines. Finally, the classification loss function combined with the PIOU bounding box loss function is introduced to further enhance the recognition accuracy of infrastructure line surface defects. The experimental results show that the mAP of the infrastructure line surface defect recognition model is up to 0.935, which is 2.41% higher than that of the baseline model, and the performance is significantly better than that of some of the current mainstream defect recognition models. Therefore, from the computational complexity, combined with the target detection YOLOv8 algorithm can realize the accurate recognition of surface defects on infrastructure lines, and provide reliable data support for improving the timely repair of grid infrastructure lines.