Adaptive crowd density estimation method and system based on crowd density scoring function

CN122551277APending Publication Date: 2026-08-11上海威士顿信息技术股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-15
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]本发明的目的在于提供一种基于人员密度打分函数的自适应人员密度估算方法及系统,以解决现有方法对监控视角跨度大的场景下适配性差、密度量化不准确的技术问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122551277A_ABST
    Figure CN122551277A_ABST
Patent Text Reader

Abstract

This invention relates to an adaptive crowd density estimation method and system based on a crowd density scoring function, belonging to the fields of machine vision and crowd detection technology. The method acquires a rectangular detection box for each person in an image using a crowd detection algorithm and extracts geometric features. It calculates the pixel length in the standing direction of each person and determines square search regions of various sizes. Then, based on the crowd density scoring function, it searches for crowd density across a large viewing angle using square search regions of different sizes. The pixel lengths in the standing direction within each square search region are summed to obtain a cumulative crowd density score. Finally, the crowd density is determined based on this cumulative crowd density score. This invention achieves crowd density detection across a large viewing angle by relying on a crowd density scoring function and adaptive multi-size square search regions, solving the problem that traditional crowd density estimation methods cannot accurately estimate crowd density across large viewing angles due to the principle that near objects appear larger than distant objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine vision and crowd detection technology, and in particular to an adaptive crowd density estimation method and system based on a crowd density scoring function. Background Technology

[0002] In scenarios such as public safety, smart security, and venue management, real-time and accurate estimation of personnel density is crucial, providing data support for crowd control, emergency response, and resource allocation. Current personnel density estimation methods are mainly divided into detection methods based on traditional machine vision and regression methods based on deep learning. Among them, traditional detection methods rely on manually designed feature extraction operators, which have poor adaptability to camera perspective. When the camera's field of view can see both near and far objects, the perspective range varies greatly due to the principle of near objects appearing larger than distant objects, which can easily lead to large estimation errors when simultaneously estimating the distribution density of near and distant objects.

