Disclosure of Invention
The invention provides a poultry feed detection and formula system, which effectively solves the problems that the conventional poultry breeding environment parameter detection system does not influence the poultry breeding economic benefit according to the nonlinearity and large lag of the change of poultry breeding environment parameters, the complexity of a poultry feed formula and the like, and the poultry breeding economic benefit and the poultry management are greatly influenced by predicting the feed-egg ratio of poultry feed and accurately adjusting the poultry feed formula.
The invention is realized by the following technical scheme:
a poultry feed detection and formula system is composed of a poultry breeding environment parameter acquisition and control platform, a poultry feed formula feed-egg ratio prediction subsystem and a feed formula genetic algorithm optimization subsystem, and is used for detecting poultry breeding environment parameters, predicting the feed-egg ratio of a poultry feed formula and optimizing the poultry feed formula, so that the poultry breeding economic benefit and the production management efficiency are improved.
The invention further adopts the technical improvement scheme that:
the poultry breeding environment parameter acquisition and control platform consists of a detection node, a control node, a gateway node, an on-site monitoring end, a cloud platform and a mobile phone APP, the detection node acquires poultry breeding environment parameters and uploads the poultry breeding environment parameters to the cloud platform through the gateway node, data and release information are stored at the cloud platform end, the mobile phone APP can monitor the poultry breeding environment parameters in real time through the poultry breeding environment information provided by the cloud platform, the detection node and the control node are responsible for acquiring the poultry breeding environment parameter information and controlling poultry breeding environment equipment, and bidirectional communication of the detection node, the control node, the on-site monitoring end, the cloud platform and the mobile phone APP is realized through the gateway node, so that the poultry breeding environment parameter acquisition and the poultry breeding equipment control are realized; the poultry farming environment parameter acquisition and control platform structure is shown in figure 1.
The invention further adopts the technical improvement scheme that:
the poultry feed formula feed-egg ratio prediction subsystem consists of a CNN convolution neural network model, an NARX neural network model, a plurality of BAM neural network models, an LSTM neural network model, a time delay neural network model, a feed-egg ratio trend prediction module and an environment evaluation module; the poultry feed formula is used as the input of the CNN convolutional neural network model, the output of the CNN convolutional neural network model is used as the input of the NARX neural network model, the outputs of the NARX neural network model, the material-egg ratio trend prediction module, the environment evaluation module and the time delay neural network model are respectively used as the input of each BAM neural network model, the outputs of the BAM neural network models are used as the input of the LSTM neural network model, the output of the LSTM neural network model is used as the input of the time delay neural network model, and the output value of the LSTM neural network model is used as the material-egg ratio prediction value of the poultry feed formula; the structure of the poultry feed formula feed-egg ratio prediction subsystem is shown in figure 2.
The invention further adopts the technical improvement scheme that:
the feed-egg ratio trend prediction module comprises an EMD empirical mode decomposition model, an ARIMA model, a plurality of ESN neural network models and a NARX neural network model, historical data of the feed-egg ratio of the poultry is used as input of the EMD empirical mode decomposition model, a low-frequency trend part and a plurality of high-frequency fluctuation parts of the historical data of the feed-egg ratio of the poultry output by the EMD empirical mode decomposition model are respectively used as input of the ARIMA model and the ESN neural network models, output of the ARIMA model and the ESN neural network models is used as input of the NARX neural network model, and output of the NARX neural network model is used as output value of the feed-egg ratio trend prediction module; the egg-feed ratio trend prediction module is shown in fig. 2.
The invention further adopts the technical improvement scheme that:
the environment evaluation module comprises a plurality of time delay neural network models, a fuzzy C mean value clustering algorithm, a plurality of ESN neural network models and a noise reduction self-encoder, wherein a plurality of groups of temperature, humidity, wind speed and illuminance sensors are respectively used as the input of the corresponding time delay neural network models, the output of the time delay neural network models is used as the input of the fuzzy C mean value clustering algorithm, the output values of the multi-type time delay neural network models output by the fuzzy C mean value clustering algorithm are respectively used as the input of the corresponding ESN neural network models, the output of the ESN neural network models is used as the input of the noise reduction self-encoder, and the output value of the noise reduction self-encoder is used as the output value of the environment evaluation module; the environment evaluation module is shown in fig. 2.
The invention further adopts the technical improvement scheme that:
the feed formula genetic algorithm optimization subsystem starts from an initial population and circularly executes the processes of selection, crossing and mutation operation evolution until a termination condition is met; in the evolution process of each generation, a certain number of poultry feed formula individuals are kept, the poultry feed formula individuals are evaluated through calculating the individual fitness value of each poultry feed formula, the individual fitness of each poultry feed formula is used as a condition for participating in the next generation of evolution chance, and the poultry feed formula individuals meeting the termination condition are the optimal solution of the feed formula genetic algorithm optimization subsystem; the structure of the feed formula genetic algorithm optimization subsystem is shown in figure 3;
each poultry feed formula individual is used as the input of the poultry feed formula feed-egg ratio prediction subsystem, the output of the poultry feed formula feed-egg ratio prediction subsystem is used as the feed-egg ratio prediction value of the feed formula individual, the reciprocal of the feed-egg ratio prediction value of each poultry feed formula individual is used as the fitness of the poultry feed formula individual, the larger the reciprocal of the feed-egg ratio prediction value of each poultry feed formula individual is, the higher the fitness of the poultry feed formula individual is, and the sum of the reciprocals of the feed-egg ratio prediction values of each poultry feed formula individual in the population is the total fitness of the population.
Compared with the prior art, the invention has the following obvious advantages:
the method has the advantages that the CNN convolutional neural network model can be used for realizing the spatial feature extraction of the poultry feed formula and shortening the feature extraction time, and the NARX neural network model can remember the advantage of the relationship between the poultry feed formula and the poultry feed egg ratio in the poultry breeding process with strong dependence, so that the problems of spatial feature extraction and time feature data dependence of the poultry feed formula and poultry feed egg ratio data activity sequence data are solved; firstly, inputting sequence data of a poultry feed formula into a CNN convolutional neural network model to extract a spatial feature vector of the poultry feed formula; and secondly, extracting the spatial feature vector of the poultry feed formula in the last step as the input of an NARX neural network model, and predicting the problem of mutual influence of time features between activity sequence data of the feed-egg ratio of the poultry feed formula by using a closed-loop network formed by input delay and feedback delay in the NARX neural network model, thereby improving the accuracy and time efficiency of predicting the feed-egg ratio of the poultry feed formula.
Secondly, extracting the spatial characteristics of the poultry feed formula by using a CNN convolutional neural network model to realize the characteristic extraction of the poultry feed formula; meanwhile, the NARX neural network model is selected to process the spatial feature sequence output by the CNN convolutional neural network model, the time sequence information of the poultry feed formula is mined, the time feature of the poultry feed formula is extracted in the time dimension, and the accurate prediction of the feed-egg ratio of the poultry feed formula is realized.
Thirdly, the convolutional layer of the CNN convolutional neural network model has the main advantages that weight sharing and sparse connection in the spatial characteristics of the poultry feed formula are extracted, wherein the weight sharing means that the weight of a convolutional kernel of the CNN convolutional neural network model is kept unchanged when convolution operation is carried out on the convolutional kernel, and the weight of each convolutional kernel is the same as that of the poultry feed formula in the whole area; the sparse connection means that each convolution kernel of the CNN convolution neural network model only uses specific local area data in the data of the upper layer to carry out operation, and a global poultry feed formula is not used; the weight sharing and sparse connection characteristics of the convolution kernel of the CNN convolutional neural network model greatly reduce the number of spatial characteristic parameters of the poultry feed formula, so that overfitting of the CNN convolutional neural network model is prevented, the training speed of the CNN convolutional neural network model is increased, and the poultry feed formula prediction accuracy is improved.
The LSTM neural network model is similar to a standard network containing a recursion hidden layer, the only change is that a memory module is used for replacing an original hidden layer unit, the problems of gradient disappearance and sharp increase are solved through self-feedback of the internal state of a memory cell and truncation of errors of input and output, compared with a BP neural network and a common RNN, the LSTM adds 1 state unit c and 3 control gates, the feature inclusion capacity and the memory capacity of the model are greatly increased, and under-fitting and gradient disappearance are avoided. The function of the LSTM neural network model is to learn the relationships and changes in the relationships over time that exist in the poultry feed formulation, poultry feed egg ratio history data and aquaculture environment data, and to obtain more accurate results. The LSTM neural network model realizes the prediction of the feed egg ratio of the poultry feed formula and the water quality parameter grade of the aquaculture pond environment, and improves the prediction accuracy.
And fifthly, the LSTM neural network model has a chain-like repeating network structure similar to the standard RNN, and a repeating network in the LSTM neural network model has 4 interaction layers including 3 gate layers and 1 tanh layer. Processor state is a key variable in the LSTM neural network model that carries information from previous steps of feed-to-egg ratio prediction for poultry feed formulations and steps through the entire LSTM neural network model. The gate in the interaction layer may partially delete the processor state of the previous step and add new information to the processor state of the current step based on the hidden state of the previous step and the input of the current step. The inputs to each repeating network include the predicted hidden and processor states of the egg ratio for the poultry feed formulation of the previous step and the inputs for the current step. The processor state is updated according to the calculation results of the 4 interaction layers. The updated processor state and hidden state constitute the output and are passed on to the next step.
Sixthly, the LSTM neural network model is a recurrent neural network with 4 interaction layers in a repetitive network. It not only extracts information from the egg ratio prediction sequence data of poultry feed formulations like the standard recurrent neural network, but also retains information with long-term relevance from previous distant steps. The feed-egg ratio prediction data of the poultry feed formula are sequence data, and the variation trend of the sequence data is rich in meaning. Furthermore, because the sampling interval for the egg ratio prediction for the poultry feed formulation is relatively small, there is a long-term spatial correlation of the egg ratio prediction for the poultry feed formulation, and the LSTM neural network model has sufficient long-term memory to address this problem.
Seventhly, in the cascade LSTM neural network model, the feed-egg ratio data of the poultry feed formula which is relatively easy to predict is firstly reconstructed at a shallow level, and then the feed-egg ratio data of the generated poultry feed formula is used as the input of the next level. The deep-level prediction result is not only based on the input value in the feed-egg ratio data training data of the poultry feed formula, but also influenced by the feed-egg ratio data result of the shallow-level poultry feed formula.
The invention adopts a time delay module and feedback realization of an NARX neural network model through feed-to-egg ratio prediction of a poultry feed formula to establish a dynamic recursive network of the NARX neural network model, which is a data association modeling idea of a function simulation function and realized by a sequence of feed-to-egg ratio parameters of the poultry feed formula at a plurality of times along the expansion of the feed-to-egg ratio parameters in the time axis direction. The input comprises a feed-egg ratio input and an output historical feedback of a poultry feed formula for a period of time, the feedback input can be considered to contain historical feed-egg ratio state information of the poultry feed formula for a period of time to participate in the prediction of the feed-egg ratio of the poultry feed formula, and the prediction has good effect on a proper feedback time length.
The invention utilizes the NARX neural network model to establish the feed-egg ratio prediction model of the poultry feed formula, because the dynamic recursive network of the feed-egg ratio model of the poultry feed formula is established by introducing the input delay module and the output feedback, the CNN convolutional neural network model output is used as the input and the NARX neural network output vector delay feedback is introduced into the NARX neural network model training to form a new input vector, and the invention has good nonlinear mapping capability.
The BAM neural network model is a double-layer feedback neural network, and can realize the function of the different associative memory of the feed-egg ratio of the poultry feed formula; when the feed-egg ratio input signal of the poultry feed formula is added to one layer, the other layer is output. Since the initial mode can be applied to any layer of the network, the feed-to-egg ratio information of the poultry feed formulation can also be propagated in both directions, so there is no explicit input layer or output layer. The learning speed of the BAM neural network model is high, the convergence speed is low during BP learning, the final convergence can possibly reach a local minimum point instead of a global minimum point, and the BAM reaches an energy minimum point; the BAM neural network model is a feedback network for the feed-to-egg ratio of the poultry feed formula, and when an input error occurs, the BAM neural network model not only can output an accurate fault reason, but also can correct the feed-to-egg ratio error of the poultry feed formula. The BAM neural network model utilizes the characteristic of bidirectional association storage of the BAM neural network to improve the uncertain information processing capability of the feed-egg ratio of the poultry feed formula in the reasoning process.
Detailed Description
The technical scheme of the application is further described by combining the attached drawings 1-7:
design of overall system function
The poultry feed detection and formula system for detecting and predicting poultry breeding environment parameters comprises a poultry breeding environment parameter acquisition and control platform, a poultry feed formula feed-egg ratio prediction subsystem and a feed formula genetic algorithm optimization subsystem. The poultry breeding environment parameter acquisition and control platform comprises detection nodes, control nodes, gateway nodes, an on-site monitoring end, a cloud platform and a mobile phone App of poultry breeding environment parameters, wherein the detection nodes and the control nodes construct CAN bus network communication to realize the CAN bus network communication among the detection nodes, the control nodes and the gateway nodes; the detection node sends the detected poultry breeding environment parameters to the field monitoring end and the cloud platform through the gateway node, and bidirectional transmission of the poultry breeding environment parameters and related control information is achieved among the gateway node, the cloud platform, the field monitoring end and the mobile phone App. The poultry breeding environment parameter acquisition and control platform is shown in figure 1.
Design of detection node
A large number of detection nodes 1 based on a CAN bus communication network are used as poultry breeding environment parameter sensing terminals, and the detection nodes realize mutual information interaction between field monitoring terminals through the CAN bus communication network. The detection node comprises a sensor for acquiring the temperature, the humidity, the wind speed and the illuminance of the environment of the poultry house, a corresponding signal conditioning circuit, an STM32 microprocessor and a CAN bus interface for CAN bus network communication; the software of the detection node mainly realizes CAN bus network communication and acquisition and pretreatment of poultry breeding environment parameters. The software is designed by adopting a C language program, so that the compatibility degree is high, the working efficiency of software design and development is greatly improved, and the reliability, readability and transportability of program codes are enhanced. The structure of the detection node is shown in fig. 4.
Design of control node
The control node realizes mutual information interaction between gateway nodes through a CAN bus network, and comprises 4 digital-to-analog conversion circuits corresponding to control external equipment, an STM32 microprocessor, 4 external equipment controllers and CAN interfaces of a CAN bus communication network; the 4 external equipment controllers are respectively a temperature controller, a humidity controller, a wind speed controller and an illumination controller. The control node structure is shown in fig. 5.
Fourth, gateway node design
The gateway node comprises a CAN interface, an NB-IoT module, an STM32 single chip microcomputer and an RS232 interface, the gateway node comprises a CAN bus communication network which is used for realizing communication between the gateway node and the detection node and the control node through the CAN interface, the NB-IoT module realizes data bidirectional interaction between the gateway and the cloud platform, and the RS232 interface is connected with the field monitoring terminal to realize information interaction between the gateway and the field monitoring terminal. The gateway node structure is shown in figure 6.
Fifthly, software design of field monitoring terminal
The on-site monitoring terminal is an industrial control computer, mainly collects poultry environmental parameters, predicts poultry feed formula feed-egg ratio and optimizes poultry feed formula, and realizes information interaction with a detection node and a control node, the on-site monitoring terminal mainly has the functions of communication parameter setting, data analysis and data management, a poultry feed formula feed-egg ratio prediction subsystem and a feed formula genetic algorithm optimization subsystem realize poultry breeding environmental parameter detection, poultry feed formula feed-egg ratio prediction and poultry feed formula optimization, the management software selects Microsoft Visual + +6.0 as a development tool, a communication program is designed by calling Mscom communication controls of the system, and the software function of the on-site monitoring terminal is shown in figure 7. The poultry feed formula feed-egg ratio prediction subsystem is shown in figure 2, and the feed formula genetic algorithm optimization subsystem flow is shown in figure 3. The design process of the poultry feed formula feed-egg ratio prediction subsystem and the feed formula genetic algorithm optimization subsystem flow is as follows:
(I) poultry feed formula feed-egg ratio prediction subsystem design
The poultry feed formula feed-egg ratio prediction subsystem consists of a CNN convolution neural network model, an NARX neural network model, a plurality of BAM neural network models, an LSTM neural network model, a time delay neural network model, a feed-egg ratio trend prediction module and an environment evaluation module; the respective models were designed as follows:
1. convolutional neural network model design
The poultry feed formula is used as the input of the CNN convolutional neural network model, and the output of the CNN convolutional neural network model is used as the input of the NARX neural network model. The CNN convolutional neural network model can automatically mine and extract sensitive spatial features representing the system state from a large number of poultry feed formulas, and mainly comprises 4 parts: input layer (Input). The input layer is the input of the CNN convolutional neural network model, and the poultry feed formula or the preprocessed signals are generally normalized and then directly input. ② a convolutional layer (Conv). Because the data dimension of the input layer is large, the CNN convolutional neural network model is difficult to directly and comprehensively sense all poultry feed formula input information, the input data needs to be divided into a plurality of parts for local sensing, then the global information is obtained through weight sharing, and meanwhile, the complexity of the CNN convolutional neural network model structure is reduced. And a pooling layer (Pool, also known as a down-sampling layer). Because the dimensionality of the data samples obtained after the convolution operation is still large, the data size needs to be compressed and key information needs to be extracted to avoid overlong model training time and overfitting, and therefore a pooling layer is connected behind the convolution layer to reduce the dimensionality. And taking the peak characteristic of the defect characteristic into consideration, performing down-sampling by adopting a maximum pooling method. And fourthly, a full connection layer. After all convolution operations and pooling operations, feature extraction data enter a full-connection layer, each nerve layer in the layer is in full connection with all neurons in the previous layer, and local feature information extracted by the convolution layer and the pooling layer is integrated. Meanwhile, in order to avoid the over-fitting phenomenon, a lost data (dropout) technology is added in the layer, the output value passing through the last layer of full connection layer is transmitted to the output layer, and the pooling results of the last layer are connected together in an end-to-end mode to form the output layer.
2. NARX neural network model design
The output of the CNN convolutional neural network model is used as the input of the NARX neural network model, the outputs of the NARX neural network model, the material-egg ratio trend prediction module, the environment evaluation module and the time delay neural network model are respectively used as the input of each BAM neural network model, and the output value of the NARX neural network model is used as the material-egg ratio of the poultry feed formula; the NARX neural network model is a dynamic recurrent neural network with output feedback connection, which can be equivalent to a BP neural network with input time delay and added with time delay feedback connection from output to input on a topological connection relation, and the structure of the NARX neural network model is composed of an input layer, a time delay layer, a hidden layer and an output layer, wherein an input layer node is used for signal input, a time delay layer node is used for time delay of an input signal and an output feedback signal, the hidden layer node performs nonlinear operation on the delayed signal by using an activation function, and an output layer node is used for performing linear weighting on hidden layer output to obtain final network output. The NARX neural network has the characteristics of nonlinear mapping capability, good robustness, adaptability and the like, and is suitable for predicting the feed-egg ratio of the poultry feed formula. x (t) represents the external input of the neural network, namely the CNN convolutional neural network model output value; m represents the delay order of the external input; y (t) is the output of the neural network, namely the predicted value of the feed-egg ratio in the next time period; n is the output delay order; s is the number of hidden layer neurons; the output of the jth implicit element can thus be found as:
in the above formula, wjiFor the connection between the ith input and the jth implicit neuronWeight, bjIs the bias value of the jth implicit neuron, and the output y (t +1) of the network has the value:
y(t+1)=f[y(t),y(t-1),…,y(t-n),x(t),x(t-1),…,x(t-m+1);W] (2)
the NARX neural network model of the invention is a dynamic feedforward neural network, the NARX neural network is a nonlinear autoregressive network with the output value of the CNN convolutional neural network model with external input, the NARX neural network has the dynamic characteristic of multi-step time delay and is connected to a plurality of layers of closed networks of network input through the output value of the feedback feed-egg ratio, the NARX neural network model is a dynamic neural network which is most widely applied in a nonlinear dynamic system, and the performance of the NARX neural network model is generally superior to that of a full-regression neural network. A typical NARX recurrent neural network is mainly composed of an input layer, a hidden layer, an output layer, and input and output delays, before application, the delay order and the number of hidden layer neurons of the input and output are generally determined in advance, and the current output feed-egg ratio of the NARX neural network model depends not only on the output feed-egg ratio at the past y (t-n) time, but also on the output of the current CNN convolutional neural network model as an input vector x (t), the delay order of the input vector, and the like. The output of the CNN convolutional neural network model is used as an input signal and is transmitted to the hidden layer through the time delay layer, the hidden layer processes the input signal and transmits the processed input signal to the output layer, the output layer performs linear weighting on the output signal of the hidden layer to obtain a final output material-to-egg ratio of the NARX neural network model, the time delay layer delays a signal fed back by the output material-to-egg ratio of the NARX neural network model and the output of the CNN convolutional neural network model as the signal of the input layer, and then the signal is transmitted to the hidden layer.
3. BAM neural network model design
The outputs of the NARX neural network model, the material-egg ratio trend prediction module, the environment evaluation module and the time delay neural network model are respectively used as the input of each BAM neural network model, and the outputs of the BAM neural network models are used as the input of the LSTM neural network model. The BAM neural network model is a feedback type bidirectional associative memory neural network, and further predicts the feed-egg ratio through a mode of multiple feedback training, and has the feed-egg ratio of an associative memory poultry feed formulaThe value function and the adaptability are strong, the feed-egg ratio of the poultry feed formula is automatically extracted, the prediction error is small, and the feed-egg ratio can be widely applied due to the self occurrence; in the BAM neural network model topological structure, the initial mode of the network input end is x (t), and the initial mode is obtained by a weight matrix W1Weighted and then reaches the y end of the output end and passes through the transfer characteristic f of the output nodeyNon-linear transformation of (1) and (W)2The matrix is weighted and returns to the input end x, and then the transfer characteristic f of the output node at the x end is passedxThe nonlinear transformation of the BAM neural network prediction model is changed into the output of the input terminal x, and the operation process is repeated, so that the state transition equation of the BAM neural network prediction model is shown in an equation (3).
4. LSTM neural network model design
The output of the BAM neural network models is used as the input of the LSTM neural network model, the output of the LSTM neural network model is used as the input of the time delay neural network model, and the output value of the LSTM neural network model is used as the feed-egg ratio predicted value of the poultry feed formula. The temporal Recurrent Neural Network (RNN) of the LSTM neural network model, which is composed of long-short term memory (LSTM) units, is referred to as the LSTM neural network model temporal recurrent neural network, and is also commonly referred to as the LSTM neural network model network. The LSTM neural network model introduces mechanisms of Memory cells (Memory cells) and hidden layer states (Cell states) to control the transfer of information between hidden layers. The memory unit of an LSTM neural network model neural network is internally provided with 3 Gate (Gates) computing structures which are an Input Gate (Input Gate), a forgetting Gate (Forget Gate) and an Output Gate (Output Gate). Wherein, the input gate can control the adding or filtering of new information; the forgetting door can forget the information to be lost and keep the useful information in the past; the output gate enables the memory unit to output only information related to the current time step. The 3 gate structures carry out operations such as matrix multiplication, nonlinear summation and the like in the memory unit, so that the memory still cannot be attenuated in continuous iteration. The long-short term memory unit (LSTM) structure unit is composed of unit (Cell), Input Gate (Input Gate), and output GateAn Output Gate (Output Gate) and a forgetting Gate (form Gate). The LSTM neural network model is suitable for dynamic change of the feed-egg ratio of a prediction time sequence detection point, can last for a long time and memorize in a short time, effectively prevents gradient disappearance during RNN training, and is a special RNN (long short term memory) (LSTM). The LSTM neural network model can learn long-term dependency information while avoiding the gradient vanishing problem. The LSTM neural network model adds a structure called a Memory Cell (Memory Cell) in a neural node of a hidden layer of a neuron internal structure RNN for memorizing past egg-ratio dynamic change information, and adds three gate structures (Input, form and Output) for controlling the use of egg-ratio historical information. Let the output values of the input multiple BAM neural network models be (x)1,x2,…,xT) The hidden layer state is (h)1,h2,…,hT) Then, time t has:
it=sigmoid(Whiht-1+WxiXt) (4)
ft=sigmoid(Whfht-1+WhfXt) (5)
ct=ft⊙ct-1+it⊙tanh(Whcht-1+WxcXt) (6)
ot=sigmoid(Whoht-1+WhxXt+Wcoct) (7)
ht=ot⊙tanh(ct) (8)
wherein it、ft、otRepresenting input, forget and output doors, ctRepresenting a cell, WhRepresenting the weight of the recursive connection, WxSigmoid and tanh represent the weights from the input layer to the hidden layer, and are two activation functions. The method comprises establishing LSTM neural network model, establishing training set by using output data of preprocessed BAM neural network models, and modelingThe model is trained, and the LSTM neural network model considers the time sequence and nonlinearity of the change of the feed-egg ratio, so that the prediction precision of the feed-egg ratio is high.
5. Time delay neural network model design
The output of the LSTM neural network model is used as the input of the delay neural network model, and the output of the delay neural network model is used as the corresponding input of the BAM neural network model. The Time Delay Neural Network (TDNN) is a self-adaptive linear network, the input of which enters from the left side of the network, and becomes the input of D +1 dimensional vector after D steps of Delay through the action of a single step Delay line D, the vector is formed by combining the signals output by the LSTM Neural network model at the current K moments and the signals output by D-1 LSTM Neural network models before K, the neuron adopts a linear activation function, and the Delay Neural network belongs to the variety of the traditional artificial Neural network. The time delay neural network structure consists of an input layer, an output layer and one or a plurality of hidden layers, and the neural network establishes a mapping relation between input and output. Different from the traditional neural network, the time delay neural network realizes the memory of preamble input by delaying input at an input layer, and the input is delayed at the input layer, so that the network can jointly predict the output of the current time point by using the input of previous d steps and the current input, and for the time delay neural network with the delay step number of d at an input layer, R is a forward propagation operator of the time delay neural network, the relation between an input sequence X and an output sequence Y can be simply expressed as follows:
Y(t)=R(X(t),X(t-1),…,X(t-d)) (9)
6. material-egg ratio trend prediction module design
The feed-egg ratio trend prediction module comprises an EMD empirical mode decomposition model, an ARIMA model, a plurality of ESN neural network models and a NARX neural network model, historical data of the feed-egg ratio of the poultry is used as input of the EMD empirical mode decomposition model, a low-frequency trend part and a plurality of high-frequency fluctuation parts of the historical data of the feed-egg ratio of the poultry output by the EMD empirical mode decomposition model are respectively used as input of the ARIMA model and the ESN neural network models, output of the ARIMA model and the ESN neural network models is used as input of the NARX neural network model, and output of the NARX neural network model is used as output value of the feed-egg ratio trend prediction module. Design of NARX neural network model referring to the design process 2 above, EMD empirical mode decomposition model, ARIMA model, multiple ESN neural network model design processes are as follows:
A. EMD empirical mode decomposition model design
The EMD empirical mode decomposition model is a method for screening historical data trend signals of the feed egg ratio of poultry, has the characteristics of simple and intuitive calculation, and is based on experience and self-adaption, and can screen out the trends of different characteristics existing in the historical data signals of the feed egg ratio of poultry step by step to obtain a plurality of high-frequency fluctuation parts (IMF) and low-frequency trend parts of the historical data signals of the feed egg ratio of poultry. The IMF poultry feed egg ratio historical data component signals decomposed by the EMD empirical mode decomposition model comprise component signals of different frequency bands from high to low, the frequency resolution contained in the poultry feed egg ratio historical data changes along with the poultry feed egg ratio signals, and the self-adaptive multi-resolution analysis characteristic is achieved. The purpose of decomposition using EMD empirical mode decomposition model is to extract more accurate information about the ratio of poultry feed to egg ratio to historical data. The IMF component must satisfy two conditions simultaneously: in the historical data signal of the feed-egg ratio of the poultry to be decomposed, the number of the extreme value points of the signal is equal to the number of the zero-crossing points, or the difference is one at most; and secondly, at any time, the envelope mean value defined by the local maximum value and the local minimum value of the feed-egg ratio historical data of the poultry is zero. The empirical mode decomposition method comprises the following steps of screening an upper limit value signal of the historical data of the feed-egg ratio of poultry: (a) all local extreme points of the historical data of the feed-egg ratio of the poultry are determined and then connected by the local extreme points of the three spline lines respectively to form an upper envelope line. (b) And then, three sample lines are used for connecting local minimum value points of the poultry feed egg ratio historical data to form a lower envelope line, and the upper envelope line and the lower envelope line should envelop all data points. (c) The average value of the upper envelope line and the lower envelope line of the historical data of the feed-egg ratio of the poultry is recorded as m1(t), obtaining:
x(t)-m1(t)=h1(t) (10)
x (t) is the historical data primary signal of the feed-egg ratio of poultry, if h1(t) is an IMF, then h1(t) is the first IMF component of x (t). Note c1(t)=h1k(t), then c1(t) is the first component of signal x (t) that satisfies the IMF condition. (d) C is to1(t) separating from x (t) to obtain:
r1(t)=x(t)-c1(t) (11)
will r is1(t) repeating steps (a) to (c) as raw data to obtain the 2 nd component c satisfying IMF condition of x (t)2. The cycle is repeated n times to obtain n components of the signal x (t) satisfying the IMF condition. The empirical mode decomposition model then decomposes the poultry feed egg ratio historical data into a low frequency trend portion and a plurality of high frequency fluctuation portions.
B. ARIMA model design
The ARIMA model is a time series predictive feed-to-egg ratio modeling method proposed by Box et al and extends to the analysis of time series of poultry feed-to-egg ratio historical data. According to the study on the material-egg ratio time series characteristics of the ARIMA model, 3 parameters are adopted to analyze the time series of the material-egg ratio change, namely the autoregressive order (p), the difference times (d) and the moving average order (q). The ARIMA model is written as: ARIMA (p, d, q). The ARIMA model equation with p, d, and q as parameters can be expressed as follows:
Δdytdenotes ytSequence after d differential conversions,. epsilontIs a random error of time, is a white noise sequence which is independent of each other, and has a mean value of 0 and a variance of a constant sigma2Normal distribution of phii(i ═ 1,2, …, p) and θj(j ═ 1,2, …, q) is the parameter to be estimated of the ARIMA model, and p and q are the orders of the ARIMA dynamic prediction feed-egg ratio model. ARIMA dynamic prediction material-egg ratio modelThe method belongs to a linear model in nature, and the modeling and prediction comprise 4 steps of (1) sequence smoothing processing. If the egg ratio data sequence is not stable, if a certain increase or decrease trend exists, the data needs to be differentially processed. Common tools are autocorrelation function maps and partial autocorrelation function maps. And if the autocorrelation function rapidly approaches zero, the material-egg ratio time sequence is a stable time sequence. If the time sequence has a certain trend, the material-egg ratio data needs to be differentially processed, if seasonal rules exist, seasonal differences also need to be carried out, and if the time sequence has heteroscedasticity, the material-egg ratio data needs to be logarithmically converted. (2) And (5) identifying the model. The orders p, d and q of the ARIMA dynamic prediction feed-egg ratio model are mainly determined through autocorrelation coefficients and partial autocorrelation coefficients. (3) Estimating parameters of the model and diagnosing the model. Obtaining estimated values of all parameters in an ARIMA dynamic prediction material-to-egg ratio model by using maximum likelihood estimation, checking the estimated values including parameter significance check and residual randomness check, judging whether the established material-to-egg ratio model is available or not, and performing material-to-egg ratio prediction by using the ARIMA dynamic prediction material-to-egg ratio model with selected proper parameters; and checks are made in the model to determine if the model is adequate and if not, the parameters are re-estimated. (4) And predicting the change trend of the feed-egg ratio by using a feed-egg ratio model with proper parameters.
C. ESN neural network model design
An ESN (Echo state network) is a novel dynamic neural network, has all the advantages of the dynamic neural network, and can better adapt to nonlinear system identification compared with a common dynamic neural network because the Echo state network introduces a reserve pool concept. The reserve pool is a randomly connected reserve pool which is formed by converting a part connected among traditional dynamic neural networks, and the whole learning process is a process of learning how to connect the reserve pool. The "pool" is actually a randomly generated large-scale recursive structure in which the interconnection of neurons is sparse, usually denoted SD as the percentage of interconnected neurons in the total number of neurons N. The state equation of the ESN neural network model is as follows:
wherein W is the state variable of the neural network, W
inIs an input variable of the neural network; w
backConnecting a weight matrix for the output state variables of the neural network; x (n) represents the internal state of the neural network; w
outA connection weight matrix among a nuclear reserve pool of the ESN neural network model, the input of the neural network and the output of the neural network;
is the output deviation of the neural network or may represent noise; f ═ f [ f
1,f
2,…,f
n]N activation functions for neurons within the "pool of stores"; f. of
iIs a hyperbolic tangent function; f. of
outIs the epsilon output functions of the ESN neural network model. And the ESN neural network model outputs a predicted value of the pressure trapezoidal fuzzy number fusion value.
7. Environment assessment module design
The environment evaluation module comprises a plurality of time delay neural network models, a fuzzy C mean value clustering algorithm, a plurality of ESN neural network models and a noise reduction self-encoder, wherein a plurality of groups of temperature, humidity, wind speed and illuminance sensors are respectively used as the input of the corresponding time delay neural network models, the output of the time delay neural network models is used as the input of the fuzzy C mean value clustering algorithm, the output values of the multi-type time delay neural network models output by the fuzzy C mean value clustering algorithm are respectively used as the input of the corresponding ESN neural network models, the output of the ESN neural network models is used as the input of the noise reduction self-encoder, and the output value of the noise reduction self-encoder is used as the output value of the environment evaluation module; the environment evaluation module is shown in fig. 2. The time delay neural network model and the multiple ESN neural network models refer to the design process, and the design process of the fuzzy C-means clustering algorithm and the noise reduction self-encoder is as follows:
A. fuzzy C-means clustering algorithm design
Multiple time-delayed neural network model outputs as ambiguitiesInputting the C-means clustering algorithm, outputting a plurality of time delay neural network models of a plurality of categories output by the fuzzy C-means clustering algorithm as the input of a plurality of ESN neural network models respectively, and setting a finite set X as { X ═ X1,x2,…xnN is a set of a plurality of time-delay neural network model output samples which are respectively a plurality of time-delay neural network model outputs, C is a predetermined category, m is a predetermined number of time-delay neural network model outputsi(i ═ 1,2, … c) is the center of each cluster, μj(xi) Is the membership of the ith sample with respect to the jth class, and the clustering criterion function is defined by the membership function as:
in the formula, | | xi-mjIs xiTo mjThe euclidean distance between; b is fuzzy weighted power exponent, which is a parameter capable of controlling the fuzzy degree of the clustering result; m is a fuzzy C partition matrix of X, V is a clustering center set of X, and the result of the fuzzy C-means clustering algorithm is to obtain M and V which enable the criterion function to be minimum. In the fuzzy C-means clustering method, the sum of the membership degrees of the samples to each cluster is required to be 1, namely:
the FCM algorithm can be done in the following iterative steps:
1. setting the clustering number c and the parameter b, stopping the threshold value epsilon of the algorithm, setting the iteration number t to be 1, and allowing the maximum iteration number to be tmax(ii) a 2. Initializing each cluster center mi(ii) a 3. Calculating a membership function by using the current clustering center; 4. updating various clustering centers by using the current membership function; 5. selecting a proper matrix norm, if | | | V (t +1) -V (t) | | | is less than or equal to epsilon or t is more than or equal to tmaxStopping the operation; otherwise, t is t +1, and the procedure returns to step 3. And when the algorithm is converged, obtaining various clustering centers and the membership degree of each sample to various classes, and finishing fuzzy clustering division. Finally, defuzzification is carried out on the fuzzy clustering result, and the fuzzy clustering is converted intoAnd (4) realizing final clustering segmentation for deterministic classification.
B. Noise reduction self-encoder design
A noise-reducing self-encoder (DAE) is a dimension-reducing method that converts high-dimensional data into low-dimensional data by training a multi-layer neural network having a small center layer. The DAE is a typical three-layer neural network with an encoding process between the hidden layer and the input layer and a decoding process between the output layer and the hidden layer. The auto-encoder obtains the encoded representation (encoder) by an encoding operation on the input data and the reconstructed input data (decoder) by an output decoding operation on the hidden layer, the data of the hidden layer being the dimension-reduced data. A reconstruction error function is then defined to measure the learning effect of the auto-encoder. Based on the error function, constraints can be added to generate various types of autoencoders. The encoder and decoder and the loss function are as follows: h ═ delta (Wx + b) (16)
the training process of AE is similar to BP neural network, W and W 'are weight matrix, b and b' are offset, h is output value of hidden layer, x is input vector,

to output the vector, δ is the excitation function, typically using a Sigmoid function or a tanh function. The noise reduction self-coding network is a sparse self-coding network trained by adding noise data into input data, the data characteristics learned by the self-coding network are more robust due to the action of the noise data, the self-coding network is divided into a coding process and a decoding process, the coding process is from an input layer to a hidden layer, and the decoding process is from the hidden layer to an output layer. The goal of a self-coding network is to minimize errors by back-propagation by making the inputs and outputs as close as possible using an error functionAnd obtaining the optimal weight and bias of the self-coding network by the difference function, and preparing for establishing a deep self-coding network model. In the process of the noise reduction self-coding network, random probability is used for setting some values in original data to be 0 to obtain data containing noise, according to the self-coding network coding and decoding principle, coded data and decoded data are obtained by using the data containing noise, finally, an error function is constructed through the decoded data and the original data, and the optimal network weight and bias are obtained through back propagation minimizing the error function. The original data is corrupted by adding noise and then the corrupted data is input into the neural network as an input layer. The reconstruction result of the noise reduction self-encoder neural network is similar to the original data, and by the method, disturbance can be eliminated and a stable structure can be obtained. The original input data is input into the coder to obtain the characteristic expression, and then mapped to the output layer through the decoder.
(II) design of feed formula genetic algorithm optimization subsystem
The feed formula genetic algorithm optimization subsystem starts from an initial population and circularly executes the processes of selection, crossing and mutation operation evolution until a termination condition is met; in the evolution process of each generation, a certain number of poultry feed formula individuals are kept, the poultry feed formula individuals are evaluated through calculating the individual fitness value of each poultry feed formula, the individual fitness of each poultry feed formula is used as a condition for participating in the next generation of evolution chance, and the poultry feed formula individuals meeting the termination condition are the optimal solution of the feed formula genetic algorithm optimization subsystem. The optimization process of the feed formula genetic algorithm optimization subsystem is as follows:
1. generation of an initial population
According to the constraints of the poultry feed formulation, n real numbers representing n materials in the poultry feed formulation are randomly generated and arranged together to form a poultry feed formulation individual, and M poultry feed formulation individuals are continuously generated, wherein M is the size of the population, namely the number of poultry feed formulation individuals per generation, and the initial generation number is 0. The poultry feed formula consists of corn, bean cake, tungsten hydrogen phosphate, stone powder, salt, oil and additive. And each material content in each poultry feed formula has a certain range, as a constraint condition of the poultry feed formula, the content of each material in the range can meet the growth nutrition requirement of poultry, and the limit range of each material content (unit is kilogram) in each poultry feed formula is as follows: corn is [55,65], bean cake is [30,40], tungsten hydrogen phosphate is [1.2,2], stone powder is [1,1.5], salt is [0.2,0.5], oil is [2.5,3.5], and additive is [0.8,1.5 ]. The poultry feed formulation individuals consisted of 7 real numbers representing 7 materials, and all 7 real numbers were within the limits of 7 materials, the initial population was 60, meeting the poultry growth nutritional needs according to the poultry feed formulation constraints.
2. Determining fitness
And the fitness function is used for evaluating the quality of the individual poultry feed formula and carrying out the basis of the quality elimination in the poultry feed formula optimization process. The optimization of the poultry feed formula is to optimize and combine the material content of the poultry feed formula, and strive for the best benefit of the poultry feed formula on the premise of reaching the poultry feed nutrition standard; each poultry feed formula individual is used as the input of the poultry feed formula feed-egg ratio prediction subsystem, the output of the poultry feed formula feed-egg ratio prediction subsystem is used as the feed-egg ratio prediction value of the poultry feed formula individual, the reciprocal of the feed-egg ratio prediction value of each poultry feed formula individual is used as the fitness of the poultry feed formula individual, the larger the reciprocal of the feed-egg ratio prediction value of each poultry feed formula individual is, the higher the fitness of the poultry feed formula individual is, and the sum of the reciprocals of the feed-egg ratio prediction values of each poultry feed formula individual in the population is the total fitness of the population.
3. Determining termination condition
If the operation reaches the specified maximum algebra, stopping the operation after the operation reaches the specified maximum algebra; or when the difference value between the individual fitness of the poultry feed formula and the designated individual fitness is smaller than a set threshold value, the genetic operation can be stopped, and the poultry feed formula individual is the optimal solution.
4. Selection operation
The selection operation aims at selecting excellent poultry feed formula individuals from the current poultry feed formula population according to the evolution principle, the wheel roulette method is adopted to select the selection probability of each poultry feed formula individual according to the quotient of the individual fitness of each poultry feed formula and the total fitness of the poultry feed formula population, each selected poultry feed formula individual is added into the next generation of new poultry feed formula population, the poultry feed formula individual with high fitness has more breeding opportunities in the next generation, so that more offspring are generated, and the poultry feed formula individual with low fitness generates less offspring and is finally eliminated gradually.
5. Crossover operation
The design of the cross operation is divided into two steps, wherein the first step is to pair every two poultry feed formula individuals generated by the selection operation randomly; secondly, performing cross operation on the poultry feed formulas matched pairwise according to the cross rate Pc; the following arithmetic crossover operator is used:
the poultry feed formula 2 is that x is (x) respectively1,x2,…,xn) And y ═ y1,y2,…,yn) At a crossing rate PcSelection of a certain gene pair of x, y (x)i,yi) Performing cross operation, wherein the corresponding gene pairs of the 2 poultry feed formula individuals after the cross operation are respectively as follows:
Δ x ═ x'i-xiSequentially adding the cross pair genes in the individual x, and checking whether the corresponding new poultry feed formula individual meets each nutritional requirement (namely constraint condition) of the feed formula one by one, if so, taking the new poultry feed formula individual as a new generation member; otherwise, abandoning new poultry feed formula individuals, and modifying the principle of the same formula x of the poultry feed formula individuals.
6. Mutation operation
Mutation operation is that a certain gene of a certain poultry feed formulation individual is randomly changed by accident, and when the mutation operation is used with a restricted place and a crossover operation, the mutation operationThe operation is an insurance strategy for preventing the poultry feed formula from being mature excessively and losing important information. The mutation operation is as follows: randomly selecting an argument x of an individual xiIt is added with a perturbation xi following a normal distribution, i.e.: x'i=xi+ ξ. Production of [0,1 ] for each individual poultry feed formulation]Random decimal fraction between if the number is greater than the variation rate PmThen, the individual poultry feed formula is selected and subjected to mutation operation, and then a gene of the poultry feed formula is randomly selected as a mutation point to perform the mutation. Δ x ═ x'i-xiSequentially adding the variant genes to the individual x of the poultry feed formula, and checking whether the corresponding individual x of the new poultry feed formula meets constraint conditions one by one, wherein if the individual x of the new poultry feed formula meets the constraint conditions, the individual x of the new poultry feed formula serves as a member of a new generation; otherwise, discarding new poultry feed formulation individuals.
Design example of eight-kind poultry feed detection and formula system
According to the actual condition of the poultry breeding environment big data detection system, the system is provided with a poultry environment parameter acquisition platform and a plane arrangement installation diagram of a detection node, a control node, a gateway node and a field monitoring end, wherein sensors of the detection node are evenly arranged in all directions of a poultry breeding house according to the detection requirement, and the poultry breeding environment parameters are acquired through the system.
The technical means disclosed in the invention scheme are not limited to the technical means disclosed in the above embodiments, but also include the technical scheme formed by any combination of the above technical features. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and such improvements and modifications are also considered to be within the scope of the present invention.