Introduction
The source of sustenance for human existence on earth has long been thought to be agriculture. There is a demand for more agricultural output in proportion to the growth in the global population. There is an urgent need to invest more time in the agriculture industry. All forms of agriculture require scientific support and financial investment since it is necessary for human survival. The amount of accessible land, crop yield, demand trends, and macroeconomic uncertainties all have an impact on agricultural output (1). They set the prices of agricultural products in this way. Crop yield in tons per hectare is used to calculate the amount of crops produced. Rice is an example of such a crop, and it just so happens to be the one that this study is focusing on.
In recent years, rice has outperformed other grains such as millet and sorghum in terms of popularity in Nigeria. The most efficient way to meet the demands of the current rate of global population growth is to increase rice output wherever possible. However, weed has been a problem for rice producers because of its severe disadvantage in the agricultural industry. One of the plants that affects the cultivation of rice is weed, which spoils around 75% of Nigeria’s poor rice crop output (2). A weed is an undesirable or unattractive plant. There is no botanical classification for weeds. The term ‘weed’ refers to any plant that grows outside of its normal environment. The phrase is occasionally used to refer to species that are not plants but have the capacity to thrive in a range of environments. They produce seeds that persist for several years in the soil seed bank. The resources that a plant normally requires, such as soil nutrients, direct sunshine, water, and (to a lesser extent) room for growth, are fiercely contested by them and the desired plants. Weeds cause more losses in rice than pests do (3).
Classifying weeds appears to be a significant problem in agricultural research. Identification of weed species for management requires weed categorization. Weeds are divided into two categories based on how frequently they have edges: weeds with thin leaves (having a lower frequency of edge) and weeds with a lot of leaves (having a higher frequency of edge) (3). Weed management is one of the most crucial factors in agricultural yield, and for decades, specialists have struggled to identify the locations and numbers of weeds. It is now necessary to have a thorough understanding of how to control weeds in rice fields in order to reduce the amount of weed seed produced prior to planting crops on the land, which will in turn reduce weed emergence. There are several ways to control weeds, including hoeing and chemical control (3, 4), the manual method, farmer’s practices (5), and machine learning-based image processing (6, 7).
The precise and successful categorization of weed seeds demonstrated by certain cutting-edge models produced in recent years is crucial for the management and control of weeds. Weed seeds were categorized by Luo et al. (8) using visual imagery and deep learning. Performance analysis of deep-learning object detectors for cotton plant identification was done by Rahman et al. (9). A two-step machine learning technique for identifying rice diseases was developed by Pan et al. (10). A deep learning method for paddy plant disease identification and classification was developed by Haridasan et al. (11). Deep convolutional neural network models for weed identification in bell peppers grown in polyhouses were researched by Subeesh et al. (12). These experiments demonstrated the importance of automated weed detection in the development of intelligent weed management gear.
According to Aggarwal et al. (13), deep learning is a field of machine learning that makes use of neural network design. Deep learning is being employed in applications including picture and audio recognition, automatic text synthesis, and automatic machine translation. Deep learning and image processing have developed into intriguing fields of study in both academia and industry. Nowadays, because of the need for vast data acquisition, such as in the areas of geospatial data infrastructure (14) and agrico-remote sensing (15), deep learning, in particular, has emerged as a fascinating study field. Deep learning is used in manufacturing (16), transportation (17), the health (18), and agriculture (19) sectors. Before the introduction of herbicides, laborers were often involved in the laborious identification and removal of weeds. Later, a few automatic weed detection techniques were developed, but due to their poor accuracy, the farmers were unable to use them. As a result, image processing techniques were developed. Deep learning techniques have improved object recognition and categorization in images. Therefore, it is necessary to create a standardized framework to ensure the detection and management of weeds on a rice farm. Deep learning models’ usefulness for use in systems for detecting rice weed is mostly unknown as of right now. To close the gaps that exist, the present research aims to:
1. Develop a deep learning basic framework by combining a pre-trained CNN model (AlexNet) and a new model developed (RiceWeedNet).
2. Evaluate the performance of both models under standard metrics such as training time, network/training accuracy, recognition accuracy, rejection rate, precision, recall, and F1 score.
Methodology
The study aims to develop a deep learning-oriented rice weed detection system, create a local rice weed dataset for the experimental procedure, create a basic deep learning framework using a pre-trained CNN architecture (AlexNet) and a newly developed CNN (RiceWeedNet), implement the framework using MATLAB R2018a, and assess the performance of both models using common metrics like Training Time, Network/Training Accuracy, Recognition Accuracy, Rejection Rate, and Prediction Occur. This system was created in accordance with the system architecture as shown in Figure 1.
Dataset acquisition
The dataset for this study was collected using a Sony DSCWX350 digital camera at the Emmanuel Ogor Rice Farm in Oriawo Area, Oyo Town, Oyo State, Omor in Ayamelum LGA, and Ifite in Anambra State, all in Nigeria. A total of 2500 photos in total were taken, which suggests that there are 1250 photographs per class accessible. Additionally, the photos were divided into two datasets, with 30% of the images in the testing dataset and 70% of the images (1750 samples) in the training dataset (750 samples). As a result, there are 875 samples per class in the training dataset and 375 samples per class in the testing dataset. The datasets are in JPEG format and are kept in a repository with the labels “Training” and “Test,” as well as “Rice” and “Weed” folders, respectively.
Image preprocessing
Pre-processing the picture to meet network requirements is necessary to use the captured images for training and testing the models. As a result, the photos were downsized to the typical input size for the AlexNet Model of 227 × 227 × 3.
Alexnet model development
The pre-trained AlexNet model was used in this study’s transfer learning strategy. The framework was created by copying the Transfer Learning workflow with a few minor modifications, such as fine-tuning the AlexNet model to conform to the assigned classes, which in this case is three (3), and the output layer, which is the classification layer, to conform to the new number of classes, which is three (3). A mini-batch gradient descent optimization technique is the algorithm used during the training stage. The initial batch data are split up into small groups (b) for the small gradient descent procedure (n), and the network parameters are adjusted using the prediction error.
where T is the total, n indicates the amount of learning phase repetitions, and b denotes the groups. The CNN weight is greatly optimizable using the following equation’s stated error function:
where X0 is the training dataset and W represents the weight. The weights are adjusted at each iteration using the mini-batch gradient descent update rule with the learning rate given in the following equation:
Convolutional neural network development
The RiceWeedNet is a 25-layered network with an image input size of 227 × 227 × 3, which features a convolutional neural network.
Input layer
ImageInputLayer is the tag given to the input layer. A convolutional neural network’s input determines the capacity of the input pictures and stores the images’ unprocessed pixel values. The input for this study is 227 × 227 × 3 pixels in size.
Convolution layer (CL)
Convolution2dLayer is the label for this layer. The neurons in this layer connect to specific areas of the input pictures or the layer below the one that produces its outputs.
Batch normalization layer (BNL)
The batch normalization layer has the batch tag. Normalization Layer: Its function is to improve network training and reduce the degree to which networks are initially sensitive.
Rectified linear unit layer (RLUL)
The ReLuLayer tag identifies this layer. After the CL and BNL, an equation of non-linear modulation, such as a rectified linear unit (ReLU), is typically utilized at this layer. Each element is subjected to a cutoff procedure by the ReLU layer, which keeps the size of the data constant and sets any data input a little under 0 to 0. This implies
Max-pooling layer (MPL)
MaxPooling2dLayer is the name of the layer. In this down-sampling layer, the maximum and mean layers come after the fully connected layers, which minimizes the connection count for the subsequent layers. They do not even learn much explicitly, but they do cut down on the number of parameters that must be learned in succeeding layers. Furthermore, they aid in reducing the fitting problem. A layer that uses max-pooling returns the highest values from its rectangular input segments. The pool size parameter determines the size of the rectangular areas of the maxPoolingLayer.
Fully connected layer (FCL)
FullyConnectedLayer is the label for this layer. This layer is regarded as a totally coupled stratum since all of the neurons inside the layer above are connected to the neurons in this layer. To find the added incentive in the image, this layer integrates all of the characteristics (local information) that the preceding layers have collected. The final fully connected layer incorporates the properties used to classify the images in classification tasks. The number of classes in the data set is consequently equal to the output size parameters of the network’s final, completely associated layer.
Soft max-layer (SML)
The tag for this layer is softmaxLayer. Given that the goal of this study is to address a problem related to classes. The very last fully connected layer must be followed by a softmax function and a learning algorithm. The softmax function is used to activate the output vector:
w
For multi-class classification issues, the output unit operational amplifier following the final fully connected layer is known as a sigmoid function:
where 0≤P(Cr|x,θ)=1 and =1. Moreover, ar=In(P(x,θ|Cr)(P(Cr)),P(x,θ|Cr) is the conditional probability of the sample given class r, and P(Cr) is the class prior probability.
Classification layer (CsL)
This layer requires that the equivalent softmax layer must come before it. The network that has been trained uses the results from the softmax function at the classification output layer to classify each input into one of the k mutually exclusive classes using a 1-of-k coding scheme.
where tij is the indicator that the ith sample belongs to the jth class, θ gives the parameter for vector. yj(xi,θ) gives the output sample i, and here, the value from the softmax function. Which implies, the likelihood that the network associates the i th input with class j, P(tj = 1 |xi).
System evaluation
Three metrics, i.e., recognition rate, rejection rate, and average recognition time, were used to assess the created system.
Recognition rate
This is the proportion of correctly classified images. Mathematically, the recognition rate is defined as follows:
Rejection rate
This is the percentage of photos that the algorithm failed to identify. Rejected photographs can be identified by the system, making it simple to go back and manually edit them. Mathematically, the rejection rate is defined as follows:
Recognition time
This is the total time (s) taken for the trained model to recognize the input image.
Incorrectly recognition
No recognition
Results
The researcher presents and discusses the study’s findings in this part.
Model evaluation for AlexNet
With the use of a novel model called RiceWeedNet and the AlexNet pre-trained network, a transfer learning technique was applied for this study’s purposes. Using the created framework, the model was implemented in the MATLAB R2018a environment (see Figure 1). A total of 2500 training datasets were divided in half, with 70% going toward training the model and the remaining 30% going toward accuracy testing to train the created model. The created model was trained using 20 epochs at a rate of 50 iterations per epoch for a total of 460 iterations. Additionally, the tic-toc function in MATLAB was used to compute the training duration, which was expected to be 169 min and 45 s (see Table 1 and Figure 2). As a result, the model’s network accuracy in the last iteration was 90.63%, whereas the test set’s accuracy was 73.78% (see Table 1). A Confusion Matrix for AlexNet is shown in Figure 3; this particular table structure permits visualization of the output of the algorithm.
Model evaluation for RiceWeedNet
Using the created framework, the RiceWeedNet model was also implemented in the MATLAB R2018a environment (see Figure 1). A total of 2500 training datasets were divided in half, with 70% going toward training the model and the other 30% going toward accuracy testing.
The training was carried out over a period of 20 epochs at a rate of 50 iterations per epoch, for a total of 460 iterations. Additionally, the training time was predicted to last 100 min and 46 s using the MATLAB tic-toc function, as shown in Table 2 and Figure 4, respectively. As a result, the model produces a network accuracy of 100% at the last iteration (see Table 2), whereas the test set accuracy is 97.71%. Figure 5 shows the confusion matrix for RiceWeedNet and describes how well the classification system performed. The output of the classification algorithm is shown and summarized in the confusion matrix. The receiver operating characteristic (ROC) curve of Figure 6 shows how well a classification model performs across all categorization levels for (a) rice weed recognition system and (b) AlexNet transfer learning.
System design
The system was developed and is known as RiceWeedNet (the user interface of the RiceWeedNet detection system is shown in Figure 7). It is a window application program designed to find weeds in a rice field. The AlexNet Transfer Learning approach was utilized to train a pre-trained AlexNet Convolutional Neural Network for the application, which was created using MATLAB R2018a. A new CNN RiceWeedNet was also created as a foundation for comparison.
Discussion of findings
A convolutional neural network was created by this research to detect weeds on a rice farm. The dataset for this study was also gathered and utilized to assess the effectiveness of the system in comparison to a pre-trained network (AlexNet) that had been altered to fit the generated model’s 25 layers and three classes. The RiceWeedNet model was found to have 100% network accuracy in 100 min and 46 s with a test set accuracy of 97.71%, 0.9776 precision, and 0.9803 recall value. In a related study, Jiang et al. (20) used AlexNet-CNN’s deep learning network in the pesticide detection of postharvest apples. The accuracy of the proposed method for apple pesticide detection was 99.09%. AlexNet used in the present study completed the task in 1595 min and 45 s with a network accuracy of 90% and a test set accuracy of 73.78%. This result is related to the findings by McCool et al. (21), who reported similar training settings and training durations utilized for their study on carrots. (22) system from also made it possible to identify green plants and diagnose nine different forms of plant illnesses automatically with a total detection accuracy of 92.5%, 87.4%, 85.0%, and 85.1% when AlexNet+TL, ResNet-18+TL, GoogleNet+TL, and AlexNet+SVM are used, respectively.
The research team essentially established a comparison system to examine the effectiveness of two distinct CNN models used in this study, RiceWeedNet and AlexNet, for the identification of weeds in a rice field. The system created a dataset of rice and weed that will be made available to researchers and the general public. It also created a framework to classify the datasets into groups that include rice and weed using both the new RiceWeedNet and the AlexNet Pre-trained Network on the MATLAB R2018a platform. Standard metrics, including training time, network accuracy, number of epoch, number of iterations, recognition accuracy, precision, and recall, were used to evaluate the produced system. The aim of this study was to apply image recognition techniques used by many researchers on various crops to the identification of weeds in rice.
Conclusion
This type of experimental study is crucial because it will increase rice farmers’ productivity and let them use fewer herbicides, which is better for the environment and human health. As a result, this study provides a deep learning-oriented rice-weed detection system that achieved 100% network accuracy in 100 min and 46 s while maintaining 97.71% accuracy for the test set, 0.9776 precision, and 0.9803 recall. The system is viewed as a replacement for conventional weed detectors in agriculture and opens up possibilities for the creation of more sophisticated and intelligent systems. The capacity of the researcher to create a convolutional neural network model that can recognize and categorize photos in the least amount of time with 100% accuracy is the study’s contribution to knowledge. Additionally, the work has contributed to the development of a dataset of rice and weeds that may be utilized by other researchers for further improvement. The integration of geographic information systems with this model for other analyses needs to be the subject of further study.
The use of contemporary technology in agriculture to optimize production with little human energy or labor required is a sector that is significantly trailing behind in Nigeria. ICT is the most important factor in our society today, so all stakeholders in Nigeria should start thinking about how to become completely engaged. It is a good idea to investigate and apply the applications of image processing and deep learning to object recognition. Farmers are urged to employ the technique described in this study to simplify the manual process now used to find weeds on their farmlands.
References
1. Rehman A, Alam MM, Alvarado R, Işık C, Ahmad F, Cismas LM, et al. Carbonization and agricultural productivity in bhutan: investigating the impact of crops production, fertilizer usage, and employment on CO2 emissions. J Cleaner Produ. (2022) 375:134178.
2. Akobundu IO. Weed control in direct-seeded lowland rice under poor water control conditions. Weed Res. (2011) 21:273–8.
3. Saleh MK, Oyinbo O. Rice production under different weed management technologies adopted by rice farmers in katsina state, nigeria. J Agric Extens. (2017) 21:12.
4. Moody K. Weed management in wet-seeded rice in tropical Asia. Paper presented at an agricultura tropica et subtropica. (2012).
5. Moody K. Weed management in rice handbook of pest management in agriculture. Boca Raton, FL: CRC Press (2011).
6. Wang A, Zhang W, Wei X. A review on weed detection using ground-based machine vision and image processing techniques. Comput Electr Agric. (2019) 158:226–40.
7. Jin X, Che J, Chen Y. Weed identification using deep learning and image processing in vegetable plantation. IEEE Access. (2021) 9:10940–50.
8. Luo T, Zhao J, Gu Y, Zhang S, Qiao X, Tian W, et al. Classification of weed seeds based on visual images and deep learning. Inform Proc Agric. (2023) 10:40–51.
9. Rahman A, Lu Y, Wang H. Performance evaluation of deep learning object detectors for weed detection for cotton. Smart Agric Technol. (2023) 3:100126.
10. Pan J, Wang T, Wu Q. RiceNet: a two stage machine learning method for rice disease identification. Biosyst Eng. (2023) 225:25–40.
11. Haridasan A, Thomas J, Raj ED. Deep learning system for paddy plant disease detection and classification. Environ Monit Assess. (2023) 195:120.
12. Subeesh A, Bhole S, Singh K, Chandel NS, Rajwade YA, Rao KVR, et al. Deep convolutional neural network models for weed detection in polyhouse grown bell peppers. Artif Int Agric. (2022) 6:47–54.
13. Aggarwal K, Mijwil MM, Al-Mistarehi AH, Alomari S, Gök M, Alaabdin AMZ, et al. Has the future started? The current growth of artificial intelligence, machine learning, and deep learning. Iraqi J Comput Sci Mathe. (2022) 3:115–23.
14. Okeke AC, Okoli FU, Ofoegbunam EI, Oludiji SM. A web platform approach forthe implementation of geospatial data infrastructure clearing house for nigeria. Int J Adv Eng Manage (2020) 2:611–9.
15. Huang Y, Chen ZX, Tao YU, Huang XZ, Gu XF. Agricultural remote sensing big data: management and applications. J Int Agric. (2018) 17:1915–31.
16. Kotsiopoulos T, Sarigiannidis P, Ioannidis D, Tzovaras D. Machine learning and deep learning in smart manufacturing: the smart grid paradigm. Comput Sci Rev. (2021) 40:100341.
17. Guerrero-Ibañez J, Contreras-Castillo J, Zeadally S. Deep learning support for intelligent transportation systems. Trans Emerg Telecommun Technol. (2021) 32:e4169.
18. Khan S, Yairi T. A review on the application of deep learning in system health management. Mechan Syst Signal Proc. (2018) 107:241–65.
19. Saleem MH, Potgieter J, Arif KM. Automation in agriculture by machine and deep learning techniques: a review of recent developments. Prec Agric. (2021) 22:2053–91.
20. Jiang B, He J, Yang S, Fu H, Li T, Song H, et al. Fusion of machine vision technology and AlexNet-CNNs deep learning network for the detection of postharvest apple pesticide residues. Artif Int Agric. (2019) 1:1–8.
21. McCool C, Perez T, Upcroft B. Mixtures of lightweight deep convolutional neural networks: applied to agricultural robotics. IEEE Robotics Autom Lett. (2017) 1:18.