Improving Tomato Ripeness Classification Using Knowledge Distillation and Hyperparameter Optimization with Optuna

DOI: https://doi.org/10.33650/jeecom.v7i2.11266

Authors (s)


(1) * Iasya Sholihin   (Universitas Amikom Jogyakarta)  
        Indonesia
(2)  Andi Sunyoto   (Universitas Amikom Jogyakarta)  
        Indonesia
(*) Corresponding Author

Abstract


Automatic classification of tomato ripeness plays a crucial role in ensuring post-harvest quality and efficiency in the horticultural industry.
This study proposes a combined strategy of Knowledge Distillation (KD) and hyperparameter optimization using Optuna to improve the accuracy of the ResNet50 student model by leveraging the performance of a MobileNetV2 teacher model.We used a publicly available Kaggle dataset containing 8,540 images, categorized into four ripeness levels (green, red, ripe, and rotten), comprising 7,157 training images and 1,383 validation images.Each image was resized to 224×224 pixels; light augmentation techniques (random rotation, brightness–contrast adjustment, flipping, and Gaussian blur) were applied only to the training set to prevent overfitting while maintaining consistency during evaluation.The MobileNetV2 teacher model was initially fine-tuned on the last 20 layers using manual hyperparameters (freeze_until = 20, dropout = 0.6), achieving an accuracy of 85.8%.Subsequent tuning via Optuna identified the optimal configuration (freeze_until = 91, dropout_rate = 0.5055), which improved the teacher’s performance to 89.6%.The resulting teacher model was then used to distill knowledge into the ResNet50 student: under manual settings, the student’s accuracy improved from 55.24% to 73.25%; when the student model was also optimized using Optuna, its accuracy surged to 85.54% nearly matching the teacher.Further evaluation using a confusion matrix and ROC curves revealed an increase in per-class AUC to the range of 0.91–0.99 in the KD + Optuna student model, confirming that this method effectively closes the performance gap between student and teacher.These findings demonstrate that combining KD with Optuna-based hyperparameter optimization is an effective approach for producing a lightweight, fast, and highly accurate tomato ripeness classification model ready for deployment in field applications to support post-harvest decision-making.


Keywords

Tomato Ripeness Classification; Knowledge Distillation; Optuna; Hyperparameter Tuning ResNet50; MobileNetV2



Full Text: PDF



References


Md. Y. Ali et al., “Nutritional Composition and Bioactive Compounds in Tomatoes and Their Impact on Human Health and Disease: A Review,” Foods, vol. 10, no. 1, p. 45, 2020, doi: 10.3390/foods10010045.

W. Zita, S. Bressoud, G. Glauser, F. Kessler, and V. Shanmugabalaji, “Chromoplast Plastoglobules Recruit the Carotenoid Biosynthetic Pathway and Contribute to Carotenoid Accumulation During Tomato Fruit Maturation,” 2022, doi: 10.1101/2022.09.14.507955.

A. F. Powell et al., “A Solanum Lycopersicoides Reference Genome Facilitates Insights Into Tomato Specialized Metabolism and Immunity,” The Plant Journal, vol. 110, no. 6, pp. 1791–1810, 2022, doi: 10.1111/tpj.15770.

L. Izzo, L. Castaldo, S. Lombardi, A. Gaspari, M. Grosso, and A. Ritieni, “Bioaccessibility and Antioxidant Capacity of Bioactive Compounds From Various Typologies of Canned Tomatoes,” Front Nutr, vol. 9, 2022, doi: 10.3389/fnut.2022.849163.

A. F. Powell et al., “A Solanum Lycopersicoides Reference Genome Facilitates Insights Into Tomato Specialized Metabolism and Immunity,” The Plant Journal, vol. 110, no. 6, pp. 1791–1810, 2022, doi: 10.1111/tpj.15770.

R. Braglia et al., “Phytochemicals and Quality Level of Food Plants Grown in an Aquaponics System,” J Sci Food Agric, vol. 102, no. 2, pp. 844–850, 2021, doi: 10.1002/jsfa.11420.

