A target detection method

By introducing the dual attention mechanism and Ghost module in the YOLOv4 model, the problem of missing information and large amount of calculations during feature extraction and fusion in pedestrian detection is solved, and the detection speed is improved on the basis of ensuring detection accuracy. Effect.

CN115019148BActive Publication Date: 2024-12-10ANHUI UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210800199.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-06
Publication Date
2024-12-10
Estimated Expiration
2042-07-06

AI Technical Summary

Technical Problem

The existing pedestrian detection algorithms are difficult to improve detection speed on the basis of ensuring detection accuracy, especially in real-time application scenarios, the YOLOv4 model has problems such as missing information and high computational cost in the process of feature extraction and feature fusion.

Method used

By introducing a dual attention mechanism in the YOLOv4 model, a neck network based on the Ghost module is built, the feature extraction network's attention to the target visible area is increased, and the calculation amount is reduced through lightweight feature fusion, and the detection speed is improved.

Benefits of technology

While ensuring detection accuracy, it significantly improves the target detection speed and reduces the number of parameters of the model, and is suitable for real-time pedestrian detection applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115019148B_ABST
    Figure CN115019148B_ABST
Patent Text Reader

Abstract

The embodiment of this specification discloses a method for performing target detection on an image to be detected using a target detection model, wherein the target detection model may include a backbone feature extraction network built based on a dual attention mechanism, a neck network built using a Ghost module generated based on the dual attention mechanism, and a prediction result generation network. Since the dual attention mechanism is added to the backbone feature extraction network and the neck network in the target detection model, the target detection model can increase the attention of the visible area of ​​the target in the image to be detected with less computational effort. At the same time, since the neck network in the target detection model is built using a Ghost module generated based on the dual attention mechanism, it can achieve lightweight feature fusion process. Therefore, the present application can improve the detection speed of the image to be detected while ensuring the accuracy of target detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of target detection, and in particular to a target detection method based on an improved YOLOv4 model. Background Art

[0002] Pedestrian detection is a research hotspot in the field of target detection. Pedestrian detection requires accurate judgment of whether the input image or video contains pedestrians, and provides the spatial coordinate information of pedestrians in the image. It is widely used in intelligent monitoring, assisted driving and other fields. At present, some mainstream pedestrian detection algorithms are generally implemented using deep learning methods, such as R-CNN, Fast-RCNN, and Faster-RCNN. Although they can achieve high detection accuracy, the test speed is usually slow due to the complexity of the stages, which is not suitable for applications that require real-time detection and fast response. Although a series of single-stage algorithms such as SSD and yolo have fast detection speeds and can meet real-time detection needs, the detection accuracy in some applications still needs to be improved.

[0003] Based on this, how to improve the target detection speed while ensuring the accuracy of target detection has become an urgent problem to be solved. Summary of the invention

[0004] The embodiments of this specification provide a target detection method to improve the target detection speed while ensuring the target detection accuracy.

[0005] In order to solve the above technical problems, an embodiment of this specification provides a target detection method, which may include:

[0006] Get the image to be detected.

[0007] Utilize the target detection model; perform target detection processing on the image to be detected to obtain a target detection result; the target detection model is a model obtained by improving the YOLOv4 neural network; the target detection model includes: a backbone feature extraction network, a neck network and a prediction result generation network; the backbone feature extraction network is connected to the neck network, and the neck network is connected to the prediction result generation network; the backbone feature extraction network is a network built based on a dual attention mechanism; the neck network is a network built using a Ghost module generated based on a dual attention mechanism.

[0008] At least one embodiment of this specification can achieve the following beneficial effects:

[0009] The target detection network is obtained by improving the YOLOv4 neural network. Since the backbone feature extraction network in the target detection network is built based on the dual attention mechanism, it can increase the target detection network's attention to the target visible area with less computation, which is beneficial to ensure the accuracy of target detection. In addition, since the neck network in the target detection network is built using the Ghost module generated based on the dual attention mechanism, the feature fusion process can be lightweight to improve the detection speed of the target detection model. Based on this, when the target detection model is used to detect the image to be detected, the detection speed can be improved while ensuring the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0011] Figure 1 It is a flowchart of a target detection method provided in an embodiment of this specification;

[0012] Figure 2 It is a schematic diagram of the working principle of a dual attention mechanism provided in an embodiment of this specification;

[0013] Figure 3 is a schematic diagram of the structure of a target detection model provided in an embodiment of this specification;

[0014] Figure 4 It is a structural diagram of a feature extraction module based on the target area provided in an embodiment of this specification. DETAILED DESCRIPTION

[0015] In order to make the purpose, technical solutions and advantages of one or more embodiments of this specification clearer, the technical solutions of one or more embodiments of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this description, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of one or more embodiments of this specification.

[0016] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0017] In the embodiment of this specification, since the backbone network at the YOLOv4 model in the prior art will continuously downsample the input image during the feature extraction process, the size of the feature map will gradually become smaller, thereby causing the loss of some feature information and affecting the detection accuracy. And, the size of the pooling receptive field used by the spatial pyramid pooling network (SpatialPyramid Pooling, English abbreviation SPP) of the YOLOv4 model in the neck network is square, which will cover more invalid background information outside the target area, thereby interfering with the extraction of multi-scale features of dense targets and affecting the detection speed. In addition, the path aggregation network (Path Aggregation Network, English abbreviation PAN) of the YOLOv4 model in the neck uses a large number of standard convolutions in the feature fusion process, and the standard convolution will produce a large amount of calculation, which will further affect the detection speed of the YOLOv4 model. Based on this, how to improve the target detection speed on the basis of ensuring the accuracy of the detection results generated by the YOLOv4 model has become a problem that needs to be solved urgently.

[0018] In order to solve the defects in the prior art, this solution provides the following embodiments:

[0019] Figure 1 The following is a flow chart of a target detection method provided in an embodiment of this specification. From a program perspective, the execution subject of the process can be a device used for target recognition, or an application installed on the device. Figure 1 As shown, the process may include the following steps:

[0020] Step 202: Acquire an image to be detected.

[0021] In the embodiments of this specification, the image to be detected may be an image that needs to be detected. In practical applications, the image to be detected may be an image of pedestrians taken by a camera while a vehicle is driving in an unmanned driving scenario. In this case, the pedestrians may be used as detection targets to extract the pedestrian images contained in the image to be detected; or, the image to be detected may be a road image containing vehicles taken by a camera installed at a traffic intersection in a traffic intersection monitoring scenario. In this case, the vehicle may be used as a detection target to extract the vehicle images contained in the road image. In the embodiments of this specification, images that need to be detected and are collected in other application scenarios may also be used as images to be detected, and there is no specific limitation on this.

