Abstract In order to ensure the timely detection of safety hazards in overhead transmission lines with railroad conductors and improve the accuracy of night insulator defect detection, this paper proposes the DP-YOLOv5 algorithm with dark and light channel enhancement optimization. It improves the night insulator image quality by introducing the dark and light channel enhancement algorithm, builds a lightweight network by combining the DP-BS module, and adds the Shuffle Attention module to enhance the feature extraction and ensure detection accuracy. At the same time, the EC-Loss loss function is used to optimize the prediction frame adjustment, accelerate the model convergence, and improve detection efficiency and accuracy. The simulation results show that the accuracy of DP-YOLOv5 is 95.3%, the recall is 94.8%, the average accuracy is 95.5%, and the FLOPs are 219.3. Compared with YOLOv5, the mapped value is improved by 0.9%, the F1 is improved by 1%, and the model parameter and FLOPs are reduced by 48.8% and 50.8%, respectively.