Machine Learning Approach for Fruit Quality Prediction

* Corresponding author: Ahmad Adeel ( madeelahmad@yahoo.com )
Available online November 24, 2026
PDF

Abstract

In the food supply chain, determination of fruit quality is important as it helps to satisfy the needs of consumers and curb waste. The conventional quality evaluations are visual inspection or, sometimes, expensive test equipment, and they tend to be labor-intensive. The proposed research focused on exploring a two independent unimodal experiments machine learning strategy to improve the quality of fruit. Photos of apples, bananas, and oranges at a very high resolution were obtained from a Kaggle dataset and assigned to a Convolutional Neural Network (CNN) with an architecture that facilitated the use of VGG16. The nutritional composition of the data was downloaded in parallel to the New Zealand Food Composition database and used to train the XGBoost classifier, Random Forest and Logistic Regression. These two models are image-based and metadata-based, were developed separately and tested to determine their individual capability of predicting fruit quality. Among metadata models, Logistic Regression achieved the highest validation accuracy of 93.10%, followed by Random Forest 92.53% and XGBoost 91.95% confirming the usefulness of nutrient composition features for fruit-species classification. The metadata models were trained to classify apples, bananas, and oranges and were not designed to predict freshness or spoilage status. This paper demonstrated that visual image data can be effectively used for fruit-quality classification, while compositional nutrient data can be effectively used for fruit-species classification using independent machine-learning approaches. The outcomes assisted with non-invasive and scalable quality monitoring approaches, which may be automated sorting technology, retail inventory management or consumer-facing applications. 

Keywords

Artificial intelligence (AI) computer vision fruit quality prediction machine learning (ML) metadata-based classification

Introduction

Assessing fruit quality is critical in agriculture, food safety, and supply chain management to ensure that consumers obtain high-quality goods while reducing food waste [1]. Traditionally, fruit grading was done manually, with professionals visually inspecting color, texture, maturity, and flaws. While this strategy works well on a local scale, it suffers from subjectivity, inconsistency, and high labor costs, making it unsuitable for large-scale agricultural output [2]. To address these challenges, Artificial Intelligence (AI) and Machine Learning (ML) have been widely applied in agriculture.

Artificial intelligence allows machines to implement tasks that naturally require human intelligence, including decision-making, problem-solving, and reasoning[3]–[6]. Machine learning a Subdiscipline of artificial intelligence, allow systems for learning models from data as well as make predictions without Specific programming in each task[7, 8]. Moreover, it improves identifying sophisticated relationships in datasets by supporting data-driven decision[9]–[11].

Convolutional Neural Networks (CNNs) have shown remarkable effectiveness in categorizing fruits from images, enabling automated sorting and grading [12]. However, even with their high accuracy, these models often lack metadata (size, weight, sugar content, etc.), leading to evaluations of fruit that are incomplete and unreliable[13]–[15]. Additionally, many AI models operate as black-box systems, offering little clarity in their decision-making processes, which results in reduced trust among farmers and retailers[16, 17].

The evaluation of fruit quality is a significant factor in every segment of the agricultural value chainwork of combines and packing stations, presentation in stores and stores, and purchasing decisions of buyers of fruits. Freshness of fruits not only enables nutritional value but also reduces spoilage and wastage and dissatisfaction to the customers. Historically, the assessment of freshness of fruits was performed manually by inspecting fruit appearance (e.g. color and texture) or using a set of special instruments that measure the proprieties of chemicals. They are, however, subjective, time consuming and non-scale to commercial settings [18, 19]. The automated quality detection systems, together with machine learning and computer vision, are becoming possible alternatives. The CNNs have been proved to be efficient in the classification of fruits using images and have been able to identify the pattern of the spoilage including discoloration, bruising, or fungal growth [20, 21]. Meanwhile, the nutritional values of fruits (sugar concentration, moisture, and vitamin C concentration, etc.) also contain important information that may have shown the quality or ripeness[22]–[24]. This paper focuses on a two independent unimodal experiments strategy where the images of fruits are processed via a deep CNN module, and the meta-data with a nutrient level is represented by a structured machine learning model, and two independent machine learning streams. The performance of each stream is individually analyzed according to its respective classification task. The image-based CNN identifies fresh and rotten fruit classes, whereas the metadata-based models classify fruit species using nutritional composition features.

