Research on grounding grid corrosion classification method based on convolutional neural network

. Aiming at the problem that the traditional detection methods can not accurately classify the corrosion degree of grounding grids. The corrosion image is taken as the research object , the convolution neural network is used as the algorithm firstly to classify the corrosion degree. Firstly, the corrosion simulation experiment was carried out, and the sample library was established by using the corrosion image collected in different stages. Then, according to the LeNet-5 model , the traditional CNN and improved CNN models were designed for corrosion classification of grounding grid. Simulation experiments were carried out in the preprocessed samples. Finally, the experimental results of Soft-max and SVM classifier are compared and analyzed. The results show: the classification results of the two models were better than those of the original samples, and the classification performance of SVM is better than that of Soft-max. The improved model can improve classification accuracy. This study fills the blank of detecting the corrosion degree of grounding grid by image method, and it is significant to quickly grasp the corrosion degree to avoid faults or accidents.


Introduction
Grounding grid is the necessary facilities for substation grounding, and it is the key to ensure the electrical equipment, power system and personal safety.The grounding material of domestic commonly used steel, burying in soil medium underground complex, corrosion will be gradually deepened, eventually led to the loss of grounding function even ruptured, causing a series of grounding accidents.Therefore, accurate understanding of the corrosion of grounding grid, timely detection of problems and take corresponding measures, is very important for the safe operation of the power system.
In order to ensure the normal operation of the grounding grid, it is necessary to take effective measures to detect the corrosion state of the grounding grid.But the grounding conductor is buried in the soil all the year round, so it is very expensive and difficult to operate when the corrosion condition is checked [1][2][3].Based on this, this paper first proposes the grounding grid corrosion image as the research object, and uses convolutional neural network as the research algorithm to classify the corrosion degree of the grounding grid.

Classification basis of grounding grid corrosion 2.1 Classification criteria of corrosion degree
This paper, the corrosion grade of grounding grid is evaluated by subjectively according to the national standard GB/T6461-2002 "rating of specimens and specimens after corrosion test on metal substrate and other inorganic covering layer".Table 1 is the corrosion appearance rating corresponding to the corrosion appearance features given in the standard.
Table 1.Representation of appearance rating.
The subjective evaluation of the extent of corrosion damage in the standard can be divided into four categories: VS is very mild, S is mild, M is moderate, X is severe, and the appearance rating number from A to I indicates that the degree of corrosion is from light to heavy.According to the features of corrosion degrees in the standard on the corrosion image samples plus artificial participation classification label, the appearance ratings in the A and B as a very mild corrosion, C, D, E as mild corrosion, F, G as moderate corrosion， H， I as severe corrosion.
Very mild and mild corrosion condition, grounding grid can work normally only routine monitoring; moderate to increase monitoring efforts, and make timely rectification; severe corrosion case, watch out for the grounding accidents, to immediately repair [7].

Establishment of corrosion image sample library
Carbon steel is widely used in grounding grid materials in China, and the corrosion problem is relatively serious.In the simulation experiment of grounding grid corrosion, a carbon steel plate is buried in the soil with depth of 0.8m, and the relatively complex environment.The corrosion image information is collected at different time.There is not a relatively complete system of grounding grid corrosion image database in the existing literature, and create a real grounding grid corrosion image database needs years of research and accumulation.
The image cutting method is used to expand the sample of corrosion image data [4].The specific cutting method is the use of PhotoShop image processing software, each pretreatment of the corrosion image size normalization, become a number of 32*32 small square image as the input of the network, and the principle of shear is maximum range preserving image corrosion feature information.Through the above treatment, we can build a sample library containing four kinds of image with different corrosion degree, each of 2500 kinds.The pretreatment samples are shown in Figure 1.

Brief introduction of CNN
Convolutional neural network contains four basic structure layers, which are input layer, output layer, convolution layer and sampling layer [5].In CNN, the convolutional layer and the sampling layer are alternately connected, and the feature is extracted by the convolution layer, reducing the dimension by the sampling layer , in order to reduce the complexity of the model and improve the convergence speed of the network.

