Method for performing two-phase detection on abnormal congestion on urban road on basis of polar coordinate transformation of trajectory data

By using polar coordinate transformation and decision tree detection based on trajectory data, the accuracy and granularity issues of accidental congestion detection in urban road networks have been resolved, achieving efficient and accurate detection of urban roads.

WO2026137642A1PCT designated stage Publication Date: 2026-07-02TONGJI UNIV

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
TONGJI UNIV
Filing Date
2025-04-10
Publication Date
2026-07-02

AI Technical Summary

Technical Problem

Existing methods for detecting accidental congestion are difficult to apply to urban road networks, as they have low accuracy and large detection granularity, making it impossible to accurately identify the direction of traffic flow affected by accidental congestion.

Method used

The polar coordinate transformation method based on trajectory data acquires lane-level spatiotemporal trajectory data of vehicles, divides spatiotemporal windows and calculates trajectory segment features, uses clustering to identify abnormal trajectory segments, and combines decision trees to detect the anomaly rate, thus achieving two-stage detection of urban roads.

Benefits of technology

It improves the accuracy and timeliness of detecting accidental congestion on urban roads, is applicable to urban road networks, achieves detection granularity at the vehicle flow direction level, and enhances detection performance under low-penetration trajectory data conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025088215_02072026_PF_FP_ABST
    Figure CN2025088215_02072026_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to a method for performing two-phase detection on abnormal congestion on an urban road on the basis of the polar coordinate transformation of trajectory data. The method includes two phases, i.e., the identification of an abnormal trajectory segment and the detection of incident-induced congestion. In the phase involving the identification of an abnormal trajectory segment, two key features (i.e., an average speed and a time when a road section is entered) are defined so as to capture trajectory segment features within spatio-temporal windows, and the features are affected by both incident-induced congestion and signal timing at downstream intersections; and on the basis of the two key features, the abnormal trajectory segment is identified by means of clustering. In the phase involving the detection of incident-induced congestion, anomaly rates of the spatio-temporal windows are defined; and on the basis of the anomaly rates, a decision tree is used to identify spatio-temporal windows in which incident-induced congestion occurs. Compared with the prior art, the present invention is applicable to urban road networks, and by means of the present invention, the detection of incident-induced congestion at a signal-cycle level in time and a vehicle-flow-level in space is realized.
Need to check novelty before this filing date? Find Prior Art

Description

A two-stage detection method for abnormal urban road congestion based on polar coordinate transformation of trajectory data Technical Field

[0001] This invention relates to the field of accidental traffic congestion detection, and in particular to a two-stage detection method for abnormal traffic congestion on urban roads based on polar coordinate transformation of trajectory data. Background Technology

[0002] With the continuous growth of motor vehicle travel demand, traffic congestion has become a common problem on urban roads. Based on the frequency of occurrence, congestion can be divided into recurring congestion and occasional congestion. Occasional congestion can be caused by various factors such as large events, construction zones, weather, and traffic accidents. According to data from the US Federal Traffic Safety Administration (FHWA), occasional congestion accounts for 52-58% of total traffic congestion in the United States, while accidental congestion accounts for about 25%. Compared with other types of congestion, accidental congestion can occur at any time or place, causing unpredictable delays that are more intolerable for travelers. Furthermore, accidental congestion not only negatively impacts traffic efficiency but can also lead to secondary accidents, affecting traffic safety. Timely and effective detection of accidental congestion is crucial for alleviating congestion, reducing delays, and mitigating related losses.

[0003] Existing methods for detecting accidental traffic congestion have the following main shortcomings:

[0004] (1) Most accidental congestion detection algorithms are developed for highway scenarios. Since they do not take into account the impact of intersection signal timing, they are difficult to apply to urban road network scenarios.

[0005] (2) The low penetration rate of trajectory data reduces the accuracy and timeliness of detection, which remains the main challenge for trajectory-based accidental congestion detection.

[0006] (3) The road segment is considered the smallest spatial detection unit, so it is impossible to accurately identify the direction of traffic flow affected by accidental congestion. Summary of the Invention

