People counting method, device and equipment based on point query quadtree and storage medium

Through the crowd counting method based on point query quadtree, VGG feature extraction and quadtree encoding and decoding technology are used to solve the accuracy problem of crowd counting in complex scenes and achieve accurate crowd counting in dense scenes.

CN118570723APending Publication Date: 2024-08-30WUHAN POLYTECHNIC UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410624263.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing technologies cannot accurately estimate crowd distribution and quantity in complex scenarios, especially in dense crowd counting, and cannot provide intuitive understanding and instance-level information, resulting in counting or positioning failure.

Method used

A crowd counting method based on point query quadtree is adopted, image features are obtained through VGG feature extraction network, quadtree encoder and decoder are used to encode and decode crowd information points, and the crowd is predicted to be sparse or dense, using point query quad Fork trees and prediction heads handle sparse and dense scene graphs, and network optimization is performed to obtain crowd counting results.

Benefits of technology

It provides intuitive understanding and accurate counting of crowds in complex scenes, and can accurately estimate crowd distribution and quantity in crowded scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118570723A
    Figure CN118570723A
Patent Text Reader

Abstract

The invention discloses a crowd counting method, device and equipment based on a point query quadtree, and a storage medium, relates to the technical field of computer vision, and discloses a crowd counting method based on the point query quadtree, and the method comprises the steps: uploading a crowd picture to a VGG feature extraction network, and obtaining a picture feature extracted through the VGG feature extraction network; obtaining space elements in the picture features according to the picture features; inputting the mark into a quadtree encoder, so that the quadtree encoder encodes the mark; outputting the crowd information points and the candidate points to a quadtree decoder, so that the quadtree decoder decodes the crowd information points and the candidate points; respectively processing the sparse crowd and the dense crowd by using a point query quadtree and a prediction head to respectively obtain a sparse scene graph and a dense scene graph; and obtaining a crowd counting result according to a summation result and a network optimization result. The point query quadtree is used for processing image information, and the accuracy and efficiency of crowd counting are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a crowd counting method, device, equipment and storage medium based on a point query quadtree. Background Art

[0002] With the popularization of intelligent video surveillance systems and the rapid development of artificial intelligence, intelligent video surveillance technology plays a key role in social public security, big data, and management. How to quickly locate, identify, and count people, especially dense crowds and crowd counting in complex scenes, is an important issue that is currently receiving widespread attention in computer vision and is also a difficult problem that needs to be solved in computer vision. How to accurately estimate the distribution and number of people in a complex scene has important applications in public security, traffic management, scenic spot diversion, and other scenarios.

[0003] Existing methods usually solve the counting problem by learning a surrogate target (such as a density map) and obtain the count by integrating the inferred density map. Although existing methods can achieve certain beneficial effects, they cannot provide an intuitive understanding of the crowd and do not provide instance-level information, which hinders high-level crowd counting. Crowded scenes may cause counting or localization failures.

