Abstract
Rice quality estimation is a critical process with significant food safety and socio-economic implications. Traditionally, this task has relied on manual inspection, which is prone to subjectivity and human error. This paper presents an automated visual quality estimation system designed to classify rice kernels by defect type and evaluate quality through weight ratios. To address challenges such as imbalanced data and kernels with multiple defects, we propose a multi-stage workflow that utilizes deep learning for localization and classification. Furthermore, we introduce a novel "weight-per-pixel" metric to estimate the relative weight of kernels from 2D images. Experimental results demonstrate that the system achieves high precision in a contactless manner, offering a robust alternative to manual sorting.
Introduction
Rice grading is a high-stakes agricultural task that directly influences market pricing and consumer safety. Quality is typically determined by the presence of defects such as chalkiness, spotting, or breakage. However, manual inspection is labor-intensive and inconsistent. While computer vision offers a potential solution, two primary technical hurdles have persisted: the accurate classification of "dual-defect" kernels (e.g., a grain that is both broken and chalky) and the estimation of physical weight from two-dimensional image data.
This research addresses these challenges by integrating a specialized hardware environment with a multi-stage deep learning architecture and a class-specific density metric to provide a comprehensive, automated grading solution.
System Methodology
Hardware Configuration
To ensure high-quality data acquisition, the authors developed a controlled imaging environment. This setup includes a specialized imaging box equipped with a white dome light to provide uniform, shadowless illumination. A non-reflective black mat serves as the background, maximizing the contrast of the rice kernels and ensuring that internal structures, such as chalkiness and glossiness, are clearly visible to the sensor.
Multi-Stage Classification Workflow
Rather than employing a single monolithic model, the system utilizes a branched architecture to handle the nuances of different defect types:
- Branch A (General Defects): A YOLOv5 model is trained to identify and localize "Sound" (undamaged), "Broken," "Spotted," and "Yellow-Colored" kernels using standard color imagery.
- Branch B (Chalky Defects): Recognizing that color can sometimes obscure internal grain structures, the system converts images to grayscale for chalkiness detection. A second YOLOv5 model locates these kernels, followed by a ResNeXt classifier that distinguishes between "Partial-Chalky" (PC) and "Mass-Chalky" (MC) categories.
- Fusion and Multi-Label Handling: The results from both branches are merged. If a kernel is identified by both branches, it is assigned "dual properties." This allows the system to accurately categorize complex grains without requiring a separate class for every possible defect combination, which helps mitigate the "long tail" data problem during training.
Weight-per-Pixel Metric
In the rice industry, quality is measured by weight ratios rather than simple counts. To bridge the gap between 2D pixel area and physical mass, the researchers introduced the weight-per-pixel metric ($\rho_t$). By pre-calculating the average density (mass divided by projected 2D area) for each specific defect type, the system can estimate the weight of an individual kernel by multiplying its segmented area by its class-specific density. This approach accounts for the fact that different defects (like chalkiness or breakage) significantly alter the density and transparency of the grain.
Experimental Setup and Results
Dataset
The system was trained and validated on a custom dataset of 322 high-resolution images. Each image contains between 40 and 80 kernels, all of which were manually labeled by professional quality inspectors. The dataset covers six primary categories: Sound (SO), Partial-Chalky (PC), Mass-Chalky (MC), Yellow-Colored (YC), Spotted (SP), and Broken (BR).
Performance Metrics
The system was evaluated using 5-fold cross-validation, yielding the following results:
- Classification Precision: The model achieved over 90% precision for Sound, Broken, Yellow, and Spotted kernels. The dedicated grayscale branch significantly improved the recall for Mass-Chalky kernels compared to standard single-stage baselines.
- Weight Estimation Accuracy: The mean error for weight ratio estimation remained under 2% across all defect categories, with a maximum error threshold of less than 3%.
- Efficiency: The automated, contactless nature of the system allows for rapid processing, significantly reducing the time required compared to manual weighing and sorting.
Discussion and Conclusion
The research highlights two critical insights: first, that grayscale processing is superior for identifying internal chalky structures; and second, that class-specific density is essential for accurate weight estimation from 2D images.
While the system is highly effective, current limitations include a reliance on fixed camera geometry and the requirement that kernels be relatively spread out to avoid overlaps. Future work will focus on improving segmentation algorithms to handle clumped kernels and expanding the dataset to include a wider variety of rice cultivars. Overall, this multi-stage vision system provides a precise, objective, and efficient tool for the global rice industry.
Summary updated