Electronic nose prediction method based on double-layer integrated neural network

文档序号:1566433 发布日期:2020-01-24 浏览:21次 中文

阅读说明:本技术 基于双层集成神经网络的电子鼻预测方法 (Electronic nose prediction method based on double-layer integrated neural network ) 是由 韦真博 钱康 朱建锡 王俊 程绍明 余桂平 于 2019-10-12 设计创作,主要内容包括:本发明公开了一种基于双层集成神经网络的电子鼻预测方法。包括:1、使用电子鼻采集已知标签的样本的气味数据,去基线处理后构成样本数据集,归一化处理,并将得到的数据集分为训练集和测试集;2、将训练集和测试集转化为神经网络的输入格式;3、在第一层网络中集成多个具有差异性的卷积神经网络,单个卷积神经网络作为第二层网络,将双层卷积神经网络进行集成,使用网格搜索法对超参数进行寻优,进而构建基于归一化处理后数据集的预测模型,完成对待测样品的分类。本发明结合了卷积神经网络自动提取数据集中抽象局部、拟合能力强和集成算法能有效提高预测模型泛化能力和稳定性等特点,提高了电子鼻的检测性能。(The invention discloses an electronic nose prediction method based on a double-layer integrated neural network. The method comprises the following steps: 1. collecting odor data of a sample with a known label by using an electronic nose, forming a sample data set after baseline removal processing, carrying out normalization processing, and dividing the obtained data set into a training set and a test set; 2. converting the training set and the test set into an input format of a neural network; 3. integrating a plurality of different convolutional neural networks in a first layer network, taking a single convolutional neural network as a second layer network, integrating double-layer convolutional neural networks, optimizing hyper-parameters by using a grid search method, further constructing a prediction model based on a normalized data set, and completing the classification of samples to be detected. The method combines the characteristics of automatic extraction of abstract parts in a data set by a convolutional neural network, strong fitting capability, effective improvement of generalization capability and stability of a prediction model by an integrated algorithm and the like, and improves the detection performance of the electronic nose.)

1. An electronic nose prediction method based on a double-layer integrated neural network is characterized by comprising the following steps:

(1) obtaining a response curve of a sample of a known label using an electronic nose; removing the base line of the response curve to obtain a sample data set S1∈Rm×n×kThen to S1Carrying out normalization processing to obtain a sample data set S2∈Rm×n×kWherein m represents the number of samples, n represents the number of sensors in the electronic nose, and k represents the detection time;

(2) will S2Divided into a training data set S3∈Ra×n×kAnd a test data set S4∈Rb×n×kA + b ═ m; in order to conform to the standard data input format of the convolutional neural network, S is further performed3And S4Respectively converted into training set S31∈Ra×n×k×1And test set S41∈Rb ×n×k×1

(3) Constructing a first layer of convolutional neural network, obtaining the size and the number of the optimal convolutional kernels by adopting a grid search method, and then obtaining the combination of the size and the number of f convolutional kernels by a central point symmetry method to form f convolutional neural networks; will train set S31And test set S41Inputting the data into f convolutional neural networks, and respectively outputting data sets O1And a data set O2

(4) Constructing a second layer of convolutional neural network, and adopting a grid search method to carry out data set O1Inputting the data into a second layer of convolutional neural network for training to obtain a data set O2The prediction accuracy of the second layer of convolutional neural network is used as an evaluation criterion to obtain a trained second layer of convolutional neural network;

(5) the first layer of convolutional neural network and the second layer of convolutional neural network form a double-layer integrated convolutional neural network model; acquiring a response curve of a sample to be detected by using an electronic nose, and preprocessing the response curve by using the method in the step (1) to obtain a sample set S' epsilon to R of the sample to be detectedm′×n×kM' represents the number of samples to be measured; converting S' into S ∈ Rm′×n×k×1And inputting the classification result into the double-layer integrated convolutional neural network model to obtain the classification result of the sample to be detected.

2. The electronic nose prediction method based on the double-layer integrated neural network as claimed in claim 1, wherein the step (3) is specifically as follows:

(3.1) constructing a first layer of convolutional neural network, wherein the first layer of convolutional neural network is provided with an input layer, a convolutional layer, a pooling layer, a full-connection layer and an output layer;

(3.2) initializing the weight of the neural network by adopting a uniform distribution method;