[0003] Meanwhile, existing density estimation methods mostly use fixed-size detection windows for regional density statistics, which cannot adaptively adjust according to the actual size of the detection boxes for people in the image. When there are large differences in the distance of people in the image (i.e., the camera's field of view is wide and the viewing angle span is large), the fixed detection window will result in overly dense counting of people in the foreground and underly sparse counting of people in the background. On the other hand, when the camera's field of view is narrow, the fixed detection window will result in low density quantization accuracy due to its size mismatch. In addition, although manually fine-tuning the detection window size for each camera can solve some of the above problems, the implementation process is time-consuming and labor-intensive, making it difficult to achieve low-cost large-scale deployment. As a result, areas with a large number of surveillance cameras are monitored, but the data can only be retrieved afterward, without the ability to analyze and provide early warnings in real time.

[0004] Therefore, how to improve the adaptability of cameras with arbitrary viewing angles while simultaneously enhancing the accuracy of personnel detection and density quantification has become a pressing technical problem to be solved in the field of personnel density estimation for current security monitoring. Summary of the Invention

[0005] The purpose of this invention is to provide an adaptive personnel density estimation method and system based on a personnel density scoring function, so as to solve the technical problems of poor adaptability and inaccurate density quantification of existing methods in scenarios with a large span of monitoring perspectives.

[0006] To achieve the above objectives, this invention provides an adaptive population density estimation method based on a population density scoring function, comprising the following steps:

[0007] S1. Obtain the image to be detected, and detect each person in the image using a person detection algorithm. Obtain the pixel position and rectangular detection box size of each person, and extract the pixel coordinates of the center point and the length of the longest side of the rectangular detection box.

[0008] S2. Identify the angle between the standing direction of each person and the longest side of the rectangular detection box using a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the length of the longest side.

[0009] S3. Calculate the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for three levels, and construct an adaptive density detection level set based on these parameters.

[0010] S4. Construct a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates.

[0011] S5. Based on the personnel density scoring function, traverse the center point coordinates of each person, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score of each person's pixel coordinate point.

[0012] S6. Compare the accumulated value of the personnel density score with the preset density threshold to determine the personnel density level in the image.

[0013] Optionally, in S1, extracting the center pixel coordinates and the longest side dimension of the rectangular detection box includes:

[0014] Extract the geometric feature parameters of the rectangular detection box, the geometric feature parameters including the coordinates of the upper left corner (x, y, y). min , y min ), lower right corner coordinates (x max , y max Width w=x max -x min Height h=y max -y min ;

[0015] Based on the geometric feature parameters, derived features are calculated, including the X coordinate of the center point (center). x =(x min +x max ) / 2, Y-coordinate of the center point y =(y min +y max ) / 2, the longest side dimension side =max(w, h).

[0016] Optionally, in S2, calculating the pixel length of each person's standing direction based on the included angle and the longest side dimension includes:

[0017] Obtain the angle α between the person's standing direction and the longest side of the rectangular detection frame, and the pixel length c of the longest side of the rectangular detection frame, using the formula... The pixel length of the person's standing height was calculated.

[0018] Optionally, in S3, the maximum value, the minimum value, and the median value are respectively used as half-side length parameters for constructing three levels of square search areas; wherein, the maximum value is adapted to the density statistics of small-sized people in the distance, the minimum value is adapted to the density statistics of large-sized people in the foreground, and the median value is adapted to the density statistics of medium-sized people in the mid-ground.

[0019] Optionally, in S4, the personnel feature dataset adopts a data structure in the form of a list plus a dictionary. The center point pixel coordinates, the pixel length of the personnel standing direction, and the cumulative value of the personnel density score of each personnel are stored in the corresponding dictionary according to the fields to form a complete personnel feature list.

[0020] Optionally, in S5, the calculation method for the personnel density scoring function is as follows:

[0021] The initial cumulative score for the target personnel's population density is set to 0.

[0022] Based on the half-side length parameter of the square search area for each gear, a square search area centered on the target person's center point (x0, y0) is defined.

[0023] Traverse all other people in the image except the target person. If the center point coordinates of the target person fall within the square search area, then add the pixel length of the target person's standing direction to the target person's personnel density score accumulation value.

[0024] The cumulative calculation of the square search areas at the three levels is completed in sequence to obtain the final cumulative score of the target personnel density.

[0025] Optionally, in S5, when accumulating the pixel lengths of the standing direction of all people within each square search area, if the square search area exceeds the image boundary, it is automatically truncated to the image edge, and only the pixel lengths of the standing direction of people within the image boundary are accumulated.

[0026] Optionally, in S6, the preset density threshold is dynamically configured according to the camera field of view and crowd control requirements of the actual application scenario. If the cumulative value of the personnel density score is greater than the density threshold, the area is determined to be a densely populated area; otherwise, it is a normal area.

[0027] Based on the same inventive concept, this invention also provides an adaptive population density estimation system based on a population density scoring function, comprising:

[0028] The image acquisition module is used to acquire the image to be detected;

[0029] The personnel detection module is used to detect each person in the image using a personnel detection algorithm, obtain the pixel position and rectangular detection box size of each person, and extract the center point pixel coordinates and the longest side size of the rectangular detection box.

[0030] The personnel standing height calculation module is used to identify the angle between the standing direction of each person and the longest side of the rectangular detection box through a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the size of the longest side.

[0031] The gear determination module is used to count the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for the three gears, and use them to construct an adaptive density detection gear set.

[0032] The data construction module is used to build a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates;

[0033] The density scoring module is used to traverse the center point coordinates of each person based on the personnel density scoring function, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score value of each person's pixel coordinate point.

[0034] The density determination module is used to compare the cumulative value of the personnel density score with a preset density threshold to determine the personnel density level in the image.

[0035] Based on the same inventive concept, the present invention also provides a readable storage medium having a computer program stored thereon, which, when executed, can implement the adaptive personnel density estimation method based on the personnel density scoring function as described above.

[0036] The adaptive population density estimation method and system based on population density scoring function provided by this invention has at least one of the following beneficial effects:

[0037] 1) Adaptive multi-level detection box to accommodate differences in personnel size: Based on the actual height of the personnel in the rectangular detection box in the image, three levels of square search areas are dynamically generated instead of using a fixed size. This achieves adaptation to the size distribution of people in the foreground, middle ground, and background of the image, avoids density statistical deviation caused by a fixed window, and improves the accuracy of density estimation under different fields of view.

