Self-Supervised Crowd Density Statistics Method, Device, Equipment and Medium
Through the self-supervised population density statistics method, using multiple feature extraction operators and self-attention mechanisms, the accuracy and applicability of population density statistics in the existing technology are solved, and efficient and accurate population density statistics are achieved.
Patent Information
- Application Number
- CN202210644973.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-08
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-06-08
AI Technical Summary
The prior art has problems of insufficient accuracy and poor applicability in population density statistics, especially when dealing with targets of different scales and sizes, the identification effect is poor, and it is not effectively compatible with different density classifications.
The population density statistics method based on self-supervised is adopted, and a variety of feature extraction operators such as deformable convolution, dynamic filtered convolution, and hollow convolution are used to combine multiple self-attention mechanisms and AP loss functions to perform population density statistics through attention maps and density maps to improve the model's identification compatibility of targets at different scales and the attention of far-small targets.
The recognition accuracy and applicability of the population density statistics model are improved, the supervision information of the model is enhanced, the rapid convergence of model training is promoted, and more efficient density statistics are achieved.
Smart Images

Figure CN114913482B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data statistics, and more specifically to a self-supervised crowd density statistics method, device, equipment and medium. Background Art
[0002] With the development of society, crowd counting or statistics is a research hotspot and difficulty in the current industrial and academic fields, and it has important application value in real life. There are the following several ways for crowd density statistics currently.
[0003] The first one is to perform feature fusion of information with different receptive fields through dilated convolution and original convolution, as well as feature fusion of information with different receptive fields, and fuse different hierarchical semantic information of feature maps at different resolutions, so as to generate a crowd density map with higher quality. This patent uses a large number of dilated convolutions, which results in loss of continuous information in the picture features, has a great impact on density statistics, and ignores the spatial information that the crowd density is larger near and smaller far away.
[0004] The second one is to use the AlexNet network to divide the crowd picture dataset into two categories: density and sparsity, and send them into the corresponding feature extraction networks according to the differences in the density characteristics of the two types of images. For density images, an attention mechanism method is used for personnel density statistics, and for sparse crowd density, a dilated convolution method is used for personnel density statistics. This patent first needs to analyze the personnel density of the picture to determine whether the personnel density in the picture is sparse or dense, and then perform density analysis on it. This patent cannot directly judge the crowd density and needs to judge its density sparsity and density first before making a judgment, with a bloated network and unable to adapt to different degrees of personnel density classification.
[0005] The third one is a method for crowd density and quantity estimation based on a convolutional neural network. This method only uses a convolutional neural network without using a multi-scale method, and cannot be compatible with the feature information of targets of different scales, with poor model prediction effect and inaccurate recognition results.
[0006] The fourth one is to detect the number of human heads through an object detection network and judge the crowd density according to the number of human heads. This method of judging the crowd density based on object detection of human heads will have missed detection situations for human body occlusion and human head occlusion, and at the same time, the detection recall rate for small dense targets in the distance is low, which will ultimately lead to inaccurate crowd density evaluation.
[0007] Therefore, it is necessary to design a new crowd density statistics method with accurate, efficient and strong applicability. Summary of the Invention
[0008] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a self-supervised crowd density statistics method, device, equipment and medium to achieve accurate and efficient crowd density statistics.
[0009] To achieve the above object, the present invention adopts the following technical solutions:
[0010] In the first aspect, a self-supervised crowd density statistics method includes:
[0011] Obtain image data;
[0012] Process the image data to obtain a sample map;
[0013] Input the sample map into a crowd density statistics model for crowd density statistics to obtain a crowd density map;
[0014] Accumulate and sum according to the crowd density map to obtain the number of people.
[0015] A further technical solution thereof is: when inputting the sample map into a crowd density statistics model for crowd density statistics to obtain a crowd density map, the processing method of the crowd density statistics model includes:
[0016] Input the sample map into deformable convolution and max pooling to obtain a first processed feature;
[0017] Input the sample map into dynamic filtering convolution and max pooling to obtain a second processed feature;
[0018] Input the sample map into vanilla convolution and max pooling to obtain a third processed feature;
[0019] Input the sample map into convertible dilated convolution to obtain a fourth processed feature;
[0020] Concatenate and fuse the first processed feature, the second processed feature, the third processed feature and the fourth processed feature to obtain a first fused feature;
[0021] Input the first fused feature into self-correcting convolution to obtain a corrected feature;
[0022] Input the first fused feature into vanilla convolution and max pooling to obtain a fifth processed feature;
[0023] Input the fifth processed feature into ASPP to obtain a sixth processed feature;
[0024] Input the sixth processed feature into CBAM to obtain a seventh processed feature;
[0025] Input the fifth processed feature into BAM to obtain an eighth processed feature;
[0026] Input the eighth processing feature into the convolutional block and the de-pooling process to obtain the ninth processing feature;
[0027] Concatenate and fuse the correction feature, the seventh processing feature, and the eighth processing feature to obtain the second fusion feature;
[0028] Input the result of multiplying the second fusion feature by the ninth processing feature into the transposed convolution for upsampling to obtain the first upsampled feature;
[0029] Upsample the first upsampled feature through bilinear interpolation to obtain the second upsampled feature;
[0030] Input the second upsampled feature into a 1×1 convolution and combine it with the Sigmoid activation function to obtain the attention map;
[0031] Input the second fusion feature into the CAN to obtain the tenth processing feature;
[0032] Input the tenth processing feature into the deconvolution for upsampling to obtain the third upsampled feature;
[0033] Upsample the third upsampled feature through bilinear interpolation to obtain the density map;
[0034] Combine the attention map with the density map to obtain the crowd density map.
[0035] Its further technical solution is that: the processing of the image data to obtain the sample map includes:
[0036] Segment the image data to obtain the segmented image data;
[0037] Select one frame of picture from the segmented image data as the sample map.
[0038] Its further technical solution is that: the inputting of the sample map into the convertible dilated convolution to obtain the fourth processing feature includes:
[0039] Input the sample map into the global average pooling and 1×1 convolution to obtain the first result;
[0040] Add the first result to the sample map to obtain the second result;
[0041] Input the second result into a 3×3 dilated convolution with a dilation rate of 1 to obtain the third result;
[0042] Input the second result into a 3×3 dilated convolution with a dilation rate of 3 to obtain the fourth result;
[0043] Input the second result into the global pooling and 1×1 convolution to obtain the fifth result;
[0044] Multiply the fifth result by the third result to obtain a sixth result;
[0045] Multiply the fifth result by the fourth result to obtain a seventh result;
[0046] Add the sixth result and the seventh result to obtain an eighth result;
[0047] Input the eighth result into global pooling and 1×1 convolution to obtain a ninth result;
[0048] Add the ninth result and the eighth result to obtain the fourth processed feature.
[0049] A further technical solution thereof is that: the inputting the fifth processed feature into the BAM to obtain the eighth processed feature includes:
[0050] Input the tensor of the fifth processed feature into global pooling through branch one of the BAM and connect two fully connected layers to obtain a branch one processed result;
[0051] Input the tensor of the fifth processed feature into 1×1 convolution processing through branch two of the BAM, then input it into 3×3 dilated convolution and 1×1 convolution to obtain a branch two intermediate processed result;
[0052] Input the result obtained by adding the branch two intermediate processed result and the branch one processed result into the sigmoid activation function to obtain a branch two processed result;
[0053] Multiply the tensor of the fifth processed feature by the branch two processed result through branch three of the BAM to obtain a branch three processed result;
[0054] Add the branch three processed result and the tensor of the fifth processed feature to obtain the eighth processed feature.
[0055] A further technical solution thereof is that: the inputting the eighth processed feature into a convolutional block and anti-pooling processing to obtain a ninth processed feature, and the convolutional block is composed of convolution, Batch Normalization and Relu activation function.
[0056] In a second aspect, a self-supervised crowd density statistical device includes an acquisition unit, a processing unit, a statistical unit and a calculation unit;
[0057] The acquisition unit is used to acquire image data;
[0058] The processing unit is used to process the image data to obtain a sample map;
[0059] The statistical unit is used to input the sample map into a crowd density statistical model for crowd density statistics to obtain a crowd density map;
[0060] The calculation unit is used to accumulate and sum according to the population density map to obtain the number of people.
[0061] Its further technical solution is that: the statistical unit includes a first input module, a second input module, a third input module, a fourth input module, a first fusion module, a fifth input module, a sixth input module, a seventh input module, an eighth input module, a ninth input module, a tenth input module, a second fusion module, a first upsampling module, a second upsampling module, a processing module, an eleventh input module, a third upsampling module, a fourth upsampling module, and a combining module;
[0062] The first input module is used to input the sample map into deformable convolution and max pooling to obtain a first processed feature;
[0063] The second input module is used to input the sample map into dynamic filter convolution and max pooling to obtain a second processed feature;
[0064] The third input module is used to input the sample map into vanilla convolution and max pooling to obtain a third processed feature;
[0065] The fourth input module is used to input the sample map into convertible dilated convolution to obtain a fourth processed feature;
[0066] The first fusion module is used to perform Concate fusion on the first processed feature, the second processed feature, the third processed feature, and the fourth processed feature to obtain a first fusion feature;
[0067] The fifth input module is used to input the first fusion feature into self-correcting convolution to obtain a corrected feature;
[0068] The sixth input module is used to input the first fusion feature into vanilla convolution and max pooling to obtain a fifth processed feature;
[0069] The seventh input module is used to input the fifth processed feature into ASPP to obtain a sixth processed feature;
[0070] The eighth input module is used to input the sixth processed feature into CBAM to obtain a seventh processed feature;
[0071] The ninth input module is used to input the fifth processed feature into BAM to obtain an eighth processed feature;
[0072] The tenth input module is used to input the eighth processed feature into a convolutional block and anti-pooling processing to obtain a ninth processed feature;
[0073] The second fusion module is used to perform Concate fusion on the corrected feature, the seventh processed feature, and the eighth processed feature to obtain a second fusion feature;
[0074] The first upsampling module is used to input the result of multiplying the second fusion feature and the ninth processed feature into a transposed convolution for upsampling to obtain a first upsampled feature;
[0075] The second upsampling module is used to upsample the first upsampled feature through bilinear interpolation to obtain a second upsampled feature;
[0076] The processing module is used to input the second upsampled feature into a 1×1 convolution and combine it with a Sigmoid activation function to obtain an attention map;
[0077] The eleventh input module is used to input the second fusion feature into a CAN to obtain a tenth processed feature;
[0078] The third upsampling module is used to input the tenth processed feature into a deconvolution for upsampling to obtain a third upsampled feature;
[0079] The fourth upsampling module is used to upsample the third upsampled feature through bilinear interpolation to obtain a density map;
[0080] The combining module is used to combine the attention map and the density map to obtain a crowd density map.
[0081] In a third aspect, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the self-supervised crowd density statistics method as described above are implemented.
[0082] In a fourth aspect, a computer-readable storage medium is characterized in that the storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to execute the steps of the self-supervised crowd density statistics method as described above.
[0083] The beneficial effects of the present invention compared with the prior art are as follows: The present invention processes the acquired image data to obtain a sample image, and then inputs the sample image into a crowd density statistical model for crowd density statistics to obtain a crowd density map, and sums up the crowd density map to obtain the number of people. The crowd density statistical model of the present invention extracts features from images based on various feature extraction operators such as deformable convolution, dynamic filtering convolution, and dilated convolution, which increases the extraction of image information by the crowd density statistical model and can better extract image features. A variety of self-attention mechanisms combined with the AP loss function not only improve the recognition compatibility of the model for targets of different scales and sizes in the picture, but also strengthen the attention to far targets and small targets, improving the accuracy of model recognition and having strong applicability. Based on the attention map and density map for crowd density statistics, the model supervision information is increased, which better accelerates the convergence of model training and improves the accuracy of the model.
[0084] The above description is only an overview of the technical solution of the present invention. In order to be able to understand the technical means of the present invention more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following preferred embodiments are specifically described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0086] Figure 1 Schematic diagram of the application scenario of the self-supervised crowd density statistical method provided for the specific embodiment of the present invention;
[0087] Figure 2 Flowchart of the self-supervised crowd density statistical method provided for the specific embodiment of the present invention;
[0088] Figure 3 Schematic block diagram of the self-supervised crowd density statistical device provided for the specific embodiment of the present invention;
[0089] Figure 4 Schematic block diagram of a computer device provided for the specific embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0090] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0091] It should be understood that when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0092] It should also be understood that the terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0093] It should be further understood that the term " / and / " used in the specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0094] Please refer to Figure 1 and Figure 2 , Figure 1 which is a schematic diagram of the application scenario of the self-supervised crowd density statistics method provided by the embodiment of the present invention; Figure 2 which is a flowchart of the self-supervised crowd density statistics method provided by a specific embodiment of the present invention. The self-supervised crowd density statistics method is applied to a server and is executed by an application software installed in the server.
[0095] As Figure 1 shown, the self-supervised crowd density statistics method includes the following steps S10-S40.
[0096] S10. Obtain image data.
[0097] In this embodiment, video data (i.e., image data) of the crowd in the subway carriage is collected through a monitoring device in the subway carriage. The monitoring device can be a common one on the market, and the present application does not make any limitations in this regard. In order to collect the video data of each carriage, monitoring devices can be installed in each carriage, and the video data collected by the monitoring devices installed in each carriage can be aggregated into the subway data background through wired or wireless means. The video data situation of each carriage can be queried by accessing the data background.
[0098] S20. Process the image data to obtain a sample image.
[0099] In one embodiment, step S20 specifically includes the following steps: S201 - S202.
[0100] S201. Segment the image data to obtain segmented image data.
[0101] In this embodiment, since the subway needs to stop at different stations, the boarding and alighting situations of each carriage basically change after each stop at each station. Therefore, the image data can be segmented in the way of each carriage corresponding to each station, and the segmented image data corresponding to each carriage at each station can be obtained.
[0102] S202. Select a frame of picture from the segmented image data as the sample image.
[0103] In this embodiment, since the segmented image data includes multiple frames of pictures, a frame of picture can be selected from the segmented image data as the sample image I image Perform the statistics of the crowd density.
[0104] S30. Input the sample image into the crowd density statistical model to perform the crowd density statistics to obtain a crowd density map.
[0105] In one embodiment, for step S30, the processing method of the crowd density statistical model includes the following steps: S301 - S319.
[0106] S301. Input the sample image into deformable convolution and max pooling to obtain a first processed feature.
[0107] In this embodiment, input the sample image I image into deformable convolution (Deformable Convolution) and max pooling for processing to obtain the feature F dcm1 .
[0108] Deformable convolution is a concept relative to standard convolution. In standard convolution operations, the region of action of the convolution kernel is always within a rectangular region of the standard convolution kernel size around the center point, while deformable convolution can be an irregular region.
[0109] Using deformable convolution can improve the performance of sample image detection and segmentation. With only a small increase in computational complexity, performance improvement can be achieved.
[0110] S302. Input the sample image into dynamic filtering convolution and max pooling to obtain a second processed feature.
[0111] In this embodiment, input the sample image Iimage Input it into dynamic convolution and max pooling for processing to obtain feature F dcm2 。
[0112] S303. Input the sample image into vanilla convolution and max pooling to obtain the third processed feature.
[0113] In this embodiment, input the sample image I image Input it into vanilla convolution (Vanilla Convolution) and max pooling for processing to obtain feature F vm 。
[0114] S304. Input the sample image into switchable atrous convolution to obtain the fourth processed feature.
[0115] In this embodiment, input the sample image I image Input it into switchable atrous convolution (SwitchableAtrousConvolution) for processing to obtain feature F sacm 。
[0116] In one embodiment, step S304 specifically includes the following steps: S3041 - S3050.
[0117] S3041. Input the sample image into global average pooling and 1×1 convolution to obtain the first result.
[0118] In this embodiment, input the sample image I image Input it into global average pooling and 1×1 convolution for processing to obtain the first result.
[0119] S3042. Add the first result to the sample image to obtain the second result.
[0120] In this embodiment, add the first result to the sample image I image Perform an addition operation to obtain feature F igc 。
[0121] S3043. Input the second result into a 3×3 atrous convolution with an atrous rate of 1 to obtain the third result.
[0122] In this embodiment, input the obtained feature F igc Input it into a 3×3 atrous convolution with an atrous rate of 1 for processing to obtain feature F ac1 。
[0123] S3044. Input the second result into a 3×3 atrous convolution with an atrous rate of 3 to obtain the fourth result.
[0124] In this embodiment, the obtained feature F ac1 is input into a dilated convolution with a dilation rate of 3 and a size of 3×3 for processing to obtain feature F ac2 .
[0125] S3045. Input the second result into global pooling and a 1×1 convolution to obtain a fifth result.
[0126] In this embodiment, the obtained feature F ac1 is input into global pooling and a 1×1 convolution for processing to obtain feature F apc .
[0127] S3046. Multiply the fifth result by the third result to obtain a sixth result.
[0128] In this embodiment, multiply feature F apc by feature F ac1 to obtain feature F mac1 .
[0129] S3047. Multiply the fifth result by the fourth result to obtain a seventh result.
[0130] In this embodiment, multiply feature F apc by feature F ac2 to obtain feature F mac2 .
[0131] S3048. Add the sixth result and the seventh result to obtain an eighth result.
[0132] In this embodiment, add feature F mac1 and feature F mac2 to obtain feature F mac12 .
[0133] S3049. Input the eighth result into global pooling and a 1×1 convolution to obtain a ninth result.
[0134] In this embodiment, the obtained feature F mac12 is processed through global pooling and a 1×1 convolution to obtain feature F igc2 .
[0135] S3050. Add the ninth result and the eighth result to obtain a fourth processed feature.
[0136] In this embodiment, add feature F igc2 and feature F mac12 to obtain feature F sacm .
[0137] S305. Concatenate and fuse the first processing feature, the second processing feature, the third processing feature, and the fourth processing feature to obtain a first fused feature.
[0138] In this embodiment, feature F dcm1 , feature F dcm2 , feature F vm , and feature F sacm are concatenated and fused to obtain a new feature F fusion .
[0139] S306. Input the first fused feature into a self-correcting convolution to obtain a corrected feature.
[0140] In this embodiment, feature F fusion is input into a self-correcting convolution (Self-Calibrated Convolution) for processing to obtain feature F scc .
[0141] S307. Input the first fused feature into a vanilla convolution and max pooling to obtain a fifth processing feature.
[0142] In this embodiment, feature F fusion is input into a vanilla convolution (Vanilla Convolution) and max pooling for processing to obtain feature F cp .
[0143] S308. Input the fifth processing feature into ASPP to obtain a sixth processing feature.
[0144] In this embodiment, F cp feature is input into ASPP (Atrous Spatial Pyramid Pooling) for processing to obtain feature F aspp .
[0145] S309. Input the sixth processing feature into CBAM to obtain a seventh processing feature.
[0146] In this embodiment, feature F aspp is input into CBAM (Convolution Block Attention Module) for processing to obtain feature F CBAM .
[0147] S310. Input the fifth processing feature into BAM to obtain an eighth processing feature.
[0148] In this embodiment, feature F cpInput is processed by BAM (Bottleneck Attention Module) to obtain feature F BAM Processing with the BAM mechanism can greatly reduce the computational overhead.
[0149] In one embodiment, step S310 specifically includes the following steps: S3101 - S3105.
[0150] S3101. Input the tensor of the fifth processed feature into global pooling through branch one of BAM and connect two fully - connected layers to obtain the branch - one processing result.
[0151] In this embodiment, the BAM mechanism has three branches, namely branch one, branch two, and branch three.
[0152] Branch one passes the input feature F cp tensor Input tensor into global pooling and connects two fully - connected layers to obtain feature F channelattentation whose size is R channelattentation channel×1×1 cp .
[0153] S3102. Input the tensor of the fifth processed feature into 1×1 convolution through branch two of BAM, then input it into 3×3 dilated convolution and 1×1 convolution to obtain the intermediate processing result of branch two.
[0154] In this embodiment, branch two processes the input feature F cp tensor Input tensor through 1×1 convolution and then inputs it into 3×3 dilated convolution and 1×1 convolution for processing to obtain feature F cdc .
[0155] S3103. Input the result obtained by adding the intermediate processing result of branch two and the processing result of branch one into the sigmoid activation function to obtain the processing result of branch two.
[0156] In this embodiment, the result obtained by adding the obtained feature F cdc and F channelattentation is input into the sigmoid activation function for processing to obtain feature F add - sigmoid.
[0157] S3104. Multiply the tensor of the fifth processed feature by the processing result of branch two through branch three of BAM to obtain the processing result of branch three.
[0158] In this embodiment, branch three multiplies the input feature F cp tensor Inputtensor Multiply by F add -sigmoid to obtain the processing result of Branch 3.
[0159] S3105. Add the processing result of Branch 3 to the tensor of the fifth processing feature to obtain the eighth processing feature.
[0160] In this embodiment, the processing result of Branch 3 and the feature F cp tensor Input tensor to obtain the feature F BAM .
[0161] S311. Input the eighth processing feature into a convolutional block and an anti-pooling process to obtain the ninth processing feature.
[0162] In this embodiment, the obtained feature F BAM is passed through a convolutional block and an anti-pooling process to obtain the feature F cb1 .
[0163] In this embodiment, the convolutional block consists of convolution, Batch Normalization, and the Relu activation function.
[0164] S312. Concatenate and fuse the corrected feature, the seventh processing feature, and the eighth processing feature to obtain the second fused feature.
[0165] In this embodiment, the obtained feature F scc , the feature F CBAM , and the feature F BAM are concatenated to obtain the feature F bf .
[0166] S313. Input the result of multiplying the second fused feature by the ninth processing feature into a transposed convolution for upsampling to obtain the first upsampled feature.
[0167] In this embodiment, the result of multiplying the feature F bf by the feature F cb1 is input into a transposed convolution (TransposedConvolution) for upsampling to obtain the feature F up-tc .
[0168] S314. Upsample the first upsampled feature through bilinear interpolation to obtain the second upsampled feature.
[0169] In this embodiment, the obtained F up-tc is upsampled through bilinear interpolation to obtain the feature F up-bu1 .
[0170] S315. Input the second upsampled feature into a 1×1 convolution and combine it with the Sigmoid activation function to obtain an attention map.
[0171] In this embodiment, special F up-bu1 After being input into a 1×1 convolution and combined with the Sigmoid activation function, an attention map AttentionMap is obtained.
[0172] S316. Input the second fused feature into the CAN to obtain the tenth processed feature.
[0173] In this embodiment, the feature F bf is input into the CAN (Context-Aware Network) module to obtain the feature F bf-can .
[0174] S317. Input the tenth processed feature into a deconvolution for upsampling to obtain the third upsampled feature.
[0175] In this embodiment, the feature F bf-can is input into the deconvolution module (Deconvolution) for upsampling to obtain the feature F dc .
[0176] S318. Upsample the third upsampled feature through bilinear interpolation to obtain a density map.
[0177] In this embodiment, the obtained feature F dc is upsampled through bilinear interpolation to obtain the density map Density Map.
[0178] S319. Combine the attention map with the density map to obtain a crowd density map.
[0179] In this embodiment, the attention map Attention Map and the density map Density Map are combined to obtain the final crowd density map Crowd DensityMap.
[0180] Based on the attention map and the density map for crowd density statistics, the model supervision information is increased, thereby better accelerating the convergence of model training and improving the accuracy of the model.
[0181] In addition, the loss function used by the crowd density statistical model is the APLoss function, and this loss function is as follows:
[0182]
[0183]
[0184] This calculation method divides the real density map into 2×2 sub-networks and checks whether the population density of each sub-network is lower than the threshold T. If not, it continues to divide it into 2×2 sub-networks recursively until it ensures that the population density of each sub-network is less than the threshold T. In the formula, the predicted density map is the real density map n is 5, and finally the respective local losses are added to obtain the loss function L APLoss .
[0185] The evaluation functions for the model are the MAE evaluation function and the RMSE evaluation function respectively.
[0186]
[0187]
[0188] C i and respectively represent the real number of people, indicating the predicted number of people.
[0189] S40. Calculate the number of people by accumulating and summing the population density map.
[0190] In this embodiment, the probability density of each pixel on the population density map is accumulated and summed and then rounded to obtain the predicted value of the number of people in the picture.
[0191] The present invention performs feature extraction on images based on various feature extraction operators such as deformable convolution, dynamic filtering convolution, and dilated convolution, which increases the extraction of image information by the population density statistical model and can better extract image features.
[0192] In addition, multiple self-attention mechanisms combined with the AP loss function not only improve the recognition compatibility of the model for targets of different scales in the picture, but also strengthen the attention to far targets and small targets, improving the recognition accuracy of the model and having strong applicability.
[0193] Figure 3 is a schematic block diagram of the self-supervised population density statistical device 100 provided by an embodiment of the present invention. Corresponding to the above self-supervised population density statistical method, a specific embodiment of the present invention also provides a self-supervised population density statistical device 100. The self-supervised population density statistical device 100 includes units and modules for executing the above self-supervised population density statistical method, and the device can be configured in a server.
[0194] Such as Figure 3As shown in the figure, the self-supervised crowd density statistical device 100 includes an acquisition unit 110, a processing unit 120, a statistical unit 130, and a calculation unit 140.
[0195] The acquisition unit 110 is used to acquire image data.
[0196] In this embodiment, the video data (i.e., image data) of the crowd in the subway car is collected through the monitoring device in the subway car. Any common monitoring device on the market can be used, and the present application does not limit this. In order to collect the video data of each car, monitoring devices can be installed in each car. The video data collected by the monitoring devices installed in each car can be aggregated in the subway data background through wired or wireless means. The video data situation of each car can be queried through the data background.
[0197] The processing unit 120 is used to process the image data to obtain a sample image.
[0198] In one embodiment, the processing unit 120 includes a segmentation module and a selection module.
[0199] The segmentation module is used to segment the image data to obtain segmented image data.
[0200] In this embodiment, since the subway needs to stop at different stations, the situation of people getting on or off after each car stops at each station will basically change. Therefore, the image data can be segmented in the way of each car corresponding to each station, and the segmented image data of each car corresponding to each station can be obtained.
[0201] The selection module is used to select a frame of picture from the segmented image data as a sample image.
[0202] In this embodiment, since the segmented image data includes multiple frames of pictures, a frame of picture can be selected from the segmented image data as a sample image I image Perform the statistics of the crowd density.
[0203] The statistical unit 130 is used to input the sample image into the crowd density statistical model to perform crowd density statistics to obtain a crowd density map.
[0204] In one embodiment, the statistical unit 130 includes a first input module, a second input module, a third input module, a fourth input module, a first fusion module, a fifth input module, a sixth input module, a seventh input module, an eighth input module, a ninth input module, a tenth input module, a second fusion module, a first upsampling module, a second upsampling module, a processing module, an eleventh input module, a third upsampling module, a fourth upsampling module, and a combination module.
[0205] The first input module is used to input the sample graph into deformable convolution and max pooling to obtain the first processed feature.
[0206] In this embodiment, the sample graph I image is input into deformable convolution (Deformable Convolution) and max pooling for processing to obtain the feature F dcm1 .
[0207] Deformable convolution is a concept relative to standard convolution. In standard convolution operations, the area where the convolution kernel acts is always within a rectangular area of the standard convolution kernel size around the center point, while deformable convolution can be an irregular area.
[0208] Using deformable convolution can improve the performance in detecting and segmenting sample graphs. With only a small increase in computational complexity, performance can be improved.
[0209] The second input module is used to input the sample graph into dynamic filtering convolution and max pooling to obtain the second processed feature.
[0210] In this embodiment, the sample graph I image is input into dynamic filtering convolution (Dynamic Convolution) and max pooling for processing to obtain the feature F dcm2 .
[0211] The third input module is used to input the sample graph into vanilla convolution and max pooling to obtain the third processed feature.
[0212] In this embodiment, the sample graph I image is input into vanilla convolution (Vanilla Convolution) and max pooling for processing to obtain the feature F vm .
[0213] The fourth input module is used to input the sample graph into switchable atrous convolution to obtain the fourth processed feature.
[0214] In this embodiment, the sample graph I image is input into switchable atrous convolution (SwitchableAtrousConvolution) for processing to obtain the feature F sacm .
[0215] In one embodiment, the fourth input module includes a first input sub-module, a first operation sub-module, a second input sub-module, a third input sub-module, a fourth input sub-module, a second operation sub-module, a third operation sub-module, a fourth operation sub-module, a fifth input sub-module, and a fifth operation sub-module.
[0216] The first input sub-module is used to input a sample graph into global average pooling and 1×1 convolution to obtain a first result.
[0217] In this embodiment, the sample graph I image is input into global average pooling and 1×1 convolution for processing to obtain a first result.
[0218] The first operator sub-module adds the first result to the sample graph to obtain a second result.
[0219] In this embodiment, the first result is added to the sample graph I image to perform an addition operation to obtain the feature F igc .
[0220] The second input sub-module is used to input the second result into a 3×3 dilated convolution with a dilation rate of 1 to obtain a third result.
[0221] In this embodiment, the obtained feature F igc is input into a 3×3 dilated convolution with a dilation rate of 1 for processing to obtain the feature F ac1 .
[0222] The third input sub-module is used to input the second result into a 3×3 dilated convolution with a dilation rate of 3 to obtain a fourth result.
[0223] In this embodiment, the obtained feature F ac1 is input into a 3×3 dilated convolution with a dilation rate of 3 for processing to obtain the feature F ac2 .
[0224] The fourth input sub-module is used to input the second result into global pooling and 1×1 convolution to obtain a fifth result.
[0225] In this embodiment, the obtained feature F ac1 is input into global pooling and 1×1 convolution for processing to obtain the feature F apc .
[0226] The second operator sub-module is used to multiply the fifth result by the third result to obtain a sixth result.
[0227] In this embodiment, the feature F apc is multiplied by the feature F ac1 to obtain the feature F mac1 .
[0228] The third operator sub-module is used to multiply the fifth result by the fourth result to obtain a seventh result.
[0229] In this embodiment, the feature F apc is multiplied by the feature F ac2Multiply to obtain feature F mac2 .
[0230] The fourth operator module is used to add the sixth result and the seventh result to obtain the eighth result.
[0231] In this embodiment, feature F mac1 and feature F mac2 are added to obtain feature F mac12 .
[0232] The fifth input sub-module is used to input the eighth result into global pooling and 1×1 convolution to obtain the ninth result.
[0233] In this embodiment, the obtained feature F mac12 is processed through global pooling and 1×1 convolution to obtain feature F igc2 .
[0234] The fifth operator module is used to add the ninth result and the eighth result to obtain the fourth processed feature.
[0235] In this embodiment, feature F igc2 and feature F mac12 are added to obtain feature F sacm .
[0236] The first fusion module is used to perform Concate fusion on the first processed feature, the second processed feature, the third processed feature, and the fourth processed feature to obtain the first fusion feature.
[0237] In this embodiment, feature F dcm1 , feature F dcm2 , feature F vm , and feature F sacm are subjected to Concate fusion to obtain the new feature F fusion .
[0238] The fifth input module is used to input the first fusion feature into self-correcting convolution to obtain the corrected feature.
[0239] In this embodiment, feature F fusion is input into self-correcting convolution (Self-Calibrated Convolution) for processing to obtain feature F scc .
[0240] The sixth input module is used to input the first fusion feature into vanilla convolution and max pooling to obtain the fifth processed feature.
[0241] In this embodiment, feature F fusionInput is processed by vanilla convolution and max pooling to obtain feature F cp 。
[0242] The seventh input module is used to input the fifth processed feature into ASPP to obtain the sixth processed feature.
[0243] In this embodiment, F cp The feature is input into ASPP (Atrous Spatial Pyramid Pooling) for processing to obtain feature F aspp 。
[0244] The eighth input module is used to input the sixth processed feature into CBAM to obtain the seventh processed feature.
[0245] In this embodiment, the feature F aspp is input into CBAM (Convolution Block Attention Module) for processing to obtain feature F CBAM 。
[0246] The ninth input module is used to input the fifth processed feature into BAM to obtain the eighth processed feature.
[0247] In this embodiment, the feature F cp is input into BAM (Bottleneck Attention Module) for processing to obtain feature F BAM 。Processing using the BAM mechanism can greatly reduce the computational overhead.
[0248] In one embodiment, the ninth input module includes a sixth input sub-module, a seventh input sub-module, an eighth input sub-module, a sixth operation sub-module, and a seventh operation sub-module.
[0249] The sixth input sub-module is used to input the tensor of the fifth processed feature into global pooling through branch one of BAM and connect two fully connected layers to obtain the branch one processing result.
[0250] In this embodiment, the BAM mechanism has three branches, namely branch one, branch two, and branch up.
[0251] Branch one passes the tensor Input cp of the input feature F tensor into global pooling and connects two fully connected layers to obtain feature F channelattentation , and the size of this feature F channelattentation is R channel×1×1 。
[0252] The seventh input sub-module is used to input the tensor of the fifth processing feature into the second branch of the BAM, perform 1×1 convolution processing, and then input it into 3×3 dilated convolution and 1×1 convolution to obtain the intermediate processing result of the second branch.
[0253] In this embodiment, the second branch inputs the feature F cp tensor Input tensor After 1×1 convolution processing, it is then input into 3×3 dilated convolution and 1×1 convolution for processing to obtain the feature F cdc .
[0254] The eighth input sub-module is used to input the result obtained by adding the intermediate processing result of the second branch and the processing result of the first branch into the sigmoid activation function to obtain the processing result of the second branch.
[0255] In this embodiment, the obtained feature F cdc and F channelattentation The added result is input into the sigmoid activation function for processing to obtain the feature F add-sigmoid .
[0256] The sixth operator sub-module is used to multiply the tensor of the fifth processing feature by the processing result of the second branch through the third branch of the BAM to obtain the processing result of the third branch.
[0257] In this embodiment, the third branch inputs the feature F cp tensor Input tensor Multiply by F add-sigmoid to obtain the processing result of the third branch.
[0258] The seventh operator sub-module is used to add the processing result of the third branch and the tensor of the fifth processing feature to obtain the eighth processing feature.
[0259] In this example embodiment, the processing result of the third branch and the feature F cp tensor Input tensor to obtain the feature F BAM .
[0260] The tenth input module is used to input the eighth processing feature into the convolutional block and perform anti-pooling processing to obtain the ninth processing feature.
[0261] In this embodiment, the obtained feature F BAM Through the convolutional block and anti-pooling processing, the feature F cb1 is obtained.
[0262] In this embodiment, the convolutional block is composed of convolution, BatchNormalization, and the Relu activation function.
[0263] The second fusion module is used to perform Concate fusion on the corrected feature, the seventh processed feature, and the eighth processed feature to obtain the second fusion feature.
[0264] In this embodiment, the obtained feature F scc , feature F CBAM , and feature F BAM are Concated to obtain feature F bf .
[0265] The first upsampling module is used to input the result of multiplying the second fusion feature by the ninth processed feature into a transposed convolution for upsampling to obtain the first upsampled feature.
[0266] In this embodiment, the result of multiplying feature F bf by feature F cb1 is input into a transposed convolution (TransposedConvolution) for upsampling to obtain feature F up-tc .
[0267] The second upsampling module is used to upsample the first upsampled feature through bilinear interpolation to obtain the second upsampled feature.
[0268] In this embodiment, the obtained F up-tc is upsampled through bilinear interpolation to obtain feature F up-bu1 .
[0269] The processing module is used to input the second upsampled feature into a 1×1 convolution and combine it with a Sigmoid activation function to obtain an attention map.
[0270] In this embodiment, the special F up-bu1 is input into a 1×1 convolution and processed in combination with a Sigmoid activation function to obtain the attention map AttentionMap.
[0271] The eleventh input module is used to input the second fusion feature into CAN to obtain the tenth processed feature.
[0272] In this embodiment, the feature F bf is input into the CAN (Context-Aware Network) module to obtain feature F bf-can .
[0273] The third upsampling module is used to input the tenth processed feature into a deconvolution for upsampling to obtain the third upsampled feature.
[0274] In this embodiment, the feature F bf-can is input into a deconvolution module (Deconvolution) for upsampling to obtain feature Fdc .
[0275] The fourth upsampling module is used to upsample the third upsampling feature through bilinear interpolation to obtain a density map.
[0276] In this embodiment, the obtained feature F dc is upsampled through bilinear interpolation to obtain a density map DensityMap.
[0277] The combination module is used to combine the attention map and the density map to obtain a crowd density map.
[0278] In this embodiment, the attention map AttentionMap and the density map DensityMap are combined to obtain the final crowd density map CrowdDensityMap.
[0279] Performing crowd density statistics based on the attention map and the density map increases the model supervision information, thus better accelerating the convergence of model training and improving the accuracy of the model.
[0280] In addition, the loss function used by the crowd density statistical model is the loss function of APLoss, and this loss function is as follows:
[0281]
[0282]
[0283] This calculation method divides the real density map into 2×2 sub-networks to see the crowd density of each sub-network If it is not lower than the threshold T, it will continue to be divided into 2×2 sub-networks recursively until it is ensured that the crowd density of each sub-network is less than the threshold T. In the formula, the predicted density map is the real density map n is 5, and finally the respective local losses are added to obtain the loss function L APLoss .
[0284] The evaluation functions for the model are the MAE evaluation function and the RMSE evaluation function respectively.
[0285]
[0286]
[0287] C i and respectively represent the real number of people, represents the predicted number of people.
[0288] The calculation unit 140 is configured to accumulate and sum up the number of people according to the crowd density map.
[0289] In this embodiment, the probability density of each pixel on the crowd density map is accumulated and summed up and then rounded to obtain the predicted value of the number of people in the picture.
[0290] The present invention extracts features from images based on various feature extraction operators such as deformable convolution, dynamic filtering convolution, and dilated convolution, which increases the extraction of image information by the crowd density statistical model and can better extract image features.
[0291] In addition, a variety of self-attention mechanisms combined with the AP loss function not only improve the recognition compatibility of the model for targets of different scales in the picture, but also strengthen the attention to far targets and small targets, improving the accuracy of model recognition and having strong applicability.
[0292] The above self-supervised crowd density statistical device can be implemented in the form of a computer program, and this computer program can run on a computer device as Figure 4 shown.
[0293] Please refer to Figure 4 , Figure 4 which is a schematic block diagram of a computer device provided by an embodiment of the present application. The computer device 500 can be a server. Among them, the server can be an independent server or a server cluster composed of multiple servers.
[0294] As Figure 4 shown, the computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the above self-supervised crowd density statistical method.
[0295] The computer device 700 can be a terminal or a server. The computer device 700 includes a processor 720, a memory, and a network interface 750 connected through a system bus 710. Among them, the memory can include a non-volatile storage medium 730 and an internal memory 740.
[0296] The non-volatile storage medium 730 can store an operating system 731 and a computer program 732. When the computer program 732 is executed, it can cause the processor 720 to execute any self-supervised crowd density statistical method.
[0297] The processor 720 is used to provide computing and control capabilities to support the operation of the entire computer device 700.
[0298] The internal memory 740 provides an environment for the operation of the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can be caused to execute any self-supervised crowd density statistical method.
[0299] The network interface 750 is used for network communication, such as sending assigned tasks, etc. Those skilled in the art can understand that Figure 4 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device 700 to which the solution of this application is applied. Specifically, the computer device 700 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. Among them, the processor 720 is used to run the program code stored in the memory to implement the following steps:
[0300] Obtain image data;
[0301] Process the image data to obtain a sample map;
[0302] Input the sample map into the crowd density statistical model for crowd density statistics to obtain a crowd density map;
[0303] Accumulate and sum according to the crowd density map to obtain the number of people.
[0304] Among them, the inputting the sample map into the crowd density statistical model for crowd density statistics to obtain a crowd density map, the processing method of the crowd density statistical model includes:
[0305] Input the sample map into deformable convolution and max pooling to obtain a first processing feature;
[0306] Input the sample map into dynamic filter convolution and max pooling to obtain a second processing feature;
[0307] Input the sample map into vanilla convolution and max pooling to obtain a third processing feature;
[0308] Input the sample map into convertible dilated convolution to obtain a fourth processing feature;
[0309] Concatenate and fuse the first processing feature, the second processing feature, the third processing feature and the fourth processing feature to obtain a first fusion feature;
[0310] Input the first fusion feature into the self-correcting convolution to obtain a corrected feature;
[0311] Input the first fusion feature into vanilla convolution and max pooling to obtain a fifth processing feature;
[0312] Input the fifth processing feature into ASPP to obtain the sixth processing feature;
[0313] Input the sixth processing feature into CBAM to obtain the seventh processing feature;
[0314] Input the fifth processing feature into BAM to obtain the eighth processing feature;
[0315] Input the eighth processing feature into a convolutional block and an anti-pooling process to obtain the ninth processing feature;
[0316] Concatenate and fuse the corrected feature, the seventh processing feature, and the eighth processing feature to obtain the second fused feature;
[0317] Input the result of multiplying the second fused feature by the ninth processing feature into a transposed convolution for upsampling to obtain the first upsampled feature;
[0318] Upsample the first upsampled feature through bilinear interpolation to obtain the second upsampled feature;
[0319] Input the second upsampled feature into a 1×1 convolution and combine it with a Sigmoid activation function to obtain an attention map;
[0320] Input the second fused feature into CAN to obtain the tenth processing feature;
[0321] Input the tenth processing feature into a deconvolution for upsampling to obtain the third upsampled feature;
[0322] Upsample the third upsampled feature through bilinear interpolation to obtain a density map;
[0323] Combine the attention map with the density map to obtain a crowd density map.
[0324] Among them, the processing of the image data to obtain a sample map includes:
[0325] Segment the image data to obtain segmented image data;
[0326] Select one frame of picture from the segmented image data as the sample map.
[0327] Among them, the input of the sample map into a convertible dilated convolution to obtain the fourth processing feature includes:
[0328] Input the sample map into global average pooling and a 1×1 convolution to obtain a first result;
[0329] Add the first result to the sample map to obtain a second result;
[0330] Input the second result into a dilated convolution with a dilation rate of 1 and a kernel size of 3×3 to obtain a third result;
[0331] Input the second result into a dilated convolution with a dilation rate of 3 and a kernel size of 3×3 to obtain a fourth result;
[0332] Input the second result into global pooling and a 1×1 convolution to obtain a fifth result;
[0333] Multiply the fifth result by the third result to obtain a sixth result;
[0334] Multiply the fifth result by the fourth result to obtain a seventh result;
[0335] Add the sixth result and the seventh result to obtain an eighth result;
[0336] Input the eighth result into global pooling and a 1×1 convolution to obtain a ninth result;
[0337] Add the ninth result and the eighth result to obtain the fourth processed feature.
[0338] Among them, the step of inputting the fifth processed feature into the BAM to obtain the eighth processed feature includes:
[0339] Input the tensor of the fifth processed feature through the first branch of the BAM into global pooling and connect two fully connected layers to obtain a result of the first branch processing;
[0340] Input the tensor of the fifth processed feature through the second branch of the BAM into a 1×1 convolution, then into a 3×3 dilated convolution and a 1×1 convolution to obtain an intermediate result of the second branch processing;
[0341] Input the result obtained by adding the intermediate result of the second branch processing and the result of the first branch processing into a sigmoid activation function to obtain a result of the second branch processing;
[0342] Multiply the tensor of the fifth processed feature through the third branch of the BAM by the result of the second branch processing to obtain a result of the third branch processing;
[0343] Add the result of the third branch processing to the tensor of the fifth processed feature to obtain the eighth processed feature.
[0344] Among them, the step of inputting the eighth processed feature into a convolutional block and an anti-pooling process to obtain the ninth processed feature, and the convolutional block is composed of a convolution, Batch Normalization, and a Relu activation function.
[0345] It should be understood that in the embodiments of the present application, the processor 720 may be a central processing unit (CPU), and the processor 720 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0346] Those skilled in the art can understand that Figure 4 the structure of the computer device 700 shown in does not constitute a limitation on the computer device 700, and it may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0347] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the self-supervised crowd density statistical method disclosed in the embodiments of the present invention.
[0348] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices, apparatuses, and units can refer to the corresponding processes in the foregoing method embodiments, and will not be described herein again. Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0349] In several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, or units with the same function can be aggregated into one unit. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Additionally, the displayed or discussed couplings or direct couplings or communication connections between each other can be indirect couplings or communication connections through some interfaces, devices, or units, or can be electrical, mechanical, or other forms of connection.
[0350] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present invention.
[0351] In addition, in each embodiment of the present invention, the functional units can be integrated in one processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0352] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), magnetic disks, or optical discs, etc., all kinds of media that can store program codes.
[0353] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various equivalent modifications or substitutions, and these modifications or substitutions should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A self-supervised crowd density statistical method, characterized in that Including: Obtain image data; Process the image data to obtain a sample image; Input the sample image into a crowd density statistical model for crowd density statistics to obtain a crowd density map; Accumulate and sum according to the crowd density map to obtain the number of people; The step of inputting the sample image into a crowd density statistical model for crowd density statistics to obtain a crowd density map, and the processing method of the crowd density statistical model includes: Input the sample image into deformable convolution and max pooling to obtain a first processed feature; Input the sample image into dynamic filtering convolution and max pooling to obtain a second processed feature; Input the sample image into vanilla convolution and max pooling to obtain a third processed feature; Input the sample image into convertible dilated convolution to obtain a fourth processed feature; Concatenate and fuse the first processed feature, the second processed feature, the third processed feature and the fourth processed feature to obtain a first fused feature; Input the first fused feature into self-correcting convolution to obtain a corrected feature; Input the first fused feature into vanilla convolution and max pooling to obtain a fifth processed feature; Input the fifth processed feature into ASPP to obtain a sixth processed feature; Input the sixth processed feature into CBAM to obtain a seventh processed feature; Input the fifth processed feature into BAM to obtain an eighth processed feature; Input the eighth processed feature into a convolutional block and anti-pooling processing to obtain a ninth processed feature; Concatenate and fuse the corrected feature, the seventh processed feature and the eighth processed feature to obtain a second fused feature; Input the result of multiplying the second fused feature and the ninth processed feature into a transposed convolution for upsampling to obtain a first upsampled feature; Upsample the first upsampled feature by bilinear interpolation to obtain a second upsampled feature; Input the second upsampled feature into Convolve and combine with the Sigmoid activation function to obtain an attention map; Input the second fused feature into CAN to obtain a tenth processed feature; Input the tenth processed feature into a deconvolution for upsampling to obtain a third upsampled feature; Upsample the third upsampled feature by bilinear interpolation to obtain a density map; Combine the attention map and the density map to obtain a crowd density map.
2. The self-supervised crowd density statistics method according to claim 1, wherein The step of processing the image data to obtain a sample image includes: Segment the image data to obtain segmented image data; Select one frame of picture from the segmented image data as the sample image.
3. The self-supervised crowd density statistical method according to claim 1, wherein The step of inputting the sample image into convertible dilated convolution to obtain a fourth processed feature includes: Input the sample image into global average pooling and convolution to obtain the first result; Add the first result and the sample image to obtain a second result; Input the second result into dilated convolution with a dilation rate of 1 to obtain a third result; Input the second result into dilated convolution with a dilation rate of 3 to obtain a fourth result; Input the second result into global pooling and convolution to obtain the fifth result; Multiply the fifth result and the third result to obtain a sixth result; Multiply the fifth result and the fourth result to obtain a seventh result; Add the sixth result and the seventh result to obtain an eighth result; Input the eighth result into global pooling and convolution to obtain the ninth result; Add the ninth result and the eighth result to obtain a fourth processed feature.
4. The self-supervised crowd density statistics method according to claim 1, wherein The step of inputting the fifth processed feature into BAM to obtain an eighth processed feature includes: Input the tensor of the fifth processed feature into the first branch of BAM to global pooling and connect two fully connected layers to obtain a first branch processing result; Input the tensor of the fifth processing feature into Branch 2 of BAM After convolutional processing, input it into Atrous convolution and Convolution to obtain the intermediate processing result of Branch 2; The result obtained by adding the intermediate processing result of branch two to the processing result of branch one is input into the sigmoid activation function to obtain the processing result of branch two; The tensor of the fifth processed feature is multiplied by the processing result of branch two through branch three of BAM to obtain the processing result of branch three; The processing result of branch three is added to the tensor of the fifth processed feature to obtain the eighth processed feature.
5. The self-supervised crowd density statistics method according to claim 1, characterized in that Inputting the eighth processed feature into a convolutional block and anti-pooling processing to obtain the ninth processed feature, where the convolutional block consists of convolution, BatchNormalization, and the Relu activation function.
6. A self-supervised crowd density statistical device, when running, executes the self-supervised crowd density statistical method according to any one of claims 1-5, characterized in that Including an acquisition unit, a processing unit, a statistical unit, and a calculation unit; The acquisition unit is used to acquire image data; The processing unit is used to process the image data to obtain a sample map; The statistical unit is used to input the sample map into a crowd density statistical model for crowd density statistics to obtain a crowd density map; The calculation unit is used to accumulate and sum according to the crowd density map to obtain the number of people.
7. The self-supervised crowd density statistical device according to claim 6, characterized in that The statistical unit includes a first input module, a second input module, a third input module, a fourth input module, a first fusion module, a fifth input module, a sixth input module, a seventh input module, an eighth input module, a ninth input module, a tenth input module, a second fusion module, a first upsampling module, a second upsampling module, a processing module, an eleventh input module, a third upsampling module, a fourth upsampling module, and a combination module; The first input module is used to input the sample map into deformable convolution and max pooling to obtain a first processed feature; The second input module is used to input the sample map into dynamic filtering convolution and max pooling to obtain a second processed feature; The third input module is used to input the sample map into vanilla convolution and max pooling to obtain a third processed feature; The fourth input module is used to input the sample map into convertible dilated convolution to obtain a fourth processed feature; The first fusion module is used to perform Concate fusion on the first processed feature, the second processed feature, the third processed feature, and the fourth processed feature to obtain a first fusion feature; The fifth input module is used to input the first fusion feature into self-correcting convolution to obtain a corrected feature; The sixth input module is used to input the first fusion feature into vanilla convolution and max pooling to obtain a fifth processed feature; The seventh input module is used to input the fifth processed feature into ASPP to obtain a sixth processed feature; The eighth input module is used to input the sixth processed feature into CBAM to obtain a seventh processed feature; The ninth input module is used to input the fifth processed feature into BAM to obtain an eighth processed feature; The tenth input module is used to input the eighth processed feature into a convolutional block and anti-pooling processing to obtain a ninth processed feature; The second fusion module is used to perform Concate fusion on the corrected feature, the seventh processed feature, and the eighth processed feature to obtain a second fusion feature; The first upsampling module is configured to input the result of multiplying the second fusion feature and the ninth processed feature into a transposed convolution for upsampling to obtain a first upsampled feature; The second upsampling module is configured to perform upsampling on the first upsampled feature through bilinear interpolation to obtain a second upsampled feature; The processing module is used to input the second upsampled feature into perform convolution and combine with the Sigmoid activation function to obtain an attention map; The eleventh input module is configured to input the second fusion feature into the CAN to obtain a tenth processed feature; The third upsampling module is configured to input the tenth processed feature into a deconvolution for upsampling to obtain a third upsampled feature; The fourth upsampling module is configured to perform upsampling on the third upsampled feature through bilinear interpolation to obtain a density map; The combining module is configured to combine the attention map and the density map to obtain a crowd density map.
8. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the self-supervised crowd density statistics method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by the processor, the processor is caused to execute the steps of the self-supervised crowd density statistics method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Crowd density estimation device and method and storage medium
CN113869285A