[0007] The purpose of this invention is to overcome the shortcomings of the existing technology by providing a two-stage detection method for abnormal congestion on urban roads based on polar coordinate transformation of trajectory data, so as to solve or partially solve the problems of inapplicability to urban road networks, low accuracy of congestion detection, and large detection granularity.

[0008] The objective of this invention can be achieved through the following technical solutions:

[0009] One aspect of the present invention provides a two-stage detection method for abnormal congestion on urban roads based on polar coordinate transformation of trajectory data, comprising the following steps:

[0010] Acquire lane-level spatiotemporal trajectory data of the vehicle;

[0011] Based on the lane-level spatiotemporal trajectory data, the spatiotemporal plane is divided into multiple spatiotemporal windows according to the signal period, and multiple trajectory segments are obtained based on the spatiotemporal window division.

[0012] Calculate the features of each trajectory segment separately;

[0013] By clustering the features of the trajectory segments, abnormal points are identified after clustering, and abnormal trajectory segments are obtained.

[0014] Based on the abnormal trajectory segments, the anomalous rate associated with the spatiotemporal window is calculated;

[0015] Based on the anomaly rate associated with the spatiotemporal window, a detection result representing whether accidental congestion occurred in the corresponding spatiotemporal window is obtained using a trained decision tree.

[0016] As a preferred technical solution, the lane-level spatiotemporal trajectory data includes timestamps, vehicle IDs, the road segment where the vehicle is located, the lane occupied by the vehicle, and the distance measured from the starting point of each road segment.

[0017] As a preferred technical solution, the method of obtaining multiple trajectory segments based on spatiotemporal window segmentation includes the following steps:

[0018] Based on the lane-level spatiotemporal trajectory data, for any vehicle within any time window, the moment the vehicle enters the road segment is extracted as the starting point of the trajectory segment. It is then determined whether the end point of the vehicle's solid line trajectory is within the current time window. If not, the end point of the current time window is taken as the end point of the trajectory segment. If so, the moment the vehicle leaves the road segment is taken as the end point of the trajectory segment.

[0019] As a preferred technical solution, the characteristics of the trajectory segment include average speed and starting time.

[0020] As a preferred technical solution, after calculating the characteristics of each trajectory segment, the method further includes:

[0021] Using the average velocity as the polar radius and the starting time as the polar angle, the trajectory segment is represented in the polar coordinate system.

[0022] As a preferred technical solution, the representation of the trajectory segment in the polar coordinate system is achieved by the following formula:

[0023] Where (r, θ) are the polar coordinates of the trajectory segment represented in the polar coordinate system, V l This is the speed limit for the road, where V0 is a very small speed, C is the duration of the signal cycle, and V... tra_seg SM tra_segThese represent the average travel speed and starting time of the trajectory segment, respectively.

[0024] As a preferred technical solution, the process of clustering the features of the trajectory segments, identifying clustered outliers, and obtaining abnormal trajectory segments includes the following steps:

[0025] Map each trajectory segment to a point in the polar coordinate system and mark all points as unvisited.

[0026] Traverse the point set, calculate the distance between the current point and other points, and determine whether the number of points with a distance less than a preset value is greater than the preset minimum number. If so, mark the current point as the core point.

[0027] Traverse the set of non-core points, calculate the distance between the current point and the nearest core point, and determine whether the distance is less than a preset value. If yes, mark the current point as a boundary point; otherwise, mark the current point as a noise point.

[0028] All trajectory segments corresponding to noise points are considered as abnormal trajectory segments.

[0029] As a preferred technical solution, the anomaly rate of the spatiotemporal window association includes and The anomaly rate associated with the spatiotemporal window is calculated using the following formula:

