Journal of Researches in Mechanics of Agricultural Machinery

Journal of Researches in Mechanics of Agricultural Machinery

Performance Evaluation of a Hybrid Transfer Learning-Based Classifier for Distinguishing Healthy Apples from Apples with Three Types of Diseases

Document Type : Original Article

Author
Department of Genetics and Plant Production Engineering, Isf.C., Islamic Azad University, Isfahan, Iran
10.22034/jrmam.2026.14805.742
Abstract
Abstract
The aim of this research is the development of  hybrid models based on transfer learning concept to classify apple images into four classes named: healthy apples, apples affected by bacterial disease, apples affected by fungal disease, and apples with tissue level disease propagation. A single-staged four-class model as well as six hybrid models were utilized for classification. Each hybrid model consisted of a three-class model followed by a two-class model. To train them, 850 images of the Kaggle dataset was used. The backbone of all transfer learning models was the EfficientNet algorithm. The models were implemented in the PyCharm environment, using the Python programming language. Evaluation of the models were carried out using the confusion matrix, as well as the calculation of the precision, accuracy, sensitivity, specificity, and F1-score criteria. According to the results of this study, the value of all performance evaluation criteria exceeded 0.94, indicating that the developed models performed robustly in classifying apple images; however, some hybrid models performed worse than the single-staged classifier. Therefore, the optimal configuration of hybrid classifiers cannot be assumed a priori; instead a systematic evaluation of all possible combinations is necessary to identify the most effective approach.  

Introduction
Recent advances in precision agriculture highlight the pivotal role of machine vision and deep learning in developing automated systems for fruit classification and grading. A wide range of studies have been conducted with the primary aim of replacing manual methods and improving accuracy and efficiency. These studies can be broadly categorized into three main approaches.
The first involves hybrid frameworks, where fast detection models such as YOLO are integrated with advanced classification architectures, achieving accuracies of approximately 92% across multiple fruit types. The second focuses on multi-stage systems, designed for specific fruits, in which the classification process is structured into sequential steps such as fruit type identification, freshness assessment, and ripeness evaluation. The third approach emphasizes explainable models, exemplified by frameworks such as XAI-FruitNet, which not only achieve very high accuracies (exceeding 97%) across diverse datasets but also provide interpretability in model decision-making. Overall, while these studies share a common objective—enhancing accuracy and overcoming the limitations of conventional approaches—they differ considerably in their technical methodologies and scope of application. Some prioritize feature integration, others employ multi-stage analysis, and yet others focus on explainability.
Building on these advancements, the present study proposes the use of sequential hybrid classifiers based on transfer learning to categorize apple images into four distinct classes: healthy apples, apples affected by bacterial disease, apples affected by fungal disease, and apples with tissue-level disease progression.
Material and Methods 
The dataset used in this study was obtained from the Kaggle repository and consists of four categories of apple images:
•    Bacterial Disease (Blotch): 234 images, divided into 146 for training and 88 for testing.
•    Healthy Apples (Normal): 222 images, divided into 130 for training and 92 for testing.
•    Advanced Tissue Rot (Rot): 226 images, divided into 134 for training and 92 for testing.
•    Fungal Disease (Scab): 168 images, divided into 100 for training and 68 for testing.
The objective of this study was to classify apples into one of these four categories. Two classification strategies were investigated: a single unified four-class classifier and sequential hybrid classifiers. The hybrid classifier first classifies images into three classes, with one class combining two of the four original categories. Subsequently, a binary classifier further separates the images within this composite class into the two original groups.
Given the four-class problem, six possible hybrid configurations were constructed. The performance of each hybrid classifier was evaluated and compared with the unified four-class classifier. Using the abbreviations B, N, R, and S to represent the four categories (Blotch, Normal, Rot, and Scab, respectively), the classifiers investigated were as follows:
Unified four-class classifier: B–N–R–S
•    Hybrid classifier BN–R–S followed by a binary classifier B–N
•    Hybrid classifier BR–N–S followed by a binary classifier B–R
•    Hybrid classifier BS–N–R followed by a binary classifier B–S
•    Hybrid classifier B–NR–S followed by a binary classifier N–R
•    Hybrid classifier B–NS–R followed by a binary classifier N–S
•    Hybrid classifier B–N–RS followed by a binary classifier R–S
All classifiers employed the pre-trained EfficientNet model as the backbone, and the implementations were carried out in Python using the PyCharm environment. Performance evaluation was conducted using confusion matrices and standard metrics including accuracy, precision, sensitivity, specificity, and F1-score.
Results and Discussion 
By employing the proposed model instead of a conventional convolutional neural network, the number of trainable parameters was drastically reduced. This substantial reduction not only decreased the training time of the transfer learning-based model but also enabled its deployment on computers without GPU support.
All performance evaluation metrics exceeded 0.94, indicating that the developed model performs robustly in classifying apple images. These results confirm the suitability of the transfer learning approach using the pre-trained EfficientNet architecture for categorizing apples into four classes: Bacterial Disease (Blotch), Healthy (Normal), Advanced Tissue Rot (Rot), and Fungal Disease (Scab).
Regarding hybrid classifiers, the B–NR–S and BS–N–R configurations outperformed the unified four-class classifier, while the BR–N–S hybrid achieved comparable accuracy. In contrast, the BN–R–S, B–NS–R, and B–N–RS hybrid classifiers performed worse than the unified model. This variation can be explained by the fact that combining classes acts like a form of feature engineering, and since all possible hybrid combinations are considered, this feature engineering occurs stochastically. Consequently, some combinations may lead to reduced overall accuracy. Therefore, when developing hybrid classifiers, it is essential to account for this property and discard configurations that underperform relative to the unified classifier.
Conclusions
This study demonstrates that all developed models achieved robust, reliable performance, with all evaluation metrics exceeding 0.94, which can be attributed to the use of a sufficiently large image dataset and the incorporation of transfer learning algorithms. The consistent high performance across models underscores the effectiveness of transfer learning in enhancing the accuracy and generalizability of automated apple classification systems.
A comparative analysis revealed that some hybrid models outperformed the unified four-class classifier, while others performed comparably worse. These findings indicate that the optimal configuration of hybrid classifiers cannot be assumed a priori; instead, a comprehensive development and systematic evaluation of all possible hybrid combinations are necessary, with each being benchmarked against the unified model to identify the most effective approach.
The relative advantage of the unified classifier stems primarily from its single-model architecture, in contrast to the paired structure of hybrid models. While some hybrid configurations offer potential improvements in classification accuracy, their deployment in an operational apple grading line requires additional hardware, which may pose practical challenges. This highlights a critical trade-off between achieving marginal performance gains and maintaining the feasibility of real-world implementation.
Overall, the findings of this study not only confirm the efficacy of transfer learning-based approaches for multi-class fruit classification but also provide important insights into the design considerations, performance trade-offs, and practical constraints associated with implementing hybrid versus unified classifier architectures in industrial agricultural settings.
Data Availability Statement
Data are available on request from the author.
Ethical Considerations
The author has utilized the Microsoft Copilot to summarize articles for writing the introduction section of the paper, and to translate Persian to English in writing the English abstract.
Conflict of Interest
The author declare that he has no known competing financial interest or personal relationship that could have appeared to influence the work reported in this paper.
Funding Statement
The author received no specific funding for this research.
Keywords

