Disclosure of Invention
Aiming at the defects of the prior art, the invention discloses a method for confirming false alarm of hidden danger of a power transmission line channel crane.
The technical scheme of the invention is as follows:
a method for confirming potential crane hazard false alarm of a power transmission line channel is characterized in that based on the positions of a crane real alarm area and a crane false alarm area in a detected image, the area of the alarm area and the measure of the concentrated trend of the alarm area, the attributes with larger difference of the concentrated trends of the crane real alarm area and the crane false alarm area are determined through calculation, and a CART classification tree is trained according to the attributes;
inputting the attribute of the alarm area of the crane to be tested to a CART classification tree model, and outputting a classification result and a confidence rate;
the attributes with larger difference between the centralized trends of the real alarm area of the crane and the false alarm area of the crane can be selected during training, the number of the attributes is not limited, and at least four attributes are selected to achieve the effects of the invention: the method comprises the steps of determining a position coordinate x and a position coordinate y of an alarm region in a measured image, a distance from a central point of the measured image, an aspect ratio of the alarm region and an area of the alarm region; the alarm area is a minimum rectangular frame which is correspondingly determined after the detected image is identified by a related hidden danger identification algorithm and comprises a target crane (comprising a real crane and a false crane), and the hidden danger identification algorithm belongs to the prior art and does not belong to the content to be protected by the invention.
According to the optimization of the invention, the method for confirming the false alarm of the hidden danger of the crane in the power transmission line channel is characterized by comprising the following detailed steps:
a. calculating the attribute distribution difference of the real alarm area and the false alarm area of the crane;
b. selecting attributes with large distribution difference from all crane real alarm and crane false alarm attributes to train a CART classification tree;
the step a comprises the following detailed steps:
a 1: respectively searching the maximum value and the minimum value in the attributes in the step a, and recording the maximum value and the minimum value as maxValue and minValue;
a 2: calculating the difference d = maxValue-minValue of maxValue and minValue;
a 3: averaging the difference values into k groups, wherein the interval between each group is l = d/k, the range of the first group is (minValue, minValue + l), and so on;
a 4: counting the number n of samples in the ith groupiI is a data group subscript, and the total number of samples is t;
a 5: calculating the relative number x of the ith groupi = ni/t;
a 6: the relative number of the ith group of cranes in the real alarm area is recorded as x
i1And the relative number of the false alarm area of the crane is recorded as x
i2,Calculating the attribute distribution difference between the ith group of crane real alarm area and the crane false alarm area
;
a 7: calculating the attribute distribution difference between the real alarm area of the crane and the false alarm area of the crane
;
The step b comprises the following detailed steps:
b 1: selecting an attribute with a larger distribution difference value s;
b 2: the maximum depth q of a decision tree is appointed, the number threshold r of node samples of the decision tree and the threshold t of a kini coefficient are appointed, the value range of q is 0-20, the value range of q is 0, the depth of the decision tree is not limited, the value range of r is 1-10, and when the value of t is 0, the data purity of a representative node is highest;
b 3: creating a node, wherein the data set of the current node is D:
if the number of the samples is smaller than the threshold value r or no characteristic exists, returning to the decision sub-tree;
if the depth of the current node reaches the maximum depth of the appointed decision tree, returning to the decision sub-tree, and stopping dividing the current node;
b 4: calculating the kini coefficient of the data set D of the current node, wherein the kini coefficient represents the impure degree of the model, the smaller the kini coefficient is, the lower the impure degree is, the better the characteristic is, if the kini coefficient is smaller than a threshold value t, returning to a decision sub-tree, stopping dividing the current node, and for the data set D, the number is
Assuming that there are K classes, the number of K classes is
Then the kini coefficient of data set D is:
said
KThe total number of categories in the sample;
b 5: calculating the Gini coefficients of all characteristic values of the current node to a data set D, selecting the characteristic A with the minimum Gini coefficient and the characteristic value a, wherein A is the optimal characteristic, dividing the data set into D1 and D2 according to the optimal characteristic and the characteristic value a, D1 is less than or equal to the optimal characteristic a, D2 is greater than the optimal characteristic a, dividing the current node into two sub-nodes, and under the condition of the characteristic A characteristic value a, the Gini coefficients are as follows:
;
b 6: the child node repeats step b3 until a final decision tree is generated;
b 7: selecting a CART classification tree with highest accuracy on the test set, inputting corresponding attributes of a crane area to be tested according to the training attributes of the CART classification tree, and outputting classification results and confidence rates of the crane area to be tested.
Compared with the prior art, the invention has the following advantages and beneficial effects:
(1) the method can accurately distinguish the fuzzy crane alarm area and the crane false alarm area in the image to be detected.
(2) The invention is based on machine learning, carries out supervised learning, can rapidly carry out crane false alarm confirmation, inputs the CART classification tree model into a plurality of attributes of the crane for classification, has obviously improved classification calculation speed compared with the deep learning identification model for inputting images for classification, does not need to rely on image content, and can carry out crane false alarm confirmation with complex and various scenes.
(3) The invention greatly reduces the false alarm rate of the hidden danger of the crane of the identification model by confirming the false alarm of the crane.
Detailed Description
The invention is further described below, but not limited thereto, with reference to the following examples and the accompanying drawings.
Examples 1,
As shown in fig. 1 and 2.
A method for confirming potential crane hazard false alarm of a power transmission line channel comprises the steps of determining an attribute with a large centralized trend difference between a crane real alarm area and a crane false alarm area through calculation, and training a CART classification tree according to the attribute; and inputting the attribute of the alarm area of the crane to be tested to the CART classification tree model, and outputting a classification result and a confidence rate.
The method comprises the following detailed steps:
a. calculating the attribute distribution difference of the real alarm area and the false alarm area of the crane;
b. selecting attributes with large distribution difference from all crane real alarm and crane false alarm attributes to train a CART classification tree;
the step a comprises the following detailed steps:
a 1: respectively searching the maximum value and the minimum value in the attributes in the step a, and recording the maximum value and the minimum value as maxValue and minValue;
a 2: calculating the difference d = maxValue-minValue of maxValue and minValue;
a 3: averaging the difference values into k groups, wherein the interval between each group is l = d/k, the range of the first group is (minValue, minValue + l), and so on;
a 4: counting the number n of samples in the ith groupiI is a data group subscript, and the total number of samples is t;
a 5: calculating the relative number x of the ith groupi = ni/t;
a 6: the relative number of the ith group of cranes in the real alarm area is recorded as xi1And the relative number of the false alarm area of the crane is recorded as xi2,Calculating the attribute distribution difference s between the ith group of crane real alarm area and crane false alarm areai=|xi1-xi2|;
a 7: calculating the attribute distribution difference s = sigma s between the real warning area of the crane and the false warning area of the cranei;
The step b comprises the following detailed steps:
b 1: selecting an attribute with a larger distribution difference value s;
b 2: the maximum depth q of a decision tree is appointed, the number threshold r of node samples of the decision tree and the threshold t of a kini coefficient are appointed, the value range of q is 0-20, the value range of q is 0, the depth of the decision tree is not limited, the value range of r is 1-10, and when the value of t is 0, the data purity of a representative node is highest;
b 3: creating a node, wherein the data set of the current node is D:
if the number of the samples is smaller than the threshold value r or no characteristic exists, returning to the decision sub-tree;
if the depth of the current node reaches the maximum depth of the appointed decision tree, returning to the decision sub-tree, and stopping dividing the current node;
b 4: calculating a kini coefficient of a current node data set D, wherein the kini coefficient represents the impure degree of a model, the smaller the kini coefficient is, the lower the impure degree is, the better the characteristic is, if the kini coefficient is smaller than a threshold value t, returning to a decision sub-tree, stopping dividing the current node, and assuming that the data set D has the number of | D |, the total number of K categories is K, and the number of the kth category is | C |
kI, the kini coefficient of the data set D is:
said
KThe total number of categories in the sample;
b 5: calculating the Gini coefficients of all characteristic values of all characteristics of the current node to a data set D, selecting the characteristic A with the minimum Gini coefficient and the characteristic value a, wherein A is the optimal characteristic, and dividing the data set into D according to the optimal characteristic and the characteristic value a
1、D
2D1 for the optimal feature a being smaller than or equal to D2 for the optimal feature a being larger than D2, and segmenting the current node into two child nodes, wherein under the condition of the feature value a of the feature a, the kini coefficient is as follows:
;
b 6: the child node repeats step b3 until a final decision tree is generated;
b 7: selecting a CART classification tree with highest accuracy on the test set, inputting corresponding attributes of a crane area to be tested according to the training attributes of the CART classification tree, and outputting classification results and confidence rates of the crane area to be tested.
Application examples 1,
The method in the embodiment 1 is applied to an image shot by a certain transmission line channel, 620 crane alarms are totally obtained after hidden danger identification, distribution differences of coordinates x, coordinates y, width, height, area, length-width ratio and distance attributes from a central point of real alarms and false alarms of the crane are calculated, attributes with large distribution differences are selected to train a CART classification tree, the depth of the tree is specified, and one classification tree with the highest accuracy is selected.
1) Obtaining the attributes of coordinates x, y, width, height, area, length-width ratio and distance from a central point of the real alarm and the false alarm of the crane:
x, y, width, height, scale, area, distance, result
683,254,16,35,21,560,212,1
271,381,14,17,12,238,336,1
743,502,13,25,19,325,152,1
182,524,13,28,21,364,424,0
181,524,15,29,19,435,425,0
374,369,16,16,10,256,240,0
......
2) calculating and selecting a plurality of attributes with the maximum distribution difference:
x, height, scale, area, distance attributes
3) Specifying the depth of the tree, training the decision tree
The depth value of the tree is 0-20, 0 represents that the depth of the tree is not limited, and the obtained result is as follows:
max_depth: [0]; maxscore: [0.6855345911949685]
max_depth: [1]; maxscore: [0.8176100628930818]
max_depth: [2]; maxscore: [0.7987421383647799]
max_depth: [3]; maxscore: [0.8650314465408805]
max_depth: [4]; maxscore: [0.8635849056603774]
max_depth: [5]; maxscore: [0.8913207547169812]
max_depth: [6]; maxscore: [0.7421383647798742]
max_depth: [7]; maxscore: [0.8635849056603774]
max_depth: [8]; maxscore: [0.8672955974842768]
max_depth: [9]; maxscore: [0.9035849056603774]
max_depth: [10]; maxscore: [0.8921383647798742]
4) accuracy of outputting best decision tree
Selecting a CART classification tree with the depth of 9, wherein the accuracy rate is 0.9, and the test example is as follows:
[[341, 485, 28, 32, 11, 896, 261],
[1061, 382, 27, 29, 10, 783, 465],
[223, 732, 13, 30, 23, 390, 470],
[19, 299, 15, 29, 19, 435, 600],
[351, 406, 27, 23, 8, 621, 252]]
as a result:
[1 0 0 1 1]
620 crane hidden dangers of the power transmission line are input into the CART classification tree model, a to-be-detected set comprises 415 real crane samples and 205 crane false alarm samples, the CART classification tree model outputs 198 crane false alarms, wherein 180 crane false alarms are confirmed to be false alarms, and the application example enables the number of intersecting original unfiltered false alarms of the crane hidden dangers of the identification model to be reduced by 0.87 through confirming the crane false alarms.
The invention adopts the algorithm of the CART classification tree and realizes the automatic confirmation of the false alarm of the crane of the alarm data of the transmission line channel based on supervised learning. The method well solves the problem of false alarm confirmation of the crane which is difficult to distinguish due to fuzzy alarm images, improves the automation level of the alarm detection of the power transmission line, and reduces the time cost for operation and maintenance personnel to confirm the alarm of the crane.