A soft sensing method for fermentation process based on spatiotemporal attention
By integrating time and space attention mechanisms during the fermentation process, obtaining spatial and fusion characteristics of time and space and inputting into the LSTM layer, the dynamic optimization control problem during the fermentation process is solved, improving prediction accuracy and reducing costs.
Patent Information
- Application Number
- CN202510293499.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-03-13
AI Technical Summary
Due to time-varying, nonlinear and strong coupling characteristics during the fermentation process, it is difficult to establish an accurate mechanism model, which makes it difficult to optimize and control the dynamic process, and the lack of reliable sensors makes it difficult to detect product quality online.
A soft measurement method for fermentation process based on space-time attention is proposed. By fusing the time attention mechanism and the space-time attention mechanism, the spatial-time fusion feature representation is obtained, and the LSTM layer is input to capture long-term dependencies to achieve soft measurement prediction.
It improves the prediction accuracy of the model, achieves fast response and accurate prediction results, and reduces the time and maintenance costs of industrial fermentation.
Smart Images

Figure CN119783567B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning and soft measurement modeling of fermentation process, and in particular to a soft measurement method of fermentation process based on spatiotemporal attention. Background Art
[0002] During the fermentation process, the real-time acquisition of important biochemical parameters (such as bacterial concentration, substrate concentration, product concentration, etc.) is of great significance for process control and optimization. However, the fermentation process has the characteristics of time-varying, strong nonlinearity, and strong coupling. It is difficult to establish an accurate mechanism model to analyze and correct process measurement data, which brings great difficulties to the optimization control of dynamic processes. The quality of key products cannot be detected online due to the lack of reliable sensors. In addition, manual sampling and offline analysis have a large time delay, which often takes several hours; on the other hand, too many sampling times can easily increase the probability of contamination of bacteria and even fermentation failure, which also makes it difficult to apply advanced control and optimization strategies in fermentation.
[0003] Soft sensor technology is an important branch in the field of industrial automation and process control. Soft sensor modeling is generally divided into two main methods, theoretical methods and empirical methods. Theoretical models are modeled through an in-depth understanding of the complex operations of industrial processes. Empirical models mainly use data-driven methods, using algorithms such as machine learning and statistical analysis to learn and extract information from a large amount of historical data, and build models to predict and estimate process variables. In contrast, empirical soft sensor models rely on analyzing data sets without in-depth research on the underlying physical and chemical processes. Empirical models use advanced statistical methods to provide predictions by identifying patterns and inferring correlations from collected data.
[0004] Although deep learning technology has made remarkable achievements in soft sensor modeling, it still has certain limitations in the industrial fermentation process. In order to more effectively obtain deeper information and improve the prediction accuracy of the soft sensor model. The present invention discloses a fermentation process soft sensor method based on spatiotemporal attention, and proposes an attention mechanism network based on spatiotemporal fusion. The network has the ability to identify the hidden states of input variables and quality variables, which improves the prediction accuracy of the model. Summary of the invention
[0005] The present invention discloses a fermentation process soft measurement method based on spatiotemporal attention, which belongs to the field of soft measurement modeling and application of industrial fermentation production process. First, the temporal attention mechanism is fused with the spatial attention mechanism to obtain the spatiotemporal fusion feature representation of different batches, and then the obtained fusion feature representation of different batches is input into the LSTM layer to obtain long-term dependencies, thereby realizing soft measurement prediction output. The model has the ability to identify the hidden state of input variables and quality variables, and is modeled according to the relationship between each small batch. By considering the spatiotemporal interaction and long-term dependencies between input variables, the prediction accuracy of the model is improved, and rapid response, minimum maintenance cost and accurate prediction results are achieved. To achieve the above purpose, the following steps are implemented:
[0006] Step 1: Preprocess the original time series data of the industrial process to obtain a refined data set, D = {X, Y} = {x t-w+1 ,...,x t},{y t ,...,y t-v+1}, where X is the process variable, Y is the output variable, t represents time, w is the input window size, and v is the output window size.
[0007] Step 2: To learn the complex spatial dependencies between process variables and output variables, a spatial convolutional attention mechanism is proposed to encode the obtained dataset.
[0008] Step 2.1: To reduce the significant feature mapping and the amount of calculation to prevent overfitting, feature extraction is performed through the convolution layer and the maximum pooling layer, and scanning is performed along the time dimension through the kth CNN filter:
[0009]
[0010] Among them, w k represents the weight parameter, b k represents the offset, x i is the i-th time series, i = 1, 2, ..., n + 1, including process variables and quality variables. For simplicity, x n+1 represents the target sequence y, and ReLU is the activation function.
[0011] Step 2.2: Integrate the generated vectors into matrix form M i , in order to capture the most important features, maximum pooling is performed on each row of the matrix and h i Integrate into matrix form:
[0012] h i =MaxPool(M i ),
[0013] H=(h 1 ,h 2 ,...,h n+1 ) T ,
[0014] Among them, h i It represents the features obtained after processing the original data, and H represents the integrated matrix.
[0015] Step 2.3: Input the integrated matrix into the spatial attention module. The spatial convolution attention mechanism is as follows:
[0016]
[0017] Where X = (x 1 ,x 2 ,...,x n ,y) T is the input matrix after data processing, W i qs ,W i ks ,W i vs is a learnable parameter, d is the process variable dimension, k is the number of convolution kernels, is the matrix after the feature matrix H is converted with the input matrix X. is the scaled dot product output, and Z is the matrix after projecting the output.
[0018] Step 3: After extracting features from the encoder, the temporal convolutional attention mechanism is introduced to learn temporal dependencies. The temporal convolutional attention mechanism is as follows:
[0019]
[0020] in, is the matrix after Y is transformed using the multi-head mechanism, is the scaled dot product output, and O is the matrix after projecting the output.
[0021] Step 4: To better learn spatiotemporal dependencies, combine the spatial convolutional attention mechanism with the temporal convolutional attention mechanism:
[0022]
[0023] Among them, W qst , W kst is a learning parameter.
[0024] Step 5: To capture the long-term dependencies between different batches, the spatiotemporal features of different batches B are fused Send to the LSTM layer to get the predicted output. The LSTM mechanism is as follows:
[0025] I t =σ(Γ st W Γi +H t-1 W hi +b i ),
[0026] F t =σ(Γ st W Γf +H t-1 W hf +b f ),
[0027] O t =σ(Γ st W Γo +H t-1 W ho +b o ),
[0028]
[0029] C t =F t ⊙C t-1 +I t ⊙C t ,
[0030] H t =O t ⊙tanh(C t ),
[0031] Among them, I t ,F t ,O t They are input gate, forget gate and output gate respectively, C t is the cell memory state at time t, C t is the candidate cell state at time t, H t is the current hidden state, σ is the activation function, ⊙ is the dot multiplication operation, tanh is the activation function, W Γi ,W hi ,W Γf ,W hf ,W Γo ,W ho ,W Γc ,W hc is the weight parameter, b i ,b f ,b o ,b c is the offset.
[0032] Step 6: Use mean square error and R 2 Test the modeling results:
[0033]
[0034] Among them, y i is the true value, y i is the predicted value, Yes i The average value of .
[0035] This method can be applied to the field of intermittent fermentation. Through small batches of different batch data, the spatiotemporal attention and spatial attention fusion mechanism and LSTM module are used to perform batch modeling of the intermittent fermentation process. The model has the ability to identify the hidden state of input variables and quality variables, and is modeled according to the relationship between each small batch. By considering the spatiotemporal interaction and long-term dependency between input variables, the prediction accuracy of the model is improved, rapid response is achieved, the time cost and maintenance cost of industrial fermentation are reduced, and accurate prediction results are obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is an overall flow chart of an embodiment of the present invention.
[0037] Figure 2 This is a model structure diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0039] Figure 1 This is a flow chart of an embodiment. This embodiment provides a deep learning soft measurement method based on spatiotemporal attention. The specific process includes: collecting original data and normalizing the data; establishing a spatiotemporal attention fusion model through the spatiotemporal attention mechanism; obtaining spatiotemporal fusion features of different batches through the fusion model; inputting the fusion features of different batches into the LSTM layer to obtain soft measurement output; and performing model verification on the prediction results.
[0040] Figure 2 It is a soft measurement model structure constructed by the present invention, which is composed of a spatiotemporal attention fusion network and a long short-term memory gate.
[0041] A fermentation process soft sensing method based on spatiotemporal attention includes the following steps:
[0042] Step 1: Preprocess the original time series data of the fermentation process to obtain a refined data set, D = {X, Y} = {x t-w+1 ,...,x t},{y t ,...,y t-v+1}, where X is the process variable, Y is the output variable, t represents time, w is the input window size, and v is the output window size.
[0043] Step 2: To learn the complex spatial dependencies between process variables and output variables, a spatial convolutional attention mechanism is proposed to encode the obtained dataset.
[0044] Step 2.1: To reduce the significant feature mapping and the amount of calculation to prevent overfitting, feature extraction is performed through the convolution layer and the maximum pooling layer, and scanning is performed along the time dimension through the kth CNN filter:
[0045]
[0046] Among them, w k represents the weight parameter, b k represents the offset, x i is the i-th time series, i = 1, 2, ..., n + 1, including process variables and quality variables. For simplicity, x n+1 represents the target sequence y, and ReLU is the activation function.
[0047] Step 2.2: Integrate the generated vectors into matrix form M i , in order to capture the most important features, maximum pooling is performed on each row of the matrix and h i Integrate into matrix form:
[0048] h i =MaxPool(M i ),
[0049] H=(h 1 ,h 2 ,...,h n+1 ) T ,
[0050] Among them, h i It represents the features obtained after processing the original data, and H represents the integrated matrix.
[0051] Step 2.3: Input the integrated matrix into the spatial convolution attention module. The spatial convolution attention mechanism is as follows:
[0052]
[0053] V i s =XW i vs ,
[0054]
[0055] Where X = (x 1 ,x 2 ,...,x n ,y) T is the input matrix after data processing, W i qs ,W i ks ,W i vs is a learnable parameter, d is the process variable dimension, k is the number of convolution kernels, is the matrix after the feature matrix H is converted with the input matrix X. is the scaled dot product output, and Z is the matrix after projecting the output.
[0056] Step 3: After extracting features from the encoder, the temporal convolutional attention mechanism is introduced to learn temporal dependencies. The temporal convolutional attention mechanism is as follows:
[0057]
[0058] in, is the matrix after Y is transformed using the multi-head mechanism, is the scaled dot product output, and O is the matrix after projecting the output.
[0059] Step 4: To better learn spatiotemporal dependencies, combine the spatial convolutional attention mechanism with the temporal convolutional attention mechanism:
[0060]
[0061] Among them, W qst , W kst is a learning parameter.
[0062] Step 5: To capture the long-term dependencies between different batches, the spatiotemporal features of different batches B are fused Send to the LSTM layer to get the predicted output. The LSTM mechanism is as follows:
[0063] I t =σ(Γ st W Γi +H t-1 W hi +b i ),
[0064] F t =σ(Γ st W Γf +H t-1 W hf +b f ),
[0065] O t =σ(Γ st W Γo +H t-1 W ho +b o ),
[0066]
[0067] C t =F t ⊙C t-1 +I t ⊙C t ,
[0068] H t =O t ⊙tanh(C t ),
[0069] Among them, I t ,F t ,O t They are input gate, forget gate and output gate respectively, C t is the cell memory state at time t, C t is the candidate cell state at time t, H t is the current hidden state, σ is the activation function, ⊙ is the dot multiplication operation, tanh is the activation function, W Γi ,W hi ,W Γf ,W hf ,W Γo ,W ho ,W Γc ,W hc is the weight parameter, b i ,b f ,b o ,b c is the offset.
[0070] Step 6: Use mean square error and R 2 Test the modeling results:
[0071]
[0072] Among them, y i is the true value, y i is the predicted value, Yes i The average value of .
Claims
1. A fermentation process soft sensing method based on spatiotemporal attention, characterized in that: The steps include: Step 1: Preprocess the original time series data of the fermentation process; Step 2: In order to learn the complex spatial dependencies between process variables and output variables, a spatial convolutional attention mechanism is proposed to encode the obtained dataset. The specific implementation steps are as follows: Step 2.1: To reduce the significant feature mapping and prevent overfitting, feature extraction is performed through the convolution layer and the maximum pooling layer, and scanning is performed along the time dimension through the kth CNN filter: Among them, w k represents the weight parameter, b k represents the offset, x i is the i-th time series, i = 1, 2, ..., n + 1, including process variables and quality variables. For simplicity, x n+1 represents the target sequence y, R e LU is the activation function; Step 2.2: Integrate the generated vectors into matrix form M i , in order to capture the most important features, maximum pooling is performed on each row of the matrix and h i Integrate into matrix form: h i =MaxPool(M i ), H=(h 1 ,h 2 ,…,h n+1 ) T , Among them, h i represents the features obtained after processing the original data, and H represents the integrated matrix; Step 2.3: Input the integrated matrix into the spatial convolution attention module. The spatial convolution attention mechanism is as follows: V i s =XW i vs , Where X = (x 1 ,x 2 ,...,x n ,y) T is the input matrix after data processing, W i qs ,W i ks ,W i vs is a learnable parameter, d k is the process variable dimension, k is the number of convolution kernels, V i S is the matrix after the feature matrix H is converted with the input matrix X. is the scaled dot product output, and Z is the matrix after projecting the output; Step 3: After extracting features from the encoder, the temporal convolutional attention mechanism is introduced to learn temporal dependencies. The specific implementation steps are as follows: in, V i t is the matrix after Y is transformed using the multi-head attention mechanism, and O is the matrix after the output is projected; Step 4: In order to better learn the spatiotemporal dependencies, the spatial convolutional attention mechanism is integrated with the temporal convolutional attention mechanism. The specific implementation steps are as follows: Among them, W qst , W kst is the learning parameter; Step 5: To capture long-term dependencies, combine the spatiotemporal features of different batches B Send it to the LSTM layer to get the predicted output, which is implemented as follows: The LSTM mechanism is as follows: I t =σ(Γ st W Γi +H t-1 W hi +b i ), F t =σ(Γ st W Γf +H t-1 W hf +b f ), The t =σ(Γ st W Γo +H t-1 W ho +b o ), C t =F t ⊙C t-1 +I t C t , H t =O t ⊙tanh(C t ), Among them, I t ,F t ,O t They are input gate, forget gate and output gate respectively, C t is the cell memory state at time t, C t is the candidate cell state at time t, H t is the current hidden state, σ is the activation function, ⊙ is the dot multiplication operation, tant is the activation function, W Γi ,W hi ,W Γf ,W hf ,W Γo ,W ho ,W Γc ,W hc is the weight parameter, b i ,b f ,b o ,b c is the offset; Step 6: Use mean square error and R 2 Verify the modeling results.
Citation Information
Patent Citations
Soft measurement modeling method based on multi-scale convolution and adaptive feature fusion
CN116842358A
Polyethylene resin density prediction model based on space-time double-attention model
CN117476135A