A lightweight pedestrian detection method based on attention mechanism

By embedding the shuffle attention mechanism module in the pedestrian detection model, combining the lightweight ShuffleNet and FPEM network, the problem of excessive parameter quantity and operation quantity of pedestrian detection model after lightweight in the existing technology is solved, and efficient pedestrian detection on hardware with limited computing power is achieved.

CN114782980BActive Publication Date: 2025-04-11XIDIAN UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210209049.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-03
Publication Date
2025-04-11
Estimated Expiration
2042-03-03

AI Technical Summary

Technical Problem

After the existing technology has lightened the pedestrian detection model trained by deep learning, the number of parameters and calculations of the model are still too large, and the detection accuracy is reduced, making it difficult to deploy on edge hardware with limited computing power.

Method used

The lightweight pedestrian detection method based on attention mechanism is adopted. By combining the lightweight ShuffleNet network and the lightweight FPEM network in PanNet, and embed the shuffle attention mechanism module in the ShuffleBlock local network, the parameter amount and calculation amount of the model are reduced, while improving the detection accuracy.

Benefits of technology

In the case of small loss of detection accuracy, the parameter amount and calculation amount of the pedestrian detection model are significantly reduced, and the real-time detection capability on edge hardware with limited computing power is improved, which is suitable for pedestrian detection in mobile scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114782980B_ABST
    Figure CN114782980B_ABST
Patent Text Reader

Abstract

The present invention discloses a lightweight pedestrian detection method based on an attention mechanism, which collects image data containing pedestrian targets, inputs them into a trained lightweight pedestrian detection model, judges and predicts the images, and obtains the location information of the pedestrian targets; wherein, the lightweight pedestrian detection model adopts a network structure composed of a lightweight ShuffleNet network and a lightweight FPEM network in PanNet as a basic framework, and embeds a shuffle attention mechanism module in the ShuffleBlock local network of ShuffleNet. The present invention has the advantages of small size and fast computing speed, and is particularly suitable for deployment on edge hardware with limited computing power such as mobile phones, and effectively improves the accuracy and speed of pedestrian target detection on edge hardware with limited computing power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of target detection, and in particular relates to a lightweight pedestrian detection method based on an attention mechanism. Background Art

[0002] Due to the rapid development of artificial intelligence technology, a large number of pedestrian detection algorithms based on deep learning have emerged in recent years, becoming the mainstream method of pedestrian detection. With the widespread application of pedestrian detection algorithms based on deep learning, how to deploy pedestrian detection algorithms on edge hardware with limited computing power has become a new challenge. The existing technology is aimed at the deployment and application of edge hardware with limited computing power. It uses some large pedestrian detection models as the basic framework and reduces the number of parameters and calculations by lightweighting them, so as to maintain real-time performance when deployed on edge hardware with limited computing power. However, after the large pedestrian detection model is lightweighted, there are still disadvantages that the number of parameters and calculations are still too large for edge hardware and the detection accuracy is greatly reduced. Summary of the invention

[0003] In order to overcome the shortcomings of the above-mentioned prior art, and solve the problem that the pedestrian detection model currently trained by deep learning cannot be deployed on edge hardware with limited computing power due to the large number of parameters and computation, and the problem that the number of parameters and computation of some pedestrian detection models are still too large after lightweighting, and the detection accuracy is greatly reduced, the purpose of the present invention is to provide a lightweight pedestrian detection method based on an attention mechanism, so as to reduce the number of parameters and computation of the pedestrian detection model with a small loss of detection accuracy.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is:

[0005] A lightweight pedestrian detection method based on attention mechanism includes the following steps:

[0006] Step 1: Train a lightweight pedestrian detection model

[0007] The lightweight pedestrian detection model adopts a network structure composed of a lightweight ShuffleNet network and a lightweight FPEM network in PanNet as a basic framework, wherein the lightweight ShuffleNet network serves as the backbone network of the lightweight pedestrian detection model, and the lightweight FPEM network serves as the neck network of the lightweight pedestrian detection model; wherein a shuffle attention mechanism module is embedded in the ShuffleBolock local network of the lightweight ShuffleNet network; and the lightweight pedestrian detection model is trained by a preset loss function;

