Object detection network processing method for edge computing

By using depth-separable convolution and dilated convolution modules in the power system target detection network, quantizing and pruning network parameters, and performing Huffman coding, the problems of low small target detection accuracy and large resource usage are solved, and the problem of small target detection is achieved. Real-time detection capabilities on edge devices.

CN113111889BActive Publication Date: 2024-10-29STATE GRID ZHEJIANG ELECTRIC POWER CO LTD NINGBO POWER SUPPLY CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110259627.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-10
Publication Date
2024-10-29
Estimated Expiration
2041-03-10

AI Technical Summary

Technical Problem

The existing power system target detection network has low accuracy when extracting small target features, takes up a lot of resources, and has slow calculation speed. It cannot be directly deployed on edge devices and cannot achieve real-time online detection.

Method used

Depthwise separable convolution and dilated convolution modules are used to replace the convolution operation, quantize and prune network parameters, and combine with Huffman coding to reduce model size and calculation time, and improve small target detection accuracy.

Benefits of technology

It improves the detection accuracy of small targets, reduces the memory usage and computing time of the network model, and enables it to be deployed directly on edge devices to achieve real-time detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113111889B_ABST
    Figure CN113111889B_ABST
Patent Text Reader

Abstract

The embodiment of the present application proposes a target detection network processing method for edge computing, including extracting the convolution operation in target detection, replacing the obtained convolution operation with a depth-separable convolution operation; performing three dilation convolution operations on the feature map to be processed in target detection based on the obtained dilation convolution module, splicing the convolution result with the original feature map to obtain an enhanced feature map; setting a threshold, deleting the network links with weights below the threshold; dividing the network parameters of each layer into two parts, one part is quantized as the low-precision part of the original model, and the other part is retrained, repeating this step until all parameters are quantized; performing Huffman coding on the quantized weights. It can improve the detection accuracy of small targets in the power system, and at the same time reduce the memory size required to save the network model and the time required for network calculation, and can be directly deployed on the edge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a target detection network processing method for edge computing. Background Art

[0002] Target detection is about finding objects that match the desired target, and has a wide range of application scenarios in real life. The safe and stable operation of the power system is very important, so it is necessary to detect abnormal targets in the smart grid system in order to deal with safety hazards or solve existing problems in a timely manner.

[0003] The existing target detection network of the power system extracts the features of the detection target through deep convolution. This method can fully extract the features of large targets and has high detection accuracy. However, when extracting features, the image size keeps shrinking, resulting in a small receptive field, insufficient feature extraction of small targets, and low detection accuracy of small targets. The model needs to run on a powerful GPU, occupies a lot of memory, has a slow calculation speed, and cannot be directly ported to edge embedded devices.

[0004] At the same time, because the model needs to run on a powerful GPU, occupies a lot of memory and has a slow calculation speed, most network models cannot be directly ported to embedded devices and are difficult to apply to online detection systems at the edge to detect target status in real time and quickly.

[0005] At present, there are several challenges in power system target detection:

[0006] 1) The extraction of small target features is insufficient, resulting in low detection accuracy for small objects;

[0007] 2) It takes up more resources and has a slower reasoning speed;

[0008] 3) The computing resources of embedded devices at the edge are relatively limited and cannot meet the needs of the power system to detect the target status in real time. Summary of the invention

[0009] The embodiment of the present application proposes a target detection network processing method for the edge computing end, which can improve the detection accuracy of the power system for small targets, while reducing the memory size required to save the network model and the time required for network calculation, and can be directly deployed at the edge.

[0010] Specifically, the method proposed in the embodiment of the present application includes:

[0011] Step 1: Extract the convolution operation in target detection and replace it with the depth-wise separable convolution operation.

[0012] Step 2: Add a 1×1 convolution operation after the upsampling operation to form a dilated convolution module. Based on the obtained dilated convolution module, three dilated convolution operations are performed on the feature map to be processed in target detection, and the convolution result is spliced ​​with the original feature map to obtain the enhanced feature map.

[0013] Step 3: Set a threshold and delete the network links whose weight is lower than the threshold;

