A track stream clustering method, device and electronic equipment based on Flink

By using Flink's streaming computing engine and the DBSCAN algorithm, efficient trajectory flow clustering and visualization are achieved, solving the problem of low efficiency in existing technologies and supporting real-time traffic flow monitoring and hotspot area display.

CN116955499BActive Publication Date: 2026-06-05ZHEJIANG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2023-07-06
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing trajectory flow clustering methods are inefficient when processing large-scale spatiotemporal data, making it difficult to achieve real-time visualization and efficient clustering.

Method used

Using a Flink-based streaming computing engine, spatiotemporal trajectory points are generated, classified, and partitioned. Incremental trajectory clustering is achieved by combining an error threshold algorithm and a DBSCAN clustering algorithm. The clustering results are then merged under event timestamps for visualization.

Benefits of technology

It improves the efficiency and throughput of trajectory flow clustering, reduces latency, enables real-time traffic flow monitoring and hotspot area visualization, and supports traffic management in smart cities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116955499B_ABST
    Figure CN116955499B_ABST
Patent Text Reader

Abstract

The application discloses a track stream clustering method based on Flink, which converts a track stream clustering problem in a global space into independent subspace real-time clustering problems, maintains dynamic clustering in different subspaces in parallel, and then efficiently combines them. The application also provides a track stream clustering device and an electronic equipment. The method provided by the application can compress stream track points while keeping the amount of space-time information unchanged, reduces unnecessary calculation, improves the throughput of the whole system, and reduces the delay. Meanwhile, the spatial partition clustering of subtracks fully utilizes the parallel computing capacity of a computer, and realizes linear performance scalability on the basis of the Flink stream engine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of spatiotemporal big data mining technology, and particularly relates to a trajectory flow clustering method, device and electronic equipment based on Flink. Background Technology

[0002] Spatiotemporal big data mining is a rapidly developing and expanding field in recent years, encompassing data collection, processing, analysis, and application. Many new technologies and tools have emerged to handle big data, such as distributed computing, deep learning, and visualization. Analyzing spatiotemporal big data requires the use of appropriate algorithms and methods to uncover hidden patterns and trends. Spatiotemporal big data mining has wide applications in many fields, such as transportation planning, urban management, environmental protection, weather forecasting, and financial risk management. With technological advancements and the expansion of application scenarios, spatiotemporal big data mining will become increasingly important.

[0003] Traffic flow analysis: Real-time spatiotemporal trajectory flow clustering can be used to analyze traffic flow on urban roads. By clustering vehicle and pedestrian trajectories, congested road sections, peak hours, and densely populated pedestrian areas can be identified.

[0004] Urban planning: Urban planners can use real-time spatiotemporal trajectory flow clustering analysis to discover the activity patterns of urban residents and regional characteristics, thereby formulating more rational urban development plans. For example, analyzing pedestrian flow, traffic flow, and facility usage in various areas allows for targeted improvements to infrastructure, enhancing the city's sustainability and livability.

[0005] Disaster Early Warning: Real-time spatiotemporal trajectory stream clustering can be used for disaster emergency management and early warning. By clustering and analyzing geographic information and meteorological data from different regions and times, areas prone to natural disasters can be predicted and identified. Simultaneously, real-time analysis of the dynamic trajectories of people and materials within disaster-stricken areas helps optimize the allocation of rescue resources and improve rescue efficiency.

[0006] Social Network Analytics: In the field of social networks, real-time spatiotemporal trajectory stream clustering can be used to analyze user activity patterns, interests, and social relationships. For example, by clustering user check-in data, geolocation information, and social interaction records, it is possible to discover users' activity areas and points of interest, thereby providing users with more accurate recommendation services and advertising.

[0007] Patent document CN115033732A discloses a spatiotemporal trajectory association method, device, electronic device, and storage medium. The method includes: determining a first trajectory and a second trajectory, wherein the first trajectory is determined based on acquired image data, and the second trajectory is determined based on acquired identification code data; determining multiple candidate spatiotemporal trajectory point pairs based on the first trajectory and the second trajectory, wherein the candidate spatiotemporal trajectory point pairs include trajectory points that intersect in time and space; and determining strongly associated spatiotemporal trajectory point pairs based on the multiple candidate spatiotemporal trajectory point pairs.

