Computer vision algorithms for characterizing and classifying agro-exportable grains through size analysis and clustering techniques in Peru's agricultural sector

Authors

DOI:

https://doi.org/10.51798/sijis.v6i4.1066

Keywords:

Algorithms, Agroindustry, Classification, Computer Vision, Hyperspectral Vision

Abstract

Introduction: The implementation of machine learning and deep learning algorithms has revolutionized quality control processes in the agroindustry, providing precise and efficient solutions for grain classification and evaluation. The use of computer vision, combined with advanced algorithms, enables defect detection, measurement of physical characteristics, and optimization of batch standardization for both domestic and international markets. Objective: To review and analyze the application of ML algorithms in grain classification through digital image processing, comparing their accuracy, efficiency, and processing time to identify the most suitable strategy for productive environments. Materials and Methods: A systematic review was conducted in Scopus, IEEE Xplore, ScienceDirect, and MDPI, considering publications from 2017 to 2024. Inclusion criteria were: use of RGB or hyperspectral images, application of CNN, SVM, K-means, or Random Forest algorithms, and reporting of quantitative metrics. Review articles, studies not applied to grains, or those without experimental validation were excluded. Results and Conclusions: CNN achieved the highest accuracy (≈97%), making it ideal for detailed classification, although it requires high computational resources and longer training times. SVM and Random Forest demonstrated a balance between accuracy (≈91–92%) and efficiency, making them suitable for medium-sized datasets. K-means stood out for its speed and simplicity, although with lower accuracy (≈88%) as it is an unsupervised method. Emerging trends point to the integration of hyperspectral vision, transfer learning, and hybrid approaches to optimize the balance between accuracy, speed, and operational feasibility, thereby enhancing the competitiveness of the agroindustry in global markets.

References

Adrah, K., Adrah, K., Ananey-Obiri, D., Ananey-Obiri, D., Tahergorabi, R., & Tahergorabi, R. (2021). Sweet potato starch and a protein-based edible coating minimize the fat-uptake in deep-fat fried chicken. Cyta-Journal of Food. https://doi.org/10.1080/19476337.2021.1914736

Alshahrani, H. M., Saeed, M. K., Alotaibi, S. S., Mohamed, A., Assiri, M., & Ibrahim, S. S. (2023). Quantum-Inspired Moth Flame Optimizer Enhanced Deep Learning for Automated Rice Variety Classification. IEEE Access. https://doi.org/10.1109/access.2023.3330918

Ardeshirifar, R. (2024). Automated Classification of Dry Bean Varieties Using XGBoost and SVM Models. http://arxiv.org/abs/2408.01244

Asif, M. J., Khan, H., Tehseen, R., Tahir, S., Rizvi, H., Asad, M., Saqib, S., & Ahmad, R. F. (2025). Exploring Convolutional Neural Networks for Rice Grain Clas-sification: An Explainable AI Approach. https://doi.org/10.3390/xxxxx

Avila-George, H., De-La-Torre, M., Sánchez-Garcés, J., Quispe, J. J. C., Prieto, J. M., & Castro, W. (2023). Discrimination of foreign bodies in quinoa (Chenopodium quinoa Willd.) grains using convolutional neural networks with a transfer learning approach. PeerJ, 11. https://doi.org/10.7717/peerj.14808

Bordas, A., Bordas, A., Zhang, J., Zhang, J., Nino, J. C., & Nino, J. C. (2022). Application of Deep Learning Workflow for Autonomous Grain Size Analysis. Molecules. https://doi.org/10.3390/molecules27154826

Bordas, A., Zhang, J., & Nino, J. C. (2022). Application of Deep Learning Workflow for Autonomous Grain Size Analysis. Molecules, 27(15). https://doi.org/10.3390/molecules27154826

Breiman, L. (2001). Random Forests. Machine Learning, 45(1), 5–32. https://doi.org/10.1023/A:1010933404324

