Improving Tomato Ripeness Classification Using Knowledge Distillation and Hyperparameter Optimization with Optuna - Iasya Sholihin; Andi Sunyoto (Universitas Nurul Jadid, 2025)
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.