(3.3) setting the convolution kernel size range to [ [1,1 ]],[3,3],[5,5],...,[2t-1]]The number of convolution kernels ranges from [2,4,8t](ii) a Optimizing the size and number of convolution kernels in the convolution layer by adopting a grid search method, specifically, randomly combining the size and number of the convolution kernels to obtain t × t convolution neural networks, and adopting a training set S31Training the t × t convolutional neural networks to obtain t × t models; will measureTest set S41Inputting the prediction data into t models to obtain t prediction accuracy rates so as to test the set S41The prediction accuracy of (a) is used as an evaluation criterion to obtain a model corresponding to the highest prediction accuracy, and further obtain the optimal convolution kernel size [ x ]1,x1]And a quantity z1

(3.4) with x1、z1As a central symmetry point, X is generated1=[[x1-2i,x1-2i],...,[x1,x1],...,[x1+2i,x1+2i]]And Z1=[z1/2j,...,z1,...,z1*2j]Obtaining the combination of the size and the number of f convolution kernels, and generating f convolution neural networks according to the combination; where i and j are quantity parameters, f ═ 2i +1 × 2j + 1;

(3.5) training set S31And test set S41Inputting into f convolutional neural networks, respectively outputting S31And S41Corresponding data set O1=[output11,output12,...,output1f]And a data set O2=[output21,output22,...,output2f]。

3. The electronic nose prediction method based on the double-layer integrated neural network as claimed in claim 1, wherein the step (4) is specifically as follows:

(4.1) constructing a second layer of convolutional neural network, wherein the second layer of convolutional neural network is provided with an input layer, a convolutional layer, a pooling layer, a full-link layer and an output layer;

(4.2) initializing the weight of the neural network by adopting a uniform distribution method;

(4.3) setting the convolution kernel size range to [ [1,1 ]],[3,3],[5,5],...,[2t-1]]The number of convolution kernels ranges from [2,4,8t](ii) a Optimizing the size and the number of convolution kernels in the convolution layer by adopting a grid search method, specifically, randomly combining the size and the number of the convolution kernels to obtain t × t convolution neural networks, and adopting a data set O1Training the t × t convolutional neural networks to obtain t × t models; data set O2Inputting the data into t × t models to obtain t × t prediction accuracy rates, and collecting the dataO2The prediction accuracy is used as an evaluation criterion, and the model corresponding to the highest prediction accuracy is obtained and used as a second layer of convolutional neural network.

4. The electronic nose prediction method based on the double-layer integrated neural network as claimed in claim 2 or 3, wherein the uniform distribution method is calculated by the following formula:

Figure FDA0002230974550000021

np=hp*wp*dp

wherein, Wp is the weight matrix of the p-th convolutional layer in each convolutional neural network, and hp, Wp and dp are the height, width and number of convolutional kernels in the p-th convolutional layer, respectively.

Technical Field

The invention relates to the field of agricultural product electronic nose detection, in particular to an electronic nose prediction method based on a double-layer integrated neural network.

Background

So far, the data learning methods commonly used for the scent signals in the electronic nose are algorithms such as support vector machine, logistic regression, decision tree, random forest, k-nearest neighbor, artificial neural network, and the like. But because the electronic nose data has obvious nonlinear characteristics and is easily influenced by the environment, unknown odor and interference of an acquisition device, the artificial neural network can more effectively learn and explain the complex nonlinear sensor data in the real world compared with other data learning methods. However, as the research goes deep, the neural network has some disadvantages, such as lack of a strict theoretical system, too large influence of the experience of the user on the application effect, the selection of the neural network model and the setting of the parameters thereof need to be completed through the experience and experimental tests of researchers, no complete knowledge system structure can make strict quantitative analysis on the use of the neural network and the output result thereof, and the training process has problems of local minimum, generalization performance reduction caused by overfitting, and the like. Therefore, it is difficult to establish a prediction model with high accuracy, good stability and strong generalization ability.

The invention provides an electronic nose prediction method based on an integrated convolutional neural network, which integrates the characteristics of automatic extraction of abstract local parts in a data set by the convolutional neural network, strong fitting capability, effective improvement of generalization capability and stability of an electronic nose prediction model by an integrated algorithm and the like, establishes the electronic nose prediction model with high accuracy, good stability and strong generalization capability, and further improves the performance of an electronic nose.

Disclosure of Invention

