An electronic tongue liquor detection method based on AIF-1DCNN
Through the AIF-1DCNN method, the integrated electrode was used to collect liquor sample information and perform feature extraction and weighted fusion, which solved the problem of complex and low accuracy of feature extraction in electronic tongue liquor detection, and achieved efficient liquor ingredient analysis and classification detection.
Patent Information
- Application Number
- CN202111312263.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-11-08
AI Technical Summary
The existing electronic tongue liquor detection methods are complex and time-consuming in the feature extraction process, and deep learning algorithms ignore the full-time domain information measured by the electronic tongue, resulting in low accuracy.
Using the electronic tongue liquor detection method based on AIF-1DCNN, the liquor sample information is collected through integrated electrodes, and data preprocessing is performed, electrode attention feature extraction with convolution kernel size n, global average pooling and weighted fusion are combined with adaptive momentum Random optimization method trains AIF-1DCNN neural network to improve detection efficiency and accuracy.
The efficiency and accuracy of liquor ingredient analysis have been improved, and the accuracy of classification detection has been significantly improved compared with traditional methods. The average accuracy rate has reached 96.8%, which is better than the simple one-dimensional convolutional neural network model.
Smart Images

Figure CN114636736B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic tongue, and in particular to an electronic tongue liquor detection method based on AIF-1DCNN. Background Art
[0002] As a modern intelligent sensing instrument that is real-time, accurate, efficient, non-invasive and portable, the electronic tongue has great potential in the field of food detection. Pattern recognition is a key part of the electronic tongue system. Commonly used pattern recognition technologies can be divided into two categories: machine learning and deep learning. Machine learning requires manual feature extraction, which is a complex and time-consuming process. It rarely uses the full time domain information measured by the electronic tongue. The accuracy is highly dependent on the quality of the previous feature extraction and cannot achieve a good classification effect. In the field of deep learning, convolutional neural networks (CNNs) have powerful functions in feature selection and extraction of high-dimensional data. The deep learning algorithms currently applied to electronic tongue recognition only perform simple convolution feature extraction analysis on the sample data as a whole, ignoring the deep-level influence of each electrode and different pulse square wave voltages on the data. Therefore, it is necessary to improve efficiency and accuracy to overcome the existing shortcomings. Summary of the invention
[0003] In view of the shortcomings of the prior art, the present invention proposes an electronic tongue liquor detection method based on AIF-1DCNN, which uses the integrated electrodes in the electronic tongue to collect liquor sample information, and analyzes the data in combination with the AIF-1DCNN detection method to achieve the purpose of liquor sample detection and improve the efficiency and accuracy of liquor component analysis.
[0004] In order to solve the problems of the prior art, the technical solution adopted by the present invention is:
[0005] An electronic tongue liquor detection method based on AIF-1DCNN comprises the following steps:
[0006] S1: Use integrated electrodes to obtain the original response data matrix X of liquor and preprocess it to form a sample set E
[0007] The single data points of liquor measured by the six electrodes of the integrated electrode are horizontally spliced, and the single data points are vertically spliced according to the number of measurements to form the original response data matrix X, as shown in formula (1):
[0008]
[0009] Among them, [x i,1 ,x i,2 ,…,x i,j ] is a sample data formed by horizontally splicing single data points of liquor measured by multiple electrodes, i is the number of samples measured by multiple electrodes, and j is the number of sampling points;
[0010] The original response data matrix X is further processed to zero mean using the following formula (2):
[0011]
[0012] E is the normalized data, X max is the maximum value of each column of the original response data matrix, X min is the minimum value of each column of the original response data matrix, and X is the original response data matrix.
[0013] S2: Sample set E is convolved with a kernel size of n electrodes to extract attention features and obtain a vector of length k
[0014] First, use k convolution kernels with a kernel size of n to convolve the original signal to obtain feature F, and then perform global average pooling on F to obtain F GP Then two 1*1 convolution activations are performed to extract the attention feature of the k-electrode channel. Attention extraction is as follows: formula (3), (4), (5)
[0015]
[0016] i,j represents the dimension of the input signal e, e∈E, e i,j represents the number in row i and column j in e, represents the number of the i-th row and j-th column of the l-th convolution kernel, b l Represents the bias of the lth convolution kernel
[0017]
[0018] Among them, H, W are the dimensions of feature U, F c is the number of channels of feature F, i,j is the value of position (i,j) on the cth channel
[0019]
[0020] Where f(·) is the sigmoid activation function.
[0021] S3: Perform convolution on sample set E with square wave attention feature extraction using kernel size u to obtain a vector Ψ with length w
[0022] w convolution kernels with a kernel size of u are used to convolve the original signal, and then global average pooling and two 1*1 convolution activations are performed to obtain the pulse square wave channel attention feature Ψ with a length of w. The operation principle is the same as step S2.
[0023] The relationship between k, n, w, and u satisfies formulas (6) and (7):
[0024] w=k×v (6)
[0025] k×n=w×u (7)
[0026] Where v is the number of pulse square waves of a single electrode, k is the number of electrodes, n is the length of data collected by each electrode, and u is the length of data collected by a single electrode during the duration of a single square wave.
[0027] S4: vector The vector Ψ is weighted fused to obtain the vector Τ
[0028] Further Ψ is weighted fused to get Τ, considering The pulse square wave corresponding to each electrode in ψ is first ψ is transformed into Φ and Ψ. The dimension of Φ is (k, 1) and the dimension of Ψ is (k, v). As shown in formulas (8) and (9), Φ and Ψ are further multiplied using the broadcast mechanism to obtain the weighted fusion attention Τ. The dimension of Τ is (k, v).
[0029]
[0030]
[0031] Τ=Φ×Ψ (10)
[0032] S5: Fusion of vector Τ with the original input to obtain λ
[0033] First, the weighted fusion attention Τ is fused with the original input e to obtain λ. First, the weighted fusion attention Τ and the input signal e are transformed in dimension. The dimension of Τ is changed from (k, v) to (w, 1) to obtain Τ', and the dimension of the input signal e is changed from (1, k×n) to (w, u) to obtain e. The attention and the input signal are further fused using the broadcast mechanism to obtain Λ, as shown in the following formulas (11) and (12). Finally, Λ is re-dimensionalized to obtain λ, and the dimension of λ is (k×n, 1)
[0034]
[0035] Λ=Γ×e (12)
[0036] S6: Adaptive momentum random optimization method is used to train the AIF-1DCNN neural network for input λ, and the trained AIF-1DCNN neural network model is used to classify and detect the test set
[0037] The 1DCNN convolutional neural network module in AIF-1DCNN includes five convolutional layers, in which the convolution kernel uses a 1D convolution kernel with sizes of (1*32*16, 1*32*8, 1*64*4, 1*64*2, 1*64*2) respectively; during the convolution process, padding is set to "SAME", the stride is 1, and the Relu activation function is used to increase the nonlinearity of the network. Flatten is performed after the penultimate pooling layer in the AIF-1DCNN neural network model, and finally the final label is generated by the Softmax classifier. The model uses cross entropy as the loss function and uses the Adam adaptive momentum stochastic optimization algorithm to ensure that the loss function converges quickly to the global minimum. Finally, the trained AIF-1DCNN neural network model is used to classify and detect the test set.
[0038] Beneficial effects:
[0039] Compared with the prior art, the electronic tongue liquor detection method based on E-CPAF-1DCNN of the present invention adopts the integrated electrode in the electronic tongue to collect liquor sample information, and uses the AIF-1DCNN neural network algorithm in the host computer to analyze the liquor sample, thereby solving the technical problems that the manual feature extraction process of the machine learning algorithm is complicated and time-consuming, and the full time domain information measured by the electronic tongue is rarely used, and the accuracy of the simple 1DCNN network is not high. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 The figure is a flow chart of the electronic tongue liquor detection method based on AIF-1DCNN of the present invention;
[0041] Figure 2 A network model based on AIF-1DCNN in one embodiment;
[0042] Figure 3 is an attention module of AIF-1DCNN in one embodiment;
[0043] Figure 4 A 1DCNN module of AIF-1DCNN in implementation;
[0044] Figure 5 Result diagram of classification accuracy and iteration number of electronic tongue data of liquor of different years in one embodiment, where (a) is the relationship between training set loss and iteration number, and (b) is the relationship between training set accuracy and iteration number. DETAILED DESCRIPTION
[0045] like Figure 2 and Figure 3 As shown, an electronic tongue liquor detection method based on AIF-1DCNN of the present invention comprises the following steps:
[0046] S1: Using integrated electrodes to obtain the original response data matrix X of liquor, preprocessing is performed to form a sample set E;
[0047] The single data points of liquor measured by the six electrodes of the integrated electrode are horizontally spliced, and the single data points are vertically spliced according to the number of measurements to form the original response data matrix X, as shown in formula (1):
[0048]
[0049] Among them, [x i,1 ,x i,2 ,…,x i,j ] is a sample data formed by horizontally splicing single data points of liquor measured by multiple electrodes, i is the number of samples measured by multiple electrodes, and j is the number of sampling points;
[0050] The original response data matrix X is further processed to zero mean using the following formula (2):
[0051]
[0052] E is the normalized data, X max is the maximum value of each column of the original response data matrix, X min is the minimum value of each column of the original response data matrix, and X is the original response data matrix.
[0053] S2: Sample set E is convolved with a kernel size of n electrodes to extract attention features and obtain a vector of length k
[0054] First, use k convolution kernels with a kernel size of n to convolve the original signal to obtain feature F, and then perform global average pooling on F to obtain F GP Then two 1*1 convolution activations are performed to extract the attention feature of the k-electrode channel. Attention extraction is as follows: formula (3), (4), (5)
[0055]
[0056] i,j represents the dimension of the input signal e, e∈E, e i,j represents the number in row i and column j in e, represents the number of the i-th row and j-th column of the l-th convolution kernel, b l Represents the bias of the lth convolution kernel
[0057]
[0058] Among them, H, W are the dimensions of feature U, F cis the number of channels of feature F, i,j is the value of position (i,j) on the cth channel.
[0059]
[0060] Where f(·) is the sigmoid activation function.
[0061] S3: Perform convolution on sample set E with square wave attention feature extraction using kernel size u to obtain a vector Ψ with length w
[0062] The original signal is convolved with w convolution kernels of kernel size u, and then global average pooling and two 1*1 convolution activations are performed to obtain the pulse square wave channel attention feature Ψ of length w. The operation principle is the same as step S2.
[0063] The relationship between k, n, w, and u satisfies formulas (6) and (7):
[0064] w=k×v (6)
[0065] k×n=w×u (7)
[0066] Where v is the number of pulse square waves of a single electrode, k is the number of electrodes, n is the length of data collected by each electrode, and u is the length of data collected by a single electrode during the duration of a single square wave.
[0067] S4: vector The vector Ψ is weighted fused to obtain the vector Τ
[0068] Further Ψ is weighted fused to get Τ. Considering The pulse square wave corresponding to each electrode in ψ is first ψ is transformed into Φ and Ψ. The dimension of Φ is (k, 1) and the dimension of Ψ is (k, v). As shown in formulas (8) and (9), Φ and Ψ are further multiplied using the broadcast mechanism to obtain the weighted fusion attention Τ. The dimension of Τ is (k, v).
[0069]
[0070]
[0071] Τ=Φ×Ψ (10)
[0072] S5: Fusion of vector Τ with the original input to obtain λ
[0073] First, the weighted fusion attention Τ is fused with the original input e to obtain λ. First, the weighted fusion attention Τ and the input signal e are transformed in dimension. The dimension of Τ is changed from (k, v) to (w, 1) to obtain Τ', and the dimension of the input signal e is changed from (1, k×n) to (w, u) to obtain e. The attention and the input signal are further fused using the broadcast mechanism to obtain Λ, as shown in the following formulas (11) and (12). Finally, Λ is re-dimensionalized to obtain λ, and the dimension of λ is (k×n, 1).
[0074]
[0075] Λ=Γ×e (12)
[0076] S6: Adaptive momentum random optimization method is used to train the AIF-1DCNN neural network for input λ, and the trained AIF-1DCNN neural network model is used to classify and detect the test set
[0077] Among them, the 1DCNN convolutional neural network module in AIF-1DCNN includes five convolutional layers, in which the convolution kernel uses a 1-dimensional convolution kernel with sizes of (1*32*16, 1*32*8, 1*64*4, 1*64*2, 1*64*2) respectively; during the convolution process, padding is set to "SAME", the stride is 1, and the Relu activation function is used to increase the nonlinearity of the network. Among them, Flatten is performed after the penultimate pooling layer in the AIF-1DCNN neural network model, and finally the final label is generated by the Softmax classifier. The model uses cross entropy as the loss function and uses the Adam adaptive momentum random optimization algorithm to ensure that the loss function converges quickly to the global minimum. Finally, the trained AIF-1DCNN neural network model is used to classify and detect the test set.
[0078] The detection method of the present invention is described below with a specific embodiment. The operating environment of this embodiment is that the experimental implementation environment is written and implemented on a Dell T792 computer, Windows 10, Intel Xeon 20-core processor, 64G running memory, 2*11 GRTX2080Ti, Pycharm 2019, Python 3.7, scikit-learn 0.21.3, tensorflow 2.1.0, keras 2.3.1.
[0079] In step S6, the Adam gradient descent optimization algorithm (lr=1e-3) is used in the training process, the batch size is set to 32, the epoch size is 100, and the ratio of the training set, the validation set and the test set is 6:2:2.
[0080] The data used in the experiment are the data of five kinds of blended liquors of different years measured by the electronic tongue. The amount of data collected by the integrated electrode is shown in Table 1:
[0081] Table 1
[0082]
[0083] In the experiment, 0.6*500 samples are used for sample training, such as Figure 5 As shown in Figure 1, with the increase of Epoch, the AIF-1DCNN model gradually converges. Therefore, we take the AIF-1DCNN model after Epoch = 100 training as the final model to complete the training, and then select 0.2 samples of the total number of samples as the test set. The experimental data is the training set of the AIF-1DCNN model structure after the training is completed. Figure 3 shown.
[0084] In order to verify the superiority of the AIF-1DCNN model over the simple one-dimensional convolutional neural network model in performance, a comparative experiment was conducted. Table 3 shows the classification results of the AIF-1DCNN model compared with the traditional machine learning model.
[0085] Table 3 Accuracy of AIF-1DCNN model compared with simple one-dimensional convolutional neural network
[0086]
[0087] It can be seen from the table that the average accuracy of the AIF-1DCNN model of the present invention is 96.8%, and the maximum difference in accuracy is 1%; the average accuracy of the simple 1DCNN model is 93.4%, and the maximum difference in accuracy is 6%.
[0088] The above description is only a partial preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. An electronic tongue liquor detection method based on AIF-1DCNN, It is characterized in that The following steps are involved: S1: The original response data matrix X of liquor obtained by using the integrated electrode is preprocessed to form a sample set E. Specifically, the single data points of liquor measured by the six electrodes of the integrated electrode are horizontally spliced, and the single data points are vertically spliced according to the number of measurements to form the original response data matrix X, as shown in formula (1) Among them, [x 1,1 ,x 1,2 ,…,x 1,j ] is a sample data formed by horizontally splicing single data points of liquor measured by multiple electrodes, i is the number of samples measured by multiple electrodes, and j is the number of sampling points; The original response data matrix X is further processed to zero mean using the following formula (2): E is the normalized data, X max is the maximum value of each column of the original response data matrix, X min is the minimum value of each column of the original response data matrix, X is the original response data matrix; S2: Perform convolution on sample set E with a kernel size of n and electrode attention feature extraction to obtain a vector of length k First, use k convolution kernels with a kernel size of n to convolve the original signal to obtain feature F, and then perform global average pooling on F to obtain F GP Then two 1*1 convolution activations are performed to extract the attention feature of the k-electrode channel. Attention extraction is as follows: formula (3), (4), (5) i,j represents the dimension of the input signal e, e∈E, e i,j represents the number in row i and column j in e, represents the number of the i-th row and j-th column of the l-th convolution kernel, b l Represents the bias of the lth convolution kernel Among them, H, W are the dimensions of feature U, F c is the number of channels of feature F, i,j is the value of position (i,j) on the cth channel Where f(F Gp ) is the sigmoid activation function; S3: Perform convolution on sample set E with square wave attention feature extraction using kernel size u to obtain a vector Ψ with length w; S4: vector The vector Ψ is weightedly fused to obtain the vector Τ; S5: The vector Τ is fused with the original input to obtain λ. The weighted fusion vector Τ is first fused with the original input e to obtain λ. The weighted fusion vector Τ and the input signal e are first dimensionally transformed. The dimension of Τ is changed from (k, v) to (w, 1) to obtain Τ'. The dimension of the input signal e is changed from (1, k×n) to (w, u) to obtain e. The attention is further fused with the input signal using the broadcast mechanism to obtain Λ, as shown in the following formulas (11) and (12). Finally, Λ is re-dimensionalized to obtain λ, and the dimension of λ is (k×n, 1). Λ=Γ×e (12), S6: Adopt adaptive momentum random optimization method to train AIF-1DCNN neural network for input λ, and use the trained AIF-1DCNN neural network model to classify and detect the test set; Among them, Flatten is performed after the penultimate pooling layer in the AIF-1DCNN neural network model, and finally the final label is generated through the Softmax classifier. The model uses cross entropy as the loss function and uses the Adam gradient descent optimization algorithm to ensure that the loss function converges quickly to the global minimum.
2. According to the electronic tongue liquor detection method based on AIF-1DCNN in claim 1, It is characterized in that In step S3, w convolution kernels with a kernel size of u are used to convolve the original signal, and then global average pooling and two 1*1 convolution activations are performed to obtain the pulse square wave channel attention feature Ψ with a length of w. The relationship between k, n, w, and u satisfies formulas (6) and (7): w=k×v (6) k×n=w×u (7) Where v is the number of pulse square waves of a single electrode, k is the number of electrodes, n is the length of data collected by each electrode, and u is the length of data collected by a single electrode during the duration of a single square wave.
3. According to the electronic tongue liquor detection method based on AIF-1DCNN in claim 1, Features , in step S4, Ψ is weighted fused to get Τ, considering The pulse square wave corresponding to each electrode in ψ is first ψ is transformed into Φ and Ψ. The dimension of Φ is (k, 1) and the dimension of Ψ is (k, v). As shown in formulas (8) and (9), Φ and Ψ are further multiplied using the broadcast mechanism to obtain the weighted fusion vector Τ. The dimension of Τ is (k, v). Τ=Φ×Ψ (10).
4. According to the electronic tongue liquor detection method based on AIF-1DCNN in claim 1, It is characterized in that In step S6, the 1DCNN convolutional neural network module in AIF-1DCNN includes five convolutional layers, where the convolution kernel uses a 1D convolution kernel with sizes of 1*32*16, 1*32*8, 1*64*4, 1*64*2, and 1*64*2, respectively; during the convolution process, padding is set to "SAME", the stride is 1, and the Relu activation function is used to increase the nonlinearity of the network. Flatten is performed after the penultimate pooling layer in the AIF-1DCNN neural network model, and finally the final label is generated by the Softmax classifier. The model uses cross entropy as the loss function and uses the Adam adaptive momentum stochastic optimization algorithm to ensure that the loss function converges quickly to the global minimum. Finally, the trained AIF-1DCNN neural network model is used to classify and detect the test set.