[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present application is to provide a crowd counting method, device, equipment and storage medium based on point query quadtree, aiming to solve the technical problem of accurately estimating the distribution and number of people in a scene in a complex scene.

[0006] To achieve the above objectives, the present application proposes a crowd counting method based on point query quadtree, the method comprising:

[0007] Upload the crowd picture to the VGG feature extraction network to obtain the picture features extracted by the VGG feature extraction network;

[0008] Obtain a spatial element in the image feature according to the image feature, and regard the spatial element as a mark, where the mark has a length of H and a width of W;

[0009] Inputting the mark to a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain crowd information points, wherein the crowd information points generate candidate points where there may be people;

[0010] Outputting the crowd information points and the candidate points to a quadtree decoder so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result;

[0011] The sparse crowd and the dense crowd are processed respectively using a point query quadtree and a prediction head to obtain a sparse scene graph and a dense scene graph respectively;

[0012] The sparse query points and the dense query points in the sparse scene graph and the dense scene graph are summed respectively, and the sparse scene graph and the dense scene graph are network optimized, and a crowd counting result is obtained according to the summed result and the network optimization result.

[0013] In one embodiment, the marking is input into a quadtree encoder so that the quadtree encoder encodes the marking according to the position information of the marking, the dimension of the marking and the dimension of the model to obtain a crowd information point, wherein after the crowd information point generates a candidate point where a person may be present, the method further includes:

[0014] Detecting whether the crowd information point and the candidate point have crowd information;

[0015] If there is crowd information, mark the crowd information points and candidate points as points that need to be counted;

[0016] Input the points to be counted into a quadtree encoder to obtain position codes of the points to be counted;

[0017] The points to be counted are located according to the position codes of the points by a quadtree decoder, and the points to be counted are decoded to obtain the probability of the existence of a crowd at the points to be counted.

[0018] In one embodiment, the step of outputting the crowd information points and the candidate points to a quadtree decoder, decoding the relationship between the crowd information points and the candidate points by the quadtree decoder, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result includes:

[0019] The crowd image is divided into smaller regions through a quadtree decoder to obtain different local windows;

[0020] Calculate the quadtree decoder attention within the local window and decode the relationship between crowd information points and candidate points;

[0021] After decoding is completed, the output results of the local windows are recombined by window inversion to obtain the crowd picture;

[0022] According to the decoding result, the point query of the candidate point and the context of the crowd information point are obtained to determine whether the point query of the crowd information point is a person;

[0023] The crowd in the crowd picture is predicted to be a sparse crowd or a dense crowd according to the point query of the candidate point and the context of the crowd information point.

[0024] In one embodiment, the quadtree decoder attention includes a first decoder attention, a second decoder attention, and a third decoder attention, and the calculating the quadtree decoder attention in the local window includes:

[0025] Based on the rectangular window self-attention of the first layer and the decoder attention of the first layer, layer-normalizing the rectangular window self-attention of the first layer and the decoder attention of the first layer to obtain the first decoder attention of the second layer;

[0026] Based on the rectangular window cross attention of the second layer and the decoder attention of the second layer, layer-normalizing the rectangular window cross attention of the second layer and the decoder attention of the second layer to obtain the second decoder attention of the second layer;

[0027] Based on the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network, the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network are layer-normalized to obtain a third decoder attention.

[0028] In one embodiment, the use point query quadtree and prediction head to process the sparse crowd and the dense crowd respectively to obtain a sparse scene graph and a dense scene graph respectively, including:

[0029] If the crowd is a sparse crowd, obtain sparse query points, and map the sparse query points to the picture to obtain a sparse scene graph;

[0030] If the crowd is a dense crowd, the entire dense area of ​​the image is traversed, the dense area of ​​the image is adaptively segmented to obtain dense query points, a multi-layer quadtree is formed based on the dense query points, and the multi-layer quadtree segments the dense area to form a dense scene graph.

[0031] In one embodiment, the step of adaptively segmenting the dense area of ​​the image to obtain dense query points, forming a multi-layer quadtree based on the dense query points, and segmenting the dense area using the multi-layer quadtree includes:

[0032] Evenly setting sparse query points on the crowd image to obtain the 0th layer of the quadtree, and segmenting the crowd image based on the quadtree to obtain a segmentation map;

[0033] Each element in the segmentation map represents the probability that a region is dense, where 1 represents a dense region and 0 represents a sparse region;

[0034] An initial dense area is obtained according to the elements, and query points in the initial dense area are divided into dense query points to form a first-level quadtree;

[0035] Repeat the above process until the maximum segmentation time is reached, forming a maximum segmentation layer quadtree;

[0036] Based on the maximum segmentation level quadtree, dense areas are segmented.

[0037] In one embodiment, the steps of summing up the sparse query points and the dense query points in the sparse scene graph and the dense scene graph, performing network optimization on the sparse scene graph and the dense scene graph, and obtaining a crowd counting result according to the summed result and the network optimization result include:

[0038] The predicted classification probability is calculated based on the sparse query points and the dense query points;

[0039] Obtaining a network optimization result according to the predicted classification probability, hyperparameters, classification loss, and positioning loss;

[0040] The crowd density is obtained according to the maximum segmentation map and the minimum segmentation map;

[0041] According to the network optimization result and the crowd density, a crowd counting result of the corresponding picture is obtained.

[0042] In addition, to achieve the above purpose, the present application also proposes a crowd counting device based on a point query quadtree, the crowd counting device based on a point query quadtree comprising: an image feature extraction module, used to upload a crowd image to a VGG feature extraction network, and obtain image features extracted by the VGG feature extraction network;

[0043] A feature information analysis module, used for obtaining a spatial element in the picture feature according to the picture feature, and treating the spatial element as a mark, where the mark has a length of H and a width of W;

[0044] A quadtree encoder encoding module, used for inputting the mark into a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain a crowd information point, wherein the crowd information point generates a candidate point where a person may be present;

[0045] A quadtree decoder decoding module, used for outputting the crowd information points and candidate points to a quadtree decoder, so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result;

[0046] A crowd processing module, used to process the sparse crowd and the dense crowd respectively using a point query quadtree and a prediction head to obtain a sparse scene graph and a dense scene graph respectively;

[0047] The crowd counting module is used to sum the sparse query points and the dense query points in the sparse scene graph and the dense scene graph respectively, and perform network optimization on the sparse scene graph and the dense scene graph, and obtain the crowd counting result according to the summed result and the network optimization result.

[0048] In addition, to achieve the above-mentioned purpose, the present application also proposes a crowd counting device based on a point query quadtree, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the crowd counting method based on the point query quadtree as described above.

[0049] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the crowd counting method based on the point query quadtree as described above are implemented.

[0050] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of the crowd counting method based on point query quadtree as described above are implemented.

[0051] One or more technical solutions proposed in this application have at least the following technical effects:

[0052] By uploading a crowd picture to the VGG feature extraction network, the picture features extracted by the VGG feature extraction network are obtained, and a tag is obtained according to the picture feature. The tag is then encoded by a quadtree encoder to obtain a crowd information point, and the crowd information point generates a candidate point where there may be a person. The crowd information point is output to the quadtree decoder, and the quadtree decoder decodes the crowd information point and the candidate point, and predicts whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result. The sparse crowd and the dense crowd are processed respectively using the point query quadtree and the prediction head to obtain a sparse scene graph and a dense scene graph respectively, and the sparse query points and the dense query points in the sparse scene graph and the dense scene graph are summed respectively, and the sparse scene graph and the dense scene graph are network optimized, and the crowd counting result is obtained according to the summed result and the network optimization result. Compared with the prior art, this solution provides an intuitive understanding of the crowd and can accurately count the crowd in crowded scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

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

[0055] Figure 1 A flow chart of the first embodiment of the crowd counting method based on point query quadtree of the present application;

[0056] Figure 2 A schematic diagram of marking a crowd picture of a crowd counting method based on a point query quadtree in this application;

[0057] Figure 3 A brief flowchart of a crowd counting method based on a point query quadtree provided in Example 2 of the present application;

[0058] Figure 4 This is a schematic diagram of a local window of a crowd counting method based on a point query quadtree in this application;

[0059] Figure 5 This is a brief flowchart of the crowd counting method based on point query quadtree in this application;

[0060] Figure 6 This is a schematic diagram of the module structure of a crowd counting device based on a point query quadtree according to an embodiment of the present application;

[0061] Figure 7 Schematic diagram of the device structure of the hardware operating environment involved in the crowd counting method based on point query quadtree in the embodiment of the present application.

[0062] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0063] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0064] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0065] The main solutions of the embodiments of this application are:

[0066] The execution subject of the method of this embodiment can be a computing service device with crowd counting, data processing, network communication and program running functions of point query quadtree, such as a tablet computer, a personal computer, a mobile phone, etc.; it can also be the above-mentioned crowd counting device based on point query quadtree with the same or similar functions. This embodiment and the following embodiments will be described by taking the crowd counting device based on point query quadtree as an example.

[0067] Since existing technologies usually solve the counting problem by learning surrogate targets (such as density maps), the counts are obtained by integrating the inferred density maps. Although existing methods can achieve certain beneficial effects, they cannot provide an intuitive understanding of the crowd and do not provide instance-level information, thus hindering high-level crowd counting. Crowded scenes may lead to counting or localization failures.

[0068] This application provides a solution that can accurately estimate the distribution and number of people in a scene in a complex scene, and solve the technical problem that the instance-level information cannot be provided, resulting in crowded scenes that may cause counting or positioning failures.

[0069] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a crowd counting device for point query quadtree, etc. The following takes the crowd counting device for point query quadtree as an example to illustrate this embodiment and the following embodiments.

[0070] Based on this, the embodiment of the present application provides a crowd counting method based on point query quadtree, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the crowd counting method based on point query quadtree of the present application.

[0071] In this embodiment, the crowd counting method based on point query quadtree includes steps S10 to S60:

[0072] Step S10, uploading the crowd picture to the VGG feature extraction network, and obtaining the picture features extracted by the VGG feature extraction network;

[0073] It should be noted that crowd images refer to images captured from surveillance videos, which contain crowds of different numbers and densities and are used for training or testing of crowd location, recognition, and counting. These images may contain various scenes, such as public squares, streets, stations, etc., to simulate various surveillance scenes in the real world. By analyzing and processing these images, more accurate and effective crowd location, recognition, and counting algorithms can be developed for application in public safety, traffic management, and other fields.

[0074] In addition, it should be noted that the VGG network is a convolutional neural network architecture. The VGG feature extraction network refers to the first few convolutional layers in the VGG network, which are usually used to extract image features. These features can be used in the target task of image feature extraction, such as image classification, target detection, etc. A notable feature of the VGG network is its depth. It uses a smaller convolution kernel size, usually a 3x3 convolution kernel size. This embodiment does not limit this, and stacks multiple convolution layers to build a network. By stacking multiple convolution layers, the VGG network can learn more complex and abstract image features, thereby recognizing more complex and abstract image features.

[0075] It can be understood that in this embodiment, the VGG feature extraction network belongs to a convolutional neural network module, which is composed of a Sine position encoding module, a VGG feature extraction backbone module and a feature map joint module. The convolutional neural network module specifically includes a position encoding layer, sixteen convolutional layers and three pooling layers. The convolutional neural network module is sequentially as follows from the input: a convolutional layer, a pooling layer, two convolutional layers, a pooling layer, three convolutional layers, a pooling layer, three convolutional layers, a pooling layer, three convolutional layers, a pooling layer, three convolutional layers, a pooling layer, three convolutional layers, a pooling layer, three fully connected layers, and an activation function. The size is 3×3, and each convolutional layer generates feature maps with 64, 128, 256, 512 and 5126 channels from the input to the output direction. Each of the pooling layers is a maximum pooling layer with a step size of 2, and each of the fully connected layers outputs 4096, 4096 and 1000 fully connected layers, respectively, and the soft-max of the final output is 1000.

[0076] It is understandable that, since it is necessary to extract features from the crowd image in order to subsequently process the crowd information, performing step S10 can avoid inaccurate crowd identification, thereby improving the efficiency of crowd information processing.

[0077] In a feasible implementation, step S10 may include steps A11 to A13:

[0078] Step A11, inputting the initial uncounted picture into the Sine position coding code block, and generating a position coding tensor of the same dimension as the input tensor according to the mask information of the input tensor;

[0079] It should be noted that the tensor in this embodiment is a four-dimensional tensor, namely batch, number of channels, height and width.

[0080] In the implementation, we need to process 10,000 images. We divide the images into batches, each with 64 images, and process eight batches at a time. The batch is the batch in which the images are located.

[0081] Step A12, inputting the encoded first initial feature map into the VGG feature extraction backbone module to obtain a second initial feature map;

[0082] It can be understood that the VGG feature extraction backbone module contains 5 convolution blocks in sequence. The first convolution block includes two convolution layers, each with 64 convolution kernels, followed by a maximum pooling layer. In the next three convolution blocks, each convolution block contains three convolution layers, and the number of convolution kernels in each convolution layer gradually increases from 128 to 256, and then to 512. Each convolution block is followed by a maximum pooling layer for downsampling. The last convolution block also contains three convolution layers, but at this time each convolution layer still maintains 512 convolution kernels, and finally ends with a maximum pooling layer.

[0083] Step A13, connecting the backbone network and the position encoding module of the second initial feature map together to perform four-fold feature fusion and eight-fold feature fusion to obtain a third initial feature fusion map.

