Predicting fertilizer treating of maize using digital image processing and deep learning approaches

Machine Learning


Experimental setup

The experiments for this research were primarily conducted using Python, leveraging several libraries to facilitate various tasks. OpenCV and NumPy were the most frequently used libraries for image processing and numerical computations, respectively. For data visualization and exploration, we utilized additional libraries alongside Keras, which employed a TensorFlow backend for data modeling. The research was conducted using Google Colaboratory (Google Colab), a free cloud-based Jupyter notebook environment that enabled model training on GPUs, independent of local hardware capabilities. The data was partitioned into training and testing datasets, with 80% allocated for training and 20% for testing. We also experimented with other splits: 70% training and 30% testing, 60% training and 40% testing, and 90% training and 10% testing.

Deep learning models

We chose VGG16 and VGG19 because they are well-established and widely used CNN architectures known for their strong performance in image classification tasks. Their relatively simple architecture makes them suitable for transfer learning, and we aimed to investigate the performance of these classic models in classifying maize leaf diseases as a baseline before attempting more complex models. We selected these architectures due to their popularity and the availability of pre-trained weights, which simplify implementation. After feature extraction, classification is performed based on the information learned during training, specifically after the distinctive features are identified. Convolutional Neural Networks (CNNs) are commonly utilized for image classification tasks33. The VGG-16 model, which consists of 16 layers, is capable of performing typical image classification tasks effectively34.The model was trained multiple times using the CNN architecture with datasets of varying image sizes, including 224 × 224 and 127 × 127, while adjusting the training, validation, and testing ratios. Additionally, different hyperparameter values, such as the learning rate and batch size, were tested. The researcher also compared the results of the model with other CNN architectures, including VGG19.

In this study, the focus was on fine-tuning various hyperparameters to enhance classification performance. The values for several hyperparameters were determined experimentally, emphasizing the importance of careful selection in achieving an effective model design. Each hyperparameter was meticulously tested to minimize loss and improve evaluation metrics35. The model optimization employed a gradient descent algorithm combined with the Adaptive Moment Estimation (Adam) optimizer, which adjusts the learning rates for each parameter and incorporates moving averages of the gradients. The learning rate, crucial for weight updates, was assessed at values of 0.001, 0.01, and 0.1, with 0.001 identified as optimal. The Categorical Cross-Entropy (CCE) loss function was selected, paired with the SoftMax activation function in the output layer to address the multiclass classification problem. Moreover, the model training explored various epochs and batch sizes, determining that 60 epochs and a batch size of 32 yielded the best results. Dropout was also implemented as a regularization technique to mitigate overfitting during training.

Experiment results

Experiment by changing image size

When the size of an image changes, the researcher observed varying performance results. There is no clear generalization regarding the effects of image size on model performance. Generally, upscaling from a lower resolution led to a greater performance loss than downscaling from a higher resolution. However, when the image size is close to the standard size of the model, performance outcomes may differ.

For the VGG16 model, performance was evaluated using a dataset with an image size of 224 × 224. In this experiment, the dataset was partitioned into training (80%), validation (10%), and testing (10%). The researcher achieved 99% training accuracy and 95% validation accuracy. Training and validation phases were conducted to illustrate performance differences, with accuracy and loss graphs from the training phase presented in Figs. 4 and 5, respectively.

Fig. 4
figure 4

: VGG16 training and validation accuracy 224 × 224 image size.

Fig. 5
figure 5

VGG16 training and validation loss 244 × 224 image.

VGG16 with 127 × 127 image size: In this experiment, the researcher conducted trials using the same dataset, hyperparameter values, and training, validation, and testing ratios, with the only difference being the image size. The researcher achieved 95% training accuracy and 90% validation accuracy. The results are presented in the form of accuracy and loss curve graphs, shown in Figs. 6 and 7, respectively.

Fig. 6
figure 6

VGG16 training and validation accuracy 127 × 127image size.

Fig. 7
figure 7

VGG16 training and validation loss 127 × 127 image size.

The researcher trained the models using the training and validation phases to demonstrate the performance differences in the Convolutional Neural Network (CNN) algorithms. The results from the previous experiment indicate that an image size of 224 × 224 yields the best performance for this model, as shown in Table 3.

Table 3 Experiment result by changing image size.

Experiment by changing train and test datasets ratio

The results obtained from the experiment using different training and testing split ratios are presented in Table 4, which shows the classification accuracy metrics in percentage for the training, validation, and test datasets separately.

The model demonstrates promising results with various training and testing dataset ratios, as shown in Table 4. Among the tested ratios, the 80%/20% split exhibits better performance than the others.

Experiments by changing batch size

Batch size is one of the most important hyperparameters to tune in modern deep learning systems. The effects of hyperparameters can be difficult to generalize, as results often vary from dataset to dataset and model to model. Therefore, the conclusions drawn by the researcher apply specifically to this dataset and classification task, rather than serving as broad statements about batch size. In practice, using a larger batch size to train a model increases the computational speed of the system. However, it is well known that excessively large batch sizes can lead to poor generalization and suboptimal results. To determine the optimal batch size for this model, the researcher conducted two experiments with batch sizes of 16 and 32. The results indicate that batch size 32 performs better than batch size 16. The detailed results, including training, validation, and testing accuracy in percentage, are shown in Table 5.

Table 4 Experiment result by changing training and testing dataset ratio.
Table 5 Experiment result by changing batch size value.

Experiment by changing learning rate