The invention aims to provide an electronic nose prediction method based on an integrated convolutional neural network, and the electronic nose prediction method integrates the advantages that the convolutional neural network automatically extracts abstract parts in a data set, the fitting capability is strong, an integrated algorithm can effectively improve the generalization capability and stability of a prediction model, and the like. On one hand, the accuracy of the electronic nose prediction model can be improved, and on the other hand, the generalization capability of the electronic nose prediction model can be enhanced. The detection performance of the electronic nose is effectively improved.

In order to achieve the purpose, the invention adopts the following technical scheme:

an electronic nose prediction method based on a double-layer integrated neural network specifically comprises the following steps:

(1) obtaining a response curve of a sample of a known label using an electronic nose; removing the base line of the response curve to obtain a sample data set S1∈Rm×n×kThen to S1Carrying out normalization processing to obtain a sample data set S2∈Rm×n×kWherein m represents the number of samples, n represents the number of sensors in the electronic nose, and k represents the detection time;

(2) will S2Divided into a training data set S3∈Ra×n×kAnd a test data set S4∈Rb×n×kA + b ═ m; in order to conform to the standard data input format of the convolutional neural network, S is further performed3And S4Respectively converted into training set S31∈Ra×n×k×1And test set S41∈Rb×n×k×1

(3) Constructing a first layer of convolutional neural network, obtaining the size and the number of the optimal convolutional kernels by adopting a grid search method, and then obtaining the combination of the size and the number of f convolutional kernels by a central point symmetry method to form f convolutional neural networks; will train set S31And test set S41Inputting the data into f convolutional neural networks, and respectively outputting data sets O1And a data set O2

(4) Constructing a second layer of convolutional neural network, and adopting a grid search method to carry out data set O1Inputting the data into a second layer of convolutional neural network for training to obtain a data set O2The prediction accuracy of the second layer of convolutional neural network is used as an evaluation criterion to obtain a trained second layer of convolutional neural network;

(5) first layer convolutional neural network andthe second layer of convolutional neural network forms a double-layer integrated convolutional neural network model; acquiring a response curve of a sample to be detected by using an electronic nose, and preprocessing the response curve by using the method in the step (1) to obtain a sample set S' epsilon to R of the sample to be detectedm′×n×kM' represents the number of samples to be measured; converting S' into S ∈ Rm′×n×k×1And inputting the classification result into the double-layer integrated convolutional neural network model to obtain the classification result of the sample to be detected.

Further, the step (3) is specifically as follows:

(3.1) constructing a first layer of convolutional neural network, wherein the first layer of convolutional neural network is provided with an input layer, a convolutional layer, a pooling layer, a full-connection layer and an output layer;

(3.2) initializing the weight of the neural network by adopting a uniform distribution method;

(3.3) setting the convolution kernel size range to [ [1,1 ]],[3,3],[5,5],...,[2t-1]]The number of convolution kernels ranges from [2,4,8t](ii) a Optimizing the size and number of convolution kernels in the convolution layer by adopting a grid search method, specifically, randomly combining the size and number of the convolution kernels to obtain t × t convolution neural networks, and adopting a training set S31Training the t × t convolutional neural networks to obtain t × t models; test set S41Inputting the prediction data into t models to obtain t prediction accuracy rates so as to test the set S41The prediction accuracy of (a) is used as an evaluation criterion to obtain a model corresponding to the highest prediction accuracy, and further obtain the optimal convolution kernel size [ x ]1,x1]And a quantity z1

(3.4) with x1、z1As a central symmetry point, X is generated1=[[x1-2i,x1-2i],...,[x1,x1],...,[x1+2i,x1+2i]]And Z1=[z1/2j,...,z1,...,z1*2j]Obtaining the combination of the size and the number of f convolution kernels, and generating f convolution neural networks according to the combination; where i and j are quantity parameters, f ═ 2i +1 × 2j + 1;

(3.5) training set S31And test set S41Is inputted into fIn a convolutional neural network, S is output separately31And S41Corresponding data set O1=[output11,output12,...,output1f]And a data set O2=[output21,output22,...,output2f]。

Further, the step (4) is specifically as follows:

(4.1) constructing a second layer of convolutional neural network, wherein the second layer of convolutional neural network is provided with an input layer, a convolutional layer, a pooling layer, a full-link layer and an output layer;

(4.2) initializing the weight of the neural network by adopting a uniform distribution method;