[0022] Step 204: Use the target detection model to perform target detection processing on the image to be detected to obtain a target detection result; the target detection model is a model improved on the YOLOv4 neural network; the target detection model includes: a backbone feature extraction network, a neck network and a prediction result generation network; the backbone feature extraction network is connected to the neck network, and the neck network is connected to the prediction result generation network; the backbone feature extraction network is a network built based on a dual attention mechanism; the neck network is a network built using a Ghost module generated based on a dual attention mechanism.

[0023] In the embodiment of this specification, the YOLOv4 neural network is an existing target detection network, which mainly includes: an input end, a reference network, a neck network (Neck in English) and a head output end (Head in English); wherein the input end is used to obtain an input image and scale the input image to the input size of the network. The reference network is used to extract some common image feature representations. CSPDarknet53 is used as the backbone network in the reference network. The CSPDarknet53 backbone network is a 53-layer convolutional network composed of a common convolution module and a plurality of cross-stage partial connection structure modules (Cross Stage Partial Networks, CSP in English). In the neck network, a spatial pyramid pooling network (Spatial PyramidPooling, SPP in English) is used to fuse feature maps of different scales; a top-down feature pyramid network (Feature Pyramid Networks, FPN in English) and a bottom-up feature pyramid path aggregation network (PathAggregation Network, PAN in English) are used to enhance the feature extraction capability of the network. The Head output end is used to output the target detection result.

[0024] In the embodiments of the present specification, the dual attention mechanism includes a channel attention module and a spatial attention module. The channel attention module is used to perform channel attention enhancement processing on image features; the spatial attention module is used to perform spatial attention enhancement processing on image features, so that in the process of processing the image to be detected, the weight of the information of the target visible area in the feature image can be enhanced from both channel and spatial dimensions.

[0025] In practical applications, the existing Ghost module can generate a large number of feature maps through linear operations, thereby reducing the structure used to generate feature maps in the target detection model, reducing the parameters in the target detection model, achieving lightweight target detection models, and thus improving the detection speed of the target detection model.

[0026] In the embodiments of the present specification, the Ghost module generated based on the dual attention mechanism can be a Ghost module obtained by connecting the existing Ghost module with the channel attention module and the spatial attention module. The specific connection method of the channel attention module, the spatial attention module, and the Ghost module can be connected in sequence or in other connection methods, and there is no specific limitation on this.

[0027] When the neck network is built using the Ghost module generated based on the dual attention mechanism, the neck network can be used to extract features from the image feature vector obtained from the backbone feature extraction network, and feature fuse the extracted image feature vector with the image feature vector output by the backbone feature extraction network. Since the existing Ghost module can effectively reduce the parameters in the target detection model, the detection speed of the target detection model can be improved. At the same time, since the dual attention mechanism can increase the weight of useful information in the image features, the Ghost module based on the dual attention mechanism can retain more effective information when extracting image features for the image to be detected, thereby improving the accuracy of the Ghost module for target detection, so as to improve the detection speed and detection accuracy of the target detection model.

[0028] In the embodiments of the present specification, the backbone feature extraction network based on the dual attention mechanism can be used to extract image feature vectors of different sizes for the image to be detected. Since the dual attention mechanism can increase the weight of the target visible area information in the image features, the backbone feature extraction network constructed based on the dual attention mechanism can extract more effective information when extracting image features for the image to be detected, thereby improving the accuracy of target detection.

[0029] In the embodiment of the present specification, the prediction result generation network is used to output the final target detection result according to the image features output by the neck network.

[0030] In actual applications, there can be many application scenarios for the target detection model, and the target detection results output by the target detection model will also be different depending on the application scenarios and target detection requirements. For example, in an unmanned driving scenario, the target detection model can be used to detect pedestrians on an unmanned driving line to obtain target detection results that reflect the area where the pedestrians are located; or in an unmanned driving scenario, the target detection model can be used to detect lane lines on an unmanned driving line to obtain detection results that reflect lane lines. In the embodiments of this specification, there are no specific restrictions on the application scenarios of the target detection model and the meaning of the target detection results obtained by the target detection model.

[0031] In the embodiments of this specification, Figure 1In the method, since the backbone feature extraction network is built based on the dual attention mechanism, and the dual attention mechanism can strengthen the weight of the target visible area information in the image, the backbone feature extraction network can extract more effective information to improve the accuracy of target detection; and since the neck network in the target detection network is built based on the Ghost module generated by the dual attention mechanism, it can effectively reduce the number of parameters in the target detection model, realize the lightweight of the target detection model, and improve the detection speed of the model.

[0032] based on Figure 1 The method, the examples of this specification also provide some specific implementation plans of the method, which are described below.

[0033] In the embodiments of the present specification, the target detection model used in the target detection method usually needs to be built in advance so as to detect the acquired image to be detected when the image to be detected is acquired.

[0034] Based on this, the method of obtaining the image to be detected may also include:

[0035] Based on the dual attention mechanism, the first number of cross-stage partial connection structure modules are built.

[0036] The backbone feature extraction network is constructed by utilizing the cross-stage partial connection structure module.

[0037] Based on the dual attention mechanism, a second number of Ghost modules are generated.

[0038] The neck network is constructed using the Ghost module.

[0039] The prediction result generation network is constructed using a third number of convolutional modules.

[0040] The connection relationship between the backbone feature extraction network, the neck network and the prediction result generation network is established in sequence to obtain the target detection model.

[0041] In the embodiment of the present specification, the existing cross-stage partial connection structure module (Cross Stage Partial Networks, English abbreviation CSP) is a network module in the CSPDarknet53 network, and the existing cross-stage partial connection structure module can be used to extract image features of the image to be detected. Since the existing cross-stage partial connection structure module continuously downsamples the image features of the image to be detected to scale the resolution of the feature layer, the size of the feature map gradually becomes smaller, thereby causing the loss of information of the visible area of ​​some targets.

[0042] In order to compensate for the loss caused by downsampling of the existing cross-stage partially connected structure module, in the embodiments of the present specification, the dual attention mechanism is connected with the existing cross-stage partially connected structure module to construct an improved cross-stage partially connected structure module required for building a backbone feature extraction network, thereby strengthening the weight of the visible area of ​​the target based on the dual attention mechanism, and then retaining more target detection information when using the improved cross-stage partially connected structure module to extract image features for the image to be detected, which is beneficial to improving the accuracy of the target detection model for the image to be detected.

