Development of an Image Processing System for Defect Detection in Nam Dok Mai Golden Mangoes
DOI:
https://doi.org/10.55003/ETH.420208Keywords:
Image Processing, Deep Learning, Mask R-CNN, Defect Classification, Quality ControlAbstract
This study proposes an image processing-based approach for detecting surface defects in Nam Dok Mai mangoes. Each fruit was photographed from two sides to capture comprehensive defect characteristics. The images were subsequently converted into the HSV color space to highlight darker defect regions, such as brown or black, followed by morphological dilation to refine defect boundaries and facilitate accurate area measurement. Detected defects were quantified in square centimeters and categorized into four quality classes: Extra Class, Class I, and Class II, according to the Thai Agricultural Standard TAS 5-2567. Additionally, a fourth class, Bad Quality, was introduced to represent defects exceeding the Class II size threshold. The annotated dataset was prepared using Roboflow, where labeling and data augmentation were conducted to enhance sample diversity. The dataset was partitioned into a training set (80%) and a testing set (20%). While image processing techniques were employed for initial dataset preparation, the primary objective was to develop a Mask R-CNN model capable of autonomously detecting defects directly from raw images, thereby eliminating the reliance on manual preprocessing. Following the training phase, the Mask R-CNN model was evaluated for its ability to detect and classify mango defects. Experimental results demonstrated high Precision and F1-Score values, particularly in the Extra Class and Bad Quality groups. The model achieved an overall accuracy of 70.71%, reflecting its strong potential for real-world application. It is anticipated that this system could significantly improve the accuracy and efficiency of mango sorting processes in the agricultural sector, contributing to standardized and reliable quality control.
References
Office of Agricultural Economics, “Office of Agricultural Economics,” oae.go.th https://oae.go.th/home/article/412. (accessed: Nov. 8, 2024).
Agricultural product standards: Mango, TAS 5-2567, National Bureau of Agricultural Commodity and Food Standards, Bangkok, Thailand, 2024.
V. G. Narendra and A. J. Pinto, “Defects detection in fruits and vegetables using image processing and soft computing techniques,” in Proceedings of 6th International Conference on Harmony Search, Soft Computing and Applications, in Advances in Intelligent Systems and Computing, vol. 1183, 2021, pp. 529–537, doi: 10.1007/978-981-15-8603-3_29.
P. Kanagaraju, N. M. Aushiq, and R. T. Vanan, “Disease detection and analysis in fruits using image processing,” International Journal of Health Sciences, vol. 6, no. S8, pp. 1198–1211, 2022. doi: 10.53730/ijhs.v6nS8.9879
K. He, G. Gkioxari, P. Dollár and R. Girshick, “Mask R-CNN,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 42, no. 2, pp. 386–397, 2020. doi: 10.1109/TPAMI.2018.2844175
C. Neupane, A. Koirala, and K. B. Walsh, “In-Orchard Sizing of Mango Fruit: 1. Comparison of Machine Vision Based Methods for On-The-Go Estimation,” horticulturae, vol. 8, no. 12, p. 1223, Dec. 2022, doi: 10.3390/horticulturae8121223.
W. Jia, Y. Tian, R. Luo, Z. Zhang, J. Lian, and Y. Zheng, “Detection and segmentation of overlapped fruits based on optimized mask R-CNN application in apple harvesting robot,” Computers and Electronics in Agriculture, vol. 172, 2020, Art. no. 105380, doi: 10.1016/j.compag.2020.105380.
Y. Yu, K. Zhang, L. Yang, and D. Zhang, “Fruit detection for strawberry harvesting robot in non-structural environment based on Mask-RCNN,” Computers and Electronics in Agriculture, vol. 163, 2019, Art. no. 104846, doi: 10.1016/j.compag.2019.06.001.
X. Xie, J. Wang, Z. Hu and Y. Zhao, “Intelligent Detection of Mango Disease Spores Based on Mask Scoring R-CNN,” in 2021 5th Asian Conference on Artificial Intelligence Technology (ACAIT), Haikou, China, Oct. 29–31, 2021, pp. 768–773, doi:10.1109/ACAIT53529.2021.9731325.
X. Cao, J. -S. Pan, Z. Wang, Z. Sun, A. U. Haq, W. Deng and S. Yang, “Application of generated mask method based on Mask R-CNN in classification and detection of melanoma,” Computer Methods and Programs in Biomedicine, vol. 207, 2021, Art. no. 106174, doi: 10.1016/j.cmpb.2021.106174.
R. Nithya, B. Santhi, R. Manikandan, M. Rahimi and A. H. Gandomi, “Computer Vision System for Mango Fruit Defect Detection Using Deep Convolutional Neural Network,” foods, vol. 11, no. 21, 2022, Art. no. 3483, doi: 10.3390/foods11213483.
H. M. R. Iqbal and A. Hakim, “Classification and Grading of Harvested Mangoes Using Convolutional Neural Network,” International Journal of Fruit Science, vol. 22, no. 1, pp. 95–109, 2022, doi: 10.1080/15538362.2021.2023069.
R. A. Rizvee, T. H. Orpa, A. Ahnaf, M. A. Kabir, M. R. A. Rashid, M. M. Islam and M. S. Ali, “LeafNet: A proficient convolutional neural network for detecting seven prominent mango leaf diseases,” Journal of Agriculture and Food Research, vol. 14, 2023, Art. no. 100787, doi: 10.1016/j.jafr.2023.100787.
N. Pattansarn and N. Sriwiboon, “Image Processing for Classifying the Quality of the Chok-Anan Mango by Simulating the Human Vision using Deep Learning,” Journal of Information Science and Technology, vol. 10, no. 1, pp. 24–29, 2020, doi: 10.14456/jist.2020.3.
H. Basri, I. Syarif, and S. Sukaridhoto, “Faster R-CNN implementation method for multi-fruit detection using Tensorflow platform,” in 2018 International Electronics Symposium on Knowledge Creation and Intelligent Computing (IES-KCIC), Bali, Indonesia, Oct. 29–30, 2018, pp. 54–59, doi: 10.1109/KCIC.2018.8628566.
M. N. Abu Bakar, A. H. Abdullah, N. Abdul Rahim, H. Yazid, N. S. Zakaria, S. Omar, W. M. F. Wan Nik, N Abu Bakar, S. F. Sulaiman, M I Ahmad et al., “Defects Detection Algorithm of Harumanis Mango for Quality Assessment Using Colour Features Extraction,” Journal of Physics: Conference Series, vol. 2107, no. 1, 2021, Art. no. 012008, doi: 10.1088/1742-6596/2107/1/012008
T. R. Razak, M. B. Othman, M. N. Abu Bakar, K. A. Ahmad, and A. R. Mansor, “Mango grading by using fuzzy image analysis,” in International Conference on Agricultural, Environment and Biological Sciences (ICAEBS'2012), Phuket, Thailand, May 26–27, 2012, pp. 18–22.
S. Naik, B. Patel, and R. Pandey, “Shape, size and maturity features extraction with fuzzy classifier for non-destructive mango (Mangifera indica L., cv. Kesar) grading,” in 2015 IEEE Technological Innovation in ICT for Agriculture and Rural Development (TIAR), Chennai, India, Jul. 10–12, 2015, pp. 1–7, doi: 10.1109/TIAR.2015.7358522.
H. M. Zawbaa, M. Hazman, M. Abbass, and A. E. Hassanien, “Automatic fruit classification using random forest algorithm,” in 2014 14th International Conference on Hybrid Intelligent Systems, Kuwait, Kuwait, Dec. 14–16, 2014, pp. 164–169, doi: 10.1109/HIS.2014.7086191.
N. M. Trieu and N. T. Thinh, “Using Random Forest Algorithm to Grading Mango’s Quality Based on External Features Extracted from Captured Images,” Journal of Image and Graphics, vol. 11, no. 4, pp. 391–396, 2023, doi: 10.18178/joig.11.4.391-396.
A. K. Ratha, S. K. Behera, N. K. Barpanda and P. K. Sethy, “Defect Discrimination of Mango Using Image Processing Techniques,” in ICT Analysis and Applications, in Lecture Notes in Networks and Systems, vol. 517, 2023, pp. 503–509. doi: 10.1007/978-981-19-5224-1_51.
T. U. Ganiron Jr., “Size Properties of Mangoes using Image Analysis,” International Journal of Bio-Science and Bio-Technology, vol. 6, no. 2, pp. 31–42, 2014, doi: 10.14257/ijbsbt.2014.6.2.03.
K. K. Patel, A. Kar and M. A. Khan, “Monochrome computer vision for detecting common external defects of mango,” Journal of Food Science and Technology, vol. 58, no. 12, pp. 4550–4557, 2021, doi: 10.1007/s13197-020-04939-9.
D. Sahu and R. M. Potdar, “Defect Identification and Maturity Detection of Mango Fruits Using Image Analysis,” American Journal of Artificial Intelligence, vol. 1, no. 1, pp. 5–14, 2017, doi: 10.11648/j.ajai.20170101.12.
S. Arunachalam, H. H. Kshatriya and M. Meena, “Identification of Defects in Fruits Using Digital Image Processing,” International Journal of Computer Sciences and Engineering, vol. 6, no. 10, pp. 637–640, 2018, doi: 10.26438/ijcse/v6i10.637640.
D. Rong, X. Rao and Y. Ying, “Computer vision detection of surface defect on oranges by means of a sliding comparison window local segmentation algorithm,” Computers and Electronics in Agriculture, vol. 137, pp. 59–68, 2017, doi:10.1016/j.compag.2017.02.027.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 School of Engineering, King Mongkut’s Institute of Technology Ladkrabang

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
The published articles are copyrighted by the School of Engineering, King Mongkut's Institute of Technology Ladkrabang.
The statements contained in each article in this academic journal are the personal opinions of each author and are not related to King Mongkut's Institute of Technology Ladkrabang and other faculty members in the institute.
Responsibility for all elements of each article belongs to each author; If there are any mistakes, each author is solely responsible for his own articles.