Personnel gathering detection method and system
Through aerial viewing images and DBSCAN clustering algorithm, the gathering of people is detected and evaluated, and the early warning value is calculated to judge safety risks, which solves the problem of safety risks caused by difficult to detect personnel mobility in the prior art, and improves the accuracy and reliability of the detection.
Patent Information
- Application Number
- CN202411871652.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-12-18
AI Technical Summary
The prior art is difficult to effectively detect the safety risks when multiple people gather due to personnel mobility, although the distance between each person is greater than the safety threshold.
By collecting aerial top-view images, the personnel detection model is used to screen out the personnel's images, and the personnel center of gravity is clustered through the DBSCAN clustering algorithm, the first warning value and the second warning value are calculated, and the target warning value is obtained in combination with weighted summing to judge the risk of personnel gathering.
It improves the accuracy and reliability of personnel gathering detection, can more accurately reflect the risk of overall personnel gathering, and avoids the limitations of single core point gathering analysis.
Smart Images

Figure CN119723459A_ABST
Abstract
Description
Technical Field
[0001] The present invention generally relates to the field of data processing technology, and more specifically, to a method and system for detecting a gathering of people. Background Art
[0002] In some industrial production, safety management and working environments, it is necessary to control the distance between people. For example, in an environment with dense machines, equipment and production lines, the working area is usually narrow. If the distance between people is too close, the risk of accidental collision or contact may increase; in chemical processing, storage or transportation areas, if people are too close, the risk of chemical leakage, fire or explosion may increase; in the process of infectious disease prevention and control, by maintaining an appropriate distance between people (usually 1-2 meters), the risk of pathogen transmission through airborne transmission, droplet transmission, etc. can be significantly reduced. Therefore, in specific environments, especially where there is frequent flow of people, it is necessary to control the density of the crowd.
[0003] Existing technologies usually use cameras to analyze the location and distance of people on site in real time, and issue an alarm when the distance between two people is less than the preset safety threshold to remind managers to take measures. The person detection model is a commonly used algorithm for detecting people. It identifies the location of people in the image and obtains their coordinates, and then calculates the distance between people. Based on these distance data, it can be determined whether there is a gathering of people. If the distance between two people is less than the set safety threshold, an alarm is triggered.
[0004] However, due to the mobility of people, when there are more people concentrated in the area around a certain person, even if the distance between each person is greater than the safety threshold, the overall density may pose a safety risk. Summary of the invention
[0005] In order to solve the technical problem that the mobility of the above-mentioned personnel may cause safety risks when many people gather together, the present invention provides solutions in the following aspects.
[0006] In a first aspect, a method for detecting a gathering of people includes: collecting an aerial top-view image, recorded as a target image; filtering out images of people in the target image using a target frame through a people detection model, wherein each person corresponds to a target frame; obtaining the center of gravity of each target frame; clustering each center of gravity according to its coordinates using a DBSCAN clustering algorithm to obtain at least one object area, and determining each center of gravity as a core point, a boundary point or an isolated point, wherein the object area is a circle with the core point as the center and the maximum radius of the neighborhood corresponding to the DBSCAN clustering algorithm as the radius; calculating a first warning value a 1: ,in p iFor the i The number of centroids in the object area corresponding to the core points, i is a positive integer, n is the number of core points, p max is the maximum value of the density values of all core points, norm is a normalized function; calculate the second warning value a 2: ,in q j To include j The maximum value of the number of centroids in all object regions of the boundary points, j is a positive integer, m is the number of boundary points, q max is the maximum value of the density value of the boundary point, s is the number of isolated points, exp() is an exponential function with natural exponent e as the base; the first warning value and the second warning value are weightedly summed to obtain the target warning value, and an alarm is issued when the target warning value is greater than the preset warning threshold.
[0007] Preferably, clustering is performed on each centroid through the DBSCAN clustering algorithm to obtain at least one object area, and determining each centroid as a core point, a boundary point or an isolated point includes: calculating the distance between each centroid according to the coordinates of each centroid, and in response to the distance between two centroids being less than the maximum radius of the neighborhood, determining that the two centroids are adjacent points to each other; determining that the centroid whose number of adjacent points is greater than a preset number threshold is a core point; determining a circular area with the core point as the center and the first distance threshold as a radius as the object area corresponding to the core point; determining that the centroid whose number of adjacent points is greater than a preset number threshold and is adjacent to at least one core point is a boundary point; and determining that the centroid other than the core point and the edge point is a noise point.
[0008] Preferably, calculate k The center of gravity and t The formula for the distance between the centroids is: ; in, d For the k The center of gravity and t The distance between the centers of gravity, x k For the k The horizontal coordinate of the center of gravity, y k For the k The vertical coordinate of the center of gravity, x t For the k The horizontal coordinate of the center of gravity,y t For the k The vertical coordinate of the center of gravity, k , t All are positive integers.
[0009] Preferably, the method further comprises: in response to the distance between at least one pair of centers of gravity being smaller than a distance threshold of a preset size, issuing an alarm, wherein the distance threshold is smaller than the maximum radius of the neighborhood.
[0010] Preferably, the formula for calculating the target warning value is: A = η 1× a 1+ η 2× a 2; among them, η 1 is the first weight coefficient of the preset size, η 2 is a second weight coefficient of a preset size.
[0011] Preferably, it also includes constructing the personnel detection model: constructing a training set, wherein the training set includes multiple training images, each training image includes multiple persons, and each person is selected by a target box; constructing a neural network model; and training the neural network model according to the training set to obtain the personnel detection model.
[0012] Preferably, the neural network model is a neural network model of YOLO architecture.
[0013] Preferably, the target frame is a rectangular frame.
[0014] Preferably, obtaining the center of gravity of each target frame includes: obtaining the coordinates of two opposite corners of the target frame, wherein the coordinate of one of the two opposite corners is ( X 1, Y 1) The coordinates of the other angle are ( X 2, Y 2); Determine the coordinates of the center of gravity of the target frame ( X A , Y A ), where the coordinates of the center of gravity of the target box ( X A , Y A )satisfy: , .
[0015] In a second aspect, a people gathering detection system includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement a people gathering detection method described in any one of the above-mentioned invention contents.
[0016] The beneficial effects of the present invention are: The present invention detects people who are close to each other and form a cluster (i.e., when they are in the same object area), takes the person in the center as the key point (i.e., the core point), and calculates the first warning value based on the points adjacent to the key point; the present invention also introduces the second warning value to conduct a more comprehensive density assessment of the area including boundary points and isolated points, avoiding the limitations of single core point aggregation analysis, thereby improving the accuracy and reliability of overall aggregation detection. By weighted summing the first warning value and the second warning value, the risk situation of the overall gathering of people can be more accurately reflected. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flowchart schematically illustrating a method for detecting a gathering of people according to an embodiment of the present invention; Figure 2 is a density aggregation diagram schematically illustrating the aggregation process of a plurality of centers of gravity according to the present invention; Figure 3 It is a block diagram schematically showing a structure of a people gathering detection system according to this embodiment. DETAILED DESCRIPTION
[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0019] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0020] Figure 1 It is a flowchart schematically showing the steps of a method for detecting a gathering of people according to an embodiment of the present invention.
[0021] like Figure 1 As shown, a method for detecting a gathering of people includes steps S1 to S.
[0022] Step S1: Collect an aerial top view image and record it as a target image.
[0023] It should be noted that the viewing angle is vertically downward, which makes the distribution of people in the image appear to be on a plane. This perspective simplifies spatial calculations and makes the measurement of relative distances between people more intuitive and accurate.
[0024] Step S2: Using a target box through a person detection model to filter out images of people in the target image.
[0025] Each person corresponds to a target box. The person detection model is usually a trained deep learning model whose task is to identify all human targets in the image and generate a target box (or bounding box) for each target.
[0026] In one embodiment, constructing the personnel detection model includes: constructing a training set, wherein the training set includes multiple training images, each training image includes multiple persons, and each person is selected by a target box; constructing a neural network model; and training the neural network model according to the training set to obtain the personnel detection model.
[0027] In one embodiment, the neural network model is a neural network model of YOLO (You Only Look Once) architecture, wherein YOLO is a real-time target detection system that predicts target bounding boxes and categories through a single neural network.
[0028] Step S3: Obtain the center of gravity of each target frame; cluster each center of gravity according to the coordinates of each center of gravity by using the DBSCAN clustering algorithm to obtain at least one object area, and determine each center of gravity as a core point, a boundary point or an isolated point.
[0029] Among them, any object area is a circle with the core point as the center and the maximum radius of the neighborhood corresponding to the DBSCAN (Density-Based Spatial Clustering of Applications with Noise) clustering algorithm as the radius.
[0030] In one embodiment, clustering is performed on each centroid through the DBSCAN clustering algorithm to obtain at least one object area, and determining each centroid as a core point, a boundary point or an isolated point includes: calculating the distance between each centroid according to the coordinates of each centroid, and in response to the distance between two centroids being less than the maximum radius of the neighborhood, determining that the two centroids are adjacent points to each other; determining that a centroid whose number of adjacent points is greater than a preset number threshold is a core point; determining a circular area with the core point as the center and the first distance threshold as a radius as the object area corresponding to the core point; determining that a centroid whose number of adjacent points is greater than a preset number threshold and is adjacent to at least one core point is a boundary point; and determining that centroids other than core points and edge points are noise points.
[0031] It should be noted that DBSCAN is a density-based clustering algorithm. Its basic idea is to analyze the density of data points, divide the data into different clusters (i.e., object regions), and identify noise points (i.e., points that do not belong to any cluster). The core point is the center of the cluster, and there is enough density around it to expand a cluster. The boundary points cannot be used as core points to expand the cluster by themselves, but the boundary points are connected to the core points and belong to a part of a cluster. That is, although the boundary points are not dense enough to form a new cluster, they are classified into a cluster due to their adjacency with the core points. Isolated points are also called noise points. Isolated points do not belong to any cluster and do not have enough density to form a cluster. The object region refers to the clustered area formed by expanding outward from the core point through the DBSCAN algorithm. The object region (i.e., cluster) is a collection of density-connected points, and each cluster is composed of a core point and its surrounding boundary points.
[0032] Figure 2 is a density aggregation diagram schematically showing the aggregation process of multiple centers of gravity according to the present invention.
[0033] like Figure 2 As shown in the figure, the dotted circle is the object area, the center of the dotted circle (i.e. the center of the circle) is the core point, the point that is not in the center of the circle but inside the dotted circle (the centroid) is the boundary point, and the point outside the dotted circle is the noise point. There are overlapping parts in multiple object areas, and a boundary point may belong to the neighboring points of multiple core points. It should be noted that if a centroid has enough neighboring points, then this centroid and its neighboring points belong to the same object area (or the same cluster); if a centroid has too few neighbors, then this centroid is considered to be a noise or boundary point.
[0034] In one embodiment, the distance between any two points is calculated, for example, k The center of gravity and t Examples of distances between centers of gravity include: ; in, d For the k The center of gravity and t The distance between the centers of gravity, x k For the k The horizontal coordinate of the center of gravity, y k For the k The vertical coordinate of the center of gravity, x t For the k The horizontal coordinate of the center of gravity, y t For thek The vertical coordinate of the center of gravity, k , t All are positive integers.
[0035] In one embodiment, the target frame is a rectangular frame. In this embodiment, obtaining the center of gravity of each target frame includes: obtaining the coordinates of two opposite corners of the target frame, wherein the coordinates of one of the two opposite corners are ( X 1, Y 1) The coordinates of the other angle are ( X 2, Y 2); Determine the coordinates of the center of gravity of the target frame ( X A , Y A ), where the coordinates of the center of gravity of the target box ( X A , Y A )satisfy: , .
[0036] In another embodiment, the target frame is a circular frame. In this embodiment, the coordinates of the center of the target frame are determined as the center of gravity coordinates of the target frame.
[0037] Step S4: Calculate the first warning value.
[0038] The formula for calculating the first warning value is: , a 1 is the first warning value, p i For the i The number of centroids in the object area corresponding to the core points, i is a positive integer, n is the number of core points, p max is the maximum value of the density values of all core points, norm is the normalization function.
[0039] It should be noted that even if the distance between each person is kept within an acceptable range, the continuous flow and gathering of people may cause the density of certain areas to increase sharply, thus creating potential safety hazards. The number of centroids in the object area corresponding to the core point reflects the compactness of the gathering of people. The more centroids there are in the object area corresponding to the core point, the more compact the gathering of people in the object area corresponding to the core point. Based on this, the average value of the centroid data in the object area corresponding to all core points (i.e. ) reflects the compactness of the gathering of people in all object areas, the maximum value of the density value of all core points p maxIt reflects the maximum density of people gathering. p max The larger the value, the greater the safety hazard; the average value (i.e. ), the greater the safety hazard. Therefore, the greater the first warning value, the greater the safety hazard.
[0040] Step S5: Calculate the second warning value.
[0041] The formula for calculating the second warning value is: , a 2 is the second warning value, q j To include j The maximum value of the number of centroids in all object regions of the boundary points, j is a positive integer, m is the number of boundary points, q max is the maximum value of the density value of the boundary point, s is the number of isolated points, and exp() is an exponential function with the natural exponential e as the base.
[0042] It should be noted that for a boundary point, the maximum value of the number of centers of gravity in all object areas including this boundary point reflects the density and concentration of people in the area where the boundary point is located. The maximum value can effectively reflect the "worst case" or "most extreme case" in the system. If the area corresponding to a boundary point has an extremely high number of centers of gravity, it means that the area may face higher risks or pressures. Therefore, by using the maximum value for measurement, early warning can be ensured in the case of maximum risk. The number of isolated points indicates the overall safety of the area corresponding to the target image. Based on this, the formula The larger or the number of isolated points s The smaller it is, the greater the safety hazard is and the larger the second warning value is.
[0043] Step S6: performing weighted summation on the first warning value and the second warning value to obtain a target warning value, and generating an alarm when the target warning value is greater than a preset warning threshold.
[0044] The formula for calculating the target warning value is: A = η 1× a 1+ η 2× a 2; η 1 is the first weight coefficient of the preset size, η 2 is a second weight coefficient of a preset size. In one embodiment, the first weight coefficient η The value of 1 is 0.8, the second weight coefficient η The value of 2 is 0.2.
[0045] Figure 3 It is a structural block diagram schematically showing a people gathering detection system according to an embodiment of the present invention.
[0046] The present invention also provides a personnel gathering detection system. Figure 3 As shown, the system includes a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a method for detecting a gathering of people according to the first aspect of the present invention is implemented.
[0047] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.
[0048] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0049] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A method for detecting a gathering of people, characterized in that: include: Collect an aerial bird's-eye view image and record it as a target image; Using a target frame to filter out images of people in the target image through a person detection model, wherein each person corresponds to a target frame; Obtain the center of gravity of each target box; perform clustering processing on each center of gravity according to the coordinates of each center of gravity by using the DBSCAN clustering algorithm to obtain at least one object area, and determine each center of gravity as a core point, a boundary point or an isolated point, wherein the object area is a circle with the core point as the center and the maximum radius of the neighborhood corresponding to the DBSCAN clustering algorithm as the radius; Calculate the first warning value a 1: ,in p i For the i The number of centroids in the object area corresponding to the core points, i is a positive integer, n is the number of core points, p max is the maximum value of the density values of all core points, norm is the normalization function; Calculate the second warning value a 2: ,in q j To include j The maximum value of the number of centroids in all object regions of the boundary points, j is a positive integer, m is the number of boundary points, q max is the maximum value of the density value of the boundary point, s is the number of isolated points, exp() is an exponential function with the natural exponent e as the base; A weighted sum is performed on the first warning value and the second warning value to obtain a target warning value, and an alarm is issued when the target warning value is greater than a preset warning threshold.
2. A method for detecting crowd gathering according to claim 1, characterized in that: Clustering each centroid by DBSCAN clustering algorithm to obtain at least one object region, and determining each centroid as a core point, a boundary point or an isolated point includes: Calculating the distance between the centers of gravity according to the coordinates of the centers of gravity, and in response to the distance between the two centers of gravity being less than the maximum radius of the neighborhood, determining that the two centers of gravity are adjacent points to each other; Determine the centroid whose number of adjacent points is greater than a preset threshold as the core point; Determine a circular area with the core point as the center and the first distance threshold as the radius as the object area corresponding to the core point; Determine the centroid of a point whose number of adjacent points is greater than a preset threshold value and which is adjacent to at least one core point as a boundary point; The centroids other than core points and edge points are determined as noise points.
3. A method for detecting crowd gathering according to claim 2, characterized in that: Calculate the k The center of gravity and t The formula for the distance between the centroids is: ; in, d For the k The center of gravity and t The distance between the centers of gravity, x k For the k The horizontal coordinate of the center of gravity, y k For the k The vertical coordinate of the center of gravity, x t For the k The horizontal coordinate of the center of gravity, y t For the k The vertical coordinate of the center of gravity, k , t All are positive integers.
4. A method for detecting gathering of people according to claim 3, characterized in that: Also includes: In response to the distance between at least one pair of gravity centers being smaller than a distance threshold of a preset size, an alarm is issued, wherein the distance threshold is smaller than the maximum radius of the neighborhood.
5. A method for detecting gathering of people according to claim 1, characterized in that: The formula for calculating the target warning value is: A = η 1× a 1+ η 2× a 2; in, η 1 is the first weight coefficient of the preset size, η 2 is a second weight coefficient of a preset size.
6. A method for detecting crowd gathering according to claim 1, characterized in that: It also includes building the person detection model: Constructing a training set, wherein the training set includes a plurality of training images, each training image includes a plurality of persons, and each person is selected by a target frame; Build a neural network model; The neural network model is trained according to the training set to obtain the personnel detection model.
7. A method for detecting crowd gathering according to claim 1, characterized in that: The neural network model is a neural network model of the YOLO architecture.
8. A method for detecting crowd gathering according to claim 1, characterized in that: The target frame is a rectangular frame.
9. A method for detecting crowd gathering according to claim 8, characterized in that: The obtaining of the center of gravity of each target frame includes: Get the coordinates of two opposite corners of the target frame, where the coordinate of one of the two opposite corners is ( X 1, Y 1) The coordinates of the other angle are ( X 2, Y 2); Determine the coordinates of the center of gravity of the target box ( X A , Y A ), where the coordinates of the center of gravity of the target box ( X A , Y A )satisfy: , .
10. A people gathering detection system, comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: The processor executes the computer program to implement a method for detecting a gathering of people as described in any one of claims 1-9.
Citation Information
Patent Citations
Personnel gathering detection method, apparatus and device
CN111666821A
Method and system for monitoring gathering density of people in market
CN113822151A
Personnel gathering area detection method, device, equipment, medium and product
CN117671584A
Personnel gathering detection method with counting function
CN118053113A
Method for crowd head localization detection, and computer program recorded on record-medium for executing method therefor
KR102706119B1