[0043] In practical applications, the backbone feature extraction network usually needs to include multiple cross-stage partial connection structure modules to extract image features of different sizes of the image to be detected. Therefore, in the embodiments of this specification, the first number is usually greater than 1.

[0044] In practical applications, when the existing Ghost module extracts features from an image to be detected, it first uses a standard convolution to compress the channels of the feature map of the image to be detected to obtain an intermediate feature map, then uses a linear transformation to replace the standard convolution on the intermediate feature map to generate more feature maps, and finally concatenates the feature maps obtained by the linear transformation according to the channels to generate the output feature map of the Ghost module.

[0045] In the embodiment of this description, since the use of 1*1 point-by-point convolution can reduce the amount of calculation, the 1*1 point-by-point convolution can be used to replace the standard convolution in the Ghost module to generate an intermediate feature map; moreover, since more feature maps are generated by using linear operations, the number of standard convolutions in the target detection model can be effectively reduced, thereby reducing the parameters of the model, achieving lightweight model, and further improving the detection speed of the image to be detected.

[0046] In the embodiment of the present specification, the prediction result generation network is used to generate the final detection result according to the image features of the image to be detected output by the neck network.

[0047] In the embodiments of this specification, it is usually necessary to connect multiple cross-stage partial connection structure modules based on the dual attention mechanism to generate a backbone feature extraction network, so as to extract image features of different sizes for the object to be detected. For ease of understanding, this is explained:

[0048] Specifically, the first number of cross-stage partial connection structure modules may include: a first cross-stage partial connection structure module, a second cross-stage partial connection structure module and a third cross-stage partial connection structure module.

[0049] The use of the cross-stage partial connection structure module to build the backbone feature extraction network may specifically include:

[0050] The first cross-stage partial connection structure module, the second cross-stage partial connection structure module and the third cross-stage partial connection structure module are connected in sequence to obtain the backbone feature extraction network.

[0051] Among them, the first cross-stage partial connection structure module is used to receive a target image, perform convolution processing on the target image, extract the first trunk intermediate image features of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the first trunk intermediate image features to obtain the first trunk image features of the target image.

[0052] The second cross-stage partial connection structure module is used to receive the first trunk image features, and perform convolution processing on the first trunk image features to extract the second trunk intermediate image features of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the second trunk intermediate image features to obtain the second trunk image features of the target image.

[0053] The third cross-stage partial connection structure module is used to receive the second trunk image features, and perform convolution processing on the second trunk image features to extract the third trunk intermediate image features of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the third trunk intermediate image features to obtain the third trunk image features of the target image.

[0054] In the embodiments of this specification, when constructing a backbone feature extraction network, it is usually necessary to connect a certain number of cross-stage partial connection structure modules to utilize different cross-stage partial connection structure modules to extract image feature vectors of different sizes or different numbers of channels for the target image.

[0055] In the embodiments of the present specification, since the cross-stage partial connection structure module (Cross Stage Partial Networks, CSP in English) in YOLOv4 will continuously downsample the image features of the target image, thereby causing the loss of some target visible area information, therefore, a cross-stage partial connection structure module can be built based on a dual attention mechanism. When detecting the image to be detected, the dual attention mechanism is used to weight the target visible area information in the extracted image features, thereby reducing the loss of target visible area information caused by downsampling.

[0056] Based on this, in the embodiment of this specification, based on the dual attention mechanism, building a first number of cross-stage partial connection structure modules may specifically include:

[0057] Based on the dual attention mechanism, a first channel attention submodule and a first spatial attention submodule are generated; wherein the first channel attention submodule is used to perform channel attention enhancement processing on image features; and the first spatial attention submodule is used to perform spatial attention enhancement processing on image features.

[0058] The first channel attention submodule, the first spatial attention submodule and the preset cross-stage partial connection structure submodule are used to generate various cross-stage partial connection structure modules; wherein the preset cross-stage partial connection structure submodule is used to extract image features.

[0059] In the embodiments of this specification, for ease of understanding, the working principle of the dual attention mechanism is explained. Figure 2 This is a schematic diagram of the working principle of a dual attention mechanism. Figure 2 As shown:

[0060] Efficient Two dimensional Attention (ETA) can include a channel attention module (CAM) and a spatial attention module (SAM).

[0061] The channel attention of the channel attention module is calculated using the following formula:

