Knowledge distillation-based lightweight global dependence network electric wire transmission line detection method and system
Through a lightweight global dependency network based on knowledge distillation, the application limitations of wire transmission line detection networks in pixel-level accuracy and complex weather conditions are solved, and efficient detection is achieved in small microcontrollers, improving detection accuracy and efficiency.
Patent Information
- Application Number
- CN202410912563.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-09
- Publication Date
- 2024-11-01
AI Technical Summary
The existing wire transmission line detection network has limitations in the application of infrared images under pixel-level accuracy and complex weather conditions, and the large number of network parameters, which leads to difficulty in deploying in small microcontrollers, affecting detection efficiency and accuracy.
Using a lightweight global dependency network based on knowledge distillation, multi-scale relational distillation, pixel comparison learning and bird visual mapping are performed through the student global dependency network and the teacher global dependency network, the characteristics of color images and heat maps are extracted, and the number of model parameters is reduced. Improve detection performance.
It achieves the accuracy and efficiency of wire transmission line detection under low parameters, is suitable for mobile devices, and enhances detection capabilities under complex conditions.
Smart Images

Figure CN118887176A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and more specifically to a method and system for detecting electric wire transmission lines based on a lightweight global dependency network of knowledge distillation. Background Art
[0002] Regular inspections are essential for the maintenance and fault diagnosis of electrical equipment in smart grids, especially for overhead transmission lines, which are located in remote areas and are extremely difficult to inspect. Traditionally, workers have to conduct manual inspections, which is time-consuming and laborious. Due to the complexity of purely manual operations, vision-based autonomous inspection systems have been gradually introduced in recent years, using drones to improve inspection efficiency and accessibility. Drones are usually equipped with optical or thermal cameras to collect images of power transmission lines, which can be analyzed by experts or vision-based transmission line detection systems. At the same time, in the field of computer vision, transmission line detection has received much attention, enabling drones to identify power transmission lines under harsh conditions, improving efficiency and eliminating the need for human pilots. This technology mainly relies on salient target detection and is applicable to various target recognition tasks.
[0003] Deep learning has been widely used in power transmission line detection due to its outstanding performance in visual tasks. Current convolutional neural networks are able to effectively classify the background and foreground areas of power transmission lines, while foreground areas are usually detected using rule-based algorithms. However, early power transmission line detection networks have certain limitations in terms of pixel-level accuracy, as they are often constrained by the fact that the prediction area units are limited to sub-regions or grid sizes. Recent studies have attempted to improve pixel-level performance by utilizing salient object detection networks, but few studies have considered the application of infrared images in power transmission line detection under complex weather conditions. In other related fields, such as depth estimation or urban scene segmentation, some studies have proposed network-level fusion methods, but these methods usually lack sufficient flexibility and cannot be applied to different types of backbone networks. In order to improve the accuracy of power transmission line detection, current networks mostly use encoding structures and combine multi-supervision, attention, pyramid, pre-training and other technologies to enhance detection capabilities. However, the introduction of these technologies may lead to an increase in the number of parameters of the network model, which may cause problems such as excessive load when embedded in a small single-chip microcomputer and used in practical applications. Therefore, in order to further improve the performance and applicability of transmission line inspection for electric wires, more flexible and efficient methods are needed to address these challenges.
[0004] At present, many multimodal fusion networks have emerged in the field of salient object detection. These methods usually use traditional attention mechanisms or simple meta-addition to fuse different modalities, but when the features are not properly aligned, it may lead to feature noise superposition and affect the detection effect. The current detection network is mainly divided into two types of architectures. The first is the encoder-decoder architecture, where the encoding layer gradually reduces the spatial dimension information through pooling and extracts abstract features, and the decoding layer gradually restores the object details and spatial dimension information. In the research, an effective fusion module is introduced between the encoding and decoding layers to help the decoding layer better restore the object details. The second architecture is the dilated convolution / void convolution, which removes the pooling layer and expands the receptive field through atrous convolution. In recent years, the development of these technologies has greatly promoted the research results in wire transmission lines. However, in practical deployment, the improvement of scene understanding methods is limited, especially in mobile devices, due to high computational cost and memory consumption. Although the current network can integrate color-thermal image (RGB-T) cues for sample fusion, it often does not fully utilize the complex correlation between the two image modes.
[0005] Therefore, how to improve the accuracy and efficiency of wire transmission line detection is an urgent problem that technicians in this field need to solve. Summary of the invention
[0006] In view of this, the present invention provides a light-weight global dependency network based knowledge distillation for detecting electric wire transmission lines and a system thereof to solve the problems in the background technology.
[0007] In order to achieve the above object, the present invention adopts the following technical solution:
[0008] On the one hand, the present invention discloses a method for detecting electric wire transmission lines based on a lightweight global dependency network of knowledge distillation, characterized in that the specific steps include:
[0009] Selecting original color images of electric wire transmission lines, heat maps corresponding to each original color image of electric wire transmission lines, and final result maps of saliency detection of the color images to form a training set and a validation set;
[0010] Construct a lightweight global dependency network, which includes a student global dependency network and a teacher global dependency network. Use a global information generator and a dependency relationship generator to divide network features into encoding and decoding parts, respectively. Consider all features of different scales in a unified manner, and use multi-scale relationship distillation, pixel contrast learning distillation, and bird vision mapping distillation to perform knowledge distillation. The teacher global dependency network obtains the final training model through the training set, and then tests the test set to detect the test results. After obtaining the optimal teacher training model, the optimal teacher training model is used to distill the student model to obtain the optimal student model.
[0011] The data set to be tested is input into the optimal student model and the optimal teacher training model, and the model network outputs the original power transmission line color map prediction map to obtain the prediction map set.
[0012] Preferably, in the above-mentioned light-weight global dependency network based on knowledge distillation for electric wire transmission line detection, both the teacher global dependency network and the student global dependency network utilize a global information generator to extract the global context information of the color image, and utilize a dependency generator to extract the dependency and weight information between pixels in the thermal image.
[0013] Preferably, in the above-mentioned light-weight global dependency network based on knowledge distillation for electric wire transmission line detection, the teacher global dependency network also includes a matrix cross-integrator that performs a series of effective evidence fusion operations on different information of the same scale, and fuses multiple outputs of the global information generator and the dependency generator into one information.
[0014] Preferably, in the above-mentioned light-weight global dependency network based on knowledge distillation, in the teacher global dependency network, the color image passes through the teacher backbone network one, the teacher backbone network two, the teacher backbone network three, and the teacher backbone network four in sequence, and the heat map also passes through the teacher backbone network one, the teacher backbone network two, the teacher backbone network three, and the teacher backbone network four in sequence; the color map and the heat map are respectively passed through the teacher backbone network to obtain feature maps of different scales; the color map corresponding to the vertical direction is output through the teacher backbone network, and enters the global information generator to obtain two outputs. Similarly, the heat map is also passed through the dependency generator. Two outputs will be obtained, and the four outputs at this time will pass through the matrix cross integrator; according to this step, the four matrix cross integrators will integrate the features of the color map and heat map of the same feature scale for subsequent processing; the four outputs obtained by the matrix cross integrator will enter the feature fusion device in order from large to small according to the number of channels, and finally the output one through the feature fusion device will use the result map for effective supervision; the three outputs obtained by the feature fusion device will pass through the decoder to obtain output two, output three and output four, and use the result map for effective supervision; finally, the sum of the losses of the four supervisions is the loss of the final teacher backbone network.
[0015] Preferably, in the above-mentioned light-weight global dependency network based knowledge distillation electric wire transmission line detection method, in the global information generator, the output of the color image is subjected to a Bayesian denoising process to obtain a Bayesian denoised color image R. b , and then the color map R b Input to convolution block 1 and activation function group to get output 6 R j , and then output six R jInput into the channel processing group consisting of adaptive average pooling, convolution block and activation function to obtain the channel processing color map R c , and the color map R j Input into the spatial processing consisting of convolution fast four and activation function three to obtain the spatial processing color map R s , and also use the color map R b After simple processing by convolution block 5, it is multiplied by itself according to the channel to obtain the color weight image R m , and finally output six R j , color weight image R m and color map R c , color map R s Multiplying together gives the output seven.
[0016] Preferably, in the above-mentioned light-weight global dependency network based knowledge distillation electric wire transmission line detection method, the dependency generator is used to extract the dependency in the heat map, and the features of the heat map obtained by the backbone network are input into the module, and firstly, the Bayesian denoising process is performed to obtain the Bayesian denoising heat map T b , heat map T b After the graph convolution operation, it is input into the dilated volume group, and the four dilated convolutions are concatenated to obtain the output eight T k , output eight T k After the activation function 2, the residual connection is used to input into the subsequent operation to obtain the heat weight image T s , heat weight image T s It is also necessary to sum according to the spatial dimension to obtain the heat weighted average image T h , and finally the heat weight image T s / Heat weighted average image T h , and get output nine.
[0017] Preferably, in the above-mentioned light-weight global dependency network based knowledge distillation electric wire transmission line detection method, the four outputs generated by the global information generator and the dependency generator are all input into the matrix cross integrator, and the output seven and the output nine are multiplied first and then pass through the activation function two to obtain the global weight map W s Output six and output eight will be processed through matrix operation one to obtain the color map L1 and the heat map L2 to be processed. The color map L1 and the heat map L2 to be processed are then multiplied by matrix operation two and linear operation to obtain the global information map Global Infographic It will be restored again through matrix operations 2 and 3 to output 7 with the same dimensions as the global weight map W s Multiply and add to itself to get the global information weight map Global Information Weight Graph The activation function 3 is used to multiply the heat map L2 to be processed and then restored to the original feature size through matrix operations 2 and 3. Then the global relationship graph is obtained through activation function 2. Global relationship diagram Through activation function three, it needs to be multiplied with the color image to be processed L1 to retain the original information, and then restored to the original feature size through matrix operations two and three, and finally the global information weight map Add and then compare with the global relationship diagram Multiplying together gives the output ten.
[0018] Preferably, in the above-mentioned light-weight global dependency network based knowledge distillation wire transmission line detection method, the specific steps of using multi-scale relationship distillation, pixel contrast learning distillation and bird's-eye view mapping distillation for knowledge distillation are as follows: first, the multi-scale distillation method is used to solve the information difference between the encoding features of the teacher and the student; secondly, considering that there are differences in the output of the decoding part of the teacher and the student at the pixel level, the contrast learning method is used to realize the pixel-level contrast learning knowledge distillation; finally, in order to solve the problem of large differences in the output results of the teacher and student backbone networks, the bird's-eye view visual mapping distillation is used for the final processing.
[0019] Preferably, in the above-mentioned light-weight global dependency network based on knowledge distillation, in the multi-scale distillation mode, the teacher encoder output 1, output 2, output 3 and output 4 are four outputs of the matrix cross integrator of different sizes of the teacher backbone network, the student encoder output 1, output 2, output 3 and output 4 are four different scales of the student backbone network obtained by adding the student global information generator and the dependency generator, the adaptive average pooling and the adaptive maximum pooling are to change the spatial scale of the feature, and change the width and height of the feature to the original size of 16, 8, 4, 2 and 1, the exponential calculation is to calculate the power operation of the tensor, the tensor is space-based normed by taking the norm of all values in the channel to obtain a new channel value, the tensor is channel-based normed by taking the norm of all values in the height and width to obtain a new height value and width value, and the loss function finally regressed to by the multi-scale relationship distillation is the mean square error loss;
[0020] In pixel contrast learning distillation, the output 2 and output 3 of the teacher backbone network are the outputs of the decoder, which are used for pixel contrast distillation with the outputs 1 and 2 of the student encoder; first, output 2 undergoes matrix operation 1, and then passes through the tensor to find the norm by channel to ensure that all samples have the same scale, which makes it easier to select positive and negative samples in the subsequent step, and obtains T s ; The output of the student encoder also undergoes matrix operation 1, the tensor is normalized by channel, and matrix operation 2 to obtain S, to T s And in T sMultiply to get Y; in the stage of selecting positive and negative samples, first calculate the maximum value max and minimum value min of the third dimension of the Y feature, and then select the maximum and minimum values from T s Select the corresponding number of positive and negative initial samples and concatenate them on S to get the final positive sample P and negative sample N. Perform a cosine similarity calculation. The intermediate target matrix between the positive and negative samples is used in T s Or use the GT result graph, and finally input the positive sample P, negative sample N and target matrix for calculating cosine similarity into the marginal ranking loss function to get the loss; according to this process, the output three and the student encoder output two can be input to perform the same operation;
[0021] In the bird vision map distillation, the output of the teacher backbone network first needs to be adaptively averaged pooled to reduce its height and width dimensions to obtain T p ; Set up a tensor Z with the same scale as output 1 but with an internal size of 0; then nest W loops through H loops, with the outer loop marked with i and the inner loop marked with j, calculate "H1 = i × 256 / 16, W1 = j × 256 / 16", and add T to the position [H1, W1] in Z space p The value of [i, j] in space; map the Z space to tensor T and retain a large amount of effective information; similarly, the student backbone network obtains tensor S after such operations; finally, the two tensors T and S are input into the mean variance loss, and the output one and output two of the teacher backbone network are used to perform effective knowledge distillation on the output five of the student backbone network.
[0022] On the other hand, the present invention discloses a light-weight global dependency network based on knowledge distillation for detecting electric wire transmission lines, and applies the above method, including:
[0023] A data set construction module selects the original color images of electric wire transmission lines, the heat map corresponding to each original color image of electric wire transmission lines, and the final result map of the saliency detection of the color image to form a training set and a validation set;
[0024] A global dependency network construction module is used to construct a lightweight global dependency network. The lightweight global dependency network includes a student global dependency network and a teacher global dependency network. A global information generator and a dependency relationship generator are used to divide network features into encoding and decoding parts, respectively. All features of different scales are considered uniformly, and knowledge distillation is performed using multi-scale relationship distillation, pixel contrast learning distillation, and bird vision mapping distillation. The teacher global dependency network obtains the final training model through the training set, and then tests the test set to detect the test results. After obtaining the optimal teacher training model, the optimal teacher training model is used to distill the student model to obtain the optimal student model.
[0025] The output module inputs the test data set into the optimal student model and the optimal teacher training model, and the model network outputs the original power transmission line color map prediction map to obtain the prediction map set.
[0026] It can be seen from the above technical solution that compared with the prior art:
[0027] 1) The method of the present invention constructs a global dependency network, inputs the image of the power transmission line into the global dependency network for training, and obtains a detection training model of the global dependency network; then the image of the power transmission line to be detected is input into the detection training model of the global dependency network to obtain a corresponding predicted semantic segmentation image. When constructing a full-distance network, the method of the present invention divides the network features into two parts: encoding and decoding, and considers all features of different scales in a unified manner, saving model development time, and using a simple fusion module to fuse features, so that power transmission line detection can be achieved with a low number of parameters.
[0028] 2) This invention adopts three different knowledge distillation methods for different outputs of teachers and students. First, in order to solve the information difference between the encoding features of teachers and students, a multi-scale distillation method is proposed to solve this problem; secondly, considering that the decoding outputs of teachers and students are different at the pixel level, the contrastive learning method is used to realize pixel-level contrastive learning knowledge distillation; finally, in order to solve the problem of large differences in the output results of the teacher and student backbone networks, bird's-eye view visual mapping distillation is used for the final processing.
[0029] 3) In the model architecture, the same information generator is designed to extract features of different sizes for color images and thermal images, which saves the time of designing different modules for different sizes. A global information generator is designed to extract global context information of color images, and a dependency generator is designed to extract the dependency and weight information between pixels in thermal images. In the teacher backbone network, we designed a matrix cross integrator to perform a series of effective evidence fusion operations on different information of the same scale, and finally fuse multiple outputs of the global information generator and the dependency generator into one information. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0031] Figure 1 It is a teacher backbone network block diagram of the method of the present invention;
[0032] Figure 2 A student backbone network diagram of the method of the present invention;
[0033] Figure 3 is a global information generator module;
[0034] Figure 4 It is a dependency generator module;
[0035] Figure 5 It is a matrix cross integrator module;
[0036] Figure 6 This is the overall framework diagram of knowledge distillation;
[0037] Figure 7a It is the first original color image in the electric wire transmission line detection dataset;
[0038] Figure 7b for Figure 7a The original result graph of ;
[0039] Figure 7c In order to utilize knowledge distillation Figure 7a The original color image shown is predicted to obtain a predicted image;
[0040] Figure 8a It is the second original color image in the electric wire transmission line detection dataset;
[0041] Figure 8b for Figure 8a The original result graph of ;
[0042] Figure 8c In order to utilize knowledge distillation Figure 8a The original color image shown is predicted to obtain a predicted image;
[0043] Figure 9a This is the third original color image in the power transmission line detection dataset;
[0044] Figure 9b for Figure 9a The original result graph of ;
[0045] Fig.9c In order to utilize knowledge distillation Figure 9a The original color image shown is predicted to obtain a predicted image;
[0046] Fig.10a This is the 4th original color image in the power transmission line detection dataset;
[0047] Fig.10b for Fig.10a The original result graph of ;
[0048] Fig.10c In order to utilize knowledge distillation Fig.10a The original color image shown is predicted to obtain the predicted image. DETAILED DESCRIPTION
[0049] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0050] The lightweight global dependency network proposed in the present invention includes a training phase and a testing phase of a teacher backbone network, and a knowledge distillation training and testing phase of a student backbone network;
[0051] Training phase 1 and testing phase 2 of the teacher backbone network:
[0052] Step 1_1: Select Q Tra The original color image of the transmission line R Tra The heat map T corresponding to each original color image of the wire transmission line Tra and R Tra The final result of the saliency detection is shown in Figure G Tra , and form the training set Tra. Select Q in the same way val (Q Tra :Q val =7:1.5) color images R of wire transmission lines that are different from the training set Tra Tra The heat map T corresponding to each original color image of the wire transmission line val and R val The final result of the saliency detection is shown in Figure G val And constitute the validation set Val. The color images of power transmission lines are mainly composed of RGB images and multispectral images taken in different scenes. The RGB image records the spectral information of the three bands of red, green and blue, and the multispectral image records the spectral information of other different bands. Each band of information is equivalent to a channel component, that is, each original scene image with significant objects contains the R channel component, G channel component and B channel component of the RGB image and the additional thermal infrared channel component T of the infrared multispectral image.
[0053] Step 1_2: Input the training set and validation set obtained in step 1_1 into the teacher global dependency network to start training the teacher global dependency network. The teacher global dependency network mainly consists of three parts, including the feature information generation stage, the feature information fusion stage and the decoding stage.
[0054] First, we introduce the components of the teacher's global dependency network:
[0055] Figure 1 The teacher global dependency network mainly includes a color image input layer, a thermal image input layer, four backbone network layers (corresponding to the four different outputs of Shunted_b), four global information generators (same structure), four dependency generators (same structure), four matrix cross integrators (same structure), three simple feature fusers (same structure) and three decoders (same structure). Figure 1 The result graph in the middle is used to supervise the final output of feature fusion and the outputs generated by each decoder. Output 1, output 2, and output 3 are supervised using structural loss, and output 4 is supervised using the loss formed by combining binary cross entropy and similarity coefficient. The feature fusion unit is composed of two 3×3 convolutional layers and a two-fold upsampling. The structure is similar to that of the decoder, which only uses one 3×3 convolutional layer.
[0056] Figure 3 It is a global information generator developed for color images. The Bayesian processing is to use Bayes to perform a noise reduction process. This operation is implemented using a custom two-dimensional convolution operation. The convolution kernel tensor and the bias term tensor in this two-dimensional convolution operation are both a set of random values, which conform to the normal distribution. Convolution block 1 is a two-dimensional convolution with a convolution size of 3 and a padding of 1. Convolution block 2 is a two-dimensional convolution with a convolution size of 1 and an input channel that is twice the output channel. Convolution block 3 is a two-dimensional convolution with a convolution size of 1 and an output channel that is twice the input channel. Convolution block 4 is a two-dimensional convolution with a convolution size of 1 and an output channel of 1. Convolution block 5 is a two-dimensional convolution with an input and output channel of 1, a convolution size of 7, a padding of 3, and no bias. Activation function 1 is a linear rectification function, and activation function 2 is a S-type function. Adaptive average pooling is to change the height and width of the feature to 1. The maximum value of the tensor by channel is to take the maximum value of the feature according to the number of channels.
[0057] Figure 4 It is a dependency generator developed for heat maps, in which Bayesian processing and introduction Figure 3 The Bayesian treatment is consistent with Figure 4 The convolution in the middle picture is implemented using matrix and one-dimensional convolution operation; the dilated convolution is a two-dimensional convolution in which the number of input channels is four times the number of output channels, and the convolution is 3, and the padding and expansion are 1, 3, 5, and 7. The splicing operation is to splice tensors along the channel dimension, and the spatial summation of the tensor is to convert the height and width to 1.
[0058] Figure 5It is a matrix cross integrator used to fuse the output features of the global information generator and the dependency generator, where the first matrix operation is to transform the third and fourth dimensions of the tensor into the result of multiplying the third and fourth dimensions, the second matrix operation is to change the positions of the second and third dimensions of the tensor, the linear operation is to process the matrix using the linear layer, the activation function three is the soft maximization function, and the third matrix operation is to split the third dimension of the tensor into two dimensions.
[0059] Next, the operation process of each part of the teacher's global dependency network is introduced:
[0060] like Figure 1 As shown in the figure, the overall execution process of the teacher backbone network. The color image passes through the teacher backbone network 1, teacher backbone network 2, teacher backbone network 3, and teacher backbone network 4 in sequence, and the heat map also passes through the teacher backbone network 1, teacher backbone network 2, teacher backbone network 3, and teacher backbone network 4 in sequence. The teacher backbone network uses shunted_b. The color image and heat map pass through the backbone network 1 to obtain a tensor of [batch (B), number of channels (C), height (H), width (W)] of [8, 64, 64, 64]. The color image and heat map pass through the backbone network 2 to obtain a tensor of [8, 128, 32, 32]. The color image and heat map pass through the backbone network 3 to obtain a tensor of [8, 256, 16, 16]. The color image and heat map pass through the backbone network 4 to obtain a tensor of [8, 512, 8, 8]. The color map corresponding to the vertical direction is output through the teacher backbone network, and enters the global information generator to obtain two outputs. Similarly, the heat map will also obtain two outputs through the dependency generator. At this time, the four outputs will pass through the matrix cross integrator; according to this step, the four matrix cross integrators will integrate the features of the color map and heat map of the same feature scale for subsequent processing. The four outputs obtained by the matrix cross integrator will enter the feature fusion device in order from large to small according to the number of channels. Finally, the output one of the feature fusion device will use the result map for effective supervision; the three outputs obtained by the feature fusion device will pass through the decoder to obtain output two, output three and output four, and finally use the result map for effective supervision. Finally, the sum of the losses of the four supervisions is the loss of the final teacher backbone network.
[0061] like Figure 3 As shown in the figure, it is the execution process of the global information generator. The output of the color image will be processed by Bayesian processing to reduce the noise of the color image and obtain the Bayesian denoised color image (R b ), and then R b Input to convolution block 1 and activation function group to get output 6 (R j ), and then R j Input to the channel processing group consisting of adaptive average pooling, convolution block and activation function to obtain the channel processing color map (Rc ), and R j Input into the spatial processing consisting of convolution fast four and activation function three to obtain the spatial processing color map (R s ), in order to fully retain the original information, R b After simple processing by convolution block 5, it is multiplied by itself after taking the maximum value according to the channel to obtain the color weight image (R m ), and finally R j , R m and R c , R s Multiplying together gives the output seven.
[0062] like Figure 4 As shown in Figure 1, it is a dependency generator, which is used to extract the dependency in the heat map. The features of the heat map obtained through the backbone network will be input into this module. First, the Bayesian denoising process is performed to obtain the Bayesian denoised heat map (T b ), T b After the graph convolution operation, it is input into the dilated volume group, and the four dilated convolutions are concatenated to obtain the output eight (T k ), T k After the activation function is used, the residual connection is used to input into the subsequent operation to obtain the heat weight image (T s ), T s It is also necessary to sum up according to the spatial dimension to obtain the heat weight average image (T h ), and finally T s / T h , and get output nine.
[0063] like Figure 5 As shown, the four outputs generated by the global information generator and the dependency generator are all input to the matrix cross integrator. Input seven and nine will be multiplied first and then pass through the activation function two to obtain the global weight map (W s ), input six and eight will be processed through matrix operation one to obtain the color map to be processed (L1) and the heat map to be processed (L2). L1 and L2 are then multiplied by matrix operation two and linear operation to obtain the global information map It will be restored to the same dimension as input 7 through matrix operations 2 and 3 again. s Multiply and add to itself to get the global information weight map It will be multiplied by L2 through activation function three and restored to the original feature size through matrix operations two and three again, and then the global relationship diagram will be obtained through activation function two. Through activation function three, it is necessary to multiply with L1 to retain the original information and then restore it to the original feature size through matrix operations two and three. Add and Multiplying together gives the output ten.
[0064] like Figure 1 As shown, matrix cross integrators of different scales will obtain outputs of different scales. Outputs enter the feature fuser one by one according to the number of scale channels, and obtain fusion features corresponding to different scales. The final output of the feature fuser is output one. The different outputs obtained by the feature fuser are input into the decoder. Different decoding features are obtained at each stage of the decoder. Finally, the result graph and the corresponding loss are used to supervise outputs one, two, three and four to obtain the final total loss. During the training, the final global dependency network detection training model is obtained through back propagation and used for the verification set to verify the effect. The verification set is verified once in each round of training, and the best training model weight is retained for the test phase.
[0065] The specific steps of the testing phase process are:
[0066] Step 2_1: Select QT ext (Q Tra :Q Text =7:1.5) original color image Q of the wire transmission line Text The heat map T corresponding to each original color image of the wire transmission line Text And the result graph G Text , and constitute the training set Text.
[0067] Step 2_2: Input the training set Text into the trained model, and the model network outputs the original power transmission line color map prediction map to obtain the prediction map set.
[0068] In order to further verify the feasibility and effectiveness of the method of the teacher backbone network, experiments were conducted. The architecture of the teacher global dependency network was built using the Python-based deep learning library Pytorch3.6. The test set of the VITL wire transmission line detection database was used to analyze the wire transmission line detection effect using the method of the present invention. We use the evaluation indicators commonly used to measure the performance of machine learning models, accuracy (Em), precision (Sm), weighted F1 score (W_F), F1 score (Fm) and mean absolute error (MAE) to evaluate the segmentation performance of the wire transmission line detection image, where the larger the Em, Sm, W_F, and Fm, the better, and the smaller the MAE, the better; and the scale (Params) and computational complexity (Flops) of the model are added to evaluate the computational amount and operation speed of the model.
[0069] Training phase 1 and testing phase 2 of knowledge distillation of the student backbone network:
[0070] Step 1_1: The method of selecting training sets and validation sets is the same as that of the teacher backbone network. During the knowledge distillation training phase of the student backbone network, it is necessary to load the trained teacher training model, which is used in knowledge distillation.
[0071] Step 1_2: Construct the student global dependency network. The student global dependency network mainly consists of three parts, including the feature information generation stage, the decoding stage and the teacher global dependency network supervision stage.
[0072] First, we introduce the components of the student global dependency network and knowledge distillation:
[0073] Figure 2 It is the overall framework diagram of the student backbone network. The student backbone network adopts shunted_t. The global information generator is less than the global information generator of the teacher backbone network, and the dependency generator is less of the graph convolution. Figure 6 This is the overall framework diagram of knowledge distillation. The teacher encoder outputs one, two, three and four are the four outputs of the matrix cross integrator of different sizes of the teacher backbone network. The student encoder outputs one, two, three and four are the four different scales of the student backbone network obtained by adding the student global information generator and the dependency generator. Adaptive average pooling and adaptive maximum pooling change the spatial scale (width and height) of the features, and convert the width and height of the features into the original sizes of 16, 8, 4, 2 and 1. Exponential calculation is the power operation of calculating tensors. The spatial norm of the tensor is to obtain a new channel value by taking the norm of all values in the channel. The channel norm of the tensor is to obtain a new height value and width value by taking the norm of all values in the height and width. The loss function that multi-scale relationship distillation finally regresses to is the mean square error loss. The selection of positive samples is to multiply the student features and the teacher features to obtain the maximum and minimum values of the third dimension of the features. The positive and negative samples are the concatenation of the selected maximum and minimum images to obtain the final number of samples. The cosine similarity is to use cosine to calculate the internal similarity between positive and negative samples. The target matrix is the intermediate value set up to facilitate the calculation of the examples between positive and negative samples. The pixel contrast learning distillation finally regresses to the marginal ranking loss function. The student encoder outputs one and two are the outputs of the first and second encoders of the student backbone network. The pixel block is a feature generated by a cycle. The BVE space is a feature composed of pixel blocks. The loss that the bird vision mapping distillation finally regresses to is the mean square error loss.
[0074] Next, the operation process of each part of the teacher's global dependency network is introduced:
[0075] like Figure 2As shown in the figure, the general process is similar to that of the teacher backbone network. In order to reduce the number of parameters, the student backbone network omits the matrix cross integrator and directly multiplies the global information generator and the dependency generator to obtain four outputs. These four outputs are input into the decoder from the largest to the smallest channel number to obtain the final output five, and the result graph is used to supervise the output five to obtain the final loss. Figure 6 As shown, the teacher backbone network has a total of eight outputs, namely teacher encoder output one, two, three, four and outputs one, two, three, and four. The student backbone network has a total of seven outputs, namely student encoder output one, two, three, four and student encoder output one, two, and output five.
[0076] Figure 6 In pixel contrast learning distillation, the output 2 and output 3 of the teacher backbone network are the outputs of the decoder, which are used for pixel contrast distillation with the outputs 1 and 2 of the student encoder; first, output 2 undergoes matrix operation 1, and then passes through the tensor to find the norm by channel to ensure that all samples have the same scale, which makes it easier to select positive and negative samples in the subsequent step. s ; The output of the student encoder also undergoes matrix operation 1, the tensor is normalized by channel, and matrix operation 2 to obtain S, to T s And in T s Multiply to get Y; in the stage of selecting positive and negative samples, first calculate the maximum value max and minimum value min of the third dimension of the Y feature, and then select the maximum and minimum values from T s Select the corresponding number of positive and negative initial samples and perform splicing operation on S to obtain the final positive sample P and negative sample N. In order to better make the positive and negative samples have a gap, it is necessary to calculate the cosine similarity. The intermediate target matrix between the positive and negative samples can be used T s Or use the GT result graph (same effect), and finally input the positive sample P, negative sample N and target matrix with calculated cosine similarity into the marginal ranking loss function to get the loss; because the structure of the teacher and student backbone networks is not very similar, in order to ensure the confidence of selecting positive and negative samples, we use an auxiliary loss to fine-tune the final contrastive learning loss. According to this process, the output three and the student encoder output two can be input to perform the same operation.
[0077] Figure 6 The output of the bird vision map distillation is firstly subjected to adaptive average pooling to reduce its height (H) and width (W) dimensions (this project reduces H and W to 16), in order to reduce the amount of calculation to obtain T p . Create a tensor Z with the same scale as output 1 but with an internal size of 0. Then nest W loops through H loops (the outer loop is marked with i, the inner loop is marked with j), calculate "H1 = i × 256 / 16, W1 = j × 256 / 16", and add T to the position [H1, W1] in Z space.p The value of [i, j] in space. In this way, a tensor of [8, 1, 16, 16] is mapped to a tensor T of [8, 1, 256, 256], and a large amount of effective information can be retained. Similarly, the student can also obtain a tensor S of [8, 1, 256, 256] after such operations. Finally, the two tensors T and S are input into the mean variance loss. This distillation method uses the teacher's output 1 and output 2 to perform an effective knowledge distillation on the student's output 5.
[0078] Step 2: Test and evaluate in the same way as the teacher backbone network.
[0079] The final knowledge distillation results are shown in Table 1.
[0080] Table 1 Evaluation results of the method of the present invention on the test set
[0081] method Em↑ Sm↑ W_F↑ avgF↑ MAE↓ Params Flops Ours 0.952 0.862 0.636 0.611 0.027 17.96 6.43G
[0082] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0083] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A light-weight global dependency network based knowledge distillation method for power transmission line detection, characterized in that: The specific steps include: Selecting original color images of electric wire transmission lines, heat maps corresponding to each original color image of electric wire transmission lines, and final result maps of saliency detection of the color images to form a training set and a validation set; Construct a lightweight global dependency network, which includes a student global dependency network and a teacher global dependency network. Use a global information generator and a dependency relationship generator to divide network features into encoding and decoding parts, respectively. Consider all features of different scales in a unified manner, and use multi-scale relationship distillation, pixel contrast learning distillation, and bird vision mapping distillation to perform knowledge distillation. The teacher global dependency network obtains the final training model through the training set, and then tests the test set to detect the test results. After obtaining the optimal teacher training model, the optimal teacher training model is used to distill the student model to obtain the optimal student model. The data set to be tested is input into the optimal student model and the optimal teacher training model, and the model network outputs the original power transmission line color map prediction map to obtain the prediction map set.
2. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 1, characterized in that: Both the teacher global dependency network and the student global dependency network use the global information generator to extract the global context information of the color image, and use the dependency generator to extract the dependency and weight information between pixels in the thermal image.
3. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 2, characterized in that: The teacher global dependency network also includes a matrix cross integrator that performs a series of effective evidence fusion operations on different information of the same scale, and fuses multiple outputs of the global information generator and the dependency generator into one information.
4. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 3, characterized in that: In the teacher global dependency network, the color image passes through the teacher backbone network 1, the teacher backbone network 2, the teacher backbone network 3, and the teacher backbone network 4 in sequence, and the heat map also passes through the teacher backbone network 1, the teacher backbone network 2, the teacher backbone network 3, and the teacher backbone network 4 in sequence; the color image and the heat map are respectively passed through the teacher backbone network to obtain feature maps of different scales; the color image corresponding to the vertical direction is output through the teacher backbone network, and enters the global information generator to obtain two outputs. Similarly, the heat map will also obtain two outputs through the dependency generator. At this time, the four outputs will pass Matrix cross integrator; according to this step, the four matrix cross integrators will integrate the features of the color map and heat map of the same feature scale for subsequent processing; the four outputs obtained by the matrix cross integrator will enter the feature fusion device in order from large to small according to the number of channels, and finally the output one of the feature fusion device will use the result map for effective supervision; the three outputs obtained by the feature fusion device will pass through the decoder to obtain output two, output three and output four, and use the result map for effective supervision; finally, the sum of the losses of the four supervisions is the loss of the final teacher backbone network.
5. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to any one of claims 1 to 4, characterized in that: In the global information generator, the output of the color image will be processed by Bayesian processing to obtain a Bayesian denoised color image R b , and then the color map R b Input to convolution block 1 and activation function group to get output 6 R j , and then output six R j Input into the channel processing group consisting of adaptive average pooling, convolution block and activation function to obtain the channel processing color map R c , and the color map R j Input into the spatial processing consisting of convolution fast four and activation function three to obtain the spatial processing color map R s , and also use the color map R b After simple processing by convolution block 5, it is multiplied by itself according to the channel to obtain the color weight image R m , and finally output six R j , color weight image R m and color map R c , color map R s Multiplying together gives the output seven.
6. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 5, characterized in that: The dependency generator is used to extract the dependencies in the heat map. The features of the heat map obtained through the backbone network are input into the dependency generator. First, the Bayesian denoising process is performed to obtain the Bayesian denoised heat map T b , heat map T b After the graph convolution operation, it is input into the dilated volume group, and the four dilated convolutions are concatenated to obtain the output eight T k , output eight T k After the activation function 2, the residual connection is used to input into the subsequent operation to obtain the heat weight image T s , heat weight image T s It is also necessary to sum according to the spatial dimension to obtain the heat weighted average image T h , and finally the heat weight image T s / Heat weighted average image T h , and get output nine.
7. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 6, characterized in that: The four outputs generated by the global information generator and the dependency generator are all input into the matrix cross integrator. Output seven and output nine will be multiplied first and then pass through the activation function two to obtain the global weight map W s Output six and output eight will be processed through matrix operation one to obtain the color map L1 and the heat map L2 to be processed. The color map L1 and the heat map L2 to be processed are then multiplied by matrix operation two and linear operation to obtain the global information map Global Infographic It will be restored again through matrix operations 2 and 3 to output 7 with the same dimensions as the global weight map W s Multiply and add to itself to get the global information weight map Global Information Weight Graph The activation function 3 is used to multiply the heat map L2 to be processed and then restored to the original feature size through matrix operations 2 and 3. Then the global relationship graph is obtained through activation function 2. Global relationship diagram Through activation function three, it needs to be multiplied with the color image to be processed L1 to retain the original information, and then restored to the original feature size through matrix operations two and three, and finally the global information weight map Add and then compare with the global relationship diagram Multiplying together gives the output ten.
8. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 1, characterized in that: The specific steps of knowledge distillation using multi-scale relationship distillation, pixel contrast learning distillation and bird's-eye view mapping distillation are as follows: first, multi-scale distillation is used to solve the information gap between the encoding features of the teacher and the student; second, considering that there are differences in the output of the decoding part of the teacher and the student at the pixel level, the contrastive learning method is used to realize pixel-level contrastive learning knowledge distillation; finally, in order to solve the problem of large differences in the output results of the teacher and student backbone networks, bird's-eye view mapping distillation is used for the final processing.
9. The method for detecting electric wire transmission lines based on a lightweight global dependency network based on knowledge distillation according to claim 1, characterized in that: In the multi-scale distillation method, the teacher encoder output 1, output 2, output 3 and output 4 are the four outputs of the matrix cross integrator of different sizes of the teacher backbone network, the student encoder output 1, output 2, output 3 and output 4 are the four different scales of the student backbone network obtained by adding the student global information generator and the dependency generator, the adaptive average pooling and the adaptive maximum pooling are to change the spatial scale of the feature, and change the width and height of the feature to the original size of 16, 8, 4, 2 and 1, the exponential calculation is to calculate the power operation of the tensor, the tensor is space-based normed by taking the norm of all values in the channel to obtain a new channel value, and the tensor is channel-based normed by taking the norm of all values in the height and width to obtain a new height value and width value, and the loss function that the multi-scale relationship distillation finally regresses to is the mean square error loss; In pixel contrast learning distillation, the output 2 and output 3 of the teacher backbone network are the outputs of the decoder, which are used for pixel contrast distillation with the outputs 1 and 2 of the student encoder; first, output 2 undergoes matrix operation 1, and then passes through the tensor to find the norm by channel to ensure that all samples have the same scale, which makes it easier to select positive and negative samples in the subsequent step, and obtains T s ; The output of the student encoder also undergoes matrix operation 1, the tensor is normalized by channel, and matrix operation 2 to obtain S, to T s And in T s Multiply to get Y; In the stage of selecting positive and negative samples, the first step is to calculate the maximum value max and minimum value min of the third dimension of feature Y, and then select the maximum and minimum values from T according to max and min. s Select the corresponding number of positive and negative initial samples and concatenate them on S to get the final positive sample P and negative sample N. Perform a cosine similarity calculation. The intermediate target matrix between the positive and negative samples is used in T s Or use the GT result graph, and finally input the positive sample P, negative sample N, and target matrix for calculating cosine similarity into the marginal ranking loss function to get the loss; follow this process to input output three and student encoder output two and perform the same operation; In the bird vision map distillation, the output of the teacher backbone network first needs to be adaptively averaged pooled to reduce its height and width dimensions to obtain T p ; Set up a tensor Z with the same scale as output 1 but with an internal size of 0; then nest W loops through H loops, with the outer loop marked with i and the inner loop marked with j, calculate "H1 = i × 256 / 16, W1 = j × 256 / 16", and add T to the position [H1, W1] in Z space p The value of [i, j] in space; map the Z space to tensor T and retain a large amount of effective information; similarly, the student backbone network obtains tensor S after such operations; finally, the two tensors T and S are input into the mean variance loss, and the output one and output two of the teacher backbone network are used to perform effective knowledge distillation on the output five of the student backbone network.
10. A wire transmission line detection system based on a lightweight global dependency network of knowledge distillation, applying the wire transmission line detection method based on a lightweight global dependency network of knowledge distillation as described in any one of claims 1-4 and 6-9, characterized in that: include: A data set construction module selects the original color images of electric wire transmission lines, the heat map corresponding to each original color image of electric wire transmission lines, and the final result map of the saliency detection of the color image to form a training set and a validation set; A global dependency network construction module is used to construct a lightweight global dependency network. The lightweight global dependency network includes a student global dependency network and a teacher global dependency network. A global information generator and a dependency relationship generator are used to divide network features into encoding and decoding parts, respectively. All features of different scales are considered uniformly, and knowledge distillation is performed using multi-scale relationship distillation, pixel contrast learning distillation, and bird vision mapping distillation. The teacher global dependency network obtains the final training model through the training set, and then tests the test set to detect the test results. After obtaining the optimal teacher training model, the optimal teacher training model is used to distill the student model to obtain the optimal student model. The output module inputs the test data set into the optimal student model and the optimal teacher training model, and the model network outputs the original power transmission line color map prediction map to obtain the prediction map set.