1) Input and output layer design
In the traditional CNN model, the size of each image in the sample library is 32*32, stored in the pixel form of the whole picture 32*32=1024 in the data file, and the whole pixel is used as the input of the network.
According to the standard GB/T6461-2002, the corrosion images can be divided into four categories: very mild corrosion, mild corrosion, moderate corrosion, severe corrosion, so the output layer of the network is set to 4 neuron nodes. 2

) Intermediate layer design
The traditional CNN classification model is to improve the existing problems of LeNet-5 network, mainly from the following aspects: a) The maximum sampling method is selected.Based on the nonlinear principle of maximum sampling, the sampled images are divided into non overlapping regions.The pixel is the basic unit for segmentation, and the output value is the largest pixel value in each rectangle area.
b) Using Soft-max and SVM[6] instead of radial basis functions.This paper chooses Soft-max and SVM as the classifier model CNN to achieve better classification effect.
Soft-max regression has achieved good results in solving multi classification problems.A training sample {(x (1) ,y (1) ),(x (2) ,y (2) )…(x (m) ,y (m) )} is made up of M images with class labels, this paper, k=4 is used to classify the corrosion degree of grounding grids.
For training sample x, the probability value p(y=j/x) is estimated by using the assumed function for each category j That is, the probability that the sample x is assigned to each classification result is estimated.Suppose that the function h θ (x) can be expressed as (1) Among them,θ 1 ,θ 2 ,…,θ k ∈R n+1 , are the parameters of the model, the fractional part is normalized.
The cost function can be expressed as: In Soft-max regression, the probability of classifying sample X into category j is: (3) The support vector machine (SVM) method is based on the limited sample information to find the best compromise between the complexity of the model and learning ability [7].To construct hyperplane in high dimensional feature space, and then transform nonlinear classification into linear classification problem, that is, the following optimization problems: The Lagrange function is introduced to solve convex optimization problems.
The α i ,γ i ,≥0,i=1,…l, α i ,γ i are Lagrange multipliers.The extreme value of function L should satisfy the condition: (8) c) Increase the number of convolution kernels of the stacking layer.In addition, the next layer feature map with convolution kernel size determined by a convolution kernel is w×w, stride=k filter, to a new image (n h ×n w ) convolution processing, new feature map size (n h -w+k)k×(n w -w+k)k.
d) Adding Dropout to F5 layer.The basic idea of Dropout is that the activation value of some neurons is output to 0 by the probability P, and the P is set to 0.5.

Model establishment
Through the above improvements, two traditional CNN models, CNN-Soft-max and CNN-SVM are formed, and the model structure is shown in Figure 2.

Model training a) Training process
The CNN training method is supervised training.When the model is convergent, the optimal input and output functions can be obtained by preserving the optimal parameters learned.The training process of the network is shown in figure 3.
The CNN training process is the same as the traditional BP, including two stages.The first stage is the forward propagation stage: (a) Select a tagged image sample (x, t) from the training set and send the image into the network.
(b) The corresponding actual output y is calculated.
In the first stage, the tagged image starts from the input and transforms layers by layer to extract the feature and reduce the dimension.Then the final extracted feature is sent to the classification layer to output.This process is the forward calculation of each layer weight and activation value: The second stage, back propagation stage: (a) Calculate the difference between the output y of the model and the corresponding ideal output, that is, the label value t.
(b) The error is transmitted back, and the update weight parameter is adjusted according to the minimization error Network initialization.CNN network initialization is the initialization of the relevant parameters, the main work is to roll layer, output layer weights and bias of the initialization parameter settings, DeepLearnToolbox toolbox for the random initialization of weights.
Learning rate.The learning rate (learning_rate, represented by alpha) is proportional to the training speed of the network.When the alpha is larger, the training speed of the network can be accelerated, but the convergence is poor.On the contrary, the network stability is good, but it will fall into local optimization to a great extent.The setting of learning rate is usually adjusted by experience and adjusted according to the actual training situation.The improved CNN model as shown in Figure 4, the left is a traditional CNN model (2-CNN), the difference is the improved model of ReLU using the activation function, ReLU function is an activation function in recent years deep learning fields commonly used the mathematical form of f(x)=max(0,x).On the right is a 3 layer network volume (3-CNN), Pad=1 said in a circle around the map feature extraction to ensure zero, more features, the model contains two different topologies of CNN parameters, save two CNN minimum error after the end of the model training.Two kinds of different network topology can learn and extract the corrosion characteristics of more abundant, the better generalization performance.
Model training, the training image input the 2-CNN and 3-CNN, in the connection layer respectively output 512 one-dimensional feature vector, the feature vector stitching two get 512 dimensional a 1024 dimensional feature vector as the classification model of Soft-max and SVM input, to get a training class of higher performance, generalization ability the stronger CNN classification model.
The training set and test set are also generated by MATLAB code of traditional model, and the training method and initialization parameter setting are the same as the traditional model.