[0062] M c (F) = σ(ClD k (AvgPool(F))+ClD k (MaxPool(F')))

[0063] Among them, M c (F) refers to the calculated channel attention of the module; σ(·) refers to the Sigmoid activation function; C1D k (·) represents the one-dimensional convolution process, k refers to the number of adjacent input channels involved in predicting a certain output channel, AvgPool(F) and MaxPool(F) refer to the description information of global average pooling and maximum pooling, respectively.

[0064] In the channel attention module, k can be calculated adaptively, and the formula is as follows:

[0065]

[0066] In the formula, C is the total number of channels, γ,b is a hyperparameter, |*| odd Represents the odd number closest to *.

[0067] The spatial attention of the spatial attention module is calculated using the following formula:

[0068] M s (F') = σ(f 7*7 [AvgPool(F');MaxPool(F')])

[0069] Where M s (F') represents the calculated spatial attention of the SAM module; σ(·) refers to the sigmoid activation function; f 7*7 Refers to the convolution process consisting of a 7*7 convolution kernel. AvgPool(F') and MaxPool(F') refer to the description information of the global average pooling and maximum pooling respectively.

[0070] In the embodiments of the present specification, the generation principle of the first channel attention submodule is the same as the generation principle of the above-mentioned channel attention submodule, and the generation principle of the first spatial attention submodule is the same as the generation principle of the above-mentioned spatial attention submodule, which will not be repeated here.

[0071] In the embodiment of the present specification, the preset cross-stage partial connection structure module submodule may be an existing cross-stage partial connection structure module (Cross Stage Partial Networks, CSP for short).

[0072] In the embodiment of this specification, the preset cross-stage partial connection structure submodule, the first channel attention submodule, and the first spatial attention submodule are connected to generate each improved cross-stage partial connection structure module (ETA_CSP for short). The specific connection relationship between the above submodules can be connected in sequence or determined according to the detection requirements, and there is no specific limitation on this.

[0073] In the embodiments of this specification, in order to better process the target image, the backbone feature extraction network also needs to include: an input module, a convolution module and a pooling module. For ease of understanding, this is explained in detail:

[0074] Optionally, the backbone feature extraction network may also include: an input module, a first convolution module, a second convolution module, a first maximum pooling module, a second maximum pooling module, a third maximum pooling module, a third convolution module, and a feature extraction module based on the target area; the feature extraction module based on the target area is used to extract image features of different sizes.

[0075] The building of the backbone feature extraction network may specifically include:

[0076] The input module, the first convolution module, the second convolution module, the first cross-stage partially connected structure module, the first maximum pooling module, the second cross-stage partially connected structure module, the second maximum pooling module, the third cross-stage partially connected structure module, the third maximum pooling module, the third convolution module and the feature extraction module based on the target area are connected in sequence to obtain the backbone feature extraction network.

[0077] Wherein, the input module is used to obtain the target image.

[0078] The first convolution module is used to receive the target image and perform convolution processing on the target image to obtain a first convolution image feature of the target image.

[0079] The second convolution module is used to receive the first convolution image feature and perform convolution processing on the first convolution image feature to obtain a second convolution image feature of the target image.

[0080] The first cross-stage partial connection structure module is specifically used to receive the second convolution image feature and generate the first trunk image feature of the target image.

[0081] The first maximum pooling module is used to receive the first trunk image feature and perform maximum pooling processing on the first trunk image feature to obtain a first maximum pooling image feature.

[0082] The second cross-stage partial connection structure module is specifically used to receive the first maximum pooling image features and generate second trunk image features of the target image.

[0083] The second maximum pooling module is used to receive the second trunk image features and perform maximum pooling processing on the second trunk image features to obtain second maximum pooling image features.

[0084] The third cross-stage partial connection structure module is specifically used to receive the second maximum pooling image features and generate the third trunk image features of the target image.

[0085] The third maximum pooling module is used to receive the third trunk image feature and perform maximum pooling processing on the third trunk image feature to obtain a third maximum pooling image feature.

[0086] The third convolution module is used to receive the third maximum pooling image feature and perform convolution processing on the third maximum pooling image feature to obtain the third convolution image feature of the target image.

[0087] The feature extraction module based on the target area is used to receive the third convolution image feature and perform convolution processing on the third convolution image feature to extract the first image feature of the target image.

[0088] In the embodiments of the present specification, the input module is used to obtain the target image and scale the target image to an input size that the network can handle. The first convolution module, the second convolution module and the third convolution module are respectively the smallest convolution module structures in the prior art, and the parameters of their convolution kernels can be specifically set as needed, without limitation. The first maximum pooling module, the second maximum pooling module and the third maximum pooling module respectively perform maximum pooling processing on the image features of the target image to obtain local information and eliminate non-maximum values ​​in the image features, thereby reducing the amount of calculation of the target detection model and thereby improving the detection speed of the target detection model.

[0089] In the embodiments of this specification, the structures and working principles of the multiple cross-stage partial connection structural modules have been discussed in the previous text and will not be repeated here.

[0090] In the embodiment of the present specification, the feature extraction module based on the target area is used to perform convolution processing on the acquired third convolution image features, so as to further extract the image features of the target image.

[0091] Figure 3 A schematic diagram of the structure of a target detection model provided in the embodiments of this specification is shown in FIG. Figure 3 As shown, the backbone feature extraction network 1 may include: the input module, the first convolution module, the second convolution module, the first cross-stage partial connection structure module, the first maximum pooling module, the second cross-stage partial connection structure module, the second maximum pooling module, the third cross-stage partial connection structure module, the third maximum pooling module, the third convolution module and the feature extraction module based on the target area.

[0092] In the embodiment of the present specification, the input module is used to obtain a target image and scale the target image to a size that can be processed by the network. When detecting the target image in an actual application, the target image may be an image to be detected; when training the target detection model, the target image may be a training set used to train the target detection model; multiple cross-stage partial connection structure modules generated based on the dual attention mechanism are connected in sequence to obtain image features of target images of different sizes respectively; because the target visible area in the target image can be weighted based on the dual attention mechanism, more target detection information can be retained when extracting image features of the target image using the cross-stage partial connection structure module, thereby improving the accuracy of target image detection;

[0093] And after each cross-stage partial connection structure module, a maximum pooling module is connected to perform a maximum pooling operation on the feature image output by each cross-stage partial connection structure module, extract local information, and eliminate non-maximum values ​​in image features, thereby reducing the computational complexity of the target detection model, thereby improving the detection speed of the backbone feature extraction network.

[0094] In the embodiments of the present specification, when the target detection model is applied to the pedestrian detection scenario, in actual dense scenes, pedestrian targets have different shooting positions and angles, and their postures, body shapes and heights are also different, resulting in pedestrians in different positions in the same target image and pedestrian scales. However, after clustering analysis of the pedestrian annotation information in the data set, it is found that dense pedestrian targets are often in rectangular areas. In order to extract pedestrian features of different scale ranges, it is necessary to construct a feature extraction module based on the target area, for example, a PFM module (Pedestrian-based Feature-extraction Module).

[0095] In an embodiment of the present specification, the feature extraction module based on the target area may include: a first convolution layer, a second convolution layer, and a third convolution layer with different convolution kernels. The input ends of the first convolution layer, the second convolution layer, and the third convolution layer may be connected to the third convolution module respectively.

[0096] The first convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a first-size image feature of the target image.

[0097] The second convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a second-size image feature of the target image.

[0098] The third convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a third-size image feature of the target image.

[0099] The first-size image feature, the second-size image feature, and the third-size image feature are respectively used for channel stitching with the third maximum pooling image feature to obtain the first image feature of the target image.

[0100] In the embodiment of the present specification, since the number of channels of the obtained third convolution image feature is large, it is necessary to use a convolution filter to perform channel transformation on the third convolution image feature, so as to reduce the number of channels of the third convolution image feature; based on this, the feature extraction module based on the target area may also include: a fourth convolution layer and a fifth convolution layer;

[0101] The input end of the fourth convolutional layer is connected to the output end of the third convolutional module, and the output end of the fourth convolutional layer is respectively connected to the input ends of the first convolutional layer, the second convolutional layer, and the third convolutional layer. The fourth convolutional layer is used to receive the third convolutional image feature, perform convolution processing on the third convolutional image feature, and obtain a fourth size image feature of the target image.

[0102] An input end of the fifth convolutional layer is connected to output ends of the first convolutional layer, the second convolutional layer, and the third convolutional layer, respectively.

[0103] The fifth convolutional layer is used to perform channel transformation on the target stitching image features to obtain the first image features output by the feature extraction module based on the target area, and the target stitching image is the image features of the target image obtained by channel stitching the first size image features, the second size image features and the third size image features.

[0104] In the embodiment of the present specification, the fourth convolution layer may be a 1*1 convolution filter, which is used to perform channel transformation on the features of the third convolution image to reduce the number of channels of the third convolution image.

[0105] In the embodiment of the present specification, the fifth convolution layer can be a 1*1 convolution filter. Since the number of channels of the obtained target spliced ​​image features is large, the fifth convolution layer can be used to perform channel transformation on the target spliced ​​image features to reduce the number of channels of the target spliced ​​image features.

[0106] In the embodiments of this specification, in order to facilitate a better understanding of the working principle of the feature extraction module based on the target area, the working principle of the feature extraction module based on the target area is explained. Figure 4It is a structural diagram of a feature extraction module based on the target area. Figure 4 As shown:

[0107] The feature extraction module based on the target area includes: the first convolution layer 401, the second convolution layer 402, the third convolution layer 403, the fourth convolution layer 404 and the fifth convolution layer 405.

[0108] In the embodiment of the present specification, the feature extraction module based on the target area first uses the fourth convolution layer to obtain the third convolution image feature from the third convolution module at the aforementioned backbone feature extraction network, transforms the channels of the third convolution image feature, reduces the number of channels of the third convolution image feature, thereby reducing the computational complexity of the target detection model and obtaining the fourth size image feature; then, three branch convolution layers 401, 402, and 403 with different receptive field sizes are used to perform convolution processing on the fourth size image feature, respectively, to extract the image features of the fourth size image, wherein the sizes of the receptive fields of the three branch convolutions are assumed to be 3*1, 3*2, and 3*3, respectively; in order to fit the aspect ratio size of the detection target (for example, a pedestrian) and reduce video memory consumption, the feature extraction module based on the target area can be By using dilation rates of 1 and 2 for convolution kernels of 3*2 and 3*3 in height, respectively, a larger target (e.g., pedestrian) receptive field is obtained with fewer parameters, and finally convolutions of three receptive fields of 3*1, 5*2 and 7*3 are formed. Thus, the three target receptive field convolutions of different sizes (3*1, 5*2 and 7*3) can be used to extract image features of the image of the fourth size, respectively, to obtain first size image features, second size image features and third size image features of different scales. Then, the generated first size image features, second size image features and third size image features are spliced ​​with the original input feature map by channel to obtain a target spliced ​​image of the target image; finally, the target spliced ​​image features are subjected to channel transformation using the fifth convolution layer to obtain the first image features.

[0109] In the embodiments of the present specification, since the convolutions of three different sizes have similar aspect ratios to the detection targets (e.g., dense pedestrians), the features of detection targets of different scales in the target image can be effectively extracted to improve the detection accuracy of the target detection model.

[0110] Attached Figure 4 and with Figure 4The corresponding textual explanation is only used as an implementable embodiment to explain the working principle of the feature extraction module based on the target area, and cannot be used as a specific limitation of the feature extraction module based on the target area. The operating parameters in the feature extraction module based on the target area can be set as needed.

[0111] In the embodiment of this specification, the neck network in the YOLOv4 network uses a large number of standard convolutions in the process of feature fusion, and the channel transformation between feature layers of different scales uses a large number of standard convolutions. However, standard convolutions will cause a large amount of calculation, which is not conducive to implementation in small devices. Therefore, we use a ghost network generated based on a dual attention mechanism to construct a unidirectional multi-scale feature fusion structure. For ease of understanding, this is explained in detail:

[0112] Optionally, the second number of Ghost modules required to build the neck network may include: a first Ghost module, a second Ghost module, a third Ghost module, a fourth Ghost module, a fifth Ghost module, and a sixth Ghost module; in addition, the neck network also includes: a first upsampling module, a second upsampling module, a first fusion module, and a second fusion module.

[0113] The use of the Ghost module to build the neck network specifically includes:

[0114] The first Ghost module, the second Ghost module, the first up-sampling module, the first fusion module, the third Ghost module, the second up-sampling module and the second fusion module are sequentially connected.

[0115] The input end of the fourth Ghost module is connected to the output end of the first Ghost module.

[0116] The input end of the fifth Ghost module is connected to the output end of the first fusion module.

[0117] The input end of the sixth Ghost module is connected to the output end of the second fusion module.

[0118] The first Ghost module is used to receive the first image feature output by the feature extraction module based on the target area, and perform channel attention enhancement processing and spatial attention enhancement processing on the first image feature to obtain a first intermediate image feature; and, perform feature transformation processing on the first intermediate image feature to obtain a first Ghost image feature.

[0119] The second Ghost module is used to receive the first Ghost image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the first Ghost image feature to obtain a second intermediate image feature; and, perform feature transformation processing on the second intermediate image feature to obtain a second Ghost image feature.

[0120] The first up-sampling module is used to receive the second Ghost image feature and perform up-sampling processing on the second Ghost image feature to obtain a first up-sampled image feature.

[0121] The first fusion module is used to add the first up-sampled image feature and the third trunk image feature element by element to obtain the second image feature of the target image.

[0122] The third Ghost module is used to receive the second image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the second image feature to obtain a third intermediate image feature; and, perform feature transformation processing on the third intermediate image feature to obtain a third Ghost image feature.

[0123] The second up-sampling module is used to receive the third Ghost image feature and perform up-sampling processing on the third Ghost image feature to obtain a second up-sampled image feature.

[0124] The second fusion module is used to add the second up-sampled image feature and the second trunk image feature element by element to obtain a third image feature of the target image.

[0125] The fourth Ghost module is used to receive the first Ghost image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the first Ghost image feature to obtain a fourth intermediate image feature; and, perform feature transformation processing on the fourth intermediate image feature to obtain a fourth Ghost image feature.

[0126] The fifth Ghost module is used to receive the second image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the second image feature to obtain a fifth intermediate image feature; and, perform feature transformation processing on the fifth intermediate image feature to obtain a fifth Ghost image feature.

[0127] The sixth Ghost module is used to receive the third image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the third image feature to obtain a sixth intermediate image feature; and, perform feature transformation processing on the sixth intermediate image feature to obtain a sixth Ghost image feature.

[0128] In the embodiments of the present specification, the first upsampling module and the second upsampling module are upsampling modules used in the prior art, which are respectively used to upsample the target image features obtained respectively so that the size of the processed image can match the size of the image features output by the backbone feature extraction network.

[0129] Figure 3 The structure of the neck network constructed in the embodiment of this specification is also shown. The neck network may include: a first Ghost module, a second Ghost module, a third Ghost module, a fourth Ghost module, a fifth Ghost module, and a sixth Ghost module; in addition, the neck network also includes: a first upsampling module, a second upsampling module, a first fusion module, and a first fusion module.

[0130] In the embodiments of this specification, a multi-scale feature fusion concept similar to the feature pyramid is adopted, the top-down downsampling fusion process is abandoned, and the lightweight fusion feature stage is achieved through a bottom-up upsampling method.

[0131] In the embodiments of the present specification, in the existing Ghost module, the entire convolution process is divided into two processes. First, a standard convolution is used to compress the channels of the input target image features to obtain an intermediate feature map, and then the intermediate feature map is linearly transformed to generate more feature maps. Although the existing Ghost module uses a large number of linear operations to generate feature maps, the number of parameters of the entire model is reduced, which improves the detection speed. However, directly using the existing Ghost module to construct a feature fusion structure has no substantial effect on the detection accuracy. Therefore, the dual attention mechanism can be integrated with the Ghost module to improve the detection speed while improving the detection accuracy.

[0132] Specifically: the generating of the second number of Ghost modules based on the dual attention mechanism may include:

[0133] Based on the dual attention mechanism, a second channel attention submodule and a second spatial attention submodule are generated; the second channel attention submodule is used to perform channel attention enhancement processing on image features; the second spatial attention submodule is used to perform spatial attention enhancement processing on image features.

[0134] The second channel attention submodule, the second spatial attention submodule and the preset Ghost submodule are used to generate each Ghost module; the preset Ghost submodule is used to perform feature transformation processing on image features.

[0135] In the embodiments of the present specification, the generation principle of the second channel attention submodule is the same as the generation principle of the channel attention submodule described above; the generation principle of the second spatial attention submodule is the same as the generation principle of the spatial attention submodule described above, so it will not be repeated here.

[0136] In the embodiment of this specification, the preset Ghost submodule may be an existing Ghost module.

[0137] In the embodiment of this specification, the channel attention submodule CAM, the spatial attention submodule and the preset Ghost submodule are connected to generate each of the Ghost modules, and the specific connection relationship is not limited here.

[0138] In the embodiments of this specification, in order to reduce the amount of calculation, the Ghost module can use 1*1 point-by-point convolution instead of its standard convolution, and use 1*1 point-by-point convolution to generate an intermediate feature map to improve the detection speed of the target detection model.

[0139] In the embodiments of this specification, based on the dual attention mechanism, the improved Ghost module in this specification is generated, and the dual attention mechanism is used to strengthen the attention to the visible area of ​​the target. Before the input target image feature map is convolved point by point using the Ghost module, the weight of the visible area of ​​the target is first strengthened by the dual attention mechanism to retain more effective feature information, and then point by point convolution and subsequent linear operations are performed to generate more feature vectors. Compared with the existing Ghost module, the Ghost module generated based on the dual attention mechanism pays more attention to the feature information of the detection target in the subsequent process of generating feature maps, thereby improving the accuracy of the neck network in extracting target image features, which is beneficial to improving the detection accuracy of the target detection method.

[0140] In the embodiment of the present specification, the detection result obtained for the target image is usually generated and output by a prediction result generation network. Based on this, the prediction result generation network is constructed by using the third number of convolution modules, which may include:

[0141] Optionally, the third number of convolution modules includes: a first result generating convolution module, a second result generating convolution module, a third result generating convolution module and a detection result output layer.

[0142] The step of using the third number of convolution modules to build a prediction result generation network may include:

[0143] The input end of the first result generation convolution module is connected to the output end of the fourth Ghost module; the first result generation convolution module is used to receive the fourth Ghost image feature output by the fourth Ghost module, and generate a first detection result based on the fourth Ghost image feature.

[0144] The input end of the second result generating convolution module is connected to the output end of the fifth Ghost module; the first result generating convolution module is used to receive the fifth Ghost image feature output by the fifth Ghost module, and generate a second detection result based on the fifth Ghost image feature.

[0145] The input end of the third result generation convolution module is connected to the output end of the sixth Ghost module; the third result generation convolution module is used to receive the sixth Ghost image feature output by the sixth Ghost module, and generate a third detection result based on the sixth Ghost image feature.

[0146] The input end of the detection result output layer is respectively connected to the first result generation convolution module, the first result generation convolution module, and the output end of the first result generation convolution module, and the detection result output layer is used to generate a target detection result based on the first detection result, the second detection result, and the third detection result.

[0147] In the embodiments of this specification, the detection result output layer may be an algorithm, such as the NMS non-maximum suppression algorithm, or other algorithms that can obtain the final detection result, which is not specifically limited in the embodiments of this specification.

[0148] In an embodiment of the present specification, the first detection result, the second detection result, and the third detection result may be a plurality of detection frames generated by a target detection model for targets of different scales in a target image, wherein a plurality of detection frames may also be generated for each target in the target image.

[0149] The first detection result, the second detection result and the third detection result are processed using the NMS non-maximum suppression algorithm to output the final detection result.

[0150] Figure 3 The structure of the prediction result generation network constructed in the embodiments of this specification is also shown. Figure 3 As shown, the prediction result generation network 3 includes a first result generation convolution module, a second result generation convolution module, a third result generation convolution module and a detection result output layer.

[0151] In practical applications, the constructed target detection model usually needs to be trained before it can be applied to target detection in practical applications to ensure the accuracy of the prediction results. Based on this, before obtaining the image to be detected, the following can also be included:

[0152] Get a detection benchmark dataset. In the pedestrian detection scenario, the benchmark dataset may be WiderPerson, which is an outdoor pedestrian detection benchmark dataset.

[0153] The obtained benchmark data set is divided into training set, validation set, and test set in a ratio of 7:1:2.

[0154] The training set is input into the input module of the backbone feature extraction network in the target detection model, and the Figure 1 The target detection model built by the method and its embodiments extracts image features of target images of different scales through a backbone feature extraction network, performs feature fusion on image features of different scales through a neck network and extracts image features of the fused image, then generates a detection frame of the target to be detected in the target image through a prediction result generation network, and finally outputs the final target detection result through an NMS non-maximum suppression algorithm.

[0155] Find the error between the output value of the target detection model and the target value, that is, the loss function.

[0156] The hyperparameters of the target detection model are updated, and the training is terminated when the loss function of the target detection model converges to a certain level and no longer decreases.

[0157] The detection performance of the target detection model detection algorithm used in this embodiment is shown in Table 1 below:

[0158] Table 1

[0159] algorithm Model volume / MB Accuracy Recall / % Average accuracy / % Speed / FPS SSD-Lite 32.5 53.1 46.4 48.7 22 YOLOv3-tiny 35.6 51.6 43.7 46.9 20 YOLO-Slim 28.7 57.8 51.2 53.4 25 YOLOv4-tiny 25.4 55.9 50.5 51.6 29 Object Detection Methods 22.5 58.3 53.7 55.4 31

[0160] The target detection method in this application is compared with lightweight detection algorithms such as SSD-Lite, YOLOvTiny and YOLOv4-tiny algorithms, and the results are shown in Table 1. It can be seen from Table 1 that the model size of the target detection method in this application is 22.5MB, which is smaller than the four network models of SSD-Lite, YOLOv3-tiny, YOLO-Slim and YOLOv4-tiny, and has a smaller model size. In terms of accuracy, recall rate and average precision, the target detection method in this application reached 58.3%, 53.7% and 55.4% respectively, which are higher than the other four models, and have higher pedestrian detection accuracy. In terms of recall rate and average precision, the target detection method in this application reached 8.3%, 53.7% and 55.4% respectively, which are higher than the other four models, and have higher pedestrian detection accuracy. In terms of detection speed, the target detection method in this application reaches 31FPS, which is 9FPS, 11FPS and 6FPS higher than SSD-Lite, YOLOv3-tiny and YOLO-Slim respectively, and slightly higher than YOLOv4-tiny, but the average accuracy is improved by 3.8%. In summary, compared with other lightweight detection models, the target detection method in this application maintains a smaller model volume and achieves higher detection accuracy. Therefore, when using the target detection model provided in this application to detect the image to be detected, a certain detection accuracy and detection speed can be guaranteed.

[0161] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0162] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0163] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0164] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing one or more embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0165] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, one or more embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0166] One or more embodiments of the present specification are described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to one or more embodiments of the present specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0170] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0171] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0172] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0173] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0174] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0175] The above description is only an embodiment of the present specification and is not intended to limit one or more embodiments of the present specification. For those skilled in the art, one or more embodiments of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present specification shall be included in the scope of the claims of one or more embodiments of the present specification.

