A people congregation discovery algorithm
Patent Information
- Application Number
- CN202310605823.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2043-05-23
AI Technical Summary
[0021]This invention provides a people gathering algorithm. By modifying the clustering algorithm, it uses the maximum cluster radius method to solve the chain clustering situation that may occur in density clustering, and can also effectively avoid non-conversational gathering activities such as normal queuing. For spherical clustering, it provides a new clustering method without setting the number of clusters. In practical applications, the algorithm provided by this invention can also record the gathering time and people according to the actual situation, and can be widely used in various industries.
Smart Images

Figure CN116595400B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of clustering algorithm technology, specifically relating to a people clustering detection algorithm. Background Technology
[0002] In machine learning, an important task is to quantitatively describe the clustering phenomenon in data. Cluster analysis is the process of exploring suitable coarse-grained data objects under unsupervised learning. During the exploration process, the differences between data objects in different clusters become more and more obvious, while the differences between data objects within the same cluster become smaller and smaller.
[0003] Traditional clustering discovery algorithms, such as spherical clustering, are mostly based on k-means, which are greatly affected by outliers. They also require setting the number of clusters manually and are quite sensitive to initial values, making them less effective for streaming data processing. Furthermore, some hierarchical clustering and density clustering algorithms may produce chain-like clustering results during cluster discovery, making them less friendly to those requiring non-chain-like results.
[0004] Therefore, in response to the above problems, the present invention aims to discover non-chain clusters by using features, thereby improving the detection of personnel clusters. Summary of the Invention
[0005] To address the shortcomings and problems of existing spherical clustering algorithms, which are mostly based on k-means, are greatly affected by outliers, require manual setting of the number of clusters, are sensitive to initial value settings, and have poor performance in handling streaming data; and some hierarchical clustering and density clustering may produce chain-like clustering results when discovering clusters, which is not friendly to those who require non-chain-like results, this invention provides a people clustering detection algorithm.
[0006] The solution adopted by this invention to solve its technical problem is: a people gathering detection algorithm, comprising the following steps:
[0007] Step 1: Obtain node latitude and longitude data and time from the data platform;
[0008] Step 2: Set parameters and calculate the distance between two nodes: Define the neighborhood, threshold within the neighborhood, maximum cluster radius, and minimum number of people in each sample data; and mark all sample data as "not queried";
[0009] Step 3: Randomly select data for query and mark it as queried; determine whether the selected data X meets the neighborhood threshold set in Step 2 above. If it does, create a new cluster M and add data X to the new cluster M; repeat this step multiple times to select multiple data items and add them to M.
[0010] Step 4: Identify each sample data X in M, and traverse all sample data Y within its neighborhood, marking the query status of data Y; repeat this step until all data has been queried.
[0011] Step 5: Draw circles with each point in the new cluster M as the center, obtain the region with the largest number of overlaps within the region, and use any point in it as the center of the cluster circle;
[0012] Step 6: Determine if the number of points within the cluster circle has reached the minimum cluster size. If it has reached the set value, write the cluster node set and time into the database.
[0013] Step 7: Repeat the above steps and determine if the aggregation has changed. If it has changed, change the time period.
[0014] Furthermore, in step one, the distance between the two nodes is calculated using latitude and longitude data.
[0015] Furthermore, the formula for calculating latitude and longitude is as follows:
[0016] S=R*arccos(cos(b.latitude)*cos(a.latitude)*cos(b.longitude-a.longitude)+sin(b.latitude)*sin(a.latitude));
[0017] Where S is the distance between two points; point a: latitude is a.latitude, accuracy is a.longitude; point b: latitude is b.latitude, accuracy is b.longitude.
[0018] Furthermore, in step four, if sample data X is a core object, then all samples Y in the neighborhood of data X are traversed and added to the new cluster M; if data Y is not found, it is marked as "not queried".
[0019] Furthermore, in step six, the number of points within the cluster circle that reach the minimum cluster number is written into the Redis database.
[0020] Compared with the prior art, the beneficial effects of the present invention are:
[0021] This invention provides a people gathering algorithm. By modifying the clustering algorithm, it uses the maximum cluster radius method to solve the chain clustering situation that may occur in density clustering, and can also effectively avoid non-conversational gathering activities such as normal queuing. For spherical clustering, it provides a new clustering method without setting the number of clusters. In practical applications, the algorithm provided by this invention can also record the gathering time and people according to the actual situation, and can be widely used in various industries. Attached Figure Description
[0022] Figure 1 This is the overall flowchart of the present invention. Detailed Implementation
[0023] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0024] Please see Figure 1 This invention provides a technical solution for a people clustering detection algorithm, which improves the density clustering algorithm and realizes a spherical density clustering algorithm that can self-cluster. It is very practical for people clustering early warning. The algorithm complexity is basically the same as other density clustering algorithms, thus making it easier to adapt to spherical clustering and better detect people clusters.
[0025] Example 1:
[0026] like Figure 1 As shown, the present invention provides a people gathering detection algorithm, which includes the following steps:
[0027] Step 1: Obtain node latitude and longitude data and time from various existing data platforms;
[0028] Step 2: Parameter setting and calculation of the distance between two nodes: Define the sample data obtained in Step 1, including defining the neighborhood ∈ between each sample data, that is, a small circle with the data as the center and ∈ as the radius; define the sample data threshold, that is, the number of samples in the neighborhood of ∈ min-x; define the maximum cluster radius, that is, the cluster range max-r; and define the minimum cluster number p; and mark all sample data as "not queried" status;
[0029] The distance between two nodes is calculated using latitude and longitude formulas. For example, assuming the Earth is a perfect sphere, the distance between points A and B is the arc length of a cross-section of a circle, calculated using the following formula:
[0030] S=R*arccos(cos(b.latitude)*cos(a.latitude)*cos(b.longitude-a.longitude)+sin(b.latitude)*sin(a.latitude));
[0031] Where S is the distance between the two points;
[0032] Point a: latitude is a.latitude, precision is a.longitude;
[0033] Point b: latitude is b.latitude, precision is b.longitude;
[0034] Step 3: Randomly select data for query and mark it as "queried". Determine whether the selected data X meets the neighborhood threshold set in Step 2 above. If it does, create a new cluster M and add data X to the new cluster M. Repeat this step multiple times to select multiple data items and add them to M.
[0035] Step 4: Confirm each sample data X in the new cluster M. If data X is a core object, then traverse all samples Y in its neighborhood and add them to M. If data Y has not been queried, then mark it as "queried". Repeat this step until all data has been queried.
[0036] Step 5: Using each point in the new cluster M as the center, draw a circle with a radius of max-r to obtain the region with the largest number of overlaps, and use any point in it as the center of the cluster circle.
[0037] Step 6: Determine whether the number of points within the cluster circle has reached the minimum cluster number p. If it has reached the set expected value, write the cluster node set and time into the Redis database.
[0038] Step 7: Repeat the above steps and determine if the aggregation has changed. If it has changed, change the time period.
[0039] The above description is only a preferred embodiment of the present invention and does not limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A people gathering detection algorithm, characterized in that: Includes the following steps: Step 1: Obtain node latitude and longitude data and time from the data platform; Step 2: Set parameters and calculate the distance S between two nodes: Define the neighborhood, threshold within the neighborhood, maximum cluster radius, and minimum number of people in each sample data; and mark all sample data as "not queried"; S= R*arccos(cos(b .latitude)*cos(a .latitude)*cos(b .longitude-a .longitude)+sin(b .latitude)*sin(a .latitude)); Where S is the distance between the two points; the latitude of point a is a.latitude, and the precision is a.longitude; the latitude of point b is b.latitude, and the precision is b.longitude; Step 3: Randomly select data for query and mark it as queried; determine whether the selected data X meets the neighborhood threshold set in Step 2 above. If it does, create a new cluster M and add data X to the new cluster M. Repeat this step multiple times, selecting multiple data items to add to M; Step 4: Identify each sample data X in M, and traverse all sample data Y within its neighborhood, marking the query status of data Y; repeat this step until all data has been queried. If sample data X is a core object, then all samples Y within the neighborhood of data X are traversed and added to the new cluster M; if data Y is not found, it is marked as "not queried". Step 5: Draw circles with each point in the new cluster M as the center, obtain the region with the largest number of overlaps within the region, and use any point in it as the center of the cluster circle; Step 6: Determine if the number of points within the cluster circle has reached the minimum cluster size. If it has reached the set value, write the cluster node set and time into the database. Step 7: Repeat the above steps and determine if the aggregation has changed. If it has changed, change the time period.
2. The crowd gathering detection algorithm according to claim 1, characterized in that: In step six, the number of points within the cluster circle that reach the minimum cluster number is written into the Redis database.
Citation Information
Patent Citations
Calculation method and system for dynamic region aggregation early warning real-time recommendation
CN111079577A
Improved DBSCAN algorithm based on hierarchical structure
CN114818870A