Rice Plant Disease Detection and Diagnosis using Deep Convolutional
  Neural Networks and Multispectral Imaging
Rice is considered a strategic crop in Egypt as it is regularly consumed in
the Egyptian people's diet. Even though Egypt is the highest rice producer in
Africa with a share of 6 million tons per year, it still imports rice to
satisfy its local needs due to production loss, especially due to rice disease.
Rice blast disease is responsible for 30% loss in rice production worldwide.
Therefore, it is crucial to target limiting yield damage by detecting rice
crops diseases in its early stages. This paper introduces a public
multispectral and RGB images dataset and a deep learning pipeline for rice
plant disease detection using multi-modal data. The collected multispectral
images consist of Red, Green and Near-Infrared channels and we show that using
multispectral along with RGB channels as input archives a higher F1 accuracy
compared to using RGB input only.
Yara Ali Alnaggar, Ahmad Sebaq, Karim Amer, ElSayed Naeem, Mohamed Elhelw
Rice Plant Disease Detection and Diagnosis using Deep Convolutional Neural Networks and Multispectral Imaging

###### Abstract

Rice is considered a strategic crop in Egypt as it is regularly consumed in the Egyptian people's diet. Even though Egypt is the highest rice producer in Africa with a share of 6 million tons per year [5], it still imports rice to satisfy its local needs due to production loss, especially due to rice disease. Rice blast disease is responsible for 30% loss in rice production worldwide [9]. Therefore, it is crucial to target limiting yield damage by detecting rice crops diseases in its early stages. This paper introduces a public multispectral and RGB images dataset and a deep learning pipeline for rice plant disease detection using multimodal data. The collected multispectral images consist of Red, Green and Near-Infrared channels and we show that using multispectral along with RGB channels as input archives a higher F1 accuracy compared to using RGB input only.

Keywords:Deep learning Computer vision Multispectral Imagery.

## 1 Introduction

In Egypt, rice is important in Egyptian agriculture sector, as Egypt is the largest rice producer in Africa. The total area used for rice cultivation in Egypt is about 600 thousand ha or approximately 22% of all cultivated area in Egypt during the summer. As a result, it is critical to address the causes of rice production loss to minimize the gap between supply and consumption. Rice plant diseases contribute mostly to this loss, especially rice blast disease. According to [9], rice blast disease causes 30% worldwide of the total loss of rice production. Thus, rice crops diseases detection, mainly rice blast disease, in the early stages can play a great role in restraining rice production loss.

Early detection of rice crops diseases is a challenging task. One of the main challenges of early detection of such disease is that it can be misclassified as the brown spot disease by less experienced agriculture extension officers (as both are fungal diseases and have similar appearances in their early stage) which can
lead to wrong treatment. Given the current scarcity of experienced extension officers in the country, there is a pressing need and opportunity for utilising recent technological advances in imaging modalities and computer vision/artificial intelligence to help in early diagnosis of the rice blast disease. Recently, multispectral photography has been deployed in agricultural tasks such as precision agriculture [3], food safety evaluation [11]. Multispectral cameras could capture images in Red, Red-Edge, Green and Near-Infrared bands wavebands, which captures what the naked eye can't see. Integrating the multispectral technology with deep learning approaches would improve crops diseases identification capability. However, it would be required to collect multispectral images in large numbers.

In this paper, we propose a public multispectral and RGB images dataset and a deep learning pipeline for rice plant disease detection. First, the dataset we present contains 3815 pairs of multispectral and RGB images for rice crop blast, brown spot and healthy leaves. Second, we developed a deep learning pipeline trained on our dataset which calculates the Normalised Difference Vegetation Index (NDVI) channel from the multispectral image channels and concatenates it along its RGB image channels. We show that using NDVI+RGB as input archives a higher F1 score by 1% compared to using RGB input only.

## 2 Literature Review