[0084] It can be understood that the role of feature fusion is to help the model better learn the characteristics of the data by integrating information from different features, different data sources or different forms of expression.

[0085] In this implementation, feature fusion is used to enhance the model's ability to understand image locations and features, which helps to improve the accuracy and robustness of crowd counting in subsequent steps.

[0086] Step S20, obtaining a spatial element in the image feature according to the image feature, and treating the spatial element as a mark, wherein the mark has a length of H and a width of W;

[0087] It can be understood that a rectangle with a H*W of 4*2 cm and a rectangle with a H*W of 2*4 cm are generated according to the sparse image and the dense image respectively, and a crowd is selected according to the rectangle, and the rectangle after the crowd is selected is a mark, and the crowd is counted by the mark. This embodiment does not specifically limit the size of the rectangle, and the above size is the size corresponding to the optimal embodiment.

[0088] Reference Figure 2 , Figure 2 A schematic diagram of marking a crowd picture of the crowd counting method based on point query quadtree in this application.

[0089] Figure 2 The red rectangle is the rectangle generated by the dense image, and the yellow rectangle is the rectangle generated by the sparse image.

[0090] In this implementation, different types of labels are generated through sparse images and dense images respectively, which helps the model to process different types of people and improves processing efficiency.

[0091] Step S30, inputting the mark into a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain crowd information points, wherein the crowd information points generate candidate points where there may be people;

[0092] It can be understood that the encoding process is sinusoidal position encoding, which can be expressed as Formula 1 and Formula 2:

[0093]

[0094]

[0095] In the formula, p represents the position information, which increases from 0, i represents the dimension, which increases from 0, and d model Indicates the size of the model dimension.

[0096] In the specific implementation process, a model dimension size of 4 can meet the implementation requirements of this solution. This embodiment does not limit the model dimension size.

[0097] It should be noted that the crowd information points are selected from the marks at some points where there may be people. These points where there may be people are crowd information points, and the points with crowd information will generate candidate points around them. The probability of the existence of crowd information can be calculated through the crowd information points and candidate points.

[0098] In a feasible implementation manner, step S30 further includes steps A31 to A34:

[0099] Step A31, detecting whether the crowd information point and the candidate point have crowd information;

[0100] It is understandable that the crowd information points and candidate points can be processed according to the encoder's attention mechanism. The encoder's attention mechanism can clearly guide the model to focus on which parts of the input sequence, thereby enhancing the model's interpretability and helping the model to better process and understand the input. The encoder's attention calculation can be expressed as Formula 3 and Formula 4:

[0101]

[0102] In the formula, x l-1 represents the output feature of the encoder layer l-1, x l represents the output feature of the encoder layer l, x 0 RectWin-SA represents rectangular window self-attention, and LN represents layer normalization.

[0103]

[0104] In the formula, x l represents the output features of the encoder layer l, FFN represents feedforward neural network, and LN represents layer normalization.

[0105] Step A32, if there is crowd information, mark the crowd information point and candidate point as points to be counted;

[0106] It should be noted that when judging whether there is crowd information at the crowd information point and candidate point, if there is no personnel information at the location of the crowd information point and candidate point, and the marked content is inanimate objects such as roads and fire hydrants, the crowd information point and candidate point will not be counted.

[0107] Step A33, inputting the points to be counted into a quadtree encoder to obtain position codes of the points to be counted;

[0108] Step A34, locating the point to be counted according to the position code of the point by using a quadtree decoder, and decoding the point to be counted to obtain the probability of the existence of a crowd at the point to be counted.

[0109] It is understandable that the quadtree decoder encodes the positions of the points to be counted, decodes to obtain the specific positions of the points to be counted, and identifies the probability of the presence of a crowd in the mark where the points to be counted are located according to the specific positions of the points.

[0110] In this embodiment, the mark is encoded according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain crowd information points, wherein the crowd information points generate candidate points where people may be present. By position encoding the crowd information points and the candidate points, and calculating the crowd probability of the mark based on the crowd information points and the candidate points, it helps to better identify the people in the mark.

[0111] Step S40, outputting the crowd information points and candidate points to a quadtree decoder, so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result;

[0112] It should be noted that the quadtree is a tree data structure, where each node has up to four child nodes. Here, the quadtree decoder refers to the use of the quadtree structure to process and decode the relationship between crowd information points and candidate points. Through the quadtree structure, a large amount of point data can be organized and managed more efficiently, thereby accelerating the decoding process.

[0113] In addition, it should be noted that sparse crowd refers to the situation where there are relatively few people in the image, while dense crowd refers to the situation where there are relatively many people in the image. Through the decoding results, the density of the crowd in the image can be predicted, so as to perform corresponding processing and analysis.

[0114] In this implementation method, a quadtree decoder is used to analyze crowd information in an image, understand the relationship between crowds, and predict the density of the crowd in the image, i.e., whether it is a sparse crowd or a dense crowd, based on the decoding result, so that different treatments can be performed on dense and sparse crowds in the subsequent process.

[0115] Step S50, using the point query quadtree and the prediction head to process the sparse crowd and the dense crowd respectively, to obtain a sparse scene graph and a dense scene graph respectively;

[0116] It should be noted that the point query quadtree refers to the use of a quadtree to store and manage point data and to be able to perform efficient query operations on these points. In this step, the point query quadtree is used to process crowd information points and candidate points in the image for subsequent processing and analysis.

