## 1 Introduction  
Due to lightning, equipment failure and other problems, abnormal currents in substations may increase rapidly. At such times, the buried grounding grid provides a discharge channel for those abnormal currents. At the same time, the grounding grid also serves as a common grounding point for primary and secondary equipment in the substation to ensure the safety of the equipment [1]. In high-voltage substations and power systems, most of the grounding grid materials used are galvanized flat steel or round steel, which are prone to corrosion or fracture to varying degrees, posing a great threat to the safe operation of the power system [2, 3]. Traditional detection methods generally require the substation to shut down, and then it is excavated to find the branches of the grounding grid that are corroded or broken. The whole process is cumbersome, the measurement is complex and blind, and it also affects the normal operation of the power system [4]. Electrical impedance tomography (EIT) is one of the main methods for non-invasive detection of grounding grids. It can reconstruct the on-site image of the grounding grid without large-scale excavation [5]. In recent years, many scholars have applied EIT technology to the field of grounding grid corrosion diagnosis and have made certain progress, but it still cannot intuitively display the corrosion status of the grounding grid [6; 7]. References [8; 9] have achieved good imaging results by optimizing the iterative algorithm of grounding grid impedance imaging, but they cannot accurately display the degree of corrosion. At present, the EIT inverse problem reconstruction algorithm based on deep learning has been widely studied and has shown its unique advantages in large-scale nonlinear reconstruction. The problem solved has a high degree of nonlinearity and it is solved with a fast solution speed thanks to easy access to simulation training datasets [10; 11; 12]. In the research on grounding grid corrosion imaging, reference [13] proposed a transient electromagnetic method for grounding grid detection using artificial neural networks to perform resistivity imaging, providing fast and accurate calculation capabilities. Reference [14] used laser-induced breakdown spectroscopy (LIBS) combined with machine learning to evaluate the degree of grounding grid corrosion, improving the accuracy of predicting the degree of corrosion. Reference [15] developed a multi-point synchronous temporary grounding wire detection device based on convolutional neural networks to accurately classify the corrosion status of the grounding grid. Most current studies use intelligent algorithms combined with electromagnetic imaging or electrical network theory to image the grounding grid [16; 17; 18]. The contribution of this paper is to demonstrate the application of impedance imaging theory combined with deep learning algorithms to image the grounding grid, which improves the precision and accuracy of grounding grid corrosion detection, and promote further research on impedance imaging of grounding grids. Compared with traditional methods and other deep learning models, CGAN performs better in dealing with noise and nonlinearity, resulting in more accurate and stable corrosion pattern reconstruction [19; 20; 21]. The CGAN is able to learn the complex mapping between the measured voltage and the conductivity distribution from large-scale simulation data. Therefore, this paper proposes a grounding grid electrical impedance imaging method based on an improved CGAN, to improve the precision and accuracy of grounding grid corrosion detection. First, a grounding grid simulation model is established, and the boundary voltage is obtained by solving the forward problem. Then, an improved CGAN algorithm is designed, and the boundary voltage value is input for grounding grid electrical impedance imaging. The generator of this method mainly consists of four modules: the preprocessing module, encoder module, decoder module and attention module.