Method for detecting water content in oil based on multi-modal data fusion
By using a multimodal data fusion method, combining microwave and near-infrared spectral signals, dynamically adjusting the fusion weights and correcting the residuals, the problem of insufficient sensitivity and robustness in oil moisture detection is solved, achieving efficient and real-time oil moisture content detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-04-07
AI Technical Summary
Existing methods for detecting moisture in oils cannot simultaneously achieve both sensitivity and robustness, and traditional methods are inefficient and cannot be measured in real time, resulting in unsatisfactory detection reliability and sensitivity.
A multimodal data fusion method is adopted, which combines microwave signals and near-infrared spectral signals, extracts features using the HiLo attention mechanism and frequency domain analysis, combines the main prediction model and the auxiliary prediction model, dynamically adjusts the fusion weights and performs residual correction, so as to achieve accurate detection of water content in oil.
It improves the sensitivity and robustness of water content detection in oil, possesses high intelligence and automation, is suitable for online detection systems, adapts to multiple environments and types of oil, and achieves real-time predictive output.
Smart Images

Figure CN121805286A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of oil quality testing, and in particular to a method for detecting water content in oil based on multimodal data fusion. Background Technology
[0002] In the fields of petrochemicals and power lubrication, the presence of trace amounts of water in oil can significantly affect oil performance and stable equipment operation. Traditional methods for detecting water in oil mainly include infrared drying and Karl Fischer titration. Although these methods have high accuracy, they are inefficient and cannot measure in real time.
[0003] In recent years, near-infrared spectroscopy and microwave detection methods have attracted attention due to their rapid, non-destructive nature and sensitivity to polar molecules, and have been increasingly used for moisture detection in oils. However, both methods struggle to simultaneously achieve both sensitivity and robustness, exhibiting issues such as detection instability, significant temperature interference, and poor sensitivity at low moisture levels, resulting in less than ideal reliability and sensitivity. Summary of the Invention
[0004] This application addresses the aforementioned problems and technical needs by proposing a method for detecting water content in oil based on multimodal data fusion. The technical solution of this application is as follows: A method for detecting water content in oil based on multimodal data fusion, the method comprising: Microwave and near-infrared spectral signals of the oil to be tested were collected; The microwave signal of the oil to be detected is subjected to frequency domain analysis and HiLo attention mechanism processing to obtain microwave features, which are then input into a pre-trained master prediction model to obtain the master prediction value. ; Feature extraction is performed on the near-infrared spectral signal of the oil to be tested to obtain spectral features, which are then input into a pre-trained auxiliary prediction model to obtain auxiliary prediction values. ; Based on the combined performance parameters of the primary and auxiliary prediction models and the current prediction discrepancies, the primary prediction value is evaluated using a confidence level assessment mechanism. Perform residual correction as And dynamically determine the fusion weights. The water content in the oil to be tested was obtained. , Represents the residual.
[0005] A further technical solution is that the method for detecting water content in oil also includes: Based on the performance parameters of the primary and auxiliary prediction models, and the primary prediction value... With auxiliary predicted values absolute differences between Calculate the standardized difference index And obtain the confidence parameters. Confidence parameter Used to quantify the degree of randomness in the current prediction discrepancies between the primary and secondary prediction models; The performance parameters and confidence parameters of both the main prediction model and the auxiliary prediction model are combined. For the main forecast value Perform residual correction and determine fusion weights .
[0006] The further technical solution involves using the error variance as the model performance parameter and calculating the standardized difference index. And obtain the confidence parameters. Including calculations according to the following formula:
[0007]
[0008] in, It is the error variance of the main prediction model on the validation dataset. It is the error variance of the auxiliary prediction model on the validation dataset.
[0009] The further technical solution is that the model performance parameter is the error variance, which is a combination of the model performance parameters of the main prediction model and the auxiliary prediction model, as well as the confidence parameter. For the main forecast value Residual correction includes calculating the residuals according to the following formula. :
[0010] in, .
[0011] The further technical solution is that the model performance parameter is the error variance, which is a combination of the model performance parameters of the main prediction model and the auxiliary prediction model, as well as the confidence parameter. Determine the fusion weights include: The basic weights are determined based on the performance parameters of the primary forecasting model and the auxiliary forecasting model, respectively. And calculate the master forecast value. With auxiliary predicted values Relative differences in predictions between ; It is the error variance of the main prediction model on the validation dataset. It is the error variance of the auxiliary prediction model on the validation dataset; Based on the predicted relative differences Confidence parameters and basic weights Determine the fusion weights .
[0012] Its further technical solution is to predict the relative difference. Confidence parameters and basic weights Determine the fusion weights Including calculations according to the following formula: .
[0013] A further technical solution is that the method for detecting water content in oil also includes: Obtain the validation dataset, which includes microwave and near-infrared spectral signals of multiple oil samples collected under different environmental conditions, as well as the true water content values of each oil sample. ; After extracting the microwave features from the microwave signals of each group of oil samples, the microwave features are input into the trained master prediction model to obtain the master predicted value of the oil sample. ; Feature extraction is performed on the near-infrared spectral signals of each group of oil samples to obtain spectral features, which are then input into a trained auxiliary prediction model to obtain auxiliary predicted values for the oil samples. ; Based on the master predicted values of the oil samples in each group With true water content The bias calculation yields the error variance of the main prediction model on the validation dataset. ; Based on the auxiliary predicted values of the oil samples in each group With true water content The bias calculation yields the error variance of the auxiliary prediction model on the validation dataset. .
[0014] A further technical solution involves performing frequency domain analysis and HiLo attention mechanism processing on the microwave signal of the oil to be detected to obtain microwave characteristics, including: The FreTS model is used to perform time-frequency domain transformation on the microwave signal of the oil to be tested to enhance the characterization of key frequency components. Then, the HiLo attention mechanism is used to focus on local details through the high-frequency path and model the global structure through the low-frequency path. The outputs of the high-frequency path and the low-frequency path are spliced together in the feature dimension to obtain the microwave features.
[0015] A further technical solution involves extracting spectral features from the near-infrared spectral signal of the oil to be tested, including: Principal component analysis was performed to reduce the dimensionality of the near-infrared spectral signal of the oil to be tested, followed by UMAP nonlinear dimensionality reduction extraction to obtain spectral features.
[0016] The further technical solution is that the main prediction model is trained based on MLP, SVR or random forest model, and the auxiliary prediction model is trained based on gradient boosting tree, ELM or one-dimensional convolutional neural network.
[0017] The beneficial technical effects of this application are: This application discloses a method for detecting water content in oil based on multimodal data fusion. This method constructs a dual prediction model to obtain two predicted values based on microwave and near-infrared spectral signals, respectively. Then, based on the model performance parameters of the two models and the real-time prediction dynamic differences, the fusion weights are dynamically adjusted. Finally, the main predicted value is weighted and output after residual correction using confidence level judgment, and then combined with the auxiliary predicted value. This method combines the advantages of microwave and near-infrared spectral signals, fusing their complementary features. Combined with a residual enhancement mechanism, it improves the sensitivity and robustness of water content detection in oil. This method is highly automated, requires no manual intervention, and is highly intelligent and embeddable. It can be embedded into embedded processing systems for online oil detection to achieve real-time predictive output.
[0018] This method employs a two-stage adaptive fusion strategy: first, it calculates the residual correction term based on the difference in predictions between the two models and their confidence levels. For the main forecast value The model is optimized; then the basic weights are determined based on the historical error variance of the two models, and the fusion ratio is dynamically adjusted in combination with the real-time prediction difference. Finally, the predicted value of water content in oil is output through weighted fusion, which can make more precise use of heterogeneous information, thus achieving a significant improvement in both prediction accuracy and robustness.
[0019] This method utilizes principal component analysis, nonlinear dimensionality reduction, and frequency domain statistics to extract highly expressive structural features, accurately capturing subtle changes in water content in oil. It has higher resolution in low water content ranges and is suitable for demanding detection scenarios in complex oil systems.
[0020] This method has good versatility and scalability, and can flexibly integrate different modeling strategies (such as neural networks, extreme learning machines, support vector machines, etc.). It also supports adaptive adjustment of residuals based on environmental factors (such as temperature and oil sample type), making it suitable for building online detection systems for multiple environments and oil types. Attached Figure Description
[0021] Figure 1 This is a flowchart of a method for detecting water content in oil according to an embodiment of this application.
[0022] Figure 2 This is a schematic diagram of the microwave feature extraction process in one embodiment of this application.
[0023] Figure 3 This is a schematic diagram of the spectral feature extraction process in one embodiment of this application.
[0024] Figure 4 This is an embodiment of the present application for calculating residuals. A schematic diagram of the method.
[0025] Figure 5 This is a flowchart of a method for calculating the error variance of two models using a validation dataset in one embodiment of this application. Detailed Implementation
[0026] The specific embodiments of this application will be further described below with reference to the accompanying drawings.
[0027] This application discloses a method for detecting water content in oil based on multimodal data fusion. Please refer to [link / reference]. Figure 1 The flowchart shown illustrates the method for detecting water content in oil, which includes: Step 110: Collect microwave signals and near-infrared spectral signals of the oil to be tested.
[0028] In one embodiment, the near-infrared spectral signal of the oil to be tested is an absorbance sequence with an output wavelength range of 800 nm to 2500 nm.
[0029] Step 120: Extract microwave features from the microwave signal of the oil to be detected, and input them into the pre-trained master prediction model to obtain the master prediction value. .
[0030] In one embodiment, when extracting features from microwave signals, the FreTS model is first used to perform time-frequency domain transformation on the microwave signal of the oil to be detected, and key patterns in the signal are captured through frequency domain analysis to enhance the characterization of key frequency components. Then, the HiLo attention mechanism is used to focus on local details through the high-frequency path and model the global structure through the low-frequency path. The outputs of the high-frequency and low-frequency paths are then concatenated in the feature dimension to obtain the microwave features. Please refer to [reference needed]. Figure 2 The flowchart shown is a schematic diagram of microwave feature extraction. (1) FreTS model part The core idea of the FreTS model is to transform the time-domain signal into the frequency domain for processing, fully utilizing the global view and energy compression characteristics provided by frequency domain analysis to more effectively capture key discriminative patterns in the signal. For the task of identifying the oil content of univariate microwave signals, the frequency-domain time learner is selected as the feature extraction component.
[0031] The constructed model mainly consists of three parts. First, the input microwave signal is subjected to dimensional expansion. The microwave signal input to the model is... That is, it contains one sequence. Microwave signals with timestamps are compared with learnable weight vectors. The enhanced hidden representation is obtained after multiplication. This operation can enhance the model's representational capabilities by mapping the original microwave signal to a higher-dimensional semantic space.
[0032] Next, a time-frequency domain transformation is performed to convert the extended signal. Applying the Discrete Fourier Transform along the time dimension converts it to a frequency domain representation. ,in and denoted by , where are the real and imaginary parts respectively, and j is the imaginary parameter. The time-frequency domain transformation formula is as follows:
[0033] in for The real part, for The imaginary part, Let v be the frequency and v be the time variable.
[0034] Finally, a frequency-domain multilayer perceptron (MLP) module is introduced. This module directly performs linear transformations and nonlinear activations on the complex components in the frequency domain through complex weight matrices and bias terms. This design not only preserves the phase information of the frequency components but also enhances the expression of key frequency components through nonlinear transformations in the complex domain. The complex weights and biases are respectively... and The specific formula is as follows:
[0035] in , , and These are the real and imaginary parts of the complex number weights and biases mentioned earlier. Final output Right now Input for the HiLo section.
[0036] (2) HiLo part First, the signal input to the HiLo section is divided into multiple segments to reduce computational complexity. This also lays the foundation for capturing local high-frequency details in the Hi-Fi path and capturing the global low-frequency structure in the Lo-Fi path. Hi-Fi focuses on capturing the local details and transient characteristics of the signal. For each segment, the processing flow is as follows: First, a multi-head attention mechanism is adopted, using Each independent attention head projects each segment into a query, key, and value matrix respectively: ,in , and Each is a learnable parameter. The input is divided into segments.
[0037] Next, scaling dot product attention is calculated within each segment. For the h-th attention head, the following holds:
[0038] in, It is the number of hidden dimensions in the head.
[0039] Finally, the outputs of all attention heads are concatenated along the feature dimension to form the high-frequency feature representation of this segment:
[0040] in, These are learnable parameters.
[0041] Lo-Fi focuses on modeling the global structure, long-term dependencies, and overall trend patterns of signals. The process is as follows: First, perform a one-dimensional average pooling operation on each segment to extract the low-frequency components of the signal:
[0042] Where s is the number of consecutive time steps contained in each pooling window, m is the relative position number within the pooling window, and c is the number of channels.
[0043] Subsequently, using Differential projection is performed using individual attention heads: the key and value matrices (K, V) are derived from the compressed signal, while the query matrix (Q) remains derived from the original signal. .
[0044] Next, attention calculation will be performed:
[0045] Finally, the outputs of all attention heads are concatenated along the feature dimension to form a low-frequency feature representation:
[0046] After processing the high-frequency and low-frequency paths, the outputs of the high-frequency and low-frequency paths are concatenated along the feature dimension to form a comprehensive feature representation. Finally, it is used as a microwave feature.
[0047] The master prediction model is pre-trained based on an MLP (Multilayer Perceptron), SVR (Support Vector Regression), or Random Forest model. Before use, the master prediction model needs to be trained. During training, a training dataset is collected, including microwave signals of multiple oil samples collected under different environmental conditions and their corresponding true water content values. The microwave features extracted from the microwave signals of each oil sample are used as input to the master prediction model. The deviation between the true water content value of the oil sample and the output of the master prediction model is calculated to obtain the loss function. The model parameters are then adjusted through backpropagation until the master prediction model is successfully trained.
[0048] Step 130: Extract spectral features from the near-infrared spectral signal of the oil to be tested, and input them into the pre-trained auxiliary prediction model to obtain auxiliary prediction values. .
[0049] In one embodiment, when extracting features from near-infrared spectral signals, principal component analysis is first performed on the near-infrared spectral signal of the oil to be tested to reduce its dimensionality, followed by UMAP nonlinear dimensionality reduction to extract its feature structure, thereby obtaining the key spectral features. Please refer to [reference needed]. Figure 3 The flowchart shown is a schematic diagram of the spectral feature extraction process: (1) Principal component analysis section Let each characteristic value of the near-infrared spectral signal be... First, the near-infrared spectral signal is decentered. ,in To calculate the covariance matrix, we obtain the average value. The covariance matrix is obtained. Then, the eigenvalues and eigenvectors are solved, arranged in descending order of eigenvalues, and the order of the eigenvectors is adjusted. Finally, the variance contribution rate is calculated. , Here, is the eigenvalue of the k-th principal component, and n is the original number of features. After calculating the variance contribution rate, the number of principal components k is selected, with the minimum number of k chosen so that the cumulative variance contribution rate reaches a preset threshold. For near-infrared spectral signals, the threshold is generally above 95%, which requires the cumulative variance of the selected k components to reach 95%. The first k eigenvectors are selected to form the feature matrix. Finally, the centered spectral data is projected onto the principal component space: Complete PCA dimensionality reduction.
[0050] (2) Nonlinear dimensionality reduction part The UMAP nonlinear dimensionality reduction method is adopted.
[0051] The first step is to construct a fuzzy topology in the high-dimensional space, representing the complex relationships between high-dimensional data points as a weighted graph. For each data point... Find its nearest n_neighbors points, let Generally, smaller k-values emphasize local structure and are suitable for situations with obvious clustering, while larger k-values emphasize global structure and are suitable for continuous manifold data. For data points... Calculate its distance to its nearest point distance Ensure that at least one point is connected to the data point. There is a valid link; the formula is as follows:
[0052] The scale parameter was then solved using a binary search. This satisfies the following formula:
[0053] This formula can ensure the point... The sum of the weighted connection strengths of its k neighbors is It adaptively adjusts the local scale parameters of each point to adapt to regions with different densities.
[0054] Then, a fuzzy similarity relationship is constructed, and points are defined. and Conditional probability between:
[0055] In this formula, if the data points and The closer the distance, the higher the similarity, which is closer to 1; the farther the distance, the lower the similarity, which is closer to 0. This allows us to convert high-dimensional distance into fuzzy similarity, establish a weighted relationship network, and achieve a non-linear transformation from distance to probability.
[0056] Finally, symmetricization yields the joint probability:
[0057] in Midpoint of high-dimensional space and points The similarity between them, and Not necessarily equal to This allows asymmetric relationships to be transformed into symmetric relationships, thus constructing a complete fuzzy topological graph.
[0058] In this way, we obtain a fuzzy topological graph that can capture the local and global structure of the data, accurately describing the local similarity relationships between data points.
[0059] The second step is to prepare a basic framework in a low-dimensional space to provide a starting point for the optimization process, by randomly generating initial low-dimensional coordinates. , For the required target dimension.
[0060] The third step is to mimic the relationships in the high-dimensional space within the low-dimensional space, using iterative optimization to make the low-dimensional relationships approximate the high-dimensional relationships. Specifically: First, calculate the low-dimensional similarity. In the low-dimensional space, points... and The similarity between them is defined by the following function:
[0061] The values of a and b are determined through the following steps: First, select parameters based on signal characteristics. and These two parameters control the degree of point clustering and the rate of similarity decay, respectively. These two parameters also define a target curve, as follows:
[0062] This target curve reflects UMAP's expectation of similarity in low-dimensional space: Points within 1 / 3 of a given value are considered perfectly similar (similarity = 1), while those beyond 1 / 3 are considered completely similar (similarity = 1). The similarity then decays exponentially with increasing distance, eventually approaching 0, and the rate of decay is... This control feature allows points to be clustered tightly while focusing only on important local connections and ignoring unimportant long-range connections, resulting in clear and faithful visualizations.
[0063] Then, by continuously modifying the values of parameters a and b using the nonlinear least squares method, a low-dimensional similarity function is constructed. To continuously fit ,make It exhibits the attenuation characteristics of this curve.
[0064] Then define the loss function: This loss function measures high-dimensional similarity. and low-dimensional similarity The difference between them can be minimized by minimizing this function, so that the relationship in the low-dimensional space can be as close as possible to the relationship in the high-dimensional space, thus maintaining the similarity of the data during the dimensionality reduction process.
[0065] The low-dimensional embedding is then iteratively updated using gradient descent. The gradient calculation formula is as follows:
[0066] in,
[0067] The gradient consists of two parts. Indicates the strength of the similarity difference. Indicates the direction of movement. If This indicates that the distance in the lower dimension is too far, and therefore requires... Bundle Pull towards The direction, and vice versa If the distance is too close in a lower dimension, then it is necessary to... Bundle Push away The direction.
[0068] The final iteration updates the low-dimensional coordinates:
[0069] in The learning rate parameter controls the update step size. After multiple iterations, a low-dimensional relational network is formed. Gradually approaching a higher-dimensional relationship network .
[0070] The fourth step is to stop the optimization when the loss function converges or the maximum number of iterations is reached, thus obtaining the final low-dimensional coordinates. These are spectral characteristics.
[0071] The auxiliary prediction model is trained based on gradient boosting trees, ELM (Extreme Learning Machine), or one-dimensional convolutional neural networks (1D-CNN). Before use, this auxiliary prediction model needs to be trained. During training, a training dataset is collected, including near-infrared spectral signals of multiple oil samples collected under different environmental conditions, along with the corresponding true water content values. The spectral features extracted from the near-infrared spectral signals of each oil sample are used as input to the auxiliary prediction model. The deviation between the true water content value of the oil sample and the output of the auxiliary prediction model is calculated to obtain the loss function. The model parameters are then adjusted through backpropagation until the auxiliary prediction model is successfully trained.
[0072] Step 140: Combining the model performance parameters of the main prediction model and the auxiliary prediction model, as well as the current prediction differences, the main prediction value is evaluated based on the confidence level judgment mechanism. Perform residual correction as And dynamically determine the fusion weights. .
[0073] After training the primary and secondary prediction models, this application further evaluates the performance parameters of each model and combines them with the primary prediction value. With auxiliary predicted values The residual is calculated from the difference in predictions between them. and fusion weight The model performance parameters used in this embodiment represent the historical error fluctuations of the model. In one embodiment, the model performance parameter used is the error variance. Calculate the residuals. and fusion weight Please refer to the following steps. Figure 4 The flowchart shown is as follows: (1) First, based on the model performance parameters of the main prediction model and the auxiliary prediction model, and the main prediction value... With auxiliary predicted values absolute differences between Calculate the standardized difference index This standardized difference index The influence of dimensions has been eliminated, and this method is used to measure the significance of the absolute difference between the two current predicted values relative to the historical error fluctuations of the model. The calculation formula is as follows:
[0074] in, It is the error variance of the main prediction model on the validation dataset. It is the error variance of the auxiliary prediction model on the validation dataset.
[0075] (2) Based on standardized difference indicators Calculate the confidence parameter This confidence parameter This is used to quantify the degree of randomness in the current prediction discrepancy between the primary and auxiliary prediction models. If the current prediction discrepancy between the two models is small, the prediction error is considered random, and the model output is corrected. If the current prediction error is large, it indicates a systematic error, requiring correction. Based on this, the standard normal distribution probability density function with normalization coefficients omitted is used to calculate the confidence parameter. The calculation formula is:
[0076] (3) Combine the model performance parameters and confidence parameters of the main prediction model and the auxiliary prediction model. For the main forecast value Perform residual correction, residual The calculation formula is:
[0077] Among them, the fusion weight The fusion weight is calculated based on the relative proportion of the error variances of the two models, and is mainly used to quantify the relative reliability of the primary and secondary prediction models. The larger the error variance of the primary prediction model, the larger its proportion, and the higher the fusion weight. The larger the value of , the greater the residual. The larger the value, the more adjustments are needed to the master forecast. Significant adjustments are made. Conversely, the larger the error variance of the auxiliary prediction model, the smaller the proportion of the error variance of the main prediction model, and the greater the weighting of the fusion. The smaller the value of , the better the residual. The smaller the value, the more likely it is that only the master predictor is needed. Make minor adjustments.
[0078] Confidence parameter and fusion weight Together they determine the degree of the main forecast value In the case of residual correction, confidence parameters The decision of whether or not to make corrections is essentially a decision-making process, while the fusion of weights... This determines the size of the correction.
[0079] (4) Combine the model performance parameters and confidence parameters of the main prediction model and the auxiliary prediction model. Determine the fusion weights Specifically: First, determine the basic weights based on the performance parameters of the main prediction model and the auxiliary prediction model. This basic weight It is the optimal linear unbiased estimate (BLUE), which satisfies the Gauss-Markov theorem and minimizes the error variance of the fusion result. It is also the globally optimal solution under the minimum mean square error criterion (MMSE). The core logic is that "the smaller the error, the larger the weight." When the model is small, if the master predictor performs better, the base weights will account for the majority of the weights; otherwise, the base weights will account for a smaller portion.
[0080] Then the master forecast value was calculated. With auxiliary predicted values Relative differences in predictions between The relative difference in the prediction The degree of inconsistency between the two models' predictions was quantified.
[0081] Finally, based on the predicted relative differences Confidence parameters and basic weights Determine the fusion weights The calculation formula is:
[0082] The calculation formula employs an exponential decay adjustment mechanism, when predicting relative differences... When it is smaller, it indicates the main predicted value. With auxiliary predicted values If the difference between the two is not significant, it indicates that the prediction result is relatively accurate. Therefore, the relative difference in predictions should be utilized. and confidence parameters For basic weights Adjustments are made to obtain the fusion weights. And when the relative difference is predicted When it increases, it indicates the master forecast value. With auxiliary predicted values The difference between them is quite large. and confidence parameters The combined effect will integrate the weights To move towards an even distribution, a conservative strategy should be adopted.
[0083] Step 150, using fusion weights Master forecast after residual correction With auxiliary predicted values Data fusion was performed to obtain the water content detection results in the oil to be tested. The calculation formula is:
[0084] As can be seen from the above description, step 140 requires the model's error variance on the validation dataset. Therefore, after training the main prediction model and the auxiliary prediction model, this method also includes a step of evaluating the error variance of the two models on the validation dataset, which includes the following content. Please refer to [link / reference]. Figure 5 The flowchart shown: Step 310: Obtain the verification dataset.
[0085] The obtained validation dataset includes microwave and near-infrared spectral signals of multiple oil samples collected under different environmental conditions, as well as the true water content values of each oil sample. The total number of sample oil groups included in the validation dataset is denoted as . .
[0086] Step 320: After extracting the microwave features from the microwave signals of each group of sample oils, the microwave features are input into the trained master prediction model to obtain the master predicted value of the sample oil. The feature extraction process here is the same as step 120 above, and will not be repeated here.
[0087] Step 330: After extracting the spectral features from the near-infrared spectral signals of each group of sample oils, the spectral features are input into the trained auxiliary prediction model to obtain the auxiliary predicted values of the sample oils. The feature extraction process here is the same as step 130 above, and will not be repeated here.
[0088] Step 340: Based on the master predicted values of the oil samples in each group. With true water content The bias calculation yields the error variance of the main prediction model on the validation dataset. The calculation formula is:
[0089] in, It is to verify any number of elements in the dataset. The true value of water content in the oil of the group of samples. It is to verify any number of elements in the dataset. The master predicted value of the oil in the sample group.
[0090] Step 350: Based on the auxiliary predicted values of the oil samples in each group. With true water content The bias calculation yields the error variance of the auxiliary prediction model on the validation dataset. The calculation formula is:
[0091] in, It is to verify any number of elements in the dataset. Auxiliary predicted values for oil samples.
[0092] The above descriptions are merely preferred embodiments of this application, and this application is not limited to the above embodiments. It is understood that other improvements and variations that can be directly derived or conceived by those skilled in the art without departing from the spirit and concept of this application should be considered to be included within the protection scope of this application.
Claims
1. A method for detecting water content in oil based on multimodal data fusion, characterized in that, The method for detecting the water content in the oil includes: Microwave and near-infrared spectral signals of the oil to be tested were collected; The microwave signal of the oil to be detected is subjected to frequency domain analysis and HiLo attention mechanism processing to obtain microwave features, which are then input into a pre-trained master prediction model to obtain the master prediction value. ; Feature extraction is performed on the near-infrared spectral signal of the oil to be tested to obtain spectral features, which are then input into a pre-trained auxiliary prediction model to obtain auxiliary prediction values. ; Based on the combined performance parameters of the primary and auxiliary prediction models and the current prediction discrepancies, the primary prediction value is evaluated using a confidence level assessment mechanism. Perform residual correction as And dynamically determine the fusion weights. The water content in the oil to be tested was obtained. , Represents the residual.
2. The method for detecting water content in oil according to claim 1, characterized in that, The method for detecting water content in oil also includes: Based on the performance parameters of the primary and auxiliary prediction models, and the primary prediction value... With auxiliary predicted values absolute differences between Calculate the standardized difference index And obtain the confidence parameters. Confidence parameter Used to quantify the degree of randomness in the current prediction discrepancies between the primary and secondary prediction models; The performance parameters and confidence parameters of both the main prediction model and the auxiliary prediction model are combined. For the main forecast value Perform residual correction and determine fusion weights .
3. The method for detecting water content in oil according to claim 2, characterized in that, The model performance parameter is the error variance; the standardized variance index is calculated. And obtain the confidence parameters. Including calculations according to the following formula: in, It is the error variance of the main prediction model on the validation dataset. It is the error variance of the auxiliary prediction model on the validation dataset.
4. The method for detecting water content in oil according to claim 2, characterized in that, The model performance parameter is the error variance, which is a combination of the performance parameters of the main prediction model and the auxiliary prediction model, as well as the confidence parameter. For the main forecast value Residual correction includes calculating the residuals according to the following formula. : in, .
5. The method for detecting water content in oil according to claim 2, characterized in that, The model performance parameter is the error variance, which is a combination of the performance parameters of the main prediction model and the auxiliary prediction model, as well as the confidence parameter. Determine the fusion weights include: The basic weights are determined based on the performance parameters of the primary forecasting model and the auxiliary forecasting model, respectively. And calculate the master forecast value. With auxiliary predicted values Relative differences in predictions between ; It is the error variance of the main prediction model on the validation dataset. It is the error variance of the auxiliary prediction model on the validation dataset; Based on the predicted relative differences Confidence parameters and basic weights Determine the fusion weights .
6. The method for detecting water content in oil according to claim 5, characterized in that, Based on the predicted relative differences Confidence parameters and basic weights Determine the fusion weights Including calculations according to the following formula: 。 7. The method for detecting water content in oil according to any one of claims 3-6, characterized in that, The method for detecting water content in oil also includes: Obtain the validation dataset, which includes microwave and near-infrared spectral signals of multiple oil samples collected under different environmental conditions, as well as the true water content values of each oil sample. ; After extracting the microwave features from the microwave signals of each group of oil samples, the microwave features are input into the trained master prediction model to obtain the master predicted value of the oil sample. ; Feature extraction is performed on the near-infrared spectral signals of each group of oil samples to obtain spectral features, which are then input into a trained auxiliary prediction model to obtain auxiliary predicted values for the oil samples. ; Based on the master predicted values of the oil samples in each group With true water content The bias calculation yields the error variance of the main prediction model on the validation dataset. ; Based on the auxiliary predicted values of the oil samples in each group With true water content The bias calculation yields the error variance of the auxiliary prediction model on the validation dataset. .
8. The method for detecting water content in oil according to claim 1, characterized in that, The microwave characteristics obtained by frequency domain analysis and HiLo attention mechanism processing of the microwave signal of the oil to be tested include: The FreTS model is used to perform time-frequency domain transformation on the microwave signal of the oil to be tested to enhance the characterization of key frequency components. Then, the HiLo attention mechanism is used to focus on local details through the high-frequency path and model the global structure through the low-frequency path. The outputs of the high-frequency path and the low-frequency path are spliced together in the feature dimension to obtain the microwave features.
9. The method for detecting water content in oil according to claim 1, characterized in that, The spectral features obtained by feature extraction of the near-infrared spectral signal of the oil to be tested include: Principal component analysis was performed to reduce the dimensionality of the near-infrared spectral signal of the oil to be tested, followed by UMAP nonlinear dimensionality reduction extraction to obtain spectral features.
10. The method for detecting water content in oil according to claim 1, characterized in that, The main prediction model is trained based on MLP, SVR or random forest models, and the auxiliary prediction model is trained based on gradient boosting tree, ELM or one-dimensional convolutional neural network.