Busi, R. A., Prasanna, V., Bhavana, S. S. L., Kishore, T. Y., Santhi, V., & Sainath, Y. V. (2024). Rice Grains Detection, Classification, and Quality Prediction Using Deep Learning. International Journal for Research in Applied Science and Engineering Technology. https://doi.org/10.22214/ijraset.2024.59321

Capajaña, M. Q., & Capajaña, M. Q. (2020). Estudio de calidad física y calidad de taza de café (Coffea arabica L.) de dos zonas de cultivo de la provincia de Sandia cosecha 2019. Revista Cientifica I+D Aswan Science. https://doi.org/10.51392/rcidas.v1i1.2

Chen, Y., Bao, J., Chen, R., Li, B., Yang, Y., Renteria, L., Delgado, D., Forbes, B., Goldman, A. E., Simhan, M., Barnes, M., Laan, M., McKever, S. A., Hou, Z. J., Chen, X., Scheibe, T. D., & Stegen, J. (2024). Quantifying Streambed Grain Size, Uncertainty, and Hydrobiogeochemical Parameters Using Machine Learning Model YOLO. Water Resources Research. https://doi.org/10.1029/2023wr036456

Choi, J., Kim, S., Jin, J., Kim, J., Chang, S., & Kim, I.-S. (2025). Estimation of Sediment Grain Size Distribution Using Optical Image-Based Spatial Feature Representation Learning with Data Augmentation. Journal of Marine Science and Engineering. https://doi.org/10.3390/jmse13061108

Choudhary, A. K., Choudhary, A. K., Jansche, A., Jansche, A., Grubesa, T., Grubesa, T., Trier, F., Trier, F., Goll, D., Goll, D., Bernthaler, T., Bernthaler, T., Schneider, G., & Schneider, G. (2022). Grain size analysis in permanent magnets from Kerr microscopy images using machine learning techniques. Materials Characterization. https://doi.org/10.1016/j.matchar.2022.111790

Cinar, I., & Koklu, M. (2022). Identification of Rice Varieties Using Machine Learning Algorithms. Tarim Bilimleri Dergisi, 28(2), 307–325. https://doi.org/10.15832/ankutbd.862482

Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine Learning, 20(3), 273–297. https://doi.org/10.1007/BF00994018

Daud, M. S. H., Tabatabai, S. M., & Wong, F. K. (2024). Cascaded Machine Learning in NMR: Unveiling a Continuous Grain Size Distribution Approach for Tackling Sand Production Challenges. SPWLA 65th Annual Symposium Transactions. https://doi.org/10.30632/spwla-2024-0077

de C. Motta, I. V., Vuillerme, N., Pham, H.-H., & Pereira de Figueiredo, F. A. (2024). Machine Learning Techniques for Coffee Classification: A Comprehensive Review of Scientific Research. https://doi.org/10.20944/preprints202406.1462.v1

Dhakal, K., Sivaramakrishnan, U., Zhang, X., Belay, K., Oakes, J., Wei, X., & Li, S. (2023). Machine Learning Analysis of Hyperspectral Images of Damaged Wheat Kernels. Sensors, 23(7). https://doi.org/10.3390/s23073523

Don, H. J., Boustani, S., Yang, C., & Shanks, D. R. (2024). A grain of truth in the grain size effect: Retrieval practice is more effective when interspersed during learning. Journal of Experimental Psychology. Learning, Memory and Cognition. https://doi.org/10.1037/xlm0001382

El Akrouchi, M., Mhada, M., Gracia, D. R., Hawkesford, M. J., & Gérard, B. (2025a). Optimizing Mask R-CNN for enhanced quinoa panicle detection and segmentation in precision agriculture. Frontiers in Plant Science, 16. https://doi.org/10.3389/fpls.2025.1472688

El Akrouchi, M., Mhada, M., Gracia, D. R., Hawkesford, M. J., & Gérard, B. (2025b). Optimizing Mask R-CNN for enhanced quinoa panicle detection and segmentation in precision agriculture. Frontiers in Plant Science, 16. https://doi.org/10.3389/fpls.2025.1472688

