Cross-domain self-adaptive Raman spectrum rapid detection method and related equipment
By employing a cross-domain adaptive Raman spectroscopy detection method and utilizing self-supervised contrastive learning and a joint characterization model of domain adversarial approaches, the problem of rapid, comparable, and quantifiable detection of transformer oil samples across different sites and instruments was solved. This achieved sub-millisecond response time and accurate quantification, while reducing the cost of model aging and maintenance.
Patent Information
- Application Number
- CN202511760971.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-17
AI Technical Summary
Existing technologies cannot achieve rapid, comparable, and quantifiable testing across sites and instruments in transformer oil sample testing. They suffer from problems such as differences in instrument response functions, differences in baseline and peak shape, high computational overhead, and poor model stability.
A cross-domain adaptive Raman spectroscopy rapid detection method is adopted. Through self-supervised contrastive learning and domain adversarial joint representation model, cross-domain invariant representation is performed. Combined with generative reconstruction network and sparse unmixing, rapid, comparable and quantifiable detection of transformer oil samples is achieved. The accuracy and stability of the detection are ensured by hierarchical Bayesian self-calibration and quality control mechanism.
Significantly reduces the impact of instrument/site differences, achieves sub-millisecond response time, provides absolute values and confidence intervals of component concentrations, reduces the need for on-site calibration, ensures the interpretability and verifiability of test results, and reduces model aging and maintenance costs.
Smart Images