[0008] Step 2: Collect image data containing pedestrian targets and input it into a trained lightweight pedestrian detection model. Use the lightweight pedestrian detection model to judge and predict the image to obtain the location information of the pedestrian targets.

[0009] Optionally, a shuffle attention mechanism module is embedded in the ShuffleBolock local network of the lightweight ShuffleNet network to obtain the SA_ShuffleBolck local network, and a repeating unit consisting of superimposed SA_ShuffleBolck local networks is formed.

[0010] Optionally, the lightweight ShuffleNet network is obtained by removing the last three layers from the ShuffleNet network, wherein the last three layers include: a 1×1 convolutional layer, a 7×7 global pooling layer and a fully connected layer;

[0011] The lightweight FPEM network is modified based on the FPEM network in PanNet, wherein the modification operation includes:

[0012] (1) The three upsampling and downsampling operations in the FPEM network are changed to two upsampling and downsampling operations, so that the input image is changed from being up-sampled and down-sampled by 2, 4, and 8 times to being up-sampled and down-sampled by 2 and 4 times;

[0013] (2) During the sampling process of the FPEM network, the depthwise separable convolution module with a stride of 1 after the first sum operation is replaced by a 1×1 convolution layer, the depthwise separable convolution module with a stride of 1 after the second sum operation is removed, the depthwise separable convolution module with a stride of 2 after the third sum operation is moved before the third sum operation, and the depthwise separable convolution module with a stride of 2 after the fourth sum operation is moved before the fourth sum operation.

[0014] Optionally, the shuffle attention mechanism module is embedded after the last convolutional layer of the ShuffleBlock local network trunk branch.

[0015] Optionally, the shuffle attention mechanism module performs the following steps:

[0016] Step 1: First, group the input feature map F into n sub-feature maps F according to the channel scale k , where 0<k≤n;

[0017] Step 2: Process all F in parallel k , for each sub-feature map F k , divide its channel number into two to get the feature map F′ k1 and F′ k2, using the branch network of shuffle units in the spatial dimension to F′ k1 After processing, we get M s (F′ k1 ), using the branch network of the shuffle unit in the channel dimension to k2 After processing, we get M c (F′ k2 ), M s (F′ k1 ) and F′ k1 Multiply point by point to get the final output feature map F of the spatial dimension attention mechanism sk , M c (F′ k2 ) and F′ k2 Multiply point by point to get the final output feature map F of the channel dimension attention mechanism ck , and then the feature map F sk and F ck Splice to get sub-feature F tk ;

[0018] Step 3: For all sub-features F tk Polymerization to obtain F a , and uses channel shuffling operation to realize information fusion between different sub-features, and obtains the feature map F′ after shuffled attention mechanism processing.

[0019] Optionally, the loss function LOSS is composed of the bounding box regression loss function L box And the confidence loss function L obj Composition, that is: LOSS = L box +L obj .

[0020] Optionally, the loss function LOSS is composed of the complete intersection-over-union loss function L IoU And the confidence loss function L obj Composition, namely:

[0021] LOSS=L IoU +L obj

[0022] The complete intersection-over-union loss function L IoU The expression is as follows:

[0023]

[0024]

[0025]

[0026] Among them, b and b gtdenote the center points of the prediction box and the target box respectively, ρ(·)=||bb gt ||2 represents the Euclidean distance between the two center points, c is the diagonal length of the smallest enclosing box containing the prediction box and the target box, and w b ,h b are the width and height of the prediction box, respectively. are the width and height of the target box respectively, and α and v are the intermediate parameters used in calculation.

[0027] Optionally, the image data is collected through movable edge hardware, and the trained lightweight pedestrian detection model is deployed on the movable edge hardware.

[0028] The present invention is based on a deep neural network and proposes a lightweight method for pedestrian detection on edge hardware with limited computing power. Based on the FPEM in ShuffleNet and PanNet, a series of improvements and optimizations are made. Compared with the prior art, the present invention has the advantages of small size and fast computing speed. It is particularly suitable for deployment on edge hardware with limited computing power such as mobile phones, and effectively improves the accuracy and speed of pedestrian target detection on edge hardware with limited computing power. Compared with the existing network structure, pedestrian detection can be performed on images taken by the camera in scenes that need to be moved, such as mobile phones, drones, and some scenes with high requirements for mobile scenes, and higher real-time performance and accuracy can be achieved. The size of the model of the present invention is greatly reduced compared to some existing network structures, while ensuring that the detection accuracy does not drop significantly, which meets the application requirements of lightweight front-end in mobile scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a flow chart of the present invention.

