A method and terminal for rapid headcount counting
By constructing a lightweight people counting model, the problem of incompatibility between people counting algorithms on edge devices is solved, realizing fast and accurate people counting and head detection, generating density heatmaps and head detection boxes, which are suitable for edge devices.
Patent Information
- Application Number
- CN202110881660.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-02
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2041-08-02
AI Technical Summary
In existing technologies, people counting algorithms for edge devices are incompatible with deep learning models, resulting in low accuracy and the inability to deploy them on edge devices, especially for inaccurate head detection at a distance.
A lightweight people counting model is constructed, consisting of a thirteen-layer structure. A lightweight convolutional neural network is used to train the model and transfer it to an edge device. The model is trained using optimal transmission loss and mean absolute difference loss, and outputs a density prediction map and generates a density heatmap and head detection boxes.
Enables fast and accurate people counting on edge devices, generating density heatmaps and head detection boxes to meet practical needs, improves the accuracy of head detection at a distance, and is suitable for deployment on edge devices.
Smart Images

Figure QLYQS_1 
Figure QLYQS_6 
Figure BDA0003192585060000021
Abstract
Description
Technical Field
[0001] This invention relates to a rapid people counting method for crowd image acquisition, and more particularly to an efficient people counting method. Background Technology
[0002] In production and daily life, people counting algorithms need to achieve pseudo-real-time prediction on edge devices (such as Rockchip RK1808 and RK3399PRO), and business applications require these algorithms to have high accuracy and a low false positive rate. Traditional people counting algorithms have low accuracy and cannot meet practical needs, while existing deep learning algorithms have high accuracy but require high computing power and are usually deployed on servers. Edge devices have limited computing power, making it difficult to deploy deep learning algorithms. Existing deep learning people counting algorithms are divided into object detection methods and density map detection methods. When counting people using object detection methods, it is difficult to detect people at a distance, resulting in low accuracy. When using density map detection methods, it is impossible to obtain specific head detection boxes for visualization and post-processing applications. At the same time, edge devices are incompatible with many deep learning operators and structures supported by servers, making it impossible to deploy commonly used deep learning people counting models on edge devices. Specific models need to be designed to be compatible with edge devices for inference. Summary of the Invention
[0003] Therefore, a deep learning-based people counting algorithm with low computational cost is needed to solve the incompatibility problem of existing edge device people counting algorithms.
[0004] To achieve the above objectives, the inventors provide a rapid headcount counting method, comprising the following steps:
[0005] S1: Construct a lightweight population statistics model;
[0006] S2: Train a lightweight people counting model and transfer the model to edge devices;
[0007] S3: Input the image of the number of people to be identified into the lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map.
[0008] S4: The density prediction map is converted into a density heatmap, which is then rendered and output as a density heatmap. At the same time, the density prediction map is processed by an automatic filtering algorithm using a nearest neighbor detection window to obtain head detection boxes, which are then output as head detection boxes.
[0009] Specifically, the lightweight people counting model constructed in step S1 comprises thirteen layers: the first layer is the input layer, receiving the image as input; the second layer consists of a convolutional block, each block including a convolutional layer and a batch normalization layer; the third layer consists of two convolutional blocks; the fourth layer is a pooling layer; the fifth layer consists of three convolutional blocks; the sixth layer is a pooling layer; the seventh layer consists of three convolutional blocks; the eighth layer is a pooling layer; the ninth layer consists of three convolutional blocks; the tenth layer consists of an upsampling layer; the eleventh layer is a stitching layer, receiving the outputs of the sixth and tenth layers as input; the twelfth layer consists of three convolutional blocks; and the thirteenth layer is the output layer. The lightweight people counting model constructed in this invention is compatible with edge devices, and all operators used are basic edge device operators.
[0010] Specifically, the training of the lightweight people counting model in step S2 includes:
[0011] S21: Obtain a set of images showing the number of people, and label the center point coordinates of the heads of the people in the images as ground truth labels;
[0012] S22: Input the labeled population statistics image set into the lightweight population statistics model, and obtain the density prediction image set through inference;
[0013] S23: Calculate the loss by comparing a density prediction map in the density prediction map set with the ground truth label of the corresponding head center point of the person, then backpropagate the loss to the lightweight people statistics model, and update the parameter weights of the lightweight people statistics model.
[0014] S24: Repeat step S23 to traverse each density prediction map in the density prediction map set, and continuously update the parameter weights of the lightweight population statistics model until the model is stable.
[0015] Specifically, in step S23, the optimal transmission loss algorithm and the mean absolute difference algorithm are used to calculate the loss;
[0016] The optimal transmission loss is calculated as follows:
[0017]
[0018] Where, α * and β * To approximate the secondary transport cost z for the optimal transport algorithm Sinkhorn, we need to find z and z'. For predicting density plots and ground truth label plots;
[0019] The mean absolute difference loss is calculated as follows:
[0020]
[0021] Preferably, step S22, which involves inputting the labeled people statistics image set into the lightweight people statistics model and obtaining the density prediction image set through inference, includes: after inputting the labeled people statistics image set into the lightweight people statistics model, processing it through layers 3, 5, 7, 9, and 13 to output corresponding density prediction images; calculating the loss between each density prediction image and the ground truth label of the corresponding person's head center point to obtain the loss value for each layer; then, backpropagating the loss to the parameter weights of the corresponding layer and other layers before it based on the loss value, and updating the corresponding parameter weights. This method improves the model's accuracy in detecting pedestrians at low resolution in the distance.
[0022] Preferably, step S2, which involves converting the model to an edge device, includes: converting a lightweight people counting model trained on a GPU into an embedded neural network processor inference model, and applying the converted lightweight people counting model to the edge device via an interface.
[0023] Specifically, in step S3, the image of the number of people to be identified is input into the lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map. Specifically, after the image is input into the lightweight people counting model, it is downsampled for the first time using convolution, then a second convolution is performed to extract features and downsample, and then another convolution is performed to extract features and downsample to obtain a first output feature map. Then, a second convolution is performed to extract features and downsample and a convolution is performed to extract features and upsample to obtain a second output feature map. The first output feature map and the second output feature map, which are of the same size, are concatenated and the density prediction map is output in the final output layer of the model.
[0024] Specifically, in step S4, converting the density prediction map into a density heatmap and rendering the density heatmap includes: generating a circle with pixel values decreasing outward from the center, centered on the predicted head coordinates in the density prediction map and using a preset diameter value; and then rendering the generated density heatmap according to the color corresponding to the pixel value size: the preset diameter value is proportional to the image resolution.
[0025] Further, in step S4, the head detection box is obtained by using the nearest neighbor detection window automatic filtering algorithm on the density prediction map. The output of the head detection box includes: when the pixel value of the head center coordinate of the density prediction map is greater than a preset value, a square detection window is generated with the head center coordinate as the center and a preset side length, wherein the preset side length is proportional to the image resolution.
[0026] When the edges of the head detection windows overlap or intersect, neighboring detection windows are filtered. Specifically, the pixel values of the head center coordinates of the detection windows with overlapping or intersecting edges are calculated. The detection window with the largest head center coordinate pixel value or the detection window with a head center coordinate pixel value greater than a threshold is retained, and the retained detection windows are output as head detection boxes. This method allows the density map detection method to obtain specific head detection boxes for visualization and post-processing applications when counting people.
[0027] The present invention also discloses a fast people counting terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements each step of the above-described fast people counting method.
[0028] Unlike existing technologies, the above-mentioned technical solution can recognize human images without consuming excessive computing power. Furthermore, in processing human images, it can output two visualization results, meeting the post-processing requirements of subsequent engineering applications. In addition, the technical solution of this invention is compatible with existing edge devices, achieving operating speeds and accuracy close to those on GPUs. Attached Figure Description
[0029] Figure 1 A flowchart illustrating the rapid headcount counting method described in the specific implementation;
[0030] Figure 2 The flowchart for training a lightweight population statistics model is shown in the specific implementation method. Detailed Implementation
[0031] To explain in detail the technical content, structural features, objectives, and effects of the technical solution, the following description is provided in conjunction with specific embodiments and accompanying drawings.
[0032] Please see Figure 1 The rapid people counting method described in this embodiment includes the following steps: S1: Constructing a lightweight people counting model;
[0033] S2: Train a lightweight people counting model and transfer the model to edge devices;
[0034] S3: Input the image of the number of people to be identified into the lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map.
[0035] S4: The density prediction map is converted into a density heatmap, which is then rendered and output as a density heatmap. At the same time, the density prediction map is processed by an automatic filtering algorithm using a nearest neighbor detection window to obtain head detection boxes, which are then output as head detection boxes.
[0036] Through the above scheme, we can obtain two visualization results after the task image is run. The visualization is highly detailed and facilitates post-processing for subsequent engineering applications. This invention can achieve prediction in 75ms on Rockchip's RK1808. Due to its ease of adaptation to edge devices, it can meet the requirements of accuracy, speed, and edge device deployment. It can also generate density heatmaps and head detection boxes to meet practical needs, and it handles distant heads well, generating correct head detection boxes.
[0037] In such Figure 2 In some specific embodiments shown, step S2: training the lightweight people counting model specifically involves:
[0038] S21: Obtain a set of images showing the number of people, and label the center point coordinates of the heads of the people in the images as ground truth labels;
[0039] S22: Input the labeled population statistics image set into the lightweight population statistics model, and obtain the density prediction image set through inference;
[0040] S23: Calculate the loss by comparing a density prediction map in the density prediction map set with the ground truth label of the corresponding head center point of the person, then backpropagate the loss to the lightweight people statistics model, and update the parameter weights of the lightweight people statistics model.
[0041] S24: Repeat step S23 to traverse each density prediction map in the density prediction map set, and continuously update the parameter weights of the lightweight population statistics model until the model is stable.
[0042] The training method described above is highly efficient. The model stored after the training loss converges is used as an inference model for image inference.
[0043] The constructed people counting model includes the following layers: a first input layer (input image); a second layer consisting of a convolutional layer and a batch normalization layer; a third layer consisting of two convolutional blocks, each including a convolutional layer and a batch normalization layer; a fourth layer being a pooling layer; a fifth layer consisting of three convolutional blocks, each including a convolutional layer and a batch normalization layer; a sixth layer being a pooling layer; a seventh layer consisting of three convolutional blocks, each including a convolutional layer and a batch normalization layer; an eighth layer being a pooling layer; a ninth layer consisting of three convolutional blocks, each including a convolutional layer and a batch normalization layer; a tenth layer consisting of an upsampling layer; an eleventh layer being a concatenation layer, with the input being the outputs of the seventh and tenth layers; a twelfth layer consisting of three convolutional blocks, each including a convolutional layer and a batch normalization layer; and a thirteenth layer consisting of five output layers, each consisting of a convolutional layer. In this embodiment, one or more of layers two through nine in the people counting model can be configured as layers with activation functions, such as the ReLU function. The ReLU function is a piecewise linear function. For example, it sets all negative values to 0 while leaving positive values unchanged. This operation is a form of one-sided inhibition. (That is, when the input is negative, it outputs 0, so the neuron is not activated. This means that only a portion of the neurons are activated at any given time, making the network sparse and therefore computationally efficient.) It is precisely this one-sided inhibition that gives neurons in neural networks sparse activation. This is especially evident in deep neural network models (such as CNNs). Theoretically, when the model adds N layers, the activation rate of ReLU neurons will decrease by a factor of 2 to the power of N.
[0044] In this scheme, the advantages of using the ReLU function are: 1. No saturation region, eliminating the gradient vanishing problem. 2. No complex exponential operations, simplifying computation and improving efficiency. 3. Faster actual convergence speed, much faster than Sigmoid / tanh. 4. More consistent with biological neural activation mechanisms than Sigmoid.
[0045] In a further embodiment, the size and stride of the convolutional kernel can be designed according to actual needs. For example, the lightweight people counting model structure is as follows: the first layer is the input layer, which is the input image; the second layer consists of a convolutional layer with a stride of 2, a kernel size of (9, 9), and 64 channels, and a batch normalization layer, with the ReLU activation function; the third layer consists of two convolutional blocks, each consisting of a convolutional layer and a batch normalization layer, wherein the stride of the convolutional layer is 1, the kernel size is (3, 3), the number of channels is 64, and the ReLU activation function is used; the fourth layer is a pooling layer with a size of (2, 2) and the ReLU activation function is used. The fifth layer consists of three convolutional blocks, each consisting of a convolutional layer and a batch normalization layer, wherein the stride of the convolutional layer is 1, the kernel size is (3, 3), the number of channels is 128, and the ReLU activation function is used; the sixth layer is a pooling layer with a size of (2, 2) and the ReLU activation function is used. Layer 7 consists of three convolutional blocks, each comprising a convolutional layer and a batch normalization layer. The convolutional layers have a stride of 1, a kernel size of (3, 3), 256 channels, and a ReLU activation function. Layer 8 is a pooling layer with a size of (2, 2) and a ReLU activation function. Layer 9 consists of three convolutional blocks, each comprising a convolutional layer and a batch normalization layer. The convolutional layers have a stride of 1, a kernel size of (3, 3), 512 channels, and a ReLU activation function. Layer 10 consists of an upsampling layer with a stride of (2, 2). Layer 11 is a concatenation layer, with the inputs being the outputs of layers 7 and 10. Layer 12 consists of three convolutional blocks, each comprising a convolutional layer and a batch normalization layer. The convolutional layers have a stride of 1, a kernel size of (3, 3), and 512, 256, and 128 channels respectively. The thirteenth layer consists of five output layers, each of which is composed of a convolutional layer with a stride of 1, a kernel size of (3, 3), and 1 channel.
[0046] In some other further embodiments, the number of convolutional blocks in the third, fifth, seventh, ninth, and twelfth layers can be modified and adjusted according to the usage. The kernel size of all convolutional layers can be slightly adjusted above the (3,3) size, such as (4,4), etc., which will not be elaborated here.
[0047] The advantages of this step in the present invention are: 1. The model consists of basic convolutional layers, pooling layers, ReLU activation layers and batch normalization layers, which are easy to deploy on edge devices; 2. When the image is input into the model, the image is downsampled directly through a convolutional layer with a stride of 2 and a kernel size of 9, which speeds up the inference speed of the model and preserves most of the image information.
[0048] In step S23, optimal transport loss and mean absolute error loss can also be used to calculate the loss, and the loss can be backpropagated according to different weights from high to low. The optimal transport loss is calculated using Formula 1.
[0049]
[0050] Where, α * and β * To approximate the secondary transport cost z for the optimal transport algorithm Sinkhorn, we need to find z and z'. For predicting density maps and ground truth label maps.
[0051] The mean absolute difference loss is calculated using Formula 2.
[0052]
[0053] The advantage of this step in the present invention is that by reducing the loss of the optimal transmission algorithm, the precision of the head coordinates in the generated final predicted density map is high. In most scenarios, one or two pixels represent one person, while previous density map predictions typically used multiple pixels to represent one person. Ultimately, this results in better image processing performance by the model.
[0054] In step S22, the labeled people statistics image set is input into the lightweight people statistics model, and the density prediction image set is obtained by inference. This includes: after the labeled people statistics image set is input into the lightweight people statistics model, the corresponding density prediction images are output after processing through the third, fifth, seventh, ninth and thirteenth layers respectively. The loss is calculated by comparing each density prediction image with the ground truth label of the corresponding head center point to obtain the loss value corresponding to each layer. Then, the loss is backpropagated to the parameter weights of the corresponding layer and other layers before the corresponding layer according to the loss value, and the corresponding parameter weights are updated.
[0055] Through the above operations, layers 3, 5, 7, 9, and 13 each serve as an output head, and a loss value can be calculated for each output head. This allows for multiple backpropagation of the loss values to the parameter weights of each layer of the model, improving both the training efficiency and the detection accuracy. These layers correspond to different resolutions within the model, and by deriving outputs at different resolutions, the model can learn features from different receptive fields in the image.
[0056] Step S2, converting the model to the edge device, includes: converting the lightweight people counting model trained on the GPU into an embedded neural network processor inference model, and applying the converted lightweight people counting model to the edge device through an interface. Through this conversion, the lightweight people counting model of the present invention can be quickly applied to edge devices.
[0057] In some simplified embodiments, we can configure the process as follows: The image of the number of people to be identified is input into a lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map. Specifically, after inputting the image into the lightweight people counting model, it undergoes a first downsampling using convolution, followed by a second convolution to extract features and downsample, and then another convolution to extract features and downsample again, resulting in a first output feature map. This is followed by another convolution to extract features and downsample, and then another convolution to extract features and upsample, resulting in a second output feature map. The first and second output feature maps, which are of the same size, are then concatenated, and the density prediction map is output in the final output layer of the model. This extraction and concatenation process of the first and second output feature maps achieves a better output density prediction map. In a specific implementation, we can try using a two-layer model to input the image into the lightweight people counting model. After the image is downsampled for the first time using convolution, the third and fourth layers perform a second convolution to extract features and downsample. Then, the fifth and sixth layers perform another convolution to extract features and downsample again, resulting in the first output feature map. The seventh to tenth layers then perform another convolution to extract features and downsample, followed by another convolution to extract features and upsample, resulting in the second output feature map. Subsequent stitching layers then stitch the first and second output feature maps together, outputting the density prediction map in the final output layer of the model. It is evident that stitching the first output feature map and the downsampled and then upsampled first output feature map is a key step in optimizing the density prediction map. The lightweight people counting model structure designed in this invention is easily compatible with edge devices, and all the operators used are basic edge device operators.
[0058] In step S4, the density prediction map is converted into a density heatmap, and the density heatmap is rendered and output. Specifically, this includes: generating a circle with pixel values decreasing outwards from the predicted head coordinates in the density prediction map, using a preset diameter value as the center; and then rendering the generated density heatmap according to the color corresponding to the pixel values. The preset diameter value is proportional to the image resolution. Through the above steps, a heatmap can be generated quickly, and its shape is consistent with the distribution of people.
[0059] The density prediction map is processed by an automatic filtering algorithm with a nearest neighbor detection window to obtain a head detection box. The output of the head detection box includes: when the pixel value of the head center coordinate in the density prediction map is greater than a preset value, a square detection window is generated with the head center coordinate as the center and a preset side length, wherein the preset side length is proportional to the image resolution.
[0060] When the edges of head detection windows overlap or intersect, adjacent detection windows are filtered. Specifically, the pixel values of the head center coordinates of detection windows with overlapping or intersecting edges are calculated. The detection window with the largest head center coordinate pixel value or the detection window with a head center coordinate pixel value greater than a threshold is retained, and the retained detection windows are output as head detection boxes. Through this processing, the density map detection method can obtain specific head detection boxes when counting people, which can be used for visualization and post-processing in applications.
[0061] In some specific embodiments, the density heatmap is generated by generating circles with decreasing pixel values, each 15 pixels in diameter, centered on the predicted head coordinates. The final density heatmap is then generated based on the corresponding color for each pixel value. The head detection bounding box is generated as a 15-pixel diameter window based on the head center coordinates where the pixel value is greater than 0.4. To filter duplicate detection windows, neighboring detection windows are filtered. The filtering method involves calculating the pixel values of the four nearest neighboring pixels, starting from the head center coordinates. If a larger value is found, the corresponding pixel's bounding box is removed. This larger pixel value is then added to the pixel value within the coordinates of the nearest largest pixel value. The pixel values of all head detection bounding boxes are then updated. Each head detection bounding box represents one person.
[0062] The advantages of this step in the present invention are: it can obtain two visualization results with a high degree of visualization, which facilitates post-processing for subsequent engineering applications. The present invention can achieve prediction in 75ms on Rockchip's RK1808, meeting the requirements for accuracy, speed, and edge device deployment, and can generate density heatmaps and head detection boxes to meet practical needs.
[0063] The above method designs a deep learning model for people counting with a specific structure, and uses a lightweight structure and basic operators to meet the requirements of edge device deployment and fast real-time prediction, thus alleviating the problem of slow speed of existing people counting algorithms.
[0064] The aforementioned method employs multi-level training and different loss functions to extract image features at varying resolutions, improving the prediction accuracy of people counting and the precision of head coordinates in the final predicted density map. Existing people counting density map prediction methods can only obtain the approximate area of heads, failing to pinpoint their precise locations. Furthermore, a unique post-processing operation is designed to address the issue of current people counting density map prediction methods being unable to simultaneously obtain density heatmaps and head detection windows. This method can generate density heatmaps through rendering and employs an automatic neighbor detection window filtering algorithm to generate head detection windows, meeting various practical application requirements.
[0065] The present invention also introduces a fast people counting terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements each step of the above-mentioned fast people counting method.
[0066] It should be noted that although the above embodiments have been described herein, this does not limit the scope of patent protection for this utility model. Therefore, any changes and modifications made to the embodiments described herein based on the innovative concept of this utility model, or equivalent structural or procedural transformations made using the content of this utility model's specification and drawings, directly or indirectly applying the above technical solutions to other related technical fields, are all included within the scope of protection of this utility model patent.
Claims
1. A rapid method for counting people, characterized in that, Includes the following steps: S1: Construct a lightweight population statistics model; S2: Training a lightweight population statistics model, including: S21: Obtain a set of images showing the number of people, and label the center point coordinates of the heads of the people in the images as ground truth labels; S22: Input the labeled population statistics image set into the lightweight population statistics model, and obtain the density prediction image set through inference; S23: Calculate the loss by comparing a density prediction map in the density prediction map set with the ground truth label of the corresponding head center point of the person, then backpropagate the loss to the lightweight people statistics model, and update the parameter weights of the lightweight people statistics model. S24: Repeat step S23 to traverse each density prediction map in the density prediction map set, continuously update the parameter weights of the lightweight population statistics model until the model is stable, and then transfer the model to the edge device. S3: Input the image of the number of people to be identified into the lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map. S4: The density prediction map is converted into a density heatmap, which is then rendered and output as a density heatmap. Simultaneously, an automatic filtering algorithm using a nearest neighbor detection window is applied to the density prediction map to obtain head detection boxes, which are then output. Specifically, this includes the following steps: when the pixel value of the head center coordinates in the density prediction map is greater than a preset value, a square detection window is generated with the head center coordinates as the center and a preset side length, where the preset side length is proportional to the image resolution; when the edges of the head detection windows overlap or intersect, neighboring detection windows are filtered, specifically: the pixel value of the head center coordinates of detection windows with overlapping or intersecting edges is calculated, and the detection window with the largest head center coordinate pixel value or the detection window with a head center coordinate pixel value greater than a threshold is retained. The retained detection windows are then output as head detection boxes. In step S23, the optimal transmission loss algorithm and the mean absolute difference algorithm are used to calculate the loss; The optimal transmission loss is calculated as follows: (1) in, and To approximate the secondary transport cost for the optimal transport algorithm Sinkhorn, and For predicting density plots and ground truth label plots; The mean absolute difference loss is calculated as follows: (2)。 2. The rapid headcount counting method according to claim 1, characterized in that, The lightweight people counting model constructed in step S1 consists of thirteen layers: the first layer is the input layer, which takes an image as input; the second layer consists of a convolutional block, each of which includes a convolutional layer and a batch normalization layer; the third layer consists of two convolutional blocks; the fourth layer is a pooling layer; the fifth layer consists of three convolutional blocks; the sixth layer is a pooling layer; the seventh layer consists of three convolutional blocks; the eighth layer is a pooling layer; the ninth layer consists of three convolutional blocks; the tenth layer consists of an upsampling layer; the eleventh layer is a stitching layer, which takes the outputs of the sixth and tenth layers as input; the twelfth layer consists of three convolutional blocks; and the thirteenth layer is the output layer.
3. The rapid headcount counting method according to claim 1, characterized in that, In step S22, the labeled people statistics image set is input into the lightweight people statistics model, and the density prediction image set is obtained by inference. This includes: after the labeled people statistics image set is input into the lightweight people statistics model, the corresponding density prediction images are output after processing through the third, fifth, seventh, ninth and thirteenth layers respectively. The loss is calculated by comparing each density prediction image with the ground truth label of the corresponding head center point to obtain the loss value corresponding to each layer. Then, the loss is backpropagated to the parameter weights of the corresponding layer and other layers before the corresponding layer according to the loss value, and the corresponding parameter weights are updated.
4. The rapid headcount counting method according to claim 1, characterized in that, The step S2 of converting the model to the edge device includes: converting the lightweight people counting model trained by the GPU into an embedded neural network processor inference model, and applying the converted lightweight people counting model to the edge device through an interface.
5. The rapid headcount counting method according to claim 1, characterized in that, In step S3, the image of the number of people to be identified is input into the lightweight people counting model. The lightweight people counting model infers and outputs a density prediction map. Specifically, after the image is input into the lightweight people counting model, it is downsampled for the first time using convolution, followed by a second convolution to extract features and downsample, and then another convolution to extract features and downsample to obtain a first output feature map. After another convolution to extract features and downsample and another convolution to extract features and upsample, a second output feature map is obtained. The first and second output feature maps of the same size are concatenated, and the density prediction map is output in the final output layer of the model.
6. The rapid headcount counting method according to claim 1, characterized in that, In step S4, converting the density prediction map into a density heatmap and rendering and outputting the density heatmap specifically includes: Using the predicted head coordinates in the predicted density map as the center, a circle with pixel values decreasing outward from the center is generated with a preset diameter value; then, a density heat map is generated by rendering the color corresponding to the pixel value: the preset diameter value is proportional to the image resolution.
7. A rapid people counting terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements each step of the rapid headcount method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Crowd density estimation method and device, computer equipment and storage medium
CN112101195A
Image data processing method and device and computer readable storage medium
CN112101303A