Trajectory classification method, trajectory classification model training method and computer program product
By dividing trajectories into fragments of different road types and fusing classification results, combining time series characteristics and spatial information, the problem of inaccurate trajectory classification in the prior art is solved, and the accuracy of identification of trajectory categories is improved.
Patent Information
- Application Number
- CN202210119091.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-08
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-02-08
AI Technical Summary
The existing trajectory classification technology fails to effectively consider spatial characteristics, resulting in inaccurate classification. Especially in the identification of low-speed trajectories on high-speed roads, walking or riding is easy to misclassify as car trajectories.
A method is proposed to divide the trajectory into fragments of different road types, extract time series features, and classify them using the classification model corresponding to the road type, fuse the results of each fragment to determine the trajectory category, and consider the position of the trajectory fragment in the trajectory Feature splicing is performed in sequence.
It improves the accuracy of trajectory classification, can more accurately identify trajectory categories, and reduces misclassification, especially in the identification of low-speed trajectories on high-speed roads.
Smart Images

Figure CN114707567B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of location services, and in particular to a trajectory classification method, a trajectory classification model training method, and a computer program product. Background Art
[0002] At present, various classifiers are used in the existing technology to classify the passage trajectory of the object, wherein the classifiers mainly include tree models, LR, Bayesian, deep neural network models, etc. The inventors of the present disclosure found that these classifiers mainly perceive the time series characteristics of the trajectory, such as speed, acceleration, etc., and do not take into account the spatial characteristics when classifying the trajectories of different passage modes. For example, if the speed characteristic of a trajectory is low and the speed is continuously low, it is likely to be classified as walking or cycling. However, if this trajectory is on a highway, it is actually more likely to be a car trajectory, rather than a walking trajectory or a cycling trajectory.
[0003] Therefore, it is necessary to propose a trajectory classification scheme that can consider both spatial features and temporal sequence features to solve the problem of inaccurate trajectory classification. Summary of the invention
[0004] Embodiments of the present disclosure provide a trajectory classification method, a trajectory classification model training method, and a computer program product.
[0005] In a first aspect, an embodiment of the present disclosure provides a trajectory classification method, which includes:
[0006] Get the trajectory to be classified;
[0007] Based on the road type to which the track points in the track to be classified belong, the track to be classified is divided into one or more track segments, where all track points in the same track segment belong to the same road type;
[0008] Extracting at least one time series feature for each of the trajectory segments;
[0009] Based on the at least one time series feature, a travel mode category of the trajectory to be classified is determined.
[0010] Further, based on the at least one time series feature, determining the travel mode category of the trajectory to be classified includes:
[0011] Determining a road type to which each of the trajectory segments belongs, and a first trajectory classification model corresponding to the road type; wherein different road types correspond to different first trajectory classification models;
[0012] For each of the trajectory segments, inputting the time series features corresponding to the trajectory segment into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs, to obtain a classification result of the trajectory segment;
[0013] The classification results corresponding to the various trajectory segments are merged to determine the travel mode category of the trajectory to be classified.
[0014] Furthermore, different first trajectory classification models are trained separately, and the road type to which the sample trajectories for training the first trajectory classification model belong is the same as the road type corresponding to the first trajectory classification model.
[0015] Further, the classification results corresponding to the trajectory segments are merged to determine the type of traffic mode of the trajectory to be classified, including:
[0016] After weighting and fusing the classification results corresponding to the trajectory segments, the travel mode category of the trajectory to be classified is obtained; wherein the weight for weighting the classification results of the trajectory segments is related to the length ratio of the trajectory segments in the trajectory to be classified.
[0017] Further, based on the at least one time series feature, determining the travel mode category of the trajectory to be classified includes:
[0018] assembling the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0019] The total time series features are input into a second trajectory classification model to obtain the travel mode category of the trajectory to be classified.
[0020] Further, the at least one time series feature extracted from the trajectory segment is assembled into a total time series feature, comprising:
[0021] Extracting a predetermined number of time series features from each of the trajectory segments, wherein the types of the predetermined number of time series features extracted from different trajectory segments are consistent with each other;
[0022] According to the position order of the trajectory segments in the trajectory to be classified, a predetermined number of time series features corresponding to each trajectory segment are sequentially spliced to obtain the total time series feature.
[0023] In a second aspect, an embodiment of the present disclosure provides a trajectory classification model training method, which includes:
[0024] Acquire training data; the training data includes a plurality of sample trajectories;
[0025] Dividing the to-be-classified trajectory into one or more trajectory segments based on the road type to which the trajectory points in the sample trajectory belong, wherein all trajectory points in the same trajectory segment belong to the same road type;
[0026] Extracting at least one time series feature for each of the trajectory segments;
[0027] The at least one time series feature is input into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs for training; wherein different road types correspond to different first trajectory classification models.
[0028] In a third aspect, an embodiment of the present disclosure provides a trajectory classification model training method, which includes:
[0029] Acquire training data; the training data includes a plurality of sample trajectories;
[0030] Based on the road type to which the trajectory points in the sample trajectory belong, the trajectory to be classified is divided into one or more trajectory segments, where all trajectory points in the same trajectory segment belong to the same road type;
[0031] Extracting at least one time series feature for each of the trajectory segments;
[0032] splicing the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0033] The total time series features are input into the second classification model for training.
[0034] In a fourth aspect, a method for analyzing traffic conditions is provided in an embodiment of the present disclosure, wherein after trajectories on a road are classified using the method described in the first aspect, the traffic conditions on the road are analyzed based on the classification results.
[0035] In a fifth aspect, an embodiment of the present invention provides a trajectory classification device, including:
[0036] A first acquisition module is configured to acquire a trajectory to be classified;
[0037] A first division module is configured to divide the trajectory to be classified into one or more trajectory segments based on the road type to which the trajectory points in the trajectory to be classified belong, wherein all trajectory points in the same trajectory segment belong to the same road type;
[0038] A first extraction module is configured to extract at least one time series feature for each of the trajectory segments;
[0039] The first determination module is configured to determine the travel mode category of the trajectory to be classified based on the at least one time series feature.
[0040] In a sixth aspect, an embodiment of the present invention provides a trajectory classification model training device, which includes:
[0041] A third acquisition module is configured to acquire training data; the training data includes a plurality of sample trajectories;
[0042] A third division module is configured to divide the to-be-classified trajectory into one or more trajectory segments based on the road type to which the trajectory points in the sample trajectory belong, wherein all trajectory points in the same trajectory segment belong to the same road type;
[0043] A third extraction module is configured to extract at least one time series feature for each of the trajectory segments;
[0044] a splicing module, configured to splice the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0045] The second training module is configured to input the total time series features into the second classification model for training.
[0046] In a seventh aspect, an embodiment of the present invention provides a traffic condition analysis device, wherein after the trajectories on the road are classified using the device described in the fifth aspect, the traffic condition on the road is analyzed based on the classification result.
[0047] The functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions.
[0048] In one possible design, the structure of the above-mentioned device includes a memory and a processor, the memory is used to store one or more computer instructions that support the above-mentioned device to execute the above-mentioned corresponding method, and the processor is configured to execute the computer instructions stored in the memory. The above-mentioned device may also include a communication interface for the above-mentioned device to communicate with other devices or communication networks.
[0049] In an eighth aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in any one of the above aspects.
[0050] In a ninth aspect, an embodiment of the present disclosure provides a computer-readable storage medium for storing computer instructions used by any of the above-mentioned devices, and the computer instructions are used to implement the method described in any of the above-mentioned aspects when executed by a processor.
[0051] In a tenth aspect, an embodiment of the present disclosure provides a computer program product, which includes computer instructions, and when the computer instructions are executed by a processor, they are used to implement the method described in any of the above aspects.
[0052] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0053] In this embodiment, when classifying the trajectory, the trajectory to be classified is divided into one or more trajectory segments according to spatial features, such as the road type to which the trajectory point in the trajectory to be classified belongs, and then the time series features are extracted for each trajectory segment, and then the classification model is classified based on the time series features extracted from each trajectory segment. In the process of trajectory classification, the disclosed embodiment extracts time series features with spatial information from the trajectory to be classified. This method considers both the spatial features of the trajectory and the time series features of the trajectory, so that the time series features used to identify the trajectory category are strongly correlated with the trajectory category, thereby improving the accuracy of trajectory classification.
[0054] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0056] Figure 1 A flow chart showing a trajectory classification method according to an embodiment of the present disclosure is shown;
[0057] Figure 2 A schematic diagram of an application process for classifying user trajectory data according to an embodiment of the present disclosure is shown;
[0058] Figure 3 A flowchart of a trajectory classification model training method according to an embodiment of the present disclosure is shown;
[0059] Figure 4 A schematic diagram of model training of a first trajectory classification model according to an embodiment of the present disclosure is shown;
[0060] Figure 5 A flowchart showing a trajectory model training method according to another embodiment of the present disclosure is shown;
[0061] Figure 6 A schematic diagram of model training of a second trajectory classification model according to an embodiment of the present disclosure is shown;
[0062] Figure 7 A schematic diagram of an application scenario of trajectory classification according to an embodiment of the present disclosure is shown;
[0063] Figure 8 It is a structural schematic diagram of an electronic device suitable for implementing the trajectory classification method, trajectory classification model training method and / or traffic condition analysis method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0064] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0065] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the specification, and do not exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0066] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0067] The details of the embodiments of the present disclosure are described in detail below through specific examples.
[0068] Figure 1 FIG. 4 is a flow chart showing a trajectory classification method according to an embodiment of the present disclosure. Figure 1 As shown, the trajectory classification method includes the following steps:
[0069] In step S101, a trajectory to be classified is obtained;
[0070] In step S102, based on the road type to which the track points in the track to be classified belong, the track to be classified is divided into one or more track segments, and all track points in the same track segment belong to the same road type;
[0071] In step S103, extracting at least one time series feature for each of the trajectory segments;
[0072] In step S104, based on the at least one time series feature, the travel mode category of the trajectory to be classified is determined.
[0073] In this embodiment, the trajectory to be classified can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object to obtain the mode of travel category of the trajectory. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0074] Trajectory classification can be applied in various scenarios. For example, the target object's portrait can be obtained by classifying the trajectory. Another example is that trajectory classification can be applied to smart transportation; for example, if you want to improve the green wave between urban traffic lights according to the road flow, the data of non-motor vehicles and pedestrians will interfere with the analysis of effective car flow on the road, hinder the analysis of road dynamic information by relevant departments, and thus curb the development of smart transportation; if the trajectory can be correctly classified, on the one hand, the above problems can be solved, and on the other hand, the traffic conditions for non-motor vehicle groups can be improved, such as further optimization and adjustment of sidewalks, zebra crossings, pedestrian bridges and cycling roads according to pedestrian and cycling flow, and even traffic control can be carried out according to different types of real-time traffic. For example, during the May Day and October travel festivals every year, traffic police can control traffic at popular tourist attractions according to actual traffic flow, which can improve traffic congestion.
[0075] As described in the background technology, considering that the classifiers studied by the current cutting-edge technology of trajectory classification only classify based on the time series features in the trajectory, and do not consider the spatial features, resulting in inaccurate trajectory classification results, the embodiment of the present disclosure proposes a trajectory classification method, which not only considers the time series features of the trajectory, but also considers the spatial features of the trajectory (that is, the road type to which the trajectory points in the trajectory belong), thereby greatly improving the accuracy of trajectory classification.
[0076] In this embodiment, the spatial feature of the trajectory may be a location feature of the trajectory point, and the location feature may include the latitude and longitude data of the GPS point, the road section to which the trajectory point belongs, and the road type to which the trajectory point belongs.
[0077] In some embodiments, a road segment may be a directed unit divided according to an actual road, each road segment corresponds to an actual road and has a unique ID. Road types may be divided according to spatial features, for example, road types may include but are not limited to 10 types, such as expressways, national roads, provincial roads, county roads, rural roads, main streets, urban expressways, main roads, secondary roads, and ordinary roads.
[0078] For the same trajectory to be classified, the trajectory to be classified can be divided into one or more different trajectory segments based on the location information of the trajectory points in the trajectory to be classified and the road type of the road to which the location information belongs. In the process of dividing the trajectory segments, the starting point of the trajectory to be classified can be used as the starting position point to traverse backwards to determine the road type to which the location information corresponding to each position point belongs. When the road type to which the location information corresponding to the current position point belongs is different from the road type to which the location information corresponding to the previous position point belongs, all the position points between the starting position point and the previous position point (including the starting position point of the traversal and the previous position point) are divided into a trajectory segment, and the current position point is used as the starting position point of the next traversal, and the subsequent position points are traversed in the above manner. Of course, it can be understood that the end point of a trajectory can also be used as the starting position point for forward traversal, and a point in the middle of a trajectory can also be used as the starting position point for forward or backward traversal. The specific method can be determined according to actual needs and is not limited here.
[0079] After the trajectory to be classified is divided in the above manner, one or more trajectory segments may be obtained. The one or more trajectory segments may correspond to the same or different road types, and all trajectory points in the same trajectory segment belong to the same road type.
[0080] In this embodiment, time series features are extracted for each trajectory segment obtained by division, that is, each trajectory segment is taken as a separate trajectory to extract time series features. Time series features may include but are not limited to: speed, acceleration, displacement, etc.
[0081] In some embodiments, 11 time series features, including average speed, maximum speed, speed variance, average displacement, maximum displacement, displacement variance, average acceleration, maximum acceleration, acceleration variance, total track running time, and total displacement, can be extracted from the track segment. That is, the above 11 time series features can be extracted from each track segment, and the 11 time series features can be used as the classification basis of the track segment.
[0082] After extracting the time series features for each trajectory segment, the trajectory to be classified can be classified based on the time series features extracted from each trajectory segment. It should be noted that if a trajectory to be classified is divided into N (N is a positive integer greater than or equal to 1) trajectory segments, and M (M is a positive integer greater than or equal to 1) time series features are extracted from a trajectory segment, then the trajectory to be classified is equivalent to extracting a total of N*M time series features, and each M time series features belong to the time series features of the trajectory under the same road type. It should be noted that the types of time series features extracted from different trajectory segments are the same, that is, in the prior art, only M time series features are extracted from the entire trajectory to be classified, while this embodiment extracts M time series features from one trajectory segment. If a trajectory to be classified is divided into multiple trajectory segments, multiple groups of M time series features will be extracted. And the spatial features of each group of M time series features are the same, that is, each group of M time series features is extracted from trajectory points belonging to the same road type. It can be understood that the time series features extracted in the embodiments of the present disclosure have spatial information, that is, they reflect both time series features and spatial features, which is different from the time series features in the prior art that do not have spatial information.
[0083] In some embodiments, a pre-trained classification model can be used to input the time series features extracted from each trajectory segment into the pre-trained classification model to obtain a classification result of the trajectory to be classified, that is, the travel mode category of the trajectory to be classified. The pre-trained classification model can select an existing classification model, such as an XGBoost model, a convolutional neural network model, etc.
[0084] In this embodiment, when classifying the trajectory, the trajectory to be classified is divided into one or more trajectory segments according to spatial features, such as the road type to which the trajectory point in the trajectory to be classified belongs, and then the time series features are extracted for each trajectory segment, and then the classification model is classified based on the time series features extracted from each trajectory segment. In the process of trajectory classification, the disclosed embodiment extracts time series features with spatial information from the trajectory to be classified. This method considers both the spatial features of the trajectory and the time series features of the trajectory, so that the time series features used to identify the trajectory category are strongly correlated with the trajectory category, thereby improving the accuracy of trajectory classification.
[0085] In an optional implementation of this embodiment, step S104, i.e., the step of determining the travel mode category of the trajectory to be classified based on the at least one time series feature, further includes the following steps:
[0086] Determining a road type to which each of the trajectory segments belongs, and a first trajectory classification model corresponding to the road type; wherein different road types correspond to different first trajectory classification models;
[0087] For each of the trajectory segments, inputting the time series features corresponding to the trajectory segment into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs, to obtain a classification result of the trajectory segment;
[0088] The classification results corresponding to the various trajectory segments are merged to determine the travel mode category of the trajectory to be classified.
[0089] In this optional implementation, different first trajectory classification models can be pre-selected and trained for different road types. For example, when X road types are pre-divided, X first trajectory classification models can be pre-trained for the X road types. Different trajectory segments can be input into corresponding first trajectory classification models based on their road types to obtain classification results for the trajectory segments. The classification results can include the probability that the trajectory segment belongs to any one of the X pre-divided trajectory categories, and the trajectory category with the highest probability can be considered as the category of the trajectory segment.
[0090] Each trajectory segment corresponds to a classification result. The category of the trajectory data can be determined by fusing multiple classification results corresponding to multiple trajectory segments. There are many fusion methods, such as summation, weighted summation, etc. The specific fusion methods can be determined according to actual needs and will not be described here.
[0091] An example of the summation fusion method is to sum the probability values corresponding to the same trajectory category in each classification result, and finally determine the trajectory category with the largest probability sum as the travel mode category of the trajectory to be classified.
[0092] In an optional implementation of this embodiment, different first trajectory classification models are trained separately, and the road type to which the sample trajectories for training the first trajectory classification model belong is the same as the road type corresponding to the first trajectory classification model.
[0093] It should be noted that different road types correspond to different first trajectory classification models, and each first trajectory classification model can be pre-trained separately. During the pre-training process, trajectory segments corresponding to the same road type can be collected, and the time series features extracted from the trajectory segments can be input as sample data into the first trajectory classification model to be trained for training. After training a large number of such trajectory segments belonging to the same road type, a pre-trained first trajectory classification model can be obtained. In some embodiments, the first trajectory classification model can use the Xgboost model. The model structure of the first trajectory classification model corresponding to different road types can be the same, and the input and output of the first trajectory classification model corresponding to different road types are also the same, but the model parameters can be different after training.
[0094] In the process of trajectory recognition, the trajectory to be classified can be divided into trajectory segments belonging to different road types, and each trajectory segment can be input into the first trajectory classification model corresponding to the corresponding road type. Since the training samples of the first trajectory classification model are all trajectory segments corresponding to the same road type, the first trajectory classification model has a stronger recognition ability for the trajectory segments corresponding to the road type, which can improve the accuracy of the trajectory classification result.
[0095] In an optional implementation of this embodiment, the step of fusing the classification results corresponding to the trajectory segments to determine the travel mode category of the trajectory to be classified further includes the following steps:
[0096] After weighting and fusing the classification results corresponding to the trajectory segments, the travel mode category of the trajectory to be classified is obtained; wherein the weight for weighting the classification results of the trajectory segments is related to the length ratio of the trajectory segments in the trajectory to be classified.
[0097] In this optional implementation, for trajectory segments belonging to different road types, different first trajectory classification models are used to obtain classification results, and then the travel mode category of the trajectory to be classified can be fused. In order to make the fusion result more accurate, the embodiment of the present disclosure obtains the fusion result by weighted fusion of each classification result. For example, the fusion result can be obtained by weighted summing of each classification result, and the weighted weight can be related to the length ratio of the trajectory segment in the entire trajectory. If the trajectory segment is longer in the entire trajectory and occupies a larger proportion, the corresponding weight can be set larger, and if the trajectory segment is shorter in the entire trajectory and occupies a smaller proportion, the corresponding weight can be set smaller. It should be noted that the sum of the weights corresponding to each trajectory segment is equal to 1. For example, weight k = trajectory segment displacement / total displacement of the trajectory to be classified.
[0098] Figure 2FIG. 2 shows a schematic diagram of an application process for classifying user trajectory data according to an embodiment of the present disclosure. Figure 2 As shown, the user trajectory data is divided into multiple trajectory segments according to different road types. Figure 2 Six trajectory segments are shown in FIG. 6 . Assuming that the road types corresponding to the six trajectory segments are different, the six trajectory segments are respectively input into six pre-trained first trajectory classification models XGB_Model. Assuming that the first trajectory classification models XGB_Model 1-10 corresponding to 10 road types are pre-trained based on the road types, the six trajectory segments are respectively input into six first trajectory classification models XGB_Model 1-3 and XGB_Model 8-10. The six first trajectory classification models output six classification results respectively. The six classification results are weighted k and then fused to obtain a fusion result. Based on the fusion result, the category of the user trajectory data can be obtained, where k = displacement length of the trajectory segment / total displacement length of the user trajectory data.
[0099] In an optional implementation of this embodiment, step S104, i.e., the step of determining the travel mode category of the trajectory to be classified based on the at least one time series feature, further includes the following steps:
[0100] assembling the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0101] The total time series features are input into a second trajectory classification model to obtain the travel mode category of the trajectory to be classified.
[0102] In this optional implementation, the time series features extracted from the trajectory segments can be spliced to obtain a set of total time series features, and the total time series features obtained are used to determine the classification result of the trajectory to be classified. In this way, a second trajectory classification model can be pre-trained, and the input of the second trajectory classification model is the splicing features of the time series features extracted from each trajectory segment in the trajectory to be classified, that is, the total time series features mentioned above, and the output is the mode of travel category of the trajectory to be classified. In some embodiments, the second trajectory classification model can use a convolutional neural network model.
[0103] During the pre-training process of the second trajectory classification model, the sample trajectory can be divided into multiple trajectory segments, and then the same type of time series features are extracted from each trajectory segment, and the time series features extracted from each trajectory segment are spliced and input into the model to be trained. After training with a large number of sample trajectories, the pre-trained first trajectory classification model can be obtained. In the trajectory classification process, the trajectory to be classified is also divided into multiple trajectory segments, and then the same type of time series features are extracted from each trajectory segment, and the time series features extracted from each trajectory segment are spliced and input into the pre-trained first trajectory classification model, and the first trajectory classification model outputs the category of the passage mode of the trajectory to be classified.
[0104] In an optional implementation of this embodiment, the step of assembling the at least one time series feature extracted from the trajectory segment into a total time series feature further includes the following steps:
[0105] Extracting a predetermined number of time series features from each of the trajectory segments, wherein the types of the predetermined number of time series features extracted from different trajectory segments are consistent with each other;
[0106] According to the position order of the trajectory segments in the trajectory to be classified, a predetermined number of time series features corresponding to each trajectory segment are sequentially spliced to obtain the total time series feature.
[0107] In this optional implementation, when splicing the time series features of multiple trajectory segments, they can be spliced in the order of the positions of the trajectory segments in the trajectory, that is, the time series features corresponding to the trajectory segments in front of the trajectory can be located before the trajectory segments behind the trajectory. For example, the time series features that need to be extracted from the trajectory segments are 11 time series features, namely, average speed, maximum speed, speed variance, average displacement, maximum displacement, displacement variance, average acceleration, maximum acceleration, acceleration variance, total trajectory running time and total displacement. Then, the above 11 time series features are extracted for each trajectory segment. The 11 time series features can be arranged in a pre-set order, and then multiple groups of 11 time series features can be spliced in the order of the positions of the trajectory segments in the trajectory to obtain the total time series features.
[0108] For example, the trajectory is divided into three segments, and three groups of time series features are extracted from the three trajectory segments, namely:
[0109] {average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1};
[0110] {average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2};
[0111] {average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3};
[0112] The total time series features obtained after splicing can be:
[0113] {Average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1, average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2, average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3}.
[0114] Figure 3 FIG. 1 is a flow chart of a trajectory classification model training method according to an embodiment of the present disclosure. Figure 3 As shown, the trajectory classification model training method includes the following steps:
[0115] In step S301, training data is obtained; the training data includes a plurality of sample trajectories;
[0116] In step S302, based on the road type to which the track points in the sample track belong, the track to be classified is divided into one or more track segments, and all track points in the same track segment belong to the same road type;
[0117] In step S303, extracting at least one time series feature for each of the trajectory segments;
[0118] In step S304, the at least one time series feature is input into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs for training; different road types correspond to different first trajectory classification models.
[0119] In this embodiment, the sample trajectory can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0120] The sample trajectories in the training data may be trajectories whose classification results are known in advance, for example, trajectories whose categories have been manually labeled. In order to train a first trajectory classification model with higher accuracy, a large number of sample trajectories may be collected.
[0121] For each sample trajectory, it can be divided based on the road type to which the trajectory point belongs, to obtain one or more trajectory segments. The division of the sample trajectory can refer to the division of the trajectory to be classified above, which will not be repeated here.
[0122] For the trajectory segments obtained by division, time series features can be extracted from them. The extraction of time series features can also refer to the description of the trajectory classification method above, which will not be repeated here.
[0123] As described above, different road types may correspond to different first trajectory classification models. When the road types include multiple types, multiple first trajectory classification models need to be trained. Multiple first trajectory classification models may use the same model structure, for example, all may use Figure 2 The Xgboost tree model structure shown.
[0124] Figure 4 FIG. 4 shows a schematic diagram of model training of a first trajectory classification model according to an embodiment of the present disclosure. Figure 4As shown, it shows the training process of one of the first trajectory classification models. If the road type corresponding to the first trajectory classification model is type 1, the first trajectory classification model can include multiple weak classifiers. The input of the first weak classifier is 11 time series features extracted from a trajectory segment (the road type to which the trajectory segment belongs is also type 1) (see the description above for details). The output of the first weak classifier is the classification result of the trajectory segment. After the residual is calculated between the classification result and the true category of the trajectory segment, it is input to the second weak classifier. The second weak classifier also outputs the classification result of the trajectory segment. After the residual is calculated between the classification result and the true category, it is input to the third weak classifier, and so on, until the last weak classifier. The first trajectory classification model also includes a strong classifier. The classification results output by multiple weak classifiers are all output to the strong classifier. The strong classifier obtains the final classification result of the trajectory segment based on the classification results of the multiple weak classifiers. Based on the final classification result and the true classification result of the trajectory segment, the loss of this training can be calculated. Based on the loss, the model parameters of multiple weak classifiers and a strong classifier can be dynamically adjusted to complete a training. After multiple trainings of multiple trajectory segments, a first trajectory classification model that has been trained can be obtained.
[0125] For other details in this embodiment, please refer to the description of the trajectory classification method above, which will not be repeated here.
[0126] In an optional implementation of this embodiment, the first trajectory classification models corresponding to different road types are trained separately, and the road type to which the sample trajectory for training the first trajectory classification model belongs is the same as the road type corresponding to the first trajectory classification model.
[0127] It should be noted that different road types correspond to different first trajectory classification models, and each first trajectory classification model can be pre-trained separately. During the pre-training process, trajectory segments corresponding to the same road type can be collected, and the time series features extracted from the trajectory segments can be input as sample data into the first trajectory classification model to be trained for training. After training a large number of such trajectory segments belonging to the same road type, a pre-trained first trajectory classification model can be obtained. In some embodiments, the first trajectory classification model can use the Xgboost model. The model structure of the first trajectory classification model corresponding to different road types can be the same, and the input and output of the first trajectory classification model corresponding to different road types are also the same, but the model parameters can be different after training.
[0128] In the process of trajectory recognition, the trajectory to be classified can be divided into trajectory segments belonging to different road types, and each trajectory segment can be input into the first trajectory classification model corresponding to the corresponding road type. Since the training samples of the first trajectory classification model are all trajectory segments corresponding to the same road type, the first trajectory classification model has a stronger recognition ability for the trajectory segments corresponding to the road type, which can improve the accuracy of the trajectory classification result.
[0129] Figure 5 FIG. 4 is a flow chart showing a trajectory model training method according to another embodiment of the present disclosure. Figure 5 As shown, the trajectory classification method includes the following steps:
[0130] In step S501, training data is obtained; the training data includes a plurality of sample trajectories;
[0131] In step S502, based on the road type to which the track points in the sample track belong, the track to be classified is divided into one or more track segments, and all track points in the same track segment belong to the same road type;
[0132] In step S503, extracting at least one time series feature for each of the trajectory segments;
[0133] In step S504, the at least one time series feature extracted from the trajectory segment is spliced into a total time series feature;
[0134] In step S505, the total time series features are input into the second classification model for training.
[0135] In this embodiment, the sample trajectory can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0136] The sample trajectories in the training data may be trajectories whose classification results are known in advance, for example, trajectories whose categories have been manually labeled. In order to train a first trajectory classification model with higher accuracy, a large number of sample trajectories may be collected.
[0137] For each sample trajectory, it can be divided based on the road type to which the trajectory point belongs, to obtain one or more trajectory segments. The division of the sample trajectory can refer to the division of the trajectory to be classified above, which will not be repeated here.
[0138] For the trajectory segments obtained by division, time series features can be extracted from them. The extraction of time series features can also refer to the description of the trajectory classification method above, which will not be repeated here.
[0139] In this embodiment, a second trajectory classification model is obtained by pre-training for trajectory classification. The second trajectory classification model may adopt a convolutional neural network model structure.
[0140] Figure 6 FIG. 4 shows a schematic diagram of model training of a second trajectory classification model according to an embodiment of the present disclosure. Figure 6 As shown, the user trajectory data may be a sample trajectory, and the user trajectory data is divided into 6 trajectory segments based on the road type to which the trajectory points in the sample trajectory belong, and 7 time series features are extracted from each trajectory segment (this is only for the convenience of example, and more time series features can be extracted in actual applications, for example, the 11 time series features mentioned above can be extracted). The 6 groups of 7 time series features are spliced in the order of the positions of the corresponding trajectory segments in the trajectory to obtain 6*7 time series features, and the 6*7 time series features are input into the convolutional neural network model to obtain a classification result, which is the category of the sample trajectory predicted by the convolutional neural network model.
[0141] During the training process, the category predicted by the model is compared with the true category, and then the loss of adjusting the model parameters is calculated, and the model parameters of the convolutional neural network model are adjusted based on the loss. After the above training of multiple sample trajectories, a second trajectory classification model that can accurately identify trajectory categories can be obtained.
[0142] For other details in this embodiment, please refer to the description of the trajectory classification method above, which will not be repeated here.
[0143] In an optional implementation of this embodiment, the step of assembling the at least one time series feature extracted from the trajectory segment into a total time series feature further includes the following steps:
[0144] Extracting a predetermined number of time series features from each of the trajectory segments, wherein the types of the predetermined number of time series features extracted from different trajectory segments are consistent with each other;
[0145] According to the position order of the trajectory segments in the trajectory to be classified, a predetermined number of time series features corresponding to each trajectory segment are sequentially spliced to obtain the total time series feature.
[0146] In this optional implementation, when splicing the time series features of multiple trajectory segments, they can be spliced in the order of the positions of the trajectory segments in the trajectory, that is, the time series features corresponding to the trajectory segments in front of the trajectory can be located before the trajectory segments behind the trajectory. For example, the time series features that need to be extracted from the trajectory segments are 11 time series features, namely, average speed, maximum speed, speed variance, average displacement, maximum displacement, displacement variance, average acceleration, maximum acceleration, acceleration variance, total trajectory running time and total displacement. Then, the above 11 time series features are extracted for each trajectory segment. The 11 time series features can be arranged in a pre-set order, and then multiple groups of 11 time series features can be spliced in the order of the positions of the trajectory segments in the trajectory to obtain the total time series features.
[0147] For example, the trajectory is divided into three segments, and three groups of time series features are extracted from the three trajectory segments, namely:
[0148] {average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1};
[0149] {average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2};
[0150] {average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3};
[0151] The total time series features obtained after splicing can be:
[0152] {Average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1, average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2, average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3}.
[0153] According to a traffic condition analysis method of an embodiment of the present disclosure, the traffic condition analysis method includes: after classifying the trajectories on the road using the above-mentioned trajectory classification method, analyzing the traffic condition on the road based on the classification result.
[0154] The above-mentioned traffic condition analysis method proposed in the embodiment of the present disclosure can be provided to the traffic management department or other relevant departments with authority for analyzing the road traffic conditions. The traffic condition analysis method can also be deployed in the cloud, and the use authority can be provided to the departments or personnel with authority. The departments or personnel with authority can upload a large amount of user trajectory data collected on the target road to the cloud, and the cloud classifies each user trajectory data. Specifically, the above-mentioned trajectory classification method proposed in the embodiment of the present disclosure can be used for classification. The details of trajectory classification can be found in the description of the trajectory classification method above, which will not be repeated here.
[0155] The cloud returns the trajectory category of each user's trajectory data to the relevant departments or personnel so that the relevant departments or personnel can statistically analyze the traffic conditions on each road based on the trajectory category. For example, the trajectory data of moving vehicles can be filtered out based on the trajectory category, and then the current traffic conditions of each road can be determined based on this type of trajectory data.
[0156] In the embodiment of the present disclosure, during the process of analyzing traffic conditions, since each trajectory is classified and the spatial characteristics of the trajectory are taken into consideration during the classification process, the accuracy of the classification is improved. Therefore, interference items in the trajectory data of moving vehicles (such as the trajectories of pedestrians and the trajectories of riding vehicles) can be eliminated, so that more accurate traffic information can be obtained based on the analysis of the trajectory data of moving vehicles with higher accuracy.
[0157] Figure 7 A schematic diagram of an application scenario of trajectory classification according to an embodiment of the present disclosure is shown. Figure 7As shown, the navigation server can record the travel trajectories of various navigation terminals. The traffic control department can collect user trajectory data from the navigation server or other means, and upload the user trajectory data on each road in a certain area to the traffic information server. The traffic information server classifies each user trajectory data based on the trajectory classification method and determines the category of each user trajectory data. After that, the traffic information server can return the category of the user trajectory data to the traffic control department. The traffic control department can exclude the trajectories of pedestrians and cycling users on the same road based on the category of the user trajectory data, and retain the user trajectory data of driving vehicles or riding vehicles. The traffic control department can also perform statistical analysis on the user trajectory data of driving vehicles or riding vehicles, and can obtain the current congestion conditions on each road, and push the congestion conditions to the user terminal for display or broadcast, and can also push it to the road traffic display screen for display, etc.
[0158] The following are embodiments of the apparatus of the present disclosure, which can be used to execute embodiments of the method of the present disclosure.
[0159] According to a trajectory classification device of an embodiment of the present disclosure, the device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The trajectory classification device includes:
[0160] A first acquisition module is configured to acquire a trajectory to be classified;
[0161] A first division module is configured to divide the trajectory to be classified into one or more trajectory segments based on the road type to which the trajectory points in the trajectory to be classified belong, wherein all trajectory points in the same trajectory segment belong to the same road type;
[0162] A first extraction module is configured to extract at least one time series feature for each of the trajectory segments;
[0163] The first determination module is configured to determine the travel mode category of the trajectory to be classified based on the at least one time series feature.
[0164] In this embodiment, the trajectory to be classified can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0165] Trajectory classification can be applied in various scenarios. For example, the target object's portrait can be obtained by classifying the trajectory. Another example is that trajectory classification can be applied to smart transportation; for example, if you want to improve the green wave between urban traffic lights according to the road flow, the data of non-motor vehicles and pedestrians will interfere with the analysis of effective car flow on the road, hinder the analysis of road dynamic information by relevant departments, and thus curb the development of smart transportation; if the trajectory can be correctly classified, on the one hand, the above problems can be solved, and on the other hand, the traffic conditions for non-motor vehicle groups can be improved, such as further optimization and adjustment of sidewalks, zebra crossings, pedestrian bridges and cycling roads according to pedestrian and cycling flow, and even traffic control can be carried out according to different types of real-time traffic. For example, during the May Day and October travel festivals every year, traffic police can control traffic at popular tourist attractions according to actual traffic flow, which can improve traffic congestion.
[0166] As described in the background technology, considering that the classifier studied by the current cutting-edge technology of trajectory classification only classifies based on the time series characteristics of the trajectory, and does not consider the spatial characteristics, which causes inaccurate trajectory classification results, the embodiment of the present disclosure proposes a trajectory classification device, which not only considers the time series characteristics of the trajectory, but also considers the spatial characteristics of the trajectory (that is, the road type to which the trajectory point in the trajectory belongs), thereby greatly improving the accuracy of trajectory classification.
[0167] In this embodiment, the spatial feature of the trajectory may be a location feature of the trajectory point, and the location feature may include the latitude and longitude data of the GPS point, the road section to which the trajectory point belongs, and the road type to which the trajectory point belongs.
[0168] In some embodiments, a road segment may be a directed unit divided according to an actual road, each road segment corresponds to an actual road and has a unique ID. Road types may be divided according to spatial features, for example, road types may include but are not limited to 10 types, such as expressways, national roads, provincial roads, county roads, rural roads, main streets, urban expressways, main roads, secondary roads, and ordinary roads.
[0169] For the same trajectory to be classified, the trajectory to be classified can be divided into one or more different trajectory segments based on the location information of the trajectory points in the trajectory to be classified and the road type of the road to which the location information belongs. In the process of dividing the trajectory segments, the starting point of the trajectory to be classified can be used as the starting position point to traverse backwards to determine the road type to which the location information corresponding to each position point belongs. When the road type to which the location information corresponding to the current position point belongs is different from the road type to which the location information corresponding to the previous position point belongs, all the position points between the starting position point and the previous position point (including the starting position point of the traversal and the previous position point) are divided into a trajectory segment, and the current position point is used as the starting position point of the next traversal, and the subsequent position points are traversed in the above manner. Of course, it can be understood that the end point of a trajectory can also be used as the starting position point for forward traversal, and a point in the middle of a trajectory can also be used as the starting position point for forward or backward traversal. The specific method can be determined according to actual needs and is not limited here.
[0170] After the trajectory to be classified is divided in the above manner, one or more trajectory segments may be obtained. The one or more trajectory segments may correspond to the same or different road types, and all trajectory points in the same trajectory segment belong to the same road type.
[0171] In this embodiment, time series features are extracted for each trajectory segment obtained by division, that is, each trajectory segment is taken as a separate trajectory to extract time series features. Time series features may include but are not limited to: speed, acceleration, displacement, etc.
[0172] In some embodiments, 11 time series features, including average speed, maximum speed, speed variance, average displacement, maximum displacement, displacement variance, average acceleration, maximum acceleration, acceleration variance, total track running time, and total displacement, can be extracted from the track segment. That is, the above 11 time series features can be extracted from each track segment, and the 11 time series features can be used as the classification basis of the track segment.
[0173] After extracting the time series features for each trajectory segment, the trajectory to be classified can be classified based on the time series features extracted from each trajectory segment. It should be noted that if a trajectory to be classified is divided into N (N is a positive integer greater than or equal to 1) trajectory segments, and M (M is a positive integer greater than or equal to 1) time series features are extracted from a trajectory segment, then the trajectory to be classified is equivalent to extracting a total of N*M time series features, and each M time series features belong to the time series features of the trajectory under the same road type. It should be noted that the types of time series features extracted from different trajectory segments are the same, that is, in the prior art, only M time series features are extracted from the entire trajectory to be classified, while this embodiment extracts M time series features from one trajectory segment. If a trajectory to be classified is divided into multiple trajectory segments, multiple groups of M time series features will be extracted. And the spatial features of each group of M time series features are the same, that is, each group of M time series features is extracted from trajectory points belonging to the same road type. It can be understood that the time series features extracted in the embodiments of the present disclosure have spatial information, that is, they reflect both time series features and spatial features, which is different from the time series features in the prior art that do not have spatial information.
[0174] In some embodiments, a pre-trained classification model can be used to input the time series features extracted from each trajectory segment into the pre-trained classification model to obtain a classification result of the trajectory to be classified, that is, the travel mode category of the trajectory to be classified. The pre-trained classification model can select an existing classification model, such as an XGBoost model, a convolutional neural network model, etc.
[0175] In this embodiment, when classifying the trajectory, the trajectory to be classified is divided into one or more trajectory segments according to spatial features, such as the road type to which the trajectory point in the trajectory to be classified belongs, and then the time series features are extracted for each trajectory segment, and then the classification model is classified based on the time series features extracted from each trajectory segment. In the process of trajectory classification, the disclosed embodiment extracts time series features with spatial information from the trajectory to be classified. This method considers both the spatial features of the trajectory and the time series features of the trajectory, so that the time series features used to identify the trajectory category are strongly correlated with the trajectory category, thereby improving the accuracy of trajectory classification.
[0176] In an optional implementation of this embodiment, the first determining module includes:
[0177] A model determination submodule is configured to determine the road type to which each of the trajectory segments belongs, and a first trajectory classification model corresponding to the road type; wherein different road types correspond to different first trajectory classification models;
[0178] A first acquisition submodule is configured to input, for each of the trajectory segments, the time series features corresponding to the trajectory segment into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs, to obtain a classification result of the trajectory segment;
[0179] The first fusion submodule is configured to fuse the classification results corresponding to the respective trajectory segments to determine the travel mode category of the trajectory to be classified.
[0180] In this optional implementation, different first trajectory classification models can be pre-selected and trained for different road types. For example, when X road types are pre-divided, X first trajectory classification models can be pre-trained for the X road types. Different trajectory segments can be input into corresponding first trajectory classification models based on their road types to obtain classification results for the trajectory segments. The classification results can include the probability that the trajectory segment belongs to any one of the X pre-divided trajectory categories, and the trajectory category with the highest probability can be considered as the category of the trajectory segment.
[0181] Each trajectory segment corresponds to a classification result. The category of the trajectory data can be determined by fusing multiple classification results corresponding to multiple trajectory segments. There are many fusion methods, such as summation, weighted summation, etc. The specific fusion methods can be determined according to actual needs and will not be described here.
[0182] An example of the summation fusion method is to sum the probability values corresponding to the same trajectory category in each classification result, and finally determine the trajectory category with the largest probability sum as the travel mode category of the trajectory to be classified.
[0183] In an optional implementation of this embodiment, different first trajectory classification models are trained separately, and the road type to which the sample trajectories for training the first trajectory classification model belong is the same as the road type corresponding to the first trajectory classification model.
[0184] It should be noted that different road types correspond to different first trajectory classification models, and each first trajectory classification model can be pre-trained separately. During the pre-training process, trajectory segments corresponding to the same road type can be collected, and the time series features extracted from the trajectory segments can be input as sample data into the first trajectory classification model to be trained for training. After training a large number of such trajectory segments belonging to the same road type, a pre-trained first trajectory classification model can be obtained. In some embodiments, the first trajectory classification model can use the Xgboost model. The model structure of the first trajectory classification model corresponding to different road types can be the same, and the input and output of the first trajectory classification model corresponding to different road types are also the same, but the model parameters can be different after training.
[0185] In the process of trajectory recognition, the trajectory to be classified can be divided into trajectory segments belonging to different road types, and each trajectory segment can be input into the first trajectory classification model corresponding to the corresponding road type. Since the training samples of the first trajectory classification model are all trajectory segments corresponding to the same road type, the first trajectory classification model has a stronger recognition ability for the trajectory segments corresponding to the road type, which can improve the accuracy of the trajectory classification result.
[0186] In an optional implementation of this embodiment, the first fusion submodule includes:
[0187] The second fusion submodule is configured to weight and fuse the classification results corresponding to the trajectory segments respectively to obtain the travel mode category of the trajectory to be classified; wherein the weight of the classification results of the trajectory segments is related to the length ratio of the trajectory segments in the trajectory to be classified.
[0188] In this optional implementation, for trajectory segments belonging to different road types, different first trajectory classification models are used to obtain classification results, and then the travel mode category of the trajectory to be classified can be fused. In order to make the fusion result more accurate, the embodiment of the present disclosure obtains the fusion result by weighted fusion of each classification result. For example, the fusion result can be obtained by weighted summing of each classification result, and the weighted weight can be related to the length ratio of the trajectory segment in the entire trajectory. If the trajectory segment is longer in the entire trajectory and occupies a larger proportion, the corresponding weight can be set larger, and if the trajectory segment is shorter in the entire trajectory and occupies a smaller proportion, the corresponding weight can be set smaller. It should be noted that the sum of the weights corresponding to each trajectory segment is equal to 1. For example, weight k = trajectory segment displacement / total displacement of the trajectory to be classified.
[0189] In an optional implementation of this embodiment, the first determining module includes:
[0190] A first splicing submodule is configured to splice the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0191] The second acquisition submodule is configured to input the total time series feature into a second trajectory classification model to obtain the travel mode category of the trajectory to be classified.
[0192] In this optional implementation, the time series features extracted from the trajectory segments can be spliced to obtain a set of total time series features, and the total time series features obtained are used to determine the classification result of the trajectory to be classified. In this way, a second trajectory classification model can be pre-trained, and the input of the second trajectory classification model is the splicing features of the time series features extracted from each trajectory segment in the trajectory to be classified, that is, the total time series features mentioned above, and the output is the mode of travel category of the trajectory to be classified. In some embodiments, the second trajectory classification model can use a convolutional neural network model.
[0193] During the pre-training process of the second trajectory classification model, the sample trajectory can be divided into multiple trajectory segments, and then the same type of time series features are extracted from each trajectory segment, and the time series features extracted from each trajectory segment are spliced and input into the model to be trained. After training with a large number of sample trajectories, the pre-trained first trajectory classification model can be obtained. In the trajectory classification process, the trajectory to be classified is also divided into multiple trajectory segments, and then the same type of time series features are extracted from each trajectory segment, and the time series features extracted from each trajectory segment are spliced and input into the pre-trained first trajectory classification model, and the first trajectory classification model outputs the category of the passage mode of the trajectory to be classified.
[0194] In an optional implementation of this embodiment, the first splicing submodule includes:
[0195] an extraction submodule, configured to extract a predetermined number of time series features from each of the trajectory segments, and the types of the predetermined number of time series features extracted from different trajectory segments are consistent;
[0196] The second splicing submodule is configured to sequentially splice a predetermined number of time series features corresponding to each of the trajectory segments according to the position order of the trajectory segments in the trajectory to be classified, so as to obtain the total time series feature.
[0197] In this optional implementation, when splicing the time series features of multiple trajectory segments, they can be spliced in the order of the positions of the trajectory segments in the trajectory, that is, the time series features corresponding to the trajectory segments in front of the trajectory can be located before the trajectory segments behind the trajectory. For example, the time series features that need to be extracted from the trajectory segments are 11 time series features, namely, average speed, maximum speed, speed variance, average displacement, maximum displacement, displacement variance, average acceleration, maximum acceleration, acceleration variance, total trajectory running time and total displacement. Then, the above 11 time series features are extracted for each trajectory segment. The 11 time series features can be arranged in a pre-set order, and then multiple groups of 11 time series features can be spliced in the order of the positions of the trajectory segments in the trajectory to obtain the total time series features.
[0198] For example, the trajectory is divided into three segments, and three groups of time series features are extracted from the three trajectory segments, namely:
[0199] {average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1};
[0200] {average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2};
[0201] {average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3};
[0202] The total time series features obtained after splicing can be:
[0203] {Average speed 1, maximum speed 1, speed variance 1, average displacement 1, maximum displacement 1, displacement variance 1, average acceleration 1, maximum acceleration 1, acceleration variance 1, total trajectory running time 1 and total displacement 1, average speed 2, maximum speed 2, speed variance 2, average displacement 2, maximum displacement 2, displacement variance 2, average acceleration 2, maximum acceleration 2, acceleration variance 2, total trajectory running time 2 and total displacement 2, average speed 3, maximum speed 3, speed variance 3, average displacement 3, maximum displacement 3, displacement variance 3, average acceleration 3, maximum acceleration 3, acceleration variance 3, total trajectory running time 3 and total displacement 3}.
[0204] According to a trajectory classification model training device according to an embodiment of the present disclosure, the device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The trajectory classification model training device includes:
[0205] A second acquisition module is configured to acquire training data; the training data includes a plurality of sample trajectories;
[0206] A second division module is configured to divide the trajectory to be classified into one or more trajectory segments based on the road type to which the trajectory points in the sample trajectory belong, and all trajectory points in the same trajectory segment belong to the same road type;
[0207] A second extraction module is configured to extract at least one time series feature for each of the trajectory segments;
[0208] The first training module is configured to input the at least one time series feature into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs for training; wherein different road types correspond to different first trajectory classification models.
[0209] In this embodiment, the sample trajectory can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0210] The sample trajectories in the training data may be trajectories whose classification results are known in advance, for example, trajectories whose categories have been manually labeled. In order to train a first trajectory classification model with higher accuracy, a large number of sample trajectories may be collected.
[0211] For each sample trajectory, it can be divided based on the road type to which the trajectory point belongs, to obtain one or more trajectory segments. The division of the sample trajectory can refer to the division of the trajectory to be classified above, which will not be repeated here.
[0212] For the divided trajectory segments, time series features can be extracted therefrom. The extraction of time series features can also refer to the description of the trajectory classification device above, which will not be repeated here.
[0213] As described above, different road types may correspond to different first trajectory classification models. When the road types include multiple types, multiple first trajectory classification models need to be trained. Multiple first trajectory classification models may use the same model structure, for example, all may use Figure 2 The Xgboost tree model structure shown.
[0214] For other details in this embodiment, please refer to the description of the trajectory classification device above, which will not be repeated here.
[0215] According to another embodiment of the present disclosure, a trajectory classification model training device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The trajectory classification model training device includes:
[0216] A third acquisition module is configured to acquire training data; the training data includes a plurality of sample trajectories;
[0217] A third division module is configured to divide the to-be-classified trajectory into one or more trajectory segments based on the road type to which the trajectory points in the sample trajectory belong, wherein all trajectory points in the same trajectory segment belong to the same road type;
[0218] A third extraction module is configured to extract at least one time series feature for each of the trajectory segments;
[0219] a splicing module, configured to splice the at least one time series feature extracted from the trajectory segment into a total time series feature;
[0220] The second training module is configured to input the total time series features into the second classification model for training.
[0221] In this embodiment, the sample trajectory can be any trajectory of the target object, and the trajectory can include a series of GPS position points that are continuous in time. The GPS position point includes the longitude data and latitude data of the point. The target object can be a person, a robot, a vehicle, an electronic device, etc. For example, if the target object is a person, the GPS position points in the trajectory of the person can be collected by a terminal held by the person, such as a mobile phone, an iPad, a wearable electronic device, or a terminal carried by the vehicle driven or taken. In some embodiments, trajectory classification can be to classify the trajectory to be classified according to the mode of travel of the target object. For example, the user trajectory can be divided into results such as walking, cycling, and driving. Of course, it can be understood that trajectory classification can also be other classification methods, not limited to the classification of the above-mentioned modes of travel.
[0222] The sample trajectories in the training data may be trajectories whose classification results are known in advance, for example, trajectories whose categories have been manually labeled. In order to train a first trajectory classification model with higher accuracy, a large number of sample trajectories may be collected.
[0223] For each sample trajectory, it can be divided based on the road type to which the trajectory point belongs, to obtain one or more trajectory segments. The division of the sample trajectory can refer to the division of the trajectory to be classified above, which will not be repeated here.
[0224] For the divided trajectory segments, time series features can be extracted therefrom. The extraction of time series features can also refer to the description of the trajectory classification device above, which will not be repeated here.
[0225] In this embodiment, a second trajectory classification model is obtained by pre-training for trajectory classification. The second trajectory classification model may adopt a convolutional neural network model structure.
[0226] During the training process, the category predicted by the model is compared with the true category, and then the loss of adjusting the model parameters is calculated, and the model parameters of the convolutional neural network model are adjusted based on the loss. After the above training of multiple sample trajectories, a second trajectory classification model that can accurately identify trajectory categories can be obtained.
[0227] For other details in this embodiment, please refer to the description of the trajectory classification device above, which will not be repeated here.
[0228] According to a traffic condition analysis device of one embodiment of the present disclosure, the traffic condition analysis device includes: after using the above-mentioned trajectory classification device to classify the trajectories on the road, analyzing the traffic conditions on the road based on the classification results.
[0229] The above-mentioned traffic condition analysis device proposed in the embodiment of the present disclosure can be provided to the traffic management department or other relevant departments with authority for analyzing the road traffic conditions. The traffic condition analysis device can also be deployed in the cloud and provide use rights to departments or personnel with authority. The department or personnel with authority can upload a large amount of user trajectory data collected on the target road to the cloud, and the cloud classifies each user trajectory data. Specifically, the above-mentioned trajectory classification device proposed in the embodiment of the present disclosure can be used for classification. The details of trajectory classification can be found in the description of the trajectory classification device above, which will not be repeated here.
[0230] The cloud returns the trajectory category of each user's trajectory data to the relevant departments or personnel so that the relevant departments or personnel can statistically analyze the traffic conditions on each road based on the trajectory category. For example, the trajectory data of moving vehicles can be filtered out based on the trajectory category, and then the current traffic conditions of each road can be determined based on this type of trajectory data.
[0231] In the embodiment of the present disclosure, during the process of analyzing traffic conditions, since each trajectory is classified and the spatial characteristics of the trajectory are taken into consideration during the classification process, the accuracy of the classification is improved. Therefore, interference items in the trajectory data of moving vehicles (such as the trajectories of pedestrians and the trajectories of riding vehicles) can be eliminated, so that more accurate traffic information can be obtained based on the analysis of the trajectory data of moving vehicles with higher accuracy.
[0232] Figure 8 It is a structural schematic diagram of an electronic device suitable for implementing the trajectory classification method, trajectory classification model training method and / or traffic condition analysis method according to an embodiment of the present disclosure.
[0233] like Figure 8 As shown, the electronic device 800 includes a processing unit 801, which can be implemented as a processing unit such as a CPU, a GPU, an FPGA, and an NPU. The processing unit 801 can perform various processes in the implementation of any of the above methods of the present disclosure according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 to a random access memory (RAM) 803. In RAM803, various programs and data required for the operation of the electronic device 800 are also stored. The processing unit 801, ROM802, and RAM803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0234] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0235] In particular, according to an embodiment of the present disclosure, any method in the above referenced embodiment of the present disclosure may be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes a program code for executing any method in the embodiment of the present disclosure. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 809, and / or installed from a removable medium 811.
[0236] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the road map or block diagram can represent a part of a module, program segment or code, and the part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0237] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0238] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into the device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0239] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A trajectory classification method, wherein: include: Get the trajectory to be classified; Based on the road type to which the track points in the track to be classified belong, the track to be classified is divided into one or more track segments, where all track points in the same track segment belong to the same road type; Extracting at least one time series feature for each of the trajectory segments; Based on the at least one time series feature, a travel mode category of the trajectory to be classified is determined.
2. The method according to claim 1, wherein: Determining the travel mode category of the trajectory to be classified based on the at least one time series feature includes: Determining a road type to which each of the trajectory segments belongs, and a first trajectory classification model corresponding to the road type; wherein different road types correspond to different first trajectory classification models; For each of the trajectory segments, inputting the time series features corresponding to the trajectory segment into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs, to obtain a classification result of the trajectory segment; The classification results corresponding to the various trajectory segments are merged to determine the travel mode category of the trajectory to be classified.
3. The method according to claim 2, wherein: Different first trajectory classification models are trained separately, and the road type to which the sample trajectories for training the first trajectory classification model belong is the same as the road type corresponding to the first trajectory classification model.
4. The method according to claim 2 or 3, wherein: The classification results corresponding to the trajectory segments are integrated to determine the type of traffic mode of the trajectory to be classified, including: After weighting and fusing the classification results corresponding to the trajectory segments, the travel mode category of the trajectory to be classified is obtained; wherein the weight for weighting the classification results of the trajectory segments is related to the length ratio of the trajectory segments in the trajectory to be classified.
5. The method according to claim 1, wherein: Determining the traffic mode category of the to-be-classified trajectory based on the at least one time series feature extracted from the trajectory segment includes: assembling the at least one time series feature extracted from the trajectory segment into a total time series feature; The total time series features are input into a second trajectory classification model to obtain the travel mode category of the trajectory to be classified.
6. The method according to claim 5, wherein: The at least one time series feature extracted from the trajectory segment is assembled into a total time series feature, comprising: Extracting a predetermined number of time series features from each of the trajectory segments, wherein the types of the predetermined number of time series features extracted from different trajectory segments are consistent with each other; According to the position order of the trajectory segments in the trajectory to be classified, a predetermined number of time series features corresponding to each trajectory segment are sequentially spliced to obtain the total time series feature.
7. A trajectory classification model training method, wherein: include: Get training data; The training data includes a plurality of sample trajectories; Based on the road type to which the track points in the sample track belong, the sample track is divided into one or more track segments, where all track points in the same track segment belong to the same road type; Extracting at least one time series feature for each of the trajectory segments; The at least one time series feature is input into a first trajectory classification model corresponding to the road type to which the trajectory segment belongs for training; wherein different road types correspond to different first trajectory classification models.
8. A trajectory classification model training method, wherein: include: Get training data; The training data includes a plurality of sample trajectories; Based on the road type to which the track points in the sample track belong, the sample track is divided into one or more track segments, where all track points in the same track segment belong to the same road type; Extracting at least one time series feature for each of the trajectory segments; splicing the at least one time series feature extracted from the trajectory segment into a total time series feature; The total time series features are input into the second classification model for training.
9. A method for analyzing traffic conditions, wherein: After the trajectories on the road are classified using the method described in any one of claims 1 to 6, the traffic conditions on the road are analyzed based on the classification results.
10. A computer program product comprising computer instructions, wherein: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