[0030] Figure 2 It is a schematic diagram of the network structure of the lightweight pedestrian detection model based on the attention mechanism of the present invention.

[0031] Figure 3 It is a structural diagram of the shuffled attention mechanism module of the present invention.

[0032] Figure 4 It is a schematic diagram of the structure of the SA_ShuffleBlock local network of the present invention. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present invention to provide a clear and complete description of the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0034] like Figure 1 As shown in the figure, the present invention is a lightweight pedestrian detection method based on the attention mechanism, the purpose of which is to reduce the number of parameters and the amount of computation of the pedestrian detection model while sacrificing a small amount of detection accuracy, so as to achieve real-time detection when deployed on edge hardware with limited computing power. The specific steps mainly include:

[0035] Step 1: Train a lightweight pedestrian detection model

[0036] The pedestrian detection model mainly consists of four parts: input layer Input, backbone network Backbone, neck network Neck and output layer Output. Among them, the input layer Input adaptively scales the input image for subsequent network processing; the backbone network Backbone processes the input image, extracts the feature map containing the image features, and then outputs the feature map to the neck network Neck; the neck network Neck enhances the features of different scales by fusing low-scale and high-scale features, and strengthens the ability of network feature fusion; the output layer Output is used to generate a predicted bounding box.

[0037] refer to Figure 2 In one embodiment of the present invention, the lightweight pedestrian detection model uses a network structure composed of a lightweight ShuffleNet network and a lightweight FPEM network in PanNet as the basic framework. Among them, the lightweight ShuffleNet network serves as the backbone network of the lightweight pedestrian detection model, and the lightweight FPEM network serves as the neck network of the lightweight pedestrian detection model. Through lightweight processing of the network, the pedestrian detection model of the present invention becomes a lightweight convolutional neural network with a lower number of parameters and computational complexity, so that the pedestrian detection model has less time and space overhead, occupies less memory and has a higher detection speed, so that the pedestrian detection model can be better deployed on edge hardware with limited computing power to achieve real-time detection.

[0038] Based on this basic framework, the present invention embeds a shuffle attention mechanism module in the ShuffleBolock local network of the lightweight ShuffleNet network to obtain the SA_ShuffleBolck local network, and forms a repeating unit composed of the superposition of the SA_ShuffleBolck local network. At this point, the lightweight pedestrian detection model based on the attention mechanism of the present invention is formed. The present invention embeds a shuffle attention mechanism module in the pedestrian detection model, adds the grouped attention mechanism of the space and channel dimensions to the feature extraction network, and simultaneously screens the feature information of the space and channel dimensions, and shuffles the sub-features obtained by aggregation, so that the network receptive field is expanded while the information between different features is also integrated, thereby improving the feature expression ability of the feature extraction network.

[0039] In an embodiment, Figure 2 As shown in the backbone network, the lightweight ShuffleNet network of the present invention is obtained by removing the last three layers from the ShuffleNet network, wherein the last three layers (i.e., the removed three layers) include: a 1×1 convolutional layer, a 7×7 global pooling layer, and a fully connected layer.

[0040] Correspondingly, Figure 2 As shown in the neck network, the lightweight FPEM network of the present invention is modified based on the FPEM network in PanNet, wherein the modification operation includes:

[0041] (1) The three upsampling and downsampling operations in the FPEM network are changed to two upsampling and downsampling operations, so that the input image is changed from the upsampling scale of 2, 4, and 8 times to the upsampling scale of 2 and 4 times. Figure 2 In the neck network part (i.e., lightweight FPEM network), Upsample is the upsampling operation, and DwSConv is the downsampling operation. Figure 2 is the final optimized network. The neck network has two UpSamples and two DwSConvs, so it is 2 times. The FPEM network itself has 3. In addition, the FPEM network and Figure 2 The differences in the neck networks shown are minor.

