# A Total Crop-Diagnosis Platform Based on Deep Learning Models in a Natural Nutrient Environment
## 2 Related Works
### A Design of a Crop Self-Diagnosis Module (CSM) Based on Deep Learning
#### 3.4.2 A Design of the TEDS
In the 2 nd phase, the TEDS computes \(\left\langle x_{n}h_{k}^{1}\right\rangle_{0}\) by using the \(\mathrm{P}\big{(}h_{k}^{1}|x\big{)}\) value and the input value. The \(\left\langle x_{n}h_{k}^{1}\right\rangle_{0}\) is computed by using Formula (19). \[\left\langle x_{n}h_{k}^{1}\right\rangle_{0}=\frac{\partial\log\left(\rho\big{(} h_{k}^{1}|x\big{)}\right)}{\partial\omega_{kk}^{1}} \tag{19}\]

In the 3 rd phase, the TEDS computes the input layer value, \(\mathrm{P}\big{(}x_{n}|h^{1}\big{)}\) and the \(\mathrm{P}\big{(}h_{k}^{1}|\mathrm{P}\big{(}x_{n}|h^{1}\big{)}\big{)}\) based on the \(\mathrm{P}\big{(}x_{n}|h^{1}\big{)}\). In the 4 th phase, the TEDS compares the input value with the \(\mathrm{P}\big{(}h^{1_{x}}|x\big{)}\) and the \(\mathrm{P}\big{(}x_{n}|h^{1}\big{)}\) with the \(\mathrm{P}\big{(}h_{k}^{1}|\mathrm{P}\big{(}x_{n}|h^{1}\big{)}\big{)}\). The \(\left\langle x_{n}h_{k}^{1}\right\rangle\) is computed in the same method as Formula (19). In the 5 th phase, the difference amount of the weight between the input layer and the first hidden layer is computed in Formula (20) about the complete pair \(<\)\(n\), \(k\)\(>\). \[\Delta w_{nk}^{1}=\alpha\Big{(}\left\langle x_{n}h_{k}^{1}\right\rangle_{0}- \left\langle x_{n}h_{k}^{1}\right\rangle_{1}\Big{)} \tag{20}\]

where \(\alpha\) is a learning rate determined by a developer in advance and the weight is modified by using Formula (21). \[new\_w_{nk}^{1}=old\_w_{nk}^{1}+\Delta w_{nk}^{1} \tag{21}\]

Figure 11: The structure of a neural network model in the TEDS. The learning from the first hidden layer to the last hidden layer is repeated by the first phase to about the 5 th phase. The TEDS continues learning between the last hidden layer and the output layer in the following phases. In the 1 st phase, it computes the output layer result \(\mathrm{P}(y|h_{4})\). Here, the \(\mathrm{P}(y|h_{4})\) is assumed as \(y\). In the 2 nd phase, it computes error \(\mathrm{E}\) by using the difference between \(\hat{y}\) and the target value \(d\). The \(\mathrm{E}\) is computed by using Formula (22). Figure 10:0

In the 3 rd phase, the error signal is computed by using Formula (23). Figure 10:1

In the 4 th phase, the weight between the last hidden layer and the output layer is modified by using the error signal \(\delta_{y}\). Figure 10:2

In the 5 th phase, the 2 nd-4 th phases are repeated if the error \(\mathrm{E}\) is equal to and greater than the \(\mathrm{E}_{\mathrm{max}}\). If the \(\mathrm{E}\) is less than the \(\mathrm{E}_{\mathrm{max}}\), the learning is closed. ## 4 The Performance Analysis

### An Analysis of the OFSG Performance

The OFSG extracts the payload from the sensor data and stores the extracted payload in a cache and transfers the stored payload cache to a farm central server after compression and fragmentation. The simulation environment of the OFSG is as follows. First, the number of wireless sensor nodes is 20, the data size is 800 bytes, and the data generation cycle is 0.1 s.

Second, the experiment time is 1500 s, and data fragmentation and data transmission quantity are measured by the 5 s.

Third, the existing wireless sensor gateway not using fragmentation and compression and the OFSG using them are compared in terms of their data fragmentation and transmission quantity. Fourth, when one message is fragmented into all fragments, it is called one data fragmentation. The number of data fragmentation times is the same as that of messages. Figures 12 and 13 show the number of data fragmentation times and data transmission quantity in the existing gateway. Figures 14 and 15 show the number of data fragmentation times and data transmission quantity in the OFSG. Figure 10:3 The number of data fragmentation times in the existing gateway. The experiment shows that in Figure 12 an existing gateway fragmented 189,325-371,283 messages and in Figure 13 transferred 153,398-247,036 messages of them. Therefore, the message transmission rate of the existing gateway was 66.53%.