Training set and test set generation
MATLAB loads the input image from the mat format database, so first the image sample set is converted into mat data format.Input conversion code to convert.Jpg format image data in the database to mat format files in the file editor, and add to the image classification label, and random selection of 80% of the total sample as the training set and test set as 20%.Table 2 gives partial image samples of.Mat format generated by MATLAB, and adds classified labels.The classified label values are set to [0 0 0 1], [0 0 1 0], [0 1 0 0], [1 0 0 0], which represent four kinds of image data, very mild corrosion, mild corrosion, moderate corrosion, and severe corrosion, respectively.

Simulation experiment
The overall block diagram of algorithm simulation is shown in Figure 5.The simulation process mainly consists of two parts: training phase and testing phase, the former loading training set update parameters through the back-propagation algorithm, the end of the training save model parameters; test stage test data will be fed to the trained model, the results is given, and record the accuracy.Figure 6 is the test results of the traditional CNN-SVM on some test sets, in which the abscissa is the sample number of the test set, and the ordinate is the corresponding classification label (drawing 1, 2, 3, 4 as the class labels).In order to observe the classification results, experiment selected 80 test samples of the mapping, it is shown that, the 80 test samples, the traditional model and improved model in the pretreatment samples were 13, 6 sample classification error.

Conclusion
This paper, the relative advanced depth learning convolutional neural network is applied to image recognition of grounding grid corrosion degree.The improved CNN model has higher classification accuracy than the traditional CNN model, and the improved CNN-SVM model has better classification effect.Compared with the traditional detection methods of corrosion, corrosion of the image recording is more realistic, and this study fills the blank of detecting the corrosion degree of grounding grid by image method, and provides a new research idea for the research and application of related fields.At the same time, it is of great significance to quickly grasp the corrosion degree of grounding grid to avoid faults or accidents.

Figure 3 .
Figure 3. Training flow chart b) Setting training parameters In this paper, the implementation of convolutional neural network is mainly based on the MATLAB Deep Learning toolbox DeepLearn Toolbox.Network initialization.CNN network initialization is the initialization of the relevant parameters, the main work is to roll layer, output layer weights and bias of the initialization parameter settings, DeepLearnToolbox toolbox for the random initialization of weights.Learning rate.The learning rate (learning_rate, represented by alpha) is proportional to the training speed of the network.When the alpha is larger, the training speed of the network can be accelerated, but the convergence is poor.On the contrary, the network stability is good, but it will fall into local optimization to a great extent.The setting of learning rate is usually adjusted by experience and adjusted according to the actual training situation.(c)Convergence condition.The iterative method is used to train the network, and the training model is stopped when the error is not obvious after the continuous epoch times batchsize (batch training), and the model parameters are preserved when the minimum classification error is obtained.The number of epoch batch training can be set according to the actual situation.(d)Parameter setting in simulation process.The parameter settings in the MATLAB simulation process are as follows:options.epochs=50,options.batchsize= 20, options.alpha= 1e-1,options.momentum=0.95,

Figure 4 .
Figure 3. Training flow chart b) Setting training parameters In this paper, the implementation of convolutional neural network is mainly based on the MATLAB Deep Learning toolbox DeepLearn Toolbox.Network initialization.CNN network initialization is the initialization of the relevant parameters, the main work is to roll layer, output layer weights and bias of the initialization parameter settings, DeepLearnToolbox toolbox for the random initialization of weights.Learning rate.The learning rate (learning_rate, represented by alpha) is proportional to the training speed of the network.When the alpha is larger, the training speed of the network can be accelerated, but the convergence is poor.On the contrary, the network stability is good, but it will fall into local optimization to a great extent.The setting of learning rate is usually adjusted by experience and adjusted according to the actual training situation.(c)Convergence condition.The iterative method is used to train the network, and the training model is stopped when the error is not obvious after the continuous epoch times batchsize (batch training), and the model parameters are preserved when the minimum classification error is obtained.The number of epoch batch training can be set according to the actual situation.(d)Parameter setting in simulation process.The parameter settings in the MATLAB simulation process are as follows:options.epochs=50,options.batchsize= 20, options.alpha= 1e-1,options.momentum=0.95,

Figure 5 .Figure 7 .
Figure 5.The overall block diagram of algorithm simulation