Fruit quality is an important process in the agriculture and food processing industry as well as the retail industry but, it is mostly a manual process or uses costly sensing technology[25]. Due to rising needs of automation and scaling it became necessary to resort to computer vision and machine learning methods in detecting spoilage and evaluating the freshness of fruits. Visual image-based techniques, especially those that utilize the Convolutional Neural Networks (CNNs), have been very successful at detecting visual signs of spoilage, including discoloration, bruises, and fungal growth [20, 21]. These techniques, however, require consistent lighting, good camera and visual descriptions which are lacking in reality during deployment. Conversely, little research has been done on the viability of utilizing real world nutritional composition data, i.e. sugar, vitamin C, and moisture contents, as single features differentiating fruit quality. The current metadata-based studies tend to use synthetic and laboratory-managed data or recreate optimal scenarios, which are unlikely to capture the variability of consumers [26, 27]. Moreover, the recent developments tried to make the integration of image and metadata streams in hybrid or multimodal models, but these methods are more prone to complicating the system architecture, lowering the explainability and generalizability of the system to other types of fruit or sources [28]. There is still a distinct lack of appreciation of whether or not these two forms of modality visual data of fruit images, and real-world compositional metadata can each in their own right sustain effective fruit quality classification. This paper fills that gap and assesses the two sources of data independently by applying image databases and real nutrient profiles obtained through Food Composition Database New Zealand[29]. In consonance with that, the main research question is: How effectively can image features classify fruit freshness categories, and how effectively can nutrient-composition metadata classify fruit species when evaluated as independent machine-learning tasks?

The objectives of this study are given as follows.

  • To use a CNN model as trained and tested to classify fresh and rotten fruit samples using images of apples, bananas and oranges that had been annotated to classify fresh and rotten pieces of fruit.

  • To train and test the machine learning modules (XGBoost, Random Forest, Logistic Regression) with the real data about nutritional metadata (e.g., sugar, moisture, and vitamin C) of the fruit in order to predict fruit species (apple, banana, orange).

  • To ensure that the performance of both modalities with respect to classification accuracy can be compared, and the explainability of metadata model evaluated through SHAP and LIME.

  • To reveal that the real-world nutrient composition data (cleaned and standardized) could represent a valid input for fruit-species classification without fusion or temporal inference.

The research has both scholarly and usable content areas in terms of research and practice, especially where artificial intelligence, food technology, and agricultural-level assurance of quality meet. Scholarly, by performing the validation of the ability to use real-world nutritional composition data to simply classify the fruit types, it fills a significant research gap by being a question thaliteratureived as much attention in the literature so far. Other previous studies have concentrated exclusively on ways of classifying fruit freshness based on images, or have applied hybrid fusion models, in which the predictive capabilities of individual modalities have not been completely isolated. This study provides a small contribution to the research in Metadata-driven fruit classification because it proves valid results in terms of classification accuracy as the authentic nutrient data with the appropriate cleaning, normalization, and structuring could show substantial results when used in the models such as XGBoost, Random Forest, and Logistic Regression. This study supports key values of modern science by collecting compositional metadata from New Zealand FOOD files database, and sourcing images from Kaggle [30]. In practice, the study can give good directions to the designing of cost-efficient, non-damaging and scalable quality control systems in the food and agriculture sectors. Although image-based classification is a widely applied approach on automated grading systems, its field of use in case of challenging or adverse real-world conditions, i.e. bad lighting, obstructions, or the absence of cameras infrastructure might constrain its application in field or warehouse scenarios. Where this is known, pre-evaluated nutritional profiles may be used for automated fruit-species classification when image data are unavailable. What is more, explainable AI methods like SHAP and LIME are used to make the support decision process not a black box thus making it clear and accountable in AI-aided systems[31]-[33]. Finally, the work is not only a justification of a new solution to metadata-controlled classification but a strong basis to evaluate it relatively to mainstream image techniques, which gives a certain operative universality to the role of AI in the evaluation of food quality in different operational conditions.

Complete Article

The complete article, including all figures, tables, equations and algorithms, is available in the official publication PDF.

Conclusion

The study evaluated two independent machine-learning experiments. The first experiment employed a VGG16-based CNN to classify six fruit-quality categories using fruit images. The second experiment used nutritional metadata and traditional machine-learning algorithms to classify fruit species (apple, banana, and orange). These experiments addressed different classification problems and were therefore evaluated independently.