[0038] 2) The personnel density scoring function achieves accurate density quantification: The designed personnel density scoring function uses a multi-level square search area as the search range. It quantifies the density by accumulating the pixel length of the standing direction of the personnel in the area. It incorporates the actual size of the personnel into the density statistics, so that the density score can truly reflect the density of personnel in the area. The quantification results are highly interpretable, less affected by the size of people at different distances from a wide span of view, and the threshold can be flexibly adjusted according to the needs of the scene.

[0039] 3) Visual large model achieves arbitrary field of view adaptation: The visual large model is used to identify the standing direction and angle of people. This model has a powerful cross-field of view feature extraction capability and can adapt to people in camera field of view images at any distance. There is no need to train or calibrate the model for a specific field of view. This solves the problem of poor field of view adaptability of traditional detection models and greatly improves the detection accuracy and general performance in different field of view scenarios.

[0040] 4) Flexible and scalable system architecture: The decoupled design of each module allows for the replacement of the visual VL large model, adjustment of the number of levels in the density scoring function, and modification of the output format according to actual needs, giving it strong scalability and engineering practicality. Attached Figure Description

[0041] Those skilled in the art will understand that the accompanying drawings are provided to better understand the invention and do not constitute any limitation on the scope of the invention. Wherein:

[0042] Figure 1 A flowchart illustrating an adaptive personnel density estimation method based on a personnel density scoring function provided in an embodiment of the present invention;

[0043] Figure 2 This is a schematic diagram of a rectangular detection frame and its center point annotation provided in an embodiment of the present invention;

[0044] Figure 3 This is a schematic diagram of a multi-level square search area provided in an embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram illustrating the personnel density scoring results and the threshold for determining the warning range of personnel density according to an embodiment of the present invention;

[0046] Figure 5This is a structural block diagram of an adaptive personnel density estimation system based on a personnel density scoring function, provided in an embodiment of the present invention. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0048] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0049] In the description of this invention, it should be understood that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product is in use, or the orientation or positional relationship commonly understood by those skilled in the art. They are only used to facilitate the description of this invention and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0050] Furthermore, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the article or apparatus that includes said element. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0051] Please refer to Figure 1 This invention provides an adaptive population density estimation method based on a population density scoring function, comprising the following steps:

[0052] S1. Obtain the image to be detected, and detect each person in the image using a person detection algorithm. Obtain the pixel position and rectangular detection box size of each person, and extract the pixel coordinates of the center point and the length of the longest side of the rectangular detection box.

[0053] S2. Identify the angle between the standing direction of each person and the longest side of the rectangular detection box using a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the length of the longest side.

[0054] S3. Calculate the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for three levels, and construct an adaptive density detection level set based on these parameters.

[0055] S4. Construct a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates.

[0056] S5. Based on the personnel density scoring function, traverse the center point coordinates of each person, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score of each person's pixel coordinate point.

[0057] S6. Compare the accumulated value of the personnel density score with the preset density threshold to determine the personnel density level in the image.

[0058] This method uses a people detection algorithm to obtain a rectangular detection box for each person in an image and extracts geometric features. It calculates the pixel length in the standing direction of each person and determines square search regions of various sizes. Then, based on a people density scoring function, it searches for the density of people across a large viewing angle using square search regions of different sizes. The pixel lengths in the standing direction of all people within each square search region are summed to obtain a cumulative people density score. Finally, the crowd density is determined based on this cumulative score. This invention relies on a people density scoring function and adaptive multi-size square search regions to achieve people density detection across a large viewing angle, solving the problem that traditional people density estimation methods cannot accurately estimate people density in situations with large viewing angles where near objects appear larger than distant objects. It achieves high-precision estimation of people density even in scenes with large viewing angles.

[0059] First, execute S1 to acquire the image to be detected. Then, use a person detection algorithm to detect each person in the image, obtaining the pixel position and rectangular detection box size for each person. Finally, extract the center pixel coordinates and the longest side size of the rectangular detection box. For example... Figure 2 As shown, Figure 2 The red rectangle in the image represents the rectangular detection box for each person in the image, and the bright spot in the center of the person represents the center point of the rectangular detection box.

[0060] In this embodiment, extracting the center pixel coordinates and the longest side dimension of the rectangular detection box includes:

