SE-FPN-based target detection model training method, target detection method and device
Through the SE-FPN model and improved sample allocation strategy, the problem of dense and small object detection accuracy of single-stage object detectors is solved, and more efficient resource utilization and detection accuracy are achieved.
Patent Information
- Application Number
- CN202011560657.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-25
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2040-12-25
AI Technical Summary
The existing single-stage object detector has low accuracy when detecting dense targets and small targets, and due to uneven target scale distribution, the resource waste and detection accuracy of the feature pyramid structure are affected.
Using the SE-FPN-based object detection model, through improving image preprocessing and sample selection strategies, multiple targets of different sizes are allocated to different pyramid feature layers according to specific allocation strategies, and the threshold is calculated by DIoU mean and standard deviation, and the appropriate one is selected. The anchor is trained, and the model is trained in combination with cross entropy and CIoU loss functions.
Improve the efficiency and accuracy of object detection, ensure that each feature layer is fully trained, reduce resource waste, and enhance the detection ability of dense targets.
Smart Images

Figure CN112561801B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to a target detection model training method based on SE-FPN, a target detection method and a device. Background Art
[0002] Object detection is a basic research topic in the field of computer vision and is widely used in fields such as unmanned driving, intelligent monitoring and automatic target recognition. Traditional object detection methods mainly use sliding windows to select and locate regions, and then classify them through classifiers such as support vector machines (SVM). With the development of deep learning, convolutional neural networks have achieved a series of results in object detection. Compared with traditional object detection methods, detection methods based on deep convolutional network models have the advantages of autonomous feature extraction and strong generalization ability, and have become one of the important research topics in the field of object detection.
[0003] At present, the target detection methods based on deep learning are mainly divided into two categories: one is the two-stage target detector, such as Faster-RCNN, which first extracts candidate regions through the region generation network, and then sends the candidate regions to the detection network for target classification and position regression. The two-stage detector has high detection accuracy, but slow speed and it is difficult to meet the real-time requirements. The other is the single-stage detector, such as Yolo, which divides the image into multiple grids, directly predicts the probability of each grid containing a target through the detection network, and regresses the bounding box and category information. The single-stage detector has a fast detection speed and can detect targets in real time, but the detection accuracy is low, especially for dense targets and small targets.
[0004] There are two main problems with single-stage detectors:
[0005] (1) Target prediction is the responsibility of the grid where the target center is located. When the targets are densely packed, a grid may contain multiple targets, but only one set of prediction parameters is output in the end. Only one target can be accurately predicted, and other targets are ignored or have large errors.
[0006] (2) The detector uses a feature pyramid structure to detect images in layers, and each feature layer is predicted using a specific anchor. However, in the data sets obtained from actual projects, the scales of objects are often unevenly distributed. Most objects are trained on one layer of the pyramid, and the other two layers cannot be trained well, which not only wastes resources but also affects detection accuracy. Summary of the invention
[0007] In view of the above situation, the present invention provides a target detection model training method based on SE-FPN, a target detection method and device, an electronic device and a readable storage medium, constructs a target detection network model based on SE-FPN, and improves the image preprocessing method and sample selection strategy and trains the model, which is applied to target detection, thereby improving the target detection efficiency.
[0008] In order to achieve the purpose of the present invention, the following scheme is proposed:
[0009] A target detection model training method based on SE-FPN, comprising the steps of:
[0010] After scaling multiple training images obtained from the dataset according to different scaling factors, they are stitched into a new image, and the target labels corresponding to the multiple training images are scaled and stitched in the same way. The new image includes multiple targets of different sizes.
[0011] Allocate multiple objects of different sizes to different pyramid feature layers of the SE-FPN object detection model according to a predetermined allocation strategy;
[0012] In each pyramid feature layer, find the m positions closest to the center point according to the true value of the training sample assigned to this layer, and calculate the DIoU between all anchors and the true value of the m positions, denoted as D g , calculate D g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output;
[0013] The classification loss function and position regression function are calculated respectively, and the model is trained by the back propagation algorithm.
[0014] Furthermore, the SE-FPN target detection model includes three layers of feature pyramids, and multiple targets of different sizes are assigned to different pyramid feature layers of the SE-FPN target detection model according to the following allocation strategy:
[0015] If the width and height of the target are both greater than or equal to the first allocation threshold T l , assigned to the first level of the feature pyramid, i.e., the topmost pyramid level;
[0016] If the width and height of the target are both greater than the second allocation threshold T m But less than the first allocation threshold T l, it is assigned to the second pyramid layer;
[0017] Otherwise, it is assigned to the third pyramid level;
[0018] The first allocation threshold T l Greater than the second allocation threshold T m .
[0019] Furthermore, DIoU is D g The calculation formula is:
[0020]
[0021] Among them, IoU represents the IoU value between the prediction and the true value of the sample, ρ 2 (b,b gt ) represents the predicted center b and the target true center b gt The Euclidean distance of , d represents the diagonal distance of the smallest rectangle that can cover both the anchor and the target box.
[0022] Furthermore, the classification loss function adopts the cross entropy loss function, and the position regression function adopts the CIoU loss function.
[0023] Furthermore, the SE-FPN target detection model includes a backbone network, SE-FPN and a head detection module backbone network, which is used to extract features from images input into the SE-FPN target detection model, and obtain multiple feature layers with different scaling scales for constructing the SE-FPN;
[0024] The head detection module consists of two parts: a classification module and a position regression module. The classification module is used to first use w convolution layers for feature extraction, then use the fully connected layer for classification, and output the classification results; the position regression module is used to use s convolution layers for the final position regression, and output the center position coordinates and scale information of the target;
[0025] SE-FPN is constructed through the following steps:
[0026] Extract features of different layers through the backbone network k , where k = 1, 2, 3, from top to bottom are f1, f2, f3, and the feature pyramid is constructed from the i-th layer, i starts from 1:
[0027] Then build a multi-layer feature pyramid FPN from top to bottom. Suppose FPN is built from the i-th layer, and i starts from 1:
[0028] S201: If i=1, directly send the original features to S202 for execution to obtain new features; if i>1, first send the previous layer features to S202 for execution to obtain new features. After the SE module, features f′ with different channel weights are generated i-1, f′ i-1 It is sent to a 1×1 convolution module and upsampled to generate a new feature f″ with the same resolution and number of channels as the i-th layer feature. i-1 ; The new feature f″ i-1 With the original feature f i Fusion, get the new feature f′ of the i-th layer i , then execute S202;
[0029] S202: The new feature f′ in S201 i After n groups of convolutional layers, the final features are generated The feature of the i-th layer is sent to the head detection module for classification and position regression; i is added by 1 and the process returns to execute S201.
[0030] A target detection model training device based on SE-FPN, comprising:
[0031] The image preprocessing module is used to scale multiple training images obtained from the data set according to different scaling factors and then splice them into a new image, and to perform the same scaling and splicing processing on the target labels corresponding to the multiple training images. The new image includes multiple targets of different sizes.
[0032] A target allocation module, used to allocate multiple targets of different sizes to different pyramid feature layers of the SE-FPN target detection model according to a predetermined allocation strategy;
[0033] The sample selection module is used to find the m positions closest to the center point in each pyramid feature layer according to the true value of the training sample assigned to this layer, and calculate the DIoU between all anchors and the true value of the m positions, denoted as D g , calculate D g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output;
[0034] The calculation module is used to calculate the classification loss function and the position regression function respectively, and train the model through the back propagation algorithm.
[0035] A target detection method based on the SE-FPN target detection model comprises the following steps:
[0036] Acquire the image to be detected;
[0037] Inputting the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained using a target detection model training method based on SE-FPN;
[0038] The SE-FPN target detection model is used to detect the image to be detected to obtain a target detection result; the target detection result includes the position information of the target object in the image to be detected.
[0039] An object detection device based on an SE-FPN object detection model, comprising:
[0040] An acquisition module, used for acquiring an image to be detected;
[0041] An input module, used for inputting the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained using a target detection model training method based on SE-FPN;
[0042] The detection module is used to detect the image to be detected through the SE-FPN target detection model to obtain the target detection result; the target detection result includes the position information of the target object in the image to be detected.
[0043] An electronic device includes: at least one processor and a memory; wherein the memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes a target detection model training method based on SE-FPN, or executes a target detection method based on an SE-FPN target detection model.
[0044] A computer-readable storage medium stores a computer program, which controls a device where the storage medium is located to execute a target detection model training method based on SE-FPN, or execute a target detection method based on an SE-FPN target detection model when the computer program is executed by a processor.
[0045] The beneficial effects of the present invention are:
[0046] 1. In the FPN network structure, the SE module is introduced to learn the importance of different channels during the training process, so that the network pays more attention to channels containing more effective information, suppresses unimportant channels, and better guides the fusion of high-level features and low-level features, so that the low-level feature map not only has accurate location information, but also contains rich semantic information.
[0047] 2. A strategy for image preprocessing and target allocation is provided. According to the distribution of targets in the data set, the scaling factor is calculated so that the target distribution is more even after the training samples are scaled. Then, according to the target allocation strategy, the targets are allocated to different feature layers to ensure that each feature pyramid layer can obtain sufficient training samples, reducing the situation where some layers in the network model are not adequately trained due to uneven target distribution.
[0048] 3. A sample selection strategy is provided. The training samples are selected from the m regions of the center grid and the surrounding nearest neighbors according to the mean and variance of DIoU, so that dense targets can be dispersed into multiple positive samples, increasing the learning probability of dense targets.
[0049] 4. Mean m g Indicates the matching degree between the preset anchor and the true value. If the mean is high, the threshold should be increased to adjust the positive sample. If the mean is low, the threshold should be lowered to adjust. Standard deviation v g Indicates the dispersion of the targets in this layer. A high standard deviation means that the targets in this layer are relatively dispersed, and the threshold should be lowered to ensure that each target has a suitable anchor. A low standard deviation means that the targets in this layer are relatively concentrated, and the threshold can be increased to ensure the high quality of the anchor. By combining the mean and variance, there is no need to manually design the threshold, and data information can be better utilized to independently select positive and negative samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The drawings described herein are for illustrative purposes only of selected embodiments and not all possible implementations, and are not intended to limit the scope of the present invention.
[0051] Figure 1 This is a flowchart of the target detection model training method according to an embodiment of the present application.
[0052] Figure 2 This is a schematic diagram of the SE-FPN target detection model structure of an embodiment of the present application.
[0053] Figure 3 This is a schematic diagram of the CSP-Darknet network structure model used in the backbone network of an embodiment of the present application.
[0054] Figure 4 This is a schematic diagram of the SE-FPN structure of an embodiment of the present application.
[0055] Figure 5 This is a schematic diagram of the SE module structure of an embodiment of the present application.
[0056] Figure 6 The final feature map is obtained by multiplying the original feature map in the embodiment of the present application.
[0057] Figure 7 This is a structural block diagram of the target detection model training device according to an embodiment of the present application.
[0058] Figure 8 This is a flowchart of the target detection method according to an embodiment of the present application.
[0059] Fig. 9 This is a structural block diagram of a target detection device according to an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings.
[0061] Embodiment 1
[0062] This example provides a target detection model training method based on SE-FPN. Figure 1 As shown, the process includes the following steps: S100: first randomly select four training images from the data set, scale them according to different scaling factors, and then splice them into a new image whose resolution is the input resolution set by the network model. The new image includes multiple targets of different sizes.
[0063] The target labels corresponding to the four images are scaled and spliced in the same way as the image to keep the consistency between the new image and the target label.
[0064] When the target is multi-category, first count the number of samples in each category, and based on the statistical results, calculate the probability of each sample being drawn, generate the sampling probability of the data set, and draw samples each time according to the sampling probability.
[0065] S200: Allocate multiple objects of different sizes to different pyramid feature layers of the SE-FPN object detection model according to a predetermined allocation strategy.
[0066] The SE-FPN target detection model includes three layers of feature pyramids, and the multiple targets of different sizes are allocated to different pyramid feature layers of the SE-FPN target detection model according to the following allocation strategy:
[0067] If the width and height of the target are both greater than or equal to the first allocation threshold T l , assigned to the first layer of the feature pyramid, that is, the top layer of the pyramid; if the width and height of the target are both greater than the second allocation threshold T m But less than the first allocation threshold T l , then it is assigned to the second pyramid layer; otherwise, it is assigned to the third pyramid layer; the first allocation threshold T l Greater than the second allocation threshold T m In this example, T m =16, Tl =32, see the following formula:
[0068]
[0069] Among them, x represents the target, w gt Indicates the width of the target, h gt Indicates the height of the target.
[0070] The SE-FPN target detection model includes the backbone network, SE-FPN and head detection modules, such as Figure 2 shown.
[0071] The backbone network is used to extract features from the images input into the SE-FPN target detection model and obtain multiple feature layers at different scales. In this example, the backbone network uses the CSP-Darknet model to extract three sets of features at different scales (generally the scale factor is 8, 16, and 32) to build a multi-level feature pyramid network FPN. CSP-Darknet is a combined network structure. The specific network structure is as follows Figure 3 As shown in the figure, adding the CSP (Cross Stage Partial model) module to the original Darknet network effectively enhances the learning ability of the convolutional network and reduces the amount of computation.
[0072] Traditional FPN directly connects high-level features with low-level features through upsampling, and then outputs them as new features. The present invention adds a SE module to the FPN module, and introduces an attention mechanism to highlight the channels in the high-level features that are more instructive to the low-level features, so that the two features can be better integrated. The specific network structure of the SE module is as follows: Figure 5 The SE module first passes through the global pooling layer to compress the feature map into a 1×1×c2 vector to obtain the channel-level global feature, which is then compressed into The vector is expanded to a 1×1×c2 vector through the activation function and the second fully connected layer. By learning the relationship between each channel, the weights of different channels are obtained and multiplied with the original feature map to obtain the final feature map. The specific implementation is as follows Figure 6 This attention mechanism allows the model to pay more attention to the channel features with large amounts of information and suppress those unimportant channel features.
[0073] The head detection module consists of two parts: a classification module and a position regression module. The classification module is used to first use w convolutional layers for feature extraction, then use the fully connected layer for classification, and output the classification results; the position regression module is used to use s convolutional layers for the final position regression, and output the center position coordinates and scale information of the target.
[0074] The schematic diagram of SE-FPN structure is as follows Figure 4 As shown, it is constructed through the following steps:
[0075] Extract features of different layers through the backbone network k , where k = 1, 2, 3, from top to bottom are f1, f2, f3, and the feature pyramid is constructed from the i-th layer, i starts from 1:
[0076] Then build a multi-layer feature pyramid FPN from top to bottom. Suppose FPN is built from the i-th layer, and i starts from 1:
[0077] S201: If i=1, directly send the original features to S202 for execution to obtain new features; if i>1, first send the previous layer features to S202 for execution to obtain new features. After the SE module, features f′ with different channel weights are generated i1 , f′ i1 It is fed into a 1×1 convolution module and upsampled. There are many upsampling methods, such as unilinear interpolation, bilinear interpolation, deconvolution, etc. This example uses bilinear interpolation to generate a new feature f″ with the same resolution and number of channels as the i-th layer feature. i-1 ; The new feature f″ i-1 With the original feature f i Fusion: There are many fusion methods, such as concat, element-wise, sum, etc. This example uses the concat method to obtain the new feature f′ of the i-th layer i , then execute S202;
[0078] S202: The new feature f′ in S201 i After n groups of convolutional layers, the final features are generated The feature of the i-th layer is sent to the head detection module for classification and position regression; i is added by 1 and the process returns to execute S201.
[0079] S300: In each pyramid feature layer, find the m positions closest to the center point according to the true value of the training sample assigned to this layer, and calculate the DIoU of all anchors and the true value of the m positions respectively, denoted as D g , calculate D g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output.
[0080] DIoU is D g The calculation formula is:
[0081]
[0082] Among them, IoU represents the IoU value between the prediction and the true value of the sample, ρ 2 (b,b gt ) represents the predicted center b and the target true center b gt The Euclidean distance of , d represents the diagonal distance of the smallest rectangle that can cover both the anchor and the target box.
[0083] S400: Using the samples obtained in S300, the classification loss function and the position regression function are calculated respectively, and the model is trained by the back propagation algorithm. In this example, the classification loss function uses the cross entropy loss function, and the position regression function uses the CIoU loss function. The formula is as follows:
[0084]
[0085]
[0086]
[0087] In the formula, C represents the category of the sample, Represents the sample category predicted by the network. ɑ is the weight coefficient, υ is used to measure the similarity of aspect ratios. The specific definition is shown in the formula, w gt Indicates the width of the sample, h gt Indicates the sample height, h p Predicted sample height, w p Represents the prediction sample width.
[0088] Embodiment 2
[0089] This example provides a target detection model training device based on SE-FPN. Figure 7 As shown, it includes an image preprocessing module, a feature extraction module, a target allocation module, a sample selection module, and a calculation module.
[0090] The image preprocessing module scales multiple training images obtained from the data set according to different scaling factors, splices them into a new image, and performs the same scaling and splicing processing on the target labels corresponding to the multiple training images. The new image includes multiple targets of different sizes.
[0091] The target allocation module allocates multiple targets of different sizes to different pyramid feature layers of the SE-FPN target detection model according to a predetermined allocation strategy.
[0092] In each pyramid feature layer, the sample selection module finds the m positions closest to the center point according to the true value of the training sample assigned to this layer, and calculates the DIoU between all anchors and the true value at the m positions, denoted as D g , calculate D g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output.
[0093] The calculation module calculates the classification loss function and the position regression function respectively, and trains the model through the back propagation algorithm.
[0094] Embodiment 3
[0095] This example provides a target detection method based on the SE-FPN target detection model. Figure 8 As shown, the following steps are included: S100: Acquire an image to be detected.
[0096] S200: Inputting the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained using the SE-FPN-based target detection model training method of the first embodiment.
[0097] S300: Detect the image to be detected by using the SE-FPN target detection model to obtain a target detection result; the target detection result includes position information of the target object in the image to be detected.
[0098] Embodiment 4
[0099] This example provides a target detection device based on the SE-FPN target detection model. Fig. 9 As shown, it includes: an acquisition module, an input module, and a detection module.
[0100] The acquisition module acquires the image to be detected.
[0101] The input module inputs the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained using the SE-FPN-based target detection model training method of Example 1.
[0102] The detection module detects the image to be detected through the SE-FPN target detection model to obtain the target detection result; the target detection result includes the position information of the target object in the image to be detected.
[0103] Embodiment 5
[0104] This example provides an electronic device, comprising: at least one processor and a memory; wherein the memory stores computer-executable instructions; the at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the SE-FPN-based target detection model training method of Example 1, or executes the SE-FPN target detection model-based target detection method of Example 3.
[0105] Embodiment 6
[0106] This example provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the device where the storage medium is located is controlled to execute the target detection model training method based on SE-FPN in Example 1, or to execute the target detection method based on SE-FPN target detection model in Example 3.
[0107] The above are only preferred embodiments of the present invention, and are not intended to be the only or limiting embodiments of the present invention. Those skilled in the art should understand that various changes or equivalent substitutions made to the present invention without departing from the scope of the present invention are within the scope of protection of the present invention.
Claims
1. A target detection model training method based on SE-FPN, It is characterized in that Includes steps: After scaling multiple training images obtained from the data set according to different scaling factors, they are spliced into a new image, and the target labels corresponding to the multiple training images are scaled and spliced in the same way, wherein the new image includes multiple targets of different sizes; Allocating the multiple objects of different sizes to different pyramid feature layers of the SE-FPN object detection model according to a predetermined allocation strategy; In each pyramid feature layer, find the m positions closest to the center point according to the true value of the training sample assigned to this layer, and calculate the DIoU between all anchors and the true value of the m positions, denoted as D g , the calculation formula is: Among them, IoU represents the IoU value between the prediction and the true value of the sample, ρ 2 (b,b gt ) represents the predicted center b and the target true center b gt The Euclidean distance of d represents the diagonal distance of the smallest rectangle that can cover both the anchor and the target box. g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output; Calculate the classification loss function and position regression function respectively, and train the model through the back propagation algorithm; Among them, the SE-FPN target detection model includes the backbone network, SE-FPN and head detection modules; The backbone network is used to extract features from images input into the SE-FPN target detection model and obtain multiple feature layers of different scaling scales for constructing SE-FPN. The head detection module consists of two parts: a classification module and a position regression module. The classification module is used to first use w convolution layers for feature extraction, then use the fully connected layer for classification, and output the classification results; the position regression module is used to use s convolution layers for the final position regression, and output the center position coordinates and scale information of the target; SE-FPN is constructed through the following steps: Extract features of different layers through the backbone network k , where k = 1, 2, 3, from top to bottom are f 1 、f 2 、f 3 , let’s construct the feature pyramid from the i-th layer, i starts from 1: Then build a multi-layer feature pyramid FPN from top to bottom. Suppose FPN is built from the i-th layer, and i starts from 1: S201: If i=1, directly send the original features to S202 for execution to obtain new features; if i>1, first send the previous layer features to S202 for execution to obtain new features. After the SE module, features f′ with different channel weights are generated i-1 , f′ i-1 It is sent to a 1×1 convolution module and upsampled to generate a new feature f″ with the same resolution and number of channels as the i-th layer feature. i-1 ; The new feature f″ i-1 With the original feature f i Fusion, get the new feature f′ of the i-th layer i , then execute S202; S202: The new feature f′ in S201 i After n groups of convolutional layers, the final features are generated The feature of the i-th layer is sent to the head detection module for classification and position regression; i is added by 1 and the process returns to execute S201.
2. The target detection model training method based on SE-FPN according to claim 1, It is characterized in that The SE-FPN target detection model includes three layers of feature pyramids, and the multiple targets of different sizes are allocated to different pyramid feature layers of the SE-FPN target detection model according to the following allocation strategy: If the width and height of the target are both greater than or equal to the first allocation threshold T l , assigned to the first level of the feature pyramid, i.e., the topmost pyramid level; If the width and height of the target are both greater than the second allocation threshold T m But less than the first allocation threshold T l , then it is assigned to the second pyramid layer; Otherwise, it is assigned to the third pyramid level; The first allocation threshold T l Greater than the second allocation threshold T m .
3. The target detection model training method based on SE-FPN according to claim 1, It is characterized in that The classification loss function uses the cross entropy loss function, and the position regression function uses the CIoU loss function.
4. A target detection model training device based on SE-FPN, It is characterized in that include: The image preprocessing module is used to scale multiple training images obtained from the data set according to different scaling factors and then stitch them into a new image; and used to perform the same scaling and splicing processing on the target labels corresponding to the multiple training images; the new images include multiple targets of different sizes; A target allocation module, used to allocate the multiple targets of different sizes to different pyramid feature layers of the SE-FPN target detection model according to a predetermined allocation strategy; The sample selection module is used to find the m positions closest to the center point in each pyramid feature layer according to the true value of the training sample assigned to this layer, and calculate the DIoU between all anchors and the true value of the m positions, recorded as D g , the calculation formula is: Among them, IoU represents the IoU value between the prediction and the true value of the sample, ρ 2 (b,b gt ) represents the predicted center b and the target true center b gt The Euclidean distance of d represents the diagonal distance of the smallest rectangle that can cover both the anchor and the target box. g The mean value m g and standard deviation v g , and get the threshold value t g =max(0.2,|m g -v g |), select greater than t g And the center position and anchor output in the target box; if there is no anchor that meets the conditions, select D g Maximum anchor and center position output; The calculation module is used to calculate the classification loss function and the position regression function respectively, and train the model through the back propagation algorithm; The SE-FPN target detection model includes a backbone network, SE-FPN, and a head detection module. The backbone network is used to extract features from images input into the SE-FPN target detection model to obtain feature layers of multiple different scaling scales for constructing SE-FPN. The head detection module includes two parts: a classification module and a position regression module. The classification module is used to first use w convolution layers for feature extraction, then use the fully connected layer for classification, and output the classification results. The position regression module is used to use s convolution layers for the final position regression, and output the center position coordinates and scale information of the target. SE-FPN is constructed through the following steps: Extract features of different layers through the backbone network k , where k = 1, 2, 3, from top to bottom are f 1 、f 2 、f 3 , let’s construct the feature pyramid from the i-th layer, i starts from 1: Then build a multi-layer feature pyramid FPN from top to bottom. Suppose FPN is built from the i-th layer, and i starts from 1: S201: If i=1, directly send the original features to S202 for execution to obtain new features; if i>1, first send the previous layer features to S202 for execution to obtain new features. After the SE module, features f′ with different channel weights are generated i-1 , f′ i-1 It is sent to a 1×1 convolution module and upsampled to generate a new feature f″ with the same resolution and number of channels as the i-th layer feature. i-1 ; The new feature f″ i-1 With the original feature f i Fusion, get the new feature f′ of the i-th layer i , then execute S202; S202: The new feature f′ in S201 i After n groups of convolutional layers, the final features are generated The feature of the i-th layer is sent to the head detection module for classification and position regression; i is added by 1 and the process returns to execute S201.
5. A target detection method based on SE-FPN target detection model, It is characterized in that The method comprises the steps of: obtaining an image to be detected; Inputting the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained using the SE-FPN-based target detection model training method according to any one of claims 1 to 3; The image to be detected is detected by the SE-FPN target detection model to obtain a target detection result; the target detection result includes position information of the target object in the image to be detected.
6. A target detection device based on SE-FPN target detection model, It is characterized in that include: An acquisition module, used for acquiring an image to be detected; An input module, used for inputting the image to be detected into a pre-trained SE-FPN target detection model; wherein the SE-FPN target detection model is trained by the SE-FPN-based target detection model training method according to any one of claims 1 to 3; The detection module is used to detect the image to be detected through the SE-FPN target detection model to obtain a target detection result; the target detection result includes the position information of the target object in the image to be detected.
7. An electronic device, include: At least one processor and a memory; wherein the memory stores computer-executable instructions; characterized in that the computer-executable instructions stored in the memory are executed by the at least one processor, so that the at least one processor executes the SE-FPN-based target detection model training method as described in any one of claims 1 to 3, or executes the target detection method based on the SE-FPN target detection model as described in claim 5.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by the processor, the device where the storage medium is located is controlled to execute the target detection model training method based on SE-FPN as described in any one of claims 1 to 3, or to execute the target detection method based on the SE-FPN target detection model as described in claim 5.
Citation Information
Patent Citations
A helmet detection method with lightweight backbone based on yolov3 network
AU2020100705A4
Target detection method based on super-feature fusion and multi-scale pyramid network
CN109034210A