Claims

1. A target detection method, characterized in that: The method comprises: Acquire the image to be detected; Performing target detection processing on the image to be detected using a target detection model to obtain a target detection result; the target detection model is a model improved from the YOLOv4 neural network; The target detection model includes: a backbone feature extraction network, a neck network and a prediction result generation network; the backbone feature extraction network is connected to the neck network, and the neck network is connected to the prediction result generation network; the backbone feature extraction network is a network built based on a dual attention mechanism; the neck network is a network built using a Ghost module generated based on a dual attention mechanism; The step of obtaining the image to be detected also includes: Based on the dual attention mechanism, the first number of cross-stage partial connection structure modules are built; Using the cross-stage partial connection structure module, building the backbone feature extraction network; Based on the dual attention mechanism, generate the second number of Ghost modules; Using the Ghost module, constructing the neck network; Using a third number of convolutional modules, building the prediction result generation network; Sequentially establish a connection relationship between the backbone feature extraction network, the neck network, and the prediction result generation network to obtain the target detection model; The first number of cross-stage partial connection structural modules include: a first cross-stage partial connection structural module, a second cross-stage partial connection structural module and a third cross-stage partial connection structural module; The use of the cross-stage partial connection structure module to build the backbone feature extraction network specifically includes: The first cross-stage partial connection structure module, the second cross-stage partial connection structure module and the third cross-stage partial connection structure module are sequentially connected to obtain the backbone feature extraction network; The first cross-stage partial connection structure module is used to receive a target image, perform convolution processing on the target image, extract a first trunk intermediate image feature of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the first trunk intermediate image feature to obtain a first trunk image feature of the target image; The second cross-stage partial connection structure module is used to receive the first trunk image feature, perform convolution processing on the first trunk image feature to extract the second trunk intermediate image feature of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the second trunk intermediate image feature to obtain the second trunk image feature of the target image; The third cross-stage partial connection structure module is used to receive the second trunk image features, and perform convolution processing on the second trunk image features to extract the third trunk intermediate image features of the target image, and perform channel attention enhancement processing and spatial attention enhancement processing on the third trunk intermediate image features to obtain the third trunk image features of the target image.