Deep learning has emerged to tackle problems in different tasks and fields. Nowadays, it is being adopted to solve the challenge of crop disease identification. For example, Mohanty et al. [8] trained a deep learning model to classify plant crop type and its disease based on images. Furthermore, [1] proposed a deep learning-based approach for banana leaf diseases classification.

Furthermore, multispectral sensors have proven its capability as a new modality to detect crop fields issues and diseases. Some approaches use multispectral images for disease detection and quantification. Cui et al. [4] developed an image processing-based method for quantitatively detecting soybean rust severity using multi-spectral images. Also, [12] utilize digital and multispectral images captured using quadrotor unmanned aerial vehicles (UAV) to collect high-spatial resolution imagery data to detect the ShB disease in rice.

After the reliable and outstanding results deep learning models could achieve on rgb images, some approaches were developed to use deep learning on multispectral images, especially of crops and plants. [10] proposed a deep learning-based approach for weed detection in lettuce crops trained on multispectral images. In addition, Ampatzidis et al. [2] collects multispectral images of citrus fields using UVA for crop phenotyping and deploys a deep learning detection model to identify trees.
## 3 Methodology

### Hardware Components

We used a MAPIR Survey3N camera, shown in Figure 1 to collect our dataset. This camera model captures ground-level multispectral images of red, green and NIR channels. It was chosen in favour of its convenient cost and easy integration with smartphones.. In addition, we used the Samsung Galaxy M51 mobile phone camera to capture RGB images, paired with the MAPIR camera.

We Designed a holder gadget to combine the mobile phone, MAPIR camera and a power bank in a single tool, as seen in Figure 2, to facilitate the data acquisition operation for the officers. It was designed using SolidWorks software and manufactured by a 3D printer.

### Data Collection Mobile Application

An android frontend application was also developed to enable the officers who collect the dataset to control the multispectral and the smartphone cameras for capturing dual RGBIR/RGB images simultaneously while providing features such as image labelling, imaging session management, and Geo-tagging. The mobile application is developed with Flutter and uses Firebase real-time database to store and synchronise the captured data including photos and metadata. Furthermore, Hive local storage database is used within the application to maintain a local backup of the data.

Figure 1: MAPIR Survey3N Camera.
### Analytics Engine Module

Our engine is based on ResNet18 [6] architecture which consists of 18 layers and it utilize the power of residual network, see Figure 3, residual network help us avoid the vanishing gradient problem.

We can see how layers are configured in the ResNet-18 architecture. The architecture starts with a convolution layer with 7x7 kernel size and stride of 2. Next we begin with the skip connection. The input from here is added to the output that is achieved by 3x3 max pool layer and two convolution layers with kernel size 3x3, 64 kernels each. This is the first residual block.

The output of this residual block is added to the output of two convolution layers with kernel size 3x3 and 128 such filters. This constituted the second residual block. Then the third residual block involves the output of the second block through skip connection and the output of two convolution layers with filter size 3x3 and 256 such filters. The fourth and final residual block involves output of third block through skip connections and output of two convolution layers with same filter size of 3x3 and 512 such filters.

Finally, average pooling is applied on the output of the final residual block and received feature map is given to the fully connected layers followed by softmax function to receive the final output.

The vanishing gradient is a problem which happens when training artificial neural networks that involved gradient based learning and backpropagation. We use gradients to update the weights in a network. But sometimes what happens is that the gradient becomes very small, effectively preventing the weights to be updated. This leads to network to stop training. To solve such problem, residual neural networks are used.

Figure 2: Holder gadget.
Residual neural networks are the type of neural network that applies identity mapping. What this means is that the input to some layer is passed directly or as a shortcut to some other layer. If \(x\) is the input, in our case its an image or a feature map, and \(F(x)\) is the output from the layer, then the output of the residual block can be given as \(F(x)+x\) as shown in Figure 4.

We changed the input shape to be 256x256 instead of 224x244, also we replaced the last layer in the original architecture with a fully connected layer where the output size was modified to three to accommodate our task labels.

Figure 4: Residual block