[0061] Extract the geometric feature parameters of the rectangular detection box, the geometric feature parameters including the coordinates of the upper left corner (x, y, y). min , y min ), lower right corner coordinates (x max , y max Width w=x max -x min Height h=y max -y min ;

[0062] Based on the geometric feature parameters, derived features are calculated, including the X coordinate of the center point (center). x =(x min +x max ) / 2, Y-coordinate of the center point y =(y min +y max ) / 2, the longest side dimension side =max(w, h), and the shortest side size. side =min(w, h).

[0063] Then, S2 is executed, which uses a pre-trained visual large model to identify the angle between the standing direction of each person and the longest side of the rectangular detection box, and calculates the pixel length of the standing direction of each person based on the angle and the length of the longest side.

[0064] In this embodiment, calculating the pixel length of each person's standing direction based on the included angle and the longest side dimension includes:

[0065] The angle α between the person's standing direction and the longest side of the rectangular detection frame, and the pixel length c of the longest side of the rectangular detection frame are obtained. The pixel length l of the person's standing height is then calculated using the formula l=c / cosα. This formula takes into account the angle between the person's standing direction and the longest side of the rectangular detection frame, effectively correcting for height measurement errors caused by the person's posture or perspective distortion, and obtaining a pixel length that is closer to the actual physical height.

[0066] Next, execute S3 to count the pixel length of all people standing in the direction of standing, determine the maximum value, minimum value and the average of the maximum value and minimum value as the median value, use these three values ​​as half-side length parameters to construct the square search area of ​​the three levels, and construct the adaptive density detection level set accordingly.

[0067] In this embodiment, the sizes of the three square search areas are dynamically generated based on the pixel length of the standing height of the person, without a fixed preset value, to achieve adaptive adaptation to the size distribution of people in the image. The maximum value, the minimum value, and the median value are respectively used as half-side length parameters for constructing the three square search areas; wherein, the maximum value is adapted to the density statistics of small-sized people in the distance, the minimum value is adapted to the density statistics of large-sized people in the foreground, and the median value is adapted to the density statistics of medium-sized people in the mid-ground.

[0068] like Figure 3 As shown, Figure 3 This diagram illustrates the multi-level square search area construction process of this invention. A relatively dense group of people is shown on the left side. To demonstrate the coverage of different levels, [the diagram shows...]. Figure 3 Two square search areas of different sizes are drawn in the image. The largest red square represents the square search area built based on the maximum value level, with a larger side length, which can accommodate people from a greater distance into the statistical range; the smaller blue square represents the square search area built based on the intermediate value level; and the smallest green square represents the square search area built based on the minimum value level.

[0069] Then execute S4 to build a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates.

[0070] In this embodiment, the personnel feature dataset adopts a list plus dictionary data structure. The center point pixel coordinates (including the X and Y coordinates of the center point), the pixel length of the person's standing direction, and the accumulated personnel density score for each person are stored as fields in the corresponding dictionary, forming a complete personnel feature list. This data structure can flexibly store any number of personnel features, adapting to changes in the number of personnel detected under different field of view.

[0071] Next, step S5 is executed. Based on the personnel density scoring function, the center point coordinates of each person are traversed. Square search areas of different levels are constructed using the three half-side length parameters. The pixel lengths of all people in the standing direction within each square search area are accumulated to obtain the accumulated personnel density score for each person's pixel coordinates. This personnel density scoring function is the core of this invention. Its core logic is based on an adaptive multi-level square search area, performing layered density statistics on the surrounding area of ​​each person. Density quantification is achieved by accumulating the longest side size, avoiding statistical bias caused by a fixed window.

[0072] In this embodiment, the calculation method of the personnel density scoring function is as follows:

[0073] The initial cumulative score for the target personnel's population density is set to 0.

[0074] Based on the half-side length parameter k of the square search area for each gear position, a square search area is defined centered on the target person's center point (x0, y0). The coordinates of the four vertices of this square search area are: x min =x0-k, x max =x0+k、y min =y0-k、y max =y0+k, which means that the length and width of the square search region are both twice the half-side length parameter k.

[0075] Traverse all other people in the image except the target person. If the center point coordinates of the target person fall within the square search area, then add the pixel length of the target person's standing direction to the target person's personnel density score accumulation value.

[0076] The cumulative calculation of the square search areas at the three levels is completed in sequence to obtain the final cumulative score of the target personnel density.

[0077] Preferably, when accumulating the pixel lengths of all people in the standing direction within each square search area, if the square search area exceeds the image boundary, it is automatically truncated to the image edge, and only the pixel lengths of people in the standing direction within the image boundary are accumulated, so as to ensure the accuracy of the calculation results.

[0078] Finally, step S6 is executed to compare the accumulated population density score with a preset density threshold to determine the population density level in the image. In this embodiment, the density threshold is a configurable parameter stored in a configuration file. Users can dynamically adjust it according to the actual application scenario (such as shopping malls, stations, stadiums, residential areas, etc.) and the camera's field of view and crowd control requirements. For example, in a station scene with a wide field of view, the threshold can be set to 500, while in a residential area scene with a narrow field of view, the threshold can be set to 200. The density level is divided into "dense" and "normal". If the accumulated population density score is greater than the threshold, it is determined to be a densely populated area; otherwise, it is a normal area.

[0079] like Figure 4 As shown, Figure 4 The system displays the population density scoring results and the warning range for determining population density based on thresholds. After determining the half-side length parameters for three levels, the system iterates through every person in the image. Taking a person in the clustered area on the left side of the image as an example, the system constructs three square search areas of different sizes centered on that person. During the iteration, if the center point of other people falls within these square search areas, their feature values ​​are added to the accumulated population density score of the center person. After layer-by-layer accumulation and comprehensive evaluation across the three levels, the system finally generates a population density distribution heatmap for the entire image, as shown below. Figure 4 The medium-colored polygonal coverage area is shown, indicating a total of 14 people in the image, with 11 people within the square search area. This multi-scale accumulation method effectively integrates density information from different visual ranges.

[0080] Based on the same inventive concept, such as Figure 5 As shown in the figure, this invention also proposes an adaptive population density estimation system based on a population density scoring function, comprising:

[0081] Image acquisition module 100 is used to acquire the image to be detected;

[0082] The personnel detection module 200 is used to detect each person in the image using a personnel detection algorithm, obtain the pixel position and rectangular detection box size of each person, and extract the center point pixel coordinates and the longest side size of the rectangular detection box.

[0083] The personnel standing height calculation module 300 is used to identify the angle between the standing direction of each person and the longest side of the rectangular detection box through a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the length of the longest side.

[0084] The gear determination module 400 is used to count the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for the three gears, and use them to construct an adaptive density detection gear set.

[0085] Data construction module 500 is used to construct a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates;

[0086] The density scoring module 600 is used to traverse the center point coordinates of each person based on the personnel density scoring function, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score of each person's pixel coordinate point.

[0087] The density determination module 700 is used to compare the cumulative value of the personnel density score with a preset density threshold to determine the personnel density level in the image.

[0088] Since the adaptive personnel density estimation system based on personnel density scoring function provided by this invention belongs to the same inventive concept as the adaptive personnel density estimation method based on personnel density scoring function described above, the adaptive personnel density estimation system based on personnel density scoring function provided by this invention has all the advantages of the adaptive personnel density estimation method based on personnel density scoring function described above. Therefore, the beneficial effects of the adaptive personnel density estimation system based on personnel density scoring function provided by this invention will not be elaborated here.

[0089] The following specific example further illustrates the adaptive personnel density estimation method and system based on personnel density scoring function provided by this invention.

[0090] In this example, the image to be detected is a wide-field fisheye surveillance image of the station hall, with a resolution of 1920×1080 and a preset density threshold of 500. The specific steps are as follows:

[0091] S1. Image Acquisition and Personnel Detection: A 1920×1080 surveillance image of the station hall is acquired via the image acquisition module. No additional preprocessing is required; the Qianwen VL large model is directly called for personnel detection, resulting in rectangular detection boxes for 30 people in the image. The top-left corner coordinates (x, y, y) of each detection box are extracted. min , y min ) and the coordinates of the lower right corner (x max , y max The width w, height h, and center point center are calculated.x center y Longest side side Shortest side side For example, the detection box for a person in close-up view is 80 pixels wide and 180 pixels high; the detection box for a person in distant view is 20 pixels wide and 45 pixels high, with the longest side being 50 pixels.

[0092] S2. Due to the use of a fisheye lens, the person's posture is somewhat distorted. Using a large visual model, the standing angle of the person in the foreground is identified as 10 degrees. Therefore, the standing height... The angle between the standing figures in the distance and their actual positions is -7 degrees. .

[0093] S3. Adaptive Gear Determination: The standing height of 30 people is statistically analyzed to obtain the maximum value K1=182.8 pixels and the minimum value K2=50.4 pixels. The median value K3=(182.8+50.4) / 2=116.6 pixels is calculated, and the set of three-gear density detection frame sizes K=[182.8, 116.6, 50.4].

[0094] S3. Personnel Feature Data Construction: Construct a personnel feature data structure in the form of List[Dict]. Assign a unique index 0~29 to each of the 30 personnel. Store the center point pixel coordinates, the pixel length of the personnel's standing direction, and the cumulative value of the personnel density score of each personnel into the corresponding dictionary according to the fields to form a complete personnel feature list.

[0095] S5. Density Score Calculation: Based on the personnel density scoring function, iterate through each person indices 0-29. Using their center point as the center, define square search areas of different sizes with dimensions of 182.8, 116.6, and 50.4 pixels respectively. Accumulate the standing heights of other people within each area. For example, the center point coordinates of the person in index 0 are (960, 540). The search area with a size of 182.8 pixels is (777.2, 357.2) to (1142.8, 722.8). There are 5 people in this area, and the sum of their standing heights is 855.5. There are 3 people in the search area with a size of 116.6 pixels, and the sum is 424.1. There is 1 person in the search area with a size of 50.4 pixels, and the sum is 182.8. The final density score for this person is 855.5 + 424.1 + 182.8 = 1462.4.

[0096] S6. Density Level Determination: Compare the density score of each person with a preset threshold, such as 500. If the cumulative density score of the person in index 0 is 1462.4 > 500, it is determined to be a dense area; if the cumulative density score of the person in index 15 is 120 < 500, it is determined to be a normal area.

[0097] Based on the same inventive concept, embodiments of the present invention also propose a readable storage medium storing a computer program thereon, which, when executed, can implement the adaptive personnel density estimation method based on the personnel density scoring function as described above.

[0098] A readable storage medium can be a tangible device capable of holding and storing instructions for use by an instruction execution device, such as, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer programs described herein can be downloaded from the readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. Networks can include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. Each computing / processing device's network adapter card or network interface receives and forwards a computer program from the network for storage on a readable storage medium within the respective computing / processing device. The computer program used to perform the operations of this invention can be execution instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" or similar languages. The computer program can execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuits, such as programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), are personalized by utilizing state information from a computer program. These electronic circuits can execute computer-readable program instructions, thereby realizing various aspects of the present invention.

[0099] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, systems, and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by a computer program. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. These computer programs can also be stored in a readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the readable storage medium storing the computer program comprises an article of manufacture including instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams.

[0100] A computer program may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the computer program executing on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0101] Since the readable storage medium provided by this invention belongs to the same inventive concept as the adaptive personnel density estimation method based on the personnel density scoring function described above, the readable storage medium provided by this invention has all the advantages of the adaptive personnel density estimation method based on the personnel density scoring function described above. Therefore, the beneficial effects of the readable storage medium provided by this invention will not be described in detail here.