2. The target detection method according to claim 1, characterized in that: The dual attention mechanism is based on which a first number of cross-stage partial connection structure modules are constructed, specifically including: Based on the dual attention mechanism, a first channel attention submodule and a first spatial attention submodule are generated; wherein the first channel attention submodule is used to perform channel attention enhancement processing on image features; and the first spatial attention submodule is used to perform spatial attention enhancement processing on image features; The first channel attention submodule, the first spatial attention submodule and the preset cross-stage partial connection structure submodule are used to generate various cross-stage partial connection structure modules; wherein the preset cross-stage partial connection structure submodule is used to extract image features.

3. The target detection method according to claim 1, characterized in that: The backbone feature extraction network also includes: an input module, a first convolution module, a second convolution module, a first maximum pooling module, a second maximum pooling module, a third maximum pooling module, a third convolution module, and a feature extraction module based on the target area; the feature extraction module based on the target area is used to extract image features of different sizes; The building of the backbone feature extraction network specifically includes: The input module, the first convolution module, the second convolution module, the first cross-stage partial connection structure module, the first maximum pooling module, the second cross-stage partial connection structure module, the second maximum pooling module, the third cross-stage partial connection structure module, the third maximum pooling module, the third convolution module and the feature extraction module based on the target area are connected in sequence to obtain the backbone feature extraction network; Wherein, the input module is used to obtain a target image; The first convolution module is used to receive the target image and perform convolution processing on the target image to obtain a first convolution image feature of the target image; The second convolution module is used to receive the first convolution image feature and perform convolution processing on the first convolution image feature to obtain a second convolution image feature of the target image; The first cross-stage partial connection structure module is specifically used to receive the second convolution image feature and generate a first trunk image feature of the target image; The first maximum pooling module is used to receive the first trunk image feature, and perform maximum pooling processing on the first trunk image feature to obtain a first maximum pooling image feature; The second cross-stage partial connection structure module is specifically used to receive the first maximum pooling image feature and generate a second trunk image feature of the target image; The second maximum pooling module is used to receive the second trunk image feature, and perform maximum pooling processing on the second trunk image feature to obtain a second maximum pooling image feature; The third cross-stage partial connection structure module is specifically used to receive the second maximum pooling image feature and generate a third trunk image feature of the target image; The third maximum pooling module is used to receive the third trunk image feature, and perform maximum pooling processing on the third trunk image feature to obtain a third maximum pooling image feature; The third convolution module is used to receive the third maximum pooling image feature and perform convolution processing on the third maximum pooling image feature to obtain a third convolution image feature of the target image; The feature extraction module based on the target area is used to receive the third convolution image feature and perform convolution processing on the third convolution image feature to extract the first image feature of the target image.