García, L., Castro, F. A., Hernández-Amasifuen, A. D., Corazon-Guivin, M. A., Vásquez, J. A., Guerrero-Abad, J. C., Arellanos, E., Veneros, J., Rojas B., N. B., Quintana, S. C., & Oliva, M. (2021). Global studies of cadmium in relation to Theobroma cacao: A bibliometric analysis from Scopus (1996 -2020). In Scientia Agropecuaria (Vol. 12, Issue 4, pp. 611–623). Universidad Nacional de Trujillo. https://doi.org/10.17268/sci.agropecu.2021.065

Girma, A., Amare, G., Kebede, B., Kebede, B., Korji, D., & Korji, D. (2021). Pre-extension Demonstration of Improved Faba Bean Varieties in Highlands of Guji Zone, Southern Oromia, Ethiopia. International Journal of Applied Agricultural Sciences. https://doi.org/10.11648/j.ijaas.20210706.11

Ibrahim, S., Zulkifli, N. A., Sabri, N., Shari, A. A., & Noordin, M. R. M. (2019). Rice grain classification using multi-class support vector machine (SVM). IAES International Journal of Artificial Intelligence, 8(3), 215–220. https://doi.org/10.11591/ijai.v8.i3.pp215-220

King, D. A., King, D. A., Hunt, M., Hunt, M. C., Barbut, S., Barbut, S., Claus, J. (Jim), Claus, J., Cornforth, D., Cornforth, D., Joseph, P., Joseph, P., Kim, B., Kim, Y. H. B., Kim, Y. H. B., Lindahl, G., Lindahl, G., Mancini, R. A., Mancini, R. A., … Weber, M. J. (2022). AMSA Meat Color Measurement Guidelines. Meat and Muscle Biology. https://doi.org/10.22175/mmb.12473

Laub, M., Bachmann, B.-I., Detemple, E., Scherff, F., Staudt, T., Müller, M., Britz, D., Mücklich, F., & Motz, C. (2022). Determination of grain size distribution of prior austenite grains through a combination of a modified contrasting method and machine learning. Praktische Metallographie. https://doi.org/10.1515/pm-2022-1025

Laudari, S., Laudari, S., Marks, B., Marks, B., Rognon, P., & Rognon, P. (2022). Classifying grains using behaviour-informed machine learning. Scientific Reports. https://doi.org/10.1038/s41598-022-18250-4

LeCun, Y., Bottou, L., Bengio, Y., & Haffner, P. (1998). Gradient-Based Learning Applied to Document Recognition. Proceedings of the IEEE, 86(11), 2278–2324. https://doi.org/10.1109/5.726791

Liu, X., Sha, Z., & Liang, J. (2024). Multibranch Block-Based Grain Size Classification Of Hybrid Disk Using Ultrasonic Scattering: A Deep Learning Method. Materials Evaluation. https://doi.org/10.32548/2024.me-04388

Liu, Y., Wang, T., Wen, T., Zhang, J., Liu, B., Li, Y., Zhang, H., Rong, X., Ma, L., Guo, F., Liu, X., & Sun, Y. (2024). Deep learning‐based grain‐size decomposition model: A feasible solution for dealing with methodological uncertainty. Sedimentology. https://doi.org/10.1111/sed.13195

López, M. S. L., & Jimenez, K. G. S. (n.d.). Efectos de la implementación de medidas sanitarias y fitosanitarias en la exportación del grano de cacao a Países Bajos en el marco del Tratado de Libre Comercio entre Perú y la Unión Europea, durante el periodo 2009 y 2019. https://doi.org/10.19083/tesis/653376

MacQueen, J. B. (1967). Some Methods for Classification and Analysis of Multivariate Observations. Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability, 1, 281–297. https://projecteuclid.org/euclid.bsmsp/1200512992

