Intelligent power equipment identification model based on grid topology analysis

. With the continuous development of the power grid, power equipment becomes more complex and diverse, which has increased the workload of power maintenance personnel. This paper proposes a method of intelligent identification of distribution network equipment to reduce the power maintenance personnel's workload. The model needs device photos, GPS coordinates, and device topology information of the entire power grid to infer the possible situation of the current device. The model is mainly divided into two parts: target recognition and equipment prediction. In target recognition, we propose a Self-attention target detection network (SA-TDN) that combines Faster-RCNN and Attention mechanism. In equipment prediction part, we use KD-Tree to analyse the grid topology to predict the real identification of the device. We compared this model with other convolutional neural networks (CNN) classification models. The results show that our model is ahead of current models in prediction accuracy.


Introduction
How to quickly and accurately know equipment-related information during the overhaul and maintenance of power distribution network equipment is an important part of efficient and safe operation and maintenance. At present, there are not many researches on smart identification of power grid equipment. Due to the marketization of the power system, its structure is complicated and the equipment is numerous [1], the intelligent identification of electrical equipment becomes extremely urgent. In the identification of electrical equipment, there are Optical Character Recognition (OCR) identification equipment nameplate [2], image recognition equipment [3] and other methods. The mainstream is to use target detection to identify. But target detection and identification equipment cannot achieve intelligent identification of electrical equipment, because it cannot uniquely identify the equipment. In the field of grid topology analysis [4], methods such as search for useful graphs and calculation of incidence matrix are studied. This paper proposed a new power equipment prediction algorithm. It included a selfattention target detection network (SA-TDN) that combines Faster Region-based Convolutional Neural Networks (Faster-RCNN) and Attention mechanism, and a topology analysis method based on K-dimensional tree (KD-Tree) to predict the real identification of equipment. The entire recognition model is divided into target detection (SA-TDN) and device prediction. The target detection part detects the input picture to obtain the type of device in the picture, and identify the device and the charged area. According to the topology of the power grid, the target recognition part predicts and outputs the identification of equipment. In addition, our model can also be applied to other related fields.
In the first part, this paper introduces the current research status of electrical equipment identification, and puts forward our research scheme. The second part introduces the related theory of the identification direction of electrical equipment. The third part mainly introduces SA-TDN scheme, the fourth part describes the performance of SA-TDN and experimental comparison. The fifth part summarizes the content of this paper.

Faster-RCNN
In order to speed up the detection, after R-CNN [5] and Fast-RCNN [6], Faster-RCNN [7] is proposed. Structurally, the selective search and Edge Boxes methods in Fast-RCNN are removed, and the region proposal network (RPN) is used to replace them. Fast-RCNN spends most of the time on the extraction of candidate regions during testing. It is also the main difference from Faster-RCNN. Faster-RCNN is mainly composed of Conv layers, RoI pooling, Region Proposal Network, classification and regression layers. It can be considered that the overall structure of Faster-RCNN is the integration of RPN and Fast-RCNN.

Network topology analysis
The grid topology diagram contains a lot of nodes and devices, as well as the relationship between them, and topology analysis is to convert this physical relationship model into an equivalent mathematical relationship model. In order to analyse the grid topology data more accurately, a combination of numerical calculation and artificial intelligence can be used. In numerical operations, methods such as effective topology method, tree search method, hierarchical search and data structure association table are often used [8]. In analysing the current operating status of the power grid and the current equipment management methods, the data that can be used are the device ID and the device GPS. With the current mature image recognition technology, electrical equipment and the live area on it can be easily identified, and the current equipment can be estimated through GPS coordinates and grid topology ID. The attention mechanism is to screen out information that is more important to the current task goal from the mass information. In this work, we introduce an attention mechanism CBAM proposed by Woo S [9] et al. Its model is shown in Figure 1. CBAM stands for the attention mechanism module of the convolution module. It is an attention module that combines spaces and channels. The feature map output by the channel attention mechanism module is used as the input feature map of the spatial attention mechanism module. Then, the output result of this spatial attention mechanism and the output result of the channel attention mechanism are multiplied to obtain the final generated features.

Intelligent identification model
The goal of our model is to confirm the device through images and GPS geographic location, as well as related information on the device, such as the charged area of the device. The input data required by the model includes equipment images, GPS data, and grid topology data. The output is equipment-related information and images with equipment and related areas marked. The entire model structure is shown in Figure 2. The model is divided into two parts: 1) Target recognition (SA-TDN): This part detects the picture of the input model to get the category of the device in the picture, and the picture that identifies the device and the charged areas. 2) Equipment prediction: The input of this part is GPS coordinates, grid topology, and the type of equipment output by the target recognition part, and the output is the predicted equipment ID.