[0042] (2) During the sampling process of the FPEM network, the depthwise separable convolution module with a stride of 1 after the first sum operation is replaced by a 1×1 convolution layer, the depthwise separable convolution module with a stride of 1 after the second sum operation is removed, the depthwise separable convolution module with a stride of 2 after the third sum operation is moved before the third sum operation, and the depthwise separable convolution module with a stride of 2 after the fourth sum operation is moved before the fourth sum operation.

[0043] Here, the depthwise separable convolution uses a 3×3 depthwise convolution and a 1×1 pointwise convolution, so the neck network can expand the receptive field and deepen the network with less computational overhead.

[0044] In an embodiment, the shuffle attention mechanism module of the present invention performs the following steps:

[0045] Step 1: First, group the input feature map F into n sub-feature maps F according to the channel scale k , where 0<k≤n.

[0046] Step 2: Process all F in parallelk , for each sub-feature map F k , divide its channel number into two to get the feature map F′ k1 and F′ k2 , using the branch network of shuffle units in the spatial dimension to F′ k1 After processing, we get M s (F′ k1 ), using the branch network of the shuffle unit in the channel dimension to k2 After processing, we get M c (F′ k2 ), M s (F′ k1 ) and F′ k1 Multiply point by point to get the final output feature map F of the spatial dimension attention mechanism sk , M c (F′ k2 ) and F′ k2 Multiply point by point to get the final output feature map F of the channel dimension attention mechanism ck , and then the feature map F sk and F ck Splice to get sub-feature F tk .

[0047] Among them, Figure 3 The right branch shows the final output feature map F of the channel dimension attention mechanism. ck The acquisition of includes the following steps:

[0048] First, the global information is obtained by generating a one-dimensional feature vector using global average pooling, where the global average pooling calculation formula is as follows:

[0049]

[0050] Among them, s is a one-dimensional feature vector generated by global average pooling, H and W are feature maps F′ k2 The height and width of (i, j) are the feature graphs F′ k2 The pixel coordinates;

[0051] Secondly, s is processed by a linear function related to parameters W2 and b2 to obtain f c (s), and then use the sigmoid function to adjust f c (s) is processed to obtain M c (F′ k2 );

[0052] Finally, M c (F′ k2 ) and F′ k2 Multiply point by point to get the final output feature map F of the channel dimension attention mechanismck , the calculation formula is as follows:

[0053] F ck =M c (F′ k2 )·F′ k2 =σ(f c (s))·F′ k2 =σ(W2s+b2)·F′ k2

[0054] Among them, W2 and b2 are one-dimensional vectors of the same size as s, which are used to scale and shift the values ​​in s, which are updated during the back-propagation process of model training, and σ is the sigmoid function.

[0055] like Figure 3 The left branch shows the final output feature map F of the spatial dimension attention mechanism. sk The acquisition of includes the following steps:

[0056] First, group normalization GN is used to obtain F′ k1 Spatial statistics:

[0057]

[0058] Where t is the two-dimensional feature vector generated by the group normalization GN operation, c g F′ k1 The number of channels, (i, j) is F′ k1 The feature map F′ of the mth channel k1m The pixel coordinate value of

[0059] Secondly, s is processed by a linear function related to parameters W1 and b1 to obtain f s (s), and then use the sigmoid function to adjust f s (s) is processed to obtain M s (F′ k1 ), enhance F′ k1 Characteristic performance;

[0060] Finally, M s (F′ k1 ) and F′ k1 Multiply point by point to get the final output feature map F of the spatial dimension attention mechanism sk , the calculation formula is as follows:

[0061] F sk =M s (F′ k1 )·F′ k1 =σ(f s (s))·F′ k1=σ(W1·t+b1)·F′ k1

[0062] Among them, W1 and b1 are two-dimensional vectors of the same size as t, which are used to scale and shift the values ​​in t, and are updated during the back-propagation process of model training.