María, A. L. P. S., Ninaquispe, J. C. M., Capuñay, L. M. P., Salazar, P. O. M., Díaz, R. A., & Tocto, R. I. M. (2024). Dinámica de la producción y exportación de quinua (Chenopodium quinoa) en Perú. Revista Alfa. https://doi.org/10.33996/revistaalfa.v8i22.250

Miranda, L., Huillca, J., & Marques-Pérez, I. (2024). El cultivo reciente de Kiwicha (Amaranthus caudatus L.) en el Perú: expansión de producción y comercialización. Agroalimentaria. https://doi.org/10.53766/agroalim/2024.30.58.09

Naik, N. K., Subbarao, M. V., Sethy, P. K., Behera, S. K., & Panigrahi, G. R. (2024). Machine learning with analysis-of-variance-based method for identifying rice varieties. Journal of Agriculture and Food Research, 18. https://doi.org/10.1016/j.jafr.2024.101397

Oscar, S. T., Etasmo, S. S., & Magomedov, I. A. (2024). Convolutional Neural Networks Applied to the Performance of a Coffee Tree. E3S Web of Conferences, 537. https://doi.org/10.1051/e3sconf/202453708015

Page, M. J., McKenzie, J. E., Bossuyt, P. M., Boutron, I., Hoffmann, T. C., Mulrow, C. D., Shamseer, L., Tetzlaff, J. M., Akl, E. A., Brennan, S. E., Chou, R., Glanville, J., Grimshaw, J. M., Hróbjartsson, A., Lalu, M. M., Li, T., Loder, E. W., Mayo-Wilson, E., McDonald, S., … Moher, D. (2021). The PRISMA 2020 statement: An updated guideline for reporting systematic reviews. BMJ, 372, n71. https://doi.org/10.1136/bmj.n71

Pastor, C. S. S. C., Vidal, L. A. G., Luk, M. C., & Garcia, A. M. R. (2022). Relación y causalidad de la competitividad de la exportación y el precio del grano de cacao en Perú. Natura@economía. https://doi.org/10.21704/ne.v7i2.2204

Paz, P., Paz, P., Andrea, D., & Andrea, D. (2018). Estudio comercial y diseño de una guía para la exportación de barras de cereal a base de quinua a Brasil. https://www.semanticscholar.org/paper/8782ee1b42332b2b4e311efaa9ff90a6a1f72cc1

Ramdhani, Y., & Alamsyah, D. P. (2023). Enhancing Sustainable Rice Grain Quality Analysis with Efficient SVM Optimization Using Genetic Algorithm. E3S Web of Conferences, 426. https://doi.org/10.1051/e3sconf/202342601035

Reza, M. N., Na, I. S., Baek, S. W., & Lee, K. H. (2019). Rice yield estimation based on K-means clustering with graph-cut segmentation using low-altitude UAV images. Biosystems Engineering, 177, 109–121. https://doi.org/10.1016/j.biosystemseng.2018.09.014

Salas, M. F. R., & Salas, M. F. R. (2022). Plan de exportación de café tostado en grano al mercado de Seúl-Corea del Sur. https://doi.org/10.21142/tb.2022.2223

Saxena, P., Priya, K., Goel, S., Aggarwal, K., Sinha, A., & Jain, P. (n.d.). RICE VARIETIES CLASSIFICATION USING MACHINE LEARNING ALGORITHMS. Journal of Pharmaceutical Negative Results ¦, 13, 2022. https://doi.org/10.47750/pnr.2022.13.S07.479

Sharon Ayme Aguirre Matos. (n.d.). Factores que influyen en la exportación del cacao en el Perú en los años 2020 a 2022. https://doi.org/10.19083/tesis/673844

Shobana, G., Bushra, S. N., Maheswari, K. U., & Subramanian, N. (2022). Multivariate Classification of Dry Beans using Pipelined Dimensionality Reduction Technique. International Conference on Signals and Electronic Systems. https://doi.org/10.1109/icses55317.2022.9914079

Sokudlor, N., Laloon, K., Junsiri, C., & Sudajan, S. (2023). Enhancing milled rice qualitative classification with machine learning techniques using morphological features of binary images. International Journal of Food Properties. https://doi.org/10.1080/10942912.2023.2264533

Swathi, T., Karinki Mani Kishore, Jujjavarapu Usha Sri, Ramasetti Chinni Krishna, & Bhavani, A. D. (2025). A Survey on Comprehensive Rice Grain Quality Analysis using Deep Learning. INTERANTIONAL JOURNAL OF SCIENTIFIC RESEARCH IN ENGINEERING AND MANAGEMENT. https://doi.org/10.55041/ijsrem43693

Taspinar, Y. S., Taşpınar, Y. S., Dogan, M., Dogan, M., Cinar, I., Çinar, İ., Kursun, R., Kursun, R., Ozkan, I. A., Özkan, İ. A., Koklu, M., & Köklü, M. (2022). Computer vision classification of dry beans (Phaseolus vulgaris L.) based on deep transfer learning techniques. European Food Research and Technology. https://doi.org/10.1007/s00217-022-04080-1

Tello, A. M. V., Tello, R. J. O., Galarza, M. O. E., & Fuentes, L. P. C. (2024). Estrategias Competitivas para Incrementar la Exportación de Cacao en Grano Ecuatoriano hacia Corea del Sur en el 2024. Ciencia Latina Revista Científica Multidisciplinar. https://doi.org/10.37811/cl_rcm.v8i4.12180

Verma, D., Bhatt, U. M., & Vidyarthi, A. (2023). Optimal Machine Learning Model for the Relationship Between Grain Size, Channel Thickness, and Grain Boundary Trap Density in 3D NAND Strings. 2023 International Conference on Electrical, Electronics, Communication and Computers (ELEXCOM). https://doi.org/10.1109/elexcom58812.2023.10370202

Yang, Y., Xiao, Y., Chen, Z., Tang, D.-S., Li, Z., & Li, Z. (2023). FCBTYOLO: A Lightweight and High-Performance Fine Grain Detection Strategy for Rice Pests. IEEE Access. https://doi.org/10.1109/access.2023.3314697

Yasar, A. (2024). Analysis of selected deep features with CNN-SVM-based for bread wheat seed classification. European Food Research and Technology, 250(6), 1551–1561. https://doi.org/10.1007/s00217-024-04488-x

Zerrouki, N., Ait-Djafer, A. Z., Harrou, F., Lafane, S., Abdelli-Messaci, S., & Sun, Y. (2024). Image-driven machine learning for automatic characterization of grain size and distribution in smart vanadium dioxide thin films. Measurement. https://doi.org/10.1016/j.measurement.2024.114791

Zhu, L., Ma, G., Zhang, Y., Wang, J., & Kan, X. (2023). Reconstruction of Snow Cover in Kaidu River Basin via Snow Grain Size Gap-filling Based on Machine Learning. Water. https://doi.org/10.3390/w15213726

张 Z. 朝 Z., Li, Y. 李, Yang, G. 杨, Zeng, Q. 曾, 李 X. 小龙 L. I., Chen, L. 陈, Qian, D. 钱, Sun, D. 孙, Su, M. 苏, Yang, L. 杨, Zhang, S. 张, & Ma, X. 马. (2023). Estimating the grain size of microgranular material using laser-induced breakdown spectroscopy combined with machine learning algorithms. Plasma Science and Technology. https://doi.org/10.1088/2058-6272/ad1792

Downloads

Published

2025-12-25

How to Cite

Arias Rivas, B. A., Machaca Mamani, J. C., Cahuana Lipa, R., & Manrique Nugent, M. A. L. (2025). Computer vision algorithms for characterizing and classifying agro-exportable grains through size analysis and clustering techniques in Peru’s agricultural sector. Sapienza: International Journal of Interdisciplinary Studies, 6(4), e25075. https://doi.org/10.51798/sijis.v6i4.1066

Issue

Section

Applied Sciences - Original Articles