[0030] in, It is the anomaly rate of traffic flow direction m within the time window t. It is the number of anomalous trajectory fragments within the spatiotemporal window. It is the total number of trajectory segments within the spacetime window. It is the anomaly rate of traffic flow direction m within the time window t-1. It is the overall anomaly rate of adjacent traffic flows of direction m within time window t, Mm={L,R,T}\{m}, where T, L, and R represent the straight, left-turn, and right-turn traffic flows on the road segment, respectively.

[0031] As a preferred technical solution, the training process of the decision tree includes the following steps:

[0032] Obtain the training dataset, which includes anomaly rate data associated with spatiotemporal windows and corresponding labels;

[0033] Based on the training dataset, the optimal splitting feature and its splitting point are calculated at each node of the decision tree. The training samples are then divided into two subsets, corresponding to the left and right child nodes of the tree, respectively. The above steps are repeated for each child node until a preset stopping condition is met.

[0034] The process of obtaining the optimal splitting features and their segmentation points includes the following steps:

[0035] Try different split points for each feature and calculate the Gini index of the split subsets;

[0036] The features and split points that minimize the Gini coefficient are selected as the optimal splitting features and split points.

[0037] The preset stopping conditions include one or more of the following: the number of samples in the dataset is less than a preset threshold, the Gini index is less than a preset threshold, and the maximum depth of the tree reaches a preset value.

[0038] In another aspect, an electronic device is provided, comprising: one or more processors and a memory, wherein the memory stores one or more programs, the one or more programs including instructions for executing the aforementioned two-stage detection method for abnormal congestion on urban roads based on polar coordinate transformation of trajectory data.

[0039] Compared with the prior art, the present invention has at least one of the following beneficial effects:

[0040] (1) Applicable to urban road networks: This invention takes into account the influence of intersection signal timing, divides the spatiotemporal plane into multiple spatiotemporal windows, obtains multiple trajectory segments based on the spatiotemporal window division, and realizes detection based on the trajectory segments, thus making it applicable to urban roads.

[0041] (2) High detection accuracy and timeliness under low penetration trajectory data conditions: This invention, through the definition of key features (average vehicle speed of trajectory segment and time of entry into road segment) and polar coordinate transformation, considers the impact of timed signal control at intersections on traffic flow, distinguishes abnormal trajectories affected by accidental congestion from normal trajectories affected by traffic lights, and fully ensures the accuracy and timeliness of detection.

[0042] (3) Small detection granularity: This invention is based on lane-level spatiotemporal trajectory data of multiple vehicles to achieve traffic flow-level congestion detection. Attached Figure Description

[0043] Figure 1 is a flowchart of the two-stage detection method for abnormal urban road congestion based on polar coordinate transformation of trajectory data in the embodiment;

[0044] Figure 2 is a schematic diagram of the trajectory segments and their feature definitions in the embodiment;

[0045] Figure 3 is a visualization of the polar coordinate transformation result of the trajectory segment in the embodiment;

[0046] Figure 4 is a schematic diagram of the trained decision tree in the embodiment;

[0047] Figure 5 is a schematic diagram of the road network in the embodiment;

[0048] Figure 6 is a schematic diagram of the electronic device in the embodiment. Detailed Implementation

[0049] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0050] Example 1

[0051] To address the problems of the aforementioned existing technologies, this embodiment provides a two-stage detection method for abnormal congestion on urban roads based on polar coordinate transformation of trajectory data. Using a trajectory dataset obtained from the road network shown in Figure 5, it achieves accident-related congestion detection. This method comprises two stages: abnormal trajectory segment identification and accident-related congestion detection. In the abnormal trajectory segment identification stage, two key features (i.e., average speed and entry time into the road segment) are defined to capture trajectory segment features within a spatiotemporal window. These features are influenced by both accident-related congestion and downstream intersection signal timing. Based on these two key features, abnormal trajectory segments are identified through clustering. In the accident-related congestion detection stage, an anomalous rate for the spatiotemporal window is defined. Based on the anomalous rate, a decision tree is used to identify the accident-related congestion spatiotemporal window.

[0052] Referring to Figure 1, this method includes the following steps:

[0053] Step S1: Obtain lane-level spatiotemporal trajectory data of the vehicle.