[0008] Patent document CN115330360A discloses a method for calculating pedestrian trajectories based on multi-agent simulation technology. This method includes: collecting pedestrian dwell time information and building information; generating a sequence of spatiotemporal trajectory points for pedestrians; generating feasible motion trajectories; verifying the pedestrian motion trajectories; and outputting complete pedestrian trajectories. This method aims to calculate pedestrian trajectories within transportation hubs. Summary of the Invention

[0009] The purpose of this invention is to provide a trajectory flow clustering method, device, and electronic device based on Flink, which can quickly realize trajectory flow clustering and its visualization.

[0010] To achieve the first objective of this invention, a trajectory flow clustering method is provided, comprising:

[0011] Step 1: Generate multiple spatiotemporal trajectory points based on the GPS information of each moving object within the monitoring area. The spatiotemporal trajectory points include the identifier of the moving object, the generation time of the spatiotemporal trajectory points, and the two-dimensional coordinates of the spatiotemporal trajectory points.

[0012] Step 2: Classify all spatiotemporal trajectory points based on the identifiers to generate trajectory point partitions corresponding to the moving objects;

[0013] Step 3: Process the data of each moving object's trajectory points into partitions to generate sub-trajectories that describe the latest state of the moving object;

[0014] Step 4: Divide the current monitoring area into multiple rectangular spatial grids in the form of two-dimensional clustering space, and perform incremental trajectory clustering processing on the sub-trajectories existing in each rectangular spatial grid in order to maintain all surviving sub-trajectories in the rectangular spatial grid and the cluster information obtained by clustering all sub-trajectories;

[0015] Step 5: Based on the end time of the event timestamp, merge all cluster information within each rectangular spatial grid to obtain the clustering result of the entire detection area under the event timestamp.

[0016] Step 6: Perform statistics and visualization based on the clustering results to display the dynamic changes of all moving objects within the monitoring area.

[0017] This invention employs the open-source general-purpose streaming computing engine Flink to visualize the trajectory flow clustering results of a detected area, displaying the real-time motion dynamics of monitored objects within that area. It can be used for real-time applications such as smart city traffic flow monitoring and hotspot area visualization. In traffic flow detection, moving objects in different clusters can be considered as different groups, with objects within the same group exhibiting similar or identical motion trends and attributes. For each group, the number of moving objects can be calculated, generating a heatmap that displays the group's distribution across road segments. Traffic management personnel can use this heatmap to quickly understand the current traffic situation, identify congested areas, and take measures to alleviate traffic congestion.

[0018] Specifically, the moving objects include vehicles, people, buildings, and meteorological data within the area.

[0019] Specifically, in step 3, trajectory point partitioning and data processing are performed using trajectory flow segmentation and compression algorithms.

[0020] Specifically, the process of step 3 is as follows:

[0021] Step 3-1: Maintain a cache partition within the trajectory point partition for caching valid trajectory points of the moving object. The trajectory points in the cache partition are arranged in timestamp order.

[0022] Step 3-2: For newly incoming trajectory points, add the trajectory points to the end of the cache partition and determine whether it disrupts the timestamp order.

[0023] For trajectory points that are not scrambled, add them to the end of the cache partition, and remove other trajectory points in the cache partition that exceed the threshold according to the error threshold algorithm.

[0024] For trajectory points whose order has been shuffled, rearrange the cache partitions and repeat steps 2 to 3 until the cache partitions meet the requirements.

[0025] Step 3-3: Copy the constructed cache partition to generate a sub-trajectory that describes the latest state of the moving object.

[0026] Specifically, in step 4, the monitoring area is divided into two-dimensional clustering spaces using the GridID encoding method.

[0027] Specifically, the incremental trajectory clustering process uses the DBSCAN clustering algorithm.

[0028] Specifically, the incremental trajectory clustering process is as follows:

[0029] Step 4-1: For each trajectory point partition, maintain an index from the moving object to the sub-trajectory. The index stores all surviving sub-trajectories within the current rectangular space grid.