[0102] In summary, this invention provides an adaptive personnel density estimation method and system based on a personnel density scoring function. This method can be widely applied in industrial fields such as smart security, public venue management, transportation hub control, and commercial complex operation, enabling real-time and accurate estimation of personnel density under arbitrary camera field of view. The method's steps are clear and easy to implement in engineering. The system modules are decoupled and highly scalable, allowing direct deployment on existing monitoring systems and artificial intelligence analysis platforms without large-scale modifications to existing hardware. It possesses excellent industrial practicality and market application prospects.

[0103] The above description is merely a description of preferred embodiments of the present invention and is not intended to limit the scope of the invention in any way. Any changes or modifications made by those skilled in the art based on the above disclosure are within the protection scope of the present invention. Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the present invention and its equivalents, the present invention also intends to include these modifications and variations.

Claims

1. An adaptive population density estimation method based on a population density scoring function, characterized in that, Includes the following steps: S1. Obtain the image to be detected, and detect each person in the image using a person detection algorithm. Obtain the pixel position and rectangular detection box size of each person, and extract the pixel coordinates of the center point and the length of the longest side of the rectangular detection box. S2. Identify the angle between the standing direction of each person and the longest side of the rectangular detection box using a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the length of the longest side. S3. Calculate the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for three levels, and construct an adaptive density detection level set based on these parameters. S4. Construct a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates. S5. Based on the personnel density scoring function, traverse the center point coordinates of each person, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score of each person's pixel coordinate point. S6. Compare the accumulated value of the personnel density score with the preset density threshold to determine the personnel density level in the image.

2. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S1, extracting the center pixel coordinates and the longest side dimension of the rectangular detection box includes: extracting geometric feature parameters of the rectangular detection frame, the geometric feature parameters including upper left corner coordinates (x min , y min ) of the rectangular detection frame, right bottom corner coordinates (x max , y max ), width w=x max -x min , and height h=y max -y min ; based on the geometric feature parameters, derive features, including a center point X coordinate center x = (x min + x max ) / 2, a center point Y coordinate center y = (y min + y max ) / 2, and a longest side size longest side = max (w, h).

3. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S2, calculating the pixel length of each person's standing direction based on the included angle and the longest side dimension includes: Obtain the angle α between the person's standing direction and the longest side of the rectangular detection frame, and the pixel length c of the longest side of the rectangular detection frame, using the formula... The pixel length of the person's standing height was calculated.

4. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S3, the maximum value, the minimum value, and the median value are respectively used as half-side length parameters for constructing three levels of square search areas; wherein, the maximum value is adapted to the density statistics of small-sized people in the distance, the minimum value is adapted to the density statistics of large-sized people in the foreground, and the median value is adapted to the density statistics of medium-sized people in the mid-ground.

5. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S4, the personnel feature dataset adopts a data structure in the form of a list plus a dictionary. The center point pixel coordinates, the pixel length of the personnel standing direction, and the cumulative value of the personnel density score of each personnel are stored in the corresponding dictionary according to the fields to form a complete personnel feature list.

6. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S5, the calculation method for the personnel density scoring function is as follows: The initial cumulative score for the target personnel's population density is set to 0. Based on the half-side length parameter of the square search area for each gear, a square search area centered on the target person's center point (x0, y0) is defined. Traverse all other people in the image except the target person. If the center point coordinates of the target person fall within the square search area, then add the pixel length of the target person's standing direction to the target person's personnel density score accumulation value. The cumulative calculation of the square search areas at the three levels is completed in sequence to obtain the final cumulative score of the target personnel density.

7. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S5, when accumulating the pixel lengths of the standing direction of all people within each square search area, if the square search area exceeds the image boundary, it is automatically truncated to the image edge, and only the pixel lengths of the standing direction of people within the image boundary are accumulated.

8. The adaptive population density estimation method based on a population density scoring function according to claim 1, characterized in that, In S6, the preset density threshold is dynamically configured according to the camera field of view and crowd control requirements of the actual application scenario. If the cumulative value of the personnel density score is greater than the density threshold, the area is determined to be a densely populated area; otherwise, it is a normal area.

9. An adaptive population density estimation system based on a population density scoring function, characterized in that, include: The image acquisition module is used to acquire the image to be detected; The personnel detection module is used to detect each person in the image using a personnel detection algorithm, obtain the pixel position and rectangular detection box size of each person, and extract the center point pixel coordinates and the longest side size of the rectangular detection box. The personnel standing height calculation module is used to identify the angle between the standing direction of each person and the longest side of the rectangular detection box through a pre-trained visual large model, and calculate the pixel length of the standing direction of each person based on the angle and the size of the longest side. The gear determination module is used to count the pixel length of all people standing in the direction of standing, determine the maximum value, the minimum value and the average value of the maximum value and the minimum value as the median value, use these three values ​​as half-side length parameters of the square search area for the three gears, and use them to construct an adaptive density detection gear set. The data construction module is used to build a personnel feature dataset, record the center point pixel coordinates and the pixel length of the standing direction for each person, and initialize the personnel density score accumulation value for the corresponding pixel coordinates; The density scoring module is used to traverse the center point coordinates of each person based on the personnel density scoring function, construct square search areas of different levels with the three half-side length parameters respectively, and accumulate the pixel length of the standing direction of all people in each square search area to obtain the accumulated personnel density score value of each person's pixel coordinate point. The density determination module is used to compare the cumulative value of the personnel density score with a preset density threshold to determine the personnel density level in the image.

10. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it can implement the adaptive personnel density estimation method based on the personnel density scoring function according to any one of claims 1-8.