# Adaptive Thresholding of CNN Features for Maize Leaf Disease Classification and Severity Estimation
## 4 Results
### Leaf Disease Quantification  
Once the ROI is successfully extracted, the final step is to determine the area of the ROI and express it as a percentage of the total leaf area. A simple workaround to this problem is to count the non-zero (ROI) and the zero (background) pixels from the heatmap. It then follows that:  
\[\text{Diseased area}=\frac{\text{Area of ROI}}{\text{Total Leaf area}}\times 100\% \tag{14}\]  
To assess the performance of leaf disease quantification, we use ImageJ software, a Java-based image processing tool to analyze image dataset [56]. We manually segment the diseased area in ImageJ, as shown in Figure 11, and calculate its area. We then compare the area obtained by manual ROI extraction from the heatmap to that obtained by automatic ROI extraction (using the best-performing adaptive thresholding technique). The results are shown in Table 2.  
The results in Table 2 show a slight decrease in the area calculated from the heatmap as compared with the area of the original RGB leaf image. This happens because Gradcam does not highlight the entire area covered by the leaf Blight disease. Further, our adaptive thresholding technique estimates a lower area of the ROI because it does not completely remove the background noise from the heatmap. Nonetheless, this presents an important step toward leaf disease quantification. We believe we can improve performance by varying the value of the constant \(k\) in our algorithm. Figure 9: Examples of maize leaf images from the PlantVillage dataset. The dataset contains the following classes: (**a**) Raw RGB color images—Top: Blight; Middle: Common Rust; and Bottom: Gray spot. (**b**) Covnet image, deep feature visualization. The heatmap output of Covnet contains the ROI as well as the background. (**c**) Adaptive threshold performance. Result of adaptive thresholding. Here, adaptive thresholding successfully removes the background from the heatmap, and the result is a clear ROI from which we can calculate its area to determine the overall disease severity. The results also confirm the influence of batch normalization in deep learning. In essence, batch normalization can improve the accuracy and convergence rates by good margins, as shown in Table 3 and Figure 12. In Table 3, batch normalization increased the accuracy of the shallow CNN by 1%, while Figure 13 shows a steeper learning curve, and the corresponding confusion matrices are shown in Figure 14. \begin{table}
\begin{tabular}{l c} \hline \hline
**Sample Image** & **\% Area of the Diseased Region** \\ \hline ROI from the raw RGB leaf image & 4.87\% \\ ROI extracted manually from the heatmap & 4.32\% \\ ROI extracted from the heatmap using & 3.09\% \\ our adaptive thresholding technique & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Leaf disease quantification. Figure 11: ROI extraction with ImageJ software. Figure 10: Results of various thresholding techniques on the CAM heatmap of an image of a Blight-infected leaf: (**a**) raw RGB color image of a leaf with Common Blight disease; (**b**) conv2D CAM heatmap visualization; (**c–f**) Custom, Bernsern’s, Niblack’s and Sauvola’s thresholding, respectively, to extract the ROI from the heatmap of (**b**). The main idea behind the algorithms is that the area of the extracted ROI correlates to the area of the disease in the original RGB image. Therefore, the area of the ROI as a percentage gives us an estimate of disease severity. Here, it is clear that our adaptive thresholding technique successfully removes the background from the heatmap, and the result is a clear ROI that can then be used for disease quantification. Figure 12: Training and validation learning curves for the custom CNN with various parameters: (i) one dropout layer, (ii) batch normalization + one dropout layer, and (iii) no regularization. All the training and validation loss curves decrease to a point of stability—representing a good fit. The plots show the expected behaviour.