[0014] Step 4: Divide the network parameters of each layer into two parts, one part is used as the low-precision part of the original model for quantization, and the other part is retrained. Repeat this step until all parameters are quantized;

[0015] Step 5: Perform Huffman coding on the quantized weights.

[0016] Optionally, the step 1 includes:

[0017] 1) Divide an N×H×W×C input into C groups, perform a 3×3 convolution operation on each group, followed by a BN layer and a Leaky ReLU activation function;

[0018] Where: N represents the total number of input images; H represents the height of the input image; W represents the width of the input image; C represents the number of channels of the input image; BN layer is the batch normalization layer;

[0019] a is a fixed parameter in the interval (1, +∞);

[0020] 2) For the result after 1), k ordinary 1×1 convolutions are performed to collect the features of each point, followed by a BN layer and a Leaky ReLU activation function; the output of the depthwise separable convolution module is N×H×W×k;

[0021] Where: k is the number of channels of the output feature.

[0022] Optionally, the dilated convolution operation in step 2 specifically includes:

[0023] 1) The upsampling layer and a common 1×1 convolution form a dilated convolution module; where the upsampling layer adopts the discrete convolution method;

[0024] 2) After the network extracts features, the dilated convolution module is used to enhance the features and improve the accuracy of small object recognition. After a specific convolution layer, 1-dilated convolution, 2-dilated convolution, and 3-dilated convolution are used to re-extract the extracted features;

[0025] 3) Concatenate the three feature maps obtained in 2) with the original feature map to obtain an enhanced feature map.

[0026] Optionally, the step three includes:

[0027] 1) Introduce factor regularization term into the loss function, and set a threshold γ to train the constructed network model to find the neural network connection with weight less than γ. The loss function used in the training process is:

[0028] Where: f is the original loss function, L is the loss function after the regularization factor is introduced, is the regularization term, θ is the regularization coefficient;

[0029] 2) The loss function L after the regularization term is introduced, the weight is compared with the threshold γ, and the neural network connections with weights less than γ are deleted;

[0030] 3) Retrain the pruned neural network; fix the weights corresponding to the layers not involved in the pruning, retain the results of the previous round of training for the remaining layers, and retrain the model on this basis;

[0031] 4) Repeat the above operation to obtain a pruned network model, and the pruned network weights are a sparse matrix;

[0032] 5) The sparse structure generated after pruning is stored in a column-compressed manner, resulting in a memory overhead of 2a+n+1, where a is the number of non-zero weights and n is the number of columns.

[0033] Optionally, the step 4 includes:

[0034] 1) For layer l, the weight is w l , the weights that need to be quantized are grouped as The weights that need to be retrained are grouped as Set the threshold θ to 40%;

[0035] 2) Set w l Sort from large to small, and put the weights in the first θ range in order The remaining weights are put into The two sets of parameters are labeled 0 and 1;

[0036] 3) Yes For each element in Will Each element in is represented by the corresponding 2 n Instead, denoted as M l , α is defined as In M l The value of β is In M l The value of the last digit in the middle;

[0037] 4) Yes Each element in is quantized, and the quantization formula is

[0038]

[0039] 5) Through the random descent method The value in is used to compensate.

[0040] Optionally, the step five includes:

[0041] 1) Count the frequency of each non-repeated weight after quantization, and regard the frequency as a leaf node to construct a Huffman tree;

[0042] 2) Define the output of 0 code when visiting the left subtree in the Huffman tree, and the output of 1 code when visiting the right subtree in the Huffman tree. The leaf nodes in the Huffman tree are visited and the corresponding outputs are saved;

[0043] 3) Replace the quantized weights with the corresponding Huffman outputs to obtain the Huffman-coded network model.

[0044] Beneficial effects:

[0045] It can improve the detection accuracy of small targets in the power system, while reducing the memory size required to save the network model and the time required for network calculations, and can be directly deployed on the edge. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0047] Figure 1 A flowchart of a target detection network processing method for edge computing proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the structure and advantages of the present application clearer, the structure of the present application will be further described below in conjunction with the accompanying drawings.