[0063] In the present invention, W (W1 and W2) and b (b1 and b2) are two vectors, which can be understood as a set of numbers with the same number of elements as s. Each number in s is scaled and shifted, and each number in s is weighted similarly to a weight value, so as to reflect the different importance of each element in s. W and b will be updated in each back propagation of the pedestrian detection network model training, so as to obtain the most important elements (i.e., F′ k2 The most important feature map) W and b. (F′ k2 It is a three-dimensional vector, that is, the superposition of multiple channel images. One image is two-dimensional, and the number of channels here is the third dimension. s is the value of F′ k2 The one-dimensional vector after "compression" is that only the channel dimension remains, and the two-dimensional dimension of the image becomes a constant. )

[0064] Step 3: For all sub-features F tk Aggregate to obtain F with the same dimension and size as the input feature map F a , and adopts a channel shuffle operation similar to ShuffleNet v2 to realize the information fusion between different sub-features, that is, the information flows along the channel dimension, and the feature map F′ processed by the shuffle attention mechanism is obtained.

[0065] refer to Figure 3 As shown in the figure, Aggregation represents aggregation operation, and Channel Shuffle represents channel shuffle operation. The channel shuffle in ShuffleNet v2 is fixed as the shuffle of two groups of feature maps, which is slightly different from that. The channel shuffle operation in the shuffle attention mechanism module of the present invention can freely set the number of groups (such as 2, 4, 8, generally an even number).

[0066] In terms of embedding, for example, refer to Figure 4 , SA_Attention is the shuffled attention mechanism module of the present invention, Figure 4The two networks in the figure are the ShuffleBlock local networks of Shufflenet. The left figure is the ShuffleBlock local network when the step size of the DwSConv convolution kernel is 1, and the right figure is the ShuffleBlock local network when the step size is 2. After embedding SA_Attention in the last convolution layer (i.e., the lower Conv(c_in, c_out, 1, 1)) of the main branch (i.e., the right branch) of the ShuffleBlock local network, the output of the lower Conv(c_in, c_out, 1, 1) is used as the input of the SA_Attention module, and the output of SA_Attention is used as the input of the next layer.

[0067] The shuffle attention mechanism module (SA_Attention) is embedded in the ShuffleBlock local network to obtain the SA_ShuffleBolck local network, forming a repeating unit consisting of SA_ShuffleBolck local networks with a step size of 2 and a step size of 1. SA_Attention is a very lightweight plug-and-play module that can significantly improve the performance of the feature extraction network.

[0068] Step 2: Train the lightweight pedestrian detection model through a preset loss function, where the loss function can be composed of a bounding box regression loss function and a confidence loss function, or can be composed of a complete intersection-over-union loss function and a confidence loss function.

[0069] Specifically, for the constructed lightweight pedestrian detection model, the embodiment of the present invention uses the adam optimization method and adopts a preset loss function to perform training in an end-to-end manner. Optionally, the training image size is 640*640, the batch_size is set to 16, and the epoch is set to 300.

[0070] In one embodiment of the present invention, the loss function LOSS is composed of the bounding box regression loss function L box And the confidence loss function L obj The composition is shown in the following formula:

[0071] LOSS=L box +L obj

[0072] The IoU-based loss function cannot correctly reflect the closeness between the target box and the predicted box. When the predicted box and the target box do not overlap, the loss value is 0, and the convergence speed is slow. In this embodiment of the present invention, the frame regression loss function L boxReplaced by the complete IoU Loss. At this time, the loss function of the pedestrian detection model is replaced by the complete IoU loss function L IoU And the confidence loss function L obj Composition, that is: LOSS = L IoU +L obj .

[0073] Among them, the complete intersection-over-union loss function can reduce the distance between the prediction box and the target box in pedestrian detection, and add penalty terms on two scales: the center point distance and the aspect ratio of the prediction box and the target box, so that the loss function converges faster and the prediction box can be more consistent with the target box through regression.

[0074] The complete intersection-over-union loss function consists of three parts: the first part is the loss value generated by calculating the intersection-over-union ratio between the prediction box and the target box; the second part is the loss value generated by calculating the distance between the prediction box and the target box center; the third part is the loss value generated by calculating the difference in aspect ratio between the prediction box and the target box. The more the prediction box conforms to the target box, the smaller the loss value will be. The expression of the complete intersection-over-union loss function is shown as follows:

[0075]

[0076]

[0077]