(4.3) setting the convolution kernel size range to [ [1,1 ]],[3,3],[5,5],...,[2t-1]]The number of convolution kernels ranges from [2,4,8t](ii) a Optimizing the size and the number of convolution kernels in the convolution layer by adopting a grid search method, specifically, randomly combining the size and the number of the convolution kernels to obtain t × t convolution neural networks, and adopting a data set O1Training the t × t convolutional neural networks to obtain t × t models; data set O2Inputting the data into t × t models to obtain t × t prediction accuracy rates, and collecting the data into a data set O2The prediction accuracy is used as an evaluation criterion, and the model corresponding to the highest prediction accuracy is obtained and used as a second layer of convolutional neural network.

Further, the calculation formula of the uniform distribution method is as follows:

Figure BDA0002230974560000031

np=hp*wp*dp

wherein, Wp is the weight matrix of the p-th convolutional layer in each convolutional neural network, and hp, Wp and dp are the height, width and number of convolutional kernels in the p-th convolutional layer, respectively.

The invention has the following beneficial effects:

(1) in the stage of constructing the first layer of convolutional neural network, the parameters of the convolutional neural network are determined by a grid search method, and the convolutional neural network with the difference is generated based on the vicinity of the optimal parameters, so that the accuracy of the prediction model is maintained, and the difference of the prediction model is ensured.

(2) In the stage of constructing the second layer of convolutional neural network, the output of the f convolutional neural networks of the first layer is used as the input, and the idea of integrated learning is combined, so that the fault tolerance rate is improved, and the anti-interference capability of the prediction model is further improved.

(3) Compared with a common machine learning algorithm used in electronic nose data processing, the integrated neural network disclosed by the invention not only improves the prediction capability of the model, but also improves the generalization capability of the prediction model.

Drawings

FIG. 1 is a diagram of the response signals of sensors for detecting ham samples with different grades by an electronic nose, wherein (a) is the response curve of the electronic nose of a primary ham, (b) is the response curve of the electronic nose of a secondary ham, and (c) is the response curve of the electronic nose of a tertiary ham;

FIG. 2 is a schematic flow chart of a specific process for constructing a first layer convolutional neural network;

fig. 3 is a specific flow diagram for constructing the second layer convolutional neural network.

Detailed Description

In order to facilitate the understanding and implementation of the present invention for those of ordinary skill in the art, the present invention is further described in detail with reference to the accompanying drawings and examples, it is to be understood that the embodiments described herein are merely illustrative and explanatory of the present invention and are not restrictive thereof.

In the first step, in the embodiment, Jinhua first-grade, second-grade and third-grade hams are used as detection samples, and the experimental samples are provided by the pyramid ham corporation. Dividing the samples into three groups according to grades, wherein each group comprises 20 samples, each sample comprises 200g, inserting three odorless bamboo sticks into ham, standing for 10s, placing the bamboo sticks into a 250ml gas washing bottle, and headspace at room temperature for 30min to stabilize the concentration of volatile matters in the headspace device. Each sample is not repeatedly sampled for 5 times, 100 samples of ham in each grade are detected by using an electronic nose, the precleaning time is set to be 40s, the sampling time is set to be 100s, the cleaning time is set to be 60s, the response curve of the electronic nose is obtained, and all samples are subjected to repeated sampling for 5 timesMarking the category of the sample data to obtain a data set S0Wherein S is0∈R300×12×160

The electronic nose response curves of three different grades of ham are shown in figure 1, and it can be seen that the sensor response intensities of the different grades of ham are greatly different.

In this embodiment, a home-made electronic nose system is used as a detection instrument, and 12 metal oxide sensors, the types and corresponding characteristics of which are shown in table 1, are used:

TABLE 1 respective characteristics of the home-made electronic nose sensors

Figure BDA0002230974560000041

Figure BDA0002230974560000051

Step two, for all data sets S0Performing baseline removal processing to obtain a data set S1The specific formula is as follows:

Rnew=Ri-Rbaseline

wherein R isiRepresenting the value of the ith response curve, RbaselineDenotes the base line, RnewRepresents the response value after baseline removal;

for data set S1Carrying out standardization processing to obtain a standardized data set S2The concrete formula is as follows:

Figure BDA0002230974560000052

wherein f isijJ value, f, representing the ith sensorimeanAnd fistdRespectively representing the mean and standard deviation of the ith sensor,

Figure BDA0002230974560000053

a jth value representing the normalized ith feature.

Step three, data are processedCollection S2According to the following steps: 3 random division into training feature sets S3And a test feature set S4Wherein S is3∈R210 ×12×160,S4∈R90×12×160(ii) a Since the data input of the convolutional neural network is in an image format, S3 and S4 are required to be converted into a grayscale map with the channel number of 1, so that the training feature set S is set3And a test feature set S4Performing matrix conversion to obtain a training set S31And test set S41Wherein S is31∈R210×12×160×1,S41∈R90×12×160×1