Subjects


Ahmadi, I. (2025). Detection and classification of some diseases of tomato crops using transfer learning. Journal of Agricultural Machinery, 15(), 319–335. 3. https://doi.org/10.22067/jam.2024.88500.1258
Anjali, S., Pious, V., Sebastian, J. J., Krishnanunni, J., Johnson, J. K., Mujeeb, A., & Baselios, M. (2023). Multi-Stage Fruit Grading System. In Lecture Notes in Networks and Systems (Vol. 672). Springer.
Cullerne Bown, W. (2024). Sensitivity and specificity versus precision and recall, and related dilemmas. Journal of Classification, 41(2), 402–426. https://doi.org/10.1007/s00357-024-09478-y
Farahani, M., & Bagherpour, H. (2025). Using novel optimized deep learning techniques for detecting fungal infections in hazelnuts kernels based on shell color changes. Journal of Food Quality, 2025, Article ID 3350046. https://doi.org/10.1155/jfq/3350046
Golzar, S. H., Bagherpour, H., & Parian, J. A. (2024). A new method to optimize deep CNN model for classification of regular cucumber based on global average pooling. Journal of Food Processing and Preservation, 2024, Article ID 5818803. https://doi.org/10.1155/2024/5818803
Jahanbakhshi, A., Momeny, M., Mahmoudi, M., & Zhang, Y.-D. (2020). Classification of sour lemons based on apparent defects using stochastic pooling mechanism in deep convolutional neural networks. Scientia Horticulturae, 263, Article 109133. https://doi.org/10.1016/j.scienta.2019.109133
JayaprakashPondy. (2023). Apple Fruit [Dataset]. Kaggle. https://www.kaggle.com/datasets/jayaprakashpondy/apple-fruit
Kayaalp, K. (2024). A deep ensemble learning method for cherry classification. European Food Research and Technology, 250(7), 1513–1528. https://doi.org/10.1007/s00217-024-04490-3
Moallem, P., Serajoddin, A., & Pourghassem, H. (2017). Computer vision-based apple grading for Golden Delicious apples based on surface features. Information Processing in Agriculture, 4(1), 33–40. https://doi.org/10.1016/j.inpa.2016.10.003
Sabzi, S., Abbaspour-Gilandeh, Y., Javadikia, H., & Havaskhan, H. (2015). Automatic grading of emperor apples based on image processing and ANFIS [Görüntü işleme ve ANFIS ile emperor elmasının otomatik sınıflandırılması]. Tarım Bilimleri Dergisi, 21(3), 326–336. https://doi.org/10.1501/tarimbil_0000001335
Sultana, S., Tasir, M. A. M., Nobel, S. M. N., Kabir, M. M., & Mridha, M. F. (2024). XAI-FruitNet: An explainable deep model for accurate fruit classification. Journal of Agriculture and Food Research, 18(9), 101474. https://doi.org/10.1016/j.jafr.2024.101474
Tripathi, M. K., & Maktedar, D. D. (2022). Internal quality assessment of mango fruit: An automated grading system with ensemble classifier. The Imaging Science Journal, 70:4, 253-272, DOI: 10.1080/13682199.2023.2166657
Unay, D., Gosselin, B., Kleynen, O., Leemans, V., Destain, M.-F., & Debeir, O. (2011). Automatic grading of bi-colored apples by multispectral machine vision. Computers and Electronics in Agriculture, 75(1), 204–212. https://doi.org/10.1016/j.compag.2010.11.006
Vidyarthi, S. K., Singh, S. K., Tiwari, R., Xiao, H.-W., & Rai, R. (2020). Classification of first quality fancy cashew kernels using four deep convolutional neural network models. Journal of Food Process Engineering, 43(12), e13552. https://doi.org/10.1111/jfpe.13552
Vidyarthi, S. K., Singh, S. K., Xiao, H.-W., & Tiwari, R. (2021). Deep learnt grading of almond kernels. Journal of Food Engineering, 44(4). https://doi.org/10.1111/jfpe.13662 Process