[0078] Among them, b and b gt Represent the center points of the prediction box and the target box respectively. ρ(·)=||bb gt ||2 represents the Euclidean distance between the two center points. c is the diagonal length of the smallest enclosing box containing the two boxes, and w b ,h b are the width and height of the prediction box, respectively. are the width and height of the target box, α and v are the intermediate parameters used in the calculation. The second part calculates the loss value of the distance between the center point of the prediction box and the target box, and the third part calculates the loss value of the difference between the width and height ratio of the prediction box and the target box. This can avoid the situation where the loss value is 0 when the prediction box and the target box do not overlap based on the IoU loss function, and can make the bounding box regression converge faster and better.

[0079] For the pedestrian detection model, the present invention uses precision (Precision), recall rate (Recall), average precision (Average Precision, referred to as AP), parameter quantity (params), model complexity (Floating point of persecond, referred to as FLOPs) and frame rate (Frames Per Second, referred to as FPS) as evaluation indicators.

[0080] Step 3: Collect image data containing pedestrian targets and input it into the trained lightweight pedestrian detection model. The lightweight pedestrian detection model is used to judge and predict the image to obtain the location information of the pedestrian targets.

[0081] For example, the present invention aims to improve the speed and accuracy of pedestrian detection in images captured by cameras in scenarios that need to be moved, which are processed by edge hardware with limited computing power. That is, when performing pedestrian detection, target detection is performed on images captured by the camera in scenarios that need to be moved (mobile edge hardware). Images containing pedestrian targets are captured by cameras carried by mobile devices (such as cameras carried by tools such as smartphones, vehicles or airplanes, etc.). The lightweight pedestrian detection model trained by the present invention can be directly deployed on the movable edge hardware. This effectively improves the accuracy and speed of pedestrian detection in mobile scenarios, and meets the application requirements of lightweight front-ends in mobile scenarios.

[0082] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

Claims

1. A lightweight pedestrian detection method based on attention mechanism, characterized in that: The steps include: Step 1: Train a lightweight pedestrian detection model The lightweight pedestrian detection model adopts a network structure composed of a lightweight ShuffleNet network and a lightweight FPEM network in PanNet as a basic framework, wherein the lightweight ShuffleNet network serves as the backbone network of the lightweight pedestrian detection model, and the lightweight FPEM network serves as the neck network of the lightweight pedestrian detection model; wherein a shuffle attention mechanism module is embedded in the ShuffleBolock local network of the lightweight ShuffleNet network; and the lightweight pedestrian detection model is trained by a preset loss function; The lightweight ShuffleNet network is obtained by removing the last three layers from the ShuffleNet network, wherein the last three layers include: a 1×1 convolutional layer, a 7×7 global pooling layer, and a fully connected layer; The lightweight FPEM network is modified based on the FPEM network in PanNet, wherein the modification operation includes: (1) The three upsampling and downsampling operations in the FPEM network are changed to two upsampling and downsampling operations, so that the input image is changed from being up-sampled and down-sampled by 2, 4, and 8 times to being up-sampled and down-sampled by 2 and 4 times; (2) During the sampling process of the FPEM network, the depthwise separable convolution module with a stride of 1 after the first sum operation is replaced with a 1×1 convolution layer, the depthwise separable convolution module with a stride of 1 after the second sum operation is removed, the depthwise separable convolution module with a stride of 2 after the third sum operation is moved before the third sum operation, and the depthwise separable convolution module with a stride of 2 after the fourth sum operation is moved before the fourth sum operation; The shuffle attention mechanism module is embedded after the last convolutional layer of the ShuffleBlock local network trunk branch. The shuffle attention mechanism module performs the following steps: Step 1: First, group the input feature map F into n sub-feature maps F according to the channel scale k , where 0 <k≤n; Step 2: Process all F in parallel k , for each sub-feature map F k , divide its channel number into two to get the feature map F k ′ 1 and F k ′ 2. Using the branch network of shuffle units in the spatial dimension to k ′ 1 is processed to obtain M s (F k ′ 1) Using the branch network of the shuffle unit in the channel dimension to k ′ 2 After processing, M c (F k ′ 2) M s (F k ′ 1) With F k ′ 1 Multiply point by point to get the final output feature map F of the spatial dimension attention mechanism sk , M c (F k ′ 2) With F k ′ 2 multiply point by point to get the final output feature map F of the channel dimension attention mechanism ck , and then the feature map F sk and F ck Splice to get sub-feature F tk ; Step 3: For all sub-features F tk Polymerization to obtain F a , and use channel shuffle operation to realize information fusion between different sub-features, and obtain the feature map F after shuffle attention mechanism processing ′ ; Step 2: Collect image data containing pedestrian targets and input it into a trained lightweight pedestrian detection model. Use the lightweight pedestrian detection model to judge and predict the image to obtain the location information of the pedestrian targets.