In this research, the investigator conducted various experiments by adjusting the learning rate values, as indicated in Table 6. The results obtained from these experiments are presented in Tables 6 and 7, focusing on accuracy metrics for the training, validation, and testing data. The findings suggest that a smaller learning rate yields higher accuracy than a larger one. Therefore, a learning rate of 0.001 is considered the optimal value for this model.

The results from the experiment indicate that an image size of 224 × 224, a training/testing ratio of 80/20, a batch size of 32, and a learning rate of 0.001 are the optimal hyperparameter values for this model. With these hyperparameter settings, the researcher achieved a training accuracy of 99% and a testing accuracy of 95%, as shown in Table 7.

Table 6 Experiment result by changing learning rate.
Table 7 Hyper parameter values with their accuracy and loss result.

Results comparison with VGG19

In the results section, one task involved a comparison with the VGG19 model. The researcher conducted an experiment using the VGG19 model with the same dataset and parameter values as those used for the VGG16 model. After completing the experiment, the researcher achieved a training accuracy of 97% and a testing accuracy of 92%. The overall results are illustrated in the accuracy and loss graphs presented in Figs. 8 and 9, respectively.

Fig. 8
figure 8

VGG19 model training and validation accuracy curve.

Fig. 9
figure 9

VGG19 model training and validation loss curve.

The training and loss results for VGG19 are shown in Table 8. When the researcher compared the two models, VGG16 and VGG19, it was found that VGG16 demonstrated better performance. In summary, Table 9 highlights the performance differences between the two models.

Table 8 VGG19 accuracy and loss in percent.
Table 9 Model result summary.

Results discussion

In the results section, the model was trained multiple times by adjusting hyperparameter values to improve performance. The first experimental scenario involved changing the image size. In this experiment, the model was trained using image sizes of 224 × 224 and 127 × 127 pixels. The researcher achieved 99% training accuracy and 95% testing accuracy with the 224 × 224 image size, while the 127 × 127 image size resulted in 95% training accuracy and 85% testing accuracy.

The second experimental scenario focused on changing the training and testing dataset split ratio. The ratios applied were 60/40, 70/30, 80/20, and 90/10. The results showed 95% training accuracy and 93% testing accuracy at the 60/40 ratio, 98% training accuracy and 93% testing accuracy at the 70/30 ratio, 99% training accuracy and 95% testing accuracy at the 80/20 ratio, and 95% training accuracy and 92% testing accuracy at the 90/10 ratio.

The third experimental scenario examined the effects of batch size. It is challenging to generalize the impact of batch size; however, when a larger batch size is used, computational speed improves. Two batch sizes were tested: 32 and 16. The results yielded 99% training accuracy and 95% testing accuracy with a batch size of 32, while a batch size of 16 resulted in 97% training accuracy and 93% testing accuracy.

The fourth experimental scenario involved varying learning rate values. The model was trained using learning rates of 0.1, 0.01, and 0.001. The researcher achieved 91% training accuracy and 85% testing accuracy with a learning rate of 0.1, 94% training accuracy and 93% testing accuracy with a learning rate of 0.01, and 99% training accuracy and 95% testing accuracy with a learning rate of 0.001. From these experiments, the optimal hyperparameter values identified were a batch size of 32, an image size of 224 × 224, and a learning rate of 0.001.

When comparing the VGG16 model with the VGG19 model, the results indicated that the VGG19 model achieved 97% training accuracy and 92% testing accuracy, while the VGG16 model achieved 99% training accuracy and 95% testing accuracy. Consequently, the VGG16 model outperformed VGG19 due to its lower training parameters. Thus, VGG16 can accurately identify maize leaf fertility deficiencies 95% of the time. The proposed deep learning model for detecting and classifying maize leaf fertility deficiencies achieved an impressive accuracy of 95% using the VGG16 architecture, outperforming comparable models such as VGG19. The experimental analysis involved adjusting various hyperparameters, including image size, dataset split ratio, batch size, and learning rate, significantly enhancing the model’s performance. The results demonstrate the effectiveness of the proposed approach in addressing the structural challenges of traditional maize production in Ethiopia.

In comparison to existing works, such as the decision tree algorithm10 and Random Forest Classifier12, which achieved lower accuracy rates of 93% and 72.74% respectively, the proposed model demonstrates superior performance. Additionally, this work contributes to the existing literature by addressing the specific challenge of maize leaf fertility deficiencies and providing a viable solution for improved maize production in Ethiopia. VGG16 outperformed VGG19 in predicting fertilizer treatment for maize due to its simpler architecture, which reduces the risk of overfitting and enhances generalization, particularly when working with smaller datasets that may lack sufficient diversity for a more complex model. The fewer layers in VGG16 can effectively capture pertinent features in the images, making it well-suited for this specific task. In contrast, the additional layers of VGG19 may complicate the learning process without delivering proportional benefits in feature extraction. Furthermore, if hyperparameter tuning and training resources are limited, the advantages of VGG19’s complexity may not be fully realized, favoring the more efficient VGG16 in this context.

To effectively extend the VGG16 and VGG19 models for analyzing different crops and other fertilizer treatments, it is essential to leverage transfer learning by fine-tuning pretrained models on new datasets specific to the crops in question, implementing data augmentation to account for variability in growth conditions, and customizing the architecture by adding specific layers or adjusting the output layer for multi-class classification. Incorporating regularization techniques and conducting comprehensive hyperparameter tuning will enhance model generalization, while ensemble methods may further improve prediction accuracy across varied agricultural contexts.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *