Control method and system of on-line spectrum analysis device for early warning of fermentation contamination
By decoupling the spectral characteristics of the anti-autocoder, combining noise filtering and timing interpolation, dynamically updating the early warning threshold and model, the real-time and accuracy problems of traditional fermented bacteria detection are solved, and efficient early warning and control of bacterial infection is achieved.
Patent Information
- Application Number
- CN202510793793.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-08-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional fermentation dye detection methods cannot monitor the types and status of microorganisms in the fermentation process in real time and accurately, resulting in a decrease in the yield and quality of fermentation products, and the model parameters are prone to overfitting, resulting in false positives or missed reports.
By performing spectral feature decoupling processing on the anti-autocoder, combining noise filtering and timing interpolation, the reconstruction error of bacteria-sensitive features and KL divergence distribution offset of the infection bacteria are calculated, the warning threshold is dynamically updated, and the model incremental update is performed under the constraint of knowledge distillation to generate warning instructions.
It improves the accuracy and sensitivity of bacterial infection warning during fermentation, reduces the false alarm rate, enhances the model's adaptability to dynamic changes in the fermentation process, realizes hierarchical early warning and linkage control, and reduces production losses.
Smart Images

Figure CN120489984A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of fermentation engineering and intelligent control technology, and in particular relates to a control method and system for an online spectral analysis device for fermentation contamination early warning. Background Art
[0002] Fermentation is a biotechnological process widely used in numerous fields, including biopharmaceuticals, food processing, and chemical production. Contamination occurs when the fermentation tank becomes contaminated with microorganisms other than the target strain. These foreign microorganisms compete with the target strain for nutrients, disrupting the fermentation process and leading to reduced yield and quality of the fermentation product. They may even produce harmful metabolites, rendering the entire fermentation batch useless.
[0003] Traditional fermentation contamination detection methods are divided into offline detection methods and online detection methods. On the one hand, commonly used offline detection methods include microbial culture methods, microscopy methods, etc. Although the detection results are relatively accurate, the detection cycle is long, and the sampling process may damage the sterile environment in the fermentation tank, increasing the risk of contamination. On the other hand, traditional online detection methods mainly rely on sensor technology, such as pH sensors, temperature sensors, etc., which can only monitor some physical and chemical parameters in the fermentation process and cannot directly reflect the type and status of microorganisms in the fermentation liquid. In addition, although the early warning technology based on online spectral analysis can collect fermentation liquid component information in real time through near-infrared / Raman spectroscopy, the fermentation process has strong time-varying characteristics. The metabolic characteristics of the strains and fluctuations in process parameters will cause the spectral data distribution to drift. This technology is usually based on historical data offline training. During long-term operation, the addition of new data will cause the model parameters to overfit the current mode and lose historical contamination characteristics. Regular recalibration is required, which in turn affects the continuity of the production line. Summary of the Invention
[0004] Based on this, it is necessary to provide a control method and system for an online spectral analysis device for fermentation contamination early warning to address the above technical problems, so as to enhance the real-time monitoring capability of the fermentation process and improve the accuracy of contamination early warning.
[0005] In a first aspect, the present application provides a control method for an online spectral analysis device for fermentation contamination early warning, comprising:
[0006] Based on the original spectral data and original process parameters of the fermentation broth during the fermentation process, noise filtering and time series interpolation processing are performed to obtain a multimodal time series tensor. The original process parameters include pH value and temperature.
[0007] Based on the spectral data and process parameters in the multimodal time series tensor, the spectral feature decoupling process is performed through the adversarial autoencoder to obtain the contamination sensitive features. The adversarial autoencoder includes an encoder, a first decoder, a second decoder and a discriminator.
[0008] The preset autoencoder is used to calculate the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature to obtain a real-time anomaly score. The current fermentation warning threshold is then updated based on extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on historical spectral data from historically normal fermentation batches.
[0009] When the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated under the constraint of knowledge distillation based on the abnormal spectral data of the current abnormal batch and the historical spectral data of historical normal fermentation batches to obtain an updated autoencoder model. The warning level is divided according to the real-time anomaly score and the warning threshold, and the warning instruction is generated based on the warning level and process parameters.
[0010] In one embodiment, based on the spectral data and process parameters in the multimodal time series tensor, spectral feature decoupling is performed through an adversarial autoencoder to obtain contamination-sensitive features, including:
[0011] According to the spectral data and process parameters in the multimodal time series tensor, they are encoded separately through the dual-channel 1D convolution layer of the encoder to obtain spectral latent variables and process latent variables;
[0012] Performing a deconvolution operation through a first decoder according to the spectral latent variable to obtain a normal spectral reconstruction value, wherein a spectral reconstruction error between the spectral data and the normal spectral reconstruction value satisfies a preset error threshold;
[0013] The spectral latent variable and the process latent variable are concatenated and input into the second decoder to generate a contamination perturbation sequence. The contamination perturbation sequence is then input into the discriminator for adversarial training to obtain the optimal contamination perturbation sequence. The discriminator uses the process latent variable as a constraint and uses a binary classification loss function to distinguish the perturbation characteristics of the true contamination spectrum from the contamination perturbation sequence generated by the second decoder, generating an adversarial loss. The second decoder optimizes the network parameters based on the adversarial loss to generate the optimal contamination perturbation sequence.
[0014] The contamination sensitive features were obtained by processing the spectral latent variables and the optimal contamination disturbance sequence through Hadamard product operation.
[0015] In one embodiment, the reconstruction error and KL divergence distribution offset of the bacterial contamination sensitivity feature are calculated based on a preset autoencoder to obtain a real-time anomaly score, and the current fermentation warning threshold is updated based on extreme value theory to obtain an updated fermentation warning threshold, including:
[0016] Input the bacterial contamination sensitivity feature into the encoder of the preset autoencoder to obtain the latent variable distribution, and reconstruct it through the decoder of the preset autoencoder to obtain a reconstructed feature vector;
[0017] Calculate the mean square error between the reconstructed feature vector and the contamination sensitivity feature, and calculate the reconstruction error in combination with the stability index of the process parameters. The stability index of the process parameters is calculated by the average of the current temperature in the process parameters and the normal temperature of the fermentation liquid in the current fermentation stage.
[0018] The KL divergence is calculated based on the statistical mean and covariance matrix of the latent variable distribution and the historical latent variable distribution of historical normal fermentation batches to obtain the KL divergence distribution offset, where the covariance matrix is dynamically scaled according to the fluctuation range of the current pH value in the process parameters;
[0019] The reconstruction error and the KL divergence distribution offset are weightedly fused to obtain a real-time anomaly score;
[0020] Based on extreme value theory, the extreme value distribution of the real-time abnormality score in the current fermentation stage is modeled, a generalized Pareto distribution is fitted, and the 99% quantile of the generalized Pareto distribution is used as the candidate threshold;
[0021] When the candidate threshold is less than the current fermentation warning threshold, the current fermentation warning threshold is used as the updated fermentation warning threshold, otherwise the candidate threshold is used as the updated fermentation warning threshold, where the 99% quantile of the generalized Pareto distribution based on the historical abnormality scores of historical normal batches is used as the initial warning threshold.
[0022] In one embodiment, when the real-time anomaly score exceeds the updated fermentation warning threshold, an incremental model update process is performed under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of historical normal fermentation batches to obtain an updated autoencoder model, including:
[0023] Based on historical spectral data, historical latent variables are extracted through the encoder of the preset autoencoder, and the K-means algorithm is used to cluster the historical latent variables according to the process parameter interval to obtain multiple process-conditioned historical feature prototypes. A memory matrix is constructed based on each historical feature prototype.
[0024] Based on the abnormal spectral data of the current abnormal batch, the abnormal latent variables are extracted through the preset autoencoder encoder. The corresponding process parameter interval is selected according to the abnormal process parameters of the current abnormal batch. The historical feature prototypes in the same interval are matched from the memory matrix, and the distillation loss term is calculated.
[0025] According to the spectral data of the current abnormal batch, the abnormal reconstruction error is calculated, and combined with the distillation loss term, the parameters of the preset autoencoder are updated to obtain the updated autoencoder model.
[0026] In one embodiment, the distillation loss term is:
[0027]
[0028] Among them, L distill is the distillation loss term, m is the number of historical feature prototypes in the memory matrix M, cos(θ i ) is the abnormal latent variable and the i-th historical feature prototype c i The cosine similarity of .
[0029] In one embodiment, the warning level is divided according to the real-time anomaly score and the warning threshold, and the warning instruction is generated based on the warning level and process parameters, including:
[0030] When the real-time abnormality score exceeds the warning threshold for the first time and the duration is less than the preset first threshold, it is determined to be a suspected bacterial risk and a spectral re-inspection instruction is generated;
[0031] When the real-time anomaly score exceeds the warning threshold continuously and the duration exceeds the preset first threshold and is less than the preset second threshold, or the real-time anomaly score exceeds 150% of the warning threshold, it is determined to be a high risk of contamination and a process parameter adjustment instruction is generated. The process parameter adjustment instruction is used to automatically adjust the pH value and temperature;
[0032] When the real-time anomaly score exceeds 200% of the warning threshold, or the real-time anomaly score exceeds the warning threshold continuously and the duration exceeds the preset second threshold, it is determined that the contamination is out of control and an emergency stop instruction is generated. The emergency stop instruction is used to stop the fermentation process.
[0033] In one embodiment, noise filtering and time series interpolation processing are performed based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor, including:
[0034] The original spectral data is subjected to wavelet threshold denoising to obtain denoised spectral data. The number of wavelet decomposition layers and threshold parameters are dynamically adjusted according to the spectral signal-to-noise ratio (SNR). The spectral signal-to-noise ratio is calculated as the ratio of the high-frequency noise intensity to the low-frequency signal energy of the original spectral data.
[0035] The original process parameters are smoothed using a sliding window moving average filter. The length of the sliding window is dynamically adjusted according to the fermentation stage of the fermentation liquid to obtain the filtered process parameters.
[0036] Based on the sampling timestamps of the filtered process parameters, cubic spline interpolation is performed on the denoised spectral data to generate spectral time series data synchronized with the sampling timestamps. The spectral time series data and the filtered process parameters are concatenated along the time dimension to generate a multimodal time series tensor.
[0037] In a second aspect, the present application also provides a control system for an online spectral analysis device for fermentation contamination early warning, comprising:
[0038] The multimodal data preprocessing module is used to perform noise filtering and time series interpolation processing based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor. The original process parameters include pH value and temperature;
[0039] A spectral feature decoupling module is used to perform spectral feature decoupling processing based on the spectral data and process parameters in the multimodal time series tensor through an adversarial autoencoder to obtain contamination-sensitive features. The adversarial autoencoder includes an encoder, a first decoder, a second decoder, and a discriminator.
[0040] The dynamic threshold and score calculation module is used to calculate the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature based on the preset autoencoder to obtain a real-time anomaly score, and update the current fermentation warning threshold based on extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on historical spectral data of historical normal fermentation batches;
[0041] The model update and early warning control module is used to perform incremental model update processing under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of historical normal fermentation batches when the real-time anomaly score exceeds the updated fermentation early warning threshold, obtain the updated autoencoder model, and divide the early warning level according to the real-time anomaly score and the early warning threshold, and generate early warning instructions based on the early warning level and process parameters.
[0042] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the first aspect when executing the computer program.
[0043] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the first aspect when the computer program is processed.
[0044] The control method and system for an online spectral analysis device for fermentation contamination early warning, through noise filtering and time-series interpolation processing of raw spectral data and process parameters, can remove noise interference from the data, achieve spatiotemporal alignment of multi-source data, and provide high-quality input data for subsequent analysis. Secondly, based on the spectral data and process parameters in a multimodal time series tensor, the dual-branch structure of an adversarial autoencoder and discriminator adversarial training can separate weak contamination-related features from complex spectral data, enhancing the detectability of weak contamination signals and further improving the sensitivity of early contamination early warning. Furthermore, the reconstruction error and KL divergence distribution offset of contamination-sensitive features are calculated based on a preset autoencoder to obtain a real-time anomaly score, quantifying the degree of anomaly in the fermentation process and providing a quantitative basis for contamination early warning. The warning threshold is updated based on extreme value theory, allowing it to adapt to the time-varying characteristics of the fermentation process data distribution, improving the accuracy of the anomaly score and the adaptability of the warning threshold, and reducing the false alarm rate. Finally, when the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated under the constraints of knowledge distillation based on the spectral data of the current anomaly batch and historical normal batches. This knowledge distillation mechanism preserves the characteristics of historical contamination patterns during model updates, preventing the model from forgetting historical knowledge due to new data input, thereby enhancing the model's adaptability to dynamic changes in the fermentation process. Furthermore, warning levels are divided based on the real-time anomaly score and warning threshold, and warning instructions are generated. This not only implements hierarchical warning and coordinated control, but also improves the efficiency and reliability of fermentation contamination risk control and reduces production losses caused by contamination.
[0045] Compared with traditional fermentation contamination early warning methods, this method enhances the detection capability of weak contamination signals through technical means such as adversarial feature decoupling, dynamic threshold calculation, and anti-forgetting incremental learning, and improves the early warning efficiency in complex fermentation environments. It provides an efficient and reliable technical solution for the prevention and control of contamination in fermentation processes in the fields of biopharmaceuticals, food processing, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0047] Figure 1 A flow chart of a control method for an online spectral analysis device for fermentation contamination early warning provided by an exemplary embodiment of the present invention;
[0048] Figure 2A schematic diagram of the control system structure of an online spectral analysis device for fermentation contamination early warning provided by an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0050] In one embodiment, Figure 1 As shown, a control method for an online spectral analysis device for fermentation contamination early warning is provided. This embodiment uses the method applied to a terminal as an example for illustration. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0051] S101: noise filtering and time series interpolation processing are performed based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor. The original process parameters include pH value and temperature.
[0052] Specifically, during the actual fermentation process, the online spectral analysis device can use a built-in spectral sensor to collect absorbance or reflectance data of the fermentation broth at different wavelengths, generating raw spectral data. Furthermore, pH and temperature sensors can be used to collect real-time pH and temperature data of the fermentation broth. Due to factors such as electromagnetic interference and sensor noise in actual production environments, raw spectral data often contains significant noise, and the sampling frequency and timestamps of the spectral data and process parameters differ. Therefore, the raw spectral data can be removed using a low-pass filter or denoised using a wavelet transform. Time series interpolation can be used to fill in uneven time intervals or missing values in the data collection using linear interpolation, spline interpolation, or machine learning-based interpolation methods. Finally, a multimodal time series tensor is generated. This vector is a high-dimensional data structure that simultaneously contains time series information of the spectral data and process parameters. It not only removes noise but also fills in missing data, providing a high-quality data foundation for subsequent feature extraction and analysis.
[0053] S102: Based on the spectral data and process parameters in the multimodal time series tensor, spectral feature decoupling processing is performed through an adversarial autoencoder to obtain contamination sensitive features. The adversarial autoencoder includes an encoder, a first decoder, a second decoder and a discriminator.
[0054] Specifically, the adversarial autoencoder is a deep learning model that combines the feature extraction capability of the autoencoder and the adversarial training mechanism of the generative adversarial network. The encoder can encode the input multimodal time series tensor into a low-dimensional feature vector, and the feature vector can capture the key information in the spectral data and process parameters. The first decoder can reconstruct the spectral data from the low-dimensional feature vector and optimize the feature extraction capability of the encoder by minimizing the reconstruction error. The second decoder can reconstruct the process parameters from the low-dimensional feature vector and further optimize the expression capability of the feature vector. The discriminator is used to distinguish whether the low-dimensional feature vector generated by the encoder is consistent with the real data distribution, and improve the quality of the feature vector through the adversarial training mechanism. Through the training of the adversarial autoencoder, the sensitive features related to contamination, namely the contamination sensitive features, can be decoupled. The contamination sensitive features can effectively reflect the changes in the microbial state during the fermentation process, providing a key basis for subsequent anomaly detection.
[0055] S103: According to the preset autoencoder, the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature are calculated to obtain a real-time anomaly score, and the current fermentation warning threshold is updated based on the extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on the historical spectral data of historical normal fermentation batches.
[0056] Specifically, the pre-set autoencoder is trained based on historical spectral data from normal fermentation batches, effectively identifying characteristic patterns during normal fermentation. By comparing the difference between the input contamination-sensitive features and the features reconstructed by the autoencoder, the reconstruction error can be calculated. A large reconstruction error indicates that the current features differ significantly from the normal fermentation pattern, indicating a potential risk of contamination. The KL divergence measures the difference between two probability distributions. By calculating the KL divergence between the current feature distribution and the normal fermentation feature distribution, the degree to which the current fermentation process deviates from normal can be quantified. Combining the reconstruction error and the KL divergence distribution offset yields a real-time anomaly score, which comprehensively reflects the degree of anomaly during the fermentation process. Furthermore, to improve the adaptability and robustness of the early warning system, the current fermentation warning threshold can be dynamically updated based on extreme value theory. Extreme value theory is a statistical method used to analyze the probability distribution of extreme events. Using this extreme value theory, adjustments and updates can be made based on the score and the current threshold, ensuring that the updated fermentation warning threshold better adapts to changes during the fermentation process.
[0057] S104: When the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated under the knowledge distillation constraint based on the abnormal spectral data of the current abnormal batch and the historical spectral data of the historical normal fermentation batches to obtain an updated autoencoder model. The warning level is divided according to the real-time anomaly score and the warning threshold, and the warning instruction is generated based on the warning level and process parameters.
[0058] Specifically, when the real-time anomaly score exceeds the updated fermentation warning threshold, it indicates that the current fermentation batch may be contaminated. Therefore, the model can be updated based on the abnormal spectral data of the current abnormal batch and the historical spectral data of the historical normal fermentation batches to further improve the warning accuracy and adaptability. Among them, knowledge distillation can improve the performance of the student model by migrating the knowledge of a complex model into a simple model. In this embodiment, the historical spectral data of the historical normal fermentation batches can be used as the knowledge source of the teacher model, and through the knowledge distillation constraint, this knowledge is migrated to the model update of the current abnormal batch to ensure the stability and reliability of the model update process. Through the incremental update under this constraint, the parameters of the autoencoder model can be adjusted in time to make it better adapt to the new fermentation batch and contamination mode. After completing the incremental update of the model, the warning level can be divided according to the real-time anomaly score and the warning threshold to obtain warning instructions and provide operators with clearer intervention suggestions.
[0059] In the above method, the original spectral data and original process parameters of the fermentation liquid are subjected to noise filtering and time series interpolation processing to obtain a multimodal time series tensor, which further improves the data quality and provides a reliable data basis for subsequent analysis. Secondly, based on the spectral data and process parameters in the multimodal time series tensor, the spectral feature decoupling processing is performed through the adversarial autoencoder, which can effectively separate the feature information related to contamination and suppress the interference of other irrelevant features to obtain contamination sensitive features. And by calculating the reconstruction error and KL divergence distribution offset of the contamination sensitive features through the preset autoencoder, the degree of abnormality in the fermentation process can be further quantified to obtain a real-time abnormality score. Based on this score, the current fermentation warning threshold can also be updated through extreme value theory, avoiding the problem of false alarms or omissions that may be caused by fixed thresholds, and can better adapt to the differences in fermentation processes of different batches, thereby improving the robustness and adaptability of the warning.
[0060] Finally, when the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated to produce an updated autoencoder model. This allows for timely adjustment of model parameters upon detecting an anomaly, while ensuring the stability and reliability of the model update process through knowledge distillation constraints. Furthermore, by categorizing warning levels based on the real-time anomaly score and warning threshold, and generating warning instructions based on process parameters, operators can be provided with clear intervention recommendations, enabling timely action to address contamination and reduce fermentation batch losses.
[0061] In one embodiment, noise filtering and time series interpolation processing are performed based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor, including:
[0062] The original spectral data is subjected to wavelet threshold denoising to obtain denoised spectral data. The number of wavelet decomposition layers and threshold parameters are dynamically adjusted according to the spectral signal-to-noise ratio (SNR). The spectral signal-to-noise ratio is calculated as the ratio of the high-frequency noise intensity to the low-frequency signal energy of the original spectral data.
[0063] The original process parameters are smoothed using a sliding window moving average filter. The length of the sliding window is dynamically adjusted according to the fermentation stage of the fermentation liquid to obtain the filtered process parameters.
[0064] Based on the sampling timestamps of the filtered process parameters, cubic spline interpolation is performed on the denoised spectral data to generate spectral time series data synchronized with the sampling timestamps. The spectral time series data and the filtered process parameters are concatenated along the time dimension to generate a multimodal time series tensor.
[0065] Specifically, the original spectral data can be decomposed into subbands of different frequencies using a wavelet transform. The number of decomposition levels can be dynamically adjusted based on the spectral signal-to-noise ratio to ensure that the decomposed subbands effectively separate noise and signal. Furthermore, at each decomposition level, thresholding can be applied to eliminate noise, and the threshold can be set based on the spectral signal-to-noise ratio to ensure that the effective information in the spectral data is retained to the greatest extent possible while removing noise. After thresholding, the denoised subbands can be reconstructed into denoised spectral data using an inverse wavelet transform.
[0066] Specifically, a sliding window moving average filtering technique can be used to smooth the original process parameters. The sliding window length is dynamically adjusted based on the fermentation stage of the fermentation broth to accommodate the varying characteristics of the process parameters at different stages. For example, in the early stages of fermentation, process parameters may fluctuate dramatically, so a shorter sliding window length can be used to more quickly respond to parameter changes. During the stable fermentation phase, a longer sliding window length can be used to achieve a smoother filtering effect. Finally, filtered process parameters are obtained, effectively reducing noise and fluctuations in the original process parameters. Furthermore, since spectral data and process parameters may have different sampling frequencies, cubic spline interpolation can be used to generate spectral time series data synchronized with the process parameter sampling timestamps. Cubic spline interpolation ensures a smooth transition of the interpolated spectral data along the time axis while preserving the shape characteristics and continuity of the original spectral data. The synchronized spectral time series data and the filtered process parameters are concatenated along the time dimension to form a multimodal time series tensor. This tensor integrates the spectral data and process parameters along the time dimension, providing a unified data structure for subsequent feature extraction and analysis.
[0067] In one embodiment, based on the spectral data and process parameters in the multimodal time series tensor, spectral feature decoupling processing is performed through an adversarial autoencoder to obtain contamination-sensitive features, including:
[0068] According to the spectral data and process parameters in the multimodal time series tensor, they are encoded separately through the dual-channel 1D convolution layer of the encoder to obtain spectral latent variables and process latent variables;
[0069] Performing a deconvolution operation through a first decoder according to the spectral latent variable to obtain a normal spectral reconstruction value, wherein a spectral reconstruction error between the spectral data and the normal spectral reconstruction value satisfies a preset error threshold;
[0070] The spectral latent variable and the process latent variable are concatenated and input into the second decoder to generate a contamination perturbation sequence. The contamination perturbation sequence is then input into the discriminator for adversarial training to obtain the optimal contamination perturbation sequence. The discriminator uses the process latent variable as a constraint and uses a binary classification loss function to distinguish the perturbation characteristics of the true contamination spectrum from the contamination perturbation sequence generated by the second decoder, generating an adversarial loss. The second decoder optimizes the network parameters based on the adversarial loss to generate the optimal contamination perturbation sequence.
[0071] The contamination sensitive features were obtained by processing the spectral latent variables and the optimal contamination disturbance sequence through Hadamard product operation.
[0072] Specifically, the 1D convolutional layer effectively captures local features and time series information in spectral data, compressing high-dimensional spectral data into a low-dimensional latent variable representation. Process parameters, on the other hand, are low-dimensional numerical data reflecting the macroscopic state of the fermentation process. Inputting them into the 1D convolutional layer enhances their feature representation through the convolution operation. The first decoder then performs a deconvolution operation on the spectral latent variables, gradually expanding them into reconstructed spectra with the same dimensionality as the original spectral data. To ensure the quality of the reconstructed spectra, a preset error threshold is set to ensure that the difference between the reconstructed and original spectra remains within an acceptable range. Furthermore, to extract sensitive features related to contamination from the spectral data, a second decoder generates a contamination perturbation sequence and combines it with a discriminator for adversarial training. The discriminator can condition the process latent variables, such as the current temperature stage, to ensure that the generated perturbation sequence conforms to the abnormal patterns of a specific process stage, enhancing the targeted feature decoupling. A binary classification loss is then used to determine whether the input perturbation sequence is a true contaminated sample or a generated sample. The second decoder minimizes the adversarial loss to ensure that the generated perturbation sequence approximates the true contamination feature distribution. Finally, the spectral latent variable is subjected to the Hadamard product with the optimal bacterial contamination disturbance sequence, that is, element-by-element multiplication, which can amplify the characteristic response related to bacterial contamination in the latent variable, suppress the normal fermentation background signal, and finally output the bacterial contamination sensitive feature.
[0073] In one embodiment, the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature are calculated based on a preset autoencoder to obtain a real-time anomaly score, and the current fermentation warning threshold is updated based on extreme value theory to obtain an updated fermentation warning threshold, including:
[0074] Input the bacterial contamination sensitivity feature into the encoder of the preset autoencoder to obtain the latent variable distribution, and reconstruct it through the decoder of the preset autoencoder to obtain a reconstructed feature vector;
[0075] Calculate the mean square error between the reconstructed feature vector and the contamination sensitivity feature, and calculate the reconstruction error in combination with the stability index of the process parameters. The stability index of the process parameters is calculated by the average of the current temperature in the process parameters and the normal temperature of the fermentation liquid in the current fermentation stage.
[0076] The KL divergence is calculated based on the statistical mean and covariance matrix of the latent variable distribution and the historical latent variable distribution of historical normal fermentation batches to obtain the KL divergence distribution offset, where the covariance matrix is dynamically scaled according to the fluctuation range of the current pH value in the process parameters;
[0077] The reconstruction error and the KL divergence distribution offset are weightedly fused to obtain a real-time anomaly score;
[0078] Based on extreme value theory, the extreme value distribution of the real-time abnormality score in the current fermentation stage is modeled, a generalized Pareto distribution is fitted, and the 99% quantile of the generalized Pareto distribution is used as the candidate threshold;
[0079] When the candidate threshold is less than the current fermentation warning threshold, the current fermentation warning threshold is used as the updated fermentation warning threshold, otherwise the candidate threshold is used as the updated fermentation warning threshold, where the 99% quantile of the generalized Pareto distribution based on the historical abnormality scores of historical normal batches is used as the initial warning threshold.
[0080] Specifically, the autoencoder is an unsupervised learning model that can learn an effective representation of data, namely the distribution of latent variables. The encoder maps the high-dimensional contamination-sensitive features to a low-dimensional latent variable space, reducing the spatial dimension but retaining the key information in the data. Inputting it into the decoder can obtain a reconstructed feature vector. The reconstructed feature vector is an approximate representation of the original contamination-sensitive features, reducing the dimensionality of the data and retaining key information. The smaller the mean square error between the reconstructed feature vector and the original contamination-sensitive features, the closer they are, and the better the reconstruction effect. In addition, during the fermentation process, fluctuations in process parameters such as temperature changes may cause changes in spectral features, which can easily be confused with changes in features caused by contamination. Therefore, the stability index of the process parameters can also be combined to calculate the reconstruction error to more comprehensively evaluate the degree of abnormality in the fermentation process.
[0081] Furthermore, in the early stages of bacterial contamination, characteristic changes are subtle, but the specific numerical changes are not noticeable, making them undetectable. However, bacterial contamination can alter the composition of the fermentation broth, causing the probability distribution of the spectral features to deviate from the normal pattern. Therefore, the KL divergence distribution offset can be calculated based on the latent variable distribution and the historical latent variable distribution of normal fermentation batches to quantify the degree of offset and improve the detection capability of early bacterial contamination. The historical latent variable distribution can be described by the statistical mean and covariance matrix. Furthermore, the covariance matrix can be dynamically scaled based on the current pH fluctuation range. The greater the pH fluctuation, the higher the covariance matrix scaling, to accommodate the distribution uncertainty under different process fluctuations. A weighted fusion of the reconstruction error and the KL divergence distribution offset can be used to obtain a real-time anomaly score. The extreme value distribution of the real-time anomaly score for the current fermentation stage can then be modeled and fitted with a generalized Pareto distribution. The 99th percentile of this distribution is used as a candidate threshold, meaning that in extreme cases, only 1% of the real-time anomaly scores will exceed this threshold, effectively reflecting abnormal conditions in the fermentation process. When the candidate threshold is smaller than the current fermentation warning threshold, the current fermentation warning threshold is used as the updated fermentation warning threshold; otherwise, the candidate threshold is used as the updated fermentation warning threshold, thereby enabling the fermentation warning threshold to be dynamically adjusted to adapt to changes in the fermentation process, thereby improving the accuracy and timeliness of the warning.
[0082] In one embodiment, when the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of historical normal fermentation batches to obtain an updated autoencoder model, including:
[0083] Based on historical spectral data, historical latent variables are extracted through the encoder of the preset autoencoder, and the K-means algorithm is used to cluster the historical latent variables according to the process parameter interval to obtain multiple process-conditioned historical feature prototypes. A memory matrix is constructed based on each historical feature prototype.
[0084] Based on the abnormal spectral data of the current abnormal batch, the abnormal latent variables are extracted through the preset autoencoder encoder. The corresponding process parameter interval is selected according to the abnormal process parameters of the current abnormal batch. The historical feature prototypes in the same interval are matched from the memory matrix, and the distillation loss term is calculated.
[0085] According to the spectral data of the current abnormal batch, the abnormal reconstruction error is calculated, and combined with the distillation loss term, the parameters of the preset autoencoder are updated to obtain the updated autoencoder model.
[0086] Specifically, the K-means algorithm is a clustering method that can divide data into several clusters, so that the data within the cluster has a high degree of similarity, while the data between clusters are quite different. Different process parameter intervals may correspond to different process states in the fermentation process, such as different combination ranges of parameters such as fermentation temperature and pH. By clustering according to process parameter intervals, historical latent variables can be divided into several clusters related to specific process conditions. The center of each cluster can be regarded as a historical feature prototype, representing the typical characteristics of historical normal fermentation batches under this process parameter interval. The memory matrix is a storage structure that can organize the historical feature prototypes of different process parameter intervals so that when processing abnormal batch spectral data later, the historical feature prototype corresponding to the current abnormal batch process parameters can be quickly found.
[0087] When an abnormality is detected during the fermentation process of the current batch, the encoder portion of the preset autoencoder model can be used to encode the abnormal spectral data and extract the corresponding abnormal latent variables. Based on the abnormal process parameters of the current abnormal batch, the corresponding process parameter range is selected, and the characteristic prototype of a historical normal fermentation process with similar process conditions to the current abnormal batch is found from the memory matrix. The historical characteristic prototype can then be regarded as the knowledge of the teacher model, while the abnormal latent variable of the current abnormal batch is regarded as the characteristic representation of the student model under the current abnormal situation. By measuring the difference between the current abnormal latent variable and the matched historical characteristic prototype, a distillation loss term is obtained to achieve knowledge transfer. A smaller distillation loss value indicates that the current abnormal latent variable is closer to the historical characteristic prototype, indicating that the model can still maintain a good similarity with the historical normal fermentation process under the current abnormal situation.
[0088] Schematically, the distillation loss term can be:
[0089]
[0090] Among them, L distill is the distillation loss term, m is the number of historical feature prototypes in the memory matrix M, cos(θ i ) is the abnormal latent variable and the i-th historical feature prototype c i The cosine similarity of .
[0091] The anomaly reconstruction error measures the degree of error in the reconstruction of the current abnormal batch of spectral data using the autoencoder model. A larger anomaly reconstruction error indicates that the model's ability to reconstruct the abnormal spectral data is poor, necessitating a model update. Therefore, the anomaly reconstruction error and the distillation loss term are combined to update the parameters of the pre-set autoencoder, resulting in an updated autoencoder model. This updated model is better able to handle the current abnormal batch while maintaining a certain degree of adaptability to historically normal fermentation processes.
[0092] In one embodiment, warning levels are divided according to real-time anomaly scores and warning thresholds, and warning instructions are generated based on the warning levels and process parameters, including:
[0093] When the real-time abnormality score exceeds the warning threshold for the first time and the duration is less than the preset first threshold, it is determined to be a suspected bacterial risk and a spectral re-inspection instruction is generated;
[0094] When the real-time anomaly score exceeds the warning threshold continuously and the duration exceeds the preset first threshold and is less than the preset second threshold, or the real-time anomaly score exceeds 150% of the warning threshold, it is determined to be a high risk of contamination and a process parameter adjustment instruction is generated. The process parameter adjustment instruction is used to automatically adjust the pH value and temperature;
[0095] When the real-time anomaly score exceeds 200% of the warning threshold, or the real-time anomaly score exceeds the warning threshold continuously and the duration exceeds the preset second threshold, it is determined that the contamination is out of control and an emergency stop instruction is generated. The emergency stop instruction is used to stop the fermentation process.
[0096] Specifically, when the real-time anomaly score exceeds the warning threshold for the first time and persists for less than a preset first threshold, the increase in the anomaly score may be due to a brief disturbance or data fluctuation. Therefore, a spectral recheck instruction can be generated, triggering the spectral sensor to collect a second spectrum of the fermentation broth. By performing multiple spectral tests on the same fermentation batch, it is possible to verify whether the initial anomaly score was a random occurrence, thereby improving the accuracy of the warning. If the real-time anomaly score continuously exceeds the warning threshold for a duration exceeding the preset first threshold but less than the preset second threshold, or if the real-time anomaly score exceeds 150% of the warning threshold, this indicates that the anomaly is not a brief disturbance but rather a real bacterial contamination issue. Therefore, a process parameter adjustment instruction can be generated to automatically adjust key parameters in the fermentation process to inhibit bacterial growth and reduce the risk of contamination. If the real-time anomaly score exceeds 200% of the warning threshold, or if the real-time anomaly score continuously exceeds the warning threshold for a duration exceeding the preset second threshold, this indicates that the contamination situation may be severe, and an emergency shutdown instruction can be generated to prevent further deterioration of the contamination and avoid further losses to the entire production batch.
[0097] like Figure 2 As shown, based on the same inventive concept, the embodiment of the present application also provides a control system 200 for an online spectral analysis device for fermentation contamination early warning, which is used to implement the control method of the online spectral analysis device for fermentation contamination early warning involved above. The implementation scheme for solving the problem provided by this system is similar to the implementation scheme described in the above method. Therefore, the specific limitations of the control system embodiments of one or more online spectral analysis devices for fermentation contamination early warning provided below can be found in the above limitations on the control method of the online spectral analysis device for fermentation contamination early warning, and will not be repeated here. The system includes:
[0098] The multimodal data preprocessing module 201 is used to perform noise filtering and time series interpolation processing based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor. The original process parameters include pH value and temperature;
[0099] A spectral feature decoupling module 202 is configured to perform spectral feature decoupling processing based on the spectral data and process parameters in the multimodal time series tensor through an adversarial autoencoder to obtain a contamination-sensitive feature. The adversarial autoencoder includes an encoder, a first decoder, a second decoder, and a discriminator.
[0100] The dynamic threshold and score calculation module 203 is used to calculate the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature based on a preset autoencoder to obtain a real-time anomaly score, and update the current fermentation warning threshold based on extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on historical spectral data of historical normal fermentation batches;
[0101] The model update and warning control module 204 is used to perform incremental model update processing under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of historical normal fermentation batches when the real-time anomaly score exceeds the updated fermentation warning threshold, to obtain an updated autoencoder model, and to divide the warning level according to the real-time anomaly score and the warning threshold, and generate warning instructions based on the warning level and process parameters.
[0102] In an exemplary embodiment, the present invention further provides a computer device comprising a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the control method of the online spectral analysis device for fermentation contamination early warning. A multi-core processor is preferred to improve the system's parallel processing capabilities. Memory: Provides sufficient temporary storage space to support program execution and data processing. The memory capacity should be large enough to accommodate large amounts of supply information and computing tasks.
[0103] In an exemplary embodiment, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the control method of the online spectral analysis device for fermentation contamination early warning of the present application.
[0104] The above-described embodiments merely represent several implementation methods of the embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the concept of the embodiments of the present application, and these modifications and improvements fall within the scope of protection of the embodiments of the present application.
Claims
1. A control method for an online spectral analysis device for fermentation contamination early warning, characterized in that: The method comprises: noise filtering and time series interpolation processing are performed based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor, wherein the original process parameters include pH value and temperature; Based on the spectral data and process parameters in the multimodal time series tensor, spectral feature decoupling processing is performed through an adversarial autoencoder to obtain contamination sensitive features, wherein the adversarial autoencoder includes an encoder, a first decoder, a second decoder and a discriminator; According to a preset autoencoder, the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature are calculated to obtain a real-time anomaly score, and the current fermentation warning threshold is updated based on extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on historical spectral data of historical normal fermentation batches; When the real-time anomaly score exceeds the updated fermentation warning threshold, the model is incrementally updated under the knowledge distillation constraint based on the abnormal spectral data of the current abnormal batch and the historical spectral data of the historical normal fermentation batch to obtain an updated autoencoder model. The warning level is divided according to the real-time anomaly score and the warning threshold, and a warning instruction is generated based on the warning level and the process parameters.
2. The method according to claim 1, characterized in that The method of performing spectral feature decoupling processing based on the spectral data and process parameters in the multimodal time series tensor through an adversarial autoencoder to obtain bacterial contamination sensitive features includes: According to the spectral data and the process parameters in the multimodal time series tensor, encoding is performed respectively through the dual-channel 1D convolution layer of the encoder to obtain spectral latent variables and process latent variables; performing a deconvolution operation through the first decoder according to the spectral latent variable to obtain a normal spectral reconstruction value, wherein a spectral reconstruction error between the spectral data and the normal spectral reconstruction value satisfies a preset error threshold; The spectral latent variable and the process latent variable are concatenated and input into the second decoder to generate a contamination perturbation sequence, and the contamination perturbation sequence is input into the discriminator for adversarial training to obtain an optimal contamination perturbation sequence. The discriminator uses the process latent variable as a constraint and uses a binary classification loss function to distinguish the perturbation characteristics of the true contamination spectrum from the contamination perturbation sequence generated by the second decoder to generate an adversarial loss. The second decoder optimizes network parameters based on the adversarial loss to generate the optimal contamination perturbation sequence. The bacterial contamination sensitive feature is obtained by performing a Hadamard product operation on the spectral latent variable and the optimal bacterial contamination disturbance sequence.
3. The method according to claim 1, characterized in that The method calculates the reconstruction error and KL divergence distribution offset of the bacterial contamination sensitive feature according to the preset autoencoder to obtain a real-time anomaly score, and updates the current fermentation warning threshold based on extreme value theory to obtain an updated fermentation warning threshold, including: Inputting the bacterial contamination sensitivity feature into the encoder of the preset autoencoder to obtain a latent variable distribution, and performing reconstruction processing through the decoder of the preset autoencoder to obtain a reconstructed feature vector; Calculating the mean square error between the reconstructed feature vector and the contamination sensitivity feature, and calculating the reconstruction error in combination with the stability index of the process parameter, wherein the stability index of the process parameter is calculated by the average of the current temperature in the process parameter and the normal temperature of the fermentation liquid in the current fermentation stage; performing a KL divergence calculation based on the statistical mean and covariance matrix of the latent variable distribution and the historical latent variable distribution of the historical normal fermentation batches to obtain the KL divergence distribution offset, wherein the covariance matrix is dynamically scaled according to the fluctuation range of the current pH value in the process parameter; Performing weighted fusion on the reconstruction error and the KL divergence distribution offset to obtain the real-time anomaly score; Based on the extreme value theory, modeling the extreme value distribution of the real-time abnormality score in the current fermentation stage, fitting a generalized Pareto distribution, and using the 99% quantile of the generalized Pareto distribution as a candidate threshold; When the candidate threshold is less than the current fermentation warning threshold, the current fermentation warning threshold is used as the updated fermentation warning threshold; otherwise, the candidate threshold is used as the updated fermentation warning threshold, where the 99% quantile of the generalized Pareto distribution based on the historical abnormality scores of the historical normal batches is used as the initial warning threshold.
4. The method according to claim 1, wherein When the real-time anomaly score exceeds the updated fermentation warning threshold, a model incremental update process is performed under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of the historical normal fermentation batch to obtain an updated autoencoder model, including: Extracting historical latent variables from the historical spectral data using an encoder of the preset autoencoder, clustering the historical latent variables according to process parameter intervals using a K-means algorithm to obtain a plurality of process-conditioned historical feature prototypes, and constructing a memory matrix based on each of the historical feature prototypes; Based on the abnormal spectral data of the current abnormal batch, extracting abnormal latent variables through the encoder of the preset autoencoder, selecting a corresponding process parameter interval according to the abnormal process parameters of the current abnormal batch, matching the historical feature prototypes in the same interval from the memory matrix, and calculating the distillation loss term; According to the spectral data of the current abnormal batch, the abnormal reconstruction error is calculated, and the parameters of the preset autoencoder are updated in combination with the distillation loss term to obtain the updated autoencoder model.
5. The method according to claim 4, characterized in that The distillation loss term is: Among them, L distill is the distillation loss term, m is the number of historical feature prototypes in the memory matrix M, cos(θ i ) is the abnormal latent variable and the i-th historical feature prototype c i The cosine similarity of .
6. The method according to claim 1, characterized in that The step of dividing the warning level according to the real-time anomaly score and the warning threshold, and generating a warning instruction according to the warning level and the process parameters includes: When the real-time abnormality score exceeds the warning threshold for the first time and the duration is less than the preset first threshold, it is determined to be a suspected bacterial contamination risk and a spectral re-inspection instruction is generated; When the real-time abnormality score continuously exceeds the warning threshold and the duration exceeds the preset first threshold and is less than the preset second threshold, or the real-time abnormality score exceeds 150% of the warning threshold, it is determined to be a high risk of contamination, and a process parameter adjustment instruction is generated, which is used to automatically adjust the pH value and the temperature; When the real-time abnormality score exceeds 200% of the warning threshold, or the real-time abnormality score exceeds the warning threshold continuously and the duration exceeds the preset second threshold, it is determined that the contamination is out of control and an emergency shutdown instruction is generated. The emergency shutdown instruction is used to stop the fermentation process.
7. The method according to claim 1, characterized in that The method performs noise filtering and time series interpolation processing based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor, including: performing wavelet threshold denoising on the original spectral data to obtain denoised spectral data, wherein the number of wavelet decomposition layers and threshold parameters are dynamically adjusted according to a spectral signal-to-noise ratio (SNR), wherein the spectral signal-to-noise ratio is calculated as a ratio of high-frequency noise intensity to low-frequency signal energy in the original spectral data; The original process parameters are smoothed using a sliding window moving average filter, where the length of the sliding window is dynamically adjusted according to the fermentation stage corresponding to the fermentation liquid, to obtain filtered process parameters; Based on the sampling timestamp of the filtered process parameters, the denoised spectral data is subjected to cubic spline interpolation processing to generate spectral time series data synchronized with the sampling timestamp, and the spectral time series data is spliced with the filtered process parameters along the time dimension to generate the multimodal time series tensor.
8. A control system for an online spectral analysis device for fermentation contamination early warning, characterized in that: The system comprises: A multimodal data preprocessing module is used to perform noise filtering and time series interpolation processing based on the original spectral data and original process parameters of the fermentation liquid during the fermentation process to obtain a multimodal time series tensor, wherein the original process parameters include pH value and temperature; A spectral feature decoupling module is used to perform spectral feature decoupling processing based on the spectral data and process parameters in the multimodal time series tensor through an adversarial autoencoder to obtain a contamination sensitive feature. The adversarial autoencoder includes an encoder, a first decoder, a second decoder, and a discriminator. A dynamic threshold and score calculation module is used to calculate the reconstruction error and KL divergence distribution offset of the contamination sensitivity feature based on a preset autoencoder to obtain a real-time anomaly score, and to update the current fermentation warning threshold based on extreme value theory to obtain an updated fermentation warning threshold. The preset autoencoder is trained based on historical spectral data of historical normal fermentation batches. The model update and early warning control module is used to perform incremental model update processing under knowledge distillation constraints based on the abnormal spectral data of the current abnormal batch and the historical spectral data of the historical normal fermentation batches when the real-time anomaly score exceeds the updated fermentation early warning threshold, to obtain an updated autoencoder model, and to divide the early warning level according to the real-time anomaly score and the early warning threshold, and to generate an early warning instruction based on the early warning level and the process parameters.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Big data analysis system based on microbial fermentation
CN121117785A