Target recognition part
The design task of target recognition is to solve the classification of the target area on the input image. SA-TDN is a Faster-RCNN neural network combined with CBAM. Through training the network, it has the ability to recognize the device area and the charged area on the device. Its structure is shown in Figure 3:

Self-Attention target detection network
In this work, we use the alternate training method, first train the regional proposal network, then train the Fast-RCNN network again, and then use the parameters of the trained CNN network as the initial parameters of the region suggestion network again. Train the region suggestion network, and finally train Fast-RCNN again. The recognition process of the RPN is divided into two parts. One part uses softmax to classify anchors to obtain negative and positive classifications, while removing out of range and too small [8]. The loss function used in training is shown in Formula 1.
In Formula (1), i is the anchors index, � � is the positive softmax probability, and � � * is the probability of GT predict. If the Intersection over Union (IoU) between the i-th anchor and GT is > 0.7, then the anchor is positive, � � = 1; On the contrary, when IoU < 0.3, the anchor is considered negative, � � = 0, and those anchors with 0.3 < IoU < 0.7 will not participate in training, � is the predict bounding box, � � is the GT box corresponding to the positive anchor [8].
The entire loss function is divided into two parts: 1) The classification loss part is used in the process of training the network to classify anchors. 2) The regression loss part is used in training the bounding box regression network.

Convolutional block attention module
For the features generated by VGG16, our model will use CBAM to calculate feature mapping and attention mapping from the two dimensions of channel and space. Then the model multiplies the attention map with the input feature map to perform adaptive learning of features.
First, the channel attention feature map is multiplied by the input feature map to obtain � � , and then the spatial attention feature map of � � is calculated. And multiply the two to get the final output � �� . The calculation process of the channel attention module is shown: The spatial attention module uses ReLU as the activation function, which is different from the channel attention module. The spatial attention module mainly focuses on location features, and its calculation process is shown in Equation 6: � � * � represents a 7*7 convolutional layer. The main network architecture is a channel attention module and another spatial attention module. CBAM integrates a channel attention module and a spatial attention module to obtain the image feature area of interest.

Joint training
The training of the model is an alternate process. Its purpose is to train the common network part of the region suggestion network, CBAM and Faster-RCNN. Compared with the end-toend training method, this training method can improve the recognition accuracy of the network. The detailed steps are as follows: 1) Only train the regional suggestion network, and use the parameters in the pre-training model as the initial parameters of the network. 2) Only train the detection network and use the proposal obtained in the previous step as input.
3) Continue to train the regional suggestion network, keep the common parameters unchanged, and update only the unique parameters of the regional suggestion network. 4) Train the detection network again, keep the common parameters unchanged, and only update the parameters unique to the detection network.

Equipment prediction part
This part is to predict the real ID that the device belongs to. The input is the tag value of GPS coordinates, grid topology and target recognition input. In order to predict the equipment, it is necessary to analyse, simplify and process the input grid network data [10] [11]. The grid topology analysis in this paper is mainly concerned with the way of association between devices, and the possible device ID can be estimated by virtue of the relationship between the devices.
The topological structure of the power grid contains abstract representations of various electrical equipment, components and lines [12]. In this paper, components will be removed, leaving electrical equipment, and the lines between them are the relationship between the devices [4]. In the analysis of the grid topology, the nodes are dynamic, and the change of the circuit breaker status will not change the node, but will affect the equivalent node, which will change with the change of the circuit breaker state [13]. Therefore, the topology analysis of the power grid generally includes two steps: 1) Equivalent node analysis. 2) Analysis of electrical islands. The grid topology is shown in Figure 4: Through the comparison, the structure becomes clearer after the grid topology is processed. In order to quickly search for associated nodes based on GPS, it is necessary to establish a quick index for each node in the network after topology analysis. In the processed network, each node is an electrical device, and the data contained in the node include id, type, longitude, latitude, parent-node and next-node.
In order to facilitate the identification of adjacent nodes in the network according to the input latitude and longitude, each node needs to be indexed according to the latitude and longitude. The model uses KD-Tree to build the index (K-dimensional tree) [14]. Our method is as follows: 1) According to the depth of the tree, determine the axis used as the split surface.
2) The points put into the subtree are distinguished by the median of the axis coordinates of the vertical dividing plane.
The above method generates a balanced tree. The overall height of the tree is very close, and a certain subtree will not be very deep. When searching for nodes in the tree, the nearest neighbor search method is used. In this paper, the nearest neighbor query is used, taking into account the recognition speed of the entire model. By using the kd-tree model, the corresponding node can be quickly located in the network according to the GPS coordinates of the input model. When searching for surrounding nodes, search within a certain range, and calculate the GPS coordinates of surrounding nodes with the input GPS coordinates to obtain an Euclidean distance. The model will determine whether to discard this point according to a distance threshold. Finally, the searched nodes are sorted according to the Euclidean distance from the input GPS coordinates from small to large, and then the results are returned.