4. The target detection method according to claim 3, characterized in that: The feature extraction module based on the target area specifically includes: a first convolution layer, a second convolution layer and a third convolution layer with different convolution kernels; The input ends of the first convolution layer, the second convolution layer, and the third convolution layer are respectively connected to the third convolution module; The first convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a first size image feature of the target image; The second convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a second size image feature of the target image; The third convolution layer is used to receive the third convolution image feature, perform convolution processing on the third convolution image feature, and obtain a third size image feature of the target image; The first-size image feature, the second-size image feature, and the third-size image feature are respectively used for channel stitching with the third maximum pooling image feature to obtain the first image feature of the target image.

5. The target detection method according to claim 4, characterized in that: The feature extraction module based on the target area also includes: a fourth convolution layer and a fifth convolution layer; The input end of the fourth convolutional layer is connected to the output end of the third convolutional module, the output end of the fourth convolutional layer is connected to the input ends of the first convolutional layer, the second convolutional layer, and the third convolutional layer respectively, and the fourth convolutional layer is used to receive the third convolutional image feature, perform convolution processing on the third convolutional image feature, and obtain a fourth size image feature of the target image; An input end of the fifth convolutional layer is connected to output ends of the first convolutional layer, the second convolutional layer, and the third convolutional layer respectively; The fifth convolutional layer is used to perform channel transformation on the target stitching image features to obtain the first image features output by the feature extraction module based on the target area, and the target stitching image is the image features of the target image obtained by channel stitching the first size image features, the second size image features and the third size image features.