[0030] Step 4-2: Based on the index shown in Step 4-1, search for the existence of moving objects and corresponding sub-trajectories in each rectangular spatial grid.

[0031] If a moving object and its corresponding sub-trajectory exist, the sub-trajectory indexed under the moving object is incrementally removed from the clustered trajectory clusters.

[0032] If no moving object and corresponding sub-trajectory exist, the moving object and corresponding sub-trajectory are added to the trajectory cluster according to the event timestamp.

[0033] Specifically, in step 5, the process is as follows:

[0034] Step 5-1: Combine the event timestamp, the rectangular spatial grid, and the cluster information within the rectangular grid into a triplet.

[0035] Step 5-2: Partition the triples based on the event timestamp to obtain cluster information of all rectangular spatial grids within the same event timestamp.

[0036] Step 5-3: Merge the cluster information obtained from the partitioning in Step 5-2 to obtain the clustering result of the entire detection area under the corresponding event timestamp.

[0037] To achieve the second objective of this invention, a trajectory flow clustering device is provided, implemented based on the aforementioned Flink-based trajectory flow clustering method, comprising:

[0038] The acquisition module is used to acquire trajectory points generated by the trajectory flow of the monitored moving object.

[0039] The sub-trajectory module generates sub-trajectories using trajectory points generated based on different moving objects and employs trajectory flow compression and segmentation algorithms based on error thresholds.

[0040] The clustering module is used to partition the newly generated sub-trajectories, incrementally execute the clustering algorithm within each partition, and maintain the trajectory clusters generated by the clustering in real time.

[0041] The merging module is used to merge the sub-trajectory clusters of the partitions according to the timestamp, so as to obtain the global clustering result at each timestamp.

[0042] The visualization module is used to statistically analyze and visualize clustering results.

[0043] To achieve a third objective of the present invention, an electronic device is provided, comprising: one or more processors.

[0044] This memory is used to store one or more programs;

[0045] When the one or more programs are executed by the one or more processors, the one or more processors implement the Flink-based trajectory flow clustering method described above.

[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0047] The problem of trajectory flow clustering in the global space is transformed into a real-time clustering problem in independent subspaces. Dynamic clusters are maintained in parallel in different subspaces and then efficiently merged. On the one hand, streaming trajectory point compression reduces unnecessary computation while preserving spatiotemporal information, thereby improving the throughput of the entire system and reducing latency. On the other hand, spatial partitioning clustering of sub-trajectories fully utilizes the parallel capabilities of computers and achieves linear performance scalability based on the Flink streaming engine. Attached Figure Description

[0048] Figure 1 This embodiment provides a flowchart of a trajectory flow clustering method based on Flink.

[0049] Figure 2 This is a schematic diagram of trajectory point partitioning and sub-trajectory generation provided in this embodiment;

[0050] Figure 3 This is a schematic diagram of data processing for trajectory point partitioning provided in this embodiment;

[0051] Figure 4 This is a clustering diagram of sub-trajectories within the same event timestamp provided in this embodiment;

[0052] Figure 5 This is a schematic diagram of the sub-trajectory segment distance measurement algorithm provided in this embodiment;

[0053] Figure 6 This is a schematic diagram illustrating the visualization of trajectory data clustering provided in this embodiment;

[0054] Figure 7 This is a block diagram of the trajectory flow clustering device provided in this embodiment;

[0055] Figure 8 This is a schematic diagram of an electronic device provided in this embodiment. Detailed Implementation

[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0057] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0058] like Figure 1 The diagram shows a trajectory flow clustering method based on Flink, which includes the following steps:

[0059] The spatiotemporal trajectory points p are collected in real time from data sources such as GPS devices, smartphones, smart car systems, and satellite remote sensing. Each trajectory point includes a quadruple containing a unique identifier id for the moving object, the collection time t, the x-coordinate of the two-dimensional space, and the y-coordinate of the two-dimensional space, i.e., p =<id,t,x,y> .

[0060] Each trajectory point corresponding to each id falls within an independent data partition P-ID(id).

[0061] Within each P-ID(id), a trajectory flow segmentation and compression method based on an error threshold is used to compress and generate sub-trajectories T in real time. <id,t,p1,p2,…,p n > is used to describe the latest state of the current trajectory flow.