[0054] The spatiotemporal trajectory data includes the floating car's driving status, such as timestamps, vehicle IDs, road segments, occupied lanes, and distances measured from the starting point of each segment.

[0055] Preferably, after acquiring the spatiotemporal trajectory data, a data cleaning process is also included.

[0056] Step S2: Based on lane-level spatiotemporal trajectory data, the spatiotemporal plane is divided into multiple spatiotemporal windows according to the signal period, and multiple trajectory segments are obtained based on the spatiotemporal window division.

[0057] The spatiotemporal plane is divided into several spatiotemporal windows by the duration of the signal period. A trajectory can traverse one spatiotemporal window (dotted line) or multiple spatiotemporal windows (solid line). A trajectory segment within a spatiotemporal window is defined by its time start and end point. The time start of the trajectory segment is the moment the vehicle enters the road segment. The time end of the trajectory segment has two possibilities: if the trajectory leaves the road segment within the spatiotemporal window, the end point is the time when the trajectory leaves the road segment; if the trajectory crosses this spatiotemporal window, the end point is the time when the spatiotemporal window ends.

[0058] For example, referring to the dotted line trajectory in Figure 2, the trajectory enters and exits spacetime window 2 at t1 and t2 respectively, and the corresponding trajectory segment TS1 is the part from t1 to t2. The solid line trajectory enters the spacetime window at t3, crosses the boundary between spacetime window 3 and spacetime window 4 at t4, and leaves the road segment at time t5 within spacetime window 4. Therefore, the corresponding trajectory segment TS1 collected in spacetime window 3 is the part from t3 to t4, and the corresponding trajectory segment TS3 collected in spacetime window 4 is the part between t3 and t5. The trajectory segments collected in spacetime windows 3 and 4 have the same starting point.

[0059] The above process defines the trajectory segments within a spatiotemporal window and their key characteristics: the average velocity of the trajectory segment and the start time of the trajectory segment. Based on the above process, the start and end points of all trajectory segments within each spatiotemporal window can be obtained.

[0060] This embodiment calculates two key features to characterize a trajectory segment within a spatiotemporal window, including the average travel speed V of the feature trajectory segment. tra_seg And the time when the vehicle enters the road segment (i.e., the start time SM of the trajectory segment). tra_seg For example, the V of the three trajectory segments in Figure 2 tra_seg and SM tra_seg The specific calculation formula is as follows:

[0061] SM1 = t1

[0062] SM2=t3

[0063] SM3 = t3

[0064] An intersection and one of its approach lanes are considered as a detection object. Each detection object includes three traffic flow directions: straight, left turn, and right turn. Each traffic flow direction is considered a spatial detection unit, and the cycle length of the intersection is controlled at regular intervals as a temporal detection unit. The state of a traffic flow direction within one cycle is defined as the state of a spatiotemporal window, which is used as the basic unit to detect whether accidental congestion occurs in the spatiotemporal window in real time.

[0065] Step S3: Calculate the characteristics of each trajectory segment.

[0066] This step transforms the trajectory segment into a point in the polar coordinate system. The two key features of the trajectory segment (average velocity and starting time) are transformed into the coordinates (r, θ) of the point.

[0067] The formula for converting a trajectory segment into a point (r, θ) in polar coordinates is:

[0068] Among them, V l V0 is the speed limit of the road (in km / h), V0 is defined as a very small speed (e.g., 1 km / h), and C is the duration of the signal cycle.

[0069] After the historical trajectory segments of the same spatial unit are transformed into polar coordinates, they are visualized in the polar coordinate system as shown in Figure 3. Among them, the three scatter plots (a), (b), and (c) represent the straight-through traffic flow, the left-turning traffic flow, and the right-turning traffic flow, respectively.

[0070] Step S4, Abnormal trajectory segment identification: By clustering the features of the trajectory segments, abnormal points after clustering are identified, and abnormal trajectory segments are obtained.