6. The target detection method according to claim 3, characterized in that: The second number of Ghost modules includes: a first Ghost module, a second Ghost module, a third Ghost module, a fourth Ghost module, a fifth Ghost module, and a sixth Ghost module; The neck network further includes: a first upsampling module, a second upsampling module, a first fusion module and a second fusion module; The use of the Ghost module to build the neck network specifically includes: Connecting the first Ghost module, the second Ghost module, the first upsampling module, the first fusion module, the third Ghost module, the second upsampling module and the second fusion module in sequence; The input end of the fourth Ghost module is connected to the output end of the first Ghost module; The input end of the fifth Ghost module is connected to the output end of the first fusion module; The input end of the sixth Ghost module is connected to the output end of the second fusion module; The first Ghost module is used to receive the first image feature output by the feature extraction module based on the target area, and perform channel attention enhancement processing and spatial attention enhancement processing on the first image feature to obtain a first intermediate image feature; and perform feature transformation processing on the first intermediate image feature to obtain a first Ghost image feature; The second Ghost module is used to receive the first Ghost image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the first Ghost image feature to obtain a second intermediate image feature; and perform feature transformation processing on the second intermediate image feature to obtain a second Ghost image feature; The first up-sampling module is used to receive the second Ghost image feature, and perform up-sampling processing on the second Ghost image feature to obtain a first up-sampled image feature; The first fusion module is used to add the first up-sampled image feature and the third trunk image feature element by element to obtain a second image feature of the target image; The third Ghost module is used to receive the second image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the second image feature to obtain a third intermediate image feature; and perform feature transformation processing on the third intermediate image feature to obtain a third Ghost image feature; The second up-sampling module is used to receive the third Ghost image feature, and perform up-sampling processing on the third Ghost image feature to obtain a second up-sampling image feature; The second fusion module is used for adding the second up-sampled image feature and the second trunk image feature element by element to obtain a third image feature of the target image; The fourth Ghost module is used to receive the first Ghost image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the first Ghost image feature to obtain a fourth intermediate image feature; and perform feature transformation processing on the fourth intermediate image feature to obtain a fourth Ghost image feature; The fifth Ghost module is used to receive the second image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the second image feature to obtain a fifth intermediate image feature; and perform feature transformation processing on the fifth intermediate image feature to obtain a fifth Ghost image feature; The sixth Ghost module is used to receive the third image feature, and perform channel attention enhancement processing and spatial attention enhancement processing on the third image feature to obtain a sixth intermediate image feature; and, perform feature transformation processing on the sixth intermediate image feature to obtain a sixth Ghost image feature.

7. The target detection method according to claim 6, characterized in that: The generating of the second number of Ghost modules based on the dual attention mechanism specifically includes: Based on the dual attention mechanism, a second channel attention submodule and a second spatial attention submodule are generated; the second channel attention submodule is used to perform channel attention enhancement processing on image features; the second spatial attention submodule is used to perform spatial attention enhancement processing on image features; The second channel attention submodule, the second spatial attention submodule and the preset Ghost submodule are used to generate each Ghost module; the preset Ghost submodule is used to perform feature transformation processing on image features.

8. The target detection method according to claim 6, characterized in that: The third number of convolution modules includes: a first result generating convolution module, a second result generating convolution module, a third result generating convolution module, and a detection result output layer; The using the third number of convolution modules to build a prediction result generation network specifically includes: Connecting the input end of the first result generation convolution module to the output end of the fourth Ghost module; the first result generation convolution module is used to receive the fourth Ghost image feature output by the fourth Ghost module, and generate a first detection result based on the fourth Ghost image feature; The input end of the second result generation convolution module is connected to the output end of the fifth Ghost module; the first result generation convolution module is used to receive the fifth Ghost image feature output by the fifth Ghost module, and generate a second detection result based on the fifth Ghost image feature; Connecting the input end of the third result generation convolution module to the output end of the sixth Ghost module; the third result generation convolution module is used to receive the sixth Ghost image feature output by the sixth Ghost module, and generate a third detection result based on the sixth Ghost image feature; The input end of the detection result output layer is respectively connected to the first result generation convolution module, the first result generation convolution module, and the output end of the first result generation convolution module, and the detection result output layer is used to generate a target detection result based on the first detection result, the second detection result, and the third detection result.

Citation Information

Patent Citations

  • Face mask wearing condition detection method based on deep learning

    CN113361397A

  • Method and system for detecting artificial small target in SAR (Synthetic Aperture Radar) image

    CN113567984A