[0049] For target detection at the edge of the power system, a target detection network processing method is proposed, which has high detection accuracy for small targets and less computing resources required for network storage and reasoning.

[0050] Specifically, the target detection network processing method for edge computing proposed in the embodiment of the present application is as follows: Figure 1 As shown, including:

[0051] Step 1: Extract the convolution operation in target detection and replace it with the depth-wise separable convolution operation.

[0052] Step 2: Add a 1×1 convolution operation after the upsampling operation to form a dilated convolution module. Based on the obtained dilated convolution module, three dilated convolution operations are performed on the feature map to be processed in target detection, and the convolution result is spliced ​​with the original feature map to obtain the enhanced feature map.

[0053] Step 3: Set a threshold and delete the network links whose weight is lower than the threshold;

[0054] Step 4: Divide the network parameters of each layer into two parts, one part is used as the low-precision part of the original model for quantization, and the other part is retrained. Repeat this step until all parameters are quantized;

[0055] Step 5: Perform Huffman coding on the quantized weights.

[0056] Optionally, the step 1 includes:

[0057] 1) Divide an N×H×W×C input into C groups, perform a 3×3 convolution operation on each group, followed by a BN layer and a Leaky ReLU activation function;

[0058] Where: N represents the total number of input images; H represents the height of the input image; W represents the width of the input image; C represents the number of channels of the input image; BN layer is the batch normalization layer;

[0059] a is a fixed parameter in the interval (1, +∞);

[0060] 2) For the result after 1), k ordinary 1×1 convolutions are performed to collect the features of each point, followed by a BN layer and a Leaky ReLU activation function; the output of the depthwise separable convolution module is N×H×W×k;

[0061] Where: k is the number of channels of the output feature.

[0062] Optionally, the dilated convolution operation in step 2 specifically includes:

[0063] 1) The upsampling layer and a common 1×1 convolution form a dilated convolution module; where the upsampling layer adopts the discrete convolution method;

[0064] 2) After the network extracts features, the dilated convolution module is used to enhance the features and improve the accuracy of small object recognition. After a specific convolution layer, 1-dilated convolution, 2-dilated convolution, and 3-dilated convolution are used to re-extract the extracted features;

[0065] 3) Concatenate the three feature maps obtained in 2) with the original feature map to obtain an enhanced feature map.

[0066] Optionally, the step three includes:

[0067] 1) Introduce factor regularization term into the loss function, and set a threshold γ to train the constructed network model to find the neural network connection with weight less than γ. The loss function used in the training process is:

[0068] Where: f is the original loss function, L is the loss function after the regularization factor is introduced, is the regularization term, θ is the regularization coefficient;

[0069] 2) The loss function L after the regularization term is introduced, the weight is compared with the threshold γ, and the neural network connections with weights less than γ are deleted;

[0070] 3) Retrain the pruned neural network; fix the weights corresponding to the layers not involved in the pruning, retain the results of the previous round of training for the remaining layers, and retrain the model on this basis;

[0071] 4) Repeat the above operation to obtain a pruned network model, and the pruned network weights are a sparse matrix;

[0072] 5) The sparse structure generated after pruning is stored in a column-compressed manner, resulting in a memory overhead of 2a+n+1, where a is the number of non-zero weights and n is the number of columns.

[0073] Optionally, the step 4 includes:

[0074] 1) For layer l, the weight is w l , the weights that need to be quantized are grouped as The weights that need to be retrained are grouped as Set the threshold θ to 40%;

[0075] 2) Set w l Sort from large to small, and put the weights in the first θ range in order The remaining weights are put into The two sets of parameters are labeled 0 and 1;

[0076] 3) Yes For each element in Will Each element in is represented by the corresponding 2 n Instead, denoted as M l , α is defined as In M l The value of β is In M l The value of the last digit in the middle;

[0077] 4) Yes Each element in is quantized, and the quantization formula is

[0078]

[0079] 5) Through the random descent method The value in is used to compensate.

[0080] Optionally, the step five includes:

[0081] 1) Count the frequency of each non-repeated weight after quantization, and regard the frequency as a leaf node to construct a Huffman tree;

[0082] 2) Define the output of 0 code when visiting the left subtree in the Huffman tree, and the output of 1 code when visiting the right subtree in the Huffman tree. The leaf nodes in the Huffman tree are visited and the corresponding outputs are saved;

[0083] 3) Replace the quantized weights with the corresponding Huffman outputs to obtain the Huffman-coded network model.

[0084] 1. Improvement of small target detection accuracy and inference speed

[0085] The improvement of small target detection accuracy and inference speed is mainly to improve the accuracy of small target detection and increase the speed of network model advancement when deployed to the edge.

[0086] Consider the image area and channel separately, and replace all convolution operations with depth-separable convolution operations, which includes the following steps:

[0087] (1) For an N×H×W×C input, divide it into C groups, perform a 3×3 convolution operation on each group, followed by a BN layer and a Leaky ReLU activation function;

[0088] (2) Perform k ordinary 1×1 convolutions to collect the features of each point, followed by a BN layer and a LeakyReLU activation function; the output of the depthwise separable convolution module is N×H×W×k;

[0089] After a certain depth-separable convolution operation, add a dilated convolution operation to increase the feature extraction of small objects. Specifically, the following steps are included:

[0090] (1) The upsampling layer and an ordinary 1×1 convolution form an expanded convolution module; where the upsampling layer adopts the discrete convolution method.

[0091] (2) After the network extracts features, the dilated convolution module is used to enhance the features and improve the accuracy of small object recognition. After a specific convolution layer, 1-dilated convolution, 2-dilated convolution, and 3-dilated convolution are used to extract the extracted features.

[0092] (3) Concatenate the three feature maps obtained in the previous step with the original feature map to obtain an enhanced feature map.

[0093] 2. Network Pruning and Compression

[0094] After the initial training, the network needs to be pruned, quantized, and compressed to further reduce the size of the network model.

[0095] The network model is pruned to remove network connections that have little impact on the detection results, including:

[0096] (1) Introduce a factor regularization term into the loss function. At the same time, set a threshold γ, train the constructed network model, and find the neural network connection with weight less than γ. The loss function used in the training process is:

[0097]

[0098] Where: f is the original loss function, L is the loss function after the regularization factor is introduced, is the regularization term, θ is the regularization coefficient, which can be set freely

[0099] (2) The loss function L after the regularization term is introduced, the weight is compared with the threshold γ, and the neural network connections with weights less than γ are deleted.

[0100] (3) Retrain the pruned neural network; fix the weights corresponding to the layers not involved in pruning, retain the results of the previous round of training for the remaining layers, and retrain the model based on the previous training results.

[0101] (4) Repeating the above operations, a pruned network model can be obtained, and the pruned network weights are a sparse matrix.

[0102] The weight quantization operation is performed on the pruned sparse matrix, including:

[0103] (1) For layer l, the weight is, and the weights that need to be quantized are grouped as follows The weights that need to be retrained are grouped as Set the threshold θ to 40%;

[0104] (2) w 1 Sort from large to small, and put the weights in the first θ range in order The remaining weights are put into The two sets of parameters are labeled 0 and 1;

[0105] (3) Yes For each element in Will Each element in is represented by the corresponding 2 n Instead, denoted as M 1 , α is defined as In M 1 The value of β is In M 1 The value of the last digit

[0106] (4) Yes Each element in is quantized, and the quantization formula is

[0107]

[0108] (5) Through the random descent method Compensate for the value in

[0109] Huffman coding the quantized weights has compressed the network model in one step, including:

[0110] (1) Count the frequency of each non-repeated weight after quantization, and construct a Huffman tree by treating the frequency as a leaf node

[0111] (2) Define the output code of 0 when accessing the left subtree in the Huffman tree, and the output code of 1 when accessing the right subtree in the Huffman tree. Visit the leaf nodes in the Huffman tree and save the corresponding output