[0071] This step uses historical trajectory segments of the same spatial unit as input for clustering, marks outliers identified by the algorithm as abnormal trajectory segments, marks other points as normal trajectory segments, and outputs the recognition results.

[0072] Specifically, the recognition algorithm process is shown in Table 1.

[0073] Table 1. Cluster-based algorithm for identifying abnormal trajectory segments

[0074] Step S5: Calculate the anomalous rate of spatiotemporal window association based on anomalous trajectory segments.

[0075] This step defines the spatiotemporal window anomaly rate as a feature. Based on the number of anomalous trajectory segments within a spatiotemporal window, it calculates three anomaly rates associated with that spatiotemporal window. and The following formula is used for calculation:

[0076] in, It is the anomaly rate of spatial detection unit m within the time window t; It represents the number of abnormal trajectory fragments detected within that spatiotemporal window; It is the total number of trajectory fragments collected within that spatiotemporal window; It is the anomaly rate of spatial detection unit m within the time window t-1; M represents the overall anomaly rate of adjacent flow directions of spatial detection unit m within time window t. m ={L, R, T}\{m}; T, L, R represent three spatial detection units on a certain road segment, namely the three flow directions of straight, left turn, and right turn.

[0077] Step S6, Accidental congestion detection: Based on the anomaly rate associated with the spatiotemporal window, the trained decision tree is used to obtain the detection result representing whether accidental congestion occurred in the corresponding spatiotemporal window.

[0078] Three anomaly rates associated with a spatiotemporal window ( and Using the presence or absence of accidental congestion within a given spatiotemporal window as a feature, a binary classification result is obtained. A decision tree is trained based on historical data, as shown in Figure 4. The trained decision tree is then used to classify spatiotemporal windows in real time. See label 2 for the binary tree training algorithm.

[0079] Table 2 Decision Tree Training Algorithm

[0080] See Table 3 for the process of identifying accidental congestion using the trained decision tree.

[0081] Table 3 Identification of Accidental Traffic Congestion

[0082] In summary, this method targets urban road networks, achieving accidental congestion detection at the temporal signal cycle level and the spatial vehicle flow direction level. By defining key features (average vehicle speed of trajectory segments and entry time into the road segment) and performing polar coordinate transformation, the impact of timed signal control at intersections on traffic flow is considered, distinguishing abnormal trajectories affected by accidental congestion from normal trajectories affected by traffic lights. A two-stage detection framework of abnormal trajectory segment identification and accidental congestion detection is designed, defining anomaly rates for spatiotemporal windows to capture periodic and flow direction-level traffic states, improving the algorithm's adaptability to low-penetration trajectory conditions and diverse road conditions.

[0083] Example 2

[0084] This embodiment provides an electronic device, including: one or more processors and a memory, wherein the memory stores one or more programs, the one or more programs including instructions for executing the two-stage detection method for abnormal congestion on urban roads based on trajectory data polar coordinate transformation as described in Embodiment 1.

[0085] As shown in Figure 6, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to implement the two-stage detection method for abnormal urban road congestion based on trajectory data polar coordinate transformation as described in Figure 1. Of course, in addition to the software implementation, this invention does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution subject of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.

[0086] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0087] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0088] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data, characterized in that, Includes the following steps: Acquire lane-level spatiotemporal trajectory data of the vehicle; Based on the lane-level spatiotemporal trajectory data, the spatiotemporal plane is divided into multiple spatiotemporal windows according to the signal period, and multiple trajectory segments are obtained based on the spatiotemporal window division. Calculate the features of each trajectory segment separately; By clustering the features of the trajectory segments, abnormal points are identified after clustering, and abnormal trajectory segments are obtained. Based on the abnormal trajectory segments, the anomalous rate associated with the spatiotemporal window is calculated; Based on the anomaly rate associated with the spatiotemporal window, a detection result representing whether accidental congestion occurred in the corresponding spatiotemporal window is obtained using a trained decision tree. 2.The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The lane-level spatiotemporal trajectory data includes timestamps, vehicle IDs, the road segment where the vehicle is located, the lane occupied by the vehicle, and the distance measured from the starting point of each road segment. 3.The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The process of obtaining multiple trajectory segments based on spatiotemporal window division includes the following steps: Based on the lane-level spatiotemporal trajectory data, for any vehicle within any time window, the moment the vehicle enters the road segment is extracted as the starting point of the trajectory segment. It is then determined whether the end point of the vehicle trajectory is within the current time window. If not, the end point of the current time window is taken as the end point of the trajectory segment. If so, the moment the vehicle leaves the road segment is taken as the end point of the trajectory segment.

