An insulator defect detection method based on lightweight YOLOv4 in complex scenarios
By adopting lightweight GhostNet and channel attention mechanism on YOLOv4, combined with SPP and PANet, and using generalized distribution for bounding box modeling and Quality Focal Loss training, the accuracy and real-time problems of insulator defect detection in complex scenarios are solved and achieved. Efficient detection effect.
Patent Information
- Application Number
- CN202111532763.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology has insufficient accuracy and real-time performance in detecting insulator defects in high-voltage transmission lines in complex scenarios. The traditional single-stage target detection algorithm is computationally intensive and has inconsistent classification and positioning quality estimates, which cannot meet the needs of real-time detection.
Adopt an insulator defect detection method based on lightweight YOLOv4, use the GhostNet backbone network and introduce the channel attention mechanism ECA module, remove the average pooling layer and fully connected layer, combine SPP and PANet for feature fusion, and perform bounding box probability through generalized distribution Modeling and Quality Focal Loss are used for supervised training, and classification and positioning quality estimation are jointly represented to improve detection accuracy and speed.
It achieves high-precision insulator and defect detection in complex scenarios, significantly reduces the amount of calculation and parameters, realizes real-time detection, avoids the problem of inconsistent classification and positioning quality estimation, and improves the accuracy and speed of detection.
Smart Images

