Road surface condition index prediction method, system and equipment and storage medium
By improving the position encoding and encoder design of the Transformer model, the problems of nonlinear feature capture and long-term modeling in PCI prediction are solved, achieving high-precision road condition index prediction suitable for complex environments.
Patent Information
- Application Number
- CN202511752878.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-01-13
AI Technical Summary
Existing PCI prediction technologies struggle to capture the nonlinear characteristics of pavement performance degradation under complex climates and special service environments, and their long-term modeling capabilities are insufficient, resulting in prediction accuracy that does not meet engineering requirements.
An improved Transformer model is adopted, the decoder and cross-attention module are removed, the encoder of the original Transformer model is replaced with modified positional encoding, and the parity column of PCI data is encoded by sin/cos function. The time series data is incorporated, and nonlinear variation features are extracted by multi-layer encoder for PCI prediction.
It improves the accuracy and adaptability of PCI prediction, can accurately capture long-term time-series dependencies of road conditions, is suitable for complex service environments, and meets engineering requirements.
Smart Images

Figure CN121328854A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of road engineering management, and specifically relates to a method, system, equipment and storage medium for predicting road condition index. Background Technology
[0002] The Road Condition Index (PCI) is a core indicator for assessing road service performance and a key basis for making road maintenance decisions, optimizing resource allocation, and extending road service life. With the expansion of highway networks and the increasing complexity of service environments, accurate prediction of PCI values is of significant practical importance for developing scientific maintenance plans and ensuring the long-term service performance of roads.
[0003] Existing PCI prediction techniques have significant limitations: traditional statistical models (such as linear regression and time series analysis) can only characterize linear correlations and cannot capture the nonlinear characteristics of road performance degradation, resulting in extremely poor adaptability in complex climates and special service environments; while some deep learning methods (such as Long Short-Term Memory networks LSTM) can process basic time series data, PCI data is a nonlinear decay process affected by the coupling of multiple factors. Existing methods have weak capabilities in modeling the "long-range correlation" of long-term PCI, making it difficult to uncover deep dependencies between data from multiple time steps. Their long-term modeling capabilities are insufficient, and their prediction accuracy cannot meet engineering requirements. Summary of the Invention
[0004] To address the shortcomings of existing Transformer architectures in PCI prediction, this invention provides a road condition index prediction method, system, device, and storage medium.
[0005] To achieve the above objectives, the present invention provides the following technical solution: A method for predicting road surface condition index includes the following steps: Obtain historical multi-time series road surface condition index (PCI) data for the target area; The historical multi-time series road condition index (PCI) data is input into a pre-trained improved Transformer model to obtain PCI prediction data for future time periods. The improved Transformer model is based on the original Transformer model, but the decoder and cross-attention module of the original Transformer model are removed, and the position encoding in the encoder of the original Transformer model is replaced with a modified position encoding. In the improved Transformer model, the even-numbered columns of PCI data are encoded using a sine function and the odd-numbered columns are encoded using a cosine function, and the corresponding time-series data is incorporated to obtain the encoded PCI data. A multi-layer encoder is then used to extract features from the encoded PCI data, capturing the non-linear changes in the encoded PCI data to obtain change features. Finally, a linear transformation is performed on these change features to obtain the predicted PCI data for the future time period.
[0006] Preferably, before the modified position encoding processes the PCI data, the process further includes dimensional transformation of the input PCI data through an embedding layer.
[0007] Preferably, in the multilayer encoder, each layer of the encoder sequentially performs multi-head self-attention, residual connection and layer normalization, feedforward network, residual connection and layer normalization processing.
[0008] Preferably, the even-numbered columns of the PCI data are encoded using the sine function, and the odd-numbered columns are encoded using the cosine function, incorporating the corresponding time-series data of the PCI data, specifically through the following formula: When the time series data corresponding to the incorporated PCI data has no periodic characteristics, the even-numbered column is specifically calculated using the following formula: ; Where col / / 2 indicates that even-numbered columns are grouped in pairs, Δt is the time interval for incorporating PCI time series, pos is the row index, and d is the embedding dimension; Odd-numbered sequences are calculated using the following formula: ; When the time series data corresponding to the incorporated PCI data has periodic characteristics, the even-numbered column is specifically calculated using the following formula: ; Odd-numbered sequences are calculated using the following formula: ; Where T is the period length.
[0009] Preferably, the method further includes preprocessing the multi-time series road condition index (PCI) data of the target area before inputting the multi-time series PCI data into the pre-trained improved Transformer model. Specifically, ZScore standardization is used to eliminate the influence of dimensions, and then outliers are removed using the quartile method.
[0010] Preferably, when acquiring historical multi-time series road condition index (PCI) data for the target area, a dual-mode adaptation is adopted. When there is no existing data, samples are generated with a fixed random seed. Based on the PCI engineering distribution, performance degradation is simulated by the attenuation coefficient, and random errors are superimposed. If there is existing data, structured time series PCI data is read directly.
[0011] The present invention also provides a road surface condition index prediction system, specifically including: The data acquisition module is used to acquire historical multi-time series road surface condition index (PCI) data for the target area.
[0012] The prediction processing module is used to input the historical multi-time series road condition index (PCI) data into a pre-trained improved Transformer model to obtain PCI prediction data for future time periods. The improved Transformer model is based on the original Transformer model, but removes the decoder and cross-attention module of the original Transformer model and replaces the position encoding in the encoder of the original Transformer model with a modified position encoding. In the improved Transformer model, the even-numbered columns of PCI data are encoded using a sine function and the odd-numbered columns are encoded using a cosine function, and the corresponding time-series data is incorporated to obtain the encoded PCI data. A multi-layer encoder is then used to extract features from the encoded PCI data, capturing the non-linear changes in the encoded PCI data to obtain change features. Finally, a linear transformation is performed on these change features to obtain the predicted PCI data for the future time period.
[0013] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps described in the road condition index prediction method.
[0014] The present invention also provides a computer-readable storage medium storing a computer program that, when loaded by a processor, can execute the steps described in the road surface condition index prediction method.
[0015] The road surface condition index prediction method provided by this invention has the following beneficial effects: This invention removes the decoder and cross-attention module from the original Transformer model, reducing the model parameter size, computational overhead, and better meeting the stability requirements of large-sample training. A modified positional encoding is designed to directly map temporal positions and embedding dimensions to matrix rows / columns. After assigning column parity using sin / cos functions, temporal information of the PCI data is fused, enhancing the capture and learning of the nonlinear decay process of the PCI data. Based on the improved Transformer model, high-precision and highly adaptable PCI predictions are obtained by processing PCI data. Attached Figure Description
[0016] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart of a road surface condition index prediction method according to an embodiment of the present invention.
[0018] Figure 2 A comparison chart of training / validation loss curves obtained by the prediction method provided in this invention.
[0019] Figure 3 This is a comparison chart of predicted values and actual values for the first 100 samples in an embodiment of the present invention.
[0020] Figure 4 This is a scatter plot of predicted values versus actual values in an embodiment of the present invention.
[0021] Figure 5 This is an error distribution histogram in an embodiment of the present invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0023] Example This invention provides a method for predicting road surface condition indices, such as... Figure 1 As shown, the specific steps include: Step 1: Acquire multi-time series PCI data of the target area and preprocess it.
[0024] Multi-time series PCI data of the target region was collected. ZScore standardization was used to eliminate the influence of dimensions, and outliers were removed using the quartile method, with the outlier ratio not exceeding 20%. The data was divided into training and testing sets according to the time series (e.g., 8:2). The PCI of the first N-1 time series was set as the input features, and the PCI of the Nth time series was set as the prediction target. A dual-mode adaptation mechanism was adopted for data acquisition. In the absence of existing data, samples were generated using a fixed random seed, based on the PCI engineering distribution (e.g., 50-100), and the performance degradation was simulated by an attenuation coefficient, with random errors added. In the presence of existing data, structured time series PCI data was directly read. The input features were standardized and reshaped into the form of [number of samples, time step, number of features] to adapt to the Transformer model's "[batch_size, time step, number of features]" input format. The prediction target was reshaped into [number of samples, 1] to ensure training stability.
[0025] Step 2: Construct the improved Transformer model. Based on the original Transformer model, only the "multi-layer encoder" is retained, while the decoder and cross-attention module are removed. The positional encoding in the original Transformer model's encoder is replaced with a modified positional encoding, resulting in the improved Transformer model. The positional encoding of the original Transformer model is a one-dimensional general encoding, while the modified positional encoding is a two-dimensional task-adaptive encoding.
[0026] Step 3: Divide the preprocessed multi-time series PCI data into training, testing, and validation sets. Use the training set data to train the improved Transformer model, obtaining a pre-trained improved Transformer model to predict PCI data. This specifically includes the following steps: S31: Input the multi-temporal PCI data of the target region into the embedding layer, and convert the dimensions to a high-dimensional vector sequence of d_model (16-64). Set the embedding layer dimension to 16-64, and the number of multi-head attention heads to 2-8.
[0027] S32: The high-dimensional vector sequence is subjected to modified positional encoding and input into a multilayer encoder. The modified positional encoding is organized in the form of a two-dimensional matrix, which directly maps the "temporal position" and "embedding dimension" to the rows / columns of the matrix. At the same time, the sin / cos function is assigned according to the parity of the columns, and PCI timing information is incorporated.
[0028] Core parameter definitions: Sequence length L: number of time steps in the input time series (L=30); Embedding dimension d: 16-64 in the text (i.e., the original d_model); Two-dimensional position encoding matrix PE: dimension is L×d (row = time series position, column = embedding dimension), which is directly added to the embedding layer output matrix.
[0029] Calculate separately for each element PE[pos, col] in the matrix PE (pos = row index, 0 ≤ pos < L; col = column index, 0 ≤ col < d).
[0030] For even columns, use the sin function. The frequency parameter is associated with the column index and incorporates the time interval Δt of the PCI timing. It is specifically calculated by the following formula: ; where col / / 2 means grouping even columns in pairs (e.g., col = 0 and 1, 2 and 3). The same group shares the same frequency, maintaining the characteristic of "frequency decaying as the dimension increases" of the original encoding. At the same time, pos×Δt converts the position index into the actual timing interval to adapt to the time scale of PCI.
[0031] For odd columns, use the cos function. Share the frequency parameter with the corresponding even column to ensure the phase consistency of adjacent columns. Also incorporate the time interval Δt: ; where (col - 1) / / 2 ensures that odd columns belong to the same frequency group as the previous even column (e.g., col = 1 corresponds to col = 0), avoiding phase confusion of timing information.
[0032] In continuous PCI data, there will be periodic or aperiodic stages. Different sin functions are used for calculation. Incorporating PCI timing information, when PCI has no periodic characteristics, directly generate the elements of the PE matrix according to the sin / cos formula of separate calculation. If PCI contains periodic characteristics, replace 10000 in the denominator of the frequencies of the sin and cos formulas with T (period length, e.g., T = 24), specifically as the following formula, to make the encoding more accurately capture the periodic pattern, and then generate the elements of the PE matrix according to the rule of "sin / cos corresponding to odd and even columns, and the same group sharing the frequency" of separate calculation.
[0033] ; ; Finally, directly add the PE matrix and the output matrix of the embedding layer (dimension L×d) element by element to complete the injection of "timing position information + PCI features".
[0034] S33: Each layer of the encoder performs the processing flow of "multi-head self-attention → residual connection + layer normalization → feed-forward network → residual connection + layer normalization".
[0035] S34: Obtain the task prediction result through the output layer of the encoder (such as a linear layer).
[0036] The improved Transformer model was trained using the Adam optimizer with batch sizes of 16-64 and a maximum training epoch of 30-100. A test set was used as the validation set to ensure stability during large-sample training. The learning rate was set to 0.0001-0.01, and the loss function was MSE (mean squared error). The EarlyStopping mechanism (e.g., terminating training if the validation loss does not decrease after 5-10 epochs) and the ReduceLROnPlateau mechanism (e.g., halving the learning rate if the loss does not decrease after 3-5 epochs, down to a minimum of 1e-7) were integrated. These measures effectively prevented overfitting and ensured the model exhibited good generalization ability, similar to its performance in traffic flow prediction.
[0037] Step 4: Model evaluation and results analysis.
[0038] (1): Model evaluation.
[0039] The model performance is quantitatively evaluated using three metrics: R², MSE, and MBE. Simultaneously, the model's effectiveness is validated through visualization methods such as training / validation loss curves, prediction-actual value scatter plots, and error histograms. The robustness of the model is assessed by adding ±3%-±8% noise to a randomly selected sample (e.g., 5%-15%) for perturbation testing. The evaluation criteria are set as follows: R² ≥ 0.85 is considered excellent accuracy, R² ≥ 0.8 is considered acceptable accuracy, and R² ≥ 0.75 is considered good accuracy; otherwise, further model optimization is required. The visualization charts can be saved as a results file, including training / validation loss curves, sample prediction comparison charts, prediction-actual value scatter plots, and error histograms, comprehensively demonstrating the model's prediction performance.
[0040] (2) Results analysis.
[0041] Depend on Figure 2 , Figure 3 , Figure 4 , Figure 5 As shown in Table 1, the improved Transformer model has a high R² value (e.g., above 0.9), small absolute values of MSE and MBE, and the best fitting effect and bias control. It can accurately capture the long-term dependence of PCI. Its performance advantage is similar to the complex pattern recognition capability shown in bridge health monitoring, and it has strong adaptability to complex PCI decay laws.
[0042] Table 1. Model Quantification Indicators (Test Set) (3) Robustness verification.
[0043] The improved Transformer model was tested with sample perturbation (e.g., 10% of samples ± 5% noise). The test set R² fluctuation was small (e.g., within ± 0.03), and the MSE fluctuation was small (e.g., within ± 0.5), demonstrating excellent robustness and adaptability to complex service environment changes.
[0044] This prediction method is applicable to PCI prediction in different regions, different highway management branches, and road sections with different service conditions. It can be adapted to multi-regional application scenarios by introducing regional embedding vectors (including latitude, longitude, and climate zoning information). In addition, the method can be extended to joint prediction of multiple indicators, simultaneously predicting multiple road condition indicators such as PCI, Road Ride Quality Index (RQI), and Rutting Depth (RD) based on the same Transformer architecture, similar to the multi-task learning framework in multimodal traffic prediction.
[0045] The present invention also provides a road surface condition index prediction system, comprising: The data acquisition module is used to acquire historical multi-time series road surface condition index (PCI) data for the target area.
[0046] The prediction processing module is used to input historical multi-time series road condition index (PCI) data into a pre-trained improved Transformer model to obtain PCI prediction data for future time periods. The improved Transformer model is based on the original Transformer model, but removes the decoder and cross-attention module of the original Transformer model and replaces the position encoding in the encoder of the original Transformer model with a modified position encoding. In the improved Transformer model, even-numbered columns of PCI data are encoded using a sine function and odd-numbered columns are encoded using a cosine function through modified positional coding. The time-series data corresponding to the PCI data is then incorporated to obtain the encoded PCI data. A multi-layer encoder is then used to extract features from the encoded PCI data to capture the nonlinear change process of the encoded PCI data and obtain the change features. Finally, a linear transformation is performed on the change features to obtain the PCI prediction data for the future time period.
[0047] The various modules in the aforementioned road condition index prediction system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0048] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps in an embodiment of a road condition index prediction method. Specific implementation methods can be found in the method embodiments, and will not be repeated here.
[0049] Furthermore, the present invention also provides a non-transitory computer-readable storage medium containing instructions on which a computer program is stored. For example, a memory containing instructions that can be executed by a processor of a computer device to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc. When the computer program is executed by the processor, it can implement the steps in an embodiment of a road condition index prediction method. Specific implementation methods can be found in the method embodiments, which will not be repeated here.
[0050] Those skilled in the art will understand that embodiments of the present invention can provide methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0051] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0052] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0053] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0054] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification and embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the present invention patent. No reference numerals in the claims should be construed as limiting the scope of the claims. Any simple variations or equivalent substitutions of technical solutions that can be readily obtained by those skilled in the art within the scope of the technology disclosed in the present invention are within the protection scope of the present invention.
Claims
1. A method for predicting road surface condition index, characterized in that, Includes the following steps: Obtain historical multi-time series road surface condition index (PCI) data for the target area; The historical multi-time series road condition index (PCI) data is input into a pre-trained improved Transformer model to obtain PCI prediction data for future time periods. The improved Transformer model is based on the original Transformer model, but removes the decoder and cross-attention module of the original Transformer model, and replaces the positional encoding in the encoder of the original Transformer model with a modified positional encoding. In the improved Transformer model, the even-numbered columns of PCI data are encoded using a sine function and the odd-numbered columns are encoded using a cosine function, and the corresponding time-series data is incorporated to obtain the encoded PCI data. A multi-layer encoder is then used to extract features from the encoded PCI data, capturing the non-linear changes in the encoded PCI data to obtain change features. Finally, a linear transformation is performed on these change features to obtain the predicted PCI data for the future time period.
2. The method for predicting road surface condition index according to claim 1, characterized in that, The modified position encoding process for PCI data includes dimensional transformation of the input PCI data via an embedding layer before processing.
3. The method for predicting road surface condition index according to claim 1, characterized in that, In the multilayer encoder, each layer of the encoder sequentially performs multi-head self-attention, residual connection and layer normalization, feedforward network, residual connection and layer normalization processing.
4. The method for predicting road surface condition index according to claim 1, characterized in that, Even-numbered columns of PCI data are encoded using the sine function, while odd-numbered columns are encoded using the cosine function. This is then integrated with the corresponding time-series data from the PCI data, specifically through the following formula: When the time series data corresponding to the incorporated PCI data has no periodic characteristics, the even-numbered column is specifically calculated using the following formula: ; Where col / / 2 indicates that even-numbered columns are grouped in pairs, Δt is the time interval for incorporating PCI time series, pos is the row index, and d is the embedding dimension; Odd-numbered sequences are calculated using the following formula: ; When the time series data corresponding to the incorporated PCI data has periodic characteristics, the even-numbered column is specifically calculated using the following formula: ; Odd-numbered sequences are calculated using the following formula: ; Where T is the period length.
5. The method for predicting road surface condition index according to claim 1, characterized in that, It also includes preprocessing the multi-time series road condition index (PCI) data of the target area before inputting the multi-time series PCI data into the pre-trained improved Transformer model. Specifically, ZScore standardization is used to eliminate the influence of dimensions, and then outliers are removed using the quartile method.
6. The method for predicting road surface condition index according to claim 1, characterized in that, When acquiring historical multi-time series road condition index (PCI) data for the target area, a dual-mode adaptation is adopted. When there is no existing data, samples are generated with a fixed random seed, and performance degradation is simulated by an attenuation coefficient based on the PCI engineering distribution, with random errors superimposed. When there is existing data, structured time series PCI data is read directly.
7. A road surface condition index prediction system, characterized in that, include: The data acquisition module is used to acquire historical multi-time series road surface condition index (PCI) data for the target area; The prediction processing module is used to input the historical multi-time series road condition index (PCI) data into a pre-trained improved Transformer model to obtain PCI prediction data for future time periods. The improved Transformer model is based on the original Transformer model, but removes the decoder and cross-attention module of the original Transformer model, and replaces the positional encoding in the encoder of the original Transformer model with a modified positional encoding. In the improved Transformer model, the even-numbered columns of PCI data are encoded using a sine function and the odd-numbered columns are encoded using a cosine function, and the corresponding time-series data is incorporated to obtain the encoded PCI data. A multi-layer encoder is then used to extract features from the encoded PCI data, capturing the non-linear changes in the encoded PCI data to obtain change features. Finally, a linear transformation is performed on these change features to obtain the predicted PCI data for the future time period.
8. A computer device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor, it is able to perform the steps of the method according to any one of claims 1 to 6.
