A high-precision crowd counting method based on point frame
By enhancing processing and feature fusion of high-density crowd images, the FasterNet model and feature fusion module are used to solve the problems of occlusion and blurring of the vision in high-density crowd scenes, and high-precision crowd counting is achieved.
Patent Information
- Application Number
- CN202310656964.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-05
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2043-06-05
AI Technical Summary
The prior art has problems of crowd occlusion and blurred vision portraits in high-density crowd scenarios, resulting in unsatisfactory prediction results.
The high-precision crowd counting method based on the point frame is adopted, and the high-density crowd image is enhanced, and the feature extraction and fusion is used using the FasterNet model, combined with the EVC module, the CSPlayer module and the CBAM module for feature fusion, and finally the crowd counting results are output through the detection head model.
It improves the extraction effect of occlusion and vision blur features in high-density crowd scenes, enhances the accuracy and robustness of prediction, reduces the impact of data labeling noise, and improves the accuracy of image prediction.
Smart Images

Figure CN116758472B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of crowd counting, and in particular to a high-precision crowd counting method based on a point framework. Background Art
[0002] Crowd counting plays an increasingly important role in the field of computer vision. Its primary task is to output the number of individuals in a crowd within an image or video. This technology is widely used in a variety of fields, including shopping mall customer flow statistics, public venue security monitoring, event site management, emergency management, and urban traffic management. With the development of deep learning, many excellent crowd counting models have been proposed, significantly improving the speed and robustness of crowd counting technology. However, most models perform poorly in high-density scenes. Therefore, high-precision crowd counting algorithms for these dense crowds are urgently needed.
[0003] A commonly used high-precision crowd density detection network has achieved good results on multiple datasets. However, because it uses the ResNet50 structure, it has poor prediction effects on crowd occlusion problems and blurred distant portraits in high-density scenes, and cannot accurately restore images. Summary of the Invention
[0004] Therefore, the technical problem to be solved by the present invention is to overcome the problems of crowd occlusion, blurred distant portraits and unsatisfactory prediction results in the existing technology during high-density scene processing.
[0005] To solve the above technical problems, the present invention provides a high-precision crowd counting method based on a point framework, comprising:
[0006] Step 1: Obtain a high-density crowd image and perform enhancement processing on the input high-density crowd image data; input the enhanced image data into the trained high-precision crowd counting model for counting;
[0007] The high-precision crowd counting model includes a FasterNet model, a feature extraction model, and a detection head model; wherein the feature extraction model includes an EVC module, a first CSPlayer module, a second CSPlayer module, and a CBAM module;
[0008] Step 2: Using a FasterNet model with a 4-layer structure to extract features from the enhanced image data; inputting the enhanced image data into the FasterNet model, and using the feature maps extracted from the 4th, 3rd, and 2nd layers of the FasterNet model as inputs for feature fusion;
[0009] Step 3: Input the feature map extracted from the fourth layer into the EVC module for fusion; the fused new features are spliced with the features extracted from the third layer after double upsampling; the spliced features are input into the first CSPlayer module for fusion; the fused new features are spliced with the features extracted from the second layer after double upsampling; the spliced features are input into the second CSPlayer module for fusion; the fused feature map is input into the CBAM module for fusion; the result output by CBAM is the result of feature fusion;
[0010] Step 4: Input the feature-fused data into the detection head model, which outputs the predicted target position of the crowd to be measured in the image, and obtains the result of crowd counting based on the target position.
[0011] In one embodiment of the present invention, the training process for the high-precision crowd counting model includes:
[0012] Get a high-density crowd image training dataset and define the dataset as Tagged Indicates that N is the number of images in the dataset;
[0013] Among them, X i is the i-th high-density crowd image in the dataset, with a size of m×n, P i is the label of the i-th high-density crowd image in the dataset, N′ is P i The number of marked points in (x j ,y j ) represents the horizontal and vertical coordinates of the j-th marker point in the image;
[0014] The high-density crowd images and labels in the training dataset are enhanced; the processed image samples are input into the high-precision crowd counting model to obtain the predicted points and confidence levels of the image samples. The predicted points are matched with the GroundTruth points using the Hungarian algorithm to obtain the matching results. The loss function is defined based on the matching results and confidence levels, and the model is trained until the loss function converges.
[0015] In one embodiment of the present invention, the enhancement processing of the high-density crowd and labels in the training data set includes: reading the high-density crowd image X i After that, the image is randomly scaled with a ratio of 0.7 to 1.3, and then randomly cropped to 128×128 size, and finally horizontally flipped with a probability of 0.5;
[0016] For image label P i Perform point regression, first calculate P iPerform a scaling of 0.7 to 1.3, and then select the P corresponding to the coordinates in the cropped image. i , and finally flipped synchronously with the image.
[0017] In one embodiment of the present invention, the matching of the predicted points with the GroundTruth points using the Hungarian algorithm to obtain the matching results includes:
[0018] The number of predicted points output by the high-precision crowd counting model is M, the number of GroundTruth points is N′, M>N′, and the algorithm is represented by ξ The matching results are:
[0019]
[0020] Among them, P i is the Ground Truth point, is the prediction point, is the predicted point after matching, Indicates the number of matched positive samples, Indicates the number of matched negative samples.
[0021] In one embodiment of the present invention, the loss function of the high-precision crowd counting model includes classification loss, regression loss, and target quantity loss; the classification loss is a weighted CE loss function, the regression loss is a Smooth L1 loss function, and the target quantity loss is a Focal L1 loss function;
[0022] The weighted CE loss function expression is:
[0023]
[0024] The regression loss function expression is:
[0025]
[0026]
[0027] The Focal L1 loss function expression is:
[0028]
[0029] The overall loss function expression is:
[0030] L=λ1L cls +λ2L loc +λ3L num ;
[0031] in, is the confidence of the i-th prediction point, α is the weight of the positive sample, ε>0 is to prevent the non-zero term with the denominator being 0, λ1, λ2, and λ3 are the fusion weight coefficients of the weighted loss function, regression loss function, and target quantity loss function, respectively.
[0032] In one embodiment of the present invention, the EVC module includes two parallel modules: a lightweight MLP and a learnable visual center mechanism, namely LVC; the EVC module reads the output of step 2, connects the result feature maps of the lightweight MLP and LVC modules together along the channel dimension, and uses them as the output of the EVC module.
[0033] In one embodiment of the present invention, the first CSPLayer module includes a BaseConv block, wherein the BaseConv block includes a 1×1 convolutional layer, a BN layer, and a SiLU activation function;
[0034] The second CSPLayer module includes a BaseConv module and several BottleNeck blocks, where BottleNeck includes a BaseConv block and Depthwise Conv; Depthwise Conv includes two BaseConv blocks, where the first BaseConv block groups the number of input feature map channels.
[0035] In one embodiment of the present invention, the CBAM module includes two parts: CAM and SAM; the CAM module includes global average pooling and a fully connected layer. First, the input feature map is pooled in the channel dimension through global average pooling to obtain the global pooling value of each channel, and then the global pooling value is processed through the fully connected layer to obtain the weight vector of each channel; the weight vector is used to weight the channel dimension of the input feature map.
[0036] In one embodiment of the present invention, in the CBAM module, the SAM module includes a compression-excitation operation and a spatial gating operation; the compression-excitation operation uses global average pooling and a fully connected layer to compress the input feature map in the channel dimension to obtain an excitation vector for a channel; the excitation vector is dot-multiplied with the input feature map of the SAM module, and the result is converted into a probability value between 0 and 1 through a sigmoid function to represent the importance of each position; by multiplying the input feature map by the importance, that is, through a spatial gating operation, the feature response of each position is enhanced.
[0037] In one embodiment of the present invention, the detection head model includes a regression detection head and a classification detection head; both the regression detection head and the classification detection head include three 3×3 convolutional layers with a padding of 1 and a ReLU activation function; the output channel of the first convolution is the feature size set in the regression detection head, and the number of output channels of the second convolution layer is also the feature size; in the classification detection head, the number of output channels of the third convolution layer is the number of anchor boxes multiplied by the number of categories; in the regression detection head, the number of output channels of the three convolutional layers is twice the number of anchor boxes.
[0038] The above technical solution of the present invention has the following advantages over the prior art:
[0039] When extracting features from an input image of a high-density crowd, the present invention uses the extraction results of different scales as output, performs feature fusion on the output feature maps of different scales, and uses a centralized feature pyramid structure with attention to extract information from the deep feature layer to adjust the shallow features, thereby achieving a better extraction effect on the features of the mutually occluded parts in the densely populated areas of the image and the blurred features of the portraits in the distance, making the image prediction results more accurate and achieving better results for the prediction of high-density crowds. In addition, the new loss function proposed by the present invention, which combines classification loss, regression loss and target number loss, can effectively reduce the impact of noise in the data annotation process, improve the robustness of the model, and make the image prediction results more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to make the content of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings, wherein
[0041] Figure 1 This is a flow chart of a high-precision crowd counting method provided by an embodiment of the present invention.
[0042] Figure 2 This is a network model diagram of a high-precision crowd counting method provided by an embodiment of the present invention DETAILED DESCRIPTION
[0043] The present invention will be further described below with reference to the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention.
[0044] Reference Figure 1 As shown, a high-precision crowd control technology method provided by an embodiment of the present invention includes the following steps:
[0045] Step 1: Obtain a high-density crowd image and perform enhancement processing on the input high-density crowd image data; input the enhanced image data into the trained high-precision crowd counting model for counting processing;
[0046] The high-precision crowd counting model includes a FasterNet model, a feature extraction model, and a detection head model; wherein the feature extraction model includes an EVC module, a first CSPlayer module, a second CSPlayer module, and a CBAM module;
[0047] Step 2: Using the FasterNet model, extract features from the enhanced image data; input the enhanced image data into the FasterNet model, and use the feature maps extracted from the 4th, 3rd, and 2nd layers of the FasterNet model as inputs for feature fusion;
[0048] Step 3: Input the feature map extracted from the fourth layer into the EVC module for fusion; the fused new features are spliced with the features extracted from the third layer after double upsampling; the spliced features are input into the first CSPlayer module for fusion; the fused new features are spliced with the features extracted from the second layer after double upsampling; the spliced features are input into the second CSPlayer module for fusion; the fused feature map is input into the CBAM module for fusion; the result output by CBAM is the result of feature fusion;
[0049] Step 4: Input the feature-fused data into the detection head model, which outputs the predicted target position of the crowd to be measured in the image, and obtains the result of crowd counting based on the target position.
[0050] Among them, step 1 performs data enhancement on the read image data, including: randomly scaling the image with a ratio of 0.7 to 1.3, then randomly cropping it to a size of 128×128, and finally horizontally flipping the image with a probability of 0.5.
[0051] The FasterNet model used in the feature extraction process has a four-layer structure. Each layer consists of an Embedding layer and a FasterNetBlock, or a Merging layer and a FasterNetBlock. The Embedding layer includes a convolutional layer with a 4×4 kernel and a stride of 4, and a BN layer; the Merging layer includes a convolutional layer with a 2×2 kernel and a stride of 2, and a BN layer. Each FasterNetBlock consists of a PConv layer and two PWConv layers, or two Conv layers with a 1×1 kernel. A BN layer and a Reluctant Unit (RELU) activation function are added between the PWConv or Conv layers.
[0052] When the FasterNet model reads the enhanced image data, it extracts the features of the image and represents the features extracted from each layer of the FasterNet model as X1, X2, X3, and X4 respectively. The features X2, X3, and X4 are used as the output of feature extraction for feature fusion.
[0053] During the feature fusion process, X4 is read into the EVC module and the feature is fused; the fused new feature is spliced with X3 by double upsampling; the spliced feature map is sent to the first CSPLayer module for fusion; the feature map fused in the first CSPLayer module is spliced with X2 by double upsampling, and the spliced feature map is sent to the second CSPLayer module for fusion, and the feature map output by the second CSPLayer module is sent to the CBAM module for fusion.
[0054] Among them, the EVC module includes two parallel modules: lightweight MLP and learnable visual center mechanism, namely LVC; lightweight MLP includes two residual modules: a depth-based convolution module and a channel-based MLP module. The input MLP features are first convolved through the depth-based convolution layer of the depth-based convolution module, and then residual connections are realized through channel scaling and droppath operations; the output of the depth-based convolution module enters the channel-based MLP module as input, first normalized, and then Channels MLP is implemented on the input features, and then channel scaling, droppath and residual connections are implemented in sequence; the input of the channel-based MLP module is the output of the depth-based convolution module; LVC is an encoder with a built-in dictionary, including an inherent codebook and a set of scaling factors; the EVC module reads the output of the feature extraction module, and connects the resulting feature maps of the LightWeight MLP and LVC modules along the channel dimension as the output of the EVC module. The EVC module captures global long-range dependencies and aggregates local key areas. This module not only focuses on the interaction of inter-layer features, but also pays attention to the regularity of intra-layer features and corner areas, which can greatly improve the detection ability of small targets and severely occluded targets.
[0055] The first CSPLayer module consists of a BaseConv block, which includes a 1×1 convolutional layer, a batch normalization layer, and a SiLU activation function. The second CSPLayer model consists of a BaseConv module and several BottleNeck blocks, where BottleNeck includes a BaseConv block and a Depthwise Conv. The DepthwiseConv consists of two BaseConv blocks, where the first BaseConv block groups the number of input feature map channels.
[0056] The CBAM module consists of two parts: CAM and SAM. The CAM module includes global average pooling and a fully connected layer. First, the input feature map is pooled in the channel dimension through global average pooling to obtain the global pooling value of each channel, and then the global pooling value is processed through a fully connected layer to obtain a weight vector for each channel; the weight vector is used to weight the channel dimension of the input feature map to highlight the more important feature channels. The SAM module includes a compression-excitation operation and a spatial gating operation; first, the compression-excitation operation uses global average pooling and a fully connected layer to compress the input feature map in the channel dimension to obtain an excitation vector for a channel; secondly, the excitation vector is point-multiplied with the input feature map of the SAM module, and the result is converted into a probability value between 0 and 1 through the sigmoid function to represent the importance of each position; finally, by multiplying the input feature map by the importance, that is, through a spatial gating operation, the feature response of each position is strengthened. In this way, the CBAM module can simultaneously mine the channel correlation and spatial correlation of feature maps, improve the network's attention to different positions and channels in the image, and improve the model's expressiveness and performance with relatively low computational complexity, ensuring the accuracy of classification, detection, etc.
[0057] By fusing the extracted feature maps of different scales through upsampling, objects of different sizes and shapes can be detected more accurately and robustly. At the same time, the importance of feature maps of different scales is enhanced through the attention mechanism, further improving the counting performance.
[0058] After the aforementioned data augmentation, feature extraction, and feature fusion operations, the final processed results are passed to the detection head model. The detection head model consists of a classification detection head and a regression detection head. The regression detection head is responsible for extracting the confidence level of objects in the feature map, while the classification detection head is used to locate the position of the target in the feature map. After passing through both detection heads, the target's location and confidence level are determined. This result is then passed to the Hungarian matching algorithm to match the predicted points with the ground-truth points. Finally, the network parameters are optimized using the Adam optimizer after using the loss function and backpropagation.
[0059] In the detection head model, both the regression detection head and the classification detection head include three 3×3 convolutional layers with a padding of 1 and a ReLU activation function; the output channel of the first convolution is the feature size set in the regression detection head, and the number of output channels of the second convolution layer is also the feature size; in the classification detection head, the number of output channels of the third convolution layer is the number of anchor boxes multiplied by the number of categories; in the regression detection head, the number of output channels of the three convolutional layers is twice the number of anchor boxes; the output of the detection head is a three-dimensional vector.
[0060] Input the high-density crowd image training dataset to train the high-precision crowd counting model:
[0061] Select a high-density crowd image training dataset and set the training dataset to Tagged Indicates that N is the number of training sets; where X i is the i-th image in the training set, with a size of m×n, P i is the label of the i-th image in the training set, N′ is P i The number of marked points in (x j ,y j ) represents the horizontal and vertical coordinates of the jth marker point in the image.
[0062] Reading in the training image X i Then, the image X is scaled from 0.7 to 1.3. i Perform random scaling, then random cropping to 128×128 size, and finally use a probability of 0.5 for image X i Perform horizontal flip. At the same time, i Perform point regression, first calculate P i Perform a scaling of 0.7 to 1.3, and then select the P corresponding to the coordinates in the cropped image. i , and finally flipped synchronously with the image. Through the corresponding processing of the above image data and image labels, the training accuracy can be improved to a certain extent, and the overfitting phenomenon can be effectively avoided.
[0063] The processed image samples are input into the high-precision crowd counting model to obtain the predicted points and confidence levels of the image samples. The predicted points are matched with the GroundTruth points using the Hungarian algorithm to obtain the matching results. The loss function is defined based on the matching results and confidence levels, and the model is trained until the loss function converges.
[0064] The number of predicted points output by the detection head model is M, and the number of ground truth points is N′, M>N′. The predicted M points are matched with the ground truth points through the Hungarian matching algorithm θ, and the algorithm is represented by ξ. The matching results,
[0065]
[0066] Among them, P i is the Ground Truth point, is the prediction point, is the predicted point after matching, Indicates the number of matched positive samples, Indicates the number of matched negative samples.
[0067] The loss functions used by the high-precision crowd counting model are classification loss, regression loss, and target number loss. The classification loss is the weighted CE loss function, the regression loss is the Smooth L1 loss function, and the target number loss is the Focal L1 loss function.
[0068] The weighted CE loss function expression is:
[0069]
[0070] The regression loss function expression is:
[0071]
[0072]
[0073] The Focal L1 loss function expression is:
[0074]
[0075] The overall loss function expression is:
[0076] L=λ1L cls +λ2L loc +λ3L num ;
[0077] Among them, M is the number of all predicted target points, N′ is the number of Ground Truth points, is the confidence level of the i-th prediction point, α is the weight of the positive sample, ε>0 prevents non-zero terms in the denominator from being zero, and λ1, λ2, and λ3 are the fusion weight coefficients for the classification loss function, regression loss function, and target number loss function, respectively. During the experiment, α was set to 0.5, ε was set to 0.5, and λ1, λ2, and λ3 were set to 1, 0.75, and 0.0001, respectively.
[0078] The trained high-precision crowd counting model was tested using the ShanghaiTech PartA test dataset, and the counting results of the model were compared with those of models such as GauNet on the same test dataset:
[0079] The ShangHaiTech PartA test set data is Tagged 300 is the number of test sets, where X i is the i-th image in the test dataset, with a size of m×n; P i is the label of the i-th image in the training set, M is P i The number of marked points in {x j ,y j} represents the horizontal and vertical coordinates of the jth label.
[0080] The evaluation indicators of the counting results of different models are the grid mean absolute error MAE and the mean square error MSE:
[0081]
[0082]
[0083] Among them, y i is the actual number of target people in the i-th picture, is the number of target people predicted in the i-th picture. N' is the total number of test samples.
[0084] The comparison results are shown in Table 1:
[0085] Table 1 Comparison of target counting results on the ShangHaiTech PartA dataset
[0086]
[0087] As can be seen from Table 1, the counting method used in the present invention achieves better performance in terms of MAE and MSE indicators compared with models such as GauNet, and the crowd counting results are more accurate.
[0088] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0089] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the 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 produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. 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.
[0090] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0091] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0092] Obviously, the above embodiments are merely examples for clarity of explanation and are not intended to limit the implementation methods. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all implementation methods here. Obvious variations or modifications arising therefrom remain within the scope of protection of the present invention.
Claims
1. A high-precision crowd counting method based on point frame, characterized in that: include: Step 1: Obtain a high-density crowd image and perform enhancement processing on the input high-density crowd image data; The enhanced image data is input into the trained high-precision crowd counting model for counting; The high-precision crowd counting model includes a FasterNet model, a feature extraction model, and a detection head model; The feature extraction model includes EVC module, first CSPlayer module, second CSPlayer module and CBAM module; Step 2: Using a FasterNet model with a 4-layer structure to extract features from the enhanced image data; inputting the enhanced image data into the FasterNet model, and using the feature maps extracted from the 4th, 3rd, and 2nd layers of the FasterNet model as inputs for feature fusion; Step 3: Input the feature map extracted from the fourth layer into the EVC module for fusion; the fused new features are spliced with the features extracted from the third layer after double upsampling; the spliced features are input into the first CSPlayer module for fusion; the fused new features are spliced with the features extracted from the second layer after double upsampling; the spliced features are input into the second CSPlayer module for fusion; the fused feature map is input into the CBAM module for fusion; the result output by CBAM is the result of feature fusion; Step 4: Input the feature-fused data into the detection head model, which outputs the predicted target position of the crowd to be measured in the image, and obtains the result of crowd counting based on the target position.
2. The high-precision crowd counting method based on point framework according to claim 1, characterized in that: The training process of the high-precision crowd counting model includes: Get a high-density crowd image training dataset and define the dataset as Tagged Indicates that N is the number of images in the dataset; Among them, X i is the i-th high-density crowd image in the dataset, with a size of m×n, P i is the label of the i-th high-density crowd image in the dataset, N' is P i The number of marked points in (x j ,y j ) represents the horizontal and vertical coordinates of the jth marker point in the image; The high-density crowd images and labels in the training dataset are enhanced; the processed image samples are input into the high-precision crowd counting model to obtain the predicted points and confidence levels of the image samples. The predicted points are matched with the GroundTruth points using the Hungarian algorithm to obtain the matching results. The loss function is defined based on the matching results and confidence levels, and the model is trained until the loss function converges.
3. The high-precision crowd counting method based on point framework according to claim 2, characterized in that: The enhancement process of the high-density crowd and labels in the training data set includes: reading the high-density crowd image X i After that, the image is randomly scaled with a ratio of 0.7 to 1.3, and then randomly cropped to 128×128 size, and finally horizontally flipped with a probability of 0.5; For image label P i Perform point regression, first calculate P i Perform a scaling of 0.7 to 1.3, and then select the P corresponding to the coordinates in the cropped image. i , and finally flipped synchronously with the image.
4. The high-precision crowd counting method based on point framework according to claim 2, characterized in that: The Hungarian algorithm is used to match the predicted points with the GroundTruth points, and the matching results include: The number of predicted points output by the high-precision crowd counting model is M, the number of GroundTruth points is N', M>N', and the algorithm is represented by ξ The matching results are: Among them, P i For GroundTruth points, is the prediction point, is the predicted point after matching, Indicates the number of matched positive samples, Indicates the number of matched negative samples.
5. The high-precision crowd counting system based on point framework according to claim 4, characterized in that: The loss function of the high-precision crowd counting model includes classification loss, regression loss, and target quantity loss; The classification loss is the weighted CE loss function, the regression loss is the SmoothL1 loss function, and the target number loss is the FocalL1 loss function; The weighted CE loss function expression is: The regression loss function expression is: The FocalL1 loss function expression is: The overall loss function expression is: L=λ1L cls +λ2L loc +λ3L num ; in, is the confidence of the i-th prediction point, α is the weight of the positive sample, ε>0 is to prevent the non-zero term with the denominator being 0, λ1, λ2, and λ3 are the fusion weight coefficients of the weighted loss function, regression loss function, and target quantity loss function, respectively.
6. The high-precision crowd counting system based on point framework according to claim 1, characterized in that: The EVC module includes two parallel modules: a lightweight MLP and a learnable visual center mechanism (LVC); the EVC module reads the output of step 2, concatenates the resulting feature maps of the lightweight MLP and LVC modules along the channel dimension, and uses them as the output of the EVC module.
7. The high-precision crowd counting system based on point framework according to claim 1, characterized in that: The first CSPLayer module includes a BaseConv block, wherein the BaseConv block includes a 1×1 convolution layer, a BN layer, and a SiLU activation function; The second CSPLayer module includes a BaseConv module and several BottleNeck blocks, where BottleNeck includes a BaseConv block and DepthwiseConv; DepthwiseConv includes two BaseConv blocks, where the first BaseConv block groups the number of input feature map channels.
8. The high-precision crowd counting method based on point framework according to claim 1, characterized in that: The CBAM module includes two parts: CAM and SAM; the CAM module includes global average pooling and a fully connected layer. First, the input feature map is pooled in the channel dimension through global average pooling to obtain the global pooling value of each channel, and then the global pooling value is processed through the fully connected layer to obtain the weight vector of each channel; the weight vector is used to weight the channel dimension of the input feature map.
9. The high-precision crowd counting method based on point framework according to claim 6, characterized in that: In the CBAM module, the SAM module includes a compression-excitation operation and a spatial gating operation. The compression-excitation operation compresses the input feature map in the channel dimension by using global average pooling and a fully connected layer to obtain an excitation vector for a channel. The excitation vector is dot-multiplied by the input feature map of the SAM module, and the result is converted into a probability value between 0 and 1 through the sigmoid function to represent the importance of each position. The feature response of each position is enhanced by multiplying the input feature map by the importance, that is, through a spatial gating operation.
10. The high-precision crowd counting method based on point framework according to claim 1, characterized in that: The detection head model includes a regression detection head and a classification detection head; both the regression detection head and the classification detection head include three 3×3 convolutional layers with a padding of 1 and a ReLU activation function; the output channel of the first convolution is the featuresize set in the regression detection head, and the number of output channels of the second convolution layer is also the featuresize; in the classification detection head, the number of output channels of the third convolution layer is the number of anchor boxes multiplied by the number of categories; in the regression detection head, the number of output channels of the three convolutional layers is twice the number of anchor boxes.
Citation Information
Patent Citations
Road target detection method based on attention feature enhancement module
CN114419589A
Crowd counting method and system based on improved VGG16 network, and storage medium
CN116071709A