Figure 3: ResNet18 original architecture
## 4 Experimental Evaluation

### Dataset

We have collected 3815 samples of rice crops of three labels: blast disease, brown spot disease and healthy leaves distributed, shown in Figure 5, as the following: 2135, 1095 and 585, respectively. Each sample is composed of a pair of (RGB) and (R-G-NIR) images as seen in Figure 6, which were captured simultaneously. Figure 7 shows samples of the three classes in our dataset.
### Training Configuration

In this section, we explain our pipeline for training data preparation and preprocessing. Also, we mention our deep learning models training configuration for loss functions and hyperparameters.

#### Data Preparation

Figure 7: (a) Blast class sample. (b) Brown spot class sample. (c) Healthy class sample.
RGB images registrationSince the image sample of our collected dataset consists of a pair of RGB and R-G-NIR images, the two images are expected to have a similar field of view. However, the phone and MAPIR camera have different field of view parameters that the mapir camera has a 41\({}^{\text{\tiny{e}}}\) FOV compared to the phone camera with 123\({}^{\text{\tiny{e}}}\) FOV. As a result, we register the rgb image to the r-g-mir image using the OpenCV library. The registration task starts by applying an ORB detector over the two images to extract 10K features. Next, we use a brute force with Hamming distance matcher between the two images extracted features. Based on the calculated distances for the matches, we sort them descendingly and drop the last 10%. Finally, the homography matrix is calculated using the matched points in the two images to be applied over the RGB images. Figure 8 shows an RGB image before and after registration.

MAPIR camera calibrationThe MAPIR camera sensor captures the reflected light which lies in the Wavelengths in the Visible and Near Infrared spectrum from about 400-1100n and saves the percentage of reflectance. After this step, calibration of each pixel is applied to ensure that it is correct. This calibration is performed before every round of images captured using the MAPIR Camera Reflectance Calibration Ground Target board, which consists of 4 targets with known reflectance values, as shown in Figure 9.

Models training configurationWe trained our models for 50 epochs with a batch size of 16 using Adam optimizer and Cosine Annealing with restart scheduler [7] with cycle length 10 epochs and learning rate of 0.05. For the loss function, we used a weighted cross entropy to mitigate the imbalance of the training dataset. Images were resized to dimension 256 x 256.

Figure 8: On the left is an RGB image before calibration and on the right is after registration.
#### 4.2.2 Results

For training the deep learning model using RGB and R-G-NIR pairs, we generate a NDVI channel, using Equation 1, and concatenate it to the RGB image. Our study shows that incorporating the NDVI channel improves the model capability to classify the rice crops diseases. Our model could achieve a F1 score with 5-kFold of 84.9% when using RGB+NDVI as input compared to using only RGB image which could obtain a F1 score of 83.9%. Detailed results are presented in Table 1.

\[NDVI=\frac{NIR-Red}{NIR+Red} \tag{1}\]

## 5 Conclusion

We presented our public dataset and deep learning pipeline for rice plant disease detection. We showed that employing multispectral imagery with RGB improves the model capability of disease identification by 1% compared to using solely RGB imagery. We believe using a larger number of images for training would

\begin{table}
\begin{tabular}{|l|l|l|} \hline Class & RGB & RGB+NDVI \\ \hline Blast & 89.64\% & 90.02\% \\ Spot & 82.64\% & 83.26\% \\ Healthy & 79.08\% & 81.54\% \\ \hline \end{tabular}
\end{table}
Table 1: F1 score over our collected dataset achieved by using RGB as input versus RGB+NDVI.

Figure 9: MAPIR Camera Reflectance Calibration Ground Target board.
enhance current results also considering a larger number of images when using a deeper model this will result in better results. In addition, more investigation on how to fuse multispectral imagery with RGB for training could be applied, for example we can calculate NDVI from the blue channel instead of the red this may also boost the model performance.

Acknowledgements.The authors would like to acknowledge the support received from Data Science Africa (DSA) which made this work possible.