[0062] Divide the current space into rectangular grids according to the given length parameter, with each grid coded as GridID=<x,y> For each GridID involved in the sub-trajectory T, construct a tuple GridObject =<GridID,T> Partitioning is performed based on GridObject.GridID, so that each GridObject falls within the data partition P-Grid(GridID) of its corresponding spatial area.

[0063] Within each P-Grid (GridID), an incremental DBSCAN clustering algorithm is used to maintain subtrajectories in real time, keeping track of all surviving subtrajectories T in the current partition and the partition G of their respective clusters.

[0064] After each event timestamp, each P-Grid(GridID).GridID, the cluster G, and the current ending event timestamp t′ are combined into a triple ClusterSet =<t′,GridID,G> Partitioning is performed based on ClusterSet.t′, so that triples with the same timestamp are in the same data partition P-Out(t′).

[0065] Within each timestamp's data partition, the cluster information contained in each triplet is merged to obtain the clustering result of the entire two-dimensional clustering space under that timestamp, that is, the partition of the cluster composed of all subtrajectories.

[0066] As can be seen from the above embodiments, this application constructs an efficient real-time clustering method for spatiotemporal trajectory flow clustering that fully utilizes the temporal and spatial characteristics of spatiotemporal trajectories. This method transforms the global trajectory flow clustering problem into an independent subspace real-time clustering problem, maintaining dynamic clusters in parallel across different subspaces, and then efficiently merging them. On one hand, streaming trajectory point compression reduces unnecessary computation while preserving the spatiotemporal information, thereby improving the overall system throughput and reducing latency. On the other hand, the spatial partitioning clustering of sub-trajectories fully utilizes the parallel capabilities of computers and achieves linear performance scalability based on the Flink streaming engine.

[0067] This method visualizes the clustering results of two-dimensional spatial trajectory flows in the current monitoring area, displaying the real-time movement dynamics of monitored objects. It can be used for real-time applications such as smart city traffic flow monitoring and hotspot area visualization. In traffic flow detection, moving objects in different clusters can be considered as different groups, with objects within the same group exhibiting similar or identical movement trends and attributes. For each group, the number of moving objects can be calculated, generating a heatmap that shows the group's distribution across road segments. Traffic management personnel can use this heatmap to quickly understand the current traffic situation, identify congested areas, and take measures to alleviate traffic congestion.

[0068] To better illustrate the effectiveness of the technical solution in this embodiment, tests were conducted using Beijing traffic data.

[0069] The feature of the GPS positioning point collected in this invention is the trajectory point p =<id,t,x,y> Where id is the unique identifier of the moving object to which the trajectory point belongs, t is the timestamp when the trajectory point was collected, and x and y are the horizontal and vertical coordinates of the trajectory point in two-dimensional space, which are the latitude and longitude of the GPS point.

[0070] For example, the trajectory point <3015,1201930244000,116.41036,39.89171,0> has an id of 3015, which indicates that it is the 3015th moving object collected in this dataset; t = 1201930244000 indicates that it was collected at 5:04:04 Beijing time on February 3, 2008.<x=116.41036,y=39.89171,0> This indicates that the GPS coordinates of the trajectory point are located in Beijing.

[0071] A unique data partition is created for each p.id. For example, points a = <1,1,1,1> and b = <1,2,1,1> will be routed to the partition with id=1, while point c = <2,1,1,1> will be routed to the partition with id=2. Data partitions with different ids do not interfere with each other and are processed independently and in parallel.

[0072] like Figure 3 As shown, within P-ID(id), a buffer B for trajectory points is established. A trajectory flow compression method based on an error threshold is used to cache a series of key trajectory points for the moving object. Each incoming trajectory point updates the current buffer and constructs a sub-trajectory T based on the cached trajectory points to represent the latest state of the trajectory flow. This sub-trajectory T is then delivered to the downstream operator.

[0073] This step includes the following sub-steps:

[0074] Within each P-ID(id), the trajectory points in the maintenance cache are arranged in chronological order, specifically B = <p1,p2,p3,…,p n > where the timestamp of p1 is smaller than that of p2, the timestamp of p2 is smaller than that of p3, and so on.