The study given is a relatively new and productive method to fruit freshness tests using a combination of computer vision and nutritional metadata in an interpretable and structured machine learning theory. One of the main contributions of this work will be its methodological aspect, as in addition to the high value of classification accuracy, it promotes a transparent, comparative, and flexible design, ready to be implemented in practice. The utilization of explainable AI libraries and confirmation of widely accessible farm metadata as inputs to predictive performance enables the path to cost-efficient, widespread, and intelligent quality observation in farming.

This research contributes to agricultural AI by investigating two independent classification tasks fruit-quality classification from images and fruit-species classification from nutritional metadata. It has high results in terms of image data classification using CNNs and offers strong metadata-based fruit-species classification using XGBoost. Also, the interpretability is improved with SHAP and LIME that offer real answers as to what decisions the models make. The system is scalable, modular and has been developed to work in the real world.

Finally, the study provides a good basis for pushing research in the area of fruit quality monitoring technology. It eases the connection and disconnection between visual and non-visual data in machine learning, problems of AI explainability, and helps to create the tools that could be used in real-world environments in food development, retail business, and smart agriculture.

Data Availability

The Kaggle data concerning the dataset Fresh and Rotten fruits to Classify were taken [20] this dataset offered different annotated pictures of fresh and spoiled apples, bananas, and oranges

