技术领域technical field
本发明涉及传感器温漂预测技术领域,特别是涉及一种土壤温度传感器的漂移预测方法。The invention relates to the technical field of sensor temperature drift prediction, in particular to a drift prediction method of a soil temperature sensor.
背景技术Background technique
现阶段随着我国在人工智能发展的大趋势下,工业,农业等行业土壤温度传感器在节能环保省时省力方面,影响着企业发展的效率效益等问题。为了解决比较偏远以及恶劣环境问题,以及技术手段的方便高效经济,企业纷纷尝试建立各种新的深度学习模型,找到数据的变化规律,以及内部数量关系,土壤温度传感器温漂问题如下:At this stage, with the general trend of artificial intelligence development in my country, soil temperature sensors in industries such as industry and agriculture are energy-saving, environmentally-friendly, time-saving and labor-saving, affecting the efficiency and benefits of enterprise development. In order to solve the problems of relatively remote and harsh environments, as well as the convenience, efficiency and economy of technical means, enterprises have tried to establish various new deep learning models to find the changing laws of data and the internal quantitative relationship. The temperature drift problem of soil temperature sensors is as follows:
(1)由于传感器的自身零部件经过长时间的使用,自身元器件的老化使性能参数发生变化,引起输入与输出的关系引起较大的误差,对最终结果产生影响,效率降低以及精度,实时问题。在某些极端环境条件下还有一定的外在危险性。(1) Due to the long-term use of the sensor's own components, the aging of the sensor's own components will change the performance parameters, causing the relationship between input and output to cause large errors, which will affect the final result, reduce efficiency and accuracy, real-time question. In some extreme environmental conditions, there are certain external dangers.
(2)在某些特殊的恶劣环境中,传感器维护或则更换是不经济的,而且耗时繁琐。对企业生产有着直接的联系。(2) In some special harsh environments, sensor maintenance or replacement is uneconomical and time-consuming and cumbersome. It has a direct connection with the production of enterprises.
发明内容SUMMARY OF THE INVENTION
为了解决上述问题,本发明提供一种误差小,效率高,精度高的土壤温度传感器的漂移预测方法,包括以下步骤In order to solve the above problems, the present invention provides a drift prediction method of a soil temperature sensor with small error, high efficiency and high precision, which includes the following steps
获取土壤温度传感器的历史数据;Obtain historical data from soil temperature sensors;
对历史数据进行归一化处理;Normalize historical data;
将历史数据按比例分为训练数据集和测试数据集;Divide historical data into training datasets and test datasets proportionally;
使用python平台构造RNN-LSTM神经网络;Use the python platform to construct an RNN-LSTM neural network;
使用测试数据集训练RNN-LSTM神经网络;Train the RNN-LSTM neural network using the test dataset;
使用训练完成的神经网络预测土壤温度传感器的温漂。Predict the temperature drift of the soil temperature sensor using the trained neural network.
进一步的,further,
所述对历史数据进行归一化处理步骤采用以下公式进行归一化处理, xk=(x-xmean)/xvar,其中,xmean为数据序列均值,xvar为数据方差, xk为归一化后的数据。The normalization process for the historical data is performed using the following formula: xk =(xxmean )/xvar , where xmean is the mean value of the data series, xvar is the data variance, and xk is the normalized value. Normalized data.
进一步的,further,
所述RNN-LSTM神经网络包括,The RNN-LSTM neural network includes,
输入层x=(x1,···,xt-1,xt,···)、隐藏层h=(h1,···,ht-1,ht,···)、输出层 o=(o1,···,ot-1,ot,···);Input layer x=(x1 ,...,xt-1 ,xt ,...), hidden layer h=(h1 ,...,ht-1 ,ht ,...), Output layer o=(o1 ,...,ot-1 ,ot ,...);
其中,ot=g(V*ht),where ot =g(V*ht ),
ht=f(U*xt+W*ht-1),ht =f(U*xt +W*ht-1 ),
时间t的输入值是xt,t表示时间序列的时间参数,第二层是隐藏层,时间点t的隐藏层状态为ht,其中f为非线性的激活函数,最后一层为输出层,时间点t的输出层ot;The input value of time t is xt , t represents the time parameter of the time series, the second layer is the hidden layer, the state of the hidden layer at time t is ht , where f is the nonlinear activation function, and the last layer is the output layer , the output layer ot at time point t ;
采用以下公式表示遗忘门模型,The forget gate model is represented by the following formula,
ft=σ(Wf·[ht-1,xt]+bf),ft =σ(Wf ·[ht-1 ,xt ]+bf ),
其中Wf、bf分别代表遗忘门的权重和偏置;where Wf and bf represent the weight and bias of the forget gate, respectively;
采用以下公式表示输入门和候选门模型,The input gate and candidate gate models are represented by the following formulas,
it=σ(Wi·[ht-1,xt]+bi),it =σ(Wi ·[ht-1 ,xt ]+bi ),
其中Wi、WC代表相应权重,bi、bC代表相应偏置;Among them, Wi andWC represent corresponding weights, andbi and bC represent correspondingbiases ;
采用以下公式表示记忆单元的模型函数,The model function of the memory cell is represented by the following formula,
其中Ct表示的是状态单元的值;where Ct represents the value of the state unit;
采用以下公式表示输出门模型:The output gate model is represented by the following formula:
ot=σ(Wo[ht-1,xt]+bo),ot =σ(Wo [ht-1 ,xt ]+bo ),
采用以下公式表示最终的时间序列上的输出量:The output on the final time series is represented by the following formula:
ht=ot*tanh(Ct),ht =ot *tanh(Ct ),
其中Wo、bo分别代表输出门的权重和偏置。where Wo andbo represent the weight and bias of the output gate, respectively.
进一步的,further,
所述LSTM神经网络忘记门根据读取ht-1和xt的信息,输出一个在0~1之间的数值反馈给每个在细胞状态Ct-1中的数字,若数字是1,则表示“完全保留”,若数字是0,则表示“完全舍弃”。The LSTM neural network forget gate outputs a value between 0 and 1 and feeds back to each number in the cell state Ct-1 according to the information read ht-1 and xt , if the number is 1, It means "completely reserved", and if the number is 0, it means "completely discarded".
进一步的,further,
神经网络模型使用softmax激活函数,分类交叉熵损失函数,Adam优化函数来更新模型参数,表达式如下所示:The neural network model uses the softmax activation function, the categorical cross-entropy loss function, and the Adam optimization function to update the model parameters, and the expression is as follows:
softmax激活函数表达式:Softmax activation function expression:
交叉熵损失函数表达式:Cross entropy loss function expression:
其中yi表示真实分类结果,ai代表softmax的第i个输出值。where yi represents the true classification result, and ai represents the ith output value of softmax.
进一步的,further,
所述神经网络输入层的输入数据为归一化的温度,神经网络输出数据为归一化后的温度。The input data of the input layer of the neural network is the normalized temperature, and the output data of the neural network is the normalized temperature.
本发明的有益效果是:The beneficial effects of the present invention are:
采用本发明的技术方案具有非常高的预测精度和容易实现的特点,预测效果较为理想。The technical solution of the present invention has the characteristics of very high prediction accuracy and easy realization, and the prediction effect is ideal.
附图说明Description of drawings
图1为本发明流程图。Fig. 1 is a flow chart of the present invention.
具体实施方式Detailed ways
本发明公开了一种土壤温度传感器的漂移预测方法。由于土壤的温度具有较强的随机性,受各种因素影响较多,因而土壤温度传感器会产生的漂移,因此对土壤温度预测的准确度高。根据上述现象,针对传感器漂移的特点以及对土壤温度预测的精确度和实时性的需求,提出了利用循环神经网络-长短期记忆(RecurrentNeuralNetworks-LongShort-TermMemory)模型进行未来土壤温度值的预测。以某土壤温度历史数据作为输入,对历史数据进行预处理,建立土壤温度传感器的漂移预测模型,实现提前一步土壤温度预测,研究结果表明,使用RNN-LSTM深度神经网络所预测出的土壤温度与实际土壤温度基本一致,表明所使用的RNN-LSTM模型的预测方法有非常高的预测精度和容易实现的特点,预测效果较为理想。The invention discloses a drift prediction method of a soil temperature sensor. Because the soil temperature has strong randomness and is affected by various factors, the soil temperature sensor will drift, so the accuracy of soil temperature prediction is high. According to the above phenomenon, in view of the characteristics of sensor drift and the demand for the accuracy and real-time performance of soil temperature prediction, a Recurrent Neural Networks-LongShort-Term Memory model is proposed to predict future soil temperature values. Taking a certain soil temperature historical data as the input, preprocessing the historical data, establishing the drift prediction model of the soil temperature sensor, and realizing the soil temperature prediction one step ahead. The research results show that the soil temperature predicted by the RNN-LSTM deep neural network is similar to The actual soil temperature is basically the same, indicating that the prediction method of the RNN-LSTM model used has the characteristics of very high prediction accuracy and easy implementation, and the prediction effect is ideal.
本发明所采用的技术方案是:一种土壤温度传感器的漂移预测方法,提供一种基于RNN-LSTM神经网络的土壤温度传感器预测方法,通过python平台建立神经网络,输入训练数据集,让网络自主学习出预测温度传感器的漂移预测网络模型。The technical scheme adopted by the present invention is: a method for predicting the drift of a soil temperature sensor, providing a method for predicting the soil temperature sensor based on an RNN-LSTM neural network, establishing a neural network through a python platform, inputting a training data set, and allowing the network to be autonomous Learn a drift prediction network model that predicts temperature sensors.
如图1所示,本发明提供一种土壤温度传感器的漂移预测方法,所述方法包括以下步骤:As shown in FIG. 1 , the present invention provides a drift prediction method of a soil temperature sensor, which includes the following steps:
获取土壤温度传感器的历史数据。Get historical data from soil temperature sensors.
对历史数据进行规范处理。Normalize historical data.
将历史数据按一定的比例分为训练数据集和测试数据集。Divide historical data into training data set and test data set according to a certain proportion.
使用python平台构造RNN-LSTM神经网络。Construct the RNN-LSTM neural network using the python platform.
用数据集进行训练RNN-LSTM神经网络。Use the dataset to train the RNN-LSTM neural network.
用训练完成的神经网络预测土壤温度传感器的温漂。Predict the temperature drift of the soil temperature sensor with the trained neural network.
在本发明一实施例中,对历史数据归一化处理包括;In an embodiment of the present invention, normalizing the historical data includes:
用以下公式为[0,1]之间的小数;Use the following formula for decimals between [0,1];
xk=(x-xmean)/xvarxk =(xxmean )/xvar
xmean为数据序列均值,xvar为数据方差,xk为归一化后的数据。xmean is the mean of the data series, xvar is the variance of the data, and xk is the normalized data.
在本发明一实施例中,神经网络包括输入层x=(x1,···,xt-1,xt,···)、隐藏层 h=(h1,···,ht-1,ht,···)、输出层o=(o1,···,ot-1,ot,···)。In an embodiment of the present invention, the neural network includes an input layer x=(x1 ,...,xt-1 ,xt ,...), a hidden layer h=(h1 ,...,ht -1 ,ht ,...), output layer o=(o1 ,...,ot-1 ,ot ,...).
ot=g(V*ht)ot =g(V*ht )
ht=f(U*xt+W*ht-1)ht =f(U*xt +W*ht-1 )
其中在输入层与隐藏层(用U表示)、隐藏层与输出层(用V表示)、隐藏层与隐藏层(用W表示)第一层是输入层,时间t的输入值是xt,t表示时间序列的时间参数;第二层是隐藏层,时间点t的隐藏层状态为ht,其中f为非线性的激活函数;最后一层为输出层,时间点t的输出层ot。Among them, in the input layer and hidden layer (represented by U), hidden layer and output layer (represented by V), hidden layer and hidden layer (represented by W), the first layer is the input layer, and the input value at time t is xt , t represents the time parameter of the time series; the second layer is the hidden layer, the state of the hidden layer at the time point t is ht , where f is the nonlinear activation function; the last layer is the output layer, and the output layer ot at the time point t .
遗忘门模型的具体关系式:The specific relationship of the forget gate model:
ft=σ(Wf·[ht-1,xt]+bf)ft =σ(Wf ·[ht-1 ,xt ]+bf )
其中Wf、bf分别代表遗忘门的权重和偏置。where Wf and bf represent the weight and bias of the forget gate, respectively.
输入门和候选门模型具体关系式:The specific relationship between the input gate and the candidate gate model:
it=σ(Wi·[ht-1,xt]+bi)it =σ(Wi ·[ht-1 ,xt ]+bi )
其中Wi、WC代表相应权重,bi、bC代表相应偏置。Among them, Wi andWC represent corresponding weights, andbi and bC represent corresponding biases.
记忆单元的模型函数:The model function of the memory cell:
其中Ct表示的是状态单元的值。Where Ct represents the value of the state unit.
输出门模型具体关系式:The specific relationship of the output gate model:
ot=σ(Wo[ht-1,xt]+bo)ot =σ(Wo [ht-1 ,xt ]+bo )
最终的时间序列上的输出量:The output on the final time series:
ht=ot*tanh(Ct)ht =ot *tanh(Ct )
其中Wo、bo分别代表输出门的权重和偏置。where Wo andbo represent the weight and bias of the output gate, respectively.
在本发明一实施例中,LSTM神经网络,忘记门会根据读取ht-1和xt的信息,来输出一个在0~1之间的数值反馈给每个在细胞状态Ct-1中的数字。倘若数字是1,则表示“完全保留”,若数字是0,则表示“完全舍弃”。In an embodiment of the present invention, the LSTM neural network, the forget gate will output a value between 0 and 1 according to the information read ht-1 and xt to feed back to each cell state Ct-1 numbers in . If the number is 1, it means "completely reserved", and if the number is 0, it means "completely discarded".
在本发明一实施例中,超参的选择包括学习速率,训练批次,神经元个数。In an embodiment of the present invention, the selection of hyperparameters includes a learning rate, a training batch, and the number of neurons.
其中学习速率为0到1之间,训练批次为2800,神经元个数为32。The learning rate is between 0 and 1, the training batch is 2800, and the number of neurons is 32.
在本发明一实施例中,模型使用softmax激活函数,分类交叉熵损失函数(对数损失函数),使用Adam优化函数来更新模型参数,表达式如下所示:In an embodiment of the present invention, the model uses the softmax activation function, the categorical cross-entropy loss function (logarithmic loss function), and the Adam optimization function to update the model parameters, and the expression is as follows:
softmax激活函数表达式:Softmax activation function expression:
交叉熵损失函数表达式:Cross entropy loss function expression:
其中yi表示真实分类结果。ai代表softmax的第i个输出值。where yi represents the true classification result. ai represents the ith output value of softmax.
在本发明一实施例中,所述神经网络输入层的输入数据为归一化的温度,神经网络输出数据为归一化后的温度。In an embodiment of the present invention, the input data of the input layer of the neural network is the normalized temperature, and the output data of the neural network is the normalized temperature.
虽然,上文中用一般性说明以及具体实施例对本发明作了详尽的描述,本发明解决了土壤温度传感器的漂移所给测量带来的影响,让数据采集更加方便,解决了受土壤温度传感器漂移对数据的影响,极大的提高了数据采集的效率,减少成本,提高数据采集精度,但在本发明基础上,可以作一些修改或改进,对本领域技术人员显而易见。因此在不偏离本发明精神基础上的修改或改进,均属于本发明要求保护范。Although the present invention has been described in detail with general descriptions and specific embodiments above, the present invention solves the influence of the soil temperature sensor drift on the measurement, makes data collection more convenient, and solves the problem of soil temperature sensor drift. The impact on the data greatly improves the efficiency of data collection, reduces costs, and improves the accuracy of data collection, but on the basis of the present invention, some modifications or improvements can be made, which is obvious to those skilled in the art. Therefore, any modification or improvement without departing from the spirit of the present invention belongs to the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910998346.8ACN110705700A (en) | 2019-10-21 | 2019-10-21 | Drift prediction method of soil temperature sensor |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910998346.8ACN110705700A (en) | 2019-10-21 | 2019-10-21 | Drift prediction method of soil temperature sensor |
| Publication Number | Publication Date |
|---|---|
| CN110705700Atrue CN110705700A (en) | 2020-01-17 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910998346.8APendingCN110705700A (en) | 2019-10-21 | 2019-10-21 | Drift prediction method of soil temperature sensor |
| Country | Link |
|---|---|
| CN (1) | CN110705700A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111829693A (en)* | 2020-07-30 | 2020-10-27 | 成都运达科技股份有限公司 | Bearing temperature detection method and system based on LSTM model of time and space dimensions |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102238900A (en)* | 2008-10-03 | 2011-11-09 | 拜尔健康护理有限责任公司 | System and method for predicting ambient temperature in a fluid analyte meter |
| CN103063880A (en)* | 2012-12-21 | 2013-04-24 | 浙江大学 | Method of temperature drift estimating and compensating in scanning probe microscopy |
| CN108803576A (en)* | 2018-07-24 | 2018-11-13 | 广东工业大学 | A kind of fault early warning method and relevant apparatus of temperature control system |
| CN109685676A (en)* | 2018-10-11 | 2019-04-26 | 上海交通大学 | Intelligent liquid manure management method and system |
| CN110210174A (en)* | 2019-06-21 | 2019-09-06 | 西南交通大学 | A kind of EMU axle box bearing temperature predicting method based on multilayer LSTM |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102238900A (en)* | 2008-10-03 | 2011-11-09 | 拜尔健康护理有限责任公司 | System and method for predicting ambient temperature in a fluid analyte meter |
| CN103063880A (en)* | 2012-12-21 | 2013-04-24 | 浙江大学 | Method of temperature drift estimating and compensating in scanning probe microscopy |
| CN108803576A (en)* | 2018-07-24 | 2018-11-13 | 广东工业大学 | A kind of fault early warning method and relevant apparatus of temperature control system |
| CN109685676A (en)* | 2018-10-11 | 2019-04-26 | 上海交通大学 | Intelligent liquid manure management method and system |
| CN110210174A (en)* | 2019-06-21 | 2019-09-06 | 西南交通大学 | A kind of EMU axle box bearing temperature predicting method based on multilayer LSTM |
| Title |
|---|
| 付宇: "航空发动机进气道静电传感器理论与实验研究", 《中国优秀博硕士学位论文全文数据库(博士)工程科技II辑》* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111829693A (en)* | 2020-07-30 | 2020-10-27 | 成都运达科技股份有限公司 | Bearing temperature detection method and system based on LSTM model of time and space dimensions |
| CN111829693B (en)* | 2020-07-30 | 2021-10-22 | 成都运达科技股份有限公司 | Bearing temperature detection method and system based on LSTM model of time and space dimensions |
| Publication | Publication Date | Title |
|---|---|---|
| CN109060001B (en) | Multi-working-condition process soft measurement modeling method based on feature transfer learning | |
| CN109685252B (en) | Building energy consumption prediction method based on cyclic neural network and multi-task learning model | |
| CN112116147A (en) | River water temperature prediction method based on LSTM deep learning | |
| CN106022521B (en) | Short-term load prediction method of distributed BP neural network based on Hadoop architecture | |
| CN110707763B (en) | AC/DC power distribution network load prediction method based on ensemble learning | |
| CN112733449B (en) | A CNN well-seismic joint inversion method, system, storage medium, equipment and application | |
| CN114547974A (en) | Dynamic soft measurement modeling method based on input variable selection and LSTM neural network | |
| CN111626785A (en) | A CNN-LSTM network fund price prediction method based on combined attention | |
| CN111310965A (en) | A method of aircraft track prediction based on LSTM network | |
| CN113722997A (en) | New well dynamic yield prediction method based on static oil and gas field data | |
| CN110175416A (en) | Three Gorges Reservoir water temperature prediction method based on principal component analysis and neural network | |
| CN114417740B (en) | Deep sea breeding situation sensing method | |
| CN115549082B (en) | Power load forecasting method based on load mining and LSTM neural network | |
| CN115115416B (en) | Commodity sales predicting method | |
| CN116703644A (en) | A short-term power load forecasting method based on Attention-RNN | |
| CN114819395A (en) | Industry medium and long term load prediction method based on long and short term memory neural network and support vector regression combination model | |
| CN110533249B (en) | Metallurgical enterprise energy consumption prediction method based on integrated long-term and short-term memory network | |
| CN116757545A (en) | A quality prediction method for multi-level manufacturing systems based on multi-task deep learning | |
| CN118824409A (en) | A soft-sensing method for sewage effluent index BOD5 based on Transformer and long short-term memory network | |
| CN107391851A (en) | A soft-sensing modeling method for glutamic acid fermentation process based on kernel ridge regression | |
| CN113205368B (en) | Industrial and commercial customer clustering method based on time sequence water consumption data | |
| Tung et al. | Binary classification and data analysis for modeling calendar anomalies in financial markets | |
| CN117521511A (en) | A granary temperature prediction method based on improved gray wolf algorithm optimized LSTM | |
| CN116502760A (en) | Short-term power load prediction method | |
| CN111524348A (en) | A long-term and short-term traffic flow prediction model and method |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20200117 | |
| RJ01 | Rejection of invention patent application after publication |