[0075] For trajectory point p, if its timestamp pt is greater than the timestamp p of the front end point in the buffer... n .t, will the trajectory segment L a = <p n-1 ,p>and trajectory segment L b = <p n ,p> calculate the distance between segments, such as Figure 5 As shown, the calculation formula is:

[0076] dis(L a ,L b )=α*d cen (L a ,L b )+(1-α)*d ori (L a ,L b )

[0077] in

[0078] d cen (L a ,L b ) = ED(center(L a ),center(L b ));

[0079]

[0080] Cumulative error: E = E + dis(L) a ,L b If E is less than a given threshold, then p n Remove a point from the buffer and replace it with a new point p. If E is greater than the threshold, add p to the buffer, making B = <p1,p2,…,p n If the number of points in the buffer exceeds the given threshold, remove p1 from the buffer and reset the cumulative error E = 0.

[0081] If the timestamp pt of point p is less than the front-end point p in the cache... n timestamp p n .t, remove point p1 from buffer B, insert p into the appropriate position in buffer B in chronological order, and set each point p in B to .t. i Re-sorting according to time order yields the valid cache order B = <p′1,p′2,…,p n ′>.

[0082] If the current cache size reaches a given threshold, assemble copies of all trajectory points in the cache into a sub-trajectory T = <id,t,p1,p2,…,p n > Deliver downstream operators.

[0083] like Figure 4 As shown, the current space is divided into a two-dimensional grid according to the horizontal and vertical coordinates. Each spatial grid is encoded as a GridID, and the set of GridIDs involved in the sub-trajectory T is calculated. For each GridID, a tuple GridObject is generated.<GridID,T> Based on the GridID partition, ensure that each GridObject falls within the data partition P-Grid(GridID) of its corresponding spatial area. This step includes the following sub-steps:

[0084] Obtain the given spatial grid length parameter gridlen from the outside, and for each point p of the sub-trajectory T =<id,t,x0,y0> Its GridID =<x,y> Where x = x0 / / gridlen, y = y0 / / gridlen, and " / / " represents integer division. Collect a set (GridID) of GridIDs calculated for each point. For each GridID in set (GridID), = ...<x,y> , and its neighboring grid GridID1=<x+1,y> GridID2=<x,y+1> GridID3=<x+1,y+1> Also add set(GridID).

[0085] For each element in set(GridID), copy the sub-track T and construct GridObject =<GridID,T> .

[0086] Partitioning based on GridObject.GridID ensures that each GridObject falls within the data partition P-Grid(GridID) of its corresponding spatial region.

[0087] For each P-Grid (GridID), an incremental DBSCAN clustering algorithm is used to maintain the internal sub-trajectories in real time. This maintains all surviving sub-trajectories T within the current P-Grid (GridID) and the set G of their respective trajectory clusters. This step includes the following sub-steps:

[0088] For each P-Grid (GridID), maintain an index from sub-trajectory T.id to GridObject. This index stores the IDs of all surviving motion objects in the current partition and their unique corresponding GridObjects. Also maintain a set G of all trajectory clusters in the current partition.

[0089] For each GridObject= <GridID,T arr >, record timestamp newTs=T arr .t, will T arr Add to set insert (T arr ).

[0090] For each T arr .id, check if it is included in the index Index. If Index(T) arr If .id exists, add that id to the set. expired (id).

[0091] If the current timestamp currTs < newTs, update prevTs = currTs, currTs = newTs, and perform the subsequent steps.

[0092] For set expired (id) Execute the batch trajectory DBSCAN deletion algorithm to batch delete these ids and their corresponding sub-trajectory Index(id) from the cluster set G, and delete Index(id) from the index.

[0093] For set insert (T arr ) Execute the batch trajectory DBSCAN insertion algorithm. First, insert each T arr into the index Index(T arr .id) = T arr , and then batch add set insert (T arr ) to the cluster set G.

[0094] Then, form a triple ClusterSet = <t, GridID, G> with the GridID of each P-Grid(GridID), the cluster set G, and the current end event timestamp t. Partition according to t so that ClusterSets with the same output timestamp are in the same data partition P-Out(t).

