Submitted:
01 May 2025
Posted:
08 May 2025
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Rice Image Data Collection
2.1. Image Acquisition Platform
2.2. Image Acquisition Platform
2.2.1. Grayscale Transformation of Rice Images
2.2.2. Rice Image Denoising
2.2.3. Rice Image Segmentation
2.2.4. Morphological Processing of Rice Images
3. Methods for Inspecting the Appearance Quality of Rice
3.1. Rice Detection Based on Image Processing
3.1.1. Detection Method Based on Area Threshold for Whole Kernel Rate
3.1.2. Method for Detecting the Rate of Yellow Grains in Rice Based on Color Threshold
3.1.3. Grayscale Threshold-Based Detection Method for Rice Chalkiness
3.2. Training the YOLOv8 Object Detection Model
3.2.1. Comparison of YOLOv8 Model with Other Different Models
4. Based on YOLOv8 Rice Appearance Quality Inspection Test
5. Conclusions
- To address the issue of low efficiency and high error rates in traditional manual appearance inspection of rice, a rice detection method based on the YOLOv8 object detection model has been proposed. By comparison, the weighted average gray value transformation method, median filtering denoising method, and fixed threshold segmentation method were selected for image preprocessing and use threshold segmentation and watershed algorithms to solve the problem of grain adhesion in rice images. The whole grain was detected based on the YOLOv8 detection model. This study proposes a method for area detection to detect whole rice based on the YOLOv8 detection model. Moreover, this study examines rice detection from three aspects: area threshold, color threshold, and grayscale threshold. Finally, comparative experiments confirmed the effectiveness and feasibility of the method, enabling precise and non-destructive testing of rice;
- This study proposes a rice quality detection method based on image processing and deep learning. By extracting rice features and detecting based on the YOLOv8 detection model, using area threshold, color threshold, and grayscale threshold methods, the accuracy rate for whole grain rice is 91%, for yellow grain rice is 87%, and for chalky rice is 84%. The YOLOv8 detection model has better detection performance;
- This study conducted 100 sets of comparative experiments, with manual inspection results showing a whole grain rate of 59.80%, a milling rate of 78.10%, a mold rate of 4.32%, a chalkiness degree of 11.00%, and a grade of second-class indica rice. The detection results based on the YOLOv8 model show a whole grain rate of 59.10%, a milling rate of 77.30%, a mold rate of 4.20%, a chalkiness degree of 12.00%, and a grade of second-class indica rice. The results are basically consistent with manual detection, and the detection is fast and accurate.
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Zhou, J.; Zeng, S.; Chen, Y.; Kang, Z.; Li, H.; Sheng, Z. A Method of Polished Rice Image Segmentation Based on YO-LACTS for Quality Detection. Agriculture 2023, 13. [CrossRef]
- Teng, M.; Duan, X.; Feng, R.; Zhang, D.; Guo, W.; Sun, H.; Liu, X. Effects of Harvest Time on Grinding Quality, Appearance Quality and Physical and Chemical Quality of Japonica Rice. Foods 2024, 13. [CrossRef]
- Fan, P.; Xu, J.; Wei, H.; Liu, G.; Zhang, Z.; Tian, J.; Zhang, H. Recent Research Advances in the Development of Chalkiness and Transparency in Rice. Agriculture 2022, 12. [CrossRef]
- Zhao, C.; Liu, G.; Chen, Y.; Jiang, Y.; Shi, Y.; Zhao, L.; Liao, P.; Wang, W.; Xu, K.; Dai, Q.; et al. Excessive Nitrogen Application Leads to Lower Rice Yield and Grain Quality by Inhibiting the Grain Filling of Inferior Grains. Agriculture 2022, 12. [CrossRef]
- Ogawa, Y. Chapter 17 - Quality Evaluation of Rice. In Computer Vision Technology for Food Quality Evaluation (Second Edition), Sun, D.-W., Ed.; Academic Press: San Diego, 2016; pp. 413-437.
- Ni, P.; Hu, S.; Zhang, Y.; Zhang, W.; Xu, X.; Liu, Y.; Ma, J.; Liu, Y.; Niu, H.; Lan, H. Design and Optimization of Key Parameters for a Machine Vision-Based Walnut Shell–Kernel Separation Device. Agriculture 2024, 14. [CrossRef]
- Feng, Y.; Zhao, X.; Tian, R.; Liang, C.; Liu, J.; Fan, X. Research on an Intelligent Seed-Sorting Method and Sorter Based on Machine Vision and Lightweight YOLOv5n. Agronomy 2024, 14. [CrossRef]
- Jiang, L.; Chen, W.; Shi, H.; Zhang, H.; Wang, L. Cotton-YOLO-Seg: An Enhanced YOLOV8 Model for Impurity Rate Detection in Machine-Picked Seed Cotton. Agriculture 2024, 14. [CrossRef]
- Li, X.; Xu, S.; Zhang, W.; Wang, J.; Li, Y.; Peng, B.; Sun, R. Research on the Detection Method of the Threshing Rate of Corn Ears Based on Machine Vision. Agriculture 2024, 14. [CrossRef]
- Fabiyi, S.D.; Vu, H.; Tachtatzis, C.; Murray, P.; Harle, D.; Dao, T.K.; Andonovic, I.; Ren, J.; Marshall, S. Varietal Classification of Rice Seeds Using RGB and Hyperspectral Images. IEEE Access 2020, 8, 22493-22505. [CrossRef]
- Zhang, R.; Liu, T.; Liu, W.; Yuan, C.; Seng, X.; Guo, T.; Wang, X. YOLO-CRD: A Lightweight Model for the Detection of Rice Diseases in Natural Environments. Phyton 2024, 93, 1275-1296. [CrossRef]
- Yang, L.; Liu, C.; Wang, C.; Wang, D. Maize Kernel Quality Detection Based on Improved Lightweight YOLOv7. Agriculture 2024, 14. [CrossRef]
- Guo, J.; Xiao, X.; Miao, J.; Tian, B.; Zhao, J.; Lan, Y. Design and Experiment of a Visual Detection System for Zanthoxylum-Harvesting Robot Based on Improved YOLOv5 Model. Agriculture 2023, 13. [CrossRef]
- Li, X.; Niu, W.; Yan, Y.; Ma, S.; Huang, J.; Wang, Y.; Chang, R.; Song, H. Detection of Broken Hongshan Buckwheat Seeds Based on Improved YOLOv5s Model. Agronomy 2023, 14. [CrossRef]
- Li, R.; Li, Y.; Qin, W.; Abbas, A.; Li, S.; Ji, R.; Wu, Y.; He, Y.; Yang, J. Lightweight Network for Corn Leaf Disease Identification Based on Improved YOLO v8s. Agriculture 2024, 14. [CrossRef]
- Wang, C.; Wang, H.; Han, Q.; Zhang, Z.; Kong, D.; Zou, X. Strawberry Detection and Ripeness Classification Using YOLOv8+ Model and Image Processing Method. Agriculture 2024, 14. [CrossRef]
- Yin, J.; Huang, P.; Xiao, D.; Zhang, B. A Lightweight Rice Pest Detection Algorithm Using Improved Attention Mechanism and YOLOv8. Agriculture 2024, 14. [CrossRef]
- Amin, J.; Anjum, M.A.; Zahra, R.; Sharif, M.I.; Kadry, S.; Sevcik, L. Pest Localization Using YOLOv5 and Classification Based on Quantum Convolutional Network. Agriculture 2023, 13. [CrossRef]
- Xiaofei, F.; Linbai, W.; Jingyan, L.; Yuhong, Z.; Jun, Z.; Xuesong, S. Corn seed appearance quality estimation based on improved YOLO v4. Transactions of the Chinese Society for Agricultural Machinery 2022, 53, 226-233.
- Xiangyou, W.; Yanxing, L.; Zhenyu, Y.; M, Z.; RM, W.; LX, C. Detection method of clods and stones from impurified potatoes based on improved YOLO v4 algorithm. Transactions of the Chinese Society for Agricultural Machinery 2021, 52, 241-247.
- Fang, L.; Yukun, L.; Sen, L.; Wenzhong, G.; Fan, X.; Bai, Z. Fast recognition method for tomatoes under complex environments based on improved YOLO. Transactions of the Chinese society for agricultural machinery 2020, 51, 229-237.
- de Magalhães, L.P.; Rossi, F. Use of Indices in RGB and Random Forest Regression to Measure the Leaf Area Index in Maize. Agronomy 2024, 14. [CrossRef]
- S. S, R.; Nair, R.R.; Kumar, E.R. An Efficient Low Complexity Denoising Filter Architecture for the Removal of Salt and Pepper Noise. In Proceedings of the 2022 3rd International Conference on Smart Electronics and Communication (ICOSEC), 20-22 Oct. 2022, 2022; pp. 476-481.
- Yun, L.; Yiming, W.; Ming, S.; xiaochao, Z. Chalky White Rice Image Detection Method Based on Fractal Dimension. Transactions of the Chinese Society for Agricultural Machinery 2005, 36, 92-95.
- Yanhong, W.; Muhua, L.; Jun, Y.; Huadong, Z. Rice Outer-quality Inspection Based on Computer Vision. Transactions of the Chinese Society for Agricultural Machinery 2007, 38, 107-111. [CrossRef]















