Rotten Apple Detection Using YOLOv12 for Postharvest Quality Sorting
DOI:
https://doi.org/10.32664/j-intech.v14i02.2290Kata Kunci:
Computer Vision, Embedded System, Object Detection, Rotten Apple Detection, YOLOv12Abstrak
Detecting rotten apples is critical in postharvest quality sorting, as spoiled fruit can accelerate overall decay, shorten shelf life, and lower market value. This study introduces a real-time, edge-deployable object detection method using YOLOv12 to differentiate between fresh and rotten apples in RGB images. The dataset included 2,312 annotated images, with 1,011 fresh apples and 1,301 rotten apples, split into training, validation, and testing sets with an 80:10:10 stratified ratio. To enhance model generalization, data augmentation techniques such as mosaic augmentation, horizontal flipping, rotation, scaling, HSV color jitter, and mixup were applied. The YOLOv12s model was trained with an input resolution of 640 × 640 and evaluated using accuracy, precision, recall, and F1-score. The results from the confusion matrix showed that the model achieved an accuracy of 0.93, precision of 0.91, recall of 0.89, and F1-score of 0.90, indicating that YOLOv12 offers a lightweight and effective framework for rapid apple quality assessment. The primary contribution of this work lies in integrating an attention-focused YOLOv12 detector into a postharvest apple sorting workflow, accompanied by quantitative performance evaluation and robustness analysis under challenging visual conditions.
Referensi
[1] Y. Tian, Q. Ye, and D. Doermann, “YOLOv12: Attention-Centric Real-Time Object Detectors,” ArXiv, vol. 2502.12524, 2025.
[2] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You Only Look Once: Unified, Real-Time Object Detection,” in 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), IEEE, Jun. 2016, pp. 779–788. doi: 10.1109/CVPR.2016.91.
[3] J. Redmon and A. Farhadi, “YOLO9000: Better, Faster, Stronger,” in 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), IEEE, Jul. 2017, pp. 6517–6525. doi: 10.1109/CVPR.2017.690.
[4] W. Liu et al., “SSD: Single Shot MultiBox Detector,” 2016, pp. 21–37. doi: 10.1007/978-3-319-46448-0_2.
[5] T. Brosnan and D.-W. Sun, “Inspection and grading of agricultural and food products by computer vision systems—a review,” Comput. Electron. Agric., vol. 36, no. 2–3, pp. 193–213, Nov. 2002, doi: 10.1016/S0168-1699(02)00101-1.
[6] B. Zhang et al., “Principles, developments and applications of computer vision for external quality inspection of fruits and vegetables: A review,” Food Research International, vol. 62, pp. 326–343, Aug. 2014, doi: 10.1016/j.foodres.2014.03.012.
[7] J. B. Li, W. Q. Huang, and C. J. Zhao, “Machine vision technology for detecting the external defects of fruits — a review,” The Imaging Science Journal, vol. 63, no. 5, pp. 241–251, Jun. 2015, doi: 10.1179/1743131X14Y.0000000088.
[8] L. E. Chuquimarca, B. X. Vintimilla, and S. A. Velastin, “A review of external quality inspection for fruit grading using CNN models,” Artificial Intelligence in Agriculture, vol. 14, pp. 1–20, Dec. 2024, doi: 10.1016/j.aiia.2024.10.002.
[9] V. Leemans, H. Magein, and M.-F. Destain, “Defects segmentation on ‘Golden Delicious’ apples by using colour machine vision,” Comput. Electron. Agric., vol. 20, no. 2, pp. 117–130, Jul. 1998, doi: 10.1016/S0168-1699(98)00012-X.
[10] V. Leemans, H. Magein, and M.-F. Destain, “Defect segmentation on ‘Jonagold’ apples using colour vision and a Bayesian classification method,” Comput. Electron. Agric., vol. 23, no. 1, pp. 43–53, Jun. 1999, doi: 10.1016/S0168-1699(99)00006-X.
[11] Q. Li, M. Wang, and W. Gu, “Computer vision based system for apple surface defect detection,” Comput. Electron. Agric., vol. 36, no. 2–3, pp. 215–223, Nov. 2002, doi: 10.1016/S0168-1699(02)00093-5.
[12] V. Leemans and M.-F. Destain, “A real-time grading method of apples based on features extracted from defects,” J. Food Eng., vol. 61, no. 1, pp. 83–89, Jan. 2004, doi: 10.1016/S0260-8774(03)00189-4.
[13] P. Valdez, “Apple Defect Detection Using Deep Learning Based Object Detection For Better Post Harvest Handling,” ArXiv, 2020.
[14] S. Fan et al., “On line detection of defective apples using computer vision system combined with deep learning methods,” J. Food Eng., vol. 286, p. 110102, Dec. 2020, doi: 10.1016/j.jfoodeng.2020.110102.
[15] S. Fan et al., “Real-time defects detection for apple sorting using NIR cameras with pruning-based YOLOV4 network,” Comput. Electron. Agric., vol. 193, p. 106715, Feb. 2022, doi: 10.1016/j.compag.2022.106715.
[16] Y. Li, X. Feng, Y. Liu, and X. Han, “Apple quality identification and classification by image processing based on convolutional neural networks,” Sci. Rep., vol. 11, no. 1, p. 16618, Aug. 2021, doi: 10.1038/s41598-021-96103-2.
[17] M. Agarla, P. Napoletano, and R. Schettini, “Quasi Real-Time Apple Defect Segmentation Using Deep Learning,” Sensors, vol. 23, no. 18, p. 7893, Sep. 2023, doi: 10.3390/s23187893.
[18] X. Gao et al., “Application of Advanced Deep Learning Models for Efficient Apple Defect Detection and Quality Grading in Agricultural Production,” Agriculture, vol. 14, no. 7, p. 1098, Jul. 2024, doi: 10.3390/agriculture14071098.
[19] T. Zhang et al., “Apple varieties, diseases, and distinguishing between fresh and rotten through deep learning approaches,” PLoS One, vol. 20, no. 5, p. e0322586, May 2025, doi: 10.1371/journal.pone.0322586.
[20] C. Citra, A. Ritonga, A. Arnita, S. Iskandar Al Idrus, and D. Yandra Niska, “Application of the K-Nearest Neighbor (K-NN) Algorithm for Detecting Banana Harvest Feasibility,” J-INTECH, vol. 13, no. 02, pp. 252–261, Dec. 2025, doi: 10.32664/j-intech.v13i02.2064.
[21] D. D. Indriani.S, K. S. S, S. I. Al Idrus, S. Susiana, and A. Perdana, “Identification of Palm Oil Fresh Fruit Bunches Worth Selling with K-Nearest Neighbors Algorithm,” J-INTECH, vol. 13, no. 02, pp. 262–271, Dec. 2025, doi: 10.32664/j-intech.v13i02.2066.
[22] E. M. Atsir, N. Nurmalitasari, and A. A. Sari, “Traffic Accident Severity Classification System Using Random Forest Algorithm,” J-INTECH, vol. 13, no. 02, pp. 272–281, Dec. 2025, doi: 10.32664/j-intech.v13i02.2089.
[23] A. A. Purnawan and S. D. Sancoko, “Perancangan dan Implementasi FitSphere sebagai Aplikasi Android untuk Manajemen Keanggotaan Gym di Chain Gym,” J-INTECH, vol. 13, no. 02, pp. 282–291, Dec. 2025, doi: 10.32664/j-intech.v13i02.2132.
[24] B. A. Wisesa, V. Mahat Putri, E. Faristasari, S. A. Jasman Duli, and S. Agustin, “Preventive Attendance Record using Photo from Mobile Phone and Printed Paper using CNN,” J-INTECH, vol. 13, no. 01, pp. 117–127, Jun. 2025, doi: 10.32664/j-intech.v13i01.1927.
[25] B. A. Wisesa, W. Andriyani, and B. D. P. Purnomosidi, “Usage of LSTM Method On Hand Gesture Recognition For Easy Learning of Sign Language Based On Desktop Via Webcam,” in 2022 5th International Seminar on Research of Information Technology and Intelligent Systems (ISRITI), IEEE, Dec. 2022, pp. 148–153. doi: 10.1109/ISRITI56927.2022.10053076.
[26] B. A. Wisesa, W. Andriyani, T. Suprawoto, and Hamdani, “Development of Learning Media for The Deaf Using a Webcam,” in 2022 5th International Seminar on Research of Information Technology and Intelligent Systems (ISRITI), IEEE, Dec. 2022, pp. 160–165. doi: 10.1109/ISRITI56927.2022.10052934.
[27] J. Xing and J. De Baerdemaeker, “Bruise detection on ‘Jonagold’ apples using hyperspectral imaging,” Postharvest Biol. Technol., vol. 37, no. 2, pp. 152–162, Aug. 2005, doi: 10.1016/j.postharvbio.2005.02.015.
[28] D. Unay and B. Gosselin, “Automatic defect segmentation of ‘Jonagold’ apples on multi-spectral images: A comparative study,” Postharvest Biol. Technol., vol. 42, no. 3, pp. 271–279, Dec. 2006, doi: 10.1016/j.postharvbio.2006.06.010.
[29] D. Unay and B. Gosselin, “Stem and calyx recognition on ‘Jonagold’ apples by pattern recognition,” J. Food Eng., vol. 78, no. 2, pp. 597–605, Jan. 2007, doi: 10.1016/j.jfoodeng.2005.10.038.
[30] A. Mizushima and R. Lu, “An image segmentation method for apple sorting and grading using support vector machine and Otsu’s method,” Comput. Electron. Agric., vol. 94, pp. 29–37, Jun. 2013, doi: 10.1016/j.compag.2013.02.009.
[31] Y. Yu, S. A. Velastin, and F. Yin, “Automatic grading of apples based on multi-features and weighted K-means clustering algorithm,” Information Processing in Agriculture, vol. 7, no. 4, pp. 556–565, Dec. 2020, doi: 10.1016/j.inpa.2019.11.003.
[32] Z. Wang, L. Jin, S. Wang, and H. Xu, “Apple stem/calyx real-time recognition using YOLO-v5 algorithm for fruit automatic loading system,” Postharvest Biol. Technol., vol. 185, p. 111808, Mar. 2022, doi: 10.1016/j.postharvbio.2021.111808.
[33] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar, “Focal Loss for Dense Object Detection,” in 2017 IEEE International Conference on Computer Vision (ICCV), IEEE, Oct. 2017, pp. 2999–3007. doi: 10.1109/ICCV.2017.324.
[34] X. Liang et al., “Real-Time Grading of Defect Apples Using Semantic Segmentation Combination with a Pruned YOLO V4 Network,” Foods, vol. 11, no. 19, p. 3150, Oct. 2022, doi: 10.3390/foods11193150.
[35] X. Hu et al., “Automatic Detection of Small Sample Apple Surface Defects Using ASDINet,” Foods, vol. 12, no. 6, p. 1352, Mar. 2023, doi: 10.3390/foods12061352.
[36] J.-H. Lee, H.-T. Vo, G.-J. Kwon, H.-G. Kim, and J.-Y. Kim, “Multi-Camera-Based Sorting System for Surface Defects of Apples,” Sensors, vol. 23, no. 8, p. 3968, Apr. 2023, doi: 10.3390/s23083968.
[37] H. Si et al., “Apple Surface Defect Detection Method Based on Weight Comparison Transfer Learning with MobileNetV3,” Agriculture, vol. 13, no. 4, p. 824, Apr. 2023, doi: 10.3390/agriculture13040824.
Unduhan
Diterbitkan
Terbitan
Bagian
Lisensi
Hak Cipta (c) 2026 J-INTECH ( Journal of Information and Technology)

Artikel ini berlisensiCreative Commons Attribution-ShareAlike 4.0 International License.

