# Buckwheat Disease Recognition Based on Convolution Neural Network
## 4 Buckwheat Disease Recognition Based on Convolution Neural Network  
### Detection of Disease Area  
Buckwheat pests and diseases often occur on the leaves [31]. Usually, the whole leaf is used as the input to train the recognition model of crop diseases to get the best classification structure. This method originates from the early application of deep learning in image classification. It takes advantage of the simple structure of the model constructed and the high efficiency of training and recognition. However, the whole image contains a lot of feature information, many of which are not highly relevant to the recognition task and interferes with model performance. There are many kinds of buckwheat diseases, and some diseases are similar in leaves, which is easy to produce misidentification. For example, spot blight and brown spot are easily confusing. If we can locate the disease area of buckwheat, make the recognition model only focus on the disease area, and accurately extract the most important feature of buckwheat disease, it will improve the recognition accuracy of different types of disease. Our task is to identify the categories of buckwheat diseases. It is necessary to accurately detect the buckwheat disease occurrence region from the image  
Figure 2: A sample image of each detected class. (**a**) Spot blight; (**b**) Downy mildew; (**c**) Virus disease; (**d**) Seedling blight; (**e**) Sclerotinia; (**f**) Ring spot; (**g**) Brown spot; (**h**) White mold. so as to extract the features of the disease region. Based on the regional feature extracted, different types of diseases can be effectively identified to ensure classification accuracy. The region detection for buckwheat disease is to separate the disease region and non-disease region from the images, and then send the disease region into the network to complete the training and recognition. For the detection of buckwheat disease area, this paper proposed a method combining (MSER) [32] with CNN to detect the buckwheat disease regions. The detailed steps are as follows:  
Step 1: Using MSER to detect disease areas of buckwheat, the MSER algorithm is as follows:  
1. The image of buckwheat disease was grayed, and the gray image was binarized with 256 different thresholds in the gray range (0-255); Let \(Q_{t}\) denote a connected region in the binary image corresponding to the binarization threshold \(t\). When the threshold of binarization changes from \(t\) to \(t\ +\ \Delta\) and \(t\ -\ \Delta\), \(\Delta\) is the change value, the connected region \(Q_{t}\) becomes \(Q_{t\ +\ \Delta}\) and \(Q_{t-\Delta}\) correspondingly. 2. Calculating the area ratio when the threshold is \(t\), \(q(t)\ =\ |Q_{t+\Delta}\ -\ Q_{t-\Delta}|/|Q_{t}|\). When the area of \(Q_{t}\) changes slightly with the change of the binarization threshold \(t\), namely, \(q_{t}\) is the local minimum, \(Q_{t}\) is the Stable extremum region. Where \(|Q_{t}|\) is the area about connected region \(Q_{t}\). \(|Q_{t+\Delta}\ -\ Q_{t-\Delta}|\) is the area of the remaining region after \(Q_{t+\Delta}\) subtracts \(Q_{t-\Delta}\)  
In the process of MSER detection, some large rectangular boxes could contain small ones, so these regions should be merged and the small rectangular boxes should be removed. For the merging of two regions, let the parameters of connected region 1 are \(\beta_{1},\chi_{1},\delta_{1},\varepsilon_{1}\) and the parameters of connected region 2 are \(\beta_{2},\chi_{2},\delta_{2},\varepsilon_{2}\) where \(\chi\) and \(\beta\) represent the minimum and maximum values of the minimum circumscribed rectangle in the \(y\)-axis direction of the connected region. \(\delta\) and \(\varepsilon\) represent the minimum and maximum values of the minimum circumscribed rectangle in the \(x\)-axis direction of the connected region, then the connected region 1 contains the connected region 2, which can be determined according to Equation (1):  
\[\left\{