L. Da Quach, K. N. Quoc, A. N. Quynh, N. Thai-Nghe, and T. G. Nguyen, “Explainable Deep Learning Models With Gradient-Weighted Class Activation Mapping for Smart Agriculture,” IEEE Access, vol. 11, pp. 83752–83762, 2023, doi: 10.1109/ACCESS.2023.3296792.

K. R. Resmi, G. Raju, V. Padmanabha, and J. Mani, “Person Identification by Models Trained Using Left and Right Ear Images Independently,” pp. 281–288, 2023, doi: 10.2991/978-94-6463-110-4_20.

A. Mohamed et al., “The Impact of Data Processing and Ensemble on Breast Cancer Detection Using Deep Learning,” Journal of Computing and Communication, vol. 1, no. 1, pp. 27–37, 2022, doi: 10.21608/jocc.2022.218453.

J. Chu and S. Khan, “Transfer Learning and Data Augmentation in Osteosarcoma Cancer Detection,” J Emerg Invest, 2023, doi: 10.59720/22-285.

P. R. Togatorop, Y. Pratama, A. M. Sianturi, M. S. Pasaribu, and P. S. Sinaga, “Image Preprocessing and Hyperparameter Optimization on Pretrained Model MobileNetV2 in White Blood Cell Image Classification,” Iaes International Journal of Artificial Intelligence (Ij-Ai), vol. 12, no. 3, p. 1210, 2023, doi: 10.11591/ijai.v12.i3.pp1210-1223.

W. Gouda, N. U. Sama, G. Al-Waakid, M. Humayun, and N. Z. Jhanjhi, “Detection of Skin Cancer Based on Skin Lesion Images Using Deep Learning,” Healthcare, vol. 10, no. 7, p. 1183, 2022, doi: 10.3390/healthcare10071183.

C. C. Tseng, V. Lim, and R. W. Jyung, “Use of Artificial Intelligence for the Diagnosis of Cholesteatoma,” Laryngoscope Investig Otolaryngol, vol. 8, no. 1, pp. 201–211, 2023, doi: 10.1002/lio2.1008.

A. Banerjee, O. C. Mutlu, A. Kline, S. Surabhi, P. Washington, and D. P. Wall, “Training and Profiling a Pediatric Facial Expression Classifier for Children on Mobile Devices: Machine Learning Study,” JMIR Form Res, vol. 7, p. e39917, 2023, doi: 10.2196/39917.

M. Hassanali, M. Soltanaghaei, T. J. Gandomani, and F. Z. Boroujeni, “Software Development Effort Estimation Using Boosting Algorithms and Automatic Tuning of Hyperparameters With Optuna,” Journal of Software Evolution and Process, vol. 36, no. 9, 2024, doi: 10.1002/smr.2665.

H. Almarzooq and U. b. Waheed, “Automating Hyperparameter Optimization in Geophysics With Optuna: A Comparative Study,” Geophys Prospect, vol. 72, no. 5, pp. 1778–1788, 2024, doi: 10.1111/1365-2478.13484.

M. Goldblum, L. Fowl, S. Feizi, and T. Goldstein, “Adversarially Robust Distillation,” Proceedings of the Aaai Conference on Artificial Intelligence, vol. 34, no. 04, pp. 3996–4003, 2020, doi: 10.1609/aaai.v34i04.5816.

Y. Tian, D. Krishnan, and P. Isola, “Contrastive Representation Distillation,” 2019, doi: 10.48550/arxiv.1910.10699.

F. H. Garabaghi, S. Benzer, and R. Benzer, “Sequential GP-UCB Bayesian Optimization for Deep Neural Network Fine-Tuning in Dissolved Oxygen Prediction,” 2024, doi: 10.21203/rs.3.rs-3930680/v1.


Dimensions, PlumX, and Google Scholar Metrics

10.33650/jeecom.v7i2.11266


Refbacks

  • There are currently no refbacks.


Copyright (c) 2025 Iasya Sholihin

 
This work is licensed under a Creative Commons Attribution License (CC BY-SA 4.0)

Journal of Electrical Engineering and Computer (JEECOM)
Published by LP3M Nurul Jadid University, Indonesia, Probolinggo, East Java, Indonesia.