Figure CN114359167B
Abstract
Description
Technical Field
[0001] The present invention relates to an insulator defect detection method based on lightweight YOLOv4 in complex scenarios, belongs to the field of computer vision, and specifically relates to a method that can identify and detect self-explosion defects of insulators of high-voltage transmission lines in complex scenarios. Background Art
[0002] Insulators are one of the key components of high-voltage transmission lines, and their main functions are support, fixation and insulation. Due to the influence of external factors such as heavy rain, strong winds, and lightning strikes, insulators are easily damaged, resulting in defects such as dirt, cracks, string drop, and self-explosion. Therefore, regular inspections of insulators on high-voltage transmission lines are very necessary.
[0003] At present, the main method for inspecting insulators on high-voltage transmission lines is drone aerial photography, but the efficiency of using manual recognition methods to process massive aerial images is extremely low, so researchers use image processing methods to detect insulator defects. Traditional insulator defect detection algorithms mainly include texture feature detection, edge detection, and threshold segmentation. However, these traditional methods can only perform local positioning and defect detection on insulators in specific environments, and the detection effect and real-time performance are poor in complex scenarios.
[0004] After the AlexNet algorithm won the ImageNet competition in 2012, deep learning has attracted widespread attention again, and the use of deep learning-based target detection algorithms for insulator inspection has become a new trend. In the early stage, the improved two-stage target detection algorithm was mainly used for insulator defect detection, which can improve the detection accuracy to a certain extent, but the model has a large amount of calculation and slow detection speed, which cannot meet the needs of real-time detection. Therefore, the single-stage target detection algorithm is mainly used in the later stage to realize the real-time detection of defective insulators. However, the traditional single-stage target detection algorithm has the problem of inconsistent use of classification and positioning quality estimation, and it performs bounding box regression under the Diract-delta distribution, lacks the estimation of label uncertainty, which makes it inaccurate to locate insulators and defects in complex scenes. Summary of the invention
[0005] The purpose of the present invention is: in view of the shortcomings of the background technology, in order to improve the detection speed of insulator defects in high-voltage transmission lines and the detection accuracy in complex scenarios, the present invention proposes an insulator defect detection method based on lightweight YOLOv4 in complex scenarios. The method can adapt to insulator defect detection in complex scenarios such as occlusion and blur, and achieve better detection accuracy than traditional algorithms; and can greatly reduce the amount of calculation and parameter amount of the algorithm, so as to achieve the goal of real-time detection.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is: an insulator defect detection method based on lightweight YOLOv4 in complex scenarios, characterized in that it includes the following steps:
[0007] An insulator defect detection method based on lightweight YOLOv4 in complex scenarios, characterized by comprising the following steps:
[0008] Step 1: Obtain the characteristics of insulators and their self-explosion defects. Use the lightweight backbone network GhostNet to extract the characteristics of insulators and their defects, and further lightweight GhostNet. The specific method is to integrate the channel attention mechanism ECA module (Efficient Channel Attention) into GhostNet, and remove the last average pooling layer, 1×1 convolution layer and full connection layer of the network to obtain ECA-GhostNet;
[0009] Step 2: First, three features of different scales are derived from the ECA-GhostNet network obtained in step 1 for feature fusion. Then, the SPP structure (Spatial Pyramid Pooling) is used in the feature fusion layer to obtain a rich receptive field, and then the PANet structure (Path Aggregation Network) is used for feature fusion.
[0010] Step 3: During prediction, we first introduce a joint representation method of classification and positioning quality estimation to obtain high-quality insulator and defect detection boxes. Quality Focal Loss (QFL) is used to supervise the joint representation during the training phase. Then, generalized distribution is used to implement probability modeling of bounding box coordinates, and the statistics of generalized distribution are used to guide positioning quality estimation to obtain reliable positioning quality estimation score values. Distribution Focal Loss (DFL) is used to supervise bounding box regression during the training phase.
[0011] In the above complex scenario, the insulator defect detection method based on lightweight YOLOv4, the specific steps of step 1 are: first, the backbone network CSPdarknet53 in the original YOLOv4 algorithm is replaced by a more lightweight new end-side neural network GhostNet. Since the output feature maps of the standard convolution are highly similar to each other, GhostNet uses a simple Ghost module to generate these similar feature maps. The basic operation process is as follows:
[0012] Assume the standard convolution input is X∈R c×h×w, where c is the number of input channels, h and w are the height and width of the input feature map, and the number of output channels is n. The Ghost module first uses a small number of standard convolution kernels to generate m original feature maps:
[0013] Y'=X*f' (1)
[0014] Where Y′ is the output of the Ghost module, * represents the convolution operation, and f′∈R c×k×k×m is the convolution kernel, k is the size of the convolution kernel, and m≤n. The other part uses a simple linear operation to generate s similar feature maps from the original feature map:
[0015]
[0016] Where i is the number of the original feature map, j is the number of the linear operation, and y′ i is the i-th feature map among the m original feature maps, Φ ij is the jth linear operation, used to generate similar feature graph y ij Simple linear operations can generate m×s output feature maps, thus avoiding the use of a large number of convolution operations and greatly reducing the number of parameters and calculations.
[0017] In the above complex scenario, the insulator defect detection method based on lightweight YOLOv4, in step 1, further lightweight GhostNet is performed, and the specific steps are: introducing a more lightweight and efficient ECA channel attention mechanism to replace the SE module, and removing the last average pooling layer, 1×1 convolution layer and fully connected layer of GhostNet to form ECA-GhostNet. ECA is an improvement on the channel attention mechanism SE, which adopts a local cross-channel interaction strategy without dimensionality reduction, and uses a fast one-dimensional convolution for local cross-channel interaction:
[0018] ω=σ(Conv1D k (y)) (3)
[0019] Where ω is the output of cross-channel interaction, Conv1D represents a one-dimensional convolution operation, and k is the coverage of local cross-channel interaction, which can be adaptively determined according to the number of channels C of the input feature map:
[0020]
[0021] Among them, ψ is a linear operation, b and γ are constants, set to 1 and 2 respectively; |t| odd Indicates that k is the odd number closest to t. y is the input feature vector, and σ represents the Sigmoid activation function.
[0022] In the above complex scenario, the insulator defect detection method based on lightweight YOLOv4, the prediction process in step 3, the specific steps are as follows:
[0023] Step 3.1: First, the regression branch uses the generalized distribution instead of the Dirac-delta distribution to perform probability modeling on the insulator and defect bounding box, taking the range of the true box y as y0≤y≤y n , where y0 and y n is the minimum and maximum value of the true box y, then the bounding box prediction value It can be expressed as:
[0024]
[0025] Where P(x) represents the generalized distribution of the regression branch.
[0026] Since convolutional neural networks cannot achieve continuous integration, the integral on the continuous domain is converted into a discrete form, and the continuous interval [y0,y n ] is discretized into a set {y0,y1,…,y n}, take the interval as 1, and use the relative offset from the sampling point to the four sides of the bounding box as the regression target. The four sides of the bounding box (left, right, top, and bottom) are marked as l, r, t, and b respectively, then the generalized distribution of the bounding box can be expressed as P m = {P m (y0),P m (y1),...,P m (y n )}, where m∈{l,r,t,b}, and satisfies Then the bounding box prediction value It can also be expressed as:
[0027]
[0028] After the network introduces the generalized distribution, the coordinate values of the bounding box are arbitrary, so there are infinite combinations that can make the final integral result satisfy equation (6); therefore, the DFL loss function is used in the training phase to optimize the bounding box regression, which increases the two values y closest to the true value y v With y v+1 The probability of makes the network quickly focus on learning the coordinates near the target bounding box y, which is expressed as follows:
[0029] DFL(S v ,S v+1 )=-((y v+1 -y)log(S v )+(yy v )log(S v+1 )) (7)
[0030] Where S v With S v+1 Respectively represent y v With y v+1 The generalized distribution probability value of .
[0031] Step 3.2: The classification branch introduces a joint representation method of classification and positioning quality estimation. The positioning quality estimation is implemented using a simple sub-network DGQP (Distribution-Guided Quality Predictor), and the statistics of the generalized distribution in step 3.1 are used to guide the positioning quality estimation: the top-k probability values and their means in the generalized distribution learned by the regression branch are taken as statistical features and input into the sub-network:
[0032] F=Concat({Topkm(P m )|m∈{l,r,t,b}}) (8)
[0033] Where F is the input of the DGQP network, Concat(·) is the channel concatenation operation, Topkm is the joint operation of calculating the Top-k value and its mean, and m is the relative offset from the sampling point to the four sides of the border. The DGQP subnetwork uses two fully connected layers, followed by ReLU and Sigmoid activation functions to achieve positioning quality estimation. Formula (8) is its forward propagation process:
[0034] I=σ(W2δ(W1F)) (9)
[0035] Where I is the output of the DGQP module, δ and σ represent the ReLU and Sigmoid activation functions respectively; and W1∈R p×4(z+1) is the weight matrix of the first fully connected layer in DGQP, W2∈R 1×p is the weight matrix of the second fully connected layer in DGQP, z is the number of values in Top-k; p is the dimension of the hidden layer of the fully connected layer, then the joint representation output is:
[0036] J=C×I (10)
[0037] Where J is the joint representation output, C is the classification branch output, and I is the DGQP subnetwork output.
[0038] The QFL loss function is used in the training stage to supervise the joint representation, mainly to solve the imbalance problem between foreground and background classes in the single-stage target detection algorithm. Its expression is as follows:
[0039] QFL(α)=-|y-α| β ((1-y)log(1-α)+ylog(α)) (11)
[0040] Where y represents the true value, α is the output value of the joint representation, |y-α| β is the scaling factor and β is an adjustable parameter.
[0041] The present invention can realize real-time detection of insulators and defects of high-voltage transmission lines in complex scenes such as blur and occlusion. Specifically, the present invention has the following characteristics:
[0042] (1) Based on the original YOLOv4 algorithm, a more lightweight ECA-GhostNet backbone network is adopted, which greatly reduces the complexity and computational complexity of the model and improves the detection speed;
[0043] (2) Using a more flexible generalized distribution instead of the Dirac-delta distribution to achieve probabilistic modeling of insulators and their defects, and increase the uncertainty estimation of labels;
[0044] (3) The classification branch adopts the method of jointly representing classification and localization quality estimation to avoid the inconsistency problem of classification and localization quality estimation in the training and testing process of the algorithm, thereby obtaining high-quality detection boxes.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] (1) This method can realize real-time detection of insulators and their defects, avoiding the problem of slow detection speed in traditional algorithms;
[0047] (2) This method can improve the detection performance in real complex scenes such as blur and occlusion, increase the estimation of label uncertainty, and improve positioning accuracy;
[0048] (3) This method effectively avoids the problem of inconsistent use of classification and localization quality estimation in the training and testing processes. It adopts a method of jointly representing classification and localization quality estimation and uses localization quality estimation to supervise classification to obtain high-quality detection boxes. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is the network structure of the YOLOv4 algorithm.
[0050] Figure 2 This is a schematic diagram of the Ghost module.
[0051] Figure 3 This is an example of a blurred and occluded target in a complex scene.
[0052] Figure 4 It is a lightweight YOLOv4 insulator defect detection network framework.
[0053] Figure 5 This is a schematic diagram of the ECA module.
[0054] Figure 6 It is a schematic diagram of generalized distribution modeling. DETAILED DESCRIPTION
[0055] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.
[0056] Firstly, some concepts mentioned in the present invention are introduced below:
[0057] YOLO series algorithms (You Only Look Once) are typical single-stage target detection algorithms. YOLOv4 is the fourth version of the YOLO series algorithms. The network structure is shown in the attached figure. Figure 1 As shown in the figure, the backbone network is CSPdarknet53, which integrates the cross-stage partial network structure (CSPNet) on the basis of Darknet53, effectively solving the problem of gradient information duplication between different layers in the network reasoning process; a spatial pyramid pooling module (SPP) is added at the end of the backbone network to make the output have a richer receptive field; the outputs of the last three residual blocks of the backbone network are used as targets of different scales, and the path aggregation structure (PANet) is used for feature fusion, and the three outputs are respectively input into YOLOhead to obtain three prediction results, which are used for the detection of small, medium and large scale targets respectively.
[0058] The channel attention mechanism simulates the attention mechanism of the human brain. When the human brain obtains external visual or auditory information, it generally pre-processes all the information and focuses on important or interesting information to improve the efficiency of information processing. The channel attention mechanism allows the network model to pay more attention to the channel features of more important or more interesting information and suppress irrelevant and unimportant information.
[0059] The Dirac-delta distribution is also called the unit impulse function and is defined as follows:
[0060] p(x)=δ(x-μ),x≠μ (1)
[0061]
[0062] The Dirac-delta distribution can ensure that all the mass in the probability distribution is concentrated at one point. The traditional target detection bounding box prediction only includes four values. For each individual output value, it is equivalent to optimizing a Dirac-delta distribution, that is, a probability distribution with an integral value of 1 in a given interval. There is only a supervisory signal at a certain point, but no supervisory signal elsewhere.
[0063] The present invention improves on the YOLOv4 target detection algorithm and implements a lightweight YOLOv4 insulator defect detection algorithm in complex scenarios. The present invention is divided into two parts: first, a lightweight backbone network; second, a prediction layer introduces a joint representation method of classification and positioning quality estimation, and uses generalized distribution to perform probabilistic modeling of insulators and their defect bounding boxes.
[0064] The present invention is further described below in conjunction with the accompanying drawings.
[0065] Figure 4 It is a lightweight YOLOv4 insulator defect detection network framework, which is mainly composed of four parts: input, backbone network, feature fusion layer and prediction layer. The current mainstream target detection algorithms are all based on these four parts.
[0066] The lightweight backbone network is an improvement on the CSPdarknet53 network in the original YOLOv4 algorithm, which reduces the amount of network calculation and parameters and improves the detection speed. The detailed improvement process is as follows: First, the more lightweight GhostNet network is used to replace the CSPdarknet53 network as the backbone network of the improved algorithm to extract the characteristics of insulators and their defects. The core module of GhostNet is the Ghost module, such as Figure 2 As shown, the main operation process is as follows:
[0067] Step 1: Use a small number of standard convolution kernels (selectable in proportion) to generate m original feature maps, namely Figure 2 Identity operation in . Assume that the standard convolution input feature map is X∈R c×h×w , where c is the number of input channels, h and w are the height and width of the input feature map, and the number of output channels is n, then the operation can be expressed as:
[0068] Y'=X*f' (3)
[0069] Among them, Y′ is the output of the Ghost module, * represents the standard convolution operation, and f∈R c×k×k×m is the standard convolution kernel, k is the size of the convolution kernel, and m≤n.
[0070] Step 2: Use simple linear operations to generate s similar feature maps from the original feature map obtained in the first step. The operation process can be expressed as:
[0071]
[0072] Where i is the number of the original feature map, j is the number of the linear operation, and y′ i is the i-th feature map among the m original feature maps, Φ ij is the jth linear operation, used to generate similar feature graph y ij By utilizing linear operations, m×s output feature maps can be generated, thus avoiding the use of a large number of convolution operations and effectively reducing the number of parameters and calculations.
[0073] Then, GhostNet is further improved by replacing the channel attention mechanism module SE used in GhostNet with the more efficient and lightweight ECA channel attention mechanism, and removing the last average pooling layer, 1×1 convolution layer and fully connected layer of GhostNet to form ECA-GhostNet. Figure 5 It is a schematic diagram of the ECA module, and its operation process can be expressed as:
[0074] Step 1: Use global average pooling (GAP) to aggregate the input feature map of size W×H×C.
[0075] Step 2: Use one-dimensional convolution for local cross-channel interaction:
[0076] ω=σ(Conv1D k (y)) (5)
[0077] Where ω is the output of cross-channel interaction, Conv1D represents one-dimensional convolution, and k represents the coverage of local cross-channel interaction, that is, the size of the convolution kernel. k can be adaptively determined according to the number of channels C of the input feature. The calculation formula is as follows:
[0078]
[0079] Where ψ is a linear operation, b and γ are constants, which are 1 and 2 respectively; |t| odd Indicates that k takes the odd number closest to t. y is the input feature map, and σ represents the Sigmoid activation function.
[0080] In the prediction stage, the insulator and its defect border are first modeled using generalized distribution in the regression branch to adapt to the detection in complex scenes; then the classification branch adopts the joint representation method of classification and positioning quality estimation to obtain high-quality detection frames. Figure 4The specific implementation steps of CIJhead (Classification-IoU Jointhead) are as follows:
[0081] Step 1: Use generalized distribution to perform probability modeling on the bounding boxes of insulators and their defects. The bounding box positioning of the YOLO series of algorithms is all learned under the Dirac-delta distribution, but in complex scenes, there are often uncertain targets such as blur and occlusion. Figure 3 This is an example of a blurred and occluded target in a complex scene. In this case, the Dirac-delta distribution cannot accurately describe the flexible distribution of the bounding box, so a more flexible generalized distribution is needed to represent the flexible distribution of the bounding box. In CIJhead, P(x) represents the bounding box regression branch, which uses the mathematical expectation of the generalized distribution as the bounding box coordinate prediction value, and sets the range of the label y to y0≤y≤y n , where y0 and y n is the minimum and maximum value of the true box y, so the predicted value of the bounding box It can be expressed as:
[0082]
[0083] Where P(x) represents the generalized distribution of the regression branch.
[0084] Since continuous integration cannot be implemented in convolutional neural networks, it is necessary to transform the integral on the continuous domain into a discrete form and convert the continuous interval [y0,y n ] is discretized into a set {y0,y1,...,y n}, take the sampling interval as 1, and use the relative offset from the sampling point to the four sides of the bounding box as the regression target, Figure 6 This is a schematic diagram of generalized distribution probability modeling. The left, right, top, and bottom edges of the bounding box are marked as l, r, t, and b respectively. The generalized distribution of the bounding box can be expressed as P m = {P m (y0),P m (y1),...,P m (y n )}, where m∈{l,r,t,b}, and satisfies The predicted value of the bounding box at this time It can be expressed as:
[0085]
[0086] Since the value of the generalized distribution is arbitrary, there are infinite combinations that can make the final integral result satisfy equation (8), which leads to low network learning efficiency. Therefore, the DFL loss function is introduced in the training stage to optimize the bounding box regression, which significantly increases yv With y v+1 (The two values closest to the true value y, y v ≤y≤y v+1 ) to enable the network to quickly focus on the coordinates near the learning target border y, thereby improving the learning efficiency of the network and accelerating the convergence speed. The expression is as follows:
[0087] DFL(S v ,S v+1 )=-((y v+1 -y)log(S v )+(yy v )log(S v+1 )) (9)
[0088] Since bounding box regression does not have the problem of class imbalance, the DFL loss function only needs to be implemented using cross entropy, where S v , S v+1 Respectively represent y v and v+1 The probability value of the generalized distribution of .
[0089] Step 2: Joint representation of classification and positioning quality. In CIJhead, C represents the classification branch, and the positioning quality estimation is implemented using a simple sub-network DGQP (Distribution-Guided Quality Predictor), and the generalized distribution of the regression branch is used to guide the positioning quality estimation: the top-k probability values and their means in the generalized distribution learned by the regression branch are taken, and they are concatenated as the input of the sub-network:
[0090] F=Concat({Topkm(P m )|m∈{l,r,t,b}}) (10)
[0091] Where F is the input of the DGQP network, Concat(·) represents the channel concatenation operation, which mainly concatenates the Top-k probability value and its mean of the generalized distribution, Topkm is the joint operation of calculating the Top-k probability value and its mean, and m is the relative offset from the sampling point to the four sides of the border. The DGQP subnetwork uses two fully connected layers (FC), followed by ReLU and Sigmoid activation functions to achieve positioning quality estimation. The DGQP forward propagation process is as follows:
[0092] I=σ(W2δ(W1F)) (11)
[0093] Where I is the output of the DGQP module, δ and σ represent the ReLU and Sigmoid activation functions respectively; and W1∈Rp×4(z+1) is the weight matrix of the first fully connected layer in DGQP, W2∈R 1×p is the weight matrix of the second fully connected layer in DGQP, z is the number of Top-k values, and k is 4 in the present invention; p is the dimension of the hidden layer of the fully connected layer, and p is 64 in the present invention, so the output of the joint representation of classification and positioning quality estimation is:
[0094] J=C×I (12)
[0095] Where J is the joint representation output, C is the classification branch output, and I is the DGQP subnetwork output.
[0096] The QFL loss function is used to supervise the joint representation in the training stage. The QFL loss function is an improvement on the Focal Loss (FL) loss function. FL is proposed to solve the imbalance problem between foreground and background classes in the single-stage target detection algorithm, but it is only applicable to discrete labels. After the introduction of the classification-IoU joint representation, the label becomes a continuous value between 0 and 1, so the original FL loss function is no longer applicable. Therefore, the QFL loss function has made the following improvements to the above problems:
[0097] (1) Expand the -log(·) part of FL to the complete cross entropy;
[0098] (2) The dynamic scaling factor is expanded to the absolute value of the continuous label y and the joint representation output α, that is:
[0099] QFL(α)=-|y-α| β ((1-y)log(1-α)+ylog(α)) (13)
[0100] Where β is an adjustable parameter, and this paper takes β = 2; similar to the FL loss function, QFL is composed of the complete cross entropy and the scaling factor |y-α| β The main function of the scaling factor is to reduce the contribution of easy-to-classify samples to the loss, so that the network can pay more attention to difficult samples.
[0101] It should be understood that parts not elaborated in detail in this specification belong to the prior art.
[0102] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.
Claims
1. An insulator defect detection method based on lightweight YOLOv4 in complex scenarios, characterized in that: The following steps are involved: Step 1: Obtain the characteristics of the insulator and its self-explosion defect; use the lightweight backbone network GhostNet to extract the characteristics of the insulator and its defect, and further lightweight GhostNet. The specific method is: integrate the channel attention mechanism ECA module (Efficient Channel Attention) into the GhostNet network, and remove the last average pooling layer, 1×1 convolution layer and fully connected layer of the network to obtain ECA-GhostNet; Step 2: First, three features of different scales are derived from the ECA-GhostNet network obtained in step 1 for feature fusion. Then, the SPP structure (Spatial Pyramid Pooling) is used in the feature fusion layer to obtain a richer receptive field, and then the PANet structure (Path Aggregation Network) is used for feature fusion. Step 3: During prediction, the method of joint representation of classification and positioning quality estimation is first introduced to obtain high-quality insulator and defect detection boxes. Quality Focal Loss (QFL) is used to supervise the joint representation during the training phase. Then, generalized distribution is used to implement the probability modeling of bounding box coordinates, and the statistics of generalized distribution are used to guide positioning quality estimation to obtain reliable positioning quality estimation score values. Distribution Focal Loss (DFL) is used to supervise the bounding box regression during the training phase. The specific steps of step 1 are: first, the backbone network CSPdarknet53 in the original YOLOv4 algorithm is replaced by a more lightweight new end-side neural network GhostNet; since the output feature maps of the standard convolution are highly similar to each other, GhostNet uses a simple Ghost module to generate these similar feature maps, and its basic operation process is as follows: Assume the standard convolution input is X∈R c×h×w , where c is the number of input channels, h and w are the height and width of the input feature map, and the number of output channels is n. The Ghost module first uses a small number of standard convolution kernels to generate m original feature maps: Y'=X*f' (1) Where Y′ is the output of the Ghost module, * represents the convolution operation, and f′∈R c×k×k×m is the convolution kernel, k is the size of the convolution kernel, and m≤n; the other part uses a simple linear operation to generate s similar feature maps from the original feature map: Where i is the number of the original feature map, j is the number of the linear operation, and y' i is the i-th feature map among the m original feature maps, Φ ij is the jth linear operation, used to generate similar feature graph y ij ; Simple linear operations can generate m×s output feature maps, thus avoiding the use of a large number of convolution operations and greatly reducing the number of parameters and calculations; In step 1, GhostNet is further lightweighted. Specifically, the more lightweight and efficient ECA channel attention mechanism is introduced to replace the SE module, and the last average pooling layer, 1×1 convolution layer and fully connected layer of GhostNet are removed to form ECA-GhostNet. ECA is an improvement on the channel attention mechanism SE, which adopts a local cross-channel interaction strategy without dimensionality reduction and uses a fast one-dimensional convolution for local cross-channel interaction: ω=σ(Conv1D k (y)) (3) Where ω is the output of cross-channel interaction, Conv1D represents a one-dimensional convolution operation, and k is the coverage of local cross-channel interaction, which can be adaptively determined according to the number of channels C of the input feature map: where ψ is a linear operation, b and γ are constants, set to 1 and 2 respectively; |t| odd Indicates that k takes the odd number closest to t; y is the input feature vector, and σ represents the Sigmoid activation function; The prediction process in step 3 is as follows: Step 3.1: First, the regression branch uses the generalized distribution instead of the Dirac-delta distribution to perform probability modeling on the insulator and defect bounding box, taking the range of the true box y as y0≤y≤y n , where y0 and y n is the minimum and maximum value of the true box y, then the bounding box prediction value It can be expressed as: Where P(x) represents the generalized distribution of the regression branch; Since convolutional neural networks cannot achieve continuous integration, the integral on the continuous domain is converted into a discrete form, and the continuous interval [y0,y n ] is discretized into a set {y0,y1,...,y n }, take the interval as 1, use the relative offset from the sampling point to the four sides of the bounding box as the regression target; mark the four sides of the bounding box (left, right, top, and bottom) as l, r, t, and b respectively, then the generalized distribution of the bounding box can be expressed as P m = {P m (y0),P m (y1),...,P m (y n )}, where m∈{l,r,t,b}, and satisfies Then the bounding box prediction value It can also be expressed as: After the network introduces the generalized distribution, the coordinate values of the bounding box are arbitrary, so there are infinite combinations that can make the final integral result satisfy equation (6); therefore, the DFL loss function is used in the training phase to optimize the bounding box regression, which increases the two values y closest to the true value y v With y v+1 The probability of makes the network quickly focus on learning the coordinates near the target bounding box y, which is expressed as follows: DFL(S v ,S v+1 )=-((y v+1 -y)log(S v )+(y-y v )log(S v+1 )) (7) Where S v With S v+1 Respectively represent y v With y v+1 The generalized distribution probability value of ; Step 3.2: The classification branch introduces a joint representation method of classification and positioning quality estimation. The positioning quality estimation is implemented using a simple sub-network DGQP (Distribution-Guided Quality Predictor), and the statistics of the generalized distribution in step 3.1 are used to guide the positioning quality estimation: the top-k probability values and their means in the generalized distribution learned by the regression branch are taken as statistical features and input into the sub-network: F=Concat({Topkm(P m )|m∈{l,r,t,b}}) (8) Where F is the input of the DGQP network, Concat(·) is the channel concatenation operation, Topkm is the joint operation of calculating the Top-k value and its mean, and m is the relative offset from the sampling point to the four sides of the border. The DGQP subnetwork uses two fully connected layers, followed by ReLU and Sigmoid activation functions to achieve positioning quality estimation. Formula (8) is its forward propagation process: I=σ(W2δ(W1F)) (9) Where I is the output of the DGQP module, δ and σ represent the ReLU and Sigmoid activation functions respectively; and W1∈R p×4(z+1) is the weight matrix of the first fully connected layer in DGQP, W2∈R 1×p is the weight matrix of the second fully connected layer in DGQP, z is the number of values in Top-k; p is the dimension of the hidden layer of the fully connected layer, then the joint representation output is: J=C×I (10) Where J is the joint representation output, C is the classification branch output, and I is the DGQP subnetwork output; The QFL loss function is used in the training stage to supervise the joint representation, mainly to solve the imbalance problem between foreground and background classes in the single-stage target detection algorithm. Its expression is as follows: QFL(α)=-|y-α| β ((1-y)log(1-α)+ylog(α)) (11) Where y is the true value of the bounding box, α is the output value of the joint representation, |y-α| β is the scaling factor and β is an adjustable parameter.
