Disclosure of Invention
The invention aims to provide a method and a system for detecting hardware fittings of a power transmission line, which can reduce the requirement of a traditional deep learning model on the number of samples of each hardware fitting in a data set, relieve the problems of unbalanced samples and long tail distribution of aerial data of the power transmission line and improve the detection effect of the hardware fittings of the power transmission line.
In order to achieve the purpose, the invention provides the following scheme:
a transmission line hardware detection method comprises the following steps:
acquiring a hardware fitting data set; the hardware fitting data set comprises a plurality of aerial images of the power transmission line;
obtaining visual characteristics by adopting a Faster R-CNN algorithm according to the aerial image of the power transmission line;
learning by adopting a multilayer perceptron algorithm according to the aerial images of the power transmission line and the visual characteristics to obtain a learned co-occurrence image adjacency matrix; carrying out information transmission on the visual features according to the learned co-occurrence graph adjacency matrix to obtain enhanced features;
and cascading the visual features and the enhanced features to obtain fusion features, and carrying out full-connection processing on the fusion features to obtain the hardware type and the hardware position.
Optionally, obtaining visual characteristics by using a Faster R-CNN algorithm according to the power transmission line aerial image specifically includes:
extracting multi-channel characteristics of the aerial image of the power transmission line to obtain an image characteristic diagram;
sliding an image feature map according to a plurality of anchor frames with preset sizes and proportions to generate a plurality of candidate frames;
screening the candidate frames by adopting a non-maximum suppression algorithm to obtain a plurality of target candidate areas;
and dividing the target candidate region into n x n image blocks, and performing maximum pooling processing on the n x n image blocks to obtain the visual features.
Optionally, the learning is performed by using a multi-layer perceptron algorithm according to the aerial image of the power transmission line and the visual features, so as to obtain a learned co-occurrence map adjacency matrix, and the method specifically includes:
calculating the occurrence frequency of two hardware labels in pairs and the occurrence frequency of the same hardware label in each power transmission line aerial image in the hardware data set;
determining the ratio of the occurrence frequency of the two hardware labels in pairs to the occurrence frequency of the same hardware label as a co-occurrence probability, and generating a co-occurrence probability matrix according to the co-occurrence probability;
mapping the co-occurrence probability matrix to the co-occurrence probability corresponding to the actual hardware fitting category to obtain a co-occurrence probability mapping matrix;
learning by adopting a multilayer perceptron algorithm according to the visual characteristics to obtain a co-occurrence map adjacency matrix;
and learning by adopting a multi-layer perceptron algorithm by taking the co-occurrence probability mapping matrix as a true value and the visual characteristics and the co-occurrence adjacent matrix as training values to obtain a learned co-occurrence adjacent matrix.
Optionally, the performing information propagation on the visual feature according to the learned co-occurrence map adjacency matrix to obtain an enhanced feature specifically includes:
normalizing the learned adjacent matrix of the co-occurrence map to obtain a normalized adjacent matrix of the co-occurrence map;
according to the normalized co-occurrence map adjacency matrix, obtaining an enhancement feature f' by adopting the following formula:
f′=εfW e
where ε is the normalized co-occurrence map adjacency matrix, f is the visual feature, W e To transform the weight matrix.
The invention also provides a transmission line hardware fitting detection system, which comprises:
the input sub-network module is used for acquiring a hardware fitting data set; the hardware fitting data set comprises a plurality of power transmission line aerial images;
the fast R-CNN sub-network module is used for obtaining visual characteristics by adopting a fast R-CNN algorithm according to the aerial image of the power transmission line;
the graph reasoning sub-network module is used for learning by adopting a multilayer perceptron algorithm according to the aerial image of the power transmission line and the visual characteristics to obtain a learned co-occurrence graph adjacency matrix; carrying out information transmission on the visual features according to the learned co-occurrence graph adjacency matrix to obtain enhanced features;
and the result output sub-network module is used for cascading the visual features and the enhancement features to obtain fusion features, and carrying out full-connection processing on the fusion features to obtain the hardware type and the hardware position.
Optionally, the Faster R-CNN sub-network module specifically includes:
the image feature map generating unit is used for extracting multi-channel features of the aerial image of the power transmission line to obtain an image feature map;
the candidate frame generating unit is used for performing image feature map sliding according to a plurality of anchor frames with preset sizes and proportions to generate a plurality of candidate frames;
the target candidate area generating unit is used for screening the candidate frames by adopting a non-maximum suppression algorithm to obtain a plurality of target candidate areas;
and the visual feature generation unit is used for dividing the target candidate region into n multiplied by n image blocks and performing maximum pooling processing on the n multiplied by n image blocks to obtain the visual feature.
Optionally, the graph inference sub-network module specifically includes:
the times calculation unit is used for calculating the paired occurrence times of the two hardware labels in each electric transmission line aerial image in the hardware data set and the occurrence times of the same hardware label;
the co-occurrence probability matrix generating unit is used for determining the ratio of the paired occurrence times of the two hardware labels to the occurrence times of the same hardware label as a co-occurrence probability and generating a co-occurrence probability matrix according to the co-occurrence probability;
the co-occurrence probability mapping matrix generating unit is used for mapping the co-occurrence probability matrix to the co-occurrence probability corresponding to the actual hardware fitting category to obtain a co-occurrence probability mapping matrix;
the co-occurrence map adjacency matrix generating unit is used for learning by adopting a multi-layer perceptron algorithm according to the visual characteristics to obtain a co-occurrence map adjacency matrix;
and the learning unit is used for learning by adopting a multilayer perceptron algorithm by taking the co-occurrence probability mapping matrix as a true value and the visual features and the co-occurrence map adjacency matrix as training values to obtain a learned co-occurrence map adjacency matrix.
Optionally, the graph inference sub-network module further includes:
the normalization processing unit is used for performing normalization processing on the learned co-occurrence map adjacency matrix to obtain a normalized co-occurrence map adjacency matrix;
an enhanced feature generating unit, configured to obtain an enhanced feature f' by using the following formula according to the normalized co-occurrence map adjacency matrix:
f′=εfW e
where ε is the normalized co-occurrence graph adjacency matrix, f is the visual characteristic, W e To transform the weight matrix.
Compared with the prior art, the invention has the beneficial effects that:
the invention provides a method and a system for detecting hardware fittings of a power transmission line, which are characterized by acquiring a hardware fitting data set, and obtaining visual characteristics by adopting a Faster R-CNN algorithm according to an aerial image of the power transmission line; learning by adopting a multi-layer perceptron algorithm according to the aerial images and the visual characteristics of the power transmission line to obtain a learned co-occurrence image adjacency matrix; carrying out information transmission on the visual features according to the learned adjacent matrixes of the co-occurrence graphs to obtain enhanced features; and cascading the visual features and the enhanced features to obtain fusion features, and carrying out full-connection processing on the fusion features to obtain the hardware type and the hardware position. The method can reduce the requirement of the traditional deep learning model on the number of samples of each hardware fitting in a data set, relieve the problems of unbalanced samples and long tail distribution of aerial data of the power transmission line, and improve the hardware fitting detection effect of the power transmission line.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a method and a system for detecting hardware fittings of a power transmission line, which can reduce the requirement of a traditional deep learning model on the number of samples of each hardware fitting in a data set, relieve the problems of unbalanced samples and long tail distribution of aerial data of the power transmission line and improve the detection effect of the hardware fittings of the power transmission line.
In order to make the aforementioned objects, features and advantages of the present invention more comprehensible, the present invention is described in detail with reference to the accompanying drawings and the detailed description thereof.
Examples
Fig. 1 is a flowchart of a method for detecting transmission line hardware in an embodiment of the present invention, and as shown in fig. 1, a method for detecting transmission line hardware includes:
step 101: acquiring a hardware fitting data set; the hardware data set comprises a plurality of aerial images of the power transmission line.
Step 102: and obtaining visual characteristics by adopting a Faster R-CNN algorithm according to the aerial image of the power transmission line.
Step 102, specifically comprising:
extracting multi-channel characteristics of the aerial image of the power transmission line to obtain an image characteristic diagram;
sliding an image feature map according to a plurality of anchor frames with preset sizes and proportions to generate a plurality of candidate frames;
screening the candidate frames by adopting a non-maximum suppression algorithm to obtain a plurality of target candidate areas;
and dividing the target candidate region into n x n image blocks, and performing maximum pooling processing on the n x n image blocks to obtain the visual features.
Step 103: learning by adopting a multi-layer perceptron algorithm according to the aerial images and the visual characteristics of the power transmission line to obtain a learned co-occurrence image adjacency matrix; and carrying out information transmission on the visual characteristics according to the learned adjacent matrixes of the co-occurrence graphs to obtain enhanced characteristics.
Step 103, specifically comprising:
calculating the number of times that two hardware labels in each power transmission line aerial image in the hardware data set appear in pairs and the number of times that the same hardware label appears;
determining the ratio of the occurrence frequency of the two hardware fittings labels in pairs to the occurrence frequency of the same hardware fittings label as a co-occurrence probability, and generating a co-occurrence probability matrix according to the co-occurrence probability;
mapping the co-occurrence probability matrix to the co-occurrence probability corresponding to the actual hardware fitting category to obtain a co-occurrence probability mapping matrix;
learning by adopting a multi-layer perceptron algorithm according to the visual characteristics to obtain a co-occurrence map adjacency matrix;
and taking the co-occurrence probability mapping matrix as a true value, taking the visual characteristics and the co-occurrence map adjacency matrix as training values, and learning by adopting a multi-layer perceptron algorithm to obtain a learned co-occurrence map adjacency matrix.
Normalizing the learned adjacent matrix of the co-occurrence map to obtain a normalized adjacent matrix of the co-occurrence map;
according to the normalized co-occurrence map adjacency matrix, obtaining an enhancement feature f' by adopting the following formula:
f′=εfW e
where ε is the normalized co-occurrence map adjacency matrix, f is the visual feature, W e To transform the weight matrix.
Step 104: and cascading the visual features and the enhancement features to obtain fusion features, and carrying out full-connection processing on the fusion features to obtain the hardware type and the hardware position.
The invention also provides a transmission line hardware fitting detection system, which comprises:
the input sub-network module is used for acquiring a hardware fitting data set; the hardware data set comprises a plurality of aerial images of the power transmission line.
And the Faster R-CNN sub-network module is used for obtaining visual characteristics by adopting a Faster R-CNN algorithm according to the aerial image of the power transmission line.
The fast R-CNN sub-network module specifically comprises:
the image characteristic diagram generating unit is used for extracting multi-channel characteristics of the aerial image of the power transmission line to obtain an image characteristic diagram;
the candidate frame generating unit is used for performing image characteristic map sliding according to a plurality of anchor frames with preset sizes and proportions to generate a plurality of candidate frames;
the target candidate area generating unit is used for screening the candidate frames by adopting a non-maximum suppression algorithm to obtain a plurality of target candidate areas;
and the visual feature generation unit is used for dividing the target candidate region into n multiplied by n image blocks and performing maximum pooling processing on the n multiplied by n image blocks to obtain the visual feature.
The graph reasoning sub-network module is used for learning by adopting a multi-layer perceptron algorithm according to the aerial images and the visual characteristics of the power transmission line to obtain a learned co-occurrence graph adjacency matrix; and carrying out information transmission on the visual features according to the learned adjacent matrixes of the co-occurrence graphs to obtain enhanced features.
The graph inference sub-network module specifically comprises:
the times calculation unit is used for calculating the paired occurrence times of two hardware labels in each power transmission line aerial image in the hardware data set and the occurrence times of the same hardware label;
the co-occurrence probability matrix generating unit is used for determining the ratio of the paired occurrence times of the two hardware labels to the occurrence times of the same hardware label as the co-occurrence probability and generating a co-occurrence probability matrix according to the co-occurrence probability;
the co-occurrence probability mapping matrix generating unit is used for mapping the co-occurrence probability matrix to the co-occurrence probability corresponding to the actual hardware fitting category to obtain a co-occurrence probability mapping matrix;
the co-occurrence map adjacency matrix generating unit is used for learning by adopting a multi-layer perceptron algorithm according to the visual characteristics to obtain a co-occurrence map adjacency matrix;
and the learning unit is used for learning by adopting a multilayer perceptron algorithm by taking the co-occurrence probability mapping matrix as a true value and the visual feature and the co-occurrence map adjacency matrix as training values to obtain a learned co-occurrence map adjacency matrix.
The normalization processing unit is used for performing normalization processing on the learned co-occurrence map adjacency matrix to obtain a normalized co-occurrence map adjacency matrix;
an enhanced feature generating unit, configured to obtain an enhanced feature f' by using the following formula according to the normalized co-occurrence map adjacency matrix:
f′=εfW e
where ε is the normalized co-occurrence map adjacency matrix, f is the visual feature, W e To transform the weight matrix.
And the result output sub-network module is used for cascading the visual features and the enhancement features to obtain fusion features, and carrying out full-connection processing on the fusion features to obtain the hardware type and the hardware position.
In order to further explain the method for detecting the transmission line hardware provided by the invention, as shown in fig. 2-3,
the detection network model mainly comprises 4 parts, namely an input sub-network, a Faster R-CNN sub-network, a graph reasoning sub-network and a result output sub-network.
The input sub-network mainly comprises two parts, namely image input and data set construction of aerial images of the power transmission line. Firstly, an armour clamp data set is constructed by aerial shooting images of the existing power transmission line. Then, in the training stage of the detection model, the pictures in the hardware data set are used for training and adjusting the model parameters. And in the test stage of detecting the model, carrying out model detection by using the transmission line hardware fitting pictures acquired on site.
The input sub-network inputs the aerial images into the Faster R-CNN sub-network for model training and testing, and inputs the hardware data set into the graph reasoning sub-network for prior knowledge extraction.
The Faster R-CNN sub-network essentially comprises the following 3 steps:
1. a convolutional neural network: and extracting multi-channel features of the input image from light to deep by using a residual error network ResNet101 and forming an image feature map.
RPN network: performing feature map sliding through multiple anchor frames with preset size and proportion to generate multiple candidate frames, analyzing and screening N by adopting Non-Maximum Suppression (NMS) r A target candidate region.
3.RoI pooling:uniformly dividing each target candidate region into n multiplied by n image blocks and carrying out maximum pooling calculation to obtain a feature map candidate region vector with a fixed scale
Wherein N is
r And extracting the number of candidate targets for a Faster R-CNN algorithm, wherein D is the characteristic dimension of each candidate target region.
The Faster R-CNN sub-network exports the visual features f to the graph inference sub-network and the result exporting sub-network.
The graph inference subnetwork mainly comprises the following 4 steps, as shown in fig. 3:
1. co-occurrence probability matrix: the invention adopts a conditional probability model to express the co-occurrence probability, firstly, the times of the paired occurrence of the metal labels in each image in a training set are calculated, and a statistical matrix of the co-occurrence times is obtained
Wherein C represents the number of hardware classes, H
xy Indicating label L
x And a label L
y Number of occurrences in the same image, H
xx Namely, the numerical value of the diagonal line element represents the times of the hardware variety in the training set image. Then, dividing each element in the H by the diagonal element of the row through row normalization to obtain a co-occurrence probability matrix
As shown in formula (1):
P xy =H xy /H xx (1)
wherein P is xy =P(L y |L x ) Indicates when the label L x Tag L at the time of occurrence y The probability of (c).
2. Co-occurrence probability mapping matrix: definition of
Wherein
Representing the co-occurrence probability association between the ith node and the jth node in the co-occurrence graph,
representing a co-occurrence probability mapping matrix. N for fast R-CNN sub-network export
r The candidate region vectors map the co-occurrence probability of the real class according to the co-occurrence probability matrix P to obtain a co-occurrence probability mapping matrix
3. Co-occurrence graph adjacency matrix: definition of
Wherein
Representing the association relationship between the ith input vector and the jth input vector in the co-occurrence graph,
a co-occurrence adjacency matrix representing model learning. The adjacency is learned by a Multi-layer Perceptron (MLP) as shown in the following equation:
where MLP denotes the matrix parameters learned by MLP, and α (-) denotes the matrix parameters for the input visual features (f) i ,f j ) Carry out L 1 And (4) a result of the paradigm calculation. The MLP is expressed as a process in which a vector is transformed by four steps of an input layer, a hidden layer, a nonlinear activation layer and an output layer, i.e., Y = ReLU (XW + B), where X is an input vector, Y is an output vector, W and B are weights and offsets of the MLP hidden layer, and ReLU is a nonlinear transformation function. L is 1 The paradigm is represented as a difference calculation between vectors.
In the training phase, training parameters of MLPThe number needs to be trained, and the invention maps the matrix by the co-occurrence probability
As a true value, a co-occurrence map adjacency matrix learned by visual feature f and MLP
As a training value, the MLP is parameter-updated. The loss function during the training phase is shown as follows:
normalizing the learned co-occurrence graph adjacency matrix as shown in equation 4:
4. graph reasoning: and carrying out information propagation on the visual features of the candidate region in a weighting mode to obtain an enhanced feature f', as shown in formula (5):
f′=εfW e (5)
where ε is the normalized co-occurrence graph adjacency matrix, f is the input visual features,
in order to transform the weight matrix,
is the enhanced feature obtained by graph reasoning, and E is the enhanced feature dimension.
The graph inference sub-network outputs the enhancement feature f' to the result output sub-network.
The result output sub-network mainly comprises the following steps:
characteristic cascading: and cascading the original visual feature f and the enhanced feature f' to obtain a joint feature of the fusion co-occurrence reasoning module.
And inputting the joint feature vector into the full-connection layer, calculating the category and the accurate position of the candidate region vector of the feature map, and completing a hardware target detection task.
According to the detection method, the co-occurrence matrix is used as the regular expression of the hardware fitting assembly structure, and the co-occurrence reasoning module is designed to be embedded into the target detection model, so that the organic fusion of the deep learning model and the service knowledge in the electric power field is effectively promoted, and the detection effect of the transmission line hardware fitting is improved.
According to the detection method, the fixed structure relation of the electric transmission line hardware fittings is introduced to serve as prior guidance, the requirement of a traditional deep learning model on the number of samples of each hardware fitting in a data set is lowered, and the problems of unbalanced samples and long tail distribution of aerial data of the electric transmission line are effectively solved.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In summary, this summary should not be construed to limit the present invention.