Size Classification of Tomato Fruit Using Thresholding, Machine Learning, and Deep Learning Techniques

Robert G. de Luna, Elmer P. Dadios, Argel A. Bandala, Ryan Rhay P. Vicerra


The size of tomato fruits is closely related to the market segment and price. Manual sorting in tomato is very dependent on human interpretation and thus, very prone to error.  The study presents thresholding, machine learning, and deep learning techniques in classifying the tomato as small, medium, and large based from a single tomato fruit image implemented using Open CV libraries and Python programming. Tomato images with different sizes are gathered where features like area, perimeter, and enclosed circle radius are extracted. The experiment shows that using thresholding, a classification accuracy of 85.83%, 65.83%, and 80% was achieved for area, perimeter, and enclosed circle radius, respectively. For machine learning, the training accuracy rates were recorded as 94.00%-95.00% for SVM, 97.50-92.50% for KNN and 90.33-92.50% for ANN. Comparison of models revealed that SVM is the most model without over fitting. The deep learning approach, regardless of the algorithm, produced low performances with 82.31%-78.21%-55.97% training-validation-testing accuracy for VGG16, 48.17%-41.44%-37.64% for InceptionV3, and 56.05%-44.96%-22.78% for ResNet50 models. Comparative analysis showed that machine learning technique bested the performance of the thresholding and deep learning techniques in classifying the tomato fruit size in terms of accuracy performance.


tomato fruit; solanum lycopersicum; kamatis; image processing; machine-vision

Full Text:



Arjenaki, O. O., Moghaddam, P. A., & Motlagh, A. M. (2013). Online tomato sorting based on shape, maturity, size, and surface defects using machine vision. Turkish Journal of Agriculture and Forestry, 37, 62–68. crossref

de Luna, R. G., Baldovino, R. G., Cotoco, E. A., de Ocampo, A. L. P., Valenzuela, I. C., Culaba, A. B., & Gokongwei, E. P. D. (2017). Identification of philippine herbal medicine plant leaf using artificial neural network. 2017IEEE 9th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), 1–8. crossref

de Luna, R. G., Dadios, E. P., & Bandala, A. A. (2018). Automated Image Capturing System for Deep Learning-based Tomato Plant Leaf Disease Detection and Recognition. TENCON 2018-2018 IEEE Region 10 Conference, 1414–1419. crossref

Dimatira, J. B. U., Dadios, E. P., Culibrina, F., Magsumbol, J., Cruz, J. D., Sumage, K., … Gomez, M. (2016). Application of fuzzy logic in recognition of tomato fruit maturity in smart farming. 2016 IEEE Region 10 Conference (TENCON), 2031–2035. crossref

Fellegari, R., & Navid, H. (2011). Determining the orange volume using image processing. Interbational Conference on Food Engineering and Biotechnoly (ICFEB 2011), 180–184. Retrieved from pdf

Gatica, G., Best, S., Ceroni, J., & Lefranc, G. (2013). Olive fruits recognition using neural networks. Procedia Computer Science, 17, 412–419. crossref

Gongal, A., Karkee, M., & Amatya, S. (2018). Apple fruit size estimation using a 3D machine vision system. Information Processing in Agriculture, 5(4), 498–503. crossref

Hu, M.-H., Dong, Q.-L., Malakar, P. K., Liu, B.-L., & Jaganathan, G. K. (2015). Determining banana size based on computer vision. International Journal of Food Properties, 18(3), 508–520. crossref

Ibrahim, Z., Sabri, N., & Isa, D. (2018). Palm Oil Fresh Fruit Bunch Ripeness Grading Recognition Using Convolutional Neural Network. Journal of Telecommunication, Electronic and Computer Engineering (JTEC), 10(3–2), 109–113. Retrieved from crossref

Iqbal, S. M., Gopal, A., Sankaranarayanan, P. E., & Nair, A. B. (2015). Estimation of size and shape of citrus fruits using image processing for automatic grading. 2015 3rd International Conference on Signal Processing, Communication and Networking (ICSCN), 1–8. crossref

Jana, S., Basak, S., & Parekh, R. (2017). Automatic fruit recognition from natural images using color and texture features. 2017 Devices for Integrated Circuit (DevIC), 620–624. crossref

Kalantari, D. (2014). Size determination of apple and orange fruits using the image processing technique. Advances in Agriculture, Sciences and Engineering Research, 4(2), 1537–1543. Retrieved from website

Kaur, K., & Gupta, O. (2017). A machine learning approach to determine maturity stages of tomatoes. Oriental Journal of Computer Science and Technology, 10(3), 683–690. crossref

Lesaca, P. R. A. (2019). There is gold in tomatoes. Retrieved from Business Diary Philippiines website: website

Naik, S., & Patel, B. (2017). Machine Vision based Fruit Classification and Grading-A Review. International Journal of Computer Applications, 170(9), 22–34. Retrieved from pdf

Phlippine Statistic Authority. (2019). Major Vegetables and Root Crops Quarterly Bulletin, April-June 2019. Retrieved from website

Sanches, M. J. (2019). Production value of tomatoes in the Philippines from 2011 to 2018 (in billion Philippine pesos). Retrieved from website

Thipakorn, J., Waranusast, R., & Riyamongkol, P. (2017). Egg weight prediction and egg size classification using image processing and machine learning. 2017 14th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON), 477–480. crossref

Valenzuela, I. C., Puno, J. C. V, Bandala, A. A., Baldovino, R. G., de Luna, R. G., De Ocampo, A. L., … Dadios, E. P. (2017). Quality assessment of lettuce using artificial neural network. 2017 IEEE 9th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment and Management (HNICEM), 1–5. crossref

Wan, P., Toudeshki, A., Tan, H., & Ehsani, R. (2018). A methodology for fresh tomato maturity detection using computer vision. Computers and Electronics in Agriculture, 146, 43–50. crossref

Yang, H. Q., Kuang, B. Y., & Mouazen, A. M. (2011). Size estimation of tomato fruits based on spectroscopic analysis. Advanced Materials Research, 225–226, 1254–1257. crossref

Yossy, E. H., Pranata, J., Wijaya, T., Hermawan, H., & Budiharto, W. (2017). Mango fruit sortation system using neural network and computer vision. Procedia Computer Science, 116, 596–603. crossref


Copyright (c) 2019 Universitas Brawijaya

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.