Preparation and training
In this paper, 836 images of electrical equipment are selected as the original dataset. It includes 500 KV transformer, potential transformer, circuit breaker, disconnect switch and lightning arrester. Image pre-processing and dataset enhancement are carried out in this paper by means of random flipping, rotation and zoom changing of original ratio. The number of dataset has reached 3344 after processing. The next step is to label the dataset. We use LabelImg software for image labeling and labels can be added at the same time, and according to different images generates the corresponding annotation file. The training data format includes picture ID, X value in the upper left corner, Y value in the upper left corner, X value in the lower right corner, Y value in the lower right corner, and tag ID. The format of data is shown in Figure 5. The entire trained strategy is to read the data one by one from the file storing the training data, and scale the picture so that the longest side length is 300 pixels, then send it to the SA-TDN for learning. The whole training is iterated a total of 40 times. The specific implementation of the model refers to the Faster-RCNN paper, and the initial model parameter values are the original default values. Through the continuous loop iteration of training, the overall loss rate continues to decrease, and the training ends when it reaches a stable level. The change of each reference value during training is shown in Figure 6.

Model test and comparing
In the test part, model receive the test picture one by one from the test dataset and then sent to the SA-TDN. The input picture needs to go through a network combined by VGG-16, CBAM and RPN to complete the detection and recognition of the target area. In order to improve the detection speed, it is also necessary to scale the input picture. The classification information output by the region suggestion network and the region of interest are further processed, which includes regression and classification, and then the classification result is obtained. Finally, the classification results and regional coordinate information are output. The output of the model is: �� 'transformer � , 98.84,16,16,320,272�� It is represented by label, probability, X value in the upper left corner of the area where the target object is located, Y value in the upper left corner of the area where the target object is located, X value in the lower right corner of the area where the target object is located, and Y value in the lower right corner of the area where the target object is located. The recognition result is shown in Figure 7, where the left is the original image, and the right is the result image with the recognition frame. The strategy of pre-trained classification model in this paper is also applicable to other general visual pre-training models. In this paper, we use four representative CNN models to replace SA-TDN as the Target Recognition part for testing. They are VGG16, VGG19, ResNet-50 and Inception-V3. The experimental results are shown in Table 1.
The results show that our method can realize the image classification of five kinds of electrical equipment. Compared with other models, our method has higher accuracy. The effect of VGG-16 without attention mechanism is much lower than the version with CBAM. This proves the effectiveness of classification models combined with CBAM in image classification. To compare the performance of SA-NET, we used four different target recognition models for experiments. They are SSD300, YOLO-V2, Faster-RCNN(VGG16) and Faster-RCNN(ResNet-50). We use mean Average Precision (mAP) to evaluate model performance. Table 2 shows that SA-TDN can achieve the best performance in our power image dataset. With the addition of CBAM, SA-TDN has a 3.12% performance improvement compared to Faster-RCNN(VGG-16). This result once again illustrates the effectiveness of the attention mechanism applied to target recognition. The performance of YOLO-V2 model is slightly weaker than SA-TDN, but it also has faster calculation speed.

Conclusion
Our work implements an intelligent identification model for distribution network equipment, and propose a new self-attention target recognition network, which predicts distribution equipment through images, GPS coordinates and the topology of the distribution network equipment. We use Faster-RCNN combine with CBAM to identify the power distribution equipment in the image, and identify the type of equipment in the picture and the charged area on the equipment. Then, we have analysed the distribution network topology structure and infer the equipment information in distribution network topology. However, the stability of the model in the paper is not good enough. The lack of large amounts of device data is one reason. The algorithm of equipment speculation in the model is too single, which is also the cause of unstable prediction. In order to improve the stability of the model work, it is also necessary to improve the relevant algorithms.