The proposal of the double carbon goal in China has developed its renewable energy on a large scale and rapidly increased the installed capacity of its photovoltaic (PV) power stations. The reliability of PV modules, as the core of PV power generation, affects the safety and stability of the whole system. At present, the fault diagnosis and location technology of PV modules has high cost, low efficiency, and low accuracy. This study proposed a real-time fault diagnosis of PV modules for integrated energy systems based on YOLOv7. The infrared images of PV modules in distributed PV power stations were obtained using drone cruise photography, and the fault points in the infrared images were identified and marked by training the YOLOv7 network. Compared with the traditional SSD and Faster-RCNN models, YOLOv7 not only ensures the accuracy of fault diagnosis but also greatly improves the detection speed of the model as demonstrated through actual data verification. The average accuracy reaches 95.4%, and the recall rate is 97.8%. The infrared image processing speeds are increased by 30.8% and 42.8%. Compared with traditional detection methods, the proposed method can achieve real-time fault diagnosis and play a greater role in the practical application of large-scale PV power stations.