Truck scale weighing error compensation method and device, computer equipment and storage medium
By improving the particle swarm optimization algorithm and maximum correlation entropy criterion optimization width learning model, the problem of error in the automobile scale weighing result is solved, automatic, fast and accurate weighing error compensation is achieved, and weighing accuracy and robustness are improved.
Patent Information
- Application Number
- CN202510164512.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-07-11
AI Technical Summary
The accuracy of the car weighing results is affected by a variety of factors, resulting in errors in the weighing results.
Through the improved particle swarm optimization algorithm, the number of feature windows, number of feature nodes and kernel width of the width learning model are optimized, combined with the maximum correlation entropy criterion and L2 regularization term, a vehicle scale error compensation model is built to automatically, quickly and accurately complete weighing error compensation.
It improves the accuracy of weighing results, avoids manual repeated parameter adjustment process, saves time, and enhances the robustness and accuracy of the model in complex environments.
Smart Images

Figure CN120296410A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of weighing, and in particular to a method, device, computer device and storage medium for compensating weighing errors of a weighbridge. Background Art
[0002] Large weighing scales, such as analog electronic weighbridges, have gradually replaced traditional mechanical weighbridges, providing fast and accurate weighing results in fields such as industrial and mining enterprises, logistics warehousing, etc., significantly improving operational efficiency. Currently, an analog electronic weighbridge includes a load-bearing force transmission mechanism, analog weighing sensors, and a weighing display instrument. The analog electronic weighbridge accumulates the output signals of the analog weighing sensors and centralizes the output signals of each weighing sensor in an analog junction box to generate a voltage signal proportional to the mass of the measured load. The single-chip microcomputer processes this voltage signal, including signal conditioning and A / D (analog-to-digital) conversion, thereby obtaining the weighing result and sending it to the weighing display instrument to complete the weighing of the load.
[0003] However, during the use of a weighbridge, the accuracy of the weighbridge weighing result is affected by factors such as the sensitivity of the weighing sensors, the layout method, whether the weighbridge is level, and whether the internal load-bearing force transmission mechanism of the weighbridge undergoes mechanical deformation. Currently, it is difficult to completely eliminate the above factors affecting the weighing result, resulting in errors in the weighbridge weighing result.
[0004] Therefore, in the related art, there is a problem that the accuracy of the weighbridge weighing result is affected by various factors, resulting in errors in the weighing result. Summary of the Invention
[0005] In view of this, the present invention provides a method, device, computer device and storage medium for compensating weighbridge weighing errors to solve the problem that the accuracy of the weighbridge weighing result is affected by various factors, resulting in errors in the weighing result.
[0006] In a first aspect, the present invention provides a method for compensating weighbridge weighing errors, the method comprising:
[0007] Obtaining training sample data, first configuration parameters of a model parameter optimization algorithm, second configuration parameters of a weight matrix optimization algorithm, and initial model parameters;
[0008] Creating an initial error compensation model according to the initial model parameters;
[0009] Determining target model parameters of the initial error compensation model and target parameters of the weight matrix optimization algorithm according to the first configuration parameters, the model parameter optimization algorithm, and the training sample data;
[0010] Determine the target weight matrix of the initial error compensation model according to the target parameters, the second configuration parameters, the weight matrix optimization algorithm, and the training sample data;
[0011] Set the target model parameters as the model parameters of the initial error compensation model, and set the target weight matrix as the weight matrix of the initial error compensation model to obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to the input sensor signal.
[0012] The vehicle scale weighing error compensation method provided in this embodiment optimizes the model parameters of the initial error compensation model through a model parameter optimization algorithm, and optimizes the weight matrix of the initial error compensation model through a weight matrix optimization algorithm. It avoids the process of manual parameter adjustment repeatedly, saves a lot of time, uses the optimized parameters to train the width learning model, and improves the robustness and accuracy of model prediction. The target weighing result is obtained according to the input sensor signal by using the target error compensation model, and the vehicle scale weighing error compensation is completed automatically, quickly and accurately, improving the accuracy of the weighing result. It solves the problem that the accuracy of the vehicle scale weighing result is affected by various factors, resulting in errors in the weighing result.
[0013] In a second aspect, the present invention provides a vehicle scale weighing error compensation device, including:
[0014] An acquisition module, configured to acquire training sample data, the first configuration parameters of the model parameter optimization algorithm, the second configuration parameters of the weight matrix optimization algorithm, and the initial model parameters;
[0015] A model creation module, configured to create an initial error compensation model according to the initial model parameters;
[0016] A parameter determination module, configured to determine the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm according to the first configuration parameters, the model parameter optimization algorithm, and the training sample data;
[0017] A weight matrix determination module, configured to determine the target weight matrix of the initial error compensation model according to the target parameters, the second configuration parameters, the weight matrix optimization algorithm, and the training sample data;
[0018] A model setting module, configured to set the target model parameters as the model parameters of the initial error compensation model, and set the target weight matrix as the weight matrix of the initial error compensation model to obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to the input sensor signal.
[0019] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the weighbridge weighing error compensation method according to the first aspect or any corresponding embodiment thereof.
[0020] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored. The computer instructions are used to cause a computer to execute the weighbridge weighing error compensation method according to the first aspect or any corresponding embodiment thereof.
[0021] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, which are used to cause a computer to execute the weighbridge weighing error compensation method according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related art, the following will briefly introduce the drawings required to be used in the description of the specific embodiments or the related art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0023] Figure 1 is a flowchart of the weighbridge weighing error compensation method according to an embodiment of the present invention;
[0024] Figure 2 is a flowchart of the model parameter optimization algorithm according to an embodiment of the present invention;
[0025] Figure 3 is a structural diagram of the initial error compensation model according to an embodiment of the present invention;
[0026] Figure 4 is a structural diagram of a weighbridge according to an embodiment of the present invention;
[0027] Figure 5 is a flowchart of another weighbridge weighing error compensation method according to an embodiment of the present invention;
[0028] Figure 6 is a block diagram of the structure of the weighbridge weighing error compensation device according to an embodiment of the present invention;
[0029] Figure 7 is a schematic diagram of the hardware structure of the computer device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0031] Large weighing scales such as truck scales include multiple load cells. The output signals of the load cells are accumulated to generate a voltage signal proportional to the mass of the measured load. After the single-chip microcomputer processes the voltage signal through signal conditioning and analog-to-digital conversion, the weighing result is obtained. The weighing result is sent to the display and communication device to complete the weighing of the load. Due to non-linear factors such as the stiffness and strength of the load-bearing device, internal stresses generated during the processing and installation of the truck scale, mechanical deformation, and dimensional errors in the truck scale, as well as the dispersion of the sensitivity of the load cells, the weighing result of the truck scale will have errors. In addition, the load cells of the truck scale also have linearity errors, which will also affect the weighing result. Moreover, the debugging of the truck scale is extremely cumbersome, and it is difficult to eliminate the above errors.
[0032] Based on the above, the embodiments of the present invention provide a method for compensating the weighing error of a truck scale. By improving the particle swarm optimization algorithm, the number of feature windows, the number of feature nodes, the number of enhancement nodes, and the kernel width of the width learning model are optimized, avoiding the manual repeated parameter adjustment process and saving a lot of time. The optimized parameters are used to train the width learning model, improving the robustness and accuracy of the model prediction. Based on the width learning model improved by particle swarm optimization to perform truck scale error compensation, in order to cope with the complex environment of truck scale applications, the model constructs constraints based on prior knowledge and introduces the maximum correlation entropy criterion to improve the robustness of the model. And an L2 regularization term is added to the part of optimizing the weights by the maximum correlation entropy criterion to prevent overfitting of the model, better adapting to the interference brought by different environments. To achieve the technical effect of automatically, quickly, and accurately completing the weighing error compensation of the truck scale and improving the accuracy of the weighing result.
[0033] According to the embodiments of the present invention, an embodiment of a method for compensating the weighing error of a truck scale is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0034] In this embodiment, a method for compensating the weighing error of a truck scale is provided. Figure 1 It is a flowchart of the method for compensating the weighing error of a truck scale according to the embodiments of the present invention, as Figure 1As shown, the process includes the following steps:
[0035] Step S101, obtain training sample data, the first configuration parameters of the model parameter optimization algorithm, the second configuration parameters of the weight matrix optimization algorithm, and the initial model parameters.
[0036] Specifically, obtain training sample data. The training samples are, for example, the actual weight of a certain weight and the sensor signals collected after placing the heavy object at different positions on the weighbridge scale body. There are multiple numbers of training samples, such as 120, 130, or other quantities that meet the training requirements. The model parameter optimization algorithms are, for example, the Particle Swarm Optimization (PSO) algorithm, the Genetic Algorithm (GA), the Differential Evolution (DE), etc. The weight matrix optimization algorithms are, for example, the algorithm for training the weight matrix based on the Maximum Correntropy Criterion (MCC), the Bayesian Optimization algorithm, the gradient penalty algorithm, etc. The initial model parameters include: the number of feature windows of the initial error compensation model, the number of feature nodes in each feature window, the number of enhancement nodes, the activation function, and other data. The first configuration parameters of the model parameter optimization algorithm are, for example, the maximum number of iterations, the data adjustment interval, the number of parameters to be optimized, etc. The second configuration parameters of the weight matrix optimization algorithm are, for example, the maximum number of iterations, the constraint conditions, etc.
[0037] Step S102, create an initial error compensation model according to the initial model parameters.
[0038] Specifically, an initial error compensation model can be created based on the Broad Learning System (BLS). The broad learning network constructs the network by stacking multiple layers of feature nodes and enhancement nodes, thus avoiding the common gradient explosion and complex training process in deep learning. Therefore, the initial error compensation model consists of an input layer, a hidden layer, and an output layer, where the hidden layer is a single-layer structure and consists of a feature mapping layer and an enhancement node layer.
[0039] According to the initial model parameters, determine the number of feature windows of the initial error compensation model, the number of feature nodes in each feature window, the number of enhancement nodes, the activation function, and other data, and create the input layer, hidden layer, and output layer of the initial error compensation model according to the above data, completing the creation of the input layer, hidden layer, and output layer.
[0040] Step S103: Determine the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm according to the first configuration parameters, the model parameter optimization algorithm, and the training sample data.
[0041] Specifically, adjust the model parameter optimization algorithm according to data such as the maximum number of iterations, data adjustment range, and the number of parameters to be optimized in the first configuration parameters. Take the parameters to be optimized of the initial error compensation model and the kernel width of the weight matrix optimization algorithm as a data combination. Use the adjusted model parameter optimization algorithm to adjust the initial error compensation model according to different data combinations, and determine the data combination that can make the performance of the adjusted initial error compensation model optimal, that is, the target data combination, according to the training samples. And take the model parameters in the target data combination as the target model parameters, and take the kernel width in the target data combination as the target parameters.
[0042] Step S104: Determine the target weight matrix of the initial error compensation model according to the target parameters, the second configuration parameters, the weight matrix optimization algorithm, and the training sample data.
[0043] Specifically, the weight matrix optimization algorithm is, for example, an algorithm for training the weight matrix based on the maximum correlation entropy criterion. The maximum correlation entropy criterion estimates model parameters by maximizing the local similarity between data. By using an appropriate Gaussian kernel, the correlation entropy can capture the second-order and higher-order statistical features of the error. When the second-order statistical features of the error can dominate, this makes the maximum correlation entropy criterion a suitable choice in a noisy environment.
[0044] Adjust the weight matrix optimization algorithm according to data such as the maximum number of iterations and constraint conditions in the second configuration parameters. Use the adjusted weight matrix optimization algorithm to sequentially adjust the weight matrix of the initial error compensation model. Determine the weight matrix that can make the performance of the adjusted initial error compensation model optimal, that is, the target weight matrix, according to the training samples.
[0045] Step S105: Set the target model parameters as the model parameters of the initial error compensation model, and set the target weight matrix as the weight matrix of the initial error compensation model to obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to the input sensor signal.
[0046] Specifically, set the target model parameters as the model parameters of the initial error compensation model, and set the target weight matrix as the weight matrix of the initial error compensation model to obtain a target error compensation model. When subsequently weighing heavy objects using a weighbridge, collect the sensor signals output by all weighing sensors in the weighbridge at this time, input the above sensor signals into the target error compensation model, and the target error compensation model will output the compensated target weighing result.
[0047] The vehicle scale weighing error compensation method provided in this embodiment optimizes the model parameters of the initial error compensation model through a model parameter optimization algorithm, and optimizes the weight matrix of the initial error compensation model through a weight matrix optimization algorithm. It avoids the process of manual parameter adjustment repeatedly, saves a lot of time, and uses the optimized parameters to train the width learning model, improving the robustness and accuracy of model prediction. Using the target error compensation model to obtain the target weighing result according to the input sensor signal, it automatically, quickly and accurately completes the vehicle scale weighing error compensation, improving the accuracy of the weighing result. It solves the problem that the accuracy of the vehicle scale weighing result is affected by various factors, resulting in errors in the weighing result.
[0048] In some alternative embodiments, according to the first configuration parameter, the model parameter optimization algorithm, and the training sample data, determining the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm includes:
[0049] Obtain the optimization dimension of the model parameter optimization algorithm and the target number of parameter combinations in the first configuration parameter; according to the optimization dimension, create the target number of parameter combinations, where the parameter combination includes the number of feature windows, the number of feature nodes, the number of enhancement nodes of the initial error compensation model, and the kernel width of the weight matrix optimization algorithm; obtain the speed space, the search space, and the first iteration number threshold of the model parameter optimization algorithm in the first configuration parameter; initialize the first iteration number, and initialize the target number of parameter combinations in the speed space and the search space; according to the initial error compensation model, the training sample data, the fitness function, and the parameter combination, obtain the fitness value corresponding to the parameter combination; take the parameter combination with the largest fitness value among the target number of parameter combinations as the target parameter combination; increase the first iteration number by a preset step length, and take the target parameter combination as the historical parameter combination; update the target number of parameter combinations in the speed space and the search space; according to the initial error compensation model, the training sample data, the fitness function, and the parameter combination, obtain the fitness value corresponding to the parameter combination; take the parameter combination with the largest fitness value among the target number of parameter combinations as the candidate parameter combination; judge whether the fitness value of the candidate parameter combination is greater than the fitness value of the historical parameter combination, if it is greater, then take the candidate parameter combination as the target parameter combination; start to execute the subsequent steps from increasing the first iteration number by the first preset step length and taking the target parameter combination as the historical parameter combination, until the first iteration number reaches the first iteration number threshold, then end, and obtain the target model parameters from the number of feature windows, the number of feature nodes, and the number of enhancement nodes in the target parameter combination, and take the kernel width in the target parameter combination as the target parameter.
[0050] Specifically, this embodiment uses the particle swarm optimization algorithm as the model parameter optimization algorithm.
[0051] Initialize the parameters of the model parameter optimization algorithm using the first configuration parameter. Obtain the optimization dimension and the target number of parameter combinations of the model parameter optimization algorithm from the first configuration parameter. For example, the parameter combination is the particle in the particle swarm optimization algorithm. Obtain the population size of the particle swarm algorithm, that is, the target number of particles is 10, and the optimization dimension of the particle swarm optimization algorithm is 4. The values of the optimization dimension and the target number are set according to actual requirements.
[0052] The optimization dimension represents the number of parameters to be optimized in the particle. In this embodiment, the particle swarm optimization algorithm selects the number of feature windows, the number of feature nodes in each feature window, the number of enhancement nodes, and the kernel width of the weight matrix optimization algorithm to form a parameter combination, that is, a particle. Therefore, according to the optimization dimension, create the target number of parameter combinations.
[0053] Obtain the velocity space, search space, and the first iteration number threshold of the model parameter optimization algorithm from the first configuration parameter. For example, the lower boundary [10, 1, 500, 0.1] and the upper boundary [200, 20, 5000, 10] are set in the first configuration parameter. Determine the velocity space and search space according to the lower boundary and the upper boundary. Take the maximum iteration number of the particle swarm algorithm in the first configuration parameter as 200 as the first iteration number threshold.
[0054] Set the first iteration number to a preset value, for example: 0, 1…, indicating that the current process is the first iteration of the model parameters of the initial error compensation model. Randomly initialize the velocity and position in the velocity space and search space, and initialize the parameter values in each parameter combination. The above process is as Figure 2 shown: initialization, set the size of the particle swarm, the initial position, and the initial velocity.
[0055] Obtain the fitness function. For example, the function that calculates the loss value of the output result of the initial error compensation model can be used as the fitness function. Set the initial error compensation model according to the parameters in the particle, input the training sample data into the set initial error compensation model, and calculate the fitness value of each particle according to the model output result and the defined fitness function for the evaluation of the particle.
[0056] Compare the fitness values of each particle in this optimization search, determine the global optimal solution of this time, and take the parameter combination with the largest fitness among the target number of parameter combinations as the target parameter combination, and the target parameter combination is p i ; Compare the global optimal value p i of this time and the historical global optimal value p g . If p i is better than p g , then update the position of p g to the position of p i . The above process is as Figure 2As shown, calculate the objective function of each particle, find the current individual extreme value of each particle, and find the current global optimal solution of the entire particle swarm.
[0057] Increase the first iteration number by a preset step size. For example, if the preset step size is 1 and the first iteration number is 1, increasing the first iteration number by the preset step size makes it 2, indicating that the next is the second round of iterating on the model parameters of the initial error compensation model.
[0058] Take the target parameter combination as the historical parameter combination for the purpose of differentiating it from the target parameter combination of the next round of iteration. Update the target number of parameter combinations in the velocity space and the search space according to formula (1) and formula (2).
[0059] v t+1 i = wv t i + c1 × rand() × (p i - x t i ) + c2 × rand() × (p g - x t i ) (1)
[0060] x t+1 i = x t i + v t+1 i (2)
[0061] Where x t i is the position of the i-th particle at time t; v t i is the velocity of the i-th particle at time t; p i is the historical optimal position of the i-th particle; p g is the best position searched so far in the entire particle swarm; the acceleration constants c1 and c2 are two non-negative values. These two constants endow the particle with the ability of self-regulation and learning from excellent individuals in the group, so as to approach its own historical optimal point and the global optimal point within the group or the domain; rand() is a random function taking values in the range [0, 1]; w is the inertia weight. The inertia weight is the influence of the velocity of the previous generation of particles on the velocity of the current generation of particles, or the degree of trust of the particle in its current own motion state. The particle performs inertial motion based on its own velocity.
[0062] Set the initial error compensation model according to the parameters in the particle, input the training sample data into the set initial error compensation model, and calculate the fitness value of each particle according to the model output result and the defined fitness function. Take the parameter combination with the largest fitness value among the target number of parameter combinations as the candidate parameter combination, and judge whether the fitness value of the candidate parameter combination is greater than the fitness value of the historical parameter combination. If it is greater, then take the candidate parameter combination as the target parameter combination.
[0063] When the number of iterations reaches the maximum number or the fitness value meets the requirements, then exit the loop; otherwise, perform a new round of iteration on the model parameters of the initial error compensation model. Start from increasing the first iteration number by the first preset step size and taking the target parameter combination as the historical parameter combination to execute the subsequent steps until the first iteration number reaches the first iteration number threshold, then end. Obtain the target model parameters from the number of feature windows, the number of feature nodes, and the number of enhancement nodes in the target parameter combination, and take the kernel width in the target parameter combination as the target parameter.
[0064] The above process is as Figure 2 shown. Update the velocity and position of each particle, and judge whether the termination condition is reached. If not, then re-execute "calculate the objective function of each particle, find the current individual extreme value of each particle, and find the current global optimal solution of the entire particle swarm". If so, then output the optimal solution.
[0065] In this embodiment, the model parameters of the initial error compensation model are optimized by the model parameter optimization algorithm to obtain the target model parameters, which avoids the process of manual repeated parameter tuning, saves a lot of time, and uses the optimized parameters to train the width learning model, improving the robustness and accuracy of model prediction.
[0066] In some optional embodiments, the fitness function includes a first preset formula and a second preset formula. According to the initial error compensation model, the training sample data, the fitness function, and the parameter combination, obtaining the fitness value corresponding to the parameter combination includes:
[0067] Group the training sample data according to the clustering algorithm to obtain the first preset number of sample combinations; adjust the initial error compensation model according to the parameter combination to obtain the adjusted error compensation model; input the training sample data in each sample combination into the adjusted error compensation model to obtain the output result corresponding to the training sample data; obtain the first error corresponding to the training sample data according to the output result and the reference result corresponding to the training sample data; obtain the second error of the parameter combination corresponding to the adjusted error compensation model according to the output result and the first preset formula; the first preset formula satisfies: where N is the number of training sample data in the sample combination, y i is the output result of the i-th training sample data in the sample combination, yi+1 is the output result of the (i + 1)-th training sample data in the sample combination, where i is the first index of the data, and L smooth is the second error; obtain the smoothness weight hyperparameter in the first configuration parameter; according to the first error, the second error, and the second preset formula, obtain the fitness value of the parameter combination corresponding to the adjusted error compensation model; the second preset formula satisfies: L total = L regression + ρL smooth , where L regression is the first error, ρ is the smoothness weight hyperparameter, and L total is the fitness value.
[0068] Specifically, complex environmental factors can cause dynamic errors in the weighbridge weighing system, making short-term measurements unstable. However, the actual weighing results should have smoothness. Therefore, this application uses this smoothness as a dynamic constraint to construct a smoothness constraint to suppress high-frequency noise in the model.
[0069] The clustering algorithm is, for example, the K-Means clustering algorithm. Group the training sample data according to the clustering algorithm to obtain the first preset number of sample combinations. The first preset number represents a plurality, and no specific number limit is set here.
[0070] Adjust the initial error compensation model according to the model parameters in each parameter combination in turn to obtain the adjusted error compensation model. For example, modify the number of feature nodes of the initial error compensation model, modify the number of enhancement nodes, modify the number of feature windows, etc.
[0071] Input the training sample data in each sample combination into the adjusted error compensation model respectively to obtain the output results corresponding to the training sample data in the same sample combination.
[0072] According to the output result and the reference result corresponding to the training sample data, obtain the first error L regression of the training sample data. For example, L regression is the fitting error of the adjusted error compensation model. According to the output result and the reference result, calculate the RMSE (Root Mean Square Error), and use the calculation result as the first error L regression .
[0073] Substitute the output result corresponding to the training sample data in the same sample combination into the first preset formula. The first preset formula is, for example, formula (3), and calculate to obtain the second error L smooth of the parameter combination corresponding to the adjusted error compensation model.
[0074]
[0075] Obtain the smoothness weight hyperparameter in the first configuration parameter. For example, set the smoothness weight hyperparameter ρ to 0.01 in the first configuration parameter. The smoothness weight hyperparameter can also be 0.02, 0.03, or other values that meet the actual requirements.
[0076] Substitute the above first error L regression , second error L smooth , and smoothness weight hyperparameter ρ into the second preset formula. The second preset formula is, for example, formula (4), and calculate the fitness value of the parameter combination corresponding to the adjusted error compensation model.
[0077] L total = L regression + ρL smooth (4)
[0078] In this embodiment, a smoothness constraint is constructed by using the first error, the first preset formula, the second error, and the second preset formula. The high-frequency noise in the model is suppressed through the smoothness constraint, and the anti-interference ability of the model and the generalization of the model are improved.
[0079] In some alternative embodiments, determine the target weight matrix of the initial error compensation model according to the target parameter, the second configuration parameter, the weight matrix optimization algorithm, and the training sample data, including:
[0080] Obtain the second iteration number threshold of the weight matrix optimization algorithm, the preset threshold of the weight matrix, and the regularization hyperparameter in the second configuration parameter; determine the target kernel width of the preset kernel function according to the target parameter, and obtain the similarity between the training sample data according to the preset kernel function, the target kernel width, and the training sample data; determine the objective function including the weight matrix according to the similarity and the output expression of the initial error compensation model; take the derivative of the weight matrix in the objective function to obtain the gradient expression; generate a regularization term according to the regularization hyperparameter; add the regularization term to the gradient expression to obtain the weight matrix iteration formula; obtain the initial weight matrix of the initial error compensation model according to the weight matrix iteration formula; initialize the second iteration number, and use the initial weight matrix as the reference weight matrix; update the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula to obtain the updated weight matrix; in the case where the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, use the updated weight matrix as the target weight matrix; in the case where the difference between the updated weight matrix and the reference weight matrix is greater than or equal to the preset threshold, increase the second iteration number by the second preset step size, use the updated weight matrix as the reference weight matrix, and start to execute the subsequent steps from updating the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula until the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, or the second iteration number is equal to the second iteration number threshold, then end, and use the updated weight matrix as the target weight matrix.
[0081] Specifically, in this embodiment, the algorithm for training the weight matrix based on the maximum correlation entropy criterion is used as the weight matrix optimization algorithm. The maximum correlation entropy criterion estimates the model parameters by maximizing the local similarity between data. By using an appropriate Gaussian kernel, the correlation entropy can capture the second-order and higher-order statistical features of the error, and the second-order statistical features of the error can dominate, which makes the maximum correlation entropy criterion a suitable choice in a noisy environment.
[0082] Obtain the second iteration number threshold of the weight matrix optimization algorithm, the preset threshold of the weight matrix, and the regularization hyperparameter in the second configuration parameter. For example, set the maximum number of iterations for updating the weight of the maximum correlation entropy criterion in the second configuration parameter to 10 as the second iteration number threshold, set the error tolerance ε as the preset threshold, obtain the regularization hyperparameter such as 0.1, 0.2 or other values that meet the actual requirements from the second configuration parameter. Additionally, the weight update tolerance value of 1×10 can also be obtained from the second configuration parameter -3 。
[0083] Determine the target kernel width of the preset kernel function according to the target parameter. The target kernel width is used to control the weight of the high-order statistics. The preset kernel function is, for example, formula (5). According to the preset kernel function, the target kernel width, and the training sample data, obtain the similarity between the training sample data, as shown in formula (5), and the similarity is k σ (x,y).
[0084]
[0085] Optimization objective of the maximum correlation entropy criterion: For the width learning model, the objective based on the maximum correlation entropy criterion is to minimize the high-order statistics of the output error. Therefore, according to the similarity and the output expression of the initial error compensation model, determine the objective function including the weight matrix, for example, formula (6).
[0086]
[0087] where, u i represents the i-th row in the state matrix, y i represents the corresponding target output, λ is the L2 regularization hyperparameter, and W is the weight matrix to be optimized.
[0088] Take the derivative of the weight matrix in the objective function to obtain the gradient expression, for example, formula (7).
[0089]
[0090] where, Λ w is the diagonal element of the weight matrix, and each element is calculated by the Gaussian kernel function from the error of the corresponding sample.
[0091] To prevent the model from overfitting, generate a regularization term according to the regularization hyperparameter, for example, the regularization term is the L2 regularization term λI, where λ is the L2 regularization hyperparameter.
[0092] Add the regularization term to the gradient expression to obtain the weight matrix iteration formula, for example, formula (8).
[0093] W = (U T Λ w U + γI + λI) -1 U T Λ w Y (8)
[0094] Obtain the initial weight matrix of the initial error compensation model according to the weight matrix iteration formula.
[0095] Set the second iteration number to a preset value, e.g., 0, 1, …, indicating that the current process is the first iteration of the weight matrix optimization algorithm for the weight matrix of the initial error compensation model. Take the initial weight matrix as the reference weight matrix for distinction from the weight matrix of the next round.
[0096] Update the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula to obtain the updated weight matrix, as shown in formula (9).
[0097] W t+1 =(U T Λ w (U t )+γI+λI) -1 U T Λ w (U t )Y (9)
[0098] In this embodiment, the iteration stop condition of the weight matrix optimization algorithm is: ||W t+1 -W t || 2 < ε, where ε is the error tolerance, i.e., the preset threshold.
[0099] Therefore, determine whether the updated weight matrix and the reference weight matrix satisfy the iteration stop condition, that is, determine whether the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold. If it is less, take the updated weight matrix as the target weight matrix, indicating that the updated value of the weight matrix converges to a certain range, stop the iteration, and finally output the optimal weight matrix, i.e., the target weight matrix, which can be used for the error compensation model of width learning.
[0100] In the case where the difference between the updated weight matrix and the reference weight matrix is greater than or equal to the preset threshold, it means that the iteration stop condition is not satisfied, and it is necessary to use the weight matrix optimization algorithm to iterate the weight matrix again. Increase the second iteration number by the second preset step size, take the updated weight matrix as the reference weight matrix, and start to execute the subsequent steps from updating the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula until the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, or the second iteration number is equal to the second iteration number threshold, then end, and take the updated weight matrix as the target weight matrix.
[0101] In this embodiment, the weight matrix of the initial error compensation model is optimized by using the weight matrix optimization algorithm to obtain the target weight matrix. Through this target weight matrix, the numerical stability of the initial error compensation model can be improved, the performance of the model in a complex noise environment can be improved, and the time for training the model can be saved.
[0102] In some alternative embodiments, an initial error compensation model is created according to initial model parameters, including:
[0103] Obtain the initial feature window number, initial feature node number, initial enhancement node number, and activation function of the initial error compensation model from the initial model parameters; create a feature mapping layer according to the initial feature window number and initial feature node number, and create an enhancement node layer according to the initial enhancement node number and activation function; obtain the hidden layer of the initial error compensation model according to the feature mapping layer and the enhancement node layer; create the input layer and output layer of the initial error compensation model, and obtain the initial error compensation model according to the input layer, output layer, and hidden layer.
[0104] Specifically, in this embodiment, an initial error compensation model is created based on a wide learning network. The wide learning network constructs the network by stacking multiple layers of feature nodes and enhancement nodes, thus avoiding the common gradient explosion and complex training process in deep learning. Obtain the initial feature window number, initial feature node number, initial enhancement node number, and activation function of the initial error compensation model from the initial model parameters.
[0105] Create a feature mapping layer that contains the number of feature windows that meets the initial feature window number, and create the number of feature nodes that meets the initial feature node number in the feature windows. Create the number of enhancement nodes that meets the initial enhancement node number, and complete the creation of the enhancement node layer according to the enhancement node activation function. Combine the feature mapping layer and the enhancement node layer to obtain the hidden layer of the initial error compensation model.
[0106] Create the input layer and output layer of the initial error compensation model, and obtain the initial error compensation model according to the input layer, output layer, and hidden layer, as Figure 3 shown.
[0107] It should be noted that the output calculation of the p-th group of feature nodes is shown in formula (10).
[0108]
[0109] Where is the transformation function of the feature mapping, W ep and β ep are the feature mapping weight matrix and bias matrix, and the feature mapping weight matrix and bias matrix are randomly generated during the feature mapping process.
[0110] Combine the outputs of n groups of feature mapping nodes into Z n =[Z1, Z2,..., Z n , input Z n into the enhancement node layer, and the output calculation formula of the q-th group of enhancement nodes is shown in formula (11).
[0111] H q = ξ(Z n W hq + β hq ), q = 1, ..., m (11)
[0112] where ξ is the activation function, and different non-linear activation functions can be selected. W hq and β hq are the enhanced mapping weight matrix and the bias matrix, respectively. During the enhanced mapping process, the enhanced mapping weight matrix and the bias matrix are randomly generated.
[0113] Similarly, the outputs of m groups of enhanced nodes are combined into H m = [H1, H2, ..., H m , and Z n is combined with H m to form A, as shown in Equation (12).
[0114] A = [Z n | H m (12)
[0115] Similarly, the outputs of m groups of enhanced nodes are combined into H m = [H1, H2, ..., H m , and Z n is combined with H m to form A, as shown in Equation (12).
[0116] The output of the width learning model can be expressed as Y, as shown in Equation (13).
[0117] Y = [Z n | H m W = AW (13)
[0118] where W is the connection weight matrix of the output layer.
[0119] Therefore, finding the regularized least squares solution of W becomes the core problem of the model, and its objective function is shown in Equation (14).
[0120]
[0121] where λ is the L2 regularization hyperparameter.
[0122] The connection weight matrix of the output layer is obtained by the ridge regression algorithm, as shown in Equation (15).
[0123] W = (λI + A T A) -1 A T Y (15)
[0124] According to formula (12) and formula (15), the pseudo-inverse of A can be derived as shown in formula (16).
[0125]
[0126] In some alternative embodiments, obtaining training sample data includes:
[0127] Obtaining initial sample data; generating a kernel matrix according to the initial sample data, a preset kernel width, and a Gaussian kernel function; performing centering processing on the kernel matrix using a preset matrix to obtain an intermediate matrix; obtaining diagonal elements of the intermediate matrix, and performing normalization processing on the intermediate matrix using the diagonal elements to obtain a target matrix, where the target matrix contains training sample data.
[0128] Specifically, the structure of the weighbridge is as Figure 4 shown. Among them, the weighbridge has 8 load cells (I = 8), including: load cell 1 to load cell N, with a range of 40 tons, the maximum capacity of each load cell is 20 tons, the number of division is 4000, and the verification scale interval and the actual scale interval are both 10 kg. The signal acquisition circuit of the weighbridge is as Figure 4 shown, including conditioning circuits 1 to N, analog-to-digital conversion circuits 1 to N, a microprocessor, a power supply module, an external dedicated computer, a keyboard, a display, etc. Each load cell is sequentially connected to the conditioning circuit, the analog-to-digital conversion circuit, and then to the microprocessor. The microprocessor configures the power supply module, the keyboard, and the display. During training, the microprocessor is connected to the external dedicated computer. Among them, the microprocessor uses a high-performance single-chip microcomputer, Figure 4 shown as the main structure of the weighbridge weighing part applicable to the present invention. Standard weights of different weights, such as 0.5 tons, 1 ton, 6 tons, and 10 tons. Using standard weights of 0.5 tons, 1 ton, 6 tons, and 10 tons of different weights, place them at different positions on the weighbridge scale body respectively. In the case of randomly placing weights of different weights at different positions on the weighbridge scale body, the system obtains the load cell signals of the weighbridge through the load cells, the conditioning circuits, the analog-to-digital conversion circuits, and the microprocessor. Perform preprocessing on the load cell signals, including mean filtering and normalization processing, to obtain processed data, and combine the corresponding weights to obtain multiple groups of samples. All or part of these samples are used as initial sample data, or part of them are used as initial sample data, and the other part is used as test sample data. The microprocessor transmits these samples to the external dedicated computer through the serial communication interface to prepare for the offline training of the neural network.
[0129] In machine learning, normalization is to make the features of data have the same scale, facilitating the convergence and performance improvement of model algorithms. However, for data with high-dimensional or non-linear distributions, directly normalizing in the original space may not be able to capture the complex relationships of the data. Kernel normalization, by using kernel functions, maps the points in the original space to a high-dimensional feature space, which is also called the Hilbert space. Normalizing the above data in the high-dimensional feature space not only eliminates the scale differences between the features of the data, but also improves the robustness of the subsequent model to enhance the model's ability to handle non-linear features. Therefore, in this embodiment, kernel normalization is performed on the initial sample data. First, assume that the initial sample data is X = {x1, x2,..., x n}, where x n ∈R d represents the nth initial sample data, n is the number of initial sample data, and d is the number of features in the initial sample data.
[0130] A preset kernel width, for example: 0.1, 0.2, or other values that meet the actual requirements. According to the initial sample data, the preset kernel width, and the Gaussian kernel function, a kernel matrix is generated, as shown in formula (17). The Gaussian kernel function is used to construct the kernel matrix K∈R n *n , where each element K ab is defined as shown in formula (17):
[0131]
[0132] where, x a represents the a-th initial sample data, and x b represents the b-th initial sample data. ||x a - x b || 2 represents the square of the Euclidean distance between x a and x b . e represents the preset kernel width.
[0133] The preset matrix is an n*n matrix, and all its elements are Use E to represent the preset matrix. To eliminate the influence of the offset on normalization, the kernel matrix needs to be centered. The preset matrix is used to center the kernel matrix to obtain the intermediate matrix K c , as shown in formula (18). After centering, the kernel matrix satisfies the zero-mean condition, that is, the intermediate matrix satisfies the zero-mean condition.
[0134] K c = K - EK - KE - EKE (18)
[0135] Obtain the diagonal elements diag(K c), e.g., diag(K c ) = [K c11 , K c22 , …, K cnn . The intermediate matrix is normalized using the diagonal elements to obtain the target matrix K c ', as shown in formula (19).
[0136]
[0137] Each element in the target matrix K c ' is a set of training sample data.
[0138] In this embodiment, the kernel normalization method is used to normalize the initial sample data, so that the features of the initial sample data have the same scale, which is convenient for the model algorithm to converge and improve performance. Moreover, the kernel normalization method normalizes the data in the high-dimensional feature space, which not only eliminates the scale difference between the features of the data, but also improves the robustness of the subsequent model to enhance the model's ability to process non-linear features.
[0139] In some alternative embodiments, after obtaining the target error compensation model, the method further includes:
[0140] Obtain test sample data; determine the evaluation index function of the target error compensation model, where the evaluation index function includes a third preset formula and / or a fourth preset formula; input the load cell signal in the test sample data into the target error compensation model to obtain a predicted weighing result; according to the predicted weighing result, the reference weighing result of the test sample data, and the evaluation index function, obtain the evaluation index of the target error compensation model, where the evaluation index includes a first error and / or a second error; the third preset formula satisfies: where n is the number of test sample data, is the predicted weighing result, x j is the reference weighing result, j is the second index of the data, and R1 is the first error; the fourth preset formula satisfies: where R2 is the second error.
[0141] Specifically, in this embodiment, in order to verify the performance of PSO-CBLS (Particle Swarm Optimization-Convolutional Broad Learning System, a hybrid model of particle swarm optimization and convolutional broad learning system), it is compared with PSO-BLS (Particle Swarm Optimization-Broad Learning System, a hybrid model combining particle swarm optimization and broad learning system), BLS (Broad Learning System), BPNN (Back Propagation Neural Network), and ELM (Extreme Learning Machine) models. Among them, the number of feature windows of the BLS model is 100, the number of feature nodes in each feature window is 10, and the number of enhancement nodes is 2000. The balance parameter and the L2 regularization hyperparameter are the same as the balance parameter and the regularization parameter of PSO-CBLS; the parameters of PSO-BLS are the same as those of PSO-CBLS; the learning rate of the BPNN model is 0.005, the number of training times is 10000, the error termination threshold is 0.65×10-3, the number of input layer nodes is 8, the number of output layer nodes is 1, and the number of hidden layer nodes is 16; the learning rate of the ELM model is 0.005, the maximum number of iterations is 10000, the error termination threshold is 0.65×10-3, the number of input layer nodes is 8, the number of output layer nodes is 1, and the number of hidden layer nodes is 16. Each model runs independently 50 times, and the average value of the evaluation index is taken as the final result. The best parameters of the final PSO-CBLS model are the best number of feature windows is 144, the best number of feature nodes is 5, the best number of enhancement nodes is 2773, and the best kernel width is 6.4760; the best parameters of the PSO-BLS model are the best number of feature windows is 127, the best number of feature nodes is 6, and the best number of enhancement nodes is 2900. Table 1 shows the performance comparison of each model. In order to verify the noise processing ability of adding smoothness constraints and the improved maximum correlation entropy criterion, high-frequency noise is added to the training data in this paper. The high-frequency noise consists of Gaussian noise with a standard deviation of 0.1 and a mean of 0 and sine wave noise with a frequency of 100. The PSO-CBLS, PSO-BLS, BLS, BPNN, and ELM models are used to experiment with the data with outliers. The best parameters of the final PSO-CBLS model are the best number of feature windows is 7, the best number of feature nodes is 11, the best number of enhancement nodes is 1606, and the best kernel width is 6.3128; the best parameters of the PSO-BLS model are the best number of feature windows is 17, the best number of feature nodes is 159, and the best number of enhancement nodes is 3690.Table 2 shows the comparison of the performance indicators of each model after adding noise to the data. Based on the above content, the test sample data is obtained.
[0142] Determine the evaluation index function of the target error compensation model. The model evaluation index in this embodiment uses RMSE and MAPE (Mean Absolute Percentage Error) as the evaluation indicators. Among them, RMSE can be calculated by the third preset formula, and MAPE can be calculated by the fourth preset formula. The third preset formula is, for example, formula (20), and the fourth preset formula is, for example, formula (21).
[0143]
[0144] Among them, n is the number of test sample data, is the predicted weighing result, x j is the reference weighing result, j is the second index of the data, and R1 is the first error, and the first error is RMSE.
[0145]
[0146] Among them, R2 is the second error, and the second error is MAPE.
[0147] Input the weighing sensor signal in the test sample data into the target error compensation model to obtain the predicted weighing result. According to the predicted weighing result, the reference weighing result of the test sample data, and the evaluation index function, the evaluation index of the target error compensation model is obtained, where the evaluation index includes the first error and / or the second error. The evaluation index is shown in Table 1 and Table 2.
[0148] Table 1 Performance indicators of each model
[0149] RMSE MAPE(%) Uncompensated 0.2376 3.7708 PSO-CBLS 0.0031 0.1839 PSO-BLS 0.0087 0.2971 BLS 0.0124 0.3245 BPNN 0.6635 33.3852 ELM 0.4995 15.2249
[0150] Table 2 Performance indicators of each model after adding noise to the data
[0151] RMSE MAPE(%) PSO-CBLS 0.1259 0.1786 PSO-BLS 0.4808 31.0765 BLS 0.7321 24.5442 BPNN 0.6093 33.5805 ELM 0.5381 23.0421
[0152] Table 1 shows the comparison of the performance indicators of each model. According to Table 1 and Table 2, it can be determined that PSO-CBLS, PSO-BLS, and BLS have better compensation effects, PSO-CBLS has better accuracy, and their performances are all better than other models. In the face of a noise environment, Table 2 shows the performance indicators of each model when there is noise in the data. It can be seen that the performance of PSO-CBLS is better than other models, indicating that the addition of smoothness constraints and the improved maximum correlation entropy criterion can improve the anti-interference ability of the model and make the model better applied to the actual working scenario.
[0153] In addition, to verify the improvement of kernel normalization on the performance of the PSO-CBLS model, this paper conducts a comparative experiment on the original data and the data with added noise by using kernel normalization and the commonly used Min-Max (minimum-maximum) normalization respectively. Finally, the optimal parameters of the model using kernel normalization for the original data are as follows: the optimal number of feature windows is 18, the optimal number of feature nodes is 67, the optimal number of enhanced nodes is 4967, and the optimal kernel width is 8.2472. The optimal parameters of the model using kernel normalization for the data with added noise are: the optimal number of feature windows is 9, the optimal number of feature nodes is 83, the optimal number of enhanced nodes is 3860, and the optimal kernel width is 6.3886. The optimal parameters of the model using Min-Max normalization for the original data are: the optimal number of feature windows is 144, the optimal number of feature nodes is 5, the optimal number of enhanced nodes is 2773, and the optimal kernel width is 6.4760. The optimal number of feature windows of the model using kernel normalization for the data with added noise is 9, the optimal number of feature nodes is 83, the optimal number of enhanced nodes is 3860, and the optimal kernel width is 6.3886. The optimal parameters of the model using Min-Max normalization for the data with added noise are: the optimal number of feature windows is 7, the optimal number of feature nodes is 11, the optimal number of enhanced nodes is 1606, and the optimal kernel width is 6.3128. Table 3 shows the comparison of the model performance of the PSO-CBLS model using kernel normalization and Min-Max normalization. According to Table 3, it can be seen that under the original data and the data with added noise, the use of kernel normalization can improve the model performance to a certain extent, and the improvement is more obvious for the data with noise, indicating that the kernel normalization model can improve the anti-interference ability of the model.
[0154] Table 3 Comparison of the model performance of the PSO-CBLS model using kernel normalization and Min-Max normalization
[0155]
[0156] In this embodiment, an evaluation index function of the target error compensation model is determined, and the evaluation index of the target error compensation model is determined by using the test sample data and the evaluation index function. The accuracy of the target error compensation model is determined through the evaluation index, and moreover, high-frequency noise can be added to the test sample data to test the anti-interference ability and generalization of the target error compensation model.
[0157] In some alternative embodiments, another method for compensating the weighing error of the weighbridge is provided. This method can also solve the problem that the accuracy of the weighbridge weighing result is affected by various factors, resulting in errors in the weighing result, such as Figure 5 As shown, the process includes the following steps:
[0158] Construct a width learning network and set parameters; establish the mapping relationship between the number of particles and the feature window, feature nodes, and enhancement nodes of the width learning system; initialize the particle swarm; update the output weights according to the maximum correlation entropy criterion; calculate the particle fitness; search for the individual optimal value and the population optimal value; iteratively update the particle velocity and position according to the fitness to find the global optimal particle; determine whether the iteration times are reached. If not, re-execute "search for the individual optimal value and the population optimal value". If so, execute setting the optimal solution as the number of the feature window, feature nodes, and enhancement nodes of the width learning system; perform secondary training and learning on the width learning network.
[0159] In this embodiment, the number of feature windows of the width learning model, the number of feature nodes, the number of enhancement nodes, and the kernel width of the width learning model are optimized by an improved particle swarm optimization algorithm, which avoids the manual repeated parameter adjustment process, saves a lot of time, and trains the width learning model with the optimized parameters, improving the robustness and accuracy of the model prediction.
[0160] In this embodiment, a weighbridge weighing error compensation device is further provided. This device is used to implement the above embodiments and preferred embodiments, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0161] This embodiment provides a weighbridge weighing error compensation device, as Figure 6 shown, including:
[0162] An acquisition module 601, configured to acquire training sample data, the first configuration parameter of the model parameter optimization algorithm, the second configuration parameter of the weight matrix optimization algorithm, and the initial model parameters; a model creation module 602, configured to create an initial error compensation model according to the initial model parameters; a parameter determination module 603, configured to determine the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm according to the first configuration parameter, the model parameter optimization algorithm, and the training sample data; a weight matrix determination module 604, configured to determine the target weight matrix of the initial error compensation model according to the target parameters, the second configuration parameter, the weight matrix optimization algorithm, and the training sample data; a model setting module 605, configured to set the target model parameters as the model parameters of the initial error compensation model, set the target weight matrix as the weight matrix of the initial error compensation model, and obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to the input sensor signal.
[0163] In some alternative embodiments, the parameter determination module 603 includes: a first acquisition unit configured to acquire, from the first configuration parameters, the optimization dimension of the model parameter optimization algorithm and the target number of parameter combinations; a first creation unit configured to create, according to the optimization dimension, the target number of parameter combinations, where the parameter combinations include the number of feature windows, the number of feature nodes, the number of enhancement nodes of the initial error compensation model, and the kernel width of the weight matrix optimization algorithm; a second acquisition unit configured to acquire, from the first configuration parameters, the velocity space, the search space, and the first iteration number threshold of the model parameter optimization algorithm; a first initialization unit configured to initialize the first iteration number and initialize the target number of parameter combinations in the velocity space and the search space; a first calculation unit configured to obtain, according to the initial error compensation model, the training sample data, the fitness function, and the parameter combinations, the fitness values corresponding to the parameter combinations; a first setting unit configured to use the parameter combination with the maximum fitness value among the target number of parameter combinations as the target parameter combination; a second setting unit configured to increase the first iteration number by a preset step size and use the target parameter combination as the historical parameter combination; a first update unit configured to update the target number of parameter combinations in the velocity space and the search space; a second calculation unit configured to obtain, according to the initial error compensation model, the training sample data, the fitness function, and the parameter combinations, the fitness values corresponding to the parameter combinations; a third setting unit configured to use the parameter combination with the maximum fitness value among the target number of parameter combinations as the candidate parameter combination; a judgment unit configured to judge whether the fitness value of the candidate parameter combination is greater than the fitness value of the historical parameter combination, and if it is greater, use the candidate parameter combination as the target parameter combination; a first loop unit configured to start from increasing the first iteration number by a first preset step size and using the target parameter combination as the historical parameter combination to execute subsequent steps until the first iteration number reaches the first iteration number threshold, then end, and obtain the target model parameters from the number of feature windows, the number of feature nodes, and the number of enhancement nodes in the target parameter combination, and use the kernel width in the target parameter combination as the target parameter.
[0164] In some alternative embodiments, the first calculation unit includes: a grouping sub-module configured to group the training sample data according to the clustering algorithm to obtain a first preset number of sample combinations; an adjustment sub-module configured to adjust the initial error compensation model according to the parameter combinations to obtain an adjusted error compensation model; an input sub-module configured to input the training sample data in each sample combination into the adjusted error compensation model to obtain the output results corresponding to the training sample data; a first comparison sub-module configured to obtain, according to the output results and the reference results corresponding to the training sample data, the first error corresponding to the training sample data; a second comparison sub-module configured to obtain, according to the output results and a first preset formula, the second error of the parameter combination corresponding to the adjusted error compensation model. The first preset formula satisfies: where N is the number of training sample data in the sample combination, yi is the output result of the i-th training sample data in the sample combination, y i+1 is the output result of the (i + 1)-th training sample data in the sample combination, where i is the first index of the data, and L smooth is the second error; an acquisition sub-module, configured to acquire a smoothness weight hyperparameter in the first configuration parameter; a calculation sub-module, configured to obtain an adaptation value of a parameter combination corresponding to an adjusted error compensation model according to the first error, the second error, and a second preset formula; the second preset formula satisfies: L total = L regression + ρL smooth where L regression is the first error, ρ is the smoothness weight hyperparameter, and L total is the adaptation value.
[0165] In some optional embodiments, the weight matrix determination module 604 includes: a third acquisition unit, configured to acquire a second iteration number threshold of a weight matrix optimization algorithm, a preset threshold of the weight matrix, and a regularization hyperparameter in the second configuration parameter; a first obtaining unit, configured to determine a target kernel width of a preset kernel function according to target parameters, and obtain the similarity between training sample data according to the preset kernel function, the target kernel width, and the training sample data; a determination unit, configured to determine an objective function including a weight matrix according to the similarity and an output expression of an initial error compensation model; a third calculation unit, configured to take the derivative of the weight matrix in the objective function to obtain a gradient expression; a first generation unit, configured to generate a regularization term according to the regularization hyperparameter; a second obtaining unit, configured to add the regularization term to the gradient expression to obtain a weight matrix iteration formula; a third obtaining unit, configured to obtain an initial weight matrix of the initial error compensation model according to the weight matrix iteration formula; a second initialization unit, configured to initialize the second iteration number and use the initial weight matrix as a reference weight matrix; a second update unit, configured to update the reference weight matrix according to a preset iteration algorithm and the weight matrix iteration formula to obtain an updated weight matrix; a fourth setting unit, configured to use the updated weight matrix as the target weight matrix when the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold; a second loop unit, configured to, when the difference between the updated weight matrix and the reference weight matrix is greater than or equal to the preset threshold, increase the second iteration number by a second preset step size, use the updated weight matrix as the reference weight matrix, and start to execute subsequent steps from updating the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula until the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, or the second iteration number is equal to the second iteration number threshold, then end, and use the updated weight matrix as the target weight matrix.
[0166] In some alternative embodiments, the model creation module 602 includes: a fourth acquisition unit, configured to acquire, from the initial model parameters, the number of initial feature windows, the number of initial feature nodes, the number of initial enhancement nodes, and the activation function of the initial error compensation model; a second creation unit, configured to create a feature mapping layer according to the number of initial feature windows and the number of initial feature nodes, and create an enhancement node layer according to the number of initial enhancement nodes and the activation function; a fourth obtaining unit, configured to obtain the hidden layer of the initial error compensation model according to the feature mapping layer and the enhancement node layer; and a third creation unit, configured to create the input layer and the output layer of the initial error compensation model, and obtain the initial error compensation model according to the input layer, the output layer, and the hidden layer.
[0167] In some alternative embodiments, the acquisition module 601 includes: a fifth acquisition unit, configured to acquire initial sample data; a second generation unit, configured to generate a kernel matrix according to the initial sample data, a preset kernel width, and a Gaussian kernel function; a first processing unit, configured to perform centering processing on the kernel matrix by using a preset matrix to obtain an intermediate matrix; and a second processing unit, configured to acquire the diagonal elements of the intermediate matrix, and perform normalization processing on the intermediate matrix by using the diagonal elements to obtain a target matrix, where the target matrix includes training sample data.
[0168] In some alternative embodiments, the apparatus further includes: a data acquisition module, configured to acquire test sample data; a determination module, configured to determine an evaluation index function of the target error compensation model, where the evaluation index function includes a third preset formula and / or a fourth preset formula; an input module, configured to input the load cell signal in the test sample data into the target error compensation model to obtain a predicted weighing result; and a calculation module, configured to obtain an evaluation index of the target error compensation model according to the predicted weighing result, the reference weighing result of the test sample data, and the evaluation index function, where the evaluation index includes a first error and / or a second error; the third preset formula satisfies: where n is the number of test sample data, is the predicted weighing result, x j is the reference weighing result, j is the second index of the data, and R1 is the first error; the fourth preset formula satisfies: where R2 is the second error.
[0169] The further function descriptions of the foregoing various modules and units are the same as those in the corresponding foregoing embodiments, and are not described herein again.
[0170] The vehicle scale weighing error compensation device in this embodiment is presented in the form of functional units. Here, the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0171] An embodiment of the present invention further provides a computer device having the above Figure 6 shown vehicle scale weighing error compensation device.
[0172] Please refer to Figure 7 , Figure 7 which is a schematic structural diagram of a computer device provided by an optional embodiment of the present invention. As shown in Figure 7 , the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component communicates with each other using different buses and can be installed on a common motherboard or installed in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (such as a server array, a set of blade servers, or a multi-processor system). Figure 7 In
[0173] Processor 10 can be a central processor, a network processor, or a combination thereof. Among them, processor 10 can further include an integrated circuit, a programmable logic device, or a combination thereof. The above programmable logic device can be a complex programmable logic device, a field programmable gate array, a general array logic, or any combination thereof.
[0174] Among them, the memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0175] The memory 20 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 may optionally include a memory remotely provided with respect to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0176] The memory 20 may include volatile memory, for example, random access memory; the memory may also include non-volatile memory, for example, flash memory, a hard disk, or a solid-state drive; the memory 20 may further include a combination of the above types of memory.
[0177] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0178] Embodiments of the present invention also provide a computer-readable storage medium. The methods according to the embodiments of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented as computer code originally stored in a remote storage medium or a non-transitory machine-readable storage medium and to be stored in a local storage medium downloaded through a network, so that the methods described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium may also include a combination of the above types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code, and when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the methods shown in the above embodiments are implemented.
[0179] A part of the present invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can call or provide the methods and / or technical solutions according to the present invention through the operations of the computer. Those skilled in the art should understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Herein, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to the computer.
[0180] Although the embodiments of the present invention are described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations all fall within the scope defined by this application.
Claims
1. A method for compensating weighing errors of a weighbridge, characterized in that The method includes: Obtaining training sample data, first configuration parameters of a model parameter optimization algorithm, second configuration parameters of a weight matrix optimization algorithm, and initial model parameters; Creating an initial error compensation model according to the initial model parameters; Determining target model parameters of the initial error compensation model and target parameters of the weight matrix optimization algorithm according to the first configuration parameters, the model parameter optimization algorithm, and the training sample data; Determining a target weight matrix of the initial error compensation model according to the target parameters, the second configuration parameters, the weight matrix optimization algorithm, and the training sample data; Setting the target model parameters as the model parameters of the initial error compensation model, and setting the target weight matrix as the weight matrix of the initial error compensation model to obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to an input sensor signal.
2. The method according to claim 1, characterized in that, The determining the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm according to the first configuration parameters, the model parameter optimization algorithm, and the training sample data includes: Obtaining an optimization dimension of the model parameter optimization algorithm and a target number of parameter combinations in the first configuration parameters; Creating the target number of parameter combinations according to the optimization dimension, where the parameter combinations include the number of feature windows, the number of feature nodes, the number of enhancement nodes of the initial error compensation model, and the kernel width of the weight matrix optimization algorithm; Obtaining a speed space, a search space, and a first iteration number threshold of the model parameter optimization algorithm in the first configuration parameters; Initializing a first iteration number, and initializing the target number of parameter combinations in the speed space and the search space; Obtaining a fitness value corresponding to the parameter combination according to the initial error compensation model, the training sample data, a fitness function, and the parameter combination; Taking the parameter combination with the largest fitness value among the target number of parameter combinations as a target parameter combination; Increasing the first iteration number by a preset step length, and taking the target parameter combination as a historical parameter combination; Updating the target number of parameter combinations in the speed space and the search space; Obtaining a fitness value corresponding to the parameter combination according to the initial error compensation model, the training sample data, a fitness function, and the parameter combination; Taking the parameter combination with the largest fitness value among the target number of parameter combinations as a candidate parameter combination; Judging whether the fitness value of the candidate parameter combination is greater than the fitness value of the historical parameter combination, and if it is greater, taking the candidate parameter combination as the target parameter combination; Start executing subsequent steps by increasing the first iteration count by a first preset step size and using the target parameter combination as the historical parameter combination. End when the first iteration count reaches the first iteration count threshold. Obtain the target model parameters from the number of feature windows, the number of feature nodes, and the number of enhancement nodes in the target parameter combination, and use the kernel width in the target parameter combination as the target parameter.
3. The method according to claim 2, characterized in that The fitness function includes a first preset formula and a second preset formula. Obtaining the fitness value corresponding to the parameter combination based on the initial error compensation model, the training sample data, the fitness function, and the parameter combination includes: Group the training sample data according to the clustering algorithm to obtain a first preset number of sample combinations; Adjust the initial error compensation model according to the parameter combination to obtain an adjusted error compensation model; Input the training sample data in each sample combination into the adjusted error compensation model to obtain the output result corresponding to the training sample data; Obtain the first error corresponding to the training sample data based on the output result and the reference result corresponding to the training sample data; Obtain the second error of the parameter combination corresponding to the adjusted error compensation model based on the output result and the first preset formula; The first preset formula satisfies: where N is the number of the training sample data in the sample combination, y i is the output result of the i-th training sample data in the sample combination, y i+1 is the output result of the (i + 1)-th training sample data in the sample combination, i is the first index of the data, L smooth is the second error; Obtain the smoothness weight hyperparameter in the first configuration parameter; Obtain the fitness value of the parameter combination corresponding to the adjusted error compensation model based on the first error, the second error, and the second preset formula; The second preset formula satisfies: L total = L regression + ρL smooth , where L regression is the first error, ρ is the smoothness weight hyperparameter, and L total is the fitness value.
4. The method according to claim 1, characterized in that, Determining the target weight matrix of the initial error compensation model based on the target parameter, the second configuration parameter, the weight matrix optimization algorithm, and the training sample data includes: Obtain the second iteration count threshold of the weight matrix optimization algorithm, the preset threshold of the weight matrix, and the regularization hyperparameter in the second configuration parameter; Determine the target kernel width of the preset kernel function according to the target parameter, and obtain the similarity between the training sample data based on the preset kernel function, the target kernel width, and the training sample data; Determine the objective function including the weight matrix based on the similarity and the output expression of the initial error compensation model; Take the derivative of the weight matrix in the objective function to obtain the gradient expression; Generate a regularization term according to the regularization hyperparameter; Add the regularization term to the gradient expression to obtain the weight matrix iteration formula; Obtain the initial weight matrix of the initial error compensation model according to the weight matrix iteration formula; Initialize the second iteration count and use the initial weight matrix as the reference weight matrix; Update the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula to obtain the updated weight matrix; When the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, use the updated weight matrix as the target weight matrix; In the case where the difference between the updated weight matrix and the reference weight matrix is greater than or equal to the preset threshold, increase the second iteration count by a second preset step size, use the updated weight matrix as the reference weight matrix, and start executing subsequent steps from updating the reference weight matrix according to the preset iteration algorithm and the weight matrix iteration formula until the difference between the updated weight matrix and the reference weight matrix is less than the preset threshold, or the second iteration count is equal to the second iteration count threshold, then end, and use the updated weight matrix as the target weight matrix.
5. The method according to claim 1, wherein Creating an initial error compensation model according to the initial model parameters includes: Obtaining the initial number of feature windows, the initial number of feature nodes, the initial number of enhancement nodes, and the activation function of the initial error compensation model from the initial model parameters; Creating a feature mapping layer according to the initial number of feature windows and the initial number of feature nodes, and creating an enhancement node layer according to the initial number of enhancement nodes and the activation function; Obtaining the hidden layer of the initial error compensation model according to the feature mapping layer and the enhancement node layer; Creating the input layer and the output layer of the initial error compensation model, and obtaining the initial error compensation model according to the input layer, the output layer, and the hidden layer.
6. The method according to claim 1, characterized in that, Obtaining the training sample data includes: Obtaining initial sample data; Generating a kernel matrix according to the initial sample data, the preset kernel width, and the Gaussian kernel function; Centering the kernel matrix using a preset matrix to obtain an intermediate matrix; Obtaining the diagonal elements of the intermediate matrix, and normalizing the intermediate matrix using the diagonal elements to obtain a target matrix, where the target matrix contains the training sample data.
7. The method according to claim 1, characterized in that After obtaining the target error compensation model, the method further includes: Obtaining test sample data; Determining the evaluation index of the target error compensation model, where the evaluation index includes a third preset formula and / or a fourth preset formula; Inputting the load cell signal in the test sample data into the target error compensation model to obtain a predicted weighing result; Obtaining an evaluation index function of the target error compensation model according to the predicted weighing result, the reference weighing result of the test sample data, and the evaluation index, where the evaluation index function includes a first error and / or a second error; The third preset formula satisfies: where n is the quantity of the test sample data, is the predicted weighing result, x j is the reference weighing result, j is the second index of the data, and R1 is the first error; The fourth preset formula satisfies: wherein, R2 is the second error.
8. An error compensation device for truck scale weighing, characterized in that, The device includes: An obtaining module, configured to obtain training sample data, a first configuration parameter of a model parameter optimization algorithm, a second configuration parameter of a weight matrix optimization algorithm, and initial model parameters; A model creation module, configured to create an initial error compensation model according to the initial model parameters; A parameter determination module, configured to determine the target model parameters of the initial error compensation model and the target parameters of the weight matrix optimization algorithm according to the first configuration parameter, the model parameter optimization algorithm, and the training sample data; A weight matrix determination module, configured to determine a target weight matrix of the initial error compensation model according to the target parameter, the second configuration parameter, the weight matrix optimization algorithm, and the training sample data; A model setting module, configured to set the target model parameter as the model parameter of the initial error compensation model, and set the target weight matrix as the weight matrix of the initial error compensation model, to obtain a target error compensation model, where the target error compensation model is used to obtain a target weighing result according to an input sensor signal.
9. A computer device, characterized in that, including: A memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to execute the vehicle scale weighing error compensation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Computer instructions are stored on the computer-readable storage medium, and the computer instructions are used to cause a computer to execute the vehicle scale weighing error compensation method according to any one of claims 1 to 7.
Citation Information
Cited By
Tunnel construction geological disaster dynamic identification method and system
CN121999374A