[0112] (3) Replace the quantized weights with the corresponding Huffman outputs to obtain the Huffman-coded network model.

[0113] The above description is only an embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A target detection network processing method for edge computing, characterized in that: The method comprises: Step 1: Extract the convolution operation in target detection and replace it with the depth-wise separable convolution operation. Step 2: Add a 1×1 convolution operation after the upsampling operation to form a dilated convolution module. Based on the obtained dilated convolution module, three dilated convolution operations are performed on the feature map to be processed in target detection, and the convolution result is spliced ​​with the original feature map to obtain the enhanced feature map. Step 3: Set a threshold and delete the network links whose weight is lower than the threshold; Step 4: Divide the network parameters of each layer into two parts, one part is used as the low-precision part of the original model for quantization, and the other part is retrained. Repeat this step until all parameters are quantized; Step 5: Perform Huffman coding on the quantized weights; The step one comprises: 1) Divide an N×H×W×C input into C groups, perform a 3×3 convolution operation on each group, followed by a BN layer and a LeakyReLU activation function; Where: N represents the total number of input images; H represents the height of the input image; W represents the width of the input image; C represents the number of channels of the input image; BN layer is the batch normalization layer; 2) For the result after 1), k ordinary 1×1 convolutions are performed to collect the features of each point, followed by a BN layer and a LeakyReLU activation function; the output of the depthwise separable convolution module is N×H×W×k; Where: k is the number of channels of the output feature; The dilated convolution operation in step 2 specifically includes: 1) The upsampling layer and a common 1×1 convolution form a dilated convolution module; where the upsampling layer adopts the discrete convolution method; 2) After the network extracts features, the dilated convolution module is used to enhance the features and improve the accuracy of small object recognition. After a specific convolution layer, 1-dilated convolution, 2-dilated convolution, and 3-dilated convolution are used to re-extract the extracted features; 3) Concatenate the three feature maps obtained in 2) with the original feature map to obtain an enhanced feature map.

2. The target detection network processing method for edge computing according to claim 1, characterized in that: The step three comprises: 1) Introduce a factor regularization term into the loss function. At the same time, set a threshold γ, train the constructed network model, and find the neural network connection with a weight less than γ; The loss function used in the training process is: Where: f is the original loss function, L is the loss function after the regularization factor is introduced, is the regularization term, θ is the regularization coefficient; 2) The loss function L after the regularization term is introduced, the weight is compared with the threshold γ, and the neural network connections with weights less than γ are deleted; 3) Retrain the pruned neural network; fix the weights corresponding to the layers not involved in the pruning, retain the results of the previous round of training for the remaining layers, and retrain the model on this basis; 4) Repeat the above operation to obtain a pruned network model, and the pruned network weights are a sparse matrix; 5) The sparse structure generated after pruning is stored in a column-compressed manner, resulting in a memory overhead of 2a+n+1, where a is the number of non-zero weights and n is the number of columns.

3. The target detection network processing method for edge computing according to claim 1, characterized in that: The fourth step comprises: 1) For layer l, the weight is w l , the weights that need to be quantized are grouped as The weights that need to be retrained are grouped as Set the threshold θ to 40%; 2) Set w l Sort from large to small, and put the weights in the first θ range in order The remaining weights are put into The two sets of parameters are labeled 0 and 1; 3) Yes For each element in Will Each element in is represented by the corresponding 2 n Instead, denoted as M l , α is defined as In M l The value of β is In M l The value of the last digit in the middle; 4) Yes Each element in is quantized, and the quantization formula is 5) Through the random descent method The value in is used to compensate.

4. The target detection network processing method for edge computing according to claim 1, characterized in that: The step five comprises: 1) Count the frequency of each non-repeated weight after quantization, and regard the frequency as a leaf node to construct a Huffman tree; 2) Define the output of 0 code when visiting the left subtree in the Huffman tree, and the output of 1 code when visiting the right subtree in the Huffman tree. The leaf nodes in the Huffman tree are visited and the corresponding outputs are saved; 3) Replace the quantized weights with the corresponding Huffman outputs to obtain the Huffman-coded network model.