Abstract
Introduction:
The real-time, accurate detection and classification of rice seeds are crucial for improving agricultural productivity, ensuring grain quality, and promoting smart agriculture. Although significant progress has been made using deep learning, particularly convolutional neural networks (CNNs) and attention-based models, earlier methods such as threshold segmentation and single-grain classification faced challenges related to computational efficiency and latency, especially in high-density seed agglutination scenarios. This study addresses these limitations by proposing an integrated intelligent analysis model that combines object detection, real-time tracking, precise classification, and high-accuracy phenotypic measurement.
Methods:
The proposed model utilizes the lightweight YOLOv11-LA for real-time grain segmentation, which builds upon the YOLOv11 architecture. YOLOv11-LA incorporates several enhancements over YOLOv11, including separable convolutions, CBAM (Convolutional Block Attention Module) attention mechanisms, and module pruning strategies. These modifications not only improve detection accuracy but also significantly reduce the number of parameters by 63.2% and decrease computational complexity by 51.6%. For classification, the model employs a custom-designed, lightweight RiceLCNN classifier. Additionally, the DeepSORT algorithm is employed for real-time multi-object tracking, and sub-pixel edge detection along with dynamic scale calibration mechanisms are applied for precise phenotypic feature measurement.
Results:
Compared to YOLOv11, the YOLOv11-LA model increases the mAP@0.5:0.95 score by 1.9%, showcasing its superior detection performance while maintaining lower computational overhead. The RiceLCNN classifier achieved classification accuracies of 89.78% on private datasets and 96.32% on public benchmark datasets. The system demonstrated high accuracy in measuring phenotypic features such as seed size and roundness, with measurement errors kept within 0.1 millimeters. The DeepSORT algorithm effectively managed multi-object tracking, reducing duplicate identifications and frame loss in real-time.
Discussion:
Experimental validation confirmed that the YOLOv11-LA model outperforms the original YOLOv11 in terms of both detection speed and accuracy, while also maintaining low computational complexity. The integration of the YOLOv11-LA, RiceLCNN, and DeepSORT algorithms, combined with advanced measurement techniques, underscores the model's potential for industrial applications, particularly in enhancing smart agricultural practices.
1 Introduction
Rice (Oryza sativa L.), as a globally significant staple crop, plays a crucial role in maintaining food security and agricultural economics through its yield and quality. Achieving efficient and precise rice seed detection and classification not only enables stringent quality control at the source and supports the breeding and promotion of superior varieties, but also provides critical technological support for the transformation of agricultural production toward intelligent and precision farming ().
Compared to other crops, rice seeds are tightly enclosed by hard inner and outer glumes (husk), and their phenotypic characteristics pose a series of unique challenges for phenotypic analysis. First, rice grains are small and elongated, often appearing in high-density, inter-contacted distributions during high-throughput imaging, significantly increasing the difficulty of target segmentation (; ; ); Second, visual differences between varieties are often subtle, primarily manifesting in traits such as grain length-to-width ratio, end contour, and surface texture; Environmental and cultivation management factors (e.g., day-night temperature differences, water and fertilizer conditions) further amplify intraspecific variation and reduce interspecific distinguishability by influencing quality traits like chalkiness (; ); Additionally, variations in husk surface gloss and color, along with localized high-reflectance and low-contrast regions, complicate feature extraction and threshold segmentation (; ).
Traditional rice variety classification methodsāmanual phenotypic identification, chemical or biological analysisāremain valuable for accuracy and interpretability. However, they are generally destructive time-consuming, and costly. Consequently, recent research has shifted toward image-based deep learning approaches (; ). In the typical scenario of ādense small objects in close contact,ā object detection has become the mainstream technical approach: Mask-based methods excel in contour delineation but are prone to over-segmentation or under-segmentation in densely packed rice seed scenarios, and are not conducive to high-throughput initial screening. In contrast, one-stage methods (YOLO series) maintain accuracy while offering real-time performance. They enable rapid initial screening of rice seeds in detection-priority pipelines, followed by subsequent fine segmentation and measurement, aligning better with high-throughput workflows from field to laboratory. Previously, models like YOLOv5 have demonstrated strong performance in rice seed detection tasks (); recent enhancementsāincluding more efficient backbones and decoupled detector heads, improved small object training and sampling strategies, and end-to-end/low-latency inferenceāfurther boost their applicability in dense scenarios. YOLOv9 introduced the Generalized Efficient Layer Aggregation Network (GELAN) and programmable gradient information to enhance information utilization in lightweight models (); YOLOv10 achieved NMS-free training and significantly reduced latency through strategies like consistent dual allocation, pushing the performance boundaries of small object detection and real-time deployment (). Building upon this evolutionary trajectory, YOLOv11 comprises three major modules: the backbone network, the neck network, and the head network. The backbone handles multi-scale feature extraction, while the neck aggregates features through multi-layer convolutions and attention mechanisms before passing them to the head, which generates the final predictions. Performance improvements stem primarily from innovative module designs: replacing traditional C2f with C3k2 enhances computational efficiency, and integrating Spatial Pyramid Pooling Fast (SPPF) with Cross-Stage Partial with Spatial Attention (C2PSA) further strengthens feature representation. Furthermore, YOLOv11 undergoes systematic optimization in model size and computational efficiency, demonstrating exceptional performance in multi-scale small object detection and proving particularly well-suited for edge computing scenarios (). Accordingly, we build the segmentation frontend upon the lightweight YOLOv11-LA network to balance speed and accuracy while ensuring seamless integration with subsequent fine-grained classification modules.
For seed classification, RiceSeedNet employs a visual Transformer architecture supplemented by traditional image processing for RGB-based rice variety identification (); RiceNet focuses on color and shape feature extraction, demonstrating strong generalization capabilities across varying grain sizes and contours (). These studies demonstrate that convolutional models based on standard image information can effectively characterize rice seed phenotype. However, when confronted with high-density, intra-class-diverse real-world workflows, classification networks alone struggle to meet the efficiency and accuracy demands of end-to-end processing. Therefore, this study adopts an integrated ādetection front-end ā fine-grained classification back-endā approach to balance high throughput and high accuracy in complex scenarios.
Experiments employed a single-factor randomized block design. The same rice variety was planted across nine different treatment combinations (straw incorporation, enzyme application, and various combinations of organic and chemical fertilizers) on plots demonstrating fertilizer efficacy, ensuring consistent cultivation practices. Post-harvest, rice seed samples were collected from each treatment plot and photographed against a standard black background (each image containing 200 grains) to analyze phenotypic variations induced by different fertilizer treatments. Methodologically, we employed an optimized lightweight YOLOv11-LA frontend for automated detection/segmentation of high-density grains, coupled with a lightweight RiceLCNN for phenotypic feature extraction and classification of individual seeds, forming a scalable two-stage segmentation-classification pipeline. The main contributions of this study are as follows: (1) Proposed a lightweight, structurally optimized YOLOv11-LA localization front-end tailored for dense, overlapping, low-contrast rice seed images, enabling real-time inference and consistently improving small object recall; (2) Designs the lightweight and efficient RiceLCNN classification network, enhancing its ability to recognize subtle phenotypic variations in rice seeds; (3) Constructs a rice seed classification dataset under standardized imaging conditions, providing data support for subsequent phenotypic analysis and management strategy evaluation; (4) Establishes a scalable ātwo-stage segmentation-classificationā pipeline, facilitating real-time deployment and online iterative refinement.
2 Related work
In rice seed identification experiments, while individual grain imaging can reduce errors, it incurs extremely high labor and time costs; In practice, a more common approach involves capturing multiple grains in a single frame, followed by segmentation. Existing research, often prioritizing classification, typically employs the classical Otsu global threshold () for segmentation. This method achieves unsupervised segmentation by maximizing inter-class variance and has introduced several improvements for rice seed scenarios to enhance robustness under complex lighting and background conditions (). However, under conditions of low contrast, noise interference, and grain adhesion, Otsu and its variants remain reliant on local adaptation and post-processing, with limited effectiveness in separating adhered objects. Therefore, we turn to detection-driven real-time segmentation: The YOLO series has demonstrated its detection and localization capabilities in agricultural imagery, such as size estimation based on YOLOv7 () and grain measurement leveraging rotation awareness with YOLOv8 (). Within this framework, we adopt an optimized and lightweight YOLOv11-LA as the frontend. It inherits the CSP backbone and FPN+PAN feature fusion from YOLOv11n to enhance small object representation. Combined with pruning and quantization, it achieves a balance between accuracy and speed, enabling real-time instance-level segmentation and screening of densely packed, contacting grains.
Based on the instance regions output by this frontend, we employ the lightweight RiceLCNN for single-grain classification and phenotypic feature extraction. Early rice seed classification studies predominantly utilized machine learning algorithms such as Logistic Regression (LR), Linear Discriminant Analysis (LDA), k-Nearest Neighbors (k-NN), and Support Vector Machines (SVM). These methods perform well under conditions of thorough preprocessing and explicit feature extraction. For instance, achieved 90.61% accuracy using SVM classification on RGB images. combined geometric features with a Random Forest (RF) classifier to achieve a 77% classification rate. further proposed a hybrid model integrating deep feature extraction with traditional classifiers, enhancing model stability and generalization capabilities. As CNNs and their variants gain widespread adoption for rice variety image classification, enhanced image quality and training sample selection efficiency by integrating the EDSR network with the Kennard-Stone algorithm. introduced transfer learning to rice variety recognition. Comparing architectures like ResNet50, Xception, and InceptionV3, they found ResNet50 performed optimally on large-scale datasets, achieving 80.5% accuracy. These studies demonstrate deep learningās distinct advantages in feature extraction and phenotypic recognition. To further enhance model inference capabilities, some research attempts to incorporate multi-model fusion into rice variety classification systems. For instance, fused GBDT with ANFIS to construct a nonlinear classifier, enabling intelligent assessment of rice seed aging. Although such models demonstrate strong classification capabilities, their complex structures and high computational costs limit practical deployment in edge computing and field environments. In contrast, proposed RiceNet, centered on a lightweight convolutional architecture. Tested on five common rice varieties, it achieved 94% accuracy, outperforming InceptionV3 (84%) and InceptionResNetV2 (81.33%). RiceNetās compatibility with high accuracy and low computational complexity makes it suitable for rapid deployment and industrialization under resource-constrained conditions. Nevertheless, this approach primarily focuses on static image recognition, and future work should extend it to multi-task scenarios (such as counting and multi-attribute analysis) to enhance practicality.
3 Materials and methods
This study proposes a two-stage segmentationāclassification framework for rice seed recognition and phenotypic analysis, consisting of two core modules: (1) the real-time grain segmenter YOLOv11-LA, designed to perform rapid detection and instance segmentation in dense contact scenarios; and (2) the rice seed classifier RiceLCNN, responsible for phenotypic discrimination and feature extraction from individual grain images. As illustrated in FigureĀ 1, the overall workflow comprises dataset construction (collection, annotation, and quality control), model design and optimization (architecture refinement, pruningāquantization, and training strategies), tracking-based counting (instance-level inter-frame association), and phenotypic measurement and analysis, together forming a scalable pipeline suitable for high-throughput applications. To ensure the fairness and reliability of the experiments, all experiments were independently repeated k=5 times under the same conditions, and the average results were reported to minimize randomness.
FigureĀ 1
3.1 Real-time grain segmenter: YOLOv11-LA
3.1.1 Image acquisition and detection data set construction
The data for this study were provided by the Rice Research Institute of the Jilin Academy of Agricultural Sciences. To generate sufficient phenotypic variation while keeping the genetic background constant, the same rice variety, āTongjing 612ā was cultivated under nine fertilization regimes that systematically combined straw incorporation, enzyme application, organic fertilizer, and chemical fertilizer (TableĀ 1). Plot 1 received neither straw, enzyme, organic fertilizer, nor chemical fertilizer and therefore served as the unfertilized control. Plots 2 and 3 were designed to test the effect of straw incorporation with and without enzyme application. Plots 4ā9 combined straw with different types of fertilizers: Plot 4 received all four inputs (straw, enzyme, organic and chemical fertilizers), Plots 5 and 6 received straw and enzyme in combination with either chemical or organic fertilizer, respectively, while Plots 7ā9 received straw with different combinations of organic and/or chemical fertilizers but without enzyme. This design allowed us to disentangle the effects of straw, enzyme and fertilizer type on rice growth and phenotypic variation.
TableĀ 1
| Plot | Straw | Enzymes | Organic fertilizer | Chemical fertilizer |
|---|---|---|---|---|
| Plot 1 | Ć | Ć | Ć | Ć |
| Plot 2 | ā | ā | Ć | Ć |
| Plot 3 | ā | Ć | Ć | Ć |
| Plot 4 | ā | ā | ā | ā |
| Plot 5 | ā | ā | Ć | ā |
| Plot 6 | ā | ā | ā | Ć |
| Plot 7 | ā | Ć | ā | Ć |
| Plot 8 | ā | Ć | Ć | ā |
| Plot 9 | ā | Ć | ā | ā |
Fertilization situation of each experimental plot.
ā, use; Ć, no use.
Imaging was performed using a Nikon D7100 camera under uniform black background and standardized lighting conditions, with a resolution of 6000Ć4000 (300 dpi). Each image captured 200 grains; an example is shown in FigureĀ 2. Additionally, we integrated public datasets including RiceNet (), Japanese Rice (), and RiceSeedSize () to enhance training data diversity and cross-scenario adaptability. To enable traceable pixel-to-physical-scale conversion, black light-absorbing discs were placed within images as dynamic scale calibration references. In this study, a total of 25,000 rice seed samples were collected and annotated. These were divided into training, validation, and test sets in an 8:1:1 ratio, comprising 20,000, 2,500, and 2,500 seeds, respectively. The training set was used for model parameter learning and feature extraction; the validation set was employed during training to tune hyperparameters and monitor convergence, preventing overfitting; the test set remained strictly independent from the model development process and was used only in the final stage for unified evaluation of the modelās generalization ability and overall performance, ensuring the objectivity and comparability of experimental results. All images were annotated with rice seed bounding boxes in YOLO format, forming the rice seed detection dataset. YOLO annotations for each dataset are illustrated in FigureĀ 3.
FigureĀ 2
FigureĀ 3
3.1.2 Network structure optimization of YOLOv11-LA
This study designs a lightweight segmentation model, YOLOv11-LA (Lightweight-Attention), based on the YOLOv11n architecture. Its primary optimizations include:
(1) Lightweight Convolution Structure Design: In the model backbone, the original two-layer standard convolution structure (Conv + Conv) is replaced with a Conv + DWConv combination. Depthwise Separable Convolution (DWConv) is also adopted in subsequent multi-layer feature extraction modules to reduce computational burden (). The computational complexity is optimized from standard convolution (Equation 1) to the depthwise separable structure (Equation 2):
where K is the convolution kernel size, Cin and Cout are the input/output channel numbers, and H Ć W is the output feature map size.
(2) Streamline the C3k2 module structure to reduce redundant computations by replacing deeper C3 variants with C3k2 (). Apply a compression coefficient to the channel count at corresponding stages (while preserving the backbone resolution and receptive field) to reduce parameters and FLOPs. This modification inherits C3ās cross-stage feature fusion advantage (CSP mechanism) while significantly reducing redundant computations caused by stack depth and intermediate channels ().
(3) Introducing CBAM Attention Module before Detection Head () To highlight discriminative features of adhesions and minute grains at low cost, we insert CBAM once before the classification/regression convolutions in the detection head (channel attention with reduction ratio r = 16, spatial attention using 7Ć7 convolutions, as shown in the Equations 3, 4). This placement strategy focuses attention on high-level features after multi-scale fusion without overly interfering with the backboneās general representations. This modification consistently improves performance while keeping GFLOPs largely unchanged.
Where denotes Global Average Pooling, averaging the spatial dimensions of feature map and outputting ; denotes Global Max Pooling, which takes the maximum value in the spatial dimensions and outputs ; represents a two-layer fully connected network (typically with ReLU activation in the middle layer), used to generate channel attention weights; denotes a convolution operation with a 7Ć7 kernel, taking 2 input channels (concatenated from ) and producing 1 output channel; denotes the Sigmoid activation function, which compresses values into the range; represents concatenation along the channel dimension.
(4) Channel width reduction: The maximum output channel count of the backbone is reduced from 1024 to 512. The output channels of P5 in the Head module are also simplified accordingly, effectively compressing the parameter scale and reducing memory consumption.
Furthermore, to address the limitation of conventional YOLO boxes failing to accurately fit tilted seed grain boundaries, the Otsu adaptive thresholding method is introduced. This performs fine segmentation on each detected seed grain region and extracts the minimum bounding rectangle, thereby enhancing the accuracy of subsequent phenotypic measurements. FigureĀ 4 demonstrates the effect of using minimum bounding rectangles, and the model structure diagram is shown in FigureĀ 5.
FigureĀ 4
FigureĀ 5
3.2 Rice seed classifier: RiceLCNN
3.2.1 Classification dataset construction
Based on the detection outputs from YOLOv11-LA, each rice seed image was automatically cropped and uniformly resized to 224 Ć 224 pixels. After removing occluded, blurred, and incorrectly detected images, a high-quality rice seed classification dataset comprising 16,731 images was ultimately constructed. The data was partitioned into training, validation, and test sets at an 8:1:1 ratio, with specific counts shown in the TableĀ 2. The naming convention reflects the collection year and experimental plot number. Grain samples of each variety are displayed in FigureĀ 6.
TableĀ 2
| Rice variety | No. of training samples | No. of validation samples | No. of test samples |
|---|---|---|---|
| 2022-1 | 1,487 | 186 | 186 |
| 2022-2 | 1,487 | 186 | 186 |
| 2022-3 | 1,487 | 186 | 186 |
| 2022-4 | 1,487 | 186 | 186 |
| 2022-5 | 1,487 | 186 | 186 |
| 2022-6 | 1,487 | 186 | 186 |
| 2022-7 | 1,487 | 186 | 186 |
| 2022-8 | 1,487 | 186 | 186 |
| 2022-9 | 1,487 | 186 | 186 |
| Total | 13,383 | 1,674 | 1,674 |
Distribution of training, validation, and test data for nine rice varieties.
FigureĀ 6
3.2.2 RiceLCNN network structure design
To balance inference efficiency on mobile devices with rice seed classification accuracy, this paper proposes the lightweight convolutional neural network RiceLCNN. The model backbone consists of six cascaded convolutional modules followed by a fully connected classification head (FigureĀ 7), adhering to the lightweight paradigm of ā1 Ć 1 bottleneck restructuring + 3 Ć 3 local modeling.ā Batch Normalization and LeakyReLU are applied after all convolutions to stabilize gradients and accelerate convergence (; ). The first three modules employ a structure composed of sequential 1Ć1, 3Ć3, and 1Ć1 convolutions. The initial stage performs early downsampling using a stride s = 2 at the 3 Ć 3 convolution, followed by further spatial dimension reduction via 4 Ć 4 max pooling. The second and third stages maintain convolutions with stride s = 1 and similarly employ 4 Ć 4 max pooling to control resolution. After these three stages, the backbone introduces channel attention to enhance discriminative feature representation: Specifically, a Squeeze-and-Excitation (SE) mechanism is applied to the 64-channel features for channel recalibration. First, global average pooling is performed on the feature F to obtain the channel description z = GAP(F). Then, two fully connected layers with nonlinear transformations generate the weight vector, as shown in the following Equation 5.
FigureĀ 7
where Ī“(Ā·) and Ļ(Ā·) denote ReLU and Sigmoid, respectively. s is used for per-channel scaling of the original features.
Following SE, a 3 Ć 3 convolution layer and 2 Ć 2 max pooling continue feature refinement and compression. The fifth stage reuses the 1Ć1, 3Ć3, 1Ć1 convolution sequence followed by 2 Ć 2 pooling downsampling. The sixth stage employs a single 3Ć3 convolution for final semantic aggregation, followed by 2Ć2 pooling to obtain a compact spatial representation. Channel sizes follow a monotonically increasing pyramidal configuration along the network backbone: {16, 32, 64, 64, 128, 224}. Here, 1 Ć 1 convolutions perform cross-channel feature reorganization and dimension reduction at low cost, while 3Ć3 convolutions focus on critical local contexts. The SE module adaptively reweights channel importance during the mid-level semantic stage, enhancing feature selection capability and inter-class separability within limited parameter and computational budgets (; ; ). Finally, the network obtains a 224-dimensional global representation through a flattening operation and outputs classification results via a single fully-connected layer (224 Ć C, where C denotes the number of classes). This design effectively improves recognition performance while maintaining manageable inference overhead, making it suitable for resource-constrained mobile deployment scenarios.
3.3 Integrated tracking counting and morphometry module
3.3.1 Real-time tracking and counting
In the scenario of simultaneous multi-grain rice variety identification, we employ YOLOv11-LA as the front-end detector. For each frame image It, it outputs a detection set , where denotes the center and scale of the bounding box, represents the initial category (rice-seed), and indicates the confidence score. The detection results are fed into DeepSORT for cross-frame association: for each in-orbit target , establish a Kalman filter state (where are the bounding box center, ), yielding the prior trajectory set . Construct the cost matrix under the threshold of Mahalanobis distance and . Solve the global optimal matching of using cascade matching (starting from the most recent update time of the trajectory and proceeding from near to far) and the Hungarian algorithm, obtaining the set of matching pairs . Perform Kalman updates on to obtain the corrected trajectory . Unmatched detections initialize new trajectories, and trajectories unmatched for more than consecutive frames are terminated. This dual ācascade + IoUā constraint effectively reduces missed detections and ID switching (), as 272 illustrated in FigureĀ 8.
FigureĀ 8
For each confirmed track, the cropped region is input to the lightweight classifier RiceLCNN to obtain category prediction and confidence score . Combined with dynamic scale calibration, this outputs phenotypic measurements including length, width, aspect ratio, and roundness. Counting employs a unique ID deduplication strategy: Let denote the set of confirmed trajectories first entering the counting region by time t that remain uncounted. The cumulative count is then . In dense images withĀ coalescing but minimal occlusion, this modular ādetection-tracking-classification-measurementā pipeline maintains consistent cross-frame IDs and stable counting. Key parameters of DeepSORT are shown in TableĀ 3, with ID switches (IDSW) in the test sequence reduced to 2.1(average).
TableĀ 3
| Parameter | Value | Description |
|---|---|---|
| max_dist | 0.2 | Cosine similarity threshold for detection-tracklet matching |
| min_confidence | 0.3 | Filters low-confidence detections to reduce noise |
| nms_max_overlap | 0.5 | Removes duplicate detections in dense areas |
| max_iou_distance | 0.7 | Spatial matching tolerance in Hungarian algorithm |
| max_age | 70 | Frames to retain lost targets before deletion |
| n_init | 3 | Required consecutive matches for new track initiation |
| nn_budget | 100 | Historical feature queue length stored per tracker |
| num_target | 751 | Number of trackable objects in the dataset |
Hyperparameter configuration of the improved DeepSORT tracking module.
3.3.2 Real-time measurement
To achieve dynamic absolute scale conversion based on the image, this paper directly employs YOLOv11- LA for detection and segmentation of the calibrated disk: The detector first outputs the diskās Region of Interest (ROI) (category scale disk), and its segmentation head returns the disk mask within this ROI. The pixel domain area is obtained by counting pixels in the mask, as shown in the following Equation 6.
where denotes the pixel-domain area of the disk (units: ), is the idempotent function, and represents pixel coordinates.
Based on the circle area-diameter relationship, the equivalent pixel diameter of the disk is obtained as shown in the following Equation 7.
where Dpix denotes the diameter in the pixel domain (unit: px). This formula leverages mask geometry without requiring additional edge/ellipse fitting, making it suitable for real-time high-throughput applications.
Comparing the pixel diameter to the physical diameter yields a uniform millimeter/pixel scale across the entire image, as shown in the following Equation 8.
where Dreal is the true diameter of the calibrated disk (unit: mm), and α is the scale factor mapping lengths from the pixel domain to the physical domain. This paper assumes near-orthogonal imaging with square (isotropic) pixels; if minor perspective/distortion exists, camera calibration is applied for prior correction.
After obtaining , for each detected seed instance (category seed), contours are extracted within its detection bounding box using the Otsu method. These are then processed through Gaussian smoothing, Sobel gradient detection, and sub-pixel edge fitting to derive the pixel-domain metrics within its detection bounding box. The corresponding physical domain quantities are converted according to the following Equation 9:
where denote seed length and width (mm), denotes area (), and denotes perimeter (mm); The superscript (s) denotes seed-related quantities.
Roundness is a scale-invariant property and can be computed equivalently in both the pixel domain and the physical domain. The calculation process is shown in Equation 10.
where A,P must be taken from the same measurement domain; C reflects the degree of circularity of the contour (C ā (0,1]).
To evaluate measurement uncertainty, this paper employs a first-order error propagation approximation, as shown in Equation 11.
where is the estimated scale, is the pixel-domain length error caused by sub-pixel edge localization, and is the standard deviation of the scale estimate. This equation quantifies the combined uncertainty contribution from segmentation boundary and scale estimation noise to the physical-domain length.
4 Experiments
4.1 Experimental environment and parameters
This experiment leverages the PyTorch framework and utilizes a Quadro RTX 8000 GPU (48 GB VRAM, 672 GB/s bandwidth, 4608 CUDA cores) under CUDA 12.6 for accelerated training. The segmentation model uses a uniform input size of 1080 Ć 720 with a batch size of 8. The optimizer operates in auto mode with an initial learning rate of 0.01. The classification model employs an input size of 3 Ć 224 Ć 224 with a batch size of 64, trained for 50 epochs. The optimizers include SGD and Adam, with an initial learning rate of 0.001.
4.2 Experimental evaluation metrics
To comprehensively evaluate the performance of the proposed model in rice seed detection and classification tasks, this paper constructs a multidimensional evaluation metric system focusing on accuracy, robustness, and computational complexity. The detection task primarily assesses the modelās ability to accurately identify the location of rice seed targets, while the classification task emphasizes the modelās capability to distinguish between different rice seed varieties or grades. All evaluation metrics are calculated based on an independent test set, with specific definitions and calculation formulas as follows.
(1) Model Complexity: To measure model lightweight nature and computational overhead, the following metrics are calculated: Parameters (Params): Total number of trainable parameters in the model; GFLOPs (Giga Floating Point Operations per Second): The floating-point computation required for forward inference on a single image, as shown in Equation 12.
where Clin and Clout denote the input and output channel counts of the lth convolutional layer, respectively; Klis the convolution kernel size; HlĆ Wlrepresents the spatial resolution of the feature map at that layer; and L is the total number of convolutional layers.
(2)Object detection metrics: The quality of bounding box predictions is evaluated using three metricsāPrecision (P), Recall (R), and Mean Average Precision (mAP) (). The calculation processes are shown in Equations 13ā15, respectively.
In Equation 13, TP denotes the number of samples predicted as positive and actually positive (true positives), while FP denotes the number of samples predicted as positive but actually negative (false positives); In Equation 14, FN denotes missed samples (false negatives). For detection tasks, the definitions of TP, FP, and FN depend on whether the Intersection over Union (IoU) between predicted and ground-truth bounding boxes exceeds a set threshold (e.g., 0.5).
where N is the total number of target classes, and Pi(Ri) denotes the precision-recall (PR) curve for the ith class. This paper reports two metrics: mAP@0.5 (IoU threshold of 0.5) and mAP@0.5:0.95 (averaging samples from 0.5 to 0.95), reflecting detection performance under lenient and stringent conditions, respectively.
(3) Image Classification Metrics: To evaluate the modelās discriminative capability for rice variety classification, we introduce Accuracy and F1 Score [where Precision (P) and Recall (R) are defined in (13) and (14)]. Accuracy is defined as shown in Equation 16.
where TN denotes the number of samples correctly classified as negative. This metric measures the proportion of correctly classified samples across all categories. To further evaluate the modelās performance in positive class recognition, the F1 score is introduced as shown in Equation 17.
F1 combines precision and recall, serving as their harmonic mean and being well-suited for evaluating models in scenarios with class imbalance. For multi-class classification tasks, the macro-average strategy is employed: P, R, and F1 are calculated separately for each class, and their arithmetic mean is taken to fairly reflect the importance of each class. Distinction: While Precision and Recall share identical calculation methods, their meanings and emphasis differ across tasks: In object detection, these metrics evaluate how well detection boxes overlap with targets, prioritizing spatial accuracy and false negative rates. In classification tasks, they measure a modelās ability to distinguish between categories, particularly crucial for identifying intermediate, adjacent classes.
4.3 YOLOv11-LA lightweight model improvement and ablation experiments
To reduce computational and memory overhead while maintaining detection accuracy, this paper proposes the lightweight detection network YOLOv11-LA based on the YOLOv11n baseline. The design focuses on four orthogonal structural optimizations: (i) replacing part of the standard convolutions with Depthwise Separable Convolution (DWConv+PWConv) to reduce parameters and FLOPs; (ii) streamlining the C3k2 feature extraction unit and simultaneously narrowing channel width to suppress redundant computation (Slim); (iii) introducing CBAM attention in the detection head to enhance the representation of key regions; and (iv) imposing a maximum-channel cap (512 channels) on the widest layers to further control model size.
To quantify how each strategy contributes to the performanceāefficiency trade-off, we constructed seven ablation configurations (TableĀ 4). A denotes the original YOLOv11n baseline. B (YOLOv11n-DW) isolates the effect of DWConv by only replacing the corresponding standard convolutions in A. C (YOLOv11n-Slim) keeps the convolution type unchanged but simplifies the C3k2 blocks and compresses channels, so that the impact of structural slimming on accuracy and complexity can be observed independently. D (YOLOv11n-Attn) inserts CBAM modules into the detection head on top of A, leaving the backbone unchanged, which isolates the contribution of attention. E (YOLOv11n-SlimAttn) combines the Slim backbone in C with the attention mechanism in D to investigate the interaction between compression and attention under a low-computation regime. F (YOLOv11n-Cap) applies only the maximum-channel cap to the baseline A, without DWConv, Slim, or attention, to isolate the influence of the channel cap itself on model capacity and efficiency. Finally, G (YOLOv11-LA) integrates all the above optimizationsāDWConv, Slim C3k2 blocks with channel compression, CBAM attention, and the channel capāto obtain the final lightweight model.
TableĀ 4
| Algorithm | P (%) | R (%) | mAP@0.5 | mAP@0.5:0.95 | GFLOPs | Parameters |
|---|---|---|---|---|---|---|
| A(YOLOv11n) | 98.83 ± 0.23 | 99.55 ± 0.19 | 99.50 ± 0.12 | 91.16 ± 0.30 | 6.4 | 2,590,230 |
| B(YOLOv11n-DW) | 98.51 ± 0.24 | 99.37 ± 0.22 | 99.50 ± 0.14 | 90.69 ± 0.31 | 5.8 | 2,439,606 |
| C(YOLOv11n-Slim) | 97.60 ± 0.28 | 99.07 ± 0.26 | 98.43 ± 0.20 | 82.09 ± 0.48 | 3.3 | 942,814 |
| D(YOLOv11n-Attn) | 99.79 ± 0.12 | 99.72 ± 0.15 | 99.49 ± 0.12 | 92.89 ± 0.27 | 6.5 | 2,569,434 |
| E(YOLOv11n-SlimAttn) | 98.38 ± 0.23 | 99.46 ± 0.21 | 99.45 ± 0.13 | 92.41 ± 0.29 | 3.4 | 992,994 |
| F(YOLOv11n-Cap) | 97.10 ± 0.11 | 98.50 ± 0.12 | 99.40 ± 0.10 | 92.40 ± 0.13 | 3.3 | 942,789 |
| G(YOLOv11-LA) | 99.15 ± 0.18 | 99.67 ± 0.16 | 99.50 ± 0.12 | 93.06 ± 0.25 | 3.1 | 953,682 |
Ablation study results of different configurations of YOLOv11-LA on rice seed detection (values reported as mean ± std).
As shown in TableĀ 4, B significantly reduces computational and parameter overhead (GFLOPs drop from 6.4 to 5.8, i.e., a 9.4% reduction; parameters decrease from 2.59M to 2.44M) with almost no loss in detection accuracy (mAP@0.5 remains at 99.50%). C further compresses the model to 0.94M parameters and 3.3 GFLOPs (48.4% fewer FLOPs than A), but causes a noticeable drop in mAP@0.5:0.95 (from 91.16% to 82.09%), indicating that overly aggressive structural slimming alone harms localization and scale regression of dense small objects. D shows that CBAM attention mainly improves accuracy: compared with A, YOLOv11n-Attn slightly increases complexity (GFLOPs from 6.4 to 6.5), but boosts mAP@0.5:0.95 by 1.73 percentage points (from 91.16% to 92.89%), confirming that attention is beneficial even without compression.
The additional configuration F highlights the isolated effect of the channel cap. Compared with the baseline A, YOLOv11n-Cap achieves a substantial reduction in complexity (GFLOPs from 6.4 to 3.3, i.e., a 48.4% reduction; parameters from 2.59M to 0.94M, a 63.6% reduction), while maintaining high detection performance: mAP@0.5 only decreases slightly (from 99.50% to 99.40%), and mAP@0.5:0.95 even improves from 91.16% to 92.40%. Under a similar computational cost to C, F therefore provides much better overall detection quality (mAP@0.5:0.95 improves from 82.09% to 92.40%), indicating that redistributing capacity via a channel cap is more favorable than pure structural slimming.
The combined configurations E and G further reveal the interaction among these modules. Adding CBAM to the slimmed model (E) recovers most of the accuracy loss of C: mAP@0.5:0.95 is increased from 82.09% to 92.41%, while GFLOPs remain at only 3.4 and parameters below 1.0M. On this basis, integrating DWConv and the channel cap in G further improves the trade-off: YOLOv11-LA achieves mAP@0.5 of 99.50% and mAP@0.5:0.95 of 93.06% with only 3.1 GFLOPs and 0.95M parameters, corresponding to a 51.6% reduction in computation and about a 63.2% reduction in parameters compared with the baseline A, while also increasing mAP@0.5:0.95 by 1.90 percentage points. These results demonstrate that under dense, small-object and occlusion-prone scenarios, each lightweighting strategy contributes in a complementary way, and their combination in YOLOv11-LA maintains or even improves detection accuracy while significantly reducing model size and computational cost, making it well-suited for edge deployment.
4.4 Comparison experiment design
4.4.1 Detection model comparison experiment
To comprehensively evaluate the performance of the proposed lightweight improved network YOLOv11-LA, we trained and validated five object detection models on the rice seed detection dataset: YOLOv5n, YOLOv8n, YOLOv10n, YOLOv11n, and the enhanced YOLOv11-LA. All models were trained with identical parameter settings and underwent three independent experimental runs to ensure result stability and reproducibility. Experimental results are shown in TableĀ 5.
TableĀ 5
| Metric | YOLOv5n | YOLOv8n | YOLOv10n | YOLOv11n | YOLOv11-LA |
|---|---|---|---|---|---|
| Precision | 98.43 ± 0.22 | 98.00 ± 0.25 | 97.31 ± 0.27 | 98.83 ± 0.23 | 99.15 ± 0.18 |
| Recall | 98.59 ± 0.24 | 98.82 ± 0.22 | 95.55 ± 0.35 | 99.55 ± 0.19 | 99.67 ± 0.16 |
| mAP@0.5 | 99.42 ± 0.14 | 99.47 ± 0.13 | 99.05 ± 0.16 | 99.55 ± 0.12 | 99.50 ± 0.12 |
| mAP@0.5:0.95 | 91.37 ± 0.28 | 93.06 ± 0.26 | 91.81 ± 0.30 | 91.16 ± 0.30 | 93.06 ± 0.25 |
| GFLOPs | 7.2 | 8.2 | 8.4 | 6.4 | 3.1 |
| Parameters | 2,508,854 | 3,011,238 | 2,707,820 | 2,590,230 | 953,682 |
Comparison of results from each model in the contrast experiment (values reported as mean ± std).
As shown in TableĀ 5, YOLOv11-LA demonstrates superior performance at both common IoU thresholds, outperforming all comparison models. At IoU=0.5, YOLOv11-LA achieves mAP improvements of 0.08%, 0.03%, 0.45%, and -0.05% compared to YOLOv5n, YOLOv8n, YOLOv10n, and YOLOv11n, respectively. Although numerically close to YOLOv11n, YOLOv11-LA demonstrates a more significant advantage under the stricter mAP@0.5:0.95 metric, achieving improvements of 1.69%, 1.25%, and 1.9% over YOLOv5n, YOLOv10n, and YOLOv11n, respectively. Indicating its enhanced robustness across multiple scales and boundary conditions.
In computational complexity, YOLOv11-LA achieves 3.1 GFLOPs, reducing computational load by approximately 56.9%, 62.2%, 63.1%, and 51.6% compared to YOLOv5n, YOLOv8n, YOLOv10n, and YOLOv11n, respectively. Simultaneously, YOLOv11-LA demonstrates significant advantages in model parameter count. With 953,682 parameters, it represents only 38% of YOLOv5n (2,508,854), 31.7% of YOLOv8n (3,011,238), YOLOv10n (2,707,820) by 35.2%, and YOLOv11n (2,590,230) by 36.8%. This compression ratio of approximately 2.5 to 3 times significantly reduces memory consumption, demonstrating robust, lightweight characteristics and strong potential for edge deployment.
Although YOLOv8n exhibits good accuracy on certain categories, its parameter count and computational cost are significantly higher than YOLOv11-LA. Meanwhile, YOLOv11-LA achieves higher detection accuracy on most key categories while maintaining low complexity, demonstrating an excellent performance-complexity tradeoff. FigureĀ 9 displays the Precision-Recall curve and Recall-Confidence curve of the YOLOv11-LA model on the rice seed detection task. The model demonstrates outstanding performance across both categories (refer and rice-seed), achieving peak accuracies of 0.995 and 0.987, respectively. Its overall mAP@0.5 reaches 0.991, indicating exceptional discrimination capabilities in multi-class object recognition.
FigureĀ 9
4.4.2 Classification model comparison experiment
To comprehensively evaluate the classification performance of the RiceLCNN model, this study compared it against current mainstream deep learning classification models, including MobileNetV2 (Model A), MobileNetV3 (Model B, using small variant), Xception (Model C), ResNet50 (Model D), EfficientNetV2 (Model E), ShuffleNetV2 (Model G, using 0.5x variant) and Vision Transformer (Model H, using ViT-B/16). RiceLCNN was evaluated as the comparison model F. Specific comparison results include the number of parameters, training speed (seconds per epoch, abbreviated as āSpeedā), classification accuracy (Accuracy, abbreviated as āAccā), precision (P), recall (R), and F1 score for each model, as shown in TableĀ 6.
TableĀ 6
| Algorithm | Params | Speed (s/Ep.) | Acc (%) | P (%) | R (%) | F1 (%) |
|---|---|---|---|---|---|---|
| A (MobileNetV2) | 3,504,872 | 30.23 ± 0.41 | 85.78 ± 0.32 | 85.78 ± 0.33 | 86.53 ± 0.34 | 85.82 ± 0.31 |
| B (MobileNetV3) | 2,542,856 | 25.23 ± 0.38 | 87.77 ± 0.34 | 85.78 ± 0.33 | 86.53 ± 0.34 | 85.82 ± 0.31 |
| C (Xception) | 20,045,897 | 40.12 ± 0.47 | 88.77 ± 0.35 | 88.77 ± 0.34 | 88.95 ± 0.33 | 88.82 ± 0.32 |
| D (ResNet50) | 24,045,897 | 75.00 ± 0.50 | 87.28 ± 0.33 | 87.28 ± 0.32 | 87.57 ± 0.33 | 87.34 ± 0.32 |
| E (EfficientNetV2) | 19,045,897 | 70.21 ± 0.49 | 85.66 ± 0.30 | 85.66 ± 0.31 | 86.09 ± 0.32 | 85.75 ± 0.31 |
| F (RiceLCNN) | 527,614 | 15.19 ± 0.29 | 89.78 ± 0.36 | 89.78 ± 0.35 | 89.93 ± 0.34 | 89.81 ± 0.33 |
| G (ShuffleNetV2) | 352,042 | 14.03 ± 0.28 | 84.77 ± 0.30 | 85.88 ± 0.33 | 84.77 ± 0.30 | 84.93 ± 0.31 |
| H (Vision Transformer) | 85,806,346 | 240.03 ± 20 | 65.89 ± 0.32 | 65.70 ± 0.33 | 65.89 ± 0.30 | 65.76 ± 0.31 |
Comparison results of various classification models (values reported as mean ± std).
TableĀ 6 shows that RiceLCNN achieves the highest prediction accuracy (89.78%) among all comparison models, demonstrating outstanding classification performance. With only 527,913 parameters, RiceLCNN is considerably more lightweight than large-scale models such as ResNet50 (24,045,897) and Xception (20,045,897), giving it a pronounced advantage in resource efficiency. In terms of training efficiency, RiceLCNN also performs exceptionally well, completing a single training cycle in just 15.19 secondsāapproximately 39.8% faster than MobileNetV3-small (25.23 seconds)āfurther highlighting its effectiveness. By contrast, the Vision Transformer (ViT-B/16, Model H) exhibited substantially poorer classification performance than all CNN-based counterparts, achieving only 65.89% accuracyāsignificantly lower than RiceLCNN (89.78%) and even lightweight CNN models such as MobileNetV3 (87.77%).Despite having the largest representation capacity with 85.8M parameters, ViT was markedly less efficient, requiring about 240.03 ± 20 seconds per epoch, which is over 15 times slower than RiceLCNN. The inferior performance of ViT can be explained by several factors. First, Vision Transformers generally demand large-scale datasets to fully exploit their self-attention mechanism, while the rice seed dataset used in this study is relatively limited in both size and diversity. This makes ViT more susceptible to underfitting or unstable feature learning, especially in fine-grained classification tasks such as distinguishing visually similar seed categories. Second, unlike CNNs, ViT lacks strong inductive biases (e.g., locality and translation equivariance) that are particularly advantageous when training data are scarce. As a result, whereas CNN-based models can effectively capture the local texture and morphological cues of rice grains, ViT struggles to generalize under the same conditions.
Regarding key performance evaluation metrics, RiceLCNN achieved the highest scores across accuracy (89.78%), recall (89.93%), and F1 score (89.81%), outperforming all other comparison models. It demonstrated superior stability and robustness, particularly in negative class identification and marginally classified sample discrimination. FigureĀ 10 illustrates the accuracy and loss trends of RiceLCNN during training, validation, and testing. As shown in FigureĀ 10a, the modelās accuracy rapidly improves and stabilizes within the first 15 to 20 training epochs. The training set accuracy approaches 95%, while the validation and test set accuracies stabilize around 89% with no noticeable overfitting. The loss curve in FigureĀ 10b further validates the modelās convergence and training efficiency, with training, validation, and testing losses all rapidly decreasing and converging below 0.2 within 20 epochs.
FigureĀ 10
FigureĀ 11 visualizes RiceLCNNās classification performance on the test set. FigureĀ 11a shows the confusion matrix for nine rice grain categories. The diagonal region indicates high recognition accuracy across all categories with minimal classification error. FigureĀ 11b displays the precision-recall (PR) curves for each category. The PR curves for most categories approach the upper-right corner, indicating that the model maintains high precision while preserving high recall, demonstrating strong overall classification robustness.
FigureĀ 11
4.4.3 Public dataset evaluation and generalization ability verification
To further verify the generalization ability and classification robustness of the RiceLCNN model in different data domains, this paper selected the public rice seed image dataset provided by Srinagar, Sher-Kashmir Agricultural and Technological University (SKUAST) as an independent testing platform (). The dataset includes five typical rice varieties: Jehlum, Mushkibudji, Sr-1, Sr-2, and Sr-4, comprising a total of 4,748 high-quality images (as shown in FigureĀ 12). The dataset was collected using a high-resolution flatbed scanner (HP Scanjet 200), set to 200 dpi optical resolution and 24-bit color depth. Each image contains 24 seeds of the same rice variety, arranged randomly, with the background covered by black paper to ensure imaging consistency. All images are saved in PNG format, maximizing the preservation of grain arrangement, detailed features, and appearance differences, and presenting a certain level of image complexity and challenge.
FigureĀ 12
For training and evaluation, the dataset was divided into a training set (3,278 images), a validation set (735 images), and a test set (735 images). The test set was used for independent evaluation of the RiceLCNN model, with its classification performance shown in TableĀ 7 and the confusion matrix shown in FigureĀ 13. The results show that RiceLCNN achieves excellent performance on this public rice dataset, with recognition accuracy and recall rates for the Jehlum and Mushkibudji varieties approaching or reaching 100%, and F1 scores of 99.66% and 98.64%, respectively. The F1 scores for the remaining three classes, Sr-1, Sr-2, and Sr-4, are 94.16%, 95.59%, and 93.52%, respectively. The overall accuracy of the model is 96.32%, and the Macro average metric remains between 96.31% and 96.32%, demonstrating good generalization ability and stability.
TableĀ 7
| Rice variety | P (%) | R (%) | F1 (%) |
|---|---|---|---|
| Jehlum | 99.32 | 100.00 | 99.66 |
| Mushkibudji | 98.64 | 98.64 | 98.64 |
| Sr-1 | 94.48 | 93.84 | 94.16 |
| Sr-2 | 95.27 | 95.92 | 95.59 |
| Sr-3 | 93.84 | 93.20 | 93.52 |
| Accuracy (%) | 96.32 | ||
| Macro avg (%) | 96.31 | 96.32 | 96.32 |
Evaluation report of RiceLCNN on public datasets.
FigureĀ 13
As shown in FigureĀ 13, RiceLCNN achieved 100% accurate classification for Jehlum and Mushkibudji samples; There is some confusion between Sr series varieties, primarily between Sr-1 and Sr-2, as well as Sr-4, but the overall misclassification rate is low, indicating that the model has high discriminative ability in most categories and maintains good robustness in categories with similar phenotypic characteristics.
4.5 Implementation and deployment
To balance mobile inference efficiency and recognition accuracy, this paper constructs an integrated rice seed recognition system incorporating four key components: ālightweight detectionāfine-grained classificationāonline trackingāmorphometric measurement.ā YOLOv11-LA handles instance-level localization, RiceLCNN performs single-grain classification, DeepSORT maintains cross-frame ID consistency, and the sub-pixel measurement module outputs phenotypic metrics like length and width (FigureĀ 14). Experimental results demonstrate prediction-to-actual measurement errors within 0.1 mm.
FigureĀ 14
The system is deployed on a Jetson Orin Nano 8 GB platform (single input channel, batch = 1) with Super power mode enabled; key hardware parameters are listed in TableĀ 8. This platform employs a Unified Memory Architecture (UMA), where the GPU lacks dedicated VRAM and shares system memory with LPDDR5.
TableĀ 8
| INT8 performance (TOPS) | Memory capacity | Memory bandwidth (GB/s) | GPU memory |
|---|---|---|---|
| 67 | 8GB LPDDR5 | 102 | Unified memory |
Key specifications of Jetson Orin Nano 8GB (by power mode).
To evaluate the performance of different ādetection/classificationā combinations, we employ a unified pipeline: ādetection ā tracking ā classification ā measurement.ā To ensure comparability, all combinations use the same input, with consistent threshold settings and post-processing strategies across configurations. Reported metrics include: throughput FPS (steady-state mean ± standard deviation), end-to-end latency percentiles p50āp99, GPU memory peak, and process resident memory (RSS) peak. All tests were conducted after 5 warm-up passes, with statistics aggregated from 100 consecutive inferences. Deployment results for both input resolutions are shown in TableĀ 9.
TableĀ 9
| Pipeline | Input(px) | FPS | p50āp99(ms) | GPU mem(GB) | RSS(GB) |
|---|---|---|---|---|---|
| YOLOv11-LAāRiceLCNN | 1080Ć1080 | 14 ± 1 | 71ā85 | 0.1 | 1.3 |
| YOLOv11nāXception | 1080Ć1080 | 12 ± 1 | 80ā95 | 0.2 | 1.4 |
| YOLOv11-LAāRiceLCNN | 3200Ć3200 | 4 ± 1 | 209ā227 | 0.6 | 1.3 |
| YOLOv11nāXception | 3200Ć3200 | 2 ± 1 | 333ā362 | 1.9 | 1.4 |
Jetson Orin 8GB (batch=1) deployment metrics.
Furthermore, to characterize the speed-accuracy tradeoff, we selected YOLOv11n as a control detector alongside the YOLOv11āLA + RiceLCNN baseline. For the control classifier, we employed Xception, the second-highest performing model on this dataset after RiceLCNN combined as YOLOv11nāXception. Both approaches were evaluated under identical post-processing and evaluation protocols to highlight the impact of model size and computational load on real-time performance.
5 Discussion
Experimental results indicate differences in classification accuracy among fertilization treatments: First, 2022ā1 and 2022ā2 exhibited the most pronounced bidirectional misclassification, suggesting that grain visible phenotypes remain highly similar when both āstrawā and āenzymesā factors vary simultaneously.
Second, 2022ā6 and 2022ā7 exhibited misclassification almost exclusively between themselves, differing solely in the application of enzymes. This suggests enzymes exert marginal effects on grain appearance (primarily image-visible phenotype and color/chalkiness phenotypes), as illustrated in 11. This aligns with the established understanding that ānitrogen fertilizer primarily influences taste-related physicochemical properties, exerting limited and dose-dependent effects on appearance phenotypesā (; ; ). In contrast, the classification of 2022ā4 and 2022ā8 was nearly āpureā, both receiving combined chemical fertilizer application. This suggests chemical fertilizer treatment generates stable phenotypic signals readily captured by visual models, aligning with field evidence that āoptimized nitrogen-potassium management significantly reduces chalkiness incidence and severityā (; ).
Building upon this, we deployed a ādetection-tracking-classification-quantificationā pipeline on a Jetson Orin 8GB edge device: YOLOv11-LA serves as the front-end detector, integrated with DeepSORT for continuous instance-level ID tracking. RiceLCNN then performs fine-grained single-grain classification, coupled with sub-pixel measurement (0.1mm error) to obtain key phenotypic traits including length, width, aspect ratio, and roundness. At 1080Ć1080 input resolution, the lightweight YOLOv11-LA-RiceLCNN combination achieves a 16.7% FPS improvement over YOLOv11nāXception with reduced latency. With p50/p99 latency decreasing by approximately 11.3% and 10.5%, respectively. GPU memory and process memory usage were reduced by 50% and 7.1%, respectively. At the high-resolution input of 3200Ć3200, the lightweight combinationās advantages became even more pronounced: FPS increased from 2 to 4, p50/p99 latency decreased by approximately 37.2% and 37.3% respectively, GPU memory dropped from 1.9GB to 0.6GB (a 68.4% reduction), and RSS memory decreased by 7.1%. As shown in TableĀ 9, this demonstrates that the lightweight combination excels in high-resolution scenarios while meeting edge device online processing constraints. In rice variety identification, higher resolutions provide finer-grained texture and contour information. Furthermore, measured frame rates and resource utilization demonstrate the systemās online processing capability. It supports rapid screening and parent selection for breeding and high-throughput phenotyping, random sampling and traceability for variety admixing, and quantitative assessment of treatment effects (e.g., fertilization, crop residue incorporation, enzyme application) within the field-to-postprocessing workflow. On quality control and processing lines, thresholding rules based on length, area, roundness, and variety category can generate actionable grade labels and anomaly alerts. Leveraging DeepSORT significantly reduces duplicate counting risks, enabling flexible switching between sampling and offline verification. Furthermore, research indicates that cross-varietal recognition rates generally exceed thoseĀ of intra-varietal fertilization treatments, as shown in TableĀ 7. This suggests that the explanatory power of genotype main effects surpasses that of fertilizer efficacy main effects, aligning with findings that rice quality is jointly regulated by genotype-environment interactions, with genotype contributions often dominant (; ).
It should be noted that this study primarily covers imaging scenarios with āadhesion but minimal occlusionā; under conditions of severe overlap or strong occlusion, front-end detection may require integration with instance segmentation or geometric separation to maintain recall. Domain shifts across camera positions and lighting conditions may also cause performance fluctuations, necessitating mitigation through small-scale retraining or adaptive strategies. Concurrently, potential confounders such as soil moisture, pest/disease pressure, microclimate, and variations in harvest and imagingĀ batches may still influence phenotypic expression and model classification.
6 Conclusions and future work
This study proposes and validates an integrated intelligent rice seed recognition system encompassing detection, tracking, classification, and morphometric analysis, achieving a favorable balance between model lightweighting, recognition accuracy, and edge-deployability. It employs YOLOv11-LA as the front-end detector, utilizes DeepSORT for instance-level ID association, and leverages RiceLCNN for precise single-grain classification. Combined with sub-pixel measurement, it outputs key traits including length, width, aspect ratio, and roundness. The system operates stably on edge devices like Jetson Orin 8 and GB, enabling real-time processing for breeding screening, data collection, and quality monitoring in processing lines. A systematic analysis based on confusion matrices further indicates that, compared to fertilization treatments, variety (genotype) explains a higher proportion of seed appearance phenotypes. Among these, enzyme application alone has a marginal impact on visible phenotypes, while differences induced by chemical fertilizer treatments are more readily captured by visual models. These findings provide an efficient, stable, and engineering-feasible technical pathway for intelligent seed recognition and crop phenotyping.
Future work will focus on enhancing the systemās extrapolation capability and application depth through the following directions: (1) Incorporate multi-modal sensing (e.g., near-infrared/hyperspectral imaging) and cross-modal feature alignment to enhance recognition and quantitative characterization capabilities across diverse physiological states and environmental conditions; (2) Conduct robustness enhancement and domain adaptation studies under non-ideal natural conditions (backlighting, mud spots, strong shadows, cross-camera/cross-lighting), ensuring model robustness and interpretability through hierarchical cross-validation and uncertainty estimation; (3) Promote deep integration with field agricultural machinery and IoT nodes to construct a closed-loop āperception-decision-executionā control prototype. (4) Extend testing to multi-varietal datasets and real field environments, and explore integration with breeding programs to support large-scale phenotyping and accelerate genetic improvement pipelines. This supports online grading, anomaly removal, and adaptive adjustment of operational parameters, further advancing the digitalization and precision of agricultural production.
Statements
Data availability statement
The datasets presented in this study can be found in online repositories. The names of the repository/repositories and accessionĀ number(s) can be found below: https://github.com/5120191452/RiceLCNN.
Author contributions
DZ: Methodology, Software, Writing ā original draft. SS: Funding acquisition, Resources, Writing ā review & editing. JL: Validation, Writing ā review & editing. WX: Data curation, Resources, Writing ā review & editing. NX: Formal Analysis, Visualization, Writing ā review & editing.
Funding
The author(s) declared that financial support was received for this work and/or its publication. This work was financially supported by the Natural Science Foundation of Jilin Province (No. 20220101144JC).
Conflict of interest
The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
Generative AI statement
The author(s) declare that no Generative AI was used in the creation of this manuscript.
Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.
Publisherās note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
Supplementary material
The Supplementary Material for this article can be found online at: https://www.frontiersin.org/articles/10.3389/fpls.2025.1673143/full#supplementary-material
References
1
AukkapinyoK.SawangwongS.PooyoiP.KusakunniranW. (2019). Localization and classification of rice-grain images using region proposals-based convolutional neural network. Mach. Intell. Res.16, 185ā195. doi:Ā 10.1007/s11633-019-1207-6
2
BaoY.KangG.YangL.DuanX.ZhaoB.ZhangB. (2025). Normalizing batch normalization for long-tailed recognition. IEEE Trans. Image Process.34, 209ā220. doi:Ā 10.1109/tip.2024
3
ChenY.WangM.OuwerkerkP. B. F. (2012). Molecular and environmental factors determining grain quality in rice. Food Energy Secur.1, 111ā132. doi:Ā 10.1002/fes3.11
4
CuiS.MaX.WangX.ZhangT.-A.HuJ.TsangY. F.et al. (2019). Phenolic acids derived from rice straw generate peroxides which reduce the viability of staphylococcus aureus cells in biofilm. Ind. Crops Products140, 111561. doi:Ā 10.1016/j.indcrop.2019.111561
5
DingE.ChengY.XiaoC.LiuZ.YuW. (2021). Efficient attention mechanism for dynamic convolution in lightweight neural network. Appl. Sci.11, 3111. doi:Ā 10.3390/app11073111
6
GuoX.WangL.ZhuG.XuY.MengT.ZhangW.et al. (2023). Impacts of inherent components and nitrogen fertilizer on eating and cooking quality of rice: A review. Foods12, 2495. doi:Ā 10.3390/foods12132495
7
GuoC.ZhangL.JiangP.YangZ.ChenZ.XuF.et al. (2024). Grain chalkiness is decreased by balancing the synthesis of protein and starch in hybrid indica rice grains under nitrogen fertilization. Foods13, 855. doi:Ā 10.3390/foods13060855
8
HuoX.WangJ.ChenL.FuH.YangT.DongJ.et al. (2023). Genome-wide association mapping and gene expression analysis reveal candidate genes for grain chalkiness in rice. Front. Plant Sci.14. doi:Ā 10.3389/fpls.2023.1184276
9
JinC.ZhouX.HeM.LiC.CaiZ.ZhouL.et al. (2024). A novel method combining deep learning with the kennardāstone algorithm for training dataset selection for image-based rice seed variety identification. J. Sci. Food Agric.104, 8332ā8342. doi:Ā 10.1002/jsfa.13668
10
JocherG.ChaurasiaA.StokenA.BorovecJ.et al. (2022). ultralytics/yolov5, Vol. v6.2. doi:Ā 10.5281/zenodo.7002879
11
KarunasenaG.PriyankaraH.MadushankaB. (2020). Machine vision techniques for improve rice grain quality analyzing process. Int. J. Innovative Sci. Res. Technol.5, 1001ā1005. doi:Ā 10.38124/IJISRT20JUN691
12
KiratiratanaprukK.TemniranratP.SinthupinyoW.PrempreeP.ChaitavonK.PorntheeraphatS.et al. (2020). Development of paddy rice seed classification process using machine learning techniques for automatic grading machine. J. Sensors2020, 7041310. doi:Ā 10.1155/2020/7041310
13
KuradeC.MeenuM.KalraS.MiglaniA.NeelapuB. C.YuY.et al. (2023). An automated image processing module for quality evaluation of milled rice. Foods12, 1273. doi:Ā 10.3390/foods12061273
14
LiP.ChenY.-H.LuJ.ChangquanZ.LiuQ.-Q.LiQ.-F. (2022). Genes and their molecular functions determining seed structure, components, and quality of rice. Rice15, 18. doi:Ā 10.1186/s12284-022-00562-8
15
LiD.WenG.KuaiY.ZhuL.PorikliF. (2020). Robust visual tracking with channel attention and focal loss. Neurocomputing401, 295ā307. doi:Ā 10.1016/j.neucom.2019.10.041
16
LiangH.TaoD.ZhangQ.ZhangS.WangJ.LiuL.et al. (2021). Nitrogen fertilizer application rate impacts eating and cooking quality of rice after storage. PloS One16, e0253189. doi:Ā 10.1371/journal.pone.0253189
17
LiuQ.WuT.DengY.LiuZ. (2023). Se-yolov7 landslide detection algorithm based on attention mechanism and improved loss function. Land12, 1522. doi:Ā 10.3390/land12081522
18
Mohi Ud DinN.AssadA.DarR. A.RatherS. A.BhatM. A.MushtaqU.et al. (2024). Ricenet: A deep convolutional neural network approach for classification of rice varieties. Expert Syst. Appl.235, 121214. doi:Ā 10.1016/j.eswa.2023.121214
19
NingL.SunS.ZhouL.ZhaoN.WuJ.WangW.et al. (2023). High-throughput instance segmentation and shape restoration of overlapping vegeta ble seeds based on sim2real method. Measurement2022), 112414. doi:Ā 10.2139/ssrn.4195243
20
OtsuN. (1979). A threshold selection method from grayālevel histograms. IEEE Transact. Syst. Man Cybernet9, 62ā66. doi:Ā 10.1109/TSMC.1979.4310076
21
PawÅowskiJ.KoÅodziejM.MajkowskiA. (2024). Implementing yolo convolutional neural network for seed size detection. Appl. Sci.14, 6294. doi:Ā 10.3390/app14146294
22
PhanT.-T.-H.HoH.-T.HoangT.-N. (2023). ā Investigating yolo models for rice seed classification,ā in Lecture notes in networks and systems (Cham, Switzerland: Springer), 181ā192. doi:Ā 10.1007/978-3-031-25072-215
23
PhanT.-T.-H.VoT.NguyenH.-D. (2024). A novel method for identifying rice seed purity using hybrid machine learning algorithms. Heliyon. 10, e33941. doi:Ā 10.1016/j.heliyon.2024.e33941
24
QinggeL.ZhengR.ZhaoX.WeiS.YangP. (2020). An improved otsu threshold segmentation algorithm. Int. J. Comput. Sci. Eng.22, 146. doi:Ā 10.1504/IJCSE.2020.10029225
25
RajalakshmiR.FaizalS.SivasankaranS.GeethaR. (2024). Riceseednet: Rice seed variety identification using deep neural network. J. Agric. Food Res.16, 101062. doi:Ā 10.1016/j.jafr.2023.101062
26
RasheedA. F.ZarkooshM. (2025). Yolov11 optimization for efficient resource utilization. J. Supercomputing81, 1ā21. doi:Ā 10.1007/s11227-025-07520-3
27
RathnayakeN.MiyazakiA.DangT. L.HoshinoY. (2023). Age classification of rice seeds in Japan using gradient-boosting and anfis algorithms. Sensors23, 2828. doi:Ā 10.3390/s23052828
28
ShafikW.TufailA.Liyanage De SilvaC.Awg Haji Mohd ApongR. A. (2025). A novel hybrid inceptionāxception convolutional neural network for efficient plant disease classification and detection. Sci. Rep.15, 82857. doi:Ā 10.1038/s41598-024-82857-y
29
SharmaK.SethiG.BawaR. (2024). A comparative analysis of deep learning and deep transfer learning approaches for identification of rice varieties. Multimedia Tools Appl.84, 6825ā6842. doi:Ā 10.1007/s11042-024-19126-7
30
ShiS.ZhangG.LiL.ChenD.LiuJ.CaoC.et al. (2022). Effects of nitrogen fertilizer on the starch structure, protein distribution, and quality of rice. ACS Food Sci. Technol.2, 1347ā1354. doi:Ā 10.1021/acsfoodscitech.2c00155
31
SunC.LiuT.JiC.JiangM.TianT.GuoD.et al. (2014). Evaluation and analysis of rice chalkiness by image processing. J. Cereal Sci.59, 12ā18. doi:Ā 10.1016/j.jcs.2014.04.009
32
WangA.ChenH.LiuL.ChenK.LinZ.HanJ.et al. (2024a). Yolov10: Real-time end-to-end object detection. arXiv.
33
WangJ.LiS.AnZ.JiangX.QianW.JiS. (2019). Batch-normalized deep neural networks for achieving fast intelligent fault diagnosis of machines. Neurocomputing329, 53ā65. doi:Ā 10.1016/j.neucom.2018.10.049
34
WangC.-Y.YehI.-H.LiaoH.-Y. M. (2024b). Yolov9: Learning what you want to learn using programmable gradient information. arXiv. doi:Ā 10.48550/ARXIV.2402.13616
35
WenG.LiM.TanY.ShiC.LuoY.LuoW. (2025). Enhanced yolov8 algorithm for leaf disease detection with lightweight gocr-elan module and loss function: Wsiou. Comput. Biol. Med.186, 109630. doi:Ā 10.1016/j.compbiomed.2024.109630
36
WooS.ParkJ.LeeJ.-Y.KweonI. (2018). Cbam: Convolutional block attention module (Cham, Switzerland: Springer). doi:Ā 10.48550/arXiv.1807.06521
37
YanF.SunY.XuH.YinY.WangH.WangC.et al. (2018). Effects of wheat straw mulch application and nitrogen management on rice root growth, dry matter accumulation and rice quality in soils of different fertility. Paddy Water Environ.16, 507ā518. doi:Ā 10.1007/s10333-018-0643-1
38
YanZ.WuY.ZhaoW.ZhangS.LiX. (2025). Research on an apple recognition and yield estimation model based on the fusion of improved yolov11 and deepsort. Agriculture15, 765. doi:Ā 10.3390/agriculture15070765
39
YangD.WangY.WuQ. (2023). Impact of tillage and straw management on soil properties and rice yield in a rice-ratoon rice system. Agronomy13, 1762. doi:Ā 10.3390/agronomy13071762
40
YuJ.ZhuD.ZhengX.ShaoL.FangC.YanQ.et al. (2023). The effects of genotype Ć environment on physicochemical and sensory properties and differences of volatile organic compounds of three rice types (oryza sativa l.). Foods12, 3108. doi:Ā 10.3390/foods12163108
41
ZhangX.LiY.DongJ.SunY.FuH. (2025). Split application of potassium reduces rice chalkiness by regulating starch accumulation process under high temperatures. Agronomy15, 116. doi:Ā 10.3390/agronomy15010116
42
ZhaoJ.MaY.YongK.ZhuM.WangY.WangX.et al. (2023). Rice seed size measurement using a rotational perception deep learning model. Comput. Electron. Agric.205, 107583. doi:Ā 10.1016/j.compag.2022.107583
43
ZhouL.LiangS.PonceK. S.MarundonS.YeG.LiJ. (2018). Effects of cultivar, nitrogen rate, and planting density on rice-grain quality. Agronomy8, 246. doi:Ā 10.3390/agronomy8110246
Summary
Keywords
YOLOv11-LA, RiceLCNN, rice seeds, object detection, classification
Citation
Zhang D, Song S, Liu J, Xu W and Xiayidan N (2025) Real-time segmentation and phenotypic analysis of rice seeds using YOLOv11-LA and RiceLCNN. Front. Plant Sci. 16:1673143. doi: 10.3389/fpls.2025.1673143
Received
30 July 2025
Revised
10 November 2025
Accepted
20 November 2025
Published
08 December 2025
Volume
16 - 2025
Edited by
Chengcheng Chen, Shenyang Aerospace University, China
Reviewed by
Zhenping Qiang, Southwest Forestry University, China
Guodong Sun, Beijing Forestry University, China
Xiaofei Fan, Hebei Agricultural University, China
Updates
Copyright
Ā© 2025 Zhang, Song, Liu, Xu and Xiayidan.
This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
*Correspondence: Weiwei Xu, xuww@jlenu.edu.cn
Disclaimer
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article or claim that may be made by its manufacturer is not guaranteed or endorsed by the publisher.