Step four, in the stage of constructing the first layer of convolutional neural network, a specific flow diagram is shown in fig. 2. The convolutional neural network is provided with an input layer, 2 convolutional layers, 2 pooling layers, a full-link layer and an output layer.

Initializing the weight of the neural network by adopting a uniform distribution method, wherein the calculation formula is as follows:

Figure BDA0002230974560000054

np=hp*wp*dp

wherein, Wp is the weight matrix of the p-th convolutional layer in the first layer of convolutional neural network, and hp, Wp and dp are the height, width and number of convolutional kernels in the p-th convolutional layer in the first layer of convolutional neural network, respectively.

Optimizing the size and the number of convolution kernels in the convolution layer by adopting a grid search method, wherein the size range of the convolution kernels is [ [1,1 ]],[3,3],[5,5],[7,7],[9,9],[11,11]]The number of convolution kernels ranges from [2,4,8,16,32,64 ]]. The size of convolution kernel and the number of convolution kernels are combined arbitrarily to obtain 36(6 multiplied by 6) convolution neural networks, and a training set S is adopted31Training the 36 convolutional neural networks to obtain 36 models; test set S41Inputting the data into 36 models to obtain 36 prediction accuracies so as to test a set S41The prediction accuracy of (2) is used as an evaluation criterion to obtain a model corresponding to the highest prediction accuracy, and further obtain the optimal convolution kernel size [5,5 ]]And a number 32.

With the optimal convolution kernel size [5,5 ]]And the sum number 32 is a central symmetry point, and X is generated1=[[1,1],[3,3],[5,5],[7,7],[9,9]]And Z1=[8,16,32,64,128]There are a total of 25 combinations of convolution kernel sizes and numbers, and 25 convolutional neural networks are generated from the combined values of the convolution kernel sizes and numbers.

The recording is based on a training set S31Of 25 convolutional neural networks1=[output11,output12,...,output125]Based on test set S41Of 25 convolutional neural networks2=[output21,output22,...,output225]。

Step five, in the stage of constructing the second layer of convolutional neural network, a specific flow diagram is shown in fig. 3. The second layer of convolutional neural network is provided with an input layer, 2 convolutional layers, 2 pooling layers, a full-link layer and an output layer.

Initializing the weight of the neural network by adopting a uniform distribution method, wherein the calculation formula is as follows:

Figure BDA0002230974560000061

np=hp*wp*dp

wherein, Wp is the weight matrix of the p-th convolutional layer in the second convolutional neural network, and hp, Wp and dp are the height, width and number of convolutional kernels of the p-th convolutional layer in the second convolutional neural network, respectively.

Optimizing the size and the number of convolution kernels in the convolution layer by adopting a grid search method, wherein the size range of the convolution kernels is [ [1,1 ]],[3,3],[5,5],[7,7],[9,9],[11,11]]The number of convolution kernels ranges from [2,4,8,16,32,64 ]]. The size of convolution kernel and the number of convolution kernels are combined arbitrarily to obtain 36(6 multiplied by 6) convolution neural networks, and a data set O is input1=[output11,output12,...,output125]Training in the 36 convolutional neural networks to obtain 36 models; data set O2Inputting the data into 36 models to obtain 36 prediction accuracies to obtain a data set O2The prediction accuracy is used as an evaluation criterion, and the model corresponding to the highest prediction accuracy is obtained and used as a second layer of convolutional neural network. First, theAnd the first layer of convolutional neural network and the second layer of convolutional neural network form a double-layer integrated convolutional neural network model to complete the establishment of the model.

And step six, in order to verify the effectiveness of the model, models established based on a support vector machine, a logistic regression, a K neighbor algorithm and a decision tree are respectively adopted for comparison. Because the integrated convolutional neural network can directly extract features, the data is not subjected to dimensionality reduction. And the data set used in the comparison model needs to be subjected to dimensionality reduction, and the main component analysis is adopted to carry out training feature set S3And a test feature set S4And (5) performing dimensionality reduction treatment.

TABLE 2 prediction accuracy

Figure BDA0002230974560000071

The result shows that the prediction accuracy of the integrated convolutional neural network is far higher than that of other learning algorithms no matter which learning algorithm is established, and the method has higher popularization and application values.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于物联网的供水检测装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!