[0117] It should also be noted that the prediction head is the part that predicts and locates specific targets in the image. In this context, the prediction head is used to process sparse and dense crowds, that is, to predict the distribution of the crowd in the image and generate the corresponding scene graph accordingly. Sparse scene graphs and dense scene graphs are two different types of images generated according to the density of the crowd in the image. Sparse scene graphs refer to images generated when there are relatively few people in the image, while dense scene graphs refer to images generated when there are relatively more people in the image. By processing sparse and dense crowds with the prediction head, corresponding scene graphs can be generated to better understand and analyze the crowd situation in the image.

[0118] In this implementation method, the point query quadtree and the prediction head are used to process the sparse and dense crowds in the image to generate corresponding scene graphs for subsequent analysis and application.

[0119] Step S60, summing up the sparse query points and the dense query points in the sparse scene graph and the dense scene graph respectively, performing network optimization on the sparse scene graph and the dense scene graph, and obtaining a crowd counting result according to the summed result and the network optimization result.

[0120] It should be noted that network optimization refers to adjusting and updating the parameters of the neural network model to improve the performance and accuracy of the model. In this step, network optimization of sparse scene graphs and dense scene graphs refers to removing sparse query points and dense query points without crowd information to make them better adapt to the characteristics of sparse and dense scene graphs, thereby improving the accuracy of crowd counting.

[0121] In a feasible implementation, step S60 may include steps A61 to A64:

[0122] Step A61, calculating predicted classification probabilities based on sparse query points and dense query points;

[0123] It can be understood that the classification probability is whether the current crowd is a dense crowd or a sparse crowd. If it is a dense crowd, the classification probability is 1, and if it is a sparse crowd, the classification probability is 0.

[0124] Step A62, obtaining a network optimization result according to the predicted classification probability, hyperparameters, classification loss and positioning loss;

[0125] It can be understood that the result of network optimization can be expressed by Formula 5:

[0126]

[0127] In the formula, is the classification loss corresponding to the classification probability, and this classification loss needs to be summed. i is the index of the point query, c i and Indicates that the classification probability is 0 and 1, representing no one and someone, respectively. In this formula, only the classification loss with a classification probability of 1 is calculated, λ 1 is a hyperparameter, M is the number of layers, Represents the ground truth point y i Matching, resulting in positioning loss, where p σ(i) Represents probability.

[0128] Step A63, obtaining crowd density according to the maximum segmentation graph and the minimum segmentation graph;

[0129] It can be understood that the calculation of crowd density is expressed by formula 6:

[0130]

[0131] In the formula, dense represents density, M s is the segmentation map, which is equal to 1 if the input image has dense regions, otherwise it is equal to 0. If the crowd density of the image is high, we consider that the image has dense regions. We call each element in M ​​the probability of dense regions.

[0132] Step A64, obtaining a crowd counting result of the corresponding picture according to the network optimization result and the crowd density.

[0133] It can be understood that the crowd counting results of the corresponding pictures are obtained by combining the trained crowd counting positioning loss and classification loss, that is, the network optimization results and crowd density, with the trained weight files in the model.

[0134] This embodiment provides a crowd counting method based on a point query quadtree, which uses a VGG network to extract feature representations of input images. These features contain high-level abstract information of the image, which is helpful for subsequent processing. Spatial element tags are extracted from VGG features, and these tags are used to represent the position information and feature dimensions in the image. The tags are encoded using a quadtree encoder, and crowd information points are generated by considering the position information, dimensions and model dimensions of the tags, including candidate points that may contain people. The quadtree encoder can effectively organize and manage spatial information, improving computational efficiency and accuracy. The relationship between crowd information points and candidate points is decoded to predict the crowd density in the crowd image and judge it as a sparse crowd or a dense crowd. The point query quadtree and the prediction head are used to process the sparse crowd and the dense crowd respectively to obtain a sparse scene graph and a dense scene graph. The sparse scene graph and the dense scene graph are network optimized, and the results after summation are combined to finally obtain the crowd counting result. This embodiment uses the optimization algorithm and network structure in deep learning to improve the accuracy and robustness of crowd counting.

[0135] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 3 , for step S40, the crowd counting method based on point query quadtree further includes steps S41 to S45:

[0136] Step S41, dividing the crowd image into smaller areas through a quadtree decoder to obtain different local windows;

[0137] Reference Figure 4 , Figure 4 This is a schematic diagram of a local window of the crowd counting method based on point query quadtree in this application.

[0138] It can be understood that window partitioning is used for query embedding and query feature map. By splitting them into multiple small windows, the model can perform decoding operations independently on each window, which greatly improves computational efficiency. After decoding, the output results of each window are reassembled back to the original shape using a window inversion operation for subsequent processing or output. The processing flow is simplified. It directly uses the query feature map as the target feature for decoding instead of further window partitioning. In order to speed up the processing, it is not necessary to perform fine window operations when processing crowd images as in the training phase.

[0139] Step S42, calculating the quadtree decoder attention in the local window, and decoding the relationship between the crowd information point and the candidate point;

[0140] It should be noted that the quadtree decoder attention includes a first decoder attention, a second decoder attention and a third decoder attention.

[0141] It can be understood that the process of calculating the decoder attention is:

[0142] Based on the rectangular window self-attention of the first layer and the decoder attention of the first layer, layer-normalizing the rectangular window self-attention of the first layer and the decoder attention of the first layer to obtain the first decoder attention of the second layer;

[0143] It should be noted that the calculation of the first decoder attention of the second layer is expressed by Formula 7:

[0144]

[0145] In the formula, z l-1 and z l are the decoder attention of the l-1th and lth layers of the quadtree decoder, z 0 is initialized as a representation of a point query, RectWin-SA stands for rectangular window self-attention, and LN stands for layer normalization.