[0095] For each P-Grid(GridID), form a triple ClusterSet = <t, GridID, G> with the output timestamp t = prevTs, GridID, and the cluster set G maintained within the partition. Partition according to t so that ClusterSets with the same timestamp fall within the same data partition P-Out(t).

[0096] Merge all the ClusterSets in each P-Out(t) to obtain the global clustering result within the entire detection area at this timestamp. This step includes the following sub-steps:

[0097] For each ClusterSet under P-Out(t), find all adjacent ClusterSets on the spatial grid according to ClusterSet.GridID. Specifically, for GridID1 = <x, y>, GridID2 = <x + 1, y>, GridID3 = <x, y + 1>, GridID4 = <x +

[0098] 1, y + 1> is adjacent to GridID1. Form a set nearby (ClusterSet) with these adjacent ClusterSets.

[0099] For each set nearby (ClusterSet), creates a set (C) of clusters, and then... nearby For each ClusterSet.G of (ClusterSet), set(C) = set(C) ∩ G.

[0100] For each pair of distinct clusters C1 and C2 in each set(C), check if they have overlapping subtrajectories T. Specifically, T1 of C1 and T2 of C2 have the same T.id. If C1 and C2 have overlapping subtrajectories T, and the number of neighboring subtrajectories nbr(T) of T is greater than the DBSCAN parameter eps, merge C1 and C2 and update set(C).

[0101] Treat each updated set(C) as a cluster G. new =set(C), constructs a ClusterSet new = <t,GridID,G new >

[0102] Merge all ClusterSets new G new For G global :G global =G global ∩G new G global This is the final global clustering result required at time t.

[0103] Based on the aforementioned ancient city, T-Drive real-time taxi trajectory data for Beijing is generated, such as... Figure 6 As shown.

[0104] Real-time clustering and visualization of taxi driving trajectories in the same area at four different time periods were performed, intuitively showing the movement trend and hot spots of taxi flow in the area during these four time periods.

[0105] Corresponding to the aforementioned embodiments of the Flink-based trajectory flow clustering method, this application also provides a Flink-based trajectory flow clustering apparatus. The trajectory flow clustering method based on the above embodiments includes:

[0106] The acquisition module is used to acquire trajectory points generated by the trajectory flow of the monitored moving object.

[0107] The sub-trajectory module generates sub-trajectories using trajectory points generated based on different moving objects and employs trajectory flow compression and segmentation algorithms based on error thresholds.

[0108] The clustering module is used to partition the newly generated sub-trajectories, incrementally execute the clustering algorithm within each partition, and maintain the trajectory clusters generated by the clustering in real time.

[0109] The merging module is used to merge the sub-trajectory clusters of the partitions according to the timestamp, so as to obtain the global clustering result at each timestamp.

[0110] The visualization module is used to statistically analyze and visualize clustering results.

[0111] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0112] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0113] Accordingly, this application also provides an electronic device, including: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the Flink-based trajectory flow clustering method described above. Figure 8 The diagram shown illustrates a hardware structure of any device with data processing capabilities, where a Flink-based trajectory flow clustering method provided in this embodiment of the invention is implemented. (Except for...) Figure 8 In addition to the processor, memory, and network interface shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.

[0114] Accordingly, this application also provides a computer-readable storage medium storing computer instructions, characterized in that, when executed by a processor, the instructions implement the Flink-based trajectory flow clustering method described above. The computer-readable storage medium can be an internal storage unit of any data-processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of a wind turbine, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data-processing device, and can also be used to temporarily store data that has been output or will be output.

[0115] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.

