Algorithm for Mango Classification Using Image Processing and Naive Bayes Classifier


  • Phantida Limsripraphan Department of Computer Engineering, Faculty of Industrial Technology, Pibulsongkram Rajabhat University
  • Peerapol Kumpan Department of Computer Engineering, Faculty of Industrial Technology, Pibulsongkram Rajabhat University
  • Nanthaphon Sathongpan Department of Computer Engineering, Faculty of Industrial Technology, Pibulsongkram Rajabhat University
  • Chitnarong Phengtaeng Department of Computer Engineering, Faculty of Industrial Technology, Pibulsongkram Rajabhat University


mango classification, mango ripeness, naive bayes classifier, classification by image processing


Mangoes are one of the most preferred fruits in the world, and one of the most crucial to the economy of the Thai fruit industry. The Thai government has therefore set a policy to encourage mango growers to improve the quality of their mango fruits. Mango fruit inspection is important for the quality control system of mango fruit production. This paper presents a Bayesian approach for mango classification based on digital image processing. The algorithm is designed to identify a defect on the mango skin and classify it into one of two groups: ‘unripe mango’ or ‘ripe mango’. To determine the defect on the mango skin, image thresholding and image labeling are applied. Colour features are extracted from RGB mango images using statistical calculations. The naive Bayes classifier is then applied to classify the colour-based feature of the mango images. The performance of the Bayesian approach was evaluated against another classification technique-the Support Vector Machine (SVM). The method was implemented and tested on 100 mango images. The surface defect detection achieved 85% accuracy. The experimental results show the superiority of the proposed method, with an accuracy of 90%, as compared to SVM-based methods, with an accuracy of 83%.


Cubero, S. et al. (2014). A new method for pedicel/peduncle detection and size assessment of grapevine berries and other fruits by image analysis. Biosystems engineering, Vol.117, 62-72.

Eyarkai Nambi, V., Thangavel, K., Shahir, S., & Thirupathi, V. (2016). Comparison of Various RGB Image Features for Nondestructive Prediction of Ripening Quality of “Alphonso” Mangoes for Easy Adoptability in Machine Vision Applications: A Multivariate Approach. Journal of Food Quality, Vol.39(6), 816-825.

Froese, R., Thorson, J. T., & Reyes, R. B. (2014). A Bayesian approach for estimating length‐weight relationships in fishes. Journal of Applied Ichthyology, Vol.30(1), 78-85.

Ghanad, N. K., & Ahmadi, S. (2015). Combination of PSO Algorithm and Naive Bayesian Classification for Parkinson Disease Diagnosis. Advances in Computer Science: an International Journal, Vol.4(4), 119-125.

Huang, X. et al. (2018). Integration of computer vision and colorimetric sensor array for nondestructive detection of mango quality. Journal of Food Process Engineering, Vol.41(8), e12873.

Joshi, C., Ruggeri, F., & Wilson, S. P. (2018). Prior Robustness for Bayesian Implementation of the Fault Tree Analysis. IEEE Transactions on Reliability, Vol.67(1), 170-183.

Kotsiantis, S. B. (2014). Integrating global and local application of naive bayes classifier. Int. Arab J. Inf. Technol., Vol.11(3), 300-307.

Liao, C. H., & Wen, C. H. P. (2018). SVM-Based Dynamic Voltage Prediction for Online Thermally Constrained Task Scheduling in 3-D Multicore Processors. IEEE Embedded Systems Letters, Vol.10(2), 49-52.

Mim, F. S., Galib, S. M., Hasan, M. F., & Jerin, S. A. (2018). Automatic detection of mango ripening stages–An application of information technology to botany. Scientia Horticulturae, Vol.237, 156-163.

Nagle, M. et al. (2016). Determination of surface color of ‘all yellow’mango cultivars using computer vision. International Journal of Agricultural and Biological Engineering, Vol.9(1), 42-50.

Nandi, C. S., Tudu, B., & Koley, C. (2014). Computer vision based mango fruit grading system. In Proceedings of International Conference on Innovative Engineering Technologies (ICIET), 1-5.

Othman, M., Bakar, M. N. A., Ahmad, K. A., & Razak, T. R. (2014). Fuzzy ripening mango index using RGB colour sensor model. Researchers World, Vol.5(2), 1.

________. (2016). Mango Size Classification Using RGB Color Sensor and Fuzzy Logic Technique. In Regional Conference on Science, Technology and Social Sciences (RCSTSS 2014) (pp. 287-296). Singapore, Springer

Rungpichayapichet, P., Mahayothee, B., Nagle, M., Khuwijitjaru, P., & Müller, J. (2016). Robust NIRS models for non-destructive prediction of postharvest fruit ripeness and quality in mango. Postharvest Biology and Technology, Vol.111, 31-40.

Sa’ad, F. S. A., Ibrahim, M. F., Shakaff, A. M., Zakaria, A., & Abdullah, M. Z. (2015). Shape and weight grading of mangoes using visible imaging. Computers and Electronics in Agriculture, Vol.115, 51-56.

Thairat news. (2016). Thai mango export market, [online]. Available access on 08/04/2016. (in Thai)

Vyas, A. M., Talati, B., & Naik, S. (2014). Quality Inspection and Classification of Mangoes using Color and Size Features. International Journal of Computer Applications, Vol.98(1).

Wang, J. C., Lian, L. X., Lin, Y. Y., & Zhao, J. H. (2015). VLSI design for SVM-based speaker verification system. IEEE Transactions on Very Large Scale Integration (VLSI) Systems, Vol.23(7), 1355-1359.

Wei, Q., Wu, B., Xu, D., & Zargari, N. R. (2017). Natural sampling SVM-based common-mode voltage reduction in medium-voltage current source rectifier. IEEE Transactions on Power Electronics, Vol.32(10), 7553-7560.

Zhao, N., Basarab, A., Kouamé, D., & Tourneret, J. Y. (2016). Joint segmentation and deconvolution of ultrasound images using a hierarchical Bayesian model based on generalized Gaussian priors. IEEE transactions on Image Processing, Vol.25(8), 3736-3750.