References

  1. P. B. Pathare, M. Al-Dairi, and A. Al-Mahdouri, “Bruise damage susceptibility and fruit quality assessment of pear, ” Open Agric. J., vol. 15, Art. no. TOASJ-15-82, 2021, doi: 10.2174/1874331502115010082
  2. K. Komal and Sonia, “GLCM algorithm and SVM classification method for orange fruit quality assessment, ” Int. J. Eng. Res. Technol. (IJERT), vol. 8, no. 9, pp. 697–703, 2019, doi: 10.17577/IJERTV8IS090213
  3. M. Rawat, S. E. Hosseini, and S. Pervez, “Sentiment analysis for assessing customer satisfaction in chatbot service encounters, ” in Proc. 16th Int. Conf. Developments in eSystems Engineering (DeSE), 2023, pp. 105–109, doi: 10.1109/DeSE60595.2023.10469554
  4. B. Gustafson, N. Kosari, E. Brothersen, M. Mosher, and A. Zhou, “Probe cytotoxic and oxidative stress effects of nanoplastics on Caco-2 cells: Insights from Raman spectroscopy and machine learning, ” Sensors, vol. 26, no. 17, Art. no. 5375, 2026, doi: 10.3390/s26175375
  5. N. Kosari, B. Gustafson, and A. Zhou, “Probing cytotoxic and oxidative stress effects of nanoplastics on human intestinal Caco-2 cells: Insights from Raman spectroscopy and machine learning, ” Microsc. Microanal., vol. 31, suppl. 1, Art. no. ozaf048.455, 2025.
  6. A. Taghizadeh, A. Behzadi, N. Fakhri, and S. A. Naghipour, “Comparing machine learning models for stock prediction: LSTM comes out on top, ” J. Mod. Technol., vol. 3, no. 1, pp. 361–366, 2026, doi: 10.71426/jmt.v3.i1.pp361-366
  7. J. Wilson, S. E. Hosseini, and S. Pervez, “Identification of fake news in social media using sentimental analysis, ” in Proc. IEEE Industrial Electronics and Applications Conference (IEACon), 2023, pp. 220–224.
  8. S. M. S. Mohammadabadi et al., “Advancing electric vehicle ecosystems: A survey of generative artificial intelligence and distributed machine learning applications, ” Global Energy Interconnection, vol. 9, no. 2, pp. 315–336, 2026, doi: 10.1016/j.gloei.2025.10.010
  9. R. Farzad and P. Brewick, “Interpretable $$-variational autoencoders for discovering higher-order sensitivities in nonlinear hysteretic structures, ” J. Eng. Mech., vol. 152, no. 10, Art. no. 04026067, 2026, doi: 10.1061/JENMDT.EMENG-9030
  10. M. Ali, S. E. Hosseini, S. Pervez, and M. Ahmad, “Real-time recognition of NZ sign language alphabets by optimal use of machine learning, ” Bioengineering, vol. 12, no. 10, Art. no. 1068, 2025, doi: 10.3390/bioengineering12101068
  11. V. Rahmani Khorasani, M. R. Yamaghani, and M. H. Darvish Motevalli, “Preventing customer churn in e-commerce based on feature selection using metaheuristic methods and deep learning, ” Eng. Manag. Soft Comput., vol. 12, no. 3, pp. 62–82, 2026, doi: 10.22091/jemsc.2026.14256.1316
  12. R. L. Satria and M. H. Wathan, “ConFruit: Effective fruit classification using CNN algorithm, ” Int. J. Informatics Comput., vol. 5, no. 1, pp. 10–18, 2023, doi: 10.35842/ijicom.v5i1.44
  13. K. A. Al-Dhlan et al., “Customizable encryption algorithms to manage data assets based on blockchain technology in smart city, ” Math. Probl. Eng., vol. 2022, Art. no. 8996629, 2022, doi: 10.1155/2022/8996629
  14. B. L. Sirisha, B. J. Nayak, B. Sai Sndhya, J. E. Rao, and M. Devisri, “Fruit quality detection using deep learning for sustainable agriculture, ” in Proc. Int. Conf. Recent Advances in Electrical, Electronics, Ubiquitous Communication, and Computational Intelligence (RAEEUCCI), 2024, pp. 441–446, doi: 10.1109/RAEEUCCI61380.2024.10548005
  15. M. Rizzo, M. Marcuzzo, A. Zangari, A. Gasparetto, and A. Albarelli, “Fruit ripeness classification: A survey, ” Artif. Intell. Agric., vol. 7, pp. 44–57, 2023, doi: 10.1016/j.aiia.2023.02.004
  16. A. Cuzzocrea, G. Pilato, and A. Cartolano, “Explainable AI for smart agriculture, ” in Proc. 28th Int. DMS Conf. Visualization and Visual Languages (DMSVIVA), 2022, pp. 69–76.
  17. A. Cartolano, A. Cuzzocrea, G. Pilato, and G. M. Grasso, “Explainable AI at work! What can it do for smart agriculture?, ” in Proc. IEEE 8th Int. Conf. Multimedia Big Data (BigMM), 2022, pp. 87–93, doi: 10.1109/BigMM55396.2022.00020
  18. P. Dhiman, A. Kaur, Y. Hamid, E. Alabdulkreem, H. Elmannai, and N. Ababneh, “Smart disease detection system for citrus fruits using deep learning with edge computing, ” Sustainability, vol. 15, no. 5, Art. no. 4576, 2023, doi: 10.3390/su15054576
  19. X. Liu, J. Wang, H. Wang, Y. Huang, and Z. Ren, “Prediction of Prunoideae fruit quality characteristics based on machine learning and spectral characteristic acquisition optimization, ” Food Control, vol. 165, Art. no. 110627, 2024, doi: 10.1016/j.foodcont.2024.110627
  20. I. D. Apostolopoulos, M. Tzani, and S. I. Aznaouridis, “A general machine learning model for assessing fruit quality using deep image features, ” AI, vol. 4, no. 4, pp. 812–830, 2023, doi: 10.3390/ai4040041
  21. S. Biswas and S. Barma, “A low-cost vegetable quality assessment system based on microscopy images in deep learning edge computing: A pilot study on potato tuber, ” IEEE Trans. Consum. Electron., vol. 70, no. 3, pp. 6343–6353, 2024, doi: 10.1109/TCE.2024.3412101
  22. J. J. Bird, C. M. Barnes, L. J. Manso, A. Ek'art, and D. R. Faria, “Fruit quality and defect image classification with conditional GAN data augmentation, ” Sci. Hortic., vol. 293, Art. no. 110684, 2022, doi: 10.1016/j.scienta.2021.110684
  23. M. V. da Silva Ferreira, S. Barbon Junior, V. G. T. da Costa, D. F. Barbin, and J. L. Barbosa Jr., “Deep computer vision system and explainable artificial intelligence applied for classification of dragon fruit (Hylocereus spp.), ” Sci. Hortic., vol. 338, Art. no. 113605, 2024, doi: 10.1016/j.scienta.2024.113605
  24. X. Wang, X. Chen, R. Gong, T. Wang, and Y. Huang, “Improving fruit variety classification using near-infrared spectroscopy and deep learning techniques, ” J. Food Compos. Anal., vol. 140, Art. no. 107243, 2025, doi: 10.1016/j.jfca.2025.107243
  25. S. Momeni, H. Amozad Khalili, E. Momeni, and Z. Saeidimobarakeh, “Designing an explainable AI-based decision support model for evaluating open innovation in the food supply chain, ” Eng. Manag. Soft Comput., vol. 12, no. 4, pp. 109–132, 2026, doi: 10.22091/jemsc.2026.15967.1381
  26. R. Nithya, B. Santhi, R. Manikandan, M. Rahimi, and A. H. Gandomi, “Computer vision system for mango fruit defect detection using deep convolutional neural network, ” Foods, vol. 11, no. 21, Art. no. 3483, 2022, doi: 10.3390/foods11213483
  27. A. Cravero, S. Pardo, S. Sep'ulveda, and L. Mu noz, “Challenges to use machine learning in agricultural big data: A systematic literature review, ” Agronomy, vol. 12, no. 3, Art. no. 748, 2022, doi: 10.3390/agronomy12030748
  28. P. Singh, A. Rana, T. Choudhury, and N. Tripathi, “AI&ML-based smart non-disruptive methods for post-harvest fruit grading: State-of-the-art, ” in Proc. MIT Art, Design and Technology School of Computing Int. Conf. (MITADTSoCiCon), 2024, pp. 1–6.
  29. S. Sivakumaran, L. Huffman, and S. Sivakumaran, “The New Zealand food composition database: A useful tool for assessing New Zealanders' nutrient intake, ” Food Chem., vol. 238, pp. 101–110, 2018, doi: 10.1016/j.foodchem.2016.12.066
  30. D. Ulucan, O. Ulucan, and M. Turkan, “A comparative analysis on fruit freshness classification, ” in Proc. Innovations in Intelligent Systems and Applications Conf. (ASYU), 2019, pp. 1–4, doi: 10.1109/ASYU48272.2019.8946385
  31. B. Azam, D. P. Kuttichira, B. Verma, A. Rahman, and L. Wang, “Explainable image recognition with graph-based feature extraction, ” IEEE Access, vol. 12, pp. 150325–150333, 2024, doi: 10.1109/ACCESS.2024.3475380
  32. R. Jovanovi'c, A. Djordjevic, M. Stefanovic, M. Eric, and N. Paji'c, “Enhanced defect management in strawberry processing using machine vision: A cost-effective edge device solution for real-time detection and quality improvement, ” Appl. Sci., vol. 14, no. 17, Art. no. 7771, 2024, doi: 10.3390/app14177771
  33. S. Alipour and M. Fazli, “From prediction to explanation: Earnings management analysis using explainable machine learning and the SHAP approach, ” J. Data Analytics Intell. Decision-Making, vol. 2, no. 3, pp. 77–113, 2026.
  34. M. Knott, F. Perez-Cruz, and T. Defraeye, “Facilitated machine learning for image-based fruit quality assessment, ” J. Food Eng., vol. 345, Art. no. 111401, 2023, doi: 10.1016/j.jfoodeng.2022.111401
  35. Y. Ren, C. Wu, H. Zhou, X. Hu, and Z. Miao, “Dual-extraction modeling: A multi-modal deep-learning architecture for phenotypic prediction and functional gene mining of complex traits, ” Plant Commun., vol. 5, no. 9, Art. no. 101002, 2024, doi: 10.1016/j.xplc.2024.101002
  36. S. Sultana, M. A. M. Tasir, S. N. Nobel, M. M. Kabir, and M. Mridha, “XAI-FruitNet: An explainable deep model for accurate fruit classification, ” J. Agric. Food Res., vol. 18, Art. no. 101474, 2024, doi: 10.1016/j.jafr.2024.101474
  37. F. J. Iriarte, M. E. Ortiz, L. Unzueta, J. Mart'inez, J. Zaldivar, and I. Arganda-Carreras, “Multi-level XAI-driven MLOps pipeline for the adjustment of fruit and vegetable classifiers, ” in Proc. IEEE 12th Int. Conf. Intelligent Systems (IS), 2024, pp. 1–6, doi: 10.1109/IS61756.2024.10705202
37 9

Similar Articles

11-20 of 28

You may also start an advanced similarity search for this article.