2. The lightweight pedestrian detection method based on the attention mechanism according to claim 1 is characterized in that: A shuffle attention mechanism module is embedded in the ShuffleBolock local network of the lightweight ShuffleNet network to obtain the SA_ShuffleBolck local network, and a repeating unit consisting of the superposition of SA_ShuffleBolck local networks is formed.

3. The lightweight pedestrian detection method based on the attention mechanism according to claim 1 is characterized in that: The final output feature map F ck The acquisition of includes the following steps: First, the global information is obtained by generating a one-dimensional feature vector using global average pooling, where the global average pooling calculation formula is as follows: Among them, s is a one-dimensional feature vector generated by global average pooling, H and W are feature maps F k ′ 2 is the height and width, (i, j) is the feature map F k ′ 2 pixel coordinate value; Secondly, s is processed by a linear function related to parameters W2 and b2 to obtain f c (s), and then use the sigmoid function to adjust f c (s) is processed to obtain M c (F k ′ 2); Finally, M c (F k ′ 2) With F k ′ 2 multiply point by point to get the final output feature map F of the channel dimension attention mechanism ck , the calculation formula is as follows: F ck =M c (F k ′ 2)·F k ′ 2=σ(f c (s))·F k ′ 2=σ(W2s+b2)·F k ′ 2 Among them, W2 and b2 are one-dimensional vectors of the same size as s, which are used to scale and shift the values ​​in s, which are updated during the back-propagation process of model training, and σ is the sigmoid function.

4. The lightweight pedestrian detection method based on the attention mechanism according to claim 3 is characterized in that: The final output feature map F sk The acquisition of includes the following steps: First, group normalization GN is used to obtain F k ′ Spatial statistics for 1: Where t is the two-dimensional feature vector generated by the group normalization GN operation, c g F k ′ 1, (i,j) is the number of channels of F k ′ 1 Feature map F of the mth channel k ′ 1m The pixel coordinate value of Secondly, s is processed by a linear function related to parameters W1 and b1 to obtain f s (s), and then use the sigmoid function to adjust f s (s) is processed to obtain M s (F k ′ 1); Finally, M s (F k ′ 1) With F k ′ 1 Multiply point by point to get the final output feature map F of the spatial dimension attention mechanism sk , the calculation formula is as follows: F sk =M s (F k ′ 1)·F k ′ 1=σ(f s (s))·F k ′ 1=σ(W1·t+b1)·F k ′ 1 Among them, W1 and b1 are two-dimensional vectors of the same size as t, which are used to scale and shift the values ​​in t, and are updated during the back-propagation process of model training.

5. The lightweight pedestrian detection method based on the attention mechanism according to claim 1 is characterized in that: The loss function LOSS is composed of the bounding box regression loss function L box And the confidence loss function L obj Composition, that is: LOSS = L box +L obj .

6. The lightweight pedestrian detection method based on the attention mechanism according to claim 1 is characterized in that: The loss function LOSS is composed of the complete intersection-over-union loss function L IoU And the confidence loss function L obj Composition, namely: LOSS=L IoU +L obj The complete intersection-over-union loss function L IoU The expression is as follows: Among them, b and b gt Represent the center points of the prediction box and the target box respectively, ρ(·)=||bb gt ||2 represents the Euclidean distance between the two center points, c is the diagonal length of the smallest enclosing box containing the prediction box and the target box, and w b ,h b are the width and height of the prediction box, respectively. are the width and height of the target box respectively, and α and v are the intermediate parameters used in calculation.

7. The lightweight pedestrian detection method based on the attention mechanism according to claim 1 is characterized in that: The image data is collected through movable edge hardware, and the trained lightweight pedestrian detection model is deployed on the movable edge hardware.