[0146] Based on the rectangular window cross attention of the second layer and the decoder attention of the second layer, layer-normalizing the rectangular window cross attention of the second layer and the decoder attention of the second layer to obtain the second decoder attention of the second layer;

[0147] It should be noted that the calculation of the second decoder attention of the second layer is expressed by Formula 8:

[0148]

[0149] In the formula, z l-1 and z l are the decoder attention of the l-1th and lth layers of the quadtree decoder, z 0 is initialized as a point query representation, RectWin-CA stands for rectangular window cross attention, x N represents the final output of the quadtree decoder, and LN represents layer normalization.

[0150] Based on the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network, the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network are layer-normalized to obtain a third decoder attention.

[0151] It should be noted that the calculation of the third decoder attention is expressed by Formula 9:

[0152]

[0153] In the formula, z l is the decoder attention of the lth layer of the quadtree decoder, FFN represents feed-forward neural network, and LN represents layer normalization.

[0154] Step S43, after decoding is completed, the output results of the local windows are recombined by window inversion to obtain the crowd picture;

[0155] Step S44, according to the decoding result, the point query of the candidate point and the context of the crowd information point are obtained to determine whether the point query of the crowd information point is a person;

[0156] Step S45 , predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the point query of the candidate point and the context of the crowd information point.

[0157] This embodiment provides a crowd counting method based on a point query quadtree. Through local window segmentation and decoding, a crowd picture is segmented into smaller areas by a quadtree decoder to obtain different local windows. The attention of the decoder is calculated in each local window, and the relationship between the crowd information point and the candidate point is decoded. This local window processing method can improve the calculation efficiency and better capture the local information in the image. By calculating the attention of the decoder in the local window, the relationship between the crowd information point and the candidate point can be decoded, so as to understand the distribution of the crowd in the local area. This helps to identify the difference between sparse and dense crowds and provide more detailed crowd density information. After decoding is completed, the output results of the local window are recombined by window inversion to obtain a complete crowd picture. This step ensures the integrity and accuracy of the decoding results and provides a reliable basis for subsequent analysis and prediction. According to the point query of the candidate point and the context of the crowd information point in the decoding result, the crowd in the crowd picture is predicted to be a sparse crowd or a dense crowd. This context-based prediction can more accurately judge the density of the crowd in the image, providing an important reference for subsequent decision-making and application.

[0158] Based on the first embodiment of the present application, in the third embodiment of the present application, the same or similar contents as those in the first embodiment can be referred to the above introduction, and will not be repeated in the following. On this basis, for step S50, the crowd counting method based on the point query quadtree also includes steps S51 to S52:

[0159] Step S51, if the crowd is a sparse crowd, obtain sparse query points, map the sparse query points to the picture, and obtain a sparse scene graph;

[0160] It can be understood that the sparse query point mapping process is as follows: First, each data point is mapped to a two-dimensional plane. This is the same as a normal scatter plot, and this step determines the position of each point on the graph. A kernel density estimation algorithm is applied to all data points. This step is accomplished by placing a "kernel" around each data point and then summing all kernels in the area covered by the entire data set, resulting in a density estimate for each position in the entire two-dimensional space.

[0161] Step S52, if the crowd is a dense crowd, traverse the entire dense area of ​​the image, adaptively segment the dense area of ​​the image to obtain dense query points, form a multi-layer quadtree based on the dense query points, and segment the dense area to form a dense scene graph.

[0162] It should be noted that adaptive segmentation is an image processing technology that aims to dynamically adjust the segmentation method and parameters according to the characteristics and needs of the image content to obtain the best segmentation results. It is different from the traditional segmentation method with fixed thresholds or predefined parameters. Instead, it automatically determines the segmentation method based on the internal features of the image.

[0163] In a feasible implementation, step S52 may include steps A51 to A55:

[0164] Step A51, evenly setting sparse query points on the crowd image to obtain the 0th layer of the quadtree, and segmenting the crowd image based on the quadtree to obtain a segmentation map;

[0165] It can be understood that sparse query points are evenly set on the image with a step size of K, which is equivalent to the 0th layer of the quadtree, and then the quadtree segmentor is applied to the encoded features to obtain a segmentation map Each element in Ms represents the probability of a dense area, where 1 represents a dense area and 0 represents a sparse area. R is the operator symbol, H represents the height of the window, and W represents the width of the window.

[0166] Step A52, each element in the segmentation map represents the probability of a region being dense, where 1 represents a dense region and 0 represents a sparse region;

[0167] Step A53, obtaining an initial dense area according to the elements, wherein the query points in the initial dense area are divided into dense query points to form a first-level quadtree;

[0168] Step A54, repeat the above process until the maximum segmentation time is reached, and a maximum segmentation layer quadtree is formed;

[0169] It is understandable that a multi-layer quadtree can be implemented by using a multi-layer quadtree splitter to predict the segmentation map at each layer. We can consider how many times the quadtree needs to split to solve the problem of dense areas.

[0170] Step A55, segmenting the dense area based on the maximum segmentation level quadtree.

[0171] The third embodiment can adopt different processing strategies for different crowd density scenes, so as to improve the accuracy and efficiency of crowd counting. At the same time, the solution can also dynamically adjust the segmentation strategy according to the actual situation to adapt to the processing requirements of different density scenes.

[0172] For example, to help understand the implementation process of the crowd counting method based on point query quadtree obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 5 , Figure 5 A brief flow chart of a crowd counting method based on point query quadtree is provided, specifically:

[0173] First, the image 3X512X512 to be recognized is input into the backbone network VGG-19, and VGG is used to extract image tag information. The attention window is used to efficiently recognize image information, and then the quadtree encoder is used to identify crowd information points and candidate points in the image. The darker purple and orange points in the image are crowd information points, and the lighter purple and orange points are candidate points. If it is a dense crowd, the dense scene graph is segmented by segmenting the quadtree, and the image is divided into quadtree level 0 and quadtree level 1, and the distance between points is K / 2. Then the quadtree decoder and prediction head are used to decode the above scene graph and determine whether there are people or not, and finally get the crowd counting result.

[0174] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the crowd counting method based on point query quadtree of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.

[0175] This application also provides a crowd counting device based on point query quadtree, please refer to Figure 6 , the crowd counting device based on point query quadtree includes:

[0176] The image feature extraction module 10 is used to upload the crowd image to the VGG feature extraction network and obtain the image features extracted by the VGG feature extraction network;

[0177] A feature information analysis module 20 is used to obtain a spatial element in the picture feature according to the picture feature, and regard the spatial element as a mark, where the mark has a length of H and a width of W;

[0178] A quadtree encoder encoding module 30, configured to input the mark into a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model, to obtain crowd information points, wherein the crowd information points generate candidate points where there may be people;

[0179] A quadtree decoder decoding module 40 is used to output the crowd information points and candidate points to a quadtree decoder, so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicts whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result;

[0180] A crowd processing module 50, used to process the sparse crowd and the dense crowd respectively using a point query quadtree and a prediction head to obtain a sparse scene graph and a dense scene graph respectively;

[0181] The crowd counting module 60 is used to sum the sparse query points and the dense query points in the sparse scene graph and the dense scene graph respectively, and perform network optimization on the sparse scene graph and the dense scene graph, and obtain the crowd counting result according to the summed result and the network optimization result.

[0182] The crowd counting device based on point query quadtree provided by the present application adopts the crowd counting method based on point query quadtree in the above embodiment, which can solve the technical problem of crowd counting based on point query quadtree. Compared with the prior art, the beneficial effect of the crowd counting device based on point query quadtree provided by the present application is the same as the beneficial effect of the crowd counting method based on point query quadtree provided by the above embodiment, and other technical features in the crowd counting device based on point query quadtree are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0183] The present application provides a crowd counting device based on a point query quadtree, and the crowd counting device based on a point query quadtree includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the crowd counting method based on the point query quadtree in the above-mentioned embodiment 1.

[0184] Reference below Figure 7, which shows a schematic diagram of the structure of a crowd counting device based on a point query quadtree suitable for implementing an embodiment of the present application. The crowd counting device based on a point query quadtree in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The crowd counting device based on point query quadtree shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0185] like Figure 7 As shown, the crowd counting device based on the point query quadtree may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the crowd counting device based on the point query quadtree are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the point query quadtree-based crowd counting device to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a point query quadtree-based crowd counting device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0186] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0187] The crowd counting device based on point query quadtree provided by the present application adopts the crowd counting method based on point query quadtree in the above embodiment, which can solve the technical problem of crowd counting based on point query quadtree. Compared with the prior art, the beneficial effect of the crowd counting device based on point query quadtree provided by the present application is the same as the beneficial effect of the crowd counting method based on point query quadtree provided by the above embodiment, and other technical features in the crowd counting device based on point query quadtree are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0188] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0189] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0190] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the crowd counting method based on point query quadtree in the above-mentioned embodiment.

[0191] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0192] The computer-readable storage medium may be included in the crowd counting device based on point query quadtree; or may exist independently without being assembled into the crowd counting device based on point query quadtree.

[0193] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the crowd counting device based on the point query quadtree, the computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof. The programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and a conventional procedural programming language, such as "C" language or similar programming languages. The program code can be executed completely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, through the Internet using an Internet service provider).

[0194] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0195] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0196] The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned crowd counting method based on point query quadtree, and can solve the technical problem of crowd counting based on point query quadtree. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the crowd counting method based on point query quadtree provided in the above-mentioned embodiment, and will not be repeated here.

[0197] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned point query quadtree-based crowd counting method when executed by a processor.

[0198] The computer program product provided by the present application can solve the technical problem of crowd counting based on point query quadtree. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the crowd counting method based on point query quadtree provided by the above embodiment, which will not be described in detail here.

[0199] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A crowd counting method based on point query quadtree, characterized in that: The method includes: Upload the crowd picture to the VGG feature extraction network to obtain the picture features extracted by the VGG feature extraction network; Obtain a spatial element in the image feature according to the image feature, and regard the spatial element as a mark, where the mark has a length of H and a width of W; Inputting the mark to a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain crowd information points, wherein the crowd information points generate candidate points where there may be people; Outputting the crowd information points and the candidate points to a quadtree decoder so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result; The sparse crowd and the dense crowd are processed respectively using a point query quadtree and a prediction head to obtain a sparse scene graph and a dense scene graph respectively; The sparse query points and the dense query points in the sparse scene graph and the dense scene graph are summed respectively, and the sparse scene graph and the dense scene graph are network optimized, and a crowd counting result is obtained according to the summed result and the network optimization result.