[0116] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A trajectory flow clustering method based on Flink, characterized in that, include: Step 1: Generate multiple spatiotemporal trajectory points based on the GPS information of each moving object within the monitoring area. The spatiotemporal trajectory points include the identifier of the moving object, the generation time of the spatiotemporal trajectory points, and the two-dimensional coordinates of the spatiotemporal trajectory points. Step 2: Classify all spatiotemporal trajectory points based on the identifiers to generate trajectory point partitions corresponding to the moving objects; Step 3: Process the data of each moving object's trajectory points into partitions to generate sub-trajectories that describe the object's latest state. The specific steps are as follows: Step 3-1: Maintain a cache partition within the trajectory point partition for caching valid trajectory points of the moving object. The trajectory points in the cache partition are arranged in timestamp order. Step 3-2: For newly arriving trajectory points, add the trajectory point to the end of the cache partition and determine whether it disrupts the timestamp order. Add trajectory points that are not out of order to the end of the cache partition, and remove other trajectory points in the cache partition that exceed the threshold according to the error threshold algorithm; For trajectory points whose order has been shuffled, rearrange the cache partitions and repeat steps 2 to 3 until the cache partitions meet the requirements. Step 3-3: Copy the constructed cache partition to generate a sub-trajectory that describes the latest state of the moving object; Step 4: Divide the current monitoring area into multiple rectangular spatial grids in the form of two-dimensional clustering space, and perform incremental trajectory clustering processing on the sub-trajectories existing in each rectangular spatial grid in order to maintain all surviving sub-trajectories in the rectangular spatial grid and the cluster information obtained by clustering all sub-trajectories; Step 5: Based on the end time of the event timestamp, merge all cluster information within each rectangular spatial grid to obtain the clustering result of the entire detection area under the event timestamp; Step 6: Perform statistics and visualization based on the clustering results to display the dynamic changes of all moving objects within the monitoring area.

2. The trajectory flow clustering method based on Flink according to claim 1, characterized in that, The moving objects include vehicles, people, buildings, and meteorological data within the area.

3. The trajectory flow clustering method based on Flink according to claim 1, characterized in that, In step 3, trajectory point partitioning and data processing are performed using trajectory flow segmentation and compression algorithms.

4. The trajectory flow clustering method based on Flink according to claim 1, characterized in that, In step 4, the following is adopted: The coding method divides the monitoring area into two-dimensional cluster spaces.

5. The trajectory flow clustering method based on Flink according to claim 1, characterized in that, The incremental trajectory clustering process uses the DBSCAN clustering algorithm.

6. The Flink-based trajectory flow clustering method according to claim 1 or 5, characterized in that, The incremental trajectory clustering process is as follows: Step 4-1: For each trajectory point partition, maintain an index from the moving object to the sub-trajectory. The index stores all surviving sub-trajectories within the current rectangular space grid. Step 4-2: Based on the index shown in Step 4-1, search for the existence of a moving object and its corresponding sub-trajectory in each rectangular spatial grid: If a moving object and its corresponding sub-trajectory exist, the sub-trajectory indexed under the moving object is incrementally removed from the clustered trajectory clusters. If no moving object and corresponding sub-trajectory exist, the moving object and corresponding sub-trajectory are added to the trajectory cluster according to the event timestamp.

7. The trajectory flow clustering method based on Flink according to claim 1, characterized in that, In step 5, the specific process is as follows: Step 5-1: Combine the event timestamp, the rectangular spatial grid, and the cluster information within the rectangular grid into a triplet; Step 5-2: Partition the triples based on the event timestamp to obtain cluster information of all rectangular spatial grids within the same event timestamp; Step 5-3: Merge the cluster information obtained from the partitioning in Step 5-2 to obtain the clustering result of the entire detection area under the corresponding event timestamp.

8. A trajectory flow clustering device, characterized in that, The implementation is based on the Flink-based trajectory flow clustering method as described in any one of claims 1 to 7, including: The acquisition module is used to acquire trajectory points generated by the trajectory flow of the monitored moving object; The sub-trajectory module is used to generate sub-trajectories based on trajectory points generated by different moving objects, using trajectory flow compression and segmentation algorithms based on error thresholds. The clustering module is used to partition the newly generated sub-trajectories, incrementally execute the clustering algorithm within each partition, and maintain the trajectory clusters generated by the clustering in real time. The merging module is used to merge the clustered sub-trajectory clusters of the partition according to the timestamp, so as to obtain the global clustering result at each timestamp; The visualization module is used to statistically analyze and visualize clustering results.

9. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the Flink-based trajectory flow clustering method as described in any one of claims 1-7.