Dynamic truck scale metering method capable of automatically fitting parameters
By recording and analyzing vehicle data in real time and using decision tree models to predict, the problems of inconvenient data recording and insufficient prediction accuracy in traditional dynamic vehicle scale measurement methods are solved, and more efficient and reliable vehicle weight monitoring is achieved.
Patent Information
- Application Number
- CN202411868999.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-18
AI Technical Summary
The traditional dynamic vehicle measurement method has problems such as inconvenient data recording, cumbersome manual operations and error-prone, resulting in insufficient weight prediction accuracy and cannot meet the needs of modern traffic management and safety monitoring.
By recording and analyzing the weight, speed and model data of the vehicle in real time, using the decision tree model to predict, the automatic recording, processing and analysis of data is realized, manual intervention is reduced, and prediction accuracy is ensured through error judgment and model optimization mechanisms.
It significantly improves the accuracy of vehicle weighing, reduces the error rate caused by manual operation, improves the efficiency and reliability of dynamic vehicle scale verification, and can better support traffic safety monitoring and road maintenance.
Smart Images

Figure CN119884540A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of dynamic automobile scale measurement with automatic parameter fitting, and in particular to a dynamic automobile scale measurement method with automatic parameter fitting. Background Art
[0002] Traditional vehicle weight measurement methods usually rely on static weighing equipment, which is not only time-consuming but also unable to reflect the weight changes of vehicles in dynamic driving in real time. In addition, existing weight prediction models are often based on relatively simple linear regression or rule-based models, which are difficult to effectively capture the complex nonlinear relationship between vehicle characteristics and weight. This leads to insufficient prediction accuracy and cannot meet the needs of modern traffic management and safety monitoring. The weight-based charging system is widely used in highway toll stations in my country. The core of this system is the dynamic truck scale. In order to ensure accurate billing, the dynamic truck scale must be regularly calibrated.
[0003] Dynamic vehicle scales are working measuring instruments installed outdoors. Calibrators need to carry laptops to debug instrument parameters and record raw data on site. However, on-site data recording is greatly affected by environmental factors, and laptops face many challenges when used on site, mainly manifested in:
[0004] 1. In summer, the direct sunlight makes the screen reflect light. Even if the screen brightness is adjusted to the maximum, sometimes it is difficult to clearly see the contents of the record form;
[0005] 2. In other seasons, weather conditions such as wind, sand, rain, and snow may affect the performance of the laptop or even cause malfunctions, making it unusable.
[0006] The current calibration process requires manual participation in multiple links, consuming a lot of manpower and material resources. In particular, in terms of data recording, the current calibration process involves manual operations in multiple links, resulting in a waste of manpower and material resources. Calibrators need to manually record the measurement data of dynamic vehicle scales and enter these data into the management system. This recording and entry process is not only cumbersome, but also prone to errors, increasing the risk of data processing.
[0007] The present invention can significantly improve the prediction accuracy by predicting vehicle weight in real time, and the error can be controlled within the set threshold range, which not only improves the effectiveness of traffic safety monitoring, but also provides data support for road maintenance, can better predict road load conditions, and reduce road damage caused by overloading. In addition, with the continuous updating and optimization of the model, the prediction ability of the system will be gradually enhanced to adapt to different vehicles and driving conditions, and achieve more accurate weight monitoring.
[0008] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0009] The object of the present invention is to provide a dynamic vehicle scale measuring method with automatic parameter fitting to solve the problems raised in the above-mentioned background technology.
[0010] To achieve the above object, the present invention provides the following technical solutions:
[0011] A dynamic vehicle scale measurement method with automatic parameter fitting, the specific steps include:
[0012] Step 1: Record the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in real time, collect the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in the historical time period, including the corresponding vehicle actual weight data, and clean and extract the collected weight and speed data to obtain the vehicle feature data;
[0013] Step 2: Build a decision tree model, use the historical vehicle feature data to be monitored, including weight, speed and vehicle model data, as a training set, and use the corresponding vehicle actual weight data as a label, and input it into the decision tree model for training;
[0014] Step 3: Input the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform recorded in real time into the trained decision tree model to predict the actual vehicle weight data;
[0015] Step 4: Based on the error between the actual vehicle weight data predicted by the model and the actual weight data of the vehicle weighing, determine whether the error exceeds the set error threshold and retrain the model.
[0016] Furthermore, the time period for collecting historical vehicle data is set to T. During this time period T, each vehicle passing through the weighing platform is continuously monitored. For each vehicle, the moment it passes through the weighing platform, i.e., the timestamp t ij Record the following information: The instantaneous weight W of the i-th vehicle when it passes the weighing platform for the jth time ij , the instantaneous speed V of the i-th vehicle when it passes the weighing platform for the jth time ij , the vehicle type classification C obtained by the vehicle type recognition system for the i-th vehicle at the jth time ij , organize these data into a data set D:
[0017] D={(t ij , W ij , V ij , C ij)|i=1,2,...,n,j=1,2,...,n i}
[0018] Where n represents the total number of vehicles passing through the weighing platform in the time period T, and ni represents the number of times the weight, speed and vehicle model data of the i-th vehicle are monitored in the time period T;
[0019] Get the minimum and maximum weight data of each vehicle passing through the weighing platform within the T time period:
[0020] W min =min(W ij |i=1,2,...,n,j=1,2,...,n i )
[0021] W max =max(W ij |i=1,2,...,n,j=1,2,...,n i )
[0022] Among them, for each car, if W ij <W min or W ij >W max , it is considered as an outlier and removed;
[0023] Get the minimum and maximum speed data of each vehicle passing the weighing platform during the T time period:
[0024] V min =min(V ij |i=1,2,...,n,j=1,2,...,n i )
[0025] V max =max(V ij |i=1,2,...,n,j=1,2,...,n i )
[0026] Among them, for each car, if V ij <V min or V ij >V max , it is considered as an outlier and removed;
[0027] The actual weight, speed and vehicle type data of the vehicle to be monitored when passing through the weighing platform are recorded at each time stamp t db Record data to form a data set:
[0028] D r ={(t db , W r,db , Vr,db , C r,db )|d=1,2,...,m,b=1,2,...,m d}
[0029] Where m represents the total number of vehicles recorded during the monitoring period, m d Indicates the number of times the weight, speed and vehicle model data of the dth vehicle are monitored within the time period T.
[0030] Furthermore, the instantaneous weight W when passing through the weighing platform during the T time period is ij , calculate the instantaneous weight W of all vehicles ij The mean value W m :
[0031]
[0032] in, It indicates the total number of monitoring times of the effective weight of all vehicles after removing outliers;
[0033] Calculate the deviation of each vehicle's weight from the mean and select the weight with the largest deviation from the mean. For the i-th vehicle, calculate the deviation of the weight from the mean at each weighing:
[0034] D ij =|W ij -W m |
[0035] Among them, D ij represents the deviation of the i-th vehicle at the j-th weighing;
[0036] For the i-th vehicle, find the number of weighings j that leads to the maximum deviation:
[0037] j i = argmax(D ij )for all i
[0038] Among them, j i represents the index of the weighing that causes the maximum deviation in the i-th vehicle;
[0039] By finding the index j i , select the corresponding weight as the dynamic parameter W s :
[0040]
[0041] Among them, W s represents the weight with the largest deviation from the mean;
[0042] At the selected vehicle index j iWhen the weighing that leads to the largest deviation is pointed to, the speed of that weighing is extracted:
[0043]
[0044] Among them, V s represents the weighing speed that leads to the largest weight deviation in the i-th vehicle;
[0045] Extract the vehicle model classification at the same weighing:
[0046]
[0047] Among them, C s It represents the classification of the vehicle type that caused the largest weight deviation in the i-th vehicle;
[0048] The extracted dynamic weight, speed and vehicle type are classified and organized into a feature dataset:
[0049] F={(W s , V s , C s )}
[0050] Among them, F represents the feature dataset, which contains the selected weight, speed and vehicle type classification data.
[0051] Furthermore, the feature data set F is standardized to eliminate the influence caused by different dimensions between features:
[0052]
[0053] Among them, F′ is the standardized feature data, and F is the original feature data;
[0054] μ is the mean of the feature data, and its calculation formula is:
[0055]
[0056] Among them, u represents the number of samples of feature data, F a represents the eigenvalue of the ath sample;
[0057] σ is the standard deviation of the characteristic data, and its calculation formula is:
[0058]
[0059] Among them, (F a -μ) 2 represents the square of the difference between each sample and the mean;
[0060] When a decision tree processes categorical data, One-Hot Encoding can convert categorical variables into numerical form. Suppose the vehicle type classification C s There are three categories: SUV, sedan, and truck. Through one-hot encoding, each category is represented by a separate binary column (0 or 1). These categories are represented as:
[0061]
[0062] Each row corresponds to a category, allowing the model to treat each category as a different input feature;
[0063] Use the vehicle weight recorded in the historical data as the label vector Y:
[0064] Y={W o |o=1,2,...,O}
[0065] Where O represents the number of vehicles, W o is the actual weight of the oth vehicle;
[0066] At each node, select a feature f to divide the data, use MSE (mean square error) as the division standard, evaluate the division effect of each node, and for the current node R, calculate its mean square error:
[0067]
[0068] Among them, M R Indicates the number of samples of the current node R, W o represents the true weight of the oth sample, Represents the predicted weight of the current node R, which is the mean of all samples in the node:
[0069]
[0070] The decision tree starts from the root node, recursively selects the best feature f and divides the data into the left subset D according to the partitioning criteria. left and right subset D right , with p representing the sample index being examined:
[0071] D left ={(F′ p , Y p )|F′ p,f ≤threshold}
[0072] The left subset contains all samples whose feature f is less than or equal to a certain threshold, F′ p represents the standardized feature vector of the pth sample, Y prepresents the target variable of the pth sample;
[0073] D right ={(F′ p , Y p )|F′ p,f >threshold}
[0074] Among them, the right subset contains all samples whose feature f values are greater than a certain threshold threshold.
[0075] Further, calculate the left subset D after feature f is divided left and right subset D right The mean square error is:
[0076]
[0077] Among them, M left and M right is the number of samples in the left subset and the right subset, and are the predicted weights of the left and right subsets;
[0078] Considering the mean square error before and after the division, the overall mean square error is calculated:
[0079]
[0080] Among them, MSE split is the overall mean square error of the current partition, which represents the weighted average of the prediction errors after the data is partitioned by a certain feature and threshold. R is the total number of samples in the current node, that is, the sum of the number of samples in the left child node and the right child node, that is, M R =M left +M right , MSE left and MSE right are the mean square errors of the left and right child nodes, respectively, indicating the mean square error between the sample prediction value and the true value in the left and right child nodes;
[0081] Select the best split feature and threshold, and select the feature with the minimum MSE for all features and their possible split points. split The characteristic f * and threshold * :
[0082]
[0083] Among them, f* is the best feature selected, which can most effectively reduce the mean square error. Threshold* is the best threshold selected, which is used to divide the value of feature f* so that the overall mean square error after division is minimized. Argmin represents the operation of finding the feature and threshold that minimizes the mean square error.
[0084] Further, create child nodes based on the feature f* and threshold * The samples that meet the conditions will be divided into the left child node R left , samples that do not meet the conditions will be divided into the right child node R right , for each child node R left and R right , repeat the above operation until the stop condition is reached;
[0085] During the training process, decide when to stop splitting: when the number of samples of the current leaf node is less than the preset minimum number of samples, stop splitting; when the depth of the tree reaches the preset maximum depth, stop splitting; when the mean square error of the node is small enough, stop splitting;
[0086] When the stopping condition is reached, the current node becomes a leaf node and stores the predicted value of the node, which is usually the mean of the node samples:
[0087]
[0088] in, is the predicted value of the current leaf node, indicating the predicted result of the sample corresponding to the leaf node, M leaf is the number of samples of the current leaf node, W o is the true target value of the oth sample in the current leaf node;
[0089] Based on the real-time monitored data, construct feature data:
[0090] F r ={(W r,s , V r,s , C r,s )}
[0091] Input the standardized feature data into the trained decision tree model X to predict the actual weight of the vehicle:
[0092]
[0093] in, represents the actual weight of the model's prediction of the real-time input feature, F′ r It is the standardized feature data;
[0094] The calculation process of the decision tree model X is:
[0095]
[0096] Among them, each Corresponds to the leaf node Leaf k The predicted value of .
[0097] Further, the actual vehicle weight data predicted and the actual weighed vehicle weight W are calculated. actual The error E between:
[0098]
[0099] Define an acceptable error threshold ∈ and check whether the calculated error E exceeds the set error threshold ∈: if E>∈, the model needs to be retrained;
[0100] Retraining the model requires collecting new sample data since the model prediction, including new feature data and corresponding actual weight data, and merging the newly collected data with the original training data to form a larger training data set D train,up :
[0101] D train,up =D train ∪{(F new , W actual )}
[0102] Using the updated dataset D train,up Retrain the decision tree model X, following the previous training process: feature selection, partitioning, and generating leaf nodes:
[0103] X(F′ r )=Train(D train,up )
[0104] During the training process, the decision tree model is retrained with the updated training data set to rebuild the model structure;
[0105] After retraining, use an independent validation set to evaluate the model effect and calculate the prediction error of the new model:
[0106]
[0107] Compute the absolute error of the new model:
[0108]
[0109] The above steps ensure that the error of the new model is lower than the error of the old model and is within an acceptable range.
[0110] Compared with the prior art, the present invention has the following beneficial effects:
[0111] The present invention can effectively reduce the errors caused by human factors and external environment in traditional methods by real-time recording and analyzing the weight, speed and model data of the vehicle, and using the decision tree model for prediction, thereby significantly improving the accuracy of vehicle weighing. The method realizes automatic recording, processing and analysis of data, reduces the need for manual intervention, reduces the error rate caused by manual operation, and makes the verification of dynamic vehicle scales more efficient and reliable.
[0112] Cleaning and feature extraction of collected data helps improve data quality and ensure the effectiveness of the training set. This process enables the model to more accurately identify and utilize the characteristic information of the vehicle, thereby improving the prediction effect. The automated measurement and data processing process reduces the workload of the inspection personnel, saves inspection time and labor costs, and improves overall work efficiency. By judging the error between the predicted value and the actual value, if it exceeds the set error threshold, the system will automatically retrain the model. This adaptive adjustment mechanism ensures that the model always maintains efficient prediction capabilities under changing environmental conditions.
[0113] The present invention effectively solves common technical problems in dynamic vehicle weighing: real-time data collection and feature extraction improve the timeliness and effectiveness of data; the establishment of a decision tree model enhances the ability to process complex data; real-time prediction reduces manual intervention and improves work efficiency; and the error judgment and model optimization mechanism ensure the long-term stability and accuracy of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0114] Figure 1 It is a schematic diagram of the overall method flow of the present invention. DETAILED DESCRIPTION
[0115] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0116] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0117] Example:
[0118] See also Figure 1 , the present invention provides a technical solution:
[0119] A dynamic vehicle scale measurement method with automatic parameter fitting, the specific steps include:
[0120] Step 1: Record the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in real time, collect the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in the historical time period, including the corresponding vehicle actual weight data, and clean and extract the collected weight and speed data to obtain the vehicle feature data;
[0121] The time period for collecting historical vehicle data is set to T. During this time period T, each vehicle passing through the weighing platform is continuously monitored. For each vehicle, the moment it passes through the weighing platform, i.e., the timestamp t ij Record the following information: The instantaneous weight W of the i-th vehicle when it passes the weighing platform for the jth time ij , the instantaneous speed V of the i-th vehicle when it passes the weighing platform for the jth time ij , the vehicle type classification C obtained by the vehicle type recognition system for the i-th vehicle at the jth time ij , organize these data into a data set D:
[0122] D={(t ij , W ij , V ij , C ij )|i=1,2,...,n,j=1,2,...,n i}
[0123] Where n represents the total number of vehicles passing through the weighing platform within the time period T, n irepresents the number of times the weight, speed and vehicle model data of the i-th vehicle are monitored in the time period T;
[0124] t ij It indicates the timestamp when the i-th vehicle passes the weighing platform for the jth time, and records the specific time information of each weighing; W ij , V ij reflects the weight and speed of the vehicle at a specific time and condition. These dependent variables can indicate the state of the vehicle. For example, a larger W ij It may indicate that the vehicle is heavily loaded or that the vehicle classification has changed; timestamp t ij and vehicle type category C ij Impact ij , V ij For example, the speed of a vehicle of the same model at a certain moment may be proportional to its weight, and a higher speed may lead to a change in weight data;
[0125] Get the minimum and maximum weight data of each vehicle passing through the weighing platform within the T time period:
[0126] W min =min(W ij |i=1,2,...,n,j=1,2,...,n i )
[0127] W max =max(W ij |i=1,2,...,n,j=1,2,...,n i )
[0128] Among them, for each car, if W ij <W min or W ij >W max , it is considered an outlier and is removed, which may indicate data collection errors or vehicle overload. The formula is used to find the minimum and maximum weights of all vehicles in the time period T to help determine the normal range;
[0129] Get the minimum and maximum speed data of each vehicle passing the weighing platform during the T time period:
[0130] V min =min(V ij |i=1,2,...,n,j=1,2,...,n i )
[0131] V max =max(V ij |i=1,2,...,n,j=1,2,...,n i )
[0132] Among them, for each car, if V ij <V min or V ij >V max , it is considered as an outlier and removed. The formula is used to determine the speed range of all vehicles to ensure the validity and reliability of the data. If the speed exceeds the range, it may indicate that the vehicle's driving state is abnormal;
[0133] The actual weight, speed and vehicle type data of the vehicle to be monitored when passing through the weighing platform are recorded at each time stamp t db Record data to form a data set:
[0134] D r ={(t db , W r,db , V r,db , C r,db )|d=1,2,...,m,b=1,2,...,m d}
[0135] Where m represents the total number of vehicles recorded during the monitoring period, m d represents the number of times the weight, speed and vehicle model data of the dth vehicle were monitored in the time period T;
[0136] The instantaneous weight W when passing through the weighing platform during the T time period ij , calculate the instantaneous weight W of all vehicles ij The mean value W m :
[0137]
[0138] in, It represents the total number of monitoring times of the effective weight of all vehicles after removing outliers, W m It reflects the overall weight level of the vehicle. The larger the mean value, the heavier the vehicle weight is overall, which may be related to the vehicle type and load conditions.
[0139] Calculate the deviation of each vehicle's weight from the mean and select the weight with the largest deviation from the mean. For the i-th vehicle, calculate the deviation of the weight from the mean at each weighing:
[0140] D ij =|W ij -W m |
[0141] Among them, D ijIt represents the deviation of the i-th vehicle at the j-th weighing, reflecting the difference between each weighing and the overall mean. The larger the deviation, the greater the difference between the weight weighed at that time and the overall weight level, which may indicate special circumstances (such as overloading, data anomaly, etc.);
[0142] For the i-th vehicle, find the number of weighings j that leads to the maximum deviation:
[0143] j i = argmax(D ij )for all i
[0144] Among them, j i Indicates the index of the weighing that causes the maximum deviation in the i-th vehicle. The weight value pointed to by this index will be used as a dynamic parameter to reflect the extreme situation and facilitate subsequent analysis and decision-making;
[0145] By finding the index j i , select the corresponding weight as the dynamic parameter W s :
[0146]
[0147] Among them, W s represents the weight with the largest deviation from the mean;
[0148] At the selected vehicle index j i When the weighing that leads to the largest deviation is pointed to, the speed of that weighing is extracted:
[0149]
[0150] Among them, V s represents the weighing speed that leads to the largest weight deviation in the i-th vehicle;
[0151] Extract the vehicle model classification at the same weighing:
[0152]
[0153] Among them, C s It represents the classification of the vehicle type that caused the largest weight deviation in the i-th vehicle;
[0154] The extracted dynamic weight, speed and vehicle type are classified and organized into a feature dataset:
[0155] F={(W s , V s , C s )}
[0156] Among them, F represents the feature data set, which contains the selected weight, speed and vehicle type classification data. The feature data set F organizes the vehicle information with the largest deviation from the mean to facilitate subsequent model training and predictive analysis.
[0157] Step 2: Build a decision tree model, use the historical vehicle feature data to be monitored, including weight, speed and vehicle model data, as a training set, and use the corresponding vehicle actual weight data as a label, and input it into the decision tree model for training;
[0158] The feature data set F is standardized to eliminate the influence caused by different dimensions between features:
[0159]
[0160] Among them, F′ is the standardized feature data, and F is the original feature data;
[0161] The original feature data F may affect the effect of model training due to different dimensions. The standardized feature data F′ reflects the performance of different features at the same scale after processing. After standardization, the mean of all features is 0 and the standard deviation is 1, so that features of different dimensions can be compared under the same standard.
[0162] μ is the mean of the feature data, which is used to measure the center position of the data. Its calculation formula is:
[0163]
[0164] Among them, u represents the number of samples of feature data, F a represents the eigenvalue of the ath sample;
[0165] σ is the standard deviation of the characteristic data, and its calculation formula is:
[0166]
[0167] Among them, (F a -μ) 2 represents the square of the difference between each sample and the mean;
[0168] When a decision tree processes categorical data, One-Hot Encoding can convert categorical variables into numerical form. Suppose the vehicle type classification C s There are three categories: SUV, sedan, and truck. Through one-hot encoding, each category is represented by a separate binary column (0 or 1). These categories are represented as:
[0169]
[0170] Each row corresponds to a category, so that the model can treat each category as a different input feature, and use binary form to represent each category as an independent feature. This processing method prevents the model from generating sequential relationships between categories during calculation.
[0171] Original model classification C s ,Through one-hot encoding, the model can better handle categorical variables and avoid information loss caused by improper category encoding;
[0172] Use the vehicle weight recorded in the historical data as the label vector Y:
[0173] Y={W o |o=1,2,...,O}
[0174] Where O represents the number of vehicles, W o is the actual weight of the oth vehicle; label Y represents the actual weight of the historical vehicle, each W o It is the actual weight of the corresponding vehicle and is used as the training target of the model;
[0175] At each node, select a feature f to divide the data, use MSE (mean square error) as the division standard, evaluate the division effect of each node, and for the current node R, calculate its mean square error:
[0176]
[0177] Among them, M R Indicates the number of samples of the current node R, W o represents the true weight of the oth sample, Represents the predicted weight of the current node R, which is the mean of all samples in the node:
[0178]
[0179] MSE reflects the prediction accuracy of the current node. The smaller the value, the better the prediction effect of the model at this node. The number of samples M R The difference between the actual and predicted weights will affect the size of the MSE. As the number of samples increases, the MSE tends to decrease if the prediction is accurate.
[0180] The decision tree starts from the root node, recursively selects the best feature f and divides the data into the left subset D according to the partitioning criteria. left and right subset D right , with p representing the sample index being examined:
[0181] D left ={(F′ p , Y p )|F′ p,f≤threshold}
[0182] The left subset contains all samples whose feature f is less than or equal to a certain threshold, F′ p represents the standardized feature vector of the pth sample, Y p represents the target variable of the pth sample;
[0183] D right ={(F′ p , Y p )|F′ p,f >threshold}
[0184] Among them, the right subset contains all samples whose feature f values are greater than a certain threshold threshold;
[0185] The sample distribution of the left and right subsets can affect the prediction effect of subsequent nodes, the eigenvalue F′ p,f The larger the threshold, the more likely it is to affect the distribution of samples and thus the learning of the model.
[0186] Calculate the left subset D after feature f is divided left and right subset D right The mean square error is used to evaluate the effectiveness of the current feature division:
[0187]
[0188]
[0189] Among them, M left and M right is the number of samples in the left subset and the right subset, and is the prediction weight of the left subset and the right subset; MSE left and MSE right Reflects the prediction accuracy of samples in the two subsets. The smaller the value, the more effective the division is.
[0190] Comprehensively consider the mean square error before and after the division, calculate the overall mean square error of the current division, combine the mean square errors of the left and right subsets, and evaluate the overall effect of the division:
[0191]
[0192] Among them, MSE split is the overall mean square error of the current partition, which represents the weighted average of the prediction errors after the data is partitioned by a certain feature and threshold. The smaller the value, the better the partition effect. R is the total number of samples in the current node, that is, the sum of the number of samples in the left child node and the right child node, that is, MR =M left +M right , MSE left and MSE right are the mean square errors of the left and right child nodes, respectively, indicating the mean square error between the sample prediction value and the true value in the left and right child nodes;
[0193] Select the best split feature and threshold, and select the feature with the minimum MSE for all features and their possible split points. split The characteristic f * and threshold * , select the features and their partitioning thresholds that can most effectively reduce the mean square error:
[0194]
[0195] Among them, f * The best feature to be selected is the feature that can most effectively reduce the mean square error. * is the optimal threshold selected to divide the feature f * The value of makes the overall mean square error minimum after division. Argmin represents the operation of finding the features and thresholds that minimize the mean square error.
[0196] Create child nodes according to feature f * and threshold * The samples that meet the conditions will be divided into the left child node R left , samples that do not meet the conditions will be divided into the right child node R right , for each child node R left and R right , repeat the above operation until the stop condition is reached;
[0197] During the training process, decide when to stop splitting: when the number of samples of the current leaf node is less than the preset minimum number of samples, stop splitting; when the depth of the tree reaches the preset maximum depth, stop splitting; when the mean square error of the node is small enough, stop splitting;
[0198] When the stopping condition is reached, the current node becomes a leaf node and stores the predicted value of the node, which is usually the mean of the node samples:
[0199]
[0200] in, is the predicted value of the current leaf node, indicating the predicted result of the sample corresponding to the leaf node, M leaf is the number of samples of the current leaf node, W o is the true target value of the oth sample in the current leaf node.
[0201] Step 3: Input the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform recorded in real time into the trained decision tree model to predict the actual vehicle weight data;
[0202] Based on the real-time monitored data, construct feature data:
[0203] F r ={(W r,s , V r,s , C r,s )}
[0204] Input the standardized feature data into the trained decision tree model X to predict the actual weight of the vehicle:
[0205]
[0206] in, represents the actual weight of the model's prediction of the real-time input feature, F′ r It is standardized feature data. At each node of the tree, the specific value of the feature value determines which leaf node the sample enters, thus affecting the final prediction value.
[0207] It represents the model's estimate of the actual weight of the vehicle based on the input feature data. It is the output of the decision tree and represents the system's response to external input. It reflects the weight that a vehicle can reach under certain conditions (such as speed, classification). The larger the predicted value, the heavier the model believes the vehicle is.
[0208] If the input features (e.g., speed, vehicle type) change, the model will adjust its predictions based on these changes. For example, if the vehicle’s speed is high and it is a heavy SUV, the model may predict a higher weight; if the independent variables (e.g., V r,s ) increases, and model C r,s ) also supports higher weights, and the model may output higher prediction values On the contrary, if the independent variable (such as W r,s ) decreases, which may lead to the prediction results reduction, especially when it reflects the adaptability of the model to certain specific conditions;
[0209] The calculation process of the decision tree model X is:
[0210]
[0211] Among them, each Corresponds to the leaf node Leaf kThe predicted value represents the average actual weight of the samples in the leaf node, X(F′ r ) represents the processing and prediction process of the decision tree model on the standardized feature data, X(F′ r ) represents the process of processing and predicting standardized feature data by the decision tree model.
[0212] Step 4: Based on the error between the actual vehicle weight data predicted by the model and the actual weight data of the vehicle weighing, determine whether the error exceeds the set error threshold and retrain the model;
[0213] Calculate the actual vehicle weight data predicted by the above method and the actual weighed vehicle weight W actual The error E between:
[0214]
[0215] Define an acceptable error threshold ∈ and check whether the calculated error E exceeds the set error threshold ∈: If E>∈, it means that the prediction is beyond the acceptable range, and the model needs to be retrained;
[0216] ∈ is the set acceptable error threshold, which indicates the maximum prediction error that the model can tolerate in practical applications, and determines whether the prediction accuracy of the model is within an acceptable range;
[0217] E represents the accuracy of model prediction. The smaller the value, the closer the model prediction result is to the actual value. On the contrary, the prediction is biased. The input feature data F′ of the model r and model parameters. Changes in these independent variables may affect the model's predictions and thus affect the error E;
[0218] Retraining the model requires collecting new sample data since the model prediction, including new feature data and corresponding actual weight data, and merging the newly collected data with the original training data to form a larger training data set D train,up :
[0219] D train,up =D train ∪{(F new , W actual )}
[0220] D train,up is the updated training data set, including the original training data D train and the newly collected sample data (F new , W actual ), expand the training set by incorporating new sample data to improve the learning effect of the model;
[0221] Using the updated dataset D train,upRetrain the decision tree model X, following the previous training process: feature selection, partitioning, and generating leaf nodes:
[0222] X(F′ r )=Train(D train,up )
[0223] During the training process, the decision tree model is retrained with the updated training data set to rebuild the model structure. The performance of the retrained model X will depend on the quality and characteristics of the training data.
[0224] After retraining, use an independent validation set to evaluate the model effect and calculate the prediction error of the new model:
[0225]
[0226] Is the updated model X up For the input feature data F′ r The prediction results;
[0227] Compute the absolute error of the new model:
[0228]
[0229] The absolute error E generated by the new model's prediction of the actual weight up , used to measure the prediction accuracy of the updated model on the new data set. The above steps ensure that the error of the new model is lower than the error of the old model and is within an acceptable range;
[0230] E up It reflects the prediction accuracy of the new model. The smaller the value, the better the model performance. The actual weighing data W actual The prediction results of the new model will be directly affected by the change of independent variables, thus affecting E up .
[0231] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0232] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0233] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0234] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A dynamic vehicle scale measurement method with automatic parameter fitting, characterized in that: The specific steps include: Step 1: Record the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in real time, collect the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform in the historical time period, including the corresponding vehicle actual weight data, and clean and extract the collected weight and speed data to obtain the vehicle feature data; Step 2: Build a decision tree model, use the historical vehicle feature data to be monitored, including weight, speed and vehicle model data, as a training set, and use the corresponding vehicle actual weight data as a label, and input it into the decision tree model for training; Step 3: Input the weight, speed and vehicle model data of the monitored vehicle passing through the weighing platform recorded in real time into the trained decision tree model to predict the actual vehicle weight data; Step 4: Based on the error between the actual vehicle weight data predicted by the model and the actual weight data of the vehicle weighing, determine whether the error exceeds the set error threshold and retrain the model.
2. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 1, characterized in that: The time period for collecting historical vehicle data is set to T. During this time period T, each vehicle passing through the weighing platform is continuously monitored. For each vehicle, the moment it passes through the weighing platform, i.e., the timestamp t ij Record the following information: The instantaneous weight W of the i-th vehicle when it passes the weighing platform for the jth time ij , the instantaneous speed V of the i-th vehicle when it passes the weighing platform for the jth time ij , the vehicle type classification C obtained by the vehicle type recognition system for the i-th vehicle at the jth time ij , organize these data into a data set D: D={(t ij ,W ij ,V ij ,C ij )|i=1,2,…,n,j=1,2,…,n i } Where n represents the total number of vehicles passing through the weighing platform within the time period T, n i represents the number of times the weight, speed and vehicle model data of the i-th vehicle are monitored in the time period T; Get the minimum and maximum weight data of each vehicle passing through the weighing platform within the T time period: IN min =min(W ij |i=1,2,…,n,j=1,2,…,n i ) W max =max(W ij |i=1,2,…,n,j=1,2,…,n i ) Among them, for each car, if W ij <W min or W ij >W max , it is considered as an outlier and removed; Get the minimum and maximum speed data of each vehicle passing the weighing platform during the T time period: V min =min(V ij |i=1,2,…,n,j=1,2,…,n i ) V max =max(V ij |i=1,2,…,n,j=1,2,…,n i ) Among them, for each car, if V ij <V min or V ij >V max , it is considered as an outlier and removed; The actual weight, speed and vehicle type data of the vehicle to be monitored when passing through the weighing platform are recorded at each time stamp t db Record data to form a data set: D r ={(t db ,W r,db ,V r,db ,C r,db )|d=1,2,…,m,b=1,2,…,m d } Where m represents the total number of vehicles recorded during the monitoring period, m d Indicates the number of times the weight, speed and vehicle model data of the dth vehicle are monitored within the time period T.
3. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 2, characterized in that: The instantaneous weight W when passing through the weighing platform during the T time period ij , calculate the instantaneous weight W of all vehicles ij The mean value W m : in, It indicates the total number of monitoring times of the effective weight of all vehicles after removing outliers; Calculate the deviation of each vehicle's weight from the mean and select the weight with the largest deviation from the mean. For the i-th vehicle, calculate the deviation of the weight from the mean at each weighing: D ij =|W ij -W m | Among them, D ij represents the deviation of the i-th vehicle at the j-th weighing; For the i-th vehicle, find the number of weighings j that leads to the maximum deviation: j i =argmax(D ij ) for all i Among them, j i represents the index of the weighing that causes the maximum deviation in the i-th vehicle; By finding the index j i , select the corresponding weight as the dynamic parameter W s : Among them, W s represents the weight with the largest deviation from the mean; At the selected vehicle index j i When the weighing that leads to the largest deviation is pointed to, the speed of that weighing is extracted: Among them, V s represents the weighing speed that leads to the largest weight deviation in the i-th vehicle; Extract the vehicle model classification at the same weighing: Among them, C s It represents the classification of the vehicle type that caused the largest weight deviation in the i-th vehicle; The extracted dynamic weight, speed and vehicle type are classified and organized into a feature dataset: F={(W s ,V s ,C s )} Among them, F represents the feature dataset, which contains the selected weight, speed and vehicle type classification data.
4. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 3, characterized in that: The feature data set F is standardized to eliminate the influence caused by different dimensions between features: Among them, F′ is the standardized feature data, and F is the original feature data; μ is the mean of the feature data, and its calculation formula is: Among them, u represents the number of samples of feature data, F a represents the eigenvalue of the ath sample; σ is the standard deviation of the characteristic data, and its calculation formula is: Among them, (F a -μ) 2 represents the square of the difference between each sample and the mean; When a decision tree processes categorical data, One-Hot Encoding can convert categorical variables into numerical form. Suppose the vehicle type classification C s There are three categories: SUV, sedan, and truck. Through one-hot encoding, each category is represented by a separate binary column (0 or 1). These categories are represented as: Each row corresponds to a category, allowing the model to treat each category as a different input feature; Use the vehicle weight recorded in the historical data as the label vector Y: Y={W o |o=1,2,…,O} Where O represents the number of vehicles, W o is the actual weight of the oth vehicle; At each node, select a feature f to divide the data, use MSE (mean square error) as the division standard, evaluate the division effect of each node, and for the current node R, calculate its mean square error: Among them, M R Indicates the number of samples of the current node R, W o represents the true weight of the oth sample, Represents the predicted weight of the current node R, which is the mean of all samples in the node: The decision tree starts from the root node, recursively selects the best feature f and divides the data into the left subset D according to the partitioning criteria. left and right subset D right , with p representing the sample index being examined: D left ={(F′ p ,Y p )|F′ p,f ≤threshold} The left subset contains all samples whose feature f is less than or equal to a certain threshold, F′ p represents the standardized feature vector of the pth sample, Y p represents the target variable of the pth sample; D right ={(F′ p ,Y p )|F′ p,f >threshold} Among them, the right subset contains all samples whose feature f values are greater than a certain threshold threshold.
5. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 4, characterized in that: Calculate the left subset D after feature f is divided left and right subset D right The mean square error is: Among them, M left and M right is the number of samples in the left and right subsets, and are the predicted weights of the left and right subsets; Considering the mean square error before and after the division, the overall mean square error is calculated: Among them, MSE split is the overall mean square error of the current partition, which represents the weighted average of the prediction errors after the data is partitioned by a certain feature and threshold. R is the total number of samples in the current node, that is, the sum of the number of samples in the left child node and the right child node, that is, M R =M left +M right , MSE left and MSE right are the mean square errors of the left and right child nodes, respectively, indicating the mean square error between the sample prediction value and the true value in the left and right child nodes; Select the best split feature and threshold, and select the feature with the minimum MSE for all features and their possible split points. split The characteristic f * and threshold * : Among them, f * The best feature to be selected is the feature that can most effectively reduce the mean square error. * is the optimal threshold selected to divide the feature f * The value of makes the overall mean square error minimum after division. Argmin represents the operation of finding the features and thresholds that minimize the mean square error.
6. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 5, characterized in that: Create child nodes according to feature f * and threshold * The samples that meet the conditions will be divided into the left child node R left , samples that do not meet the conditions will be divided into the right child node R right , for each child node R left and R right , repeat the above operation until the stop condition is reached; During the training process, decide when to stop splitting: when the number of samples of the current leaf node is less than the preset minimum number of samples, stop splitting; when the depth of the tree reaches the preset maximum depth, stop splitting; when the mean square error of the node is small enough, stop splitting; When the stopping condition is reached, the current node becomes a leaf node and stores the predicted value of the node, which is usually the mean of the node samples: in, is the predicted value of the current leaf node, indicating the predicted result of the sample corresponding to the leaf node, M leaf is the number of samples of the current leaf node, W o is the true target value of the oth sample in the current leaf node; Based on the real-time monitored data, construct feature data: F r ={(W r,s ,V r,s ,C r,s )} Input the standardized feature data into the trained decision tree model X to predict the actual weight of the vehicle: in, represents the actual weight of the model's prediction of the real-time input feature, F′ r It is the standardized feature data; The calculation process of the decision tree model X is: Among them, each Corresponds to the leaf node Leaf k The predicted value of .
7. A dynamic vehicle scale measurement method with automatic parameter fitting according to claim 6, characterized in that: Calculate the actual vehicle weight data predicted by the above method and the actual weighed vehicle weight W actual The error E between: Define an acceptable error threshold ∈ and check whether the calculated error E exceeds the set error threshold ∈: if E>∈, the model needs to be retrained; Retraining the model requires collecting new sample data since the model prediction, including new feature data and corresponding actual weight data, and merging the newly collected data with the original training data to form a larger training data set D train,up : D train,up =D train ∪{(F new ,W actual )} Using the updated dataset D train,up Retrain the decision tree model X, following the previous training process: feature selection, partitioning, and generating leaf nodes: X(F′ r )=Train(D train,up ) During the training process, the decision tree model is retrained with the updated training data set to rebuild the model structure; After retraining, use an independent validation set to evaluate the model effect and calculate the prediction error of the new model: Compute the absolute error of the new model: The above steps ensure that the error of the new model is lower than the error of the old model and is within an acceptable range.
Citation Information
Patent Citations
Weighing error automatic compensation method of vehicle scale
CN102506983A
Dynamic truck scale metering method capable of automatically fitting parameters
CN111625752A
Vehicle-mounted weight prediction method and system, electronic equipment and medium
CN112819031A
Vehicle total weight prediction method and device, electronic equipment and storage medium
CN116912974A
Cited By
Mathematical model-based multi-sensor dynamic calibration method and system
CN120176818A
Multi-sensor dynamic calibration method and system based on mathematical model
CN120176818B