Abstract Due to various mechanical and electrical stresses caused by changes in environmental and power load conditions, insulators may fail, resulting in serious economic losses. Manual cleaning of insulators is subject to weather and environmental constraints and poses significant safety risks. Traditional insulator detection methods have problems such as slow detection speed and poor robustness. Therefore, this paper proposes a real-time insulator detection algorithm based on the improved YOLOv7. First, in order to effectively streamline the number of parameters, Dense-YOLOv7 adopts the dense connection concept of DenseNet to design DenseBlock. Second, replacing the loss function with Focal Loss to solve the problem of unbalanced matching of foreground and background sample quantities has improved the detection accuracy of the model. Finally, to address the issue of PReLU and LeakyReLU activation functions being insensitive to spatial information, the activation function is replaced with FReLU to improve the robustness of the model. The experimental dataset used in this paper is a combination of the Chinese Power Transmission Line Insulator Dataset (CPTLID) and our own dataset. The experimental results show that the improved algorithm in this paper has only 44.23 M parameters and a detection speed of 44.87 FPS, which is 4.8% less than that of YOLOv7 and 8.14% quicker than that of YOLOv7. Experimental results show that Dense-YOLOv7 can significantly streamline the model parameter size while maintaining high accuracy and effectively improve the detection speed, which can meet the application requirements of real-time insulator detection.