2. The method according to claim 1, characterized in that The marking is input into a quadtree encoder so that the quadtree encoder encodes the marking according to the position information of the marking, the dimension of the marking and the dimension of the model to obtain a crowd information point, wherein after the crowd information point generates a candidate point where a person may be present, the method further comprises: Detecting whether the crowd information point and the candidate point have crowd information; If there is crowd information, mark the crowd information points and candidate points as points that need to be counted; Input the points to be counted into a quadtree encoder to obtain position codes of the points to be counted; The points to be counted are located according to the position codes of the points by a quadtree decoder, and the points to be counted are decoded to obtain the probability of the existence of a crowd at the points to be counted.

3. The method according to claim 1, characterized in that The step of outputting the crowd information points and candidate points to a quadtree decoder, decoding the relationship between the crowd information points and the candidate points by the quadtree decoder, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result comprises: The crowd image is divided into smaller regions through a quadtree decoder to obtain different local windows; Calculate the quadtree decoder attention within the local window and decode the relationship between crowd information points and candidate points; After decoding is completed, the output results of the local windows are recombined by window inversion to obtain the crowd picture; According to the decoding result, the point query of the candidate point and the context of the crowd information point are obtained to determine whether the point query of the crowd information point is a person; The crowd in the crowd picture is predicted to be a sparse crowd or a dense crowd according to the point query of the candidate point and the context of the crowd information point.

4. The method according to claim 3, characterized in that The quadtree decoder attention includes a first decoder attention, a second decoder attention, and a third decoder attention, and the calculating of the quadtree decoder attention in the local window includes: Based on the rectangular window self-attention of the first layer and the decoder attention of the first layer, layer-normalizing the rectangular window self-attention of the first layer and the decoder attention of the first layer to obtain the first decoder attention of the second layer; Based on the rectangular window cross attention of the second layer and the decoder attention of the second layer, layer-normalizing the rectangular window cross attention of the second layer and the decoder attention of the second layer to obtain the second decoder attention of the second layer; Based on the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network, the first decoder attention of the second layer and the second decoder attention of the second layer after being processed by the feedforward neural network are layer-normalized to obtain a third decoder attention.

5. The method according to claim 1, characterized in that The point query quadtree and the prediction head are used to process the sparse crowd and the dense crowd respectively to obtain a sparse scene graph and a dense scene graph respectively, including: If the crowd is a sparse crowd, obtain sparse query points, and map the sparse query points to the picture to obtain a sparse scene graph; If the crowd is a dense crowd, the entire dense area of ​​the image is traversed, the dense area of ​​the image is adaptively segmented to obtain dense query points, a multi-layer quadtree is formed based on the dense query points, and the multi-layer quadtree segments the dense area to form a dense scene graph.

6. The method according to claim 5, characterized in that The step of adaptively segmenting the dense area of ​​the image to obtain dense query points, forming a multi-layer quadtree based on the dense query points, and segmenting the dense area by the multi-layer quadtree includes: Evenly setting sparse query points on the crowd image to obtain the 0th layer of the quadtree, and segmenting the crowd image based on the quadtree to obtain a segmentation map; Each element in the segmentation map represents the probability that a region is dense, where 1 represents a dense region and 0 represents a sparse region; An initial dense area is obtained according to the elements, and query points in the initial dense area are divided into dense query points to form a first-level quadtree; Repeat the above process until the maximum segmentation time is reached, forming a maximum segmentation layer quadtree; Based on the maximum segmentation level quadtree, dense areas are segmented.

7. The method according to claim 1, characterized in that The steps of summing up the sparse query points and the dense query points in the sparse scene graph and the dense scene graph, performing network optimization on the sparse scene graph and the dense scene graph, and obtaining a crowd counting result according to the summed result and the network optimization result include: The predicted classification probability is calculated based on the sparse query points and the dense query points; Obtaining a network optimization result according to the predicted classification probability, hyperparameters, classification loss, and positioning loss; The crowd density is obtained according to the maximum segmentation map and the minimum segmentation map; According to the network optimization result and the crowd density, a crowd counting result of the corresponding picture is obtained.

8. A crowd counting device based on point query quadtree, characterized in that: The device comprises: An image feature extraction module is used to upload a crowd image to the VGG feature extraction network and obtain image features extracted by the VGG feature extraction network; A feature information analysis module, used for obtaining a spatial element in the picture feature according to the picture feature, and treating the spatial element as a mark, where the mark has a length of H and a width of W; A quadtree encoder encoding module, used for inputting the mark into a quadtree encoder, so that the quadtree encoder encodes the mark according to the position information of the mark, the dimension of the mark and the dimension of the model to obtain a crowd information point, wherein the crowd information point generates a candidate point where a person may be present; A quadtree decoder decoding module, used for outputting the crowd information points and candidate points to a quadtree decoder, so that the quadtree decoder decodes the relationship between the crowd information points and the candidate points, and predicting whether the crowd in the crowd picture is a sparse crowd or a dense crowd according to the decoding result; A crowd processing module, used to process the sparse crowd and the dense crowd respectively using a point query quadtree and a prediction head to obtain a sparse scene graph and a dense scene graph respectively; The crowd counting module is used to sum the sparse query points and the dense query points in the sparse scene graph and the dense scene graph respectively, and perform network optimization on the sparse scene graph and the dense scene graph, and obtain the crowd counting result according to the summed result and the network optimization result.

9. A crowd counting device based on point query quadtree, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the crowd counting method based on point query quadtree as claimed in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the crowd counting method based on point query quadtree as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Crowd counting method and system based on crisscross attention network

    CN112766123A

  • Quadtree-based SIFT (scale invariant feature transform) and depth feature combined image retrieval method

    CN115329115A

  • Crowd counting method and device in complex scene

    CN115527164A

  • Crowd counting method and system based on improved VGG16 network, and storage medium

    CN116071709A