A method for automatic stroke segmentation and load condition classification
By using second-order difference extremum detection and conditional random field time sequence labeling, combined with a CNN-Transformer encoder and a CRF model, the problems of noise sensitivity and gradual change process in vehicle load state classification are solved, achieving high-precision travel boundary detection and consistent load state classification.
Patent Information
- Application Number
- CN202611313282.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-10
AI Technical Summary
Existing technologies for classifying vehicle load conditions suffer from problems such as sensitivity to noise, inability to handle gradual loading and unloading processes, and inconsistent classification results over time, making it difficult to achieve robust travel boundary detection and global joint optimization classification of load conditions.
By combining second-order difference extremum detection and conditional random field time series labeling, a load sequence is extracted through a CNN-Transformer encoder with shared weights. Noise is filtered out using a triple joint loss optimization framework, inflection points are detected by first-order difference direction, and dynamic programming decoding is performed through a CRF model to achieve global optimal smoothness of the load state.
It achieves high-precision segmentation of vehicle travel boundaries and strict temporal consistency classification of load status, effectively filters out single-point noise, adapts to gradual loading and unloading processes, and improves the robustness and accuracy of load status classification.
Smart Images

Figure CN123069077A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method for automatic trip segmentation and load status classification. Background Technology
[0002] Real-time monitoring of vehicle load status and analysis of trip data are core components of intelligent transportation, vehicle-to-everything (V2X) systems, and fleet dispatch management, directly impacting logistics efficiency assessment and safety supervision. With the development of V2X data mining technology, load prediction based on vehicle driving data is gradually replacing high-cost traditional onboard weighing sensors. However, in actual operation, loading and unloading are typically gradual processes, and the collected time-series data is highly susceptible to interference from single-point noise and abnormal fluctuations in sensors. This poses a significant challenge to accurately segmenting trip boundaries and ensuring the temporal consistency of load status classification.
[0003] In the prior art, CN121301986A discloses a method and system for real-time vehicle load estimation based on driving characteristic clustering. This scheme collects dynamic characteristic parameters such as engine speed, drive shaft torque, and driving speed, and uses the K-Means++ clustering algorithm and elbow rule to achieve real-time mapping and estimation of state intervals such as empty, half-loaded, fully loaded, and overloaded. Although this technology effectively solves the problem of load estimation's dependence on hardware sensors and improves the adaptability and real-time performance of the estimation, it is essentially still a scheme that classifies each time point independently, without fully considering the temporal context and dependency relationship of adjacent time point labels. When faced with frequent small fluctuations and single-point data noise in actual driving, this classification based on independent time points is prone to serious temporal jitter and inconsistency in the results. Moreover, it lacks a boundary detection mechanism for gradual loading and unloading processes and cannot directly achieve automatic and accurate segmentation of the journey.
[0004] Furthermore, regarding the modeling problem of temporal context, existing technology CN107767036A discloses a real-time traffic state estimation method based on conditional random fields. This method extracts the speed time series of individual vehicles and uses a conditional random field (CRF) model to learn the implicit state transition relationship between the speed series and the road segment congestion level, thereby achieving optimal estimation of traffic conditions under a single trajectory. Although this technology introduces conditional random fields to solve the independent classification problem and achieves global optimization of sequence labeling, its application scenarios are limited to traffic congestion prediction and fail to address the classification needs of complex load states. More importantly, this method also lacks an inflection point identification mechanism for gradual physical behaviors such as slow loading and unloading of vehicles. When faced with sequences of continuously changing loads, it cannot accurately capture the true physical start and end points of the journey, making it difficult to achieve coordination between physical boundary localization and logical state smoothing.
[0005] In summary, existing technologies in the fields of vehicle travel processing and load classification mainly suffer from problems such as relying on simple thresholds or single-point independent classification, resulting in extreme sensitivity to noise, inability to effectively handle the gradual process of loading and unloading, and lack of temporal correlation and consistency in classification results. It is difficult to achieve highly robust automatic detection of travel boundaries and global joint optimization classification of load status under complex noise interference. Summary of the Invention
[0006] The main objective of this invention is to provide an automatic trip segmentation and load status classification method, solving the problems of blurred vehicle trip boundary detection and inconsistent load status classification timing caused by data noise and gradual loading / unloading processes. By combining second-order difference extremum detection with conditional random field time sequence labeling, a collaborative optimization of physical trip boundary segmentation and globally optimal smoothing of load status is achieved.
[0007] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for automatic stroke segmentation and load status classification, the method comprising: S1. Obtain the vehicle GPS time series data sequence, input it into the encoder to extract and output the predicted load sequence; S2. Calculate the first-order difference and the second-order difference in sequence for the predicted load sequence. Combine the extreme value of the second-order difference with the direction of the first-order difference to detect the inflection point of the load change. Filter short-stroke noise through the stroke duration condition and output the set of stroke boundary points. S3. Model the load state classification problem as a time series labeling problem, construct a CRF model, and dynamically program and decode to solve the load state sequence; S4. Based on the load state sequence and travel boundary point set output by CRF annotation, perform joint logic post-processing to determine the start and end points of the travel and output the load state category of each independent travel interval.
[0008] Preferably, in step S1, the encoder is a CNN-Transformer encoder with shared weights. Mask version 1 and mask version 2 are generated through a time-point masking strategy and synchronously input into the encoder. The encoder is trained using a triple joint loss optimization framework that includes mask reconstruction loss, encoder contrast loss and temporal continuity loss. The formula for calculating the overall objective loss in the triple joint loss optimization framework is: ; in, Represents the overall objective loss function. Indicates the loss during mask reconstruction. Indicates encoder contrast loss. Indicates the loss of temporal continuity. , and These represent the weight parameters of the corresponding loss terms.
[0009] Preferably, in step S1, the original sequence is randomly masked using a time-point masking strategy to generate mask version 1 and mask version 2. The original GPS time-series data sequence and mask version 1 and mask version 2 are synchronously input into the CNN-Transformer encoder with shared weights to generate a high-dimensional hidden layer representation. The high-dimensional hidden layer representation is then input into projection head 1 and projection head 2 respectively to calculate the encoder contrast loss.
[0010] Preferably, in step S2, the calculation formulas for the first-order difference and the second-order difference of the predicted load sequence are as follows: ; ; in, Indicates a point in time The first difference value, Indicates the current time point The predicted load value, Indicates the previous time point The predicted load value, Indicates a point in time The second difference value, For the previous time point The first-order difference value.
[0011] Preferably, in step S2, the logic for detecting the inflection point of load change by combining the second-order difference extremum and the first-order difference direction is as follows: like and Then determine the time point. This is an upward inflection point, and it is marked as a candidate point for the start of the journey; like and Then determine the time point. This is a downward inflection point, and it is marked as a candidate point for the end of the journey; If the extreme value condition is not met, it is ignored as a steady fluctuation.
[0012] Preferably, step S2, extracting the set of travel boundary points, further includes filtering short-travel noise based on travel duration conditions. The specific logic is as follows: Merge candidate start and end points to generate candidate trip segments, and determine whether the trip duration is less than the shortest time interval; If so, it should be considered as local noise fluctuation and excluded; If not, retain it as a valid trip and output the set of trip boundary points.
[0013] Preferably, in step S3, the load state classification problem is modeled as a time-series sequence labeling problem. A set of states including empty, half-loaded, and fully loaded states, along with corresponding emission and transition feature functions, is defined. The formula for solving the conditional probability of the global label sequence is: ; in, Indicates that given the observed features input sequence Under the given conditions, generate the target load tag sequence. The conditional probability, As the normalization factor, Represents the time step index of a time series. The feature weight vector obtained during model training. This represents a joint characteristic function that integrates the current state, the previous state, and the observation sequence.
[0014] Preferably, in step S3, the solution formula for dynamic programming decoding using the Viterbi algorithm is as follows: ; in, This represents the globally optimal load state sequence output by the model. Represents all possible candidate label sequences In the middle, search and return the conditional probability. The sequence parameter combination that reaches the maximum value.
[0015] Preferably, in step S4, the logic for performing joint logic post-processing is as follows: Mark the point where the load condition changes from unloaded to non-unloaded as the start of the journey. Mark the point where the load condition changes from non-empty to empty as the end point of the journey.
[0016] Preferably, in step S4, the post-processing steps of the joint logic further include: cross-validating and aligning the marked start and end points of the trip with the set of trip boundary points, calculating the average load value in each independent trip interval after alignment, and determining and outputting the exact load status category of the trip.
[0017] Beneficial effects: 1. A time-point masking strategy is introduced at the front end, and a triple joint loss optimization framework of mask reconstruction loss, encoder contrast loss and temporal continuity loss is used to train the CNN-Transformer encoder. This effectively filters out single-point noise and abnormal fluctuations in the original GPS time-series data, and extracts a robust predicted load sequence from the source.
[0018] 2. This invention proposes a boundary inflection point detection strategy that combines the first-order difference direction and the second-order difference extremum. This strategy completely overcomes the technical blind spot of the traditional fixed threshold method, which cannot accurately identify the physical process of "slow and gradual loading and unloading" of vehicles. Combined with a short-stroke filtering mechanism, it achieves high-precision stroke physical boundary segmentation.
[0019] 3. The load state classification is modeled as a time sequence labeling problem. The CRF combined with the transition features is used for time smoothing, and the Viterbi algorithm is used for global decoding. This completely eliminates the state abrupt changes and time sequence jitter caused by classification at independent time points, ensuring strict time sequence consistency of the classification results. Attached Figure Description
[0020] The present invention will be further described below with reference to the accompanying drawings and embodiments: Figure 1 This is a flowchart of the load sequence and first- and second-order difference of the present invention; Figure 2 This is a time-point level masking strategy diagram of the present invention; Figure 3 This is a diagram of the triple joint loss optimization framework of the present invention; Figure 4 This is a flowchart of the encoder comparison learning process of the present invention; Figure 5 This is a structural diagram of the CRF model of this invention. Detailed Implementation
[0021] Example 1 like Figure 1 As shown, a method for automatic stroke segmentation and load condition classification includes: S1. After obtaining the original GPS time-series data sequence of the vehicle, different mask versions are generated through a time-point masking strategy and input into a CNN-Transformer encoder with shared weights. The encoder is trained using a triple joint loss optimization framework that includes mask reconstruction loss, encoder contrast loss and temporal continuity loss, and a robust predicted load sequence is extracted and output. S2. Calculate the first-order difference and the second-order difference in sequence for the predicted load sequence. Combine the extreme value of the second-order difference with the direction of the first-order difference to detect the inflection point of the load change. Filter short-stroke noise through the stroke duration condition and output a highly reliable set of stroke boundary points. S3. Model the load state classification problem as a time series labeling problem, define a set of states including empty, half-loaded and full-loaded and the corresponding emission and transfer feature functions, construct a CRF model, and use the Viterbi algorithm to dynamically program and decode to solve the globally optimal load state sequence. S4. Based on the optimal load state sequence output by CRF annotation and the set of travel boundary points detected by second-order difference, perform joint logic post-processing to accurately determine the physical start and end points of the travel, and calculate the average load in each independent travel interval to output the final load state category.
[0022] In step S1, to overcome the single-point noise and abnormal fluctuations in the original GPS trajectory data, the system introduces a feature extraction mechanism combining a CNN-Transformer encoder with contrastive learning. Specifically, the system acquires the vehicle's GPS time-series data sequence. As input, the original sequence is randomly masked using a point-wise masking strategy, generating two different mask versions, namely mask version 1. and mask version 2 The original GPS sequence and two masked versions are synchronously input into a CNN-Transformer encoder with shared weights to generate a high-dimensional hidden layer representation. ,like Figure 2 As shown. To improve the model's ability to understand temporal context, the hidden layer representations are fed into projection head 1 and projection head 2 respectively to calculate the InfoNCE contrastive loss. During the model optimization phase, the system constructs a triple joint loss optimization framework, as follows: Figure 3 As shown, the formula for calculating the total target loss is: ; in, This represents the overall objective loss function for multi-task joint optimization. This represents the mask reconstruction loss, used to constrain the model's ability to reconstruct data from the masked time points. This represents the encoder contrastive loss (InfoNCE), used to narrow the feature distance between different mask versions of the same sequence in high-dimensional space and to widen the distance between different sequences. This represents the temporal continuity loss, used to ensure a smooth transition of features between adjacent time points. , and These represent the weight parameters of the corresponding loss term, used to balance the gradient contributions of the three.
[0023] Mask Reconstruction Loss The mean squared error (MSE) function is used to calculate the difference between the true and predicted features at the masked location. The specific calculation formula is as follows: ; in, This represents the set of indexes of the time points being masked. The total number of mask points, For time points The original GPS feature values, These are the feature predictions reconstructed by the encoder.
[0024] Encoder contrast loss The InfoNCE loss function is used to maximize the feature similarity between different masked versions of the same time series. Its specific calculation formula is as follows: ; in, and These represent the positive samples output after the same original GPS sequence is input into the projection head using mask version 1 and mask version 2, respectively. This represents negative samples from other different sequences within the same batch. This represents the function for calculating cosine similarity. In this embodiment, the preferred temperature hyperparameter is 0.07. This is the training batch size.
[0025] A stable and denoised prediction payload sequence was obtained using the aforementioned CNN-Transformer encoder. Then, the system proceeds to step S2 to capture the gradual inflection point of vehicle loading and unloading, such as... Figure 4 As shown. The system first calculates the first-order difference of the predicted load sequence, and the calculation formula is as follows: ; in, Indicates a point in time The first difference value, Indicates the current time point The predicted load value, Indicates the previous time point The predicted load value is obtained by using this formula to extract the trend of the sequence at adjacent time points and determine whether the load change is in an upward or downward direction.
[0026] Based on obtaining the first-order difference, in order to accurately locate the abrupt change point of the load change rate, the system... Within the range, the second-order difference is further calculated, and its calculation formula is as follows: ; in, Indicates a point in time The second difference value, The current time point The first difference value, For the previous time point The first-order difference value is used to characterize the rate of change of the load, and its maximum or minimum point strictly maps the inflection point of the physical loading and unloading behavior.
[0027] After obtaining the difference features, the system performs a joint logical judgment on the second-order difference extrema and the first-order difference direction: like and Then determine the time point. This is an upward inflection point, and it is marked as a candidate point for the start of the journey; like and Then determine the time point. This is a downward inflection point, and it is marked as a candidate point for the end of the journey; If the extreme value condition is not met, it is ignored as a steady fluctuation.
[0028] After merging the candidate start and end points to generate candidate trip segments, the system introduces a time span filtering rule to determine whether the trip duration is less than the shortest time interval. If so, it is treated as local noise fluctuation and excluded; otherwise, it is retained as a valid stroke, and a highly reliable set of stroke boundary points is output. .
[0029] In practical engineering applications, to ensure that the second-order difference extremum judgment and short-stroke filtering can adapt to the physical operating laws of real vehicles, this embodiment has specifically calibrated and limited the key threshold parameters: Upward extreme threshold With the downside extreme threshold An adaptive setting is implemented based on the variance of the load change rate under historical normal loading and unloading conditions. Under normal circumstances... The value range is set to the vehicle's rated load. To effectively filter high-frequency noise from suspension spring deformation caused by road bumps; Shortest time period The preferred value range is... This physical setting takes into account that when a vehicle is waiting at a traffic light, in a brief traffic jam, or going over a speed bump, it may experience instantaneous fluctuations in load characteristics due to braking inertia. Fluctuations lasting less than 30 seconds are directly eliminated as noise, which can completely avoid misjudging ordinary traffic start-stop behavior as the boundary of loading and unloading stroke.
[0030] Example 2 In order for the conditional random field model to accurately reflect the physical operating state of the vehicle, this embodiment focuses on emission characteristics. and transfer characteristics The input mapping is specifically defined as follows: emission characteristics Observation sequence input It not only includes predicted single load values, but also incorporates vehicle kinematic physics parameters extracted from GPS time-series data, specifically including: time points average vehicle speed Longitudinal acceleration and road surface slope calculated based on GPS elevation. The evaluation logic for emission characteristics in the model is as follows: when there is a large slope... Uphill with low acceleration When compared with high payload prediction values, the launch characteristics are given to full payload. The highest base probability score of the state; transition features A priori constraint matrix is set according to the objective physical laws of continuous transportation of logistics vehicles. For example, when the vehicle does not stop for a long time and the speed... During the journey, the state changed from full load Direct mutation to empty load The transition weights are set to minimum or negative infinity, thereby cutting off impossible state transitions during driving from a physical and logical perspective, greatly enhancing the model's ability to smooth local abnormal noise.
[0031] In step S3, to eliminate the temporal inconsistencies and classification jitter caused by classification at independent time points, the system models the load state classification problem as a sequence labeling problem. The system defines a set of states consisting of three load state labels. , respectively representing no load Half a year and fully loaded Subsequently, the system defined emission characteristics that reflect the observation state. and transition features that reflect the probability of time-series label transitions. Based on the above characteristics, a conditional random field model is constructed, such as... Figure 5 As shown, the formula for solving the conditional probability of the global label sequence is: ; in, Indicates that given the observed features input sequence Under the given conditions, generate the target load tag sequence. The conditional probability, This is a normalization factor used to transform the exponential scores of all possible paths into a valid probability distribution. Represents the time step index of a time series. The feature weight vector obtained during model training. This represents a joint characteristic function that integrates the current state, the previous state, and the observation sequence.
[0032] To efficiently find the global optimum in the sequence combination space, the system uses the Viterbi algorithm for dynamic programming decoding, and its solution formula is as follows: ; in, This represents the globally optimal load state sequence output by the model. Represents all possible candidate label sequences In the middle, search and return the conditional probability. The sequence parameter combination that reaches the maximum value.
[0033] In step S4, the system performs joint logical post-processing of trip segmentation and state classification. This is based on the optimal state sequence output by the CRF model. The system will change the load status from unloaded. The transition point from non-empty to non-empty is marked as the start of the journey, changing the load status from non-empty to empty. The transition point is marked as the end of the journey and is compared with the set of journey boundary points extracted in step S2. Perform cross-validation and timing alignment.
[0034] Finally, the system calculates the average load value within each independent travel interval after alignment, and ultimately determines and outputs the exact load status category of that travel.
[0035] The above embodiments are merely preferred technical solutions of the present invention and should not be considered as limitations on the present invention. The scope of protection of the present invention should be limited to the technical solutions described in the claims, including equivalent substitutions of the technical features described in the claims. That is, equivalent substitutions and improvements within this scope are also within the scope of protection of the present invention.
Claims
1. A method for automatic stroke segmentation and load condition classification, characterized in that: The method includes: S1. Obtain the vehicle GPS time series data sequence, input it into the encoder to extract and output the predicted load sequence; S2. Calculate the first-order difference and the second-order difference in sequence for the predicted load sequence. Combine the extreme value of the second-order difference with the direction of the first-order difference to detect the inflection point of the load change. Filter short-stroke noise through the stroke duration condition and output the set of stroke boundary points. S3. Model the load state classification problem as a time series labeling problem, construct a CRF model, and dynamically program and decode to solve the load state sequence; S4. Based on the load state sequence and travel boundary point set output by CRF annotation, perform joint logic post-processing to determine the start and end points of the travel and output the load state category of each independent travel interval.
2. The method for automatic stroke segmentation and load condition classification according to claim 1, characterized in that: In step S1, the encoder is a CNN-Transformer encoder with shared weights. Mask version 1 and mask version 2 are generated through a time-point masking strategy and synchronously input into the encoder. Training is performed using a triple joint loss optimization framework that includes mask reconstruction loss, encoder contrast loss and temporal continuity loss. The formula for calculating the overall objective loss in the triple joint loss optimization framework is: ; in, Represents the overall objective loss function. Indicates the loss during mask reconstruction. Indicates encoder contrast loss. Indicates the loss of temporal continuity. , and These represent the weight parameters of the corresponding loss terms.
3. The method for automatic stroke segmentation and load condition classification according to claim 1, characterized in that: In step S1, the original sequence is randomly masked using a time-point masking strategy to generate mask version 1 and mask version 2. The original GPS time-series data sequence and mask version 1 and mask version 2 are synchronously input into the CNN-Transformer encoder with shared weights to generate a high-dimensional hidden layer representation. The high-dimensional hidden layer representation is then input into projection head 1 and projection head 2 respectively to calculate the encoder contrast loss.
4. The method for automatic stroke segmentation and load condition classification according to claim 1, characterized in that: In step S2, the formulas for calculating the first-order and second-order differences of the predicted load sequence are as follows: ; ; in, Indicates a point in time The first difference value, Indicates the current time point The predicted load value, Indicates the previous time point The predicted load value, Indicates a point in time The second difference value, For the previous time point The first-order difference value.
5. The method for automatic stroke segmentation and load condition classification according to claim 4, characterized in that: In step S2, the logic for detecting the inflection point of load change by combining the second-order difference extremum and the first-order difference direction is as follows: like and Then determine the time point. This is an upward inflection point, and it is marked as a candidate point for the start of the journey; like and Then determine the time point. This is a downward inflection point, and it is marked as a candidate point for the end of the journey; If the extreme value condition is not met, the data is ignored as stable fluctuation data.
6. The method for automatic stroke segmentation and load condition classification according to claim 5, characterized in that: Step S2, extracting the set of travel boundary points, also includes filtering short-travel noise based on travel duration conditions. The specific logic is as follows: Merge candidate start and end points to generate candidate trip segments, and determine whether the trip duration is less than the shortest time interval; If so, it should be considered as local noise fluctuation and excluded; If not, retain it as a valid trip and output the set of trip boundary points.
7. The method for automatic stroke segmentation and load condition classification according to claim 1, characterized in that: In step S3, the load state classification problem is modeled as a time-series labeling problem. A set of states including empty, half-loaded, and fully loaded states, along with corresponding emission and transition feature functions, are defined. The formula for solving the conditional probability of the global label sequence is: ; in, Indicates that given the observed features input sequence Under the given conditions, generate the target load tag sequence. The conditional probability, As the normalization factor, The time step index representing a time series. The feature weight vector obtained during model training. This represents a joint characteristic function that integrates the current state, the previous state, and the observation sequence.
8. The method for automatic stroke segmentation and load condition classification according to claim 7, characterized in that: In step S3, the solution formula for dynamic programming decoding using the Viterbi algorithm is as follows: ; in, This represents the globally optimal load state sequence output by the model. Represents all possible candidate label sequences In the middle, search and return the conditional probability. The sequence parameter combination that reaches the maximum value.
9. The method for automatic stroke segmentation and load condition classification according to claim 1, characterized in that: In step S4, the logic for post-processing the joint logic is as follows: Mark the point where the load condition changes from unloaded to non-unloaded as the start of the journey. Mark the point where the load condition changes from non-empty to empty as the end point of the journey.
10. The method for automatic stroke segmentation and load condition classification according to claim 9, characterized in that: In step S4, the post-processing steps of the joint logic also include: cross-validating and aligning the marked start and end points of the trip with the set of trip boundary points, calculating the average load value in each independent trip interval after alignment, and determining and outputting the exact load status category of the trip.
Citation Information
Patent Citations
Conditional random field based real time traffic state estimation method
CN107767036A