Figure CN121540690A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical sensing systems, and more specifically to a cross-domain adaptive rapid Raman spectroscopy detection method and related equipment. Background Technology
[0002] The composition and content of dissolved gases and degradation byproducts (such as H2, CH4, C2H2, CO, CO2, etc.) in transformer oil can reflect the partial discharge, overheating, and moisture conditions of the equipment. Raman spectroscopy has advantages such as simple sample preparation, fast response speed, and suitability for online detection, and has attracted attention in rapid oil sample screening. Current engineering practices typically employ a process of "spectral preprocessing + feature extraction + chemometric modeling"; to improve generalization, simple calibration transfer and standardization are also introduced to mitigate differences between different instruments / sites.
[0003] However, the strong fluorescence of oil sample matrices, the significant overlap of peak shapes, and the large differences in the scattering cross-sections of target components often lead to the following common problems in cross-site, cross-instrument, and cross-batch scenarios:
[0004] Differences in baseline and peak shape caused by different instrument response functions, optical path strays, and temperature and humidity variations result in incomparable spectral shapes for the same chemical component at different sites;
[0005] It is difficult to obtain sufficient and uniformly covered standard addition data on-site, causing traditional monitoring models to quickly become inaccurate in new domains.
[0006] Conventional standardization or linear transfer makes it difficult to simultaneously align peak position, peak width, and relative intensity, affecting subsequent unmixing and quantification.
[0007] Full-spectrum or large-scale ROI segment-by-segment processing introduces unnecessary computational overhead, making it difficult to meet sub-millisecond response times;
[0008] Most models only output point estimates, without confidence intervals or detection / quantitation limit assessments, which is not conducive to online decision-making and alarm threshold setting;
[0009] Equipment aging and seasonal environmental changes cause slow drift in input distribution. The lack of adaptive testing and version control mechanisms makes it difficult to guarantee model stability in the long term. Summary of the Invention
[0010] The technical problem to be solved by this invention is that rapid, comparable, and quantifiable detection of transformer oil samples cannot be achieved in real engineering environments. The purpose is to provide a cross-domain adaptive Raman spectroscopy rapid detection method and related equipment, which solves the problem of how to achieve rapid, comparable, and quantifiable detection of transformer oil samples when only a very small amount of standard samples are available.
[0011] This invention is achieved through the following technical solution:
[0012] A cross-domain adaptive rapid detection method for Raman spectroscopy includes:
[0013] The raw Raman spectrum of the transformer oil sample was obtained and subjected to routine preprocessing to obtain the preprocessed spectrum. ;
[0014] A self-supervised contrastive learning and domain adversarial representation model is constructed based on preprocessed spectra from multiple sites, instruments, and batches, and then applied online. The input to the representation model yields a cross-domain invariant representation vector. ;
[0015] Based on generative reconstruction networks Mapped to standard domain spectrum ;
[0016] For a predefined set of spectral bands of interest (ROI), according to the upper confidence bound of information gain... The size of the ROI is adaptively selected for spectral band processing, and the overall confidence level of the components is not lower than a preset threshold. And the global uncertainty does not exceed a preset threshold. If early termination is triggered, the current candidate component set is output.
[0017] Reference distillations for different operating scenarios are distilled into a unified standard domain dictionary using domain mapping operators. and in Solving the weighted nonnegative sparse unmixing algorithm yields the relative concentration vectors of each target component. The unmixing objective function includes a reconstruction error term, Sparse regularization and group sparse regularization;
[0018] Based on a small number of on-site standard samples, hierarchical Bayesian self-calibration was performed to establish... relative to the absolute concentration of each component The cross-domain mapping relationship is determined, and temperature, humidity, exposure time and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration of each component and its confidence interval.
[0019] When performing constrained testing during the inference phase, the system is adaptive, updating only the normalized or affine layer parameters to minimize entropy or consistency loss, and setting up quality control and rollback steps.
[0020] Output the target component set, relative and absolute concentrations, corresponding confidence intervals, selected ROI sequence, reasons for premature termination, and quality control indicators;
[0021] Wherein: the standard fingerprint database is composed of the peak position, full width at half maximum (FWHM), and peak intensity statistics of historical standard samples in the standard domain; , The quality control thresholds are stored as preset parameters, including the anchoring peak position deviation threshold. Peak intensity relative deviation threshold Goodness-of-fit threshold With error threshold .
[0022] Furthermore, the self-supervised contrastive learning constructs positive and negative sample pairs by perturbing the baseline, scaling the intensity, shifting the small peak positions, and injecting noise into the same spectrum to learn domain-invariant features, and suppresses domain information through gradient inversion; wherein:
[0023] For each preprocessed spectrum, at least two enhanced views are constructed, including baseline perturbation, intensity scaling, peak shifting, and noise injection. The temperature parameter of the contrast loss is set to 0.05–0.2, and the proportion of negative samples is not less than 50% of the batch size. The domain adversarial layer adopts a gradient inversion layer, the domain discriminator loss weight is set to 0.1–0.3, the representation vector dimension is 64–256, and an early stopping strategy is adopted with the domain discrimination accuracy on the validation set not exceeding 60% as the stopping condition.
[0024] Furthermore, the standard domain is defined by a pre-set standard fingerprint library, and the reconstruction network is constrained by a peak-sensitive loss composed of peak position bias, full width at half maximum (FWHM) bias, and peak intensity bias, so that... The reconstruction network maintains peak shape consistency with the standard fingerprint in each spectral segment of interest. It is a generative reconstruction network with peak-sensitive constraints, wherein the ratio of the three error weights (peak position, full width at half maximum, and peak intensity) is set to 2:1:1 in each spectral segment of interest. When the peak position deviation of the reconstructed anchor peak exceeds 1.5 cm⁻¹ or the relative deviation of the full width at half maximum exceeds 10%, parameter rollback of the reconstruction network is triggered. The generative network includes a cyclic consistency branch, with a cyclic consistency loss weight of 0.5–1.5 and an identity preservation loss weight of 0.1–0.5.
[0025] Furthermore, the selection of ROI for spectral segment processing and early termination decision adopts a sequential selection strategy based on upper confidence bounds: for each spectral segment of interest, the average revenue and usage frequency are statistically maintained, spectral segments are processed sequentially according to the upper confidence bound priority, and the minimum number of spectral segments processed and the maximum processing delay are limited to no more than preset values; when the overall confidence of the component reaches 0.70 to 0.85 and the global uncertainty is no higher than 0.15 to 0.25, the process is terminated early, and the current candidate component set and the reason for early termination are output.
[0026] Furthermore, the unified standard domain dictionary and sparse demixing include: normalizing the reference dictionaries of each scenario to the standard domain using a domain mapping operator, then performing unit norm transformation on the column vectors, and introducing group sparsity regularization for highly collinear components of the same family; the sparse coefficients of the demixing target range from [value missing]. , group sparsity coefficient for The weighting matrix is constructed based on the noise variance and segment weight of each spectral segment, and the unmixing coefficients are subject to non-negativity constraints. The solution is obtained through coordinate descent or weighted non-negative least squares iteration until the relative residual decreases to less than 1%.
[0027] Furthermore, the hierarchical Bayesian self-calibration sets Gaussian priors for calibration parameters at the site level, with the prior mean obtained from historical cross-domain data and the prior variance estimated from cross-domain residuals. The number of on-site calibration samples is no less than 3. The covariate correction includes four items: temperature, humidity, exposure time, and laser power, with temperature and humidity corrected using multiplicative coefficients. Variational inference or Markov chain Monte Carlo methods are used to solve the posterior, and a 95% confidence interval is used as the uncertainty output for the absolute concentration of each component. At the same time, the detection limit is given according to the three-times-noise criterion for blank samples, and the quantitation limit is given according to the criterion that the relative standard deviation is no higher than 10%.
[0028] Furthermore, the quality control and rollback steps include: when the relative deviation of the anchor peak position and peak intensity exceeds a preset threshold or the goodness of fit is lower than a preset threshold, rolling back to the previous stable parameter and downgrading the process; wherein,
[0029] During testing, adaptive updates are only allowed for normalized or affine layer parameters, with a single step size not exceeding 1×10⁻³. If two consecutive quality control failures occur, the system will revert to the previous stable parameter. Quality control thresholds include at least: anchoring peak position deviation threshold of 1.5cm⁻¹, peak intensity relative deviation threshold of 10%, weighted goodness-of-fit threshold of R²≥0.96, and weighted root mean square error not exceeding 1.1 times that of the historical stable version. Drift detection is performed on the input distribution within the rolling window, and grayscale updates and version rollbacks are triggered when the population stability index or symmetry divergence exceeds the preset threshold.
[0030] The quality control and rollback process employs a three-level rollback mechanism, including:
[0031] When the quality control indicators fail to meet the standards for the first time, the testing process will be switched to a downgraded processing mode based solely on standard domain reconstruction and full-spectrum unmixing, and active ROI selection and adaptive updates during the testing period will be turned off.
[0032] If the quality control indicators fail to meet the standards again under the degradation processing mode, the model parameters and quality control thresholds will be reverted to the previous stable version, and adaptive updates will be temporarily frozen.
[0033] If the quality control indicators still fail to meet the standards after the rollback, a manual review alarm will be generated and the current test result will be marked as "requires manual confirmation".
[0034] The drift detection is based on the population stability index between the input sample feature distribution and the historical stable distribution. When the population stability index is greater than 0.25 for three consecutive statistical periods within a preset length of rolling statistical window, a significant distribution drift is determined, triggering the model grayscale update process. The old version is retained as a rollback backup before the new version passes the preset quality control verification.
[0035] This invention also provides a cross-domain adaptive Raman spectroscopy rapid detection system for implementing the cross-domain adaptive Raman spectroscopy rapid detection method described above, comprising:
[0036] The spectral input interface is used to receive raw Raman spectral data from transformer oil samples.
[0037] The spectral preprocessing module is used to perform preprocessing on the original spectrum sequentially and output the preprocessed spectrum. ;
[0038] The joint model module is used for joint model pairs based on self-supervised contrastive learning and domain adversarial learning. Feature extraction is performed to obtain cross-domain invariant representation vectors. ;
[0039] The standard domain reconstruction module is used to... Mapped to standard domain spectrum And within each ROI, peak-sensitive constraints are applied to peak position, full width at half maximum (FWHM), and peak intensity to make... Maintain peak shape consistency with the standard fingerprint database;
[0040] The proactive ROI selection and early termination control module is used to adaptively sort and select ROIs based on the upper confidence bound of information gain, ensuring that the overall confidence level of the components is not lower than a preset threshold. And the global uncertainty does not exceed a preset threshold. Early termination is triggered and the current candidate component set is output.
[0041] The domain mapping module is used to normalize the scenario reference dictionary to a standard domain using a domain mapping operator and perform column vector normalization to form a unified standard domain dictionary. ;
[0042] The relative concentration estimation module is used to estimate the relative concentration in the following ways: and A weighted nonnegative sparse unmixing model is established, including a reconstruction error term,
[0043] By solving for the sparse terms and group sparse terms, the relative concentration vectors of each target component can be obtained. ;
[0044] The Bayesian self-calibration module is used to add a small number of standards to the sample in the field. Mapped to absolute concentration Temperature, humidity, exposure time, and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration and its confidence interval.
[0045] The adaptive module is used to make limited updates to the normalized or affine layer parameters only during the inference phase to minimize entropy or consistency loss, and to fall back to the previous stable parameter when quality control fails.
[0046] The quality control module is used to... Anchoring peak position deviation was applied to the unmixed results. Peak intensity relative deviation Weighted goodness of fit With weighted root mean square error The threshold is determined, and if the threshold is not met, a downgrade process and rollback are triggered.
[0047] The output module is used to output the target component set, relative and absolute concentrations, confidence intervals, selected ROI sequence and reasons for early termination, and quality control indicators, and to record drift statistics, threshold triggering, grayscale and rollback information.
[0048] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the cross-domain adaptive Raman spectroscopy rapid detection method as described above. The memory stores program instructions executable on the processor, a standard fingerprint library, a scene reference dictionary, configuration and weights of spectral bands of interest, and preset threshold parameters. , , , , and .
[0049] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the cross-domain adaptive rapid detection method for Raman spectroscopy as described above.
[0050] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0051] This invention uses "domain-invariant characterization + standard domain reconstruction" to ensure that the peak position / peak width / relative intensity of key ROIs are consistent with the standard fingerprint database, significantly reducing the impact of instrument / site differences on identification and quantification. Hierarchical Bayesian self-calibration is employed to complete absolute concentration mapping with only 3–5 standard addition points, outputting a 95% confidence interval and providing LOD / LOQ, thus reducing the need for extensive on-site recalibration.
[0052] This invention employs an active ROI selection and early termination mechanism based on information gain. Processing is terminated early upon reaching confidence and uncertainty thresholds, allowing for a relatively short end-to-end P95 processing time. Within a standard domain, multi-scenario distillations are performed uniformly, and group sparsity constraints are introduced to reduce crosstalk from highly collinear components, thereby improving unmixing stability and detection accuracy when multiple components coexist.
[0053] This invention provides both confidence intervals and QC metrics for quantitative output, triggering degradation / rollback in case of anomalies to ensure that the online results are "explainable, auditable, and verifiable." During testing, adaptive (constrained parameter updates) combined with drift monitoring, canary releases, and version rollback maintain predetermined quality control thresholds even in scenarios with slow input distribution drift, reducing maintenance costs associated with model aging. Self-supervised contrastive learning and domain adversarial learning learn domain-invariant features under unlabeled / weakly labeled conditions, fully utilizing unlabeled field data and reducing reliance on large-scale manual annotation and frequent full retraining.
[0054] By forming a closed-loop process of "domain-invariant representation - standard domain reconstruction - proactive ROI / early termination - sparse demixing - few-sample self-calibration - TTA treatment", the overall effect is better than single-point algorithm improvement, enhancing adaptability and replicability to complex sites. Attached Figure Description
[0055] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0056] Figure 1 The offline preparation flowchart for the cross-domain adaptive Raman spectroscopy rapid detection method in Example 1 is shown below.
[0057] Figure 2 The above is an online detection flowchart of the cross-domain adaptive Raman spectroscopy rapid detection method in Example 1;
[0058] Figure 3 The flowchart shows the spectral selection and early termination rate of the cross-domain adaptive Raman spectroscopy rapid detection method in Example 1. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0060] Example 1
[0061] A cross-domain adaptive rapid detection method for Raman spectroscopy, such as Figure 1-3 As shown, it includes:
[0062] The raw Raman spectrum of the transformer oil sample was obtained and subjected to routine preprocessing to obtain the preprocessed spectrum. ;
[0063] A self-supervised contrastive learning and domain adversarial representation model is constructed based on preprocessed spectra from multiple sites, instruments, and batches, and then applied online. The input to the representation model yields a cross-domain invariant representation vector. ;
[0064] Based on generative reconstruction networks Mapped to standard domain spectrum ;
[0065] For a predefined set of spectral bands of interest (ROI), according to the upper confidence bound of information gain... The size of the ROI is adaptively selected for spectral band processing, and the overall confidence level of the components is not lower than a preset threshold. And the global uncertainty does not exceed a preset threshold. If early termination is triggered, the current candidate component set is output.
[0066] Reference distillations for different operating scenarios are distilled into a unified standard domain dictionary using domain mapping operators. and in Solving the weighted nonnegative sparse unmixing algorithm yields the relative concentration vectors of each target component. The unmixing objective function includes a reconstruction error term, Sparse regularization and group sparse regularization;
[0067] Based on a small number of on-site standard samples, hierarchical Bayesian self-calibration was performed to establish... relative to the absolute concentration of each component The cross-domain mapping relationship is determined, and temperature, humidity, exposure time and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration of each component and its confidence interval.
[0068] When performing constrained testing during the inference phase, the system is adaptive, updating only the normalized or affine layer parameters to minimize entropy or consistency loss, and setting up quality control and rollback steps.
[0069] Output the target component set, relative and absolute concentrations, corresponding confidence intervals, selected ROI sequence, reasons for premature termination, and quality control indicators;
[0070] Wherein: the standard fingerprint database is composed of the peak position, full width at half maximum (FWHM), and peak intensity statistics of historical standard samples in the standard domain; , The quality control thresholds are stored as preset parameters, including the anchoring peak position deviation threshold. Peak intensity relative deviation threshold Goodness-of-fit threshold With error threshold .
[0071] In this embodiment, the self-supervised contrastive learning constructs positive and negative sample pairs by perturbing the baseline of the same spectrum, scaling the intensity, shifting the small peak positions, and injecting noise to learn domain-invariant features. Domain adversarial learning suppresses domain information through gradient inversion; wherein:
[0072] For each preprocessed spectrum, at least two enhanced views are constructed, including baseline perturbation, intensity scaling, peak shifting, and noise injection. The temperature parameter of the contrast loss is set to 0.05–0.2, and the proportion of negative samples is not less than 50% of the batch size. The domain adversarial layer adopts a gradient inversion layer, the domain discriminator loss weight is set to 0.1–0.3, the representation vector dimension is 64–256, and an early stopping strategy is adopted with the domain discrimination accuracy on the validation set not exceeding 60% as the stopping condition.
[0073] This invention includes offline preparation and online detection stages, wherein the offline preparation stage includes preprocessing, which is performed on the raw spectrum according to industry-standard procedures:
[0074] Baseline subtraction (ALS is preferred in this embodiment, smoothing parameter) Penalty parameters ;
[0075] Smoothing / Denoising (In this embodiment, SG window 7–21 and order 2–3 are preferred; wavelet soft thresholding is used if necessary, and the threshold is set according to the noise MAD).
[0076] Normalization and scattering correction (vector normalization / MSC / SNV);
[0077] Micro-drift alignment (anchor peak alignment, maximum permissible drift) ).
[0078] In this implementation, the pre-configured resources (established during the offline preparation phase using historical standards and standard experimental procedures) include:
[0079] ROI configuration and weights: including center wavenumber, window width, allowable drift, and segment weights;
[0080] Standard fingerprint database Statistical values of peak position / full width at half maximum (FWHM) / peak intensity for each target component in the standard domain;
[0081] Scene dictionary A standard domain reference spectrum dictionary organized according to typical operating scenarios (normal / overload / overheating / moisture / gas content, etc.).
[0082] In this embodiment, the standard domain is defined by a pre-set standard fingerprint database, and the reconstruction network is constrained by a peak-sensitive loss composed of peak position bias, full width at half maximum (FWHM) bias, and peak intensity bias, so that... The reconstruction network maintains peak shape consistency with the standard fingerprint across all spectral segments of interest. It is a generative reconstruction network with peak-sensitive constraints, where the ratio of the error weights for peak position, full width at half maximum (FWHM), and peak intensity is set to 2:1:1 across each FWHM. When the peak position deviation of the reconstructed anchor peak exceeds 1.5 cm⁻¹ or the relative FWHM deviation exceeds 10%, parameter rollback of the reconstruction network is triggered. The generative network includes a cyclic consistency branch, with a cyclic consistency loss weight of 0.5–1.5 and an identity preservation loss weight of 0.1–0.5. Cross-domain invariant representation learning is achieved through self-supervised contrastive and domain adversarial methods.
[0083] Training data: multi-site / multi-instrument / multi-batch It may contain unlabeled samples.
[0084] Enhancement strategies: baseline perturbation, intensity scaling, and micro-shifting. Noise injection.
[0085] Loss function:
[0086] Domain-invariant representations are obtained through comparative learning of InfoNCE. ;
[0087] Suppress domain information leakage by using domain-adversarial DANN (gradient inversion layer);
[0088] The total loss is then expressed as:
[0089]
[0090] in, For contrastive learning (InfoNCE), contrastive loss is used. For Domain Adversarial Neural Network (DANN) adversarial loss (after gradient inversion layer); To counteract the loss weight (0.1–0.3).
[0091] Final output representation vector .
[0092] In this embodiment, peak fidelity constraints are used to achieve generative "standard domain" reconstruction, which is then used to map the field spectrum y to the standard domain spectrum. Make the peak position / peak width / peak intensity and Comparable; using unpaired data with CycleGAN or VAE-Cycle hybrid; a small number of pairs can enable supervised branches.
[0093] Peak sensitivity loss is expressed as:
[0094]
[0095]
[0096] in, Wave number, unit cm⁻¹; Peak position deviation of the k-th ROI. The half-width of the peak; The half-width deviation (relative or absolute); Peak intensity (one of the measures such as peak height / integral area); This refers to peak intensity deviation.
[0097] This represents the weighting ratio of the three factors in peak-sensitive loss.
[0098] In each spectral band of interest, the weight ratio of the three error terms—peak position, full width at half maximum (FWHM), and peak intensity—is set to 2:1:1. This is because the impact of peak position drift on component identification and quantification is far greater than the small changes in FWHM and peak intensity. Therefore, peak position error is given a higher weight in the loss function to prioritize ensuring the accuracy of peak alignment.
[0099] The total loss is expressed as:
[0100]
[0101]
[0102] in, The L1 reconstruction loss is for standard domain reconstruction; This is due to the loss of circular consistency. Loss in order to preserve one's identity. These are the weights corresponding to the losses.
[0103] Output: Standard domain spectrum And peak parameters.
[0104] In this embodiment, the average maintenance revenue and usage frequency of each spectral segment of interest are statistically analyzed. Segments are processed sequentially according to their upper confidence boundary priority, with a minimum number of segments processed and a maximum processing delay not exceeding preset values. The process terminates early when the overall confidence level of the components reaches 0.70–0.85 and the global uncertainty is no higher than 0.15–0.25, outputting the current candidate component set and the reason for early termination. This includes:
[0105] right upper confidence bounds (UCB, Optimize based on the validation set.
[0106] in, The expected gain of ROI on the current decision (historical statistics / model estimation); This represents the number of times the item has been used. To select a round; This refers to the exploration coefficients (calibrated on the validation set). The exploration coefficients are obtained through offline validation set parameter tuning, and their values are preferably between 0.5 and -2.0 to achieve a trade-off between convergence speed and exploration diversity.
[0107] Iterative selection Sample / compute the largest ROI;
[0108] When the confidence level of the components And global uncertainty Leaving work early.
[0109] in, Target component The overall confidence level (integrated by similarity / residual gain / ROI coverage, etc.); The early retirement confidence threshold is (preferably 0.70–0.80). The global uncertainty threshold is (preferably 0.15–0.25).
[0110] Constraint: Total processing time for P95 ms.
[0111] In this implementation, the unified standard domain dictionary and sparse demixing include: normalizing each scenario reference dictionary to the standard domain using a domain mapping operator, then performing column vector unit norm normalization, and introducing group sparsity regularization for highly collinear components of the same family; the sparse coefficients of the demixing target range from [value missing]. , group sparsity coefficient for The weighting matrix is 0.2 to 0.5 times the noise variance of each spectral band and the segment weights. The unmixing coefficients are subject to non-negativity constraints and are solved through coordinate descent or weighted non-negative least squares iterations until the relative residual decreases by less than 1%. Specifically,
[0112] Distillation of scene diction Through mapping operators Distillation to a unified standard field dictionary , minimize:
[0113]
[0114] in, The weight of the dictionary consistency term in dictionary distillation. These are the 2-norm and the Frobenius norm, respectively.
[0115] The unmixing solution involves: weighted nonnegative least squares and L1 / group sparsity regularization to obtain the relative concentration. If necessary, prune low-confidence components and then back-substitute to resolve.
[0116] In this implementation, hierarchical Bayesian self-calibration (quantitative and uncertain) achieves cross-domain quantitative transfer with minimal standard input data, providing confidence intervals. The hierarchical Bayesian self-calibration sets Gaussian priors for calibration parameters at the site level, with the prior mean obtained from historical cross-domain data and the prior variance estimated from cross-domain residuals. The number of on-site calibration samples is no less than three. Covariate correction includes four items: temperature, humidity, exposure time, and laser power, with temperature and humidity corrected using multiplicative coefficients. Variational inference or Markov chain Monte Carlo methods are used to solve the posterior, and a 95% confidence interval is used as the uncertainty output for the absolute concentration of each component. Simultaneously, a detection limit is given based on the three-times-noise criterion for blank samples, and a quantitation limit is given based on the criterion that the relative standard deviation is no higher than 10%. Specifically:
[0117]
[0118] in, For site / instrument domain; covariates (temperature T, humidity H, exposure / power) are multiplicatively corrected. Included. Components The absolute concentration (on-site output, including confidence interval); the hierarchical Bayesian parameters are... (Site / Instrument Domain) (intercept / slope below). This represents the cross-domain prior mean; The prior variance / covariance; (Here) represents the noise term of the calibration model.
[0119] In this embodiment, the prior variance is obtained from the residual statistics of historical cross-domain data, specifically:
[0120] Linear calibration models are fitted at each site, and the sample variance or robust variance estimate of the model residuals (such as the estimate based on the median absolute deviation MAD) is calculated. The weighted average of the residual variances across sites is used as the prior noise variance, and a covariance matrix of the Gaussian prior is constructed accordingly.
[0121] The solution is: the mean of the MCMC / variable inference output and the 95% interval (i.e., the 95% confidence interval); the transfer can be completed with very few samples (3-5 points).
[0122] In this embodiment, the quality control and rollback steps include: when the relative deviation between the anchor peak position and peak intensity exceeds a preset threshold or the goodness of fit is lower than a preset threshold, rolling back to the previous stable parameter and downgrading the process; wherein,
[0123] During testing, adaptive updates are only allowed for normalized or affine layer parameters, with a single step size not exceeding 1×10⁻³. Two consecutive quality control failures result in a rollback to the previous stable parameter. Quality control thresholds include at least: an anchoring peak position deviation threshold of 1.5cm⁻¹, a peak intensity relative deviation threshold of 10%, a weighted goodness-of-fit threshold of R² ≥ 0.96, and a weighted root mean square error not exceeding 1.1 times that of the historical stable version. Drift detection is performed on the input distribution within a rolling window; gray-scale updates and version rollbacks are triggered when the population stability index or symmetry divergence exceeds a preset threshold.
[0124] TTA includes: updating only the normalized / small affine layer during inference to minimize entropy or consistency loss; step size. It locks after two consecutive backtracking attempts.
[0125] The quality control and rollback process employs a three-level rollback mechanism, including:
[0126] When the quality control indicators fail to meet the standards for the first time, the testing process will be switched to a downgraded processing mode based solely on standard domain reconstruction and full-spectrum unmixing, and active ROI selection and adaptive updates during the testing period will be turned off.
[0127] If the quality control indicators fail to meet the standards again under the degradation processing mode, the model parameters and quality control thresholds will be reverted to the previous stable version, and adaptive updates will be temporarily frozen.
[0128] If the quality control indicators still fail to meet the standards after the rollback, a manual review alarm will be generated and the current test result will be marked as "requires manual confirmation".
[0129] The drift detection is based on the population stability index between the input sample feature distribution and the historical stable distribution. When the population stability index is greater than 0.25 for three consecutive statistical periods within a preset length of rolling statistical window, a significant distribution drift is determined, triggering the model grayscale update process. The old version is retained as a rollback backup before the new version passes the preset quality control verification.
[0130] Quality control thresholds include:
[0131] Anchored Peak Fidelity: , ;
[0132] Goodness of fit: weighted The weighted RMSE is no higher than 1.1× of the previous stable version.
[0133] Drift and Version: Evaluate the distribution distance (KL / PSI / MMD) by month / rolling window, and enter the grayscale update when the threshold is triggered.
[0134] This invention addresses real-world application scenarios involving multiple sites, batches, and instruments, proposing a fast Raman detection technology route based solely on algorithms and data. The main framework consists of "cross-domain invariant representation—standard domain reconstruction—proactive ROI and early termination—unified dictionary sparse demixing—few-sample hierarchical Bayesian self-calibration—test-time adaptive and version governance," enabling multi-component identification and quantification under unlabeled / weakly labeled conditions and strict time-delay constraints.
[0135] Through self-supervised contrastive learning and domain adversarial learning, spectral characterizations that are insensitive to instrument / site differences are learned, weakening the root causes of domain shift. Generative reconstruction with peak fidelity loss constraints maps the field spectrum to the "standard domain," ensuring that peak position / width / intensity are comparable to the standard fingerprint database. Active ROI selection and early termination based on information gain terminate the processing early when confidence and uncertainty thresholds are met, achieving sub-millisecond response. Multi-scenario dictionaries are distilled into a unified standard domain dictionary, combined with non-negative and group sparse unmixing, improving the separability and robustness of overlapping peaks. Few-sample hierarchical Bayesian self-calibration is adopted to achieve cross-domain quantitative transfer under conditions with minimal standard input, and outputs 95% confidence intervals, LOD / LOQ. Long-term stable operation is maintained through test-time adaptation and version governance (grayscale release / rollback / drift logs).
[0136] This invention is applicable to rapid screening and trend monitoring of multiple components of dissolved gases / degradation products in transformer oil samples, especially for consistency comparison in multi-site operation and maintenance.
[0137] In summary, this invention achieves the goals of cross-domain comparability, controllable latency, reliable quantification, and long-term maintainability with minimal engineering modification costs, forming a unified solution for rapid Raman oil sample detection that is hardware-independent and scalable.
[0138] Example 2
[0139] A cross-domain adaptive Raman spectroscopy rapid detection system, used to implement the cross-domain adaptive Raman spectroscopy rapid detection method as described in Example 1, includes:
[0140] The spectral input interface is used to receive raw Raman spectral data from transformer oil samples.
[0141] The spectral preprocessing module is used to perform preprocessing on the original spectrum sequentially and output the preprocessed spectrum. ;
[0142] The joint model module is used for joint model pairs based on self-supervised contrastive learning and domain adversarial learning. Feature extraction is performed to obtain cross-domain invariant representation vectors. ;
[0143] The standard domain reconstruction module is used to... Mapped to standard domain spectrum And within each ROI, peak-sensitive constraints are applied to peak position, full width at half maximum (FWHM), and peak intensity to make... Maintain peak shape consistency with the standard fingerprint database;
[0144] The proactive ROI selection and early termination control module is used to adaptively sort and select ROIs based on the upper confidence bound of information gain, ensuring that the overall confidence level of the components is not lower than a preset threshold. And the global uncertainty does not exceed a preset threshold. Early termination is triggered and the current candidate component set is output.
[0145] The domain mapping module is used to normalize the scenario reference dictionary to a standard domain using a domain mapping operator and perform column vector normalization to form a unified standard domain dictionary. ;
[0146] The relative concentration estimation module is used to estimate the relative concentration in the following ways: and A weighted nonnegative sparse unmixing model is established, including a reconstruction error term,
[0147] By solving for the sparse terms and group sparse terms, the relative concentration vectors of each target component can be obtained. ;
[0148] The Bayesian self-calibration module is used to add a small number of standards to the sample in the field. Mapped to absolute concentration Temperature, humidity, exposure time, and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration and its confidence interval.
[0149] The adaptive module is used to make limited updates to the normalized or affine layer parameters only during the inference phase to minimize entropy or consistency loss, and to fall back to the previous stable parameter when quality control fails.
[0150] The quality control module is used to... Anchoring peak position deviation was applied to the unmixed results. Peak intensity relative deviation Weighted goodness of fit With weighted root mean square error The threshold is determined, and if the threshold is not met, a downgrade process and rollback are triggered.
[0151] The output module is used to output the target component set, relative and absolute concentrations, confidence intervals, selected ROI sequence and reasons for early termination, and quality control indicators, and to record drift statistics, threshold triggering, grayscale and rollback information.
[0152] In a typical deployment scenario, the method of this invention is deployed on an industrial embedded computing platform (e.g., an industrial PC based on x86 or ARM architecture) equipped with a quad-core CPU and 4GB of memory. When multiple target components are detected simultaneously, the end-to-end processing latency P99 does not exceed 50ms, which meets the requirements for real-time online monitoring.
[0153] Example 3
[0154] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the cross-domain adaptive Raman spectroscopy rapid detection method as described in Embodiment 1. The memory stores program instructions executable on the processor, a standard fingerprint library, a scene reference dictionary, configuration and weights of spectral bands of interest, and preset threshold parameters. , , , , and .
[0155] Example 4
[0156] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the cross-domain adaptive rapid Raman spectroscopy detection method as described in Example 1.
[0157] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0158] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0159] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0160] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0161] Those skilled in the art will understand that all or part of the steps in the above facts and methods can be implemented by a program instructing related hardware. The program or the program described therein can be stored in a computer-readable storage medium. When the program is executed, it includes the following steps: at this time, the corresponding method steps are introduced. The storage medium can be ROM / RAM, magnetic disk, optical disk, etc.
[0162] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A cross-domain adaptive rapid detection method for Raman spectroscopy, characterized in that, include: The raw Raman spectrum of the transformer oil sample was obtained and subjected to routine preprocessing to obtain the preprocessed spectrum. ; A self-supervised contrastive learning and domain adversarial representation model is constructed based on preprocessed spectra from multiple sites, instruments, and batches, and then applied online. The input to the representation model yields a cross-domain invariant representation vector. The dimension of the representation vector is 64–256; Based on generative reconstruction networks Mapped to standard domain spectrum ; For a predefined set of spectral bands of interest (ROI), according to the upper confidence bound of information gain... The ROI is adaptively selected for spectral band processing. When the overall confidence of the component reaches 0.70 to 0.85 and the global uncertainty is not higher than 0.15 to 0.25, the process is terminated early, and the current set of candidate components and the reason for early termination are output. Reference distillations for different operating scenarios are distilled into a unified standard domain dictionary using domain mapping operators. and in Solving the weighted nonnegative sparse unmixing algorithm yields the relative concentration vectors of each target component. The unmixing objective function includes a reconstruction error term, Sparse regularization and group sparse regularization; Based on a small number of on-site standard samples, hierarchical Bayesian self-calibration was performed to establish... relative to the absolute concentration of each component The cross-domain mapping relationship is determined, and temperature, humidity, exposure time and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration of each component and its confidence interval. When performing constrained testing during the inference phase, the system is adaptive, updating only the normalized or affine layer parameters to minimize entropy or consistency loss, and setting up quality control and rollback steps. Output the target component set, relative and absolute concentrations, corresponding confidence intervals, selected ROI sequence, reasons for premature termination, and quality control indicators; Wherein: the standard fingerprint database is composed of the peak position, full width at half maximum (FWHM), and peak intensity statistics of historical standard samples in the standard domain; , The quality control thresholds are stored as preset parameters, including the anchoring peak position deviation threshold. Peak intensity relative deviation threshold Goodness-of-fit threshold With error threshold .
2. The cross-domain adaptive Raman spectroscopy rapid detection method according to claim 1, characterized in that, The self-supervised contrastive learning constructs positive and negative sample pairs by perturbing the baseline, scaling the intensity, shifting the small peak positions, and injecting noise into the same spectrum to learn domain-invariant features. Domain adversarial learning suppresses domain information through gradient inversion; wherein: For each preprocessed spectrum, at least two enhanced views are constructed, including baseline perturbation, intensity scaling, peak shifting, and noise injection. The temperature parameter of the contrast loss is set to 0.05–0.2, and the proportion of negative samples is not less than 50% of the batch size. The domain adversarial layer adopts a gradient inversion layer, the domain discriminator loss weight is set to 0.1–0.3, and an early stopping strategy is adopted to stop the domain discrimination accuracy on the validation set not exceeding 60%.
3. The cross-domain adaptive rapid detection method for Raman spectroscopy according to claim 1, characterized in that, The standard domain is defined by a pre-set standard fingerprint library, and the reconstruction network is constrained by a peak-sensitive loss consisting of peak position bias, full width at half maximum (FWHM) bias, and peak intensity bias, so that... The reconstruction network maintains peak shape consistency with the standard fingerprint in each spectral segment of interest. It is a generative reconstruction network with peak-sensitive constraints, wherein the ratio of the three error weights (peak position, full width at half maximum, and peak intensity) is set to 2:1:1 in each spectral segment of interest. When the peak position deviation of the reconstructed anchor peak exceeds 1.5 cm⁻¹ or the relative deviation of the full width at half maximum exceeds 10%, parameter rollback of the reconstruction network is triggered. The generative network includes a cyclic consistency branch, with a cyclic consistency loss weight of 0.5–1.5 and an identity preservation loss weight of 0.1–0.
5.
4. The cross-domain adaptive rapid Raman spectroscopy detection method according to claim 1, characterized in that, The selection of ROI for spectral segment processing and early termination decision adopts a sequential selection strategy based on upper confidence bounds: for each spectral segment of interest, the average revenue and usage frequency are statistically analyzed, spectral segments are processed sequentially according to the upper confidence bound priority, and the minimum number of spectral segments processed and the maximum processing delay are limited to no more than preset values.
5. The cross-domain adaptive rapid detection method for Raman spectroscopy according to claim 1, characterized in that, The unified standard domain dictionary and sparse demixing include: normalizing each scenario reference dictionary to the standard domain using a domain mapping operator, then performing column vector unit norm normalization, and introducing group sparsity regularization for highly collinear components of the same family; the sparse coefficients of the demixing target range from [value missing]. , group sparsity coefficient for The weighting matrix is constructed based on the noise variance and segment weight of each spectral segment, and the unmixing coefficients are subject to non-negativity constraints. The solution is obtained through coordinate descent or weighted non-negative least squares iteration until the relative residual decreases to less than 1%.
6. The cross-domain adaptive rapid Raman spectroscopy detection method according to claim 1, characterized in that, The hierarchical Bayesian self-calibration sets Gaussian priors for calibration parameters at the site level. The prior mean is obtained from historical cross-domain data, and the prior variance is estimated from cross-domain residuals. The number of on-site calibration samples is no less than 3. The covariate correction includes four items: temperature, humidity, exposure time, and laser power. Temperature and humidity are corrected using multiplicative coefficients. Variational inference or Markov chain Monte Carlo is used to solve the posterior, and the uncertainty of the absolute concentration of each component is output with a 95% confidence interval. At the same time, the detection limit is given according to the three-times-noise criterion for blank samples, and the quantitation limit is given according to the criterion that the relative standard deviation is no higher than 10%.
7. The cross-domain adaptive rapid detection method for Raman spectroscopy according to claim 1, characterized in that, The quality control and rollback steps include: when the anchor peak position deviation and peak intensity relative deviation exceed a preset threshold or the goodness of fit is lower than a preset threshold, rolling back to the previous stable parameter and downgrading the process; wherein... During testing, adaptive updates are only allowed for normalized or affine layer parameters, with a single step size not exceeding 1×10⁻³. If two consecutive quality control failures occur, the system will revert to the previous stable parameter. Quality control thresholds include at least: anchor peak position deviation, peak intensity relative deviation, weighted goodness of fit, and weighted root mean square error. Drift detection is performed on the input distribution within a rolling window, and grayscale updates and version rollbacks are triggered when the population stability index or symmetry divergence exceeds a preset threshold.
8. The cross-domain adaptive rapid detection method for Raman spectroscopy according to claim 7, characterized in that, The quality control and rollback process employs a three-level rollback mechanism, including: When the quality control indicators fail to meet the standards for the first time, the testing process will be switched to a downgraded processing mode based solely on standard domain reconstruction and full-spectrum unmixing, and active ROI selection and adaptive updates during the testing period will be turned off. If the quality control indicators fail to meet the standards again under the degradation processing mode, the model parameters and quality control thresholds will be reverted to the previous stable version, and adaptive updates will be temporarily frozen. If the quality control indicators still fail to meet the standards after the rollback, a manual review alarm will be generated and the current test result will be marked as "requires manual confirmation".
9. The cross-domain adaptive rapid detection method for Raman spectroscopy according to any one of claims 7 or 8, characterized in that, The drift detection is based on the population stability index between the input sample feature distribution and the historical stable distribution. When the population stability index is greater than 0.25 for three consecutive statistical periods within a preset length of rolling statistical window, a significant distribution drift is determined, triggering the model grayscale update process. The old version is retained as a rollback backup before the new version passes the preset quality control verification.
10. A cross-domain adaptive rapid Raman spectroscopy detection system, used to implement the cross-domain adaptive rapid Raman spectroscopy detection method according to any one of claims 1 to 9, characterized in that, include: The spectral input interface is used to receive raw Raman spectral data from transformer oil samples. The spectral preprocessing module is used to perform preprocessing on the original spectrum sequentially and output the preprocessed spectrum. ; The joint model module is used for joint model pairs based on self-supervised contrastive learning and domain adversarial learning. Feature extraction is performed to obtain cross-domain invariant representation vectors. ; The standard domain reconstruction module is used to... Mapped to standard domain spectrum And within each ROI, peak-sensitive constraints are applied to peak position, full width at half maximum (FWHM), and peak intensity to make... Maintain peak shape consistency with the standard fingerprint database; The proactive ROI selection and early termination control module is used to adaptively sort and select ROIs based on the upper confidence bound of information gain, ensuring that the overall confidence level of the components is not lower than a preset threshold. And the global uncertainty does not exceed a preset threshold. Early termination is triggered and the current candidate component set is output. The domain mapping module is used to normalize the scenario reference dictionary to a standard domain using a domain mapping operator and perform column vector normalization to form a unified standard domain dictionary. ; The relative concentration estimation module is used to estimate the relative concentration in the following ways: and A weighted nonnegative sparse unmixing model is established, including a reconstruction error term, 11. Sparse terms and group sparse terms: Solving for the relative concentration vector of each target component yields the solution. ; The Bayesian self-calibration module is used to add a small number of standards to the sample in the field. Mapped to absolute concentration Temperature, humidity, exposure time, and laser power are used as covariates and corrected with multiplicative coefficients to output the absolute concentration and its confidence interval. The adaptive module is used to make limited updates to the normalized or affine layer parameters only during the inference phase to minimize entropy or consistency loss, and to fall back to the previous stable parameter when quality control fails. The quality control module is used to... Anchoring peak position deviation was applied to the unmixed results. Peak intensity relative deviation Weighted goodness of fit With weighted root mean square error The threshold is determined, and if the threshold is not met, a downgrade process and rollback are triggered. The output module is used to output the target component set, relative and absolute concentrations, confidence intervals, selected ROI sequence and reasons for early termination, and quality control indicators, and to record drift statistics, threshold triggering, grayscale and rollback information.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the cross-domain adaptive rapid Raman spectroscopy detection method as described in any one of claims 1 to 10. The memory stores program instructions that can run on the processor, a standard fingerprint library, a scene reference dictionary, configuration and weights of spectral bands of interest, and preset threshold parameters. , , , , and .
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the cross-domain adaptive rapid detection method for Raman spectroscopy as described in any one of claims 1 to 10.