| Network model | mPrecision/% | mRecall/% | mF1/% |
|---|---|---|---|
| YOLOv3 | 0.553 | 0.552 | 0.552 |
| YOLOv5 | 0.652 | 0.652 | 0.652 |
| YOLOv7 | 0.778 | 0.780 | 0.780 |
| YOLOv8 | 0.912 | 0.915 | 0.912 |
| The number of iterations | 5 | 30 | 80 | 130 | 180 | 230 | 280 |
|---|---|---|---|---|---|---|---|
| Accuracy | 0.02548 | 0.57686 | 0.79765 | 0.84065 | 0.84259 | 0.86379 | 0.87091 |
| Recall | 0.25706 | 0.82675 | 0.89876 | 0.8878 | 0.8857 | 0.89374 | 0.8897 |
| mAP@0.5 | 0.08084 | 0.70734 | 0.88633 | 0.91777 | 0.9128 | 0.90258 | 0. 89766 |
| project | Chalky grains | Whole grains | Broken grains | Moldy grains | Under-cooked grains | Yellow grains | mAP@0.5 |
|---|---|---|---|---|---|---|---|
| Training set | 0.758 | 0.943 | 0.835 | 0.972 | 0.989 | 0.978 | 0.912 |
| Test set | 0.798 | 0.945 | 0.875 | 0.971 | 0.982 | 0.988 | 0.927 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).