Non-Destructive Quality Grading of Apples and Oranges using Hyperspectral Imaging and Machine Learning

Authors

  • Muhammad Aqeel Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Muhammad Allah Razi Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Syed Aun Muhammad Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Umair Siddique Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Ahmed Sohaib Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Musa Ahmad Khwaja Fareed University of Engineering and Information Technology image/svg+xml
  • Muhammad Naeem Khwaja Fareed University of Engineering and Information Technology image/svg+xml

DOI:

https://doi.org/10.57041/jx5hhf82

Keywords:

Artificial intelligence, classification, fruit quality, hyperspectral imaging, machine learning

Abstract

Hyperspectral Imaging (HSI) offers a powerful non-destructive technique for fruit quality evaluation by simultaneously capturing both spatial and spectral information. In this research, apples and oranges were analyzed using a 224-band visible–near-infrared (400–1000 nm) imaging system with a controlled illumination setup and a standardized region-of-interest (ROI) extraction protocol. To enhance signature quality, preprocessing methods such as Savitzky–Golay smoothing and median filtering were applied, effectively reducing noise while retaining meaningful spectral characteristics. The dataset comprised 34,394 spectra (224 bands each), including 19,595 fresh and 14,799 spoiled samples. Class balance was preserved during training and testing to avoid bias. Several supervised learning algorithms—k-nearest neighbours (KNN), support vector machines (SVM), random forests (RF), decision trees (DT), linear discriminant analysis (LDA), and logistic regression (LR)—were employed to classify fruit freshness both within individual species and across a four-class scenario (apple-fresh, apple-spoiled, orange-fresh, orange-spoiled). Model performance was assessed using accuracy, precision, recall, and the F1-score. The top-performing classifiers achieved nearly 99% accuracy with balanced error rates across all categories. These findings demonstrate that the integration of HSI with supervised machine learning (ML) provides a reliable and automated solution for grading apples and oranges. The approach is highly applicable to real-time sorting lines, supporting improved quality assurance, food safety, and waste reduction. Furthermore, the methodology is adaptable to other agricultural commodities and can be optimized for industrial deployment through band selection and lightweight models that reduce computational requirements while maintaining classification accuracy.

Author Biography

  • Muhammad Allah Razi, Khwaja Fareed University of Engineering and Information Technology

    Lecturer

Downloads

Published

2025-06-01

How to Cite

Non-Destructive Quality Grading of Apples and Oranges using Hyperspectral Imaging and Machine Learning. (2025). Pakistan Journal of Scientific Research, 4(2(Suppl.), 42-55. https://doi.org/10.57041/jx5hhf82

Most read articles by the same author(s)