This paper is based on the YOLO series of object detection models. By increasing the depth of the network and integrating a dense network structure, the training performance of the model is improved. Additionally, improvements are made to the NMS algorithm by using a decreasing function to adjust the probability scores of adjacent detection boxes, effectively retaining valid detection results with weaker confidence. An adaptive weighted averaging method is introduced for preprocessing infrared images of main equipment in substations, and experiments on anomaly detection of infrared images of main equipment in substations are conducted on this dataset. The proposed algorithm effectively extracts infrared image features of different substation equipment using convolutional layers. The model converges within 40 iterations for coordinate loss, confidence loss, and classification loss. The Soft-NMS algorithm used in the model achieves good redundancy removal, with infrared image anomaly detection accuracy, recall rate, mAP 0.5, and F1 score values of 94.53%, 96.38%, 94.01%, and 95.45%, respectively. The average fault detection rate and early warning accuracy of the improved method are 93.65% and 90.56%, respectively, significantly higher than those of the comparison method. In the identification of ground faults and two-pole short-circuit faults, the anomaly detection accuracy error of this method is within 3%. The experimental results fully demonstrate the practical value of the method proposed in this paper.