1. Introduction
Maize is one of the important food crops and is a major contributor to the global food supply [
1]. The leaf is an important organ for photosynthesis and nutrient production in maize. Therefore, the number of leaves is one of the key indicators for describing canopy development and growth. The irregular shape and distribution of leaves, as well as the influence of natural light, make the process of leaf segmentation and detection difficult. Inaccurate acquisition of plant phenotypic parameters may affect subsequent judgements of crop growth status and crop yield. This shows that maize leaves have a very important role in maize growth and development [
2]. However, traditional maize leaf counting is mainly observed manually, which is inefficient and difficult, and is easily influenced by subjective judgement. Therefore, obtaining the number of maize leaves efficiently and accurately is important for analyzing maize growth. Plant phenotyping has become a hotspot, in which the total number of plant leaves is an essential morphological trait in phenotyping studies, especially for breeders; accurate leaf data help to select promising varieties and accelerate the breeding process. Due to the similarity of the appearance of the leaf blades while overlapping each other, the blades present different angles, etc., and these factors greatly increase the difficulty of the target blade identification, but also directly affect the accuracy and efficiency of the target blade feature extraction [
3].
In recent years, with the continuous improvement in computer arithmetic power, deep learning techniques are widely used in the field of target detection. Applying deep learning to the processing of RGB images can provide a non-destructive and fast method for detecting corn leaves. Compared with the existing manual identification methods, the deep learning-based leaf number identification method has the advantages of low cost, high flexibility, high efficiency, etc. [
4]. Through this method, agricultural managers understand the growth status of maize in a timely manner, and formulate scientific management measures, such as reasonable arrangements for weeding, fertilizer application, and pest control, to enhance maize yield and quality. The leaves of different plants are more different and can directly reflect the information of plant growth status. Li et al. [
5] proposed a method to compute fruit normal vectors using edge computation and gradient direction distribution, and then proposed a fully convolutional single-stage instance segmentation network called LP3Net, based on feature prototypes, to target the occluded front view of litchi. The method achieves an average localization accuracy of 82%, which significantly improves the accuracy of lychee clustering harvest point localization. Liu et al. [
6] proposed a soybean phenotype information sensing method based on improved YOLOv5, introducing MobileNetv2 to alleviate the backbone network, and introducing an attention mechanism and an improved loss function to improve the apparent robustness and generalization ability. The results show that the mAP of the improved YOLOv5 is 96.13%, and the correlation coefficient between the obtained data and the manually determined soybean phenotypic information is 0.98384, which has high accuracy and good consistency. Xu et al. [
7] proposed a method for counting corn seedlings in the field combining semi-supervised learning, deep learning, and UAV digital images, constructing a segmented complete seedling model based on the semi-supervised learning framework Noisy Student’s SOLOv2, and detecting and counting corn leaves based on the Noisy Student’s YOLOv5x model, which effectively utilizes the semi-supervised learning framework to improve the performance of the model under data-scarce conditions. Zhang et al. [
8] established a leaf recognition CNN model based on UAV images to estimate the rapeseed stand fraction from the number of recognized leaves. This study confirms that it is feasible to estimate the rapeseed stand fraction automatically, quickly, and accurately in the field, which provides a reference for phenotyping and cultivation management. Chen et al. [
9] proposed a skeleton extraction and phenotypic parameter acquisition method based on the combination of target detection and key point detection models; this study can improve the accuracy of key point detection in single tiller rice plants and accurately acquire plant skeleton and phenotypic parameters, which can help rice breeding and improvement. Yu et al. [
10] used UAVs to acquire corn tassel images from different periods, proposed a SEYOLOX-tiny model to accurately and robustly detect corn tassels, and embedded the attention mechanism to extend YOLOX to achieve key feature extraction to inhibit unfavorable factors. Barreto et al. [
11] implemented automatic plant counting of sugar beets, maize, and strawberries based on a UAV-based camera system and a deep learning image analysis pipeline to automatically predict the number of crops per plot using a full convolutional network pipeline. Liu et al. [
12] achieved high-throughput counting of maize seedlings based on UAV RGB images through corner point detection, linear regression and target detection. Zhong et al. [
13] proposed an algorithm based on a Mask R-CNN deep learning network for segmentation and recognition of multi-targeted blades in complex backgrounds, and the results show that the recognition effect is good, the segmentation accuracy is 97.51%, and at the same time, the algorithm has a strong migration ability. Yi et al. [
14] established a remote sensing detection method for fast and non-destructive estimation of the leaf age of maize seedlings, constructed an unmanned aerial vehicle (UAV) high-throughput phenotyping platform, and constructed a leaf age estimation model based on RGB and MS images, which provided strong technical support for observing leaf age in the field.
Currently, deep learning techniques are widely used in crop growth status monitoring. Aich et al. [
15] used an inverse convolutional network for segmentation and a convolutional network for leaf counting to segment the leaves from the background and calculate the number of leaves, this method achieved better performance in segmenting the leaves from the whole background and calculating the number of leaves using simple data augmentation. Fan et al. [
16] proposed a two-stream deep learning framework to segment and count different sizes of shaped plant leaves from images, achieving good performance on a public test set for automated analysis of plant phenotypes. Li et al. [
17] developed a high-throughput method for counting the number of leaves by detecting leaf tips in RGB images; the Faster R-CNN model using a recurrent consistent generative adversarial network adaptive technique performed the best, and the self-supervised phenotyping method developed in this study offers great potential for solving a wide range of plant phenotyping problems. Guan et al. [
18] proposed a network model based on the improved DBi-YOLOv8 and proposed the LTNS algorithm for counting maize leaves, the mAP and FPS of this model were 89.4% and 65.3%, which were 12% and 0.6% higher than the original model, respectively, and the method still has some limitations in dealing with leaf overlap and occlusion. Buzzy et al. [
19] used Tiny-YOLOv3 for accurate real-time localization and leaf counting to create a simple robotics platform based on an Android phone and iRobot create2 to demonstrate the real-time functionality of the greenhouse network. Vishal et al. [
20] calculated the total number of leaves by counting the number of leaf tips equal to the number of leaves and used the YOLO algorithm for detecting leaf tips as objects with an average accuracy of up to 82% and an IOU of about 0.53–0.60; the applicability of this method at different stages of growth still needs to be further validated. Gao et al.’s work [
21] was based on improved YOLOv4 lightweight neural network for maize seedling number detection, using improved Ghostnet as the feature extraction network, introducing the attention mechanism and K-means clustering algorithm to improve the detection accuracy, and using depth separable convolution instead of ordinary convolution to make the network lightweight. Quan et al. [
22] proposed an improved Fast R-CNN model to quickly and accurately detect maize seedlings at different growth stages under complex field operation environments, and the accuracy of this method was greater than 97.1% for both soil and weed detection in maize seedlings. Therefore, the rapid and accurate acquisition of maize leaf numbers is important to assist breeders in making scientific decisions and providing technical support for monitoring maize growth status.
Despite the success of the above studies in leaf identification and counting, there are still some problems. For example, there are fewer studies on maize leaf number detection and a lack of studies on lightweight maize leaf number detection with edge devices. Therefore, this study takes the maize growth process as the research object, and uses a deep learning network to achieve the recognition and counting of maize leaves with a low number of parameters, low latency, and high detection accuracy [
23]. YOLOv5 and YOLOv8 are different versions of the one-stage target detection algorithms. YOLOv8, compared to YOLOv5, uses a more efficient feature extraction and fusion method employing deeply separable convolution, providing higher inference speed and lower latency for applications that require higher responsiveness. YOLOv8 introduces a new anchor mechanism that does not rely on manually preset anchor sizes, making the detection more flexible and efficient, and integrates a novel regularization technique in the training process to further improve the robustness and generalization of the model. In this study, based on the YOLOv8 model in the YOLO series, which has high accuracy, low participant count, and fast detection speed, we propose a lightweight method for recognizing and counting maize leaves, and develop a detection model that has high accuracy, fast detection speed, and is easy to deploy for mobile devices with limited computational power, which provides a feasible solution for maize growth detection for a more accurate assessment of the growth of maize.
3. Results and Analysis
3.1. Experimental Environment
This study is based on the open-source machine learning framework Pytorch 1.11.0. The server experimental environment is Ubuntu 20.04, the processor is 16 vCPU Intel(R) Xeon(R) Gold 6430, the memory is 120 GB, the graphics card is RTX4090 with 24 GB video memory, and the GPU acceleration environment is Cuda 11.3. The Python version is 3.8. The training parameter settings are shown in
Table 1.
3.2. Performance Comparison of Similar Models
In this study, a series of new improvements are made to the original YOLOv8 model to improve the accuracy and efficiency of target detection. The performance of the new network is evaluated by experimentally comparing it with other mainstream models. The comparison metrics include precision, recall, mean average precision (mAP), number of floating-point calculations, number of parameters, and model size. The comparison results are shown in
Table 2.
As can be seen from the experimental results in
Table 2, the Faster R-CNN and SSD models have larger floating-point computation and parametric quantities and generate larger model weight files. Therefore, the Faster R-CNN and SSD algorithms are less suitable for the lightweight real-time detection requirements of this dataset. The Faster R-CNN model has 941.0 G of FLOPs, 28.3 M of parameters, a model size of 108.2 M, and an FPS of only 85.6, while the SSD model has 60.9 G of FLOPs, 23.8 M of parameters, a model size of 91.1 M, and an FPS of 103.4. These properties make these two models efficient in resource-constrained environments. The YOLOv9 model was lower than YOLOv5s, YOLOv8n, and LCS-YOLOv8 in terms of precision, recall, F1, and mAP50, and the FPS was reduced by 43.4 compared to LCS-YOLOv8. The accuracy of YOLOv5s is slightly higher than that of YOLOv8n, but the number of parameters and the model size of YOLOv5s are about twice as large as that of YOLOv8n, and the FPS is reduced by 67.1 compared to LCS-YOLOv8. The improved algorithm LCS-YOLOv8 improves precision and recall by 0.1% and 0.3% and FPS by 6.6 compared to the original YOLOv8n, and the number of parameters of the improved model and the model weight file are smaller, which makes it more suitable for use in resource-constrained environments. The improved algorithm LCS-YOLOv8 was compared to YOLOv5s; although the precision and recall are slightly reduced, the number of parameters and the model size of YOLOv5s are about three times those of LCS-YOLOv8, and the FPS is reduced by 67.1 compared to LCS-YOLOv8. As can be seen from the above analysis, the LCS-YOLOv8 algorithm proposed in this study demonstrates its superiority across a number of metrics, substantially reducing the model complexity and computational requirements while maintaining high detection performance. This makes LCS-YOLOv8 an efficient and reliable choice for resource-constrained environments, capable of achieving faster processing speeds while maintaining accuracy.
3.3. Ablation Experiment
The original YOLOv8 model FLOPs and model size are large, so an improved YOLOv8 lightweight neural network is proposed. The specific improvement method is as follows: the StarNet network is used as the backbone feature extraction network, and different subspace features are fused by star operation in order to reduce the number of network parameters. Using an improved spatial pyramid pooling module, the LSKA module captures spatial features through large kernel convolution, focusing on key regions to enhance extraction. The CAFM attention module is used to focus on important information through weighted features to improve the overall performance. Using deep convolution can separate and share the convolutional detection head to reduce the number of network parameters. In order to verify the effectiveness of each improvement module in the algorithm of this study, the original model YOLOv8 is used as the baseline model, and recall, F1 score, mAP50, number of floating-point calculations, number of parameters, and model dimensions are used as the evaluation indexes, and ablation experiments are carried out through different combinations of multiple improvement modules, and the results are shown in
Table 3.
Based on the analysis of the experimental results in
Table 3, it can be seen that YOLOv8 performs well in terms of recall, F1 score and mAP50, but its FLOPs and parameter sizes are large and unsuitable for resource-constrained environments. The accuracy of the improved StarNet modular network remains unchanged from YOLOv8, and the FLOPs, number of parameters and model size are reduced by 1.6 G, 0.8 M, and 1.6 MB, and the FPS is improved by 1.5. The experimental results show that StarNet’s lightweight design may lead to inadequate feature extraction affecting the recall rate, and that the use of deeply separable convolutional modules for the backbone network greatly reduces the number of parameters and floating-point computations that the model generates during ordinary convolution.
In the improved StarNet module and LSCD module networks, the accuracy is reduced by 0.5%, recall is improved by 0.5%, FLOPs are reduced by 2.4 G, the number of covariates is reduced by 0.9 M, the model size is reduced by 3 MB, and the FPS is reduced by 3.2, when compared to the YOLOv8 network. Compared to the improved StarNet network, precision is reduced by 0.5%, recall is increased by 0.7%, FLOPs are reduced by 0.8 G, the number of covariates is reduced by 0.1 M, and model size is reduced by 0.4 MB. The experimental results suggest that due to the shared convolutional nature of the LSCD module, the individual detection layer features may not have been adequately separated leading to a decrease in precision, but the lightweight design of the LSCD may have made the detector more sensitive to the target improving the recall. Adding the LSKA module on top of this increases precision by 0.6%, decreases recall by 0.5%, increases FLOPs by 0.5 G, decreases the number of parameters by 0.2 M, decreases model size by 0.4 MB, and increases FPS by 3.8. The experimental results show that the LSKA large convolutional energy can cover a larger range of input features and identify more details and contextual information to improve the accuracy, the LSKA module can maintain a good recognition of potential targets, and the recall ability of the model is not affected by the structural changes.
Compared to the original YOLOV8, the improved StarNet module and LSKA module add a 0.2% increase in C2f-Star module accuracy, a 2.7 G reduction in FLOPs, a 0.7 M reduction in the number of parameters, a 1.5 MB reduction in the model size, and a 2.7 increase in FPS. Compared to the improved StarNet and LSCD modules, the accuracy is increased by 0.7%, FLOPs are reduced by 0.3 G, the number of parameters is increased by 0.2 M, the model size is increased by 0.5 MB, and the FPS is increased by 5.9. The experimental results show that the C2f-Star module enhances the ability of features to work together at different scales, conveys and fuses feature information to improve model accuracy, significantly reduces the number of model parameters due to the use of a large number of depth-separable convolutions, and reduces the computational complexity of inference to improve inference speed.
The improved CAFM module has a precision reduction of 0.1%, a recall increase of 0.2%, a reduction of 3.1 G in FLOPs, a reduction of 1 M in the number of parameters, a reduction of 2.2 MB in the model size, and an increase of 3.9 in the FPS compared to the original YOLOv8. Compared to the improved StarNet module, recall increased by 0.4%, FLOPs decreased by 1.5 G, parameter count and model size decreased by 0.2 M and 0.6 MB, and FPS increased by 2.4. The experimental results show that the CAFM module uses 3D convolution to obtain feature information more comprehensively from different scales and dimensions to increase recall, and the deep and grouped convolution in CAFM significantly reduces the computational complexity, allowing the model to be computed faster in the inference process.
The LCS-YOLOv8 model shows a 0.6% improvement in accuracy, a 3.2 G reduction in FLOPs, a 1.2 M reduction in the number of parameters, 2.5 MB reduction in the model size, and a 6.6 improvement in FPS compared to the original YOLOv8 model. Compared with the improved CAFM module, the precision is improved by 0.2%, recall is improved by 0.1%, FLOPs are reduced by 0.1 G, the number of parameters is reduced by 0.2 M, the model size is reduced by 0.3 MB, and FPS is improved by 2.7. The experimental results show that the LCS-YOLOv8 model is able to better capture and represent complex features in images, capture targets at different scales through multi-scale feature fusion, achieve efficient feature processing and fusion using a smaller number of parameters and computations, and reduce the number of parameters and size of the model. As a result, the LCS-YOLOv8 model occupies less memory and consumes less energy on mobile devices, making it more suitable for edge computing and cloud computing deployments.
3.4. Model Generalization Test Experiment
The visualization provides a more intuitive view of the effectiveness of the algorithm in detecting corn leaves. It allows for observing information such as the position, size, and category of the corn leaves detected by the algorithm, which can be used to evaluate the accuracy and efficiency of the algorithm, as well as to debug and optimize the algorithm. According to the ablation test results, by selecting one of the better model algorithms for comparative analysis and validation, YOLOv5s, YOLOv8, and the improved LCS-YOLOv8 algorithm of this study were selected to visualize and compare the detection results in the maize growth.
3.4.1. Comparison of Monitoring Effects of Different Models in Different Light Environments
To validate the generalization of the proposed model for maize leaf detection under different light conditions.
Figure 9 shows some of the detection results, group A shows the maize taken under normal conditions, group B shows the maize taken under a simulated cloudy day, and group C shows the maize taken under a simulated sunny day, and one maize image is selected from each of the three scenarios to be shown. Based on the comparison of the test results of A, B, and C, it can be seen that the three models are more capable of detecting under normal weather conditions, and YOLOv8 has leakage detection for leaves with different characteristics under normal conditions. In cloudy and sunny conditions, YOLOv8 and YOLOv5s’s detection abilities are slightly reduced compared to normal conditions, but they still maintain a high level of accuracy. It can be seen that different light intensities have a certain impact on the detection results. The improved LCS-YOLOv8 algorithm performs stably and has high recognition accuracy in three weather conditions, which proves that the algorithm in this study can improve the problem of inaccurate target feature recognition in different weather conditions.
3.4.2. Comparison of the Detection Effect of Different Models in Different Growth Periods
To verify the generalization of the proposed model for maize leaf detection at different growth periods. In this study, the leaf images of maize at the 4-leaf stage, 7-leaf stage and 9-leaf stage were randomly selected from the test set and input into YOLOv5s, YOLOv8n, and LCS-YOLOv8 for experiments, respectively, to observe the confidence situation, and the results of detection are shown in
Figure 10. Among them, the confidence level of LCS-YOLOv8 for the leaf detection frames at 4-leaf stage and 7-leaf stage was around 0.9, which was improved compared to YOLOv8 and YOLOv5s; the confidence level of YOLOv5s was lower and there was a leakage of detection at the 7-leaf stage compared to LCS-YOLOv8 and YOLOv8 leaf detection frames. In the detection of leaf images at the 9-leaf stage, the LCS-YOLOv8 not only maintains high accuracy, but also has no leakage occurrence, and the YOLOv8 and YOLOv5s miss one leaf at the 9-leaf stage. Higher confidence in the detection frame indicates that the model has better captured the detailed features of the target during the learning process, and a higher likelihood that the target exists. Due to the continuous growth of maize leaves, the characteristics of cotyledons change considerably. As a result, YOLOv8 and YOLOv5s missed the yellowing cotyledons during detection. The LCS-YOLOv8 model embedded in the CAFM attention module proposed in this study can highlight important leaf information and improve the expression of different features, thus better capturing maize leaves. The experiments illustrate that the improved LCS-YOLOv8 has a better detection effect compared to the original YOLOv8 model, and this conclusion provides technical support for subsequent maize leaf number detection.
3.5. Feature Visualization of Different Networks
To further explore the feature extraction capabilities of different networks, the feature maps are visualized. The visualization allows an intuitive look at the features extracted by the model during the detection process and helps to understand its detail capturing capabilities. The final feature extraction results for YOLOv5s, YOLOv8, and LCS-YOLOv8 networks are shown in
Figure 11.
The comparison shows that the feature map of the LCS-YOLOv8 model can clearly present the characteristics of the leaves. The edges, textures, and details of the blades are better preserved and highlighted in the feature maps of LCS-YOLOv8, while the blade features are relatively blurred in the feature maps of YOLOv5s and YOLOv8. This difference suggests that the LCS-YOLOv8 model has a greater ability to capture more detailed leaf features in terms of feature extraction. In summary, the LCS-YOLOv8 model is able to learn more leaf features and shows an excellent feature extraction ability and detection effect compared with YOLOv5s and YOLOv8. LCS-YOLOv8 is more suitable for maize leaf detection and provides reliable technical support for maize leaf detection.
4. Discussion
Target detection has a wide range of applications in agriculture, such as pest and disease detection, crop identification, and plant leaf counting. The number of leaves is an important piece of phenotypic information during maize growth. In this study, the improved YOLOv8 lightweight network model can accurately obtain the number of maize leaves to understand the growth rate and health status of maize, which can help to assess crop yield and specify reasonable field management measures.
Intact single maize plants are a prerequisite for accurate calculation of the number of maize leaves. In this study, the lightweight LCS-YOLOv8 model was chosen to compare with traditional one- and two-stage target detection algorithms, respectively. As can be seen from
Table 2, LCS-YOLOv8 not only approaches or even exceeds other mainstream models in terms of precision and recall, but also excels in terms of computational complexity, number of parameters, and model size. LCS-YOLOv8 is able to significantly reduce computation and storage costs while ensuring detection accuracy, making it suitable for resource-constrained application scenarios. In contrast, while the two-stage target detection algorithm performs well on some metrics, its high computational complexity and large model size do not provide a competitive advantage in resource-limited environments. The experiments showed a 5.13% increase in precision and a significant increase in recall and F1 values compared to Wang et al. [
34] when using the LCS-YOLOv8 model to detect and count maize leaves. In addition, the lightweight shared convolutional detection head processes the feature maps of all detection layers by sharing two convolutions, which significantly improves precision, recall, and increases FPS by 53.3 compared to Ye et al.’s [
35] use of lightweight YOLOv8. Therefore, for the application of corn leaf identification and counting tasks in lightweight scenarios, the improved model performs well in resource-constrained environments, but there is still room for improvement in detection accuracy under extreme conditions (e.g., sunny and cloudy days). Future work will further improve the robustness and adaptability of the model.
The method proposed in this study was evaluated only on a single maize dataset, and after training it achieved a mAP of 97.5 in the test set containing 127 images, which was in addition to a good performance. However, the effectiveness and performance for other periods (e.g., irrigations) or population maize detection tasks need to be further explored. In the future, it is planned to extend the applicability of the model by adding large field maize data to the training set and to validate its effectiveness in real production through maize detection in pots in greenhouses. Due to the diversity of maize varieties and the complexity of population growth, future research will enrich the samples and add relevant information to improve the model recognition ability and real-time detection performance. It is planned to port the model to the edge computing platform to optimize its lightweight and high efficiency, so as to achieve accurate and efficient maize growth detection and provide powerful technical support for agricultural production.