Spraying process parameter prediction method based on small sample
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHANGCHUN UNIV OF SCI & TECH
- Filing Date
- 2025-11-18
- Publication Date
- 2026-06-05
AI Technical Summary
Under small sample conditions, the predictive performance of spraying process parameters is poor, traditional data-driven models are difficult to learn effectively, and high-quality process data is difficult to obtain and costly.
A small-sample-based method for predicting spraying process parameters is adopted. By introducing WGAN-GP data augmentation technology with prior knowledge constraints, high-quality augmented data that conforms to physical laws is generated. A BP neural network model is constructed, and the data subspace is divided using the sliding window method. A compensation loss function is constructed to ensure the compliance of the generated data.
It significantly improves the accuracy and reliability of spraying process parameter prediction, reduces the cost of process data acquisition, and improves prediction accuracy.
Smart Images

Figure CN122154378A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of machine learning methods and artificial intelligence, and in particular to a method for predicting spraying process parameters based on small samples. Background Technology
[0002] With the rapid development of industries such as aerospace, shipbuilding, and automobiles, the demand for workpiece surface treatment technology is increasing daily. Traditional manual spraying methods suffer from low efficiency, reliance on worker experience, and health hazards. In the context of intelligent manufacturing, spraying robots have emerged as an innovative solution. They not only improve spraying efficiency and ensure the stability of coating quality, but also overcome the shortcomings of traditional manual spraying methods, such as inaccurate spraying paths and the inability to perform precise operations.
[0003] In the field of industrial spraying, precise control of process parameters directly determines coating quality and production costs. Although spraying robots have gradually replaced traditional manual operations, optimizing and predicting their process parameters still faces core challenges: obtaining high-quality process data is extremely difficult and costly. Each effective spraying experiment involves complex equipment preparation and parameter adjustments, resulting in very scarce effective sample data for building predictive models, forming a typical "small sample" dilemma. Under these data-scarce conditions, traditional data-driven models struggle to learn effectively.
[0004] Chinese patent publication number "CN109234661A" and patent title "Thermal Spraying Method and System Based on Artificial Neural Network" proposes a multi-parameter artificial neural network prediction model. However, this existing technology mainly focuses on multi-parameter optimization under conditions of sufficient data, and does not address the core technical challenge of how to effectively expand data and improve data quality under conditions of small samples. When its training data is insufficient, the model will also face poor prediction performance and fail to achieve the expected prediction accuracy and reliability. Summary of the Invention
[0005] To address the problem of poor prediction performance of spraying process parameters under small sample conditions, this invention proposes a method for predicting spraying process parameters based on small samples. This method, based on limited original process data from limited spraying samples, utilizes WGAN-GP data augmentation technology with prior knowledge constraints to generate high-quality, physically consistent augmented data, thereby significantly improving the accuracy and reliability of subsequent prediction models.
[0006] The technical solution of this invention to solve the technical problem is:
[0007] A method for predicting spraying process parameters based on small samples, comprising the following steps:
[0008] Step 1: Data collection and preprocessing of sprayed sample;
[0009] First, the manually collected spraying sample data is defined as the original dataset D∈R. N×K Where N is the number of samples, K is the feature dimension, and each sample corresponds to a feature vector X. i As shown in equation (1);
[0010]
[0011] In equation (1), i∈{1,2......N}, η is the viscosity of the paint, and d h For the paint film thickness, l p For the thickness position, v s For the spraying speed, d s For spraying distance, For thickness standardization differences, p a p is the atomization pressure. f For the fan-shaped pressure, p q For flow pressure;
[0012] Then, the original dataset D is centered and scaled using equation (2) to obtain the standardized data.
[0013]
[0014] In equation (2), Let x be the j-th dimension feature value of the i-th sample after standardization. (i,j) μ represents the j-th dimension feature value of the i-th sample in the original data. j Let σ be the mean of the j-th feature. j Let μ be the standard deviation of the j-th feature; where μ j and σ j Calculated by equation (3);
[0015]
[0016] For sample i∈{1,2......N}, the result obtained from equation (2) By combining the results, the standardized dataset D is constructed using equation (4). std ;
[0017]
[0018] In equation (4), This represents the standardized feature vector of the sample in the i-th row;
[0019] Finally, based on the positional parameter l of the paint film thickness p To ensure spatial continuity, a sliding window method is used to divide the standardized dataset D. stdDivide into m subsets, i.e., data subspace S κ As shown in equation (5);
[0020] S κ =D std [(k-1)×T+1:k×T,:],k=1,2,3,....,m (5)
[0021] In equation (5), S κ ∈R T×K Let m represent the k-th data subspace, which contains all samples from row (k-1)×T+1 to row k×T. Let m represent the total number of data subspaces, and T represent the sliding window length, i.e., the number of samples in each subspace.
[0022] Step 2: Construct a compensation loss function that incorporates prior knowledge constraints;
[0023] The first step is to determine the compliance of samples within the generated subspace;
[0024] (1) Define the network structure:
[0025] Define the generator G as a mapping function that maps the input space The vectors in the vector space are mapped to the data subspace, and the general expression is as shown in equation (6);
[0026]
[0027] In equation (6), For input space, The space where the data subspace resides;
[0028] The noise vector z sampled from the Gaussian distribution i Inputting into equation (7) yields the generated data subspace.
[0029]
[0030] Define the discriminator D as a mapping function that maps the data subspace to a scalar score, with the general expression as shown in equation (8);
[0031]
[0032] Data subspace S κ Or generate a data subspace Input equation (9) and output a rating scalar y, which represents the probability that the input data is true;
[0033] y=D(X)∈R (9)
[0034] In equation (9), X is the data subspace S κOr generate a data subspace
[0035] (2) Define the feasible region of process parameters and calculate the parameter judgment factor;
[0036] During the data generation phase, judgments are made based on the reasonable range of atomization, fan shape, flow rate, and pressure process parameters; the feasible domain of the process parameters is defined as follows: Based on the feasible region, for each generated data subspace in equation (7) atomization pressure Fan pressure Flow pressure To make a judgment, the judgment factors A(i,t), B(i,t), and C(i,t) of the above three parameters are calculated using equations (10), (11), and (12) respectively. When the parameter judgment factor is 1, it indicates that the corresponding process parameter is compliant.
[0037]
[0038]
[0039] In equations (10) to (12), i = 1, 2, 3, ..., m represents the number of generated data subspaces; t = 1, 2, 3, ..., T represents the number of subspace samples;
[0040] The second step is to determine the compliance of the generated subspace;
[0041] Define a subspace qualified sample function K(i) and perform compliance judgment on each generated data subspace; input the three parameter judgment factors A(i,t), B(i,t), and C(i,t) into equation (13) to calculate the subspace qualified sample function K(i). If there are samples in the subspace that do not meet the constraints of the feasible domain of process parameters, K(i) = 0, otherwise K(i) = 1.
[0042]
[0043] In equation (13), T is the length of the generated subspace;
[0044] Step 3: Define the misjudgment indicator function κ(i);
[0045] The discriminator generates a data subspace. rating The subspace qualified sample function K(i) obtained in the second step is input into equation (14) to calculate the misjudgment indicator function κ(i), which is used to quantify the situation where the discriminator result is different from the prior knowledge judgment result;
[0046]
[0047] In equation (14), when there are samples in the subspace that do not conform to the production characteristics, i.e., K(i) = 0, and the discriminator classifies the generated subspace as true, i.e. Then κ(i) = 1, indicating that the discriminator has made a misjudgment;
[0048] Step 4: Obtain the compensation loss function L oil ;
[0049] The misjudgment indicator function κ(i) and the discriminator's score on the generated data subspace are used. Input formula (15) to calculate the compensation loss function L oil This serves as compensation when the discriminator makes decisions about the generated data.
[0050]
[0051] In equation (15), num = sum(κ) is the number of misclassifications in the generated data of m subspaces, and δ is a minimum value used to prevent the denominator from being 0.
[0052] Step 3: Design the WGAN-GP loss function;
[0053] Step 1: Establish the basic loss function;
[0054] The basic WGAN-GP loss function of the discriminator D is shown in equation (16);
[0055]
[0056] In equation (16), D(X) represents the discriminator's score for the real sample X, x ~ p r Indicates the distribution of real data p r Sample x from the middle, This represents the discriminator's expected score for the real sample; the discriminator needs to maximize this value. The discriminator's expected score for the generated samples, Z~p z Indicates the noise distribution p z The noise vector Z is sampled from a (typically Gaussian) distribution. The generator G(Z) transforms the noise Z into generated samples, and the discriminator D(G(Z)) scores the generated samples. This indicates that the gradient norm of the discriminator is forced to be close to 1, improving training stability. λ gp This represents the gradient penalty coefficient, used to balance the weights of the gradient penalty term. For interpolation samples, Let ||·||2 be the gradient of the discriminator with respect to the interpolated samples, and ||·||2 be the L2 norm.
[0057] The basic WGAN-GP loss function for generator G is shown in equation (17);
[0058]
[0059] In equation (17), The discriminator's expected score for the generated sample; the generator needs to minimize this negative value, that is, maximize D(G(Z)), so that the discriminator score of the generated sample is as high as possible, thereby deceiving the discriminator;
[0060] The second step is to introduce a compensation loss function.
[0061] Adding the compensation loss function from equation (15) to equation (16) yields the discriminator loss function Loss. D ;
[0062] Loss D =L D +λ oil L oil (18)
[0063] In equation (18), λ oil L oil This represents the penalty for the discriminator's high score on generated samples that do not meet the process constraints. A larger value indicates a more severe misjudgment by the discriminator. λ oil For prior compensation weights;
[0064] Adding the compensation loss function from equation (15) to equation (17) yields the generator loss function Loss. G ;
[0065] Loss G =L G +λ oil L oil (19).
[0066] Step 4: Generate new data for the sprayed sample;
[0067] Step 1: Discriminator parameter update;
[0068] The parameter θ of the fixed generator G g Update the discriminator parameters θ d ;
[0069] (1) Forward computation: Input random noise Z into generator G in equation (20) to obtain the generated data subspace.
[0070]
[0071] (2) Discriminator loss calculation: First, the real data subspace S κ With generating data subspace The basic discriminator loss L' is obtained from input equation (21).D Then, based on step 2, construct the compensation loss function that incorporates prior knowledge constraints, and calculate the compensation loss function L'. oil Finally, the discriminator loss function Loss' is constructed by weighting the basic discriminator loss and the compensation loss. D ;
[0072]
[0073] Loss' D =L' D +λ oil L' oil (twenty two)
[0074] (3) Parameter update: Loss' D D(D mixed In input (23), calculate Loss' D For discriminator parameters θ d The gradient is calculated and updated along the gradient descent direction;
[0075]
[0076] In equation (23): Let η be the discriminator parameters for the κ-th iteration. d The discriminator learning rate, The gradient of the loss function with respect to the discriminator parameters is calculated by equation (24);
[0077]
[0078] In equation (24), The gradient of the basic loss function, To compensate for the gradient of the loss function;
[0079] Step 2: Update generator parameters;
[0080] The parameters θ of the fixed discriminator D d Update the parameter θ of generator G. g ;
[0081] (1) Generator loss calculation: The generated data subspace Inputting into equation (25) yields the basic generator loss L' G and compensation for loss L' oil Weighted average constitutes Loss' G ;
[0082]
[0083] Loss' G =L' G +λoil L' oil (26)
[0084] (2) Parameter update: Loss' G Input into equation (27) to calculate Loss' G For generator parameter θ g The gradient is calculated and updated along the gradient descent direction;
[0085]
[0086] In equation (27), Let η be the discriminator parameters for the κ-th iteration. g The discriminator learning rate, The gradient of the function with respect to the generator parameters is calculated by equation (28);
[0087]
[0088] In equation (28), The gradient of the basic loss function, To compensate for the gradient of the loss function;
[0089] After the parameters of the discriminator and generator are updated, we get Optimal Generator Parameters
[0090] The third step is to generate new data for the spraying samples and the final merged dataset.
[0091] (1) The noise vector z i The new data D of the sprayed sample is obtained by inputting formula (29). new ;
[0092]
[0093] In equation (29), M total The total number of subspaces generated;
[0094] (2)D new With D std The final merged dataset D is obtained by merging. tot This provides richer data support for subsequent BP training;
[0095]
[0096] In equation (30), N is the original sample size, and M is the number of samples. total •T represents the number of new samples.
[0097] Step 5: Train the BP neural network model using the final merged dataset;
[0098] Step 1: Divide the dataset;
[0099] The final merged dataset D obtained by combining equation (30) tot As training set D train And divide it into input dataset X train and output dataset Y train , as in equation (31);
[0100] D train ={X train ,Y train} (31)
[0101] Input dataset X train It consists of n sets of process parameter samples, each set of samples contains a 6-dimensional feature vector;
[0102]
[0103] In equation (32), the number of samples n = N + M total ·T;
[0104] Output dataset Y train It consists of n sets of process parameter samples, each set of samples contains a 3-dimensional feature vector;
[0105]
[0106] The second step is to build and train a BP neural network model.
[0107] Let the initial model of the BP neural network be f(X,θ), where θ is the initial network parameters (including weights w and biases b), and X is the input sample; first, X... train The predicted value is obtained from the input formula (34). Then through backpropagation, In input formula (35), based on the error The network weights w and biases b are continuously adjusted; for each layer's parameters, adjustments are made according to a certain learning rate η to minimize the error. Gradually decrease until the error Less than the preset training accuracy ∈;
[0108]
[0109] In equation (35), This represents the true value of the i-th sample. This represents the predicted value of the i-th sample;
[0110] The final BP neural network model obtained after training:
[0111] f(X,θ* (36)
[0112] In equation (36), θ * These are the final parameters after training.
[0113] Step 6: Evaluate the BP neural network model using the test set;
[0114] Test set D test Divide into input dataset X test and output dataset Y test , will X test In input formula (38), the output predicted value is calculated.
[0115] D test ={X test ,Y test} (37)
[0116]
[0117] The beneficial effects of this invention are:
[0118] 1) Propose a subspace partitioning strategy: During the data preprocessing process, based on the spatial continuity of the paint film thickness position parameters, the continuous spraying data is divided into data subspaces using the sliding window method, which effectively preserves the spatiotemporal correlation characteristics of the process parameters and lays the foundation for generating high-quality data;
[0119] 2) Construct a compensation loss function that incorporates prior knowledge constraints: Obtain the prior knowledge judgment result by determining whether the generated data is within a reasonable range, and calculate the compensation loss function by quantifying the discriminator result and the prior knowledge judgment result. Add the compensation loss function to the WAGN-GP loss function for training to ensure that the generated data conforms to the rules.
[0120] This invention utilizes the final merged dataset to train a BP neural network model, and then uses the trained BP neural network model to predict the test set, overcoming the challenge of predicting process parameters under small sample conditions. This method significantly improves prediction accuracy and reduces the cost of acquiring process data while reducing data dependence. Attached Figure Description
[0121] Figure 1 This is a flowchart of the spraying process parameter prediction method based on small samples according to the present invention.
[0122] Figure 2 This is a schematic diagram of the data subspace partitioning described in this invention.
[0123] Figure 3 This is a flowchart of the construction of a compensation loss function that incorporates prior knowledge constraints as described in this invention.
[0124] Figure 4 This is a schematic diagram of the WGAN-GP architecture described in this invention.
[0125] Figure 5 This is a schematic diagram of the BP neural network model structure described in this invention. Detailed Implementation
[0126] The present invention will be further described in detail below with reference to the accompanying drawings.
[0127] like Figure 1 As shown, a method for predicting spraying process parameters based on small samples is described. This method includes the following steps:
[0128] Step 1, Data Acquisition and Preprocessing;
[0129] First, the manually collected spraying sample data is defined as the original dataset D∈R. N×K (As shown in Table 1), where N = 945 is the number of samples, K = 9 is the feature dimension, and each sample corresponds to a feature vector X. i As shown in equation (1);
[0130]
[0131] In equation (1), i ∈ {1,2.......N}, where η is the viscosity of the paint, and d h For the paint film thickness, l p For the thickness position, v s For the spraying speed, d s For spraying distance, For thickness standardization differences, p a p is the atomization pressure. f For the fan-shaped pressure, p q For flow pressure;
[0132] Table 1 Partial Original Data
[0133]
[0134] Then, the original dataset D is centered and scaled using equation (2) to obtain the standardized data.
[0135]
[0136] In equation (2), Let x be the j-th dimension feature value of the i-th sample after standardization. (i,j) μ represents the j-th dimension feature value of the i-th sample in the original data. j Let σ be the mean of the j-th feature.j Let μ be the standard deviation of the j-th feature; where μ j and σ j Calculated by equation (3);
[0137]
[0138] For sample i∈{1,2,3,......,945}, the result obtained from equation (2) By combining the results, the standardized dataset D is constructed using equation (4). std .
[0139]
[0140] In equation (4), Let represent the standardized feature vector of the sample in the i-th row.
[0141] Finally, based on the positional parameter l of the paint film thickness p To maintain spatial continuity, a sliding window method is used, such as... Figure 2 As shown, the standardized dataset D std Divide into m subsets, i.e., data subspace S κ , as in equation (5).
[0142] S κ =D std [(k-1)×T+1:k×T,:],k=1,2,3,....,m (5)
[0143] In equation (5), S κ ∈R T×K Let represent the k-th data subspace, containing all samples from row (k-1)×T+1 to row k×T. m = 45 represents the total number of data subspaces, and T = 21 represents the sliding window length, i.e., the number of samples in each subspace. Partial data is shown in Table 2.
[0144] Table 2 shows some of the preprocessed data.
[0145]
[0146] Step 2: Construct a compensation loss function that incorporates prior knowledge constraints;
[0147] The first step is to determine the compliance of samples within the generated subspace;
[0148] (1) Define the network structure:
[0149] Define the generator G as a mapping function that maps the input space The vectors in the vector space are mapped to the data subspace, and the general expression is as shown in equation (6);
[0150]
[0151] In equation (6), For input space, The space where the data subspace resides;
[0152] The noise vector z sampled from the Gaussian distribution i Inputting into equation (7) yields the generated data subspace.
[0153]
[0154] Define the discriminator D as a mapping function that maps the data subspace to a scalar score, with the general expression as shown in equation (8);
[0155]
[0156] Data subspace S κ Or generate a data subspace Input equation (9) and output a rating scalar y, which represents the probability that the input data is true;
[0157] y=D(X)∈R (9)
[0158] In equation (9), X is the data subspace S κ Or generate a data subspace
[0159] (2) Define the feasible region of process parameters and calculate the parameter judgment factor;
[0160] During the data generation phase, a judgment is made based on the reasonable range of atomization, fan shape, flow rate, and pressure process parameters, and the feasible region of the process parameters, i.e., p, is defined. a ∈[0.05,0.30], p f ∈[0.05,0.30], p q ∈[0.05,0.20]. For example... Figure 3 As shown, based on the feasible region, for each generated data subspace in equation (7) atomization pressure Fan pressure Flow pressure To make a judgment, the judgment factors A(i,t), B(i,t), and C(i,t) of the above three parameters are calculated using equations (10), (11), and (12) respectively. When the parameter judgment factor is 1, it indicates that the corresponding process parameter is compliant.
[0161]
[0162]
[0163] In equations (10) to (12), i = 1, 2, 3, ..., 45 represents the number of generated data subspaces; t = 1, 2, 3, ..., 21 represents the number of subspace samples.
[0164] The second step is to determine the compliance of the generated subspace;
[0165] Define a subspace qualified sample function K(i) and perform compliance judgment on each generated data subspace; input the three parameter judgment factors A(i,t), B(i,t), and C(i,t) into equation (13) to calculate the subspace qualified sample function K(i). If there are samples in the subspace that do not meet the constraints of the feasible domain of process parameters, K(i) = 0, otherwise K(i) = 1.
[0166]
[0167] In equation (13), T is the length of the generated subspace.
[0168] Step 3: Define the misjudgment indicator function κ(i);
[0169] The discriminator generates a data subspace. rating The subspace qualified sample function K(i) obtained in the second step is input into equation (14) to calculate the misjudgment indicator function κ(i), which is used to quantify the situation where the discriminator result is different from the prior knowledge judgment result;
[0170]
[0171] In equation (14), when there are samples in the subspace that do not conform to the production characteristics, i.e., K(i) = 0, and the discriminator classifies the generated subspace as true, i.e. Then κ(i) = 1, indicating that the discriminator has made a misjudgment;
[0172] Step 4: Obtain the compensation loss function L oil ;
[0173] The misjudgment indicator function κ(i) and the discriminator's score on the generated data subspace are used. Input formula (15) to calculate the compensation loss function L oil This serves as compensation when the discriminator makes decisions about the generated data.
[0174]
[0175] In equation (15), num = sum(κ) is the number of misclassifications in the generated data of m subspaces, and δ is a minimum value used to prevent the denominator from being 0.
[0176] Step 3: Design the WGAN-GP loss function;
[0177] Step 1: Establish the basic loss function;
[0178] The basic WGAN-GP loss function of the discriminator D is shown in equation (16);
[0179]
[0180] In equation (16), D(X) represents the discriminator's score for the real sample X, x ~ p r Indicates the distribution of real data p r Sample x from the middle, This represents the discriminator's expected score for the real sample; the discriminator needs to maximize this value. The discriminator's expected score for the generated samples, Z~p z Indicates the noise distribution p z The noise vector Z is sampled from a (typically Gaussian) distribution. The generator G(Z) transforms the noise Z into generated samples, and the discriminator D(G(Z)) scores the generated samples. This indicates that the gradient norm of the discriminator is forced to be close to 1, improving training stability. λ gp This represents the gradient penalty coefficient, used to balance the weights of the gradient penalty term. For interpolation samples, Let ||·||2 be the gradient of the discriminator with respect to the interpolated samples, and ||·||2 be the L2 norm.
[0181] The basic WGAN-GP loss function for generator G is shown in equation (17);
[0182]
[0183] In equation (17), The discriminator's expected score for the generated sample; the generator needs to minimize this negative value, that is, maximize D(G(Z)), so that the discriminator score of the generated sample is as high as possible, thereby deceiving the discriminator;
[0184] The second step is to introduce a compensation loss function.
[0185] Adding the compensation loss function from equation (15) to equation (16) yields the discriminator loss function Loss. D ;
[0186] Loss D =L D +λ oil L oil (18)
[0187] In equation (18), λ oil L oilThis represents the penalty for the discriminator's high score on generated samples that do not meet the process constraints. A larger value indicates a more severe misjudgment by the discriminator. λ oil For prior compensation weights;
[0188] Adding the compensation loss function from equation (15) to equation (17) yields the generator loss function Loss. G ;
[0189] Loss G =L G +λ oil L oil (19)
[0190] Step 4: Generate new data for the sprayed sample;
[0191] The process of generating new data for sprayed coating samples is as follows: Figure 4 As shown.
[0192] Update the parameters of the generator G of the discriminator D, with an update iteration count of E = 200;
[0193] Step 1: Discriminator parameter update;
[0194] The parameter θ of the fixed generator G g Update the discriminator parameters θ d ;
[0195] (1) Forward computation: Input random noise Z = 100 into the generator G in equation (20) to obtain the generated data subspace.
[0196]
[0197] (2) Discriminator loss calculation: First, the real data subspace S κ With generating data subspace The basic discriminator loss L' is obtained from input equation (21). D Then, based on step 2, construct the compensation loss function that incorporates prior knowledge constraints, and calculate the compensation loss function L'. oil Finally, the discriminator loss function Loss' is constructed by weighting the basic discriminator loss and the compensation loss. D ;
[0198]
[0199] Loss' D =L' D +λ oil L' oil (twenty two)
[0200] (3) Parameter update: Loss' DD(D mixed In input (23), calculate Loss' D For discriminator parameters θ d The gradient is calculated and updated along the gradient descent direction;
[0201]
[0202] In equation (23): Let η be the discriminator parameters for the κ-th iteration. d =0.00001 is the discriminator learning rate. The gradient of the loss function with respect to the discriminator parameters is calculated by equation (24);
[0203]
[0204] In equation (24), The gradient of the basic loss function, To compensate for the gradient of the loss function;
[0205] Step 2: Update generator parameters;
[0206] The parameters θ of the fixed discriminator D d Update the parameter θ of generator G. g ;
[0207] (1) Generator loss calculation: The generated data subspace Inputting into equation (25) yields the basic generator loss L' G and compensation for loss L' oil Weighted average constitutes Loss' G ;
[0208]
[0209] Loss' G =L' G +λ oil L' oil (26)
[0210] (2) Parameter update: Loss' G Input into equation (27) to calculate Loss' G For generator parameter θ g The gradient is calculated and updated along the gradient descent direction;
[0211]
[0212] In equation (27), Let η be the discriminator parameters for the κ-th iteration. g =0.00001 is the discriminator learning rate. The gradient of the function with respect to the generator parameters is calculated by equation (28);
[0213]
[0214] In equation (28), The gradient of the basic loss function, To compensate for the gradient of the loss function;
[0215] After the parameters of the discriminator and generator are updated, we get Optimal Generator Parameters
[0216] The third step is to generate new data for the spraying samples and the final merged dataset.
[0217] (1) The noise vector z i =100 Input formula (29) to obtain new data D of the sprayed sample new ;
[0218]
[0219] In equation (29), M total =200 represents the total number of subspaces generated;
[0220] (2)D new With D std The final merged dataset D is obtained by merging. tot This provides richer data support for subsequent BP training;
[0221]
[0222] The final number of data points is N+M total ·T=945+200·21=5145.
[0223] Table 3 shows some of the generated data.
[0224]
[0225] Step 5: Finally, merge the datasets and train the BP neural network model;
[0226] Step 1: Divide the dataset;
[0227] The final merged dataset D obtained by combining equation (30) tot As training set D train And divide it into input dataset X train and output dataset Y train , as in equation (31);
[0228] D train ={Xtrain ,Y train} (31)
[0229] BP neural network model, such as Figure 5 As shown, the input dataset X train It consists of 5145 sets of process parameter samples, each set containing a 6-dimensional feature vector, where η is the paint viscosity and d is the viscosity of the paint. h For the paint film thickness, l p For the thickness position, v s For the spraying speed, d s For spraying distance, For thickness standardization differences;
[0230]
[0231] In equation (32), the number of samples n = N + M total ·T;
[0232] Output dataset Y train It consists of 5145 sets of process parameter samples, each set containing a 3-dimensional feature vector, p a p is the atomization pressure. f For the fan-shaped pressure, p q For flow pressure;
[0233]
[0234] The second step is to build and train a BP neural network model.
[0235] Let the initial model of the BP neural network be f(X,θ), where θ is the initial network parameters (including weights w and biases b), and X is the input sample; first, X... train The predicted value is obtained from the input formula (34). Then through backpropagation, In input formula (35), based on the error The network weights w and biases b are continuously adjusted; for each layer's parameters, adjustments are made according to a certain learning rate η = 0.01 to minimize the error. Gradually decrease until the error Less than the preset training accuracy ∈ = 0.001;
[0236]
[0237] In equation (35), This represents the true value of the i-th sample. This represents the predicted value of the i-th sample;
[0238] The final BP neural network model obtained after training:
[0239] f(X,θ * (36)
[0240] In equation (36), θ * These are the final parameters after training.
[0241] Step 6: Evaluate the BP neural network model using the test set;
[0242] Test set D test Divide into input dataset X test and output dataset Y test (As shown in Table 4), X test In input formula (38), the output predicted value is calculated.
[0243] D test ={X test ,Y test} (37)
[0244]
[0245] Table 4 shows part of the test set data.
[0246]
[0247] The final result obtained by this patent is shown in Table 5.
[0248] Table 5 shows some predicted values.
[0249]
[0250] To verify the effectiveness of the generated process data in modeling applications, the original dataset D... std The dataset D is obtained by merging the original dataset with the WGAN-GP augmented dataset (945 samples) as training set 1, and the dataset D obtained by merging the original dataset with the dataset augmented by the method of this invention. tot Training set 3 (5145 samples) and test set D test 126 sets of real data that were not used in the training process were employed. A backpropagation (BP) model was used to train and predict the data. The prediction results were evaluated using MAE and MAPE, as shown in Table 6.
[0251] Table 6 Comparison of Error Results (MAE: MPa)
[0252]
[0253] Note: 1, 2, and 3 represent the prediction results obtained by the BP model trained on training sets 1, 2, and 3, respectively.
[0254] Experiments show that the method of this invention (training set 3) has significantly lower prediction errors than the other two methods across all key parameters. Particularly in terms of atomization pressure and flow pressure, compared to the baseline WGAN-GP (training set 2), the MAE is reduced by over 80%, and the MAPE by over 90%. This fully demonstrates the effectiveness of the proposed compensation loss function and subspace partitioning strategy, which incorporates prior knowledge constraints, in improving the quality of data generation and prediction accuracy under small sample conditions.
Claims
1. A method for predicting spraying process parameters based on small samples, characterized by: The method includes the following steps: Step 1: Data collection and preprocessing of sprayed sample; Step 2: Construct a compensation loss function that incorporates prior knowledge constraints; Step 3: Design the WGAN-GP loss function; Step 4: Generate new data for the sprayed sample; Step 5: Train the BP neural network model using the final merged dataset; Step 6: Evaluate the BP neural network model using the test set.
2. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 1 specifically involves: First, defining the manually collected spraying sample data as the original dataset D∈R. N×K Where N is the number of samples, K is the feature dimension, and each sample corresponds to a feature vector X. i As shown in equation (1); In equation (1), i∈{1,2.......N}, η is the viscosity of the paint, and d h For the paint film thickness, l p For the thickness position, v s For the spraying speed, d s For spraying distance, For thickness standardization differences, p a p is the atomization pressure. f For the fan-shaped pressure, p q For flow pressure; Then, the original dataset D is centered and scaled using equation (2) to obtain the standardized data. In equation (2), Let x be the j-th dimension feature value of the i-th sample after standardization. (i,j) μ represents the j-th dimension feature value of the i-th sample in the original data. j Let σ be the mean of the j-th feature. j Let μ be the standard deviation of the j-th feature; where μ j and σ j Calculated by equation (3); For a sample i∈{1,2.......N}, the result obtained from equation (2) By combining the results, the standardized dataset D is constructed using equation (4). std ; In equation (4), This represents the standardized feature vector of the sample in the i-th row; Finally, based on the positional parameter l of the paint film thickness p To ensure spatial continuity, a sliding window method is used to divide the standardized dataset D. std Divide into m subsets, i.e., data subspace S κ As shown in equation (5); S κ =D std [(k-1)×T+1:k×T,:],k=1,2,3,....,m (5) In equation (5), S κ ∈R T×K Let m represent the k-th data subspace, which contains all samples from row (k-1)×T+1 to row k×T. Let m represent the total number of data subspaces, and T represent the sliding window length, i.e., the number of samples in each subspace.
3. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 2, which involves constructing a compensation loss function that incorporates prior knowledge constraints, includes the following steps: The first step is to determine the compliance of samples within the generated subspace; 1) Define the network structure: Define the generator G as a mapping function that maps the input space The vectors in the vector space are mapped to the data subspace, and the general expression is as shown in equation (6); In equation (6), For input space, The space where the data subspace resides; The noise vector z sampled from the Gaussian distribution i Inputting into equation (7) yields the generated data subspace. Define the discriminator D as a mapping function that maps the data subspace to a scalar score, with the general expression as shown in equation (8); Data subspace S κ Or generate a data subspace Input equation (9) and output a rating scalar y, which represents the probability that the input data is true; y=D(X)∈R (9) In equation (9), X is the data subspace S κ Or generate a data subspace 2) Define the feasible region of process parameters and calculate the parameter judgment factors; During the data generation phase, judgments are made based on the reasonable range of atomization, fan shape, flow rate, and pressure process parameters; the feasible domain of the process parameters is defined as follows: Based on the feasible region, for each generated data subspace in equation (7) atomization pressure Fan pressure Flow pressure To make a judgment, the judgment factors A(i,t), B(i,t), and C(i,t) of the above three parameters are calculated using equations (10), (11), and (12) respectively. When the parameter judgment factor is 1, it indicates that the corresponding process parameter is compliant. In equations (10) to (12), i = 1, 2, 3, ..., m represents the number of generated data subspaces; t = 1, 2, 3, ..., T represents the number of subspace samples; The second step is to determine the compliance of the generated subspace; Define a subspace qualified sample function K(i) and perform compliance judgment on each generated data subspace; input the three parameter judgment factors A(i,t), B(i,t), and C(i,t) into equation (13) to calculate the subspace qualified sample function K(i). If there are samples in the subspace that do not meet the constraints of the feasible domain of process parameters, K(i) = 0, otherwise K(i) = 1. In equation (13), T is the length of the generated subspace; Step 3: Define the misjudgment indicator function κ(i); The discriminator generates a data subspace. rating The subspace qualified sample function K(i) obtained in the second step is input into equation (14) to calculate the misjudgment indicator function κ(i), which is used to quantify the situation where the discriminator result is different from the prior knowledge judgment result; In equation (14), when there are samples in the subspace that do not conform to the production characteristics, i.e., K(i) = 0, and the discriminator classifies the generated subspace as true, i.e. Then κ(i) = 1, indicating that the discriminator has made a misjudgment; Step 4: Obtain the compensation loss function L oil ; The misjudgment indicator function κ(i) and the discriminator's score on the generated data subspace are used. Input formula (15) to calculate the compensation loss function L oil This serves as compensation when the discriminator makes decisions about the generated data. In equation (15), num = sum(κ) is the number of misclassifications in the generated data of m subspaces, and δ is a minimum value used to prevent the denominator from being 0.
4. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 3 specifically involves: Step 1: Establish the basic loss function; The basic WGAN-GP loss function of the discriminator D is shown in equation (16); In equation (16), D(X) represents the discriminator's score for the real sample X, x ~ p r Indicates the distribution of real data p r Sample x from the middle, This represents the discriminator's expected score for the real sample; the discriminator needs to maximize this value. The discriminator's expected score for the generated samples, Z~p z Indicates the noise distribution p z The noise vector Z is sampled from a (typically Gaussian) distribution. The generator G(Z) transforms the noise Z into generated samples, and the discriminator D(G(Z)) scores the generated samples. This indicates that the gradient norm of the discriminator is forced to be close to 1, improving training stability. λ gp This represents the gradient penalty coefficient, used to balance the weights of the gradient penalty term. For interpolation samples, Let ||·||2 be the gradient of the discriminator with respect to the interpolated samples, and ||·||2 be the L2 norm. The basic WGAN-GP loss function for generator G is shown in equation (17); In equation (17), The discriminator's expected score for the generated sample; the generator needs to minimize this negative value, that is, maximize D(G(Z)), so that the discriminator score of the generated sample is as high as possible, thereby deceiving the discriminator; The second step is to introduce a compensation loss function. Adding the compensation loss function from equation (15) to equation (16) yields the discriminator loss function Loss. D ; Loss D =L D +λ oil L oil (18) In equation (18), λ oil L oil This represents the penalty for the discriminator's high score on generated samples that do not meet the process constraints. A larger value indicates a more severe misjudgment by the discriminator. λ oil For prior compensation weights; Adding the compensation loss function from equation (15) to equation (17) yields the generator loss function Loss. G ; Loss G =L G +λ oil L oil (19).
5. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 4, which generates new data for the sprayed sample, includes the following steps: Step 1: Discriminator parameter update; The parameter θ of the fixed generator G g Update the discriminator parameters θ d ; 1) Forward computation: Input random noise Z into the generator G in equation (20) to obtain the generated data subspace. 2) Discriminator loss calculation: First, the real data subspace S... κ With generating data subspace The basic discriminator loss L' is obtained from input equation (21). D Then, based on step 2, construct the compensation loss function that incorporates prior knowledge constraints, and calculate the compensation loss function L'. oil Finally, the discriminator loss function Loss' is constructed by weighting the basic discriminator loss and the compensation loss. D ; Loss' D =L' D +λ oil The oil (22) 3) Parameter update: Loss' D D(D mixed In input (23), calculate Loss' D For discriminator parameters θ d The gradient is calculated and updated along the gradient descent direction; In equation (23): Let η be the discriminator parameters for the κ-th iteration. d The discriminator learning rate, The gradient of the loss function with respect to the discriminator parameters is calculated by equation (24); In equation (24), The gradient of the basic loss function, To compensate for the gradient of the loss function; Step 2: Update generator parameters; The parameters θ of the fixed discriminator D d Update the parameter θ of generator G. g ; 1) Generator loss calculation: Calculate the generated data subspace Inputting into equation (25) yields the basic generator loss L' G and compensation for loss L' oil Weighted average constitutes Loss' G ; Loss' G =L' G +λ oil The oil (26) 2) Parameter update: update Loss' G Input into equation (27) to calculate Loss' G For generator parameter θ g The gradient is calculated and updated along the gradient descent direction; In equation (27), Let η be the discriminator parameters for the κ-th iteration. g The discriminator learning rate, The gradient of the function with respect to the generator parameters is calculated by equation (28); In equation (28), The gradient of the basic loss function, To compensate for the gradient of the loss function; After the parameters of the discriminator and generator are updated, we get Optimal Generator Parameters The third step is to generate new data for the spraying samples and the final merged dataset. 1) The noise vector z i The new data D of the sprayed sample is obtained by inputting formula (29). new ; In equation (29), M total The total number of subspaces generated; 2)D new With D std The final merged dataset D is obtained by merging. tot This provides richer data support for subsequent BP training; In equation (30), N is the original sample size, and M is the number of samples. total •T represents the number of new samples.
6. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 5: Train the BP neural network model using the final merged dataset, including the following steps: Step 1: Divide the dataset; The final merged dataset D obtained by combining equation (30) tot As training set D train And divide it into input dataset X train and output dataset Y train , as in equation (31); D train ={X train ,Y train } (31) Input dataset X train It consists of n sets of process parameter samples, each set of samples contains a 6-dimensional feature vector; In equation (32), the number of samples n = N + M total ·T; Output dataset Y train It consists of n sets of process parameter samples, each set of samples contains a 3-dimensional feature vector; The second step is to build and train a BP neural network model. Let the initial model of the BP neural network be f(X,θ), where θ is the initial network parameters (including weights w and biases b), and X is the input sample; first, X... train The predicted value is obtained from the input formula (34). Then through backpropagation, In input formula (35), based on the error The network weights w and biases b are continuously adjusted; for each layer's parameters, adjustments are made according to a certain learning rate η to minimize the error. Gradually decrease until the error Less than the preset training accuracy ∈; In equation (35), This represents the true value of the i-th sample. This represents the predicted value of the i-th sample; The final BP neural network model obtained after training: f(X,θ * ) (36) In equation (36), θ * These are the final parameters after training.
7. The method for predicting spraying process parameters based on small samples according to claim 1, characterized in that, Step 6 specifically involves: Test set D test Divide into input dataset X test and output dataset Y test , will X test In input formula (38), the output predicted value is calculated. D test ={X test ,Y test } (37)