4. The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The trajectory segment features include average velocity and starting time.

5. The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 4, characterized in that, After calculating the features of each trajectory segment, the following is also included: The trajectory segment is represented into the polar coordinate system by taking the transformed average speed as the polar radius and the transformed start time as the polar angle, and the representation into the polar coordinate system is realized by using the following formula: where (r, θ) is the polar coordinate of the trajectory segment represented in polar coordinate system, V1is the speed limit of the road, V0is a very small speed, C is the length of the signal cycle, V tra_seg , SM tra_seg are the average travel speed and the start time of the trajectory segment, respectively.

6. The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The process of clustering the features of the trajectory segments, identifying outliers after clustering, and obtaining abnormal trajectory segments includes the following steps: Map each trajectory segment to a point in the polar coordinate system and mark all points as unvisited. Traverse the point set, calculate the distance between the current point and other points, and determine whether the number of points with a distance less than a preset value is greater than the preset minimum number. If so, mark the current point as the core point. Traverse the set of non-core points, calculate the distance between the current point and the nearest core point, and determine whether the distance is less than a preset value. If yes, mark the current point as a boundary point; otherwise, mark the current point as a noise point. All trajectory segments corresponding to noise points are treated as abnormal trajectory segments.

7. The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The abnormality rate associated with the spatiotemporal window includes and The abnormality rate associated with the spatiotemporal window is calculated using the following formula: wherein, is the abnormal rate of the traffic flow to m in the time window t, is the number of abnormal trajectory segments within the spatio-temporal window, is the total number of trajectory segments within the spatiotemporal window, is the abnormal rate of the traffic flow to m in the time window t-1, is the total abnormal rate of adjacent flow directions of flow direction m in time window t, M m = {L, R, T} \ {m}, T, L, R represent straight, left turn, right turn flow directions on the road segment, respectively. 8.The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, The training process of the decision tree includes the following steps: Obtain the training dataset, which includes anomaly rate data associated with spatiotemporal windows and corresponding labels; Based on the training dataset, the optimal splitting feature and its splitting point are calculated at each node of the decision tree. The training samples are then divided into two subsets, corresponding to the left and right child nodes of the tree, respectively. The above steps are repeated for each child node until a preset stopping condition is met. When a node stops splitting, it is marked as a leaf node, and the classification result is output from the leaf node. The process of obtaining the optimal splitting features and their segmentation points includes the following steps: Try different split points for each feature and calculate the Gini index of the split subsets; The features and split points that minimize the Gini coefficient are selected as the optimal splitting features and split points. The preset stopping conditions include one or more of the following: the number of samples in the dataset is less than a preset threshold, the Gini index is less than a preset threshold, and the maximum depth of the tree reaches a preset value. 9.The two-stage method for detecting abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to claim 1, characterized in that, A crossroad and a road section where one of the entrances is located are taken as a detection object, each detection object contains straight, left and right turning traffic directions, each traffic direction is taken as a space detection unit, the cycle length of the time control crossroad is taken as a time detection unit, the state of one direction in a cycle is taken as the state of a space-time window, and whether the space-time window has an accident congestion is detected in real time as a basic unit.

10. An electronic device, comprising: The application relates to a computer program product, comprising: One or more processors and a memory, the memory storing one or more programs, the one or more programs comprising instructions for performing the two-stage detection method for abnormal congestion of urban roads based on polar coordinate conversion of trajectory data according to any one of claims 1-9.