Hydrogen peroxide residue detection method, system and equipment and storage medium
By using cGAN model for progressive growth training and multi-scale feature training, the generator and discriminator are optimized, and the attention mechanism is introduced, the application scope and accuracy of traditional hydrogen peroxide monitoring methods are limited in the case of data scarcity, and effective data expansion and improvement of detection accuracy are achieved.
Patent Information
- Application Number
- CN202510146842.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-05-30
AI Technical Summary
In the case of scarce data, traditional hydrogen peroxide monitoring methods have severely limited application scope and accuracy, which is difficult to effectively support the precise prevention of diseases and the formulation of personalized treatment strategies.
The cGAN model is used for progressive growth training and multi-scale feature training, optimized generators and discriminators to generate stable and high-resolution data, and introduce attention mechanisms to focus on key areas and eliminate interfering data, thereby augmenting data in the absence of data scarcity.
The data is expanded through the improved cGAN model to ensure that the data is true and effective, and the application scope is expanded, so that the subsequent hydrogen peroxide detection model has sufficient data support when detecting hydrogen peroxide, and improve the detection accuracy.
Smart Images

Figure CN120072097A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of health monitoring, and particularly to a method, system, device and storage medium for detecting hydrogen peroxide residue. Background Art
[0002] In the broad field of disease prevention and treatment, hydrogen peroxide, as a multifunctional chemical agent, is widely used in industries such as food preservation, medical disinfection and textile processing. Its powerful oxidation characteristics are crucial for controlling microbial contamination and ensuring product hygiene and safety. However, with the popular use of hydrogen peroxide in industry, the potential health risks of its residues have gradually emerged and become the focus of public health concern. Accurate and timely health monitoring, especially the long-term tracking of potential harmful factors such as hydrogen peroxide residues, is of inestimable value for preventing disease occurrence, guiding early treatment and improving public health levels.
[0003] Traditional hydrogen peroxide monitoring means, such as chemical analysis and spectroscopic techniques, although they can provide reliable detection results under specific conditions, generally face challenges such as high cost, cumbersome operation, poor timeliness and insufficient data accumulation. Especially in the context of scarce data, the application scope and accuracy of these methods are severely limited, and it is difficult to effectively support the formulation of precise disease prevention and personalized treatment strategies. Summary of the Invention
[0004] In view of the deficiencies in the prior art, the present invention provides a method, system, device and storage medium for detecting hydrogen peroxide residue, which solves the problem that the application scope and accuracy of traditional hydrogen peroxide monitoring means in the prior art are severely limited in the case of scarce data.
[0005] According to an embodiment of the present invention, a method for detecting hydrogen peroxide residue includes:
[0006] Obtain training data, and construct a cGAN model and a hydrogen peroxide detection model;
[0007] Successively perform progressive growth training and multi-scale feature training on the cGAN model using the training data to obtain an optimized cGAN model;
[0008] Obtain an original detection data set, use the optimized cGAN model to expand the original detection data to obtain an ideal data set, and input the ideal data into the hydrogen peroxide detection model to obtain a detection result.
[0009] Preferably, the cGAN model includes a generator and a discriminator;
[0010] The method for performing progressive growth training on the cGAN model is as follows:
[0011] S1: Arrange the training data in ascending order of resolution and divide the training data into multiple consecutive sequence sets equally.
[0012] S2: Use the first sequence set as the training set and use the training data in the training set in the arranged order for the training of the generator until the discriminator determines that the data generated by the generator is real.
[0013] S3: Add a new convolutional layer to the cGAN model and use the next sequence set as the training set in order.
[0014] S4: Repeat steps S2 - S3 until all sequence sets are used for the training of the cGAN model.
[0015] Preferably, in S3, each time a convolutional layer is added, the learning rates and weight regularizations of the generator and the discriminator need to be adjusted simultaneously.
[0016] Preferably, the method for multi-scale feature training of the cGAN model includes:
[0017] Divide the training data into a low-resolution data set, a medium-resolution data set, and a high-resolution data set;
[0018] Use the data in the three data sets respectively to train the discriminator of the cGAN model after progressive growth training;
[0019] Calculate the probability expectation that the data generated by the generator is judged to be real under each data set during the training process;
[0020] Adjust the hyperparameters of the cGAN model according to the probability expectations corresponding to the three data sets.
[0021] Preferably, before training the cGAN model, the training data is also subjected to data cleaning and normalization, and then the attention mechanism is used to screen the training data.
[0022] Preferably, the method for screening the training data by using the attention mechanism includes:
[0023] Extract the query vector, key vector, and value vector of the training data, and construct an attention weight matrix according to the query vector and the key vector;
[0024] Perform a multiplication operation on the attention weight matrix and the value vector to obtain the screened features corresponding to the training data, and use the screened features as the input data of the cGAN model.
[0025] Preferably, optimize the cGAN model as follows:
[0026]
[0027] Among them, Gfinal is the output model of the generator, D final is the output model of the discriminator, G base is the initial model of the generator, D s is the discriminator model at different resolutions, z is the noise vector, c is the conditional vector, A is the attention weight matrix, and x is the input data.
[0028] On the other hand, according to an embodiment of the present invention, a hydrogen peroxide residue detection system is further provided. This system uses the above-mentioned hydrogen peroxide residue detection method, including:
[0029] A modeling module for constructing a cGAN model and a hydrogen peroxide detection model;
[0030] A training module for performing progressive growth training and multi-scale feature training on the cGAN model to obtain an optimized cGAN model;
[0031] A detection module for using the optimized cGAN model to perform data expansion to obtain an ideal data set, and inputting the ideal data into the hydrogen peroxide detection model to obtain a detection result.
[0032] On the other hand, according to an embodiment of the present invention, a computer device is further provided, including a memory and a processor. The memory stores a computer program. When the computer program is executed by the processor, the processor executes the above-mentioned hydrogen peroxide residue detection method.
[0033] On the other hand, according to an embodiment of the present invention, a computer storage medium is further provided, characterized in that it stores a computer program. When the computer program is executed by a processor, the processor executes the above-mentioned hydrogen peroxide residue detection method.
[0034] Compared with the prior art, the present invention has the following beneficial effects:
[0035] Based on the cGAN model, the present invention uses progressive growth training and multi-scale feature training to optimize the generator and discriminator in the cGAN model respectively, enabling the generator to generate stable and high-resolution data, enabling the discriminator to accurately judge data at different resolutions, and at the same time introducing an attention mechanism, so that the generator and discriminator of the cGAN model can focus on the key areas when processing input data, exclude interfering data, and thus, in the case of scarce data, use the improved cGAN model to expand the data, ensure the authenticity and effectiveness of the data, expand the application scope, provide sufficient data support for the subsequent hydrogen peroxide detection model when detecting hydrogen peroxide, and improve the detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 Flow chart of the hydrogen peroxide detection method according to the embodiment of the present invention.
[0037] Figure 2 Performance difference diagram of the hydrogen peroxide model according to the embodiment of the present invention after using real data and augmented data.
[0038] Figure 3 Distribution diagram of real data and augmented data according to the embodiment of the present invention.
[0039] Figure 4 Comparison diagram of augmented data and real data according to the embodiment of the present invention. Detailed implementation manners
[0040] The technical solutions in the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0041] As Figure 1 shown, an embodiment of the present invention provides a method for detecting hydrogen peroxide residues, including:
[0042] Obtain training data, and construct a cGAN model and a hydrogen peroxide detection model;
[0043] Before detection, equipment preparation needs to be done. The hydrogen peroxide detection model can directly use existing detection models, which will not be elaborated here; the training data can be obtained by the GPT model to grab a large amount of raw data related to hydrogen peroxide residue detection from public resources such as academic papers, patents, and industry standards. These data include detection environment parameters (such as temperature, humidity), sample characteristics (such as concentration, sampling time), and residue amount. After obtaining the training data, it needs to be preprocessed, including:
[0044] ① Data cleaning: Remove missing values and obvious outliers, such as data entries with a temperature below 0 °C or a humidity exceeding 100%.
[0045] Use statistical methods such as the three - standard - deviation rule to eliminate extreme values.
[0046] x outlier ={x∣|x - μ|>3σ}
[0047] where μ is the mean value and σ is the standard deviation.
[0048] ② Denoising processing: Use a Gaussian filter to smooth the noise data to reduce the error caused by environmental interference.
[0049] The Gaussian filter is used for denoising, and the formula is:
[0050]
[0051] where σ is the standard deviation and x represents the filtering intensity.
[0052] ③ Normalization: The purpose of normalization is to eliminate the influence of the dimension of the data, unify the value ranges of different features, and facilitate the training of the deep learning model. Using the min-max normalization formula, the data range is compressed to [0,1]. The formula is as follows:
[0053]
[0054] Among them, x is the original data, min(X) and max(X) are the minimum and maximum values of the data set respectively, and x′ is the normalized data.
[0055] After that, an original cGAN model is constructed. This model includes a generator and a discriminator. The generator concatenates random noise with the original data to generate simulated data. The formula is as follows:
[0056] G(z|y) = FCNN 2 (FCNN 1 (y) ⊕ z)
[0057] Among them, z is the noise, y is the detection condition (such as temperature, humidity, etc.), ⊕ represents the concatenation operation, FCNN 1 and FCNN 2 are fully connected neural networks.
[0058] The discriminator then combines the conditional variable to judge the authenticity of the simulated data. The formula is as follows:
[0059] D(x|y) = σ(FCNN 4 (FCNN 3 (y) ⊕ x))
[0060] Among them, x is the residual data, σ is the Sigmoid activation function, which is used to output the probability, FCNN 3 and FCNN 4 are fully connected neural networks.
[0061] The loss function formula of cGAN is as follows:
[0062]
[0063] x: Real data.
[0064] y: Conditional variable, such as temperature, humidity, etc.
[0065] z: Random noise.
[0066] G(z|y)): Simulated data generated by the generator.
[0067] D(x|y): The probability that the discriminator judges the data as real data.
[0068] E: Expected operation.
[0069] After introducing the attention mechanism, the generator and discriminator of the cGAN model can focus on the key regions and exclude the interference data when processing the input data. First, the query vector, key vector, and value vector of the training data are extracted, and the attention weight matrix is constructed based on the query vector and key vector:
[0070]
[0071] where Q and K are the query vector (Query) and key (Key) vector respectively, and d k is the normalization factor of the feature dimension.
[0072] The generated attention weight matrix A acts on the input features (multiplication operation) to output the updated features:
[0073] c = AV
[0074] After that, it is combined with the generator or discriminator. At this time, the formula of the generator becomes the following form:
[0075] G(z, c) = fgen(z ⊕ c, A)
[0076] where z is the noise vector, c is the feature (conditional vector) of the training data screened by the attention mechanism, and ⊕ represents the concatenation operation.
[0077] The formula of the discriminator becomes the following form:
[0078] D(x, c) = f disc (x ⊕ c, A)
[0079] x is the input real or generated data by the generator. The output of the discriminator f disc is a probability value, representing the confidence that the input data x is real data.
[0080] The formula of the loss function becomes the following form:
[0081]
[0082] The first term represents the expected probability that the real data x is judged as real under the condition c and the attention matrix A. The discriminator hopes to maximize this part of the loss.
[0083] The second term represents the expected probability that the generated data is judged as fake under the condition c and the attention matrix A. The generator hopes to minimize this part of the loss to "cheat" the discriminator.
[0084] The cGAN model will be trained by progressive growing and multi-scale feature training using the training data in sequence to obtain an optimized cGAN model;
[0085] Adopt a progressive growing approach to gradually increase the number of network layers of the generator and discriminator, enabling the model to learn from simple features to complex features during training. Progressive growing helps the generator generate a stable and high-resolution data distribution, avoiding model instability or collapse.
[0086] Initial stage: Train low-resolution data, with the generator and discriminator having fewer convolutional layers.
[0087] Increasing stage: Gradually add convolutional layers and feature extraction modules to refine the resolution of the generated data.
[0088] The specific training strategy is as follows:
[0089] S1: Arrange the training data in ascending order of resolution and divide the training data into multiple consecutive sequence sets equally;
[0090] S2: Use the first sequence set as the training set and use the training data in the training set in the arranged order for the training of the generator until the discriminator determines that the data generated by the generator is real;
[0091] S3: Add a new convolutional layer to the cGAN model and use the next sequence set as the training set in order. At the same time, each time a convolutional layer is added, the learning rate and weight regularization of the generator and discriminator need to be adjusted;
[0092] The update formula of the generator is as follows:
[0093]
[0094] G base : The initial low-resolution generator model, responsible for generating basic features.
[0095] G i : The gradually added higher-resolution generator layer, responsible for refining the output of the generator, corresponding to the subsequent sequence sets.
[0096] G final : The final generator is composed of the basic layer and multiple-level generator layers stacked together, supporting generation from low to high resolution.
[0097] The corresponding update formula of the discriminator is as follows:
[0098]
[0099] D base : The initial low-resolution discriminator, responsible for distinguishing the low-resolution data generated by the basic layer.
[0100] D i : The gradually added higher-resolution discriminant layers are used to judge the authenticity of the refined data.
[0101] D final : The final discriminator combines multi-level features to enhance the discrimination ability for data of different resolutions.
[0102] S4: Repeat steps S2 - S3 until all sequence sets are used for training the cGAN model.
[0103] After that, multi-scale feature training is carried out, which helps to improve the discriminator's ability to distinguish data of different scales, so that the data generated by the generator is more real.
[0104] First, the training data is divided into a low-resolution data set, a medium-resolution data set, and a high-resolution data set;
[0105] Use the data of the three data sets respectively to train the discriminator of the cGAN model after progressive growth training:
[0106]
[0107] Among them, D s (x): The discriminator branches of different scales, and s1, s2, s3 are the three data sets respectively.
[0108] During the training process, calculate the expected probability that the data generated by the generator is judged to be true under each data set;
[0109] According to the expected probabilities corresponding to the three data sets, adjust the hyperparameters of the cGAN model by combining the following objective function:
[0110]
[0111] Finally, through the above progressive growth training and multi-scale feature training, the final optimized cGAN model is obtained:
[0112]
[0113] Among them, G final is the generator output model, D final is the discriminator output model, G base is the initial model of the generator, D s is the discriminator model at different resolutions, z is the noise vector, c is the conditional vector, A is the attention weight matrix, and x is the input data.
[0114] Obtain the original detection dataset, use the optimized cGAN model to expand the original detection data to obtain an ideal dataset, and input the ideal data into the hydrogen peroxide detection model to obtain the detection results.
[0115] Such as Figure 2 The bar chart shows the performance of the model on two different datasets. The performance of the model trained with only real data in terms of accuracy, recall, and F1-score is 85%, 80%, and 82.5% respectively. After combining the real data with the generated data in the augmented dataset, the performance of the model has been significantly improved, and the three indicators have reached 92%, 90%, and 91% respectively. This shows that the data generated by the optimized cGAN model helps to enhance the overall performance of the model, especially the recall rate has the most obvious improvement.
[0116] Figure 3 The line chart shows the distribution of real data and generated data on a certain feature (Feature 1). The feature values of the real data show a normal distribution centered around 0, while the distribution of the augmented data is centered around 0.001, with a very small mean shift. The distribution patterns of the two groups of data are highly similar, and the density of the augmented data in the high-value region is almost the same as that of the real data. This result shows that the optimized cGAN model can better simulate the feature distribution of real data, with a small difference and within an acceptable range.
[0117] Figure 4 A comparison chart of the augmented data generated by the optimized cGAN model and the real data is shown. It can be seen from the figure that the augmented data is very close to the real data in terms of numerical range and distribution, proving the excellent performance of the optimized cGAN model in data augmentation.
[0118] In summary, this study uses GPT to capture relevant data on health detection data (hydrogen peroxide residue), and based on the cGAN model, uses progressive growth training and multi-scale feature training to optimize the generator and discriminator in the cGAN model respectively, so that the generator can generate stable and high-resolution data, and the discriminator can accurately judge data of different resolutions. At the same time, the attention mechanism is introduced to enable the generator and discriminator of the cGAN model to focus on the key areas when processing input data and exclude interfering data. In this way, in the case of scarce data, the improved cGAN model is used to expand the data, ensuring the authenticity and effectiveness of the data, expanding the application scope, enabling the subsequent hydrogen peroxide detection model to have sufficient data support when detecting hydrogen peroxide, and improving the detection accuracy.
[0119] On the other hand, the embodiment of the present invention also provides a hydrogen peroxide residue detection system, which uses the above-mentioned hydrogen peroxide residue detection method, including:
[0120] A modeling module, which is used to construct a cGAN model and a hydrogen peroxide detection model;
[0121] A training module, which is used to perform progressive growth training and multi-scale feature training on the cGAN model to obtain an optimized cGAN model;
[0122] A detection module, which is used to use the optimized cGAN model to perform data expansion to obtain an ideal data set, and input the ideal data into the hydrogen peroxide detection model to obtain a detection result.
[0123] On the other hand, an embodiment of the present invention further provides a computer device, which is characterized in that it includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the above-mentioned method for detecting hydrogen peroxide residue.
[0124] On the other hand, an embodiment of the present invention further provides a computer storage medium, which is characterized in that it stores a computer program, and when the computer program is executed by a processor, the processor executes the above-mentioned method for detecting hydrogen peroxide residue.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A method for detecting residual hydrogen peroxide, characterized in that: include: Obtain training data and build cGAN model and hydrogen peroxide detection model; The training data will be used to perform progressive growth training and multi-scale feature training on the cGAN model in turn to obtain an optimized cGAN model; The original detection data set is obtained, and the optimized cGAN model is used to expand the original detection data to obtain the ideal data set, and the ideal data is input into the hydrogen peroxide detection model to obtain the detection results.
2. A method for detecting residual hydrogen peroxide as claimed in claim 1, characterized in that: The cGAN model includes a generator and a discriminator; The method of progressive growth training for cGAN model is as follows: S1: Arrange the training data from low to high resolution and divide the training data into multiple continuous sequence sets; S2: Use the first sequence set as the training set, and use the training data in the training set in the order of arrangement for the training of the generator until the discriminator determines that the data generated by the generator is true; S3: Add a new convolutional layer to the cGAN model and use the next sequence set as the training set in order; S4: Repeat steps S2-S3 until all sequence sets are used to train the cGAN model.
3. A method for detecting residual hydrogen peroxide as claimed in claim 2, characterized in that: In S3, each time a convolutional layer is added, the learning rate and weight regularization of the generator and discriminator need to be adjusted.
4. A method for detecting residual hydrogen peroxide as claimed in claim 2, characterized in that: Methods for multi-scale feature training of cGAN models include: The training data is divided into a low-resolution dataset, a medium-resolution dataset, and a high-resolution dataset; The discriminator of the cGAN model after progressive growth training is trained using the data of the three datasets respectively; Calculate the expected probability that the data generated by the generator is judged to be true for each data set during the training process; The hyperparameters of the cGAN model are adjusted according to the probability expectations corresponding to the three datasets.
5. A method for detecting residual hydrogen peroxide according to claim 1, characterized in that: Before training the cGAN model, the training data is cleaned and normalized, and then the attention mechanism is used to screen the training data.
6. A method for detecting residual hydrogen peroxide as claimed in claim 5, characterized in that: Methods for using attention mechanisms to filter training data include: Extract the query vector, key vector, and value vector of the training data, and construct an attention weight matrix based on the query vector and key vector; The attention weight matrix is multiplied by the value vector to obtain the screening features corresponding to the training data, and the screening features are used as the input data of the cGAN model.
7. A method for detecting residual hydrogen peroxide as claimed in claim 1, characterized in that: The optimized cGAN model is as follows: Among them, G final Output model for the generator, D final is the discriminator output model, G base is the initial model of the generator, D s is the discriminator model at different resolutions, z is the noise vector, c is the conditional vector, A is the attention weight matrix, and x is the input data.
8. A hydrogen peroxide residual detection system, characterized in that: The system uses a hydrogen peroxide residual detection method as described in any one of claims 1 to 7, comprising: A modeling module, wherein the modeling module is used to build a cGAN model and a hydrogen peroxide detection model; A training module, wherein the training module is used to perform progressive growth training and multi-scale feature training on the cGAN model to obtain an optimized cGAN model; The detection module is used to use the optimized cGAN model to perform data expansion to obtain an ideal data set, and input the ideal data into the hydrogen peroxide detection model to obtain a detection result.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes a method for detecting residual hydrogen peroxide according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor executes a method for detecting residual hydrogen peroxide according to any one of claims 1 to 7.