Skip to main content
Log in

Machine Learning–Based Detection and Sorting of Multiple Vegetables and Fruits

  • Published:
Food Analytical Methods Aims and scope Submit manuscript

Abstract

Vegetable and fruit security plays a crucial role in the Indian economy. In the recent past, it has been noted that vegetables and fruits are affected by different diseases. This leads to the failure of the economy in the agriculture field. The identification of type and grading of vegetables and fruit is onerous due to the heavy production of products. The manual investigation is expensive, laborious, and inconsistent. Thus, an automated machine learningbased algorithm is proposed for the detection of type and quality grading of five different (jalapeno, lemon, sweet potato, cabbage, and tomato) vegetables and four different (apple, avocado, banana, and orange) varieties of fruits. Firstly, images are preprocessed by Gaussian filtering to enhance the quality of the image and removing of noise. Secondly, segmentation of images is done by fuzzy c-means clustering and grab-cut. Then, various features, namely, statistical, color, textural, geometrical, Laws’ texture energy, the histogram of gradients, and discrete wavelet transform, are extracted (114) and selected from feature vector by PCA. The detection of vegetable and fruit types is done by color and geometrical features while all other features are considered for grading. Lastly, LR, SRC, ANN, and SVM are used to make decisions for sorting and grading. The performance of the system has been validated by the k (10) fold cross-validation technique. The proposed algorithm achieves 85.49% (LR), 87.63% (SRC), 92.64% (ANN), and 97.63% (SVM) for detection of type. Also, the system achieves 83.91% (LR), 85.00% (SRC), 89.54% (ANN), and 96.59% (SVM) for grading. The proper feature selection shows the enhanced performance of the system. Among four different classifiers, SVM shows more efficient results that are promising and comparable with the literature.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12

Similar content being viewed by others

References

  • Anonymous (2004) Commission Regulation (EC) No 85/2004 of 15 January 2004 on marketing standards for apples. Off J Eur Union L 13:3–18

    Google Scholar 

  • Apples Image. Retrieved January 15, 2018, from https://www.google.com/search?biw=1366&bih=657&tbm=isch&sa=1&ei=2T4wXaz0HNO5rQHbnpewBA&q=healthy+apples+images&oq=healthy+apples+images&gs_l=img.3...9438.13173..13989...0.0..0.1981240.0j8......0....1..gws-wiz-img.......0i8i7i30.1bojhB1Qxk&ved=0ahUKEwjsxIfYlr7jAhXTXCsKHVvPBUYQ4dUDCAY&uact=5

  • Ashok V, Vinod DS (2014) Automatic quality evaluation of fruits using probabilistic neural network approach. International Conference on Contemporary Computing and Informatics (IC3I) 308–31

  • Bandyopadhyaya I, Babu D, Bhattacharjee S, Roychowdhury J (2014) Vegetable grading using tactile sensing and machine learning Advanced Computing, Networking and Informatics - Volume 1. Smart Innov Syst Technol 27:77–85

    Article  Google Scholar 

  • Baranowski P, Mazurek W, Wozniak J, Majewska U (2012) Detection of early bruises in apples using hyperspectral data and thermal imaging. J Food Eng 110(3):345–355

    Article  Google Scholar 

  • Bhargava A, Bansal A (2018) Fruits and vegetables quality evaluation using computer vision: a review” Journal of King Saud University Computer and Information Sciences, June 2018 (Elsevier, Scopus Indexed)

  • Bhargava A, Bansal A (2020a) Quality evaluation of mono & bi-colored apples with computer vision and multispectral imaging. Multimedia Tools Appl 79:7857–7874

    Article  Google Scholar 

  • Bhargava A, Bansal A (2020b) Machine learning-based quality evaluation of mono-colored apples. Multimedia Tools Appl 79:22989–23006

    Article  Google Scholar 

  • Bhargava A, Bansal A (2020c) Automatic detection and grading of multiple fruits by machine learning. Food Anal Methods 13:751–761

    Article  Google Scholar 

  • Bhargava A, Bansal A (2021) Classification and grading of multiple variety of apple fruit. Food Anal Methods. https://doi.org/10.1007/s12161-021-01970-0

  • Bhargava A, Bansal A (2021) Classification and grading of multiple variety of apple fruit. Food Anal Methods. https://doi.org/10.1007/s12161-021-01970-0

  • Bing Kang S, Webb JA, Zitnick CL, Kanade T (1995) A multibaseline stereo system with active illumination and real-time image acquisition, in: Proceedings of IEEE International Conference on Computer Vision 88–93. https://doi.org/10.1109/ICCV.1995.466802

  • Biswas H, Hossain F (2013) Automatic vegetable recognition system. Int J Eng Sci Invent 2319–6734(2):37–41

    Google Scholar 

  • Blasco J, Aleixos N, Molto E (2003) A machine vision system for automatic quality grading of fruit. Biosys Eng 85(4):415–423

    Article  Google Scholar 

  • Brosnan T, Sun D-W (2004) Improving quality inspection of food products by computer vision review. J Food Eng 61(1):3–16. https://doi.org/10.1016/S0260-8774(03)00183-3.Applicationsofcomputervisioninthefoodindustry

    Article  Google Scholar 

  • Chandra Sekhar Nandi, Bipan Tudu, Chiranjib Koley (2014) Computer vision based mango fruit grading system. International conference on Innovative Engineering Technologies (ICIET’2014) Dec. 28–29, 2014 Bangkok (Thailand) 1–5

  • Chandra Sekhar Nandi, Bipan Tudu, and Chiranjib Koley (2016) A machine vision technique for grading of harvested mangoes based on maturity and quality. IEEE Sensors J Vol. 16, No. 16, , 6387–6396

  • Chang CC, Lin CJ (2001) Libsvm: a library for support vector machines, via http://www.csie.ntu.edu.tw/cjlin/libsvm. Accessed 18 Aug 2018

  • Clement J, Novas N, Gazquez J, Manzano-Agugliaro F (2012) High speed intelligent classifier of tomatoes by colour, size and weight. Span J Agric Res 10(2):314–325

    Article  Google Scholar 

  • D. J. Lee, Senior Member IEEE, Yuchou Chang, James K. Archibald, Senior Member IEEE, and Christopher G. Greco Color quantization and image analysis for automated fruit quality evaluation 4th IEEE Conference on Automation Science and Engineering 194–199

  • D Smita, K Rajendra (2019) Proposed fungi disease detection method for vegetable crops using image processing. Int J Adv Res Comput Commun Eng 8(7):22–26

    Google Scholar 

  • Donis-Gonzlez IR, Guyer DE, Pease A, Barthel F (2014) Internal characterisation of fresh agricultural products using traditional and ultrafast electron beam x-ray computed tomography imaging. Biosyst Eng 117:104–113. https://doi.org/10.1016/j.biosystemseng.2013.07.002.ImageAnalysisinAgriculture

    Article  Google Scholar 

  • Dorj UO, Lee M, Yum S (2017) An yield estimation in citrus orchards via fruit detection and counting using image processing. Comput Electron Agric 140:103–112

    Article  Google Scholar 

  • Ebrahimnejad H, Ebrahimnejad H, Salajegheh A, Barghi H (2018) Use of magnetic resonance imaging in food quality control: a review. J Biomed Phys Eng 8:119–124. https://doi.org/10.22086/jbpe.v0i0.628

    Article  Google Scholar 

  • ElMasry G, Cubero S, Molto E, Blasco J (2012) In-line sorting of irregular potatoes by using automated computer-based machine vision system. J Food Eng 112(1–2):60–68

    Article  Google Scholar 

  • Golnabi H, Asadpour A (2007) Design and application of industrial machine vision systems, Robot. Comput.-Integr. Manuf. 23 (6) 630–637. 10.1016/j.rcim.20 07.02.0 05 . 16th International Conference on Flexible Automation and Intelligent Manufacturing

  • Google https://www.istockphoto.com/photos/rotten-cabbage

  • Hall JG, Rapanotti LL (2013) Beauty in software engineering. Computer 46:85–87

    Article  Google Scholar 

  • Horeao https://github.com/Horea94/Fruit-Images-Dataset

  • https://engineering.purdue.edu/RVL/Database/IFW/database/index.html.

  • https://www.downtoearth.org.in/news/agriculture/agri-share-in-gdp-hit-20-after-17-years-economic-survey75271#:~:text=The%20share%20of%20agriculture%20in%20GDP%20increased%20to%2019.9%20per,per%20cent%20in%202019%2D20. Assessed 1 Mar 2020

  • https://www.thehindubusinessline.com/economy/agri-business/west-bengal-emerges-at-the-top-in-vegetable-production/article30609191.ece. Assessed 1 Mar 2020

  • India at a glance. FAO in India. Food and Agriculture Organization of the United Nations; 2018. Link: <http://www.fao.org/india/fao-in-india/india-at-a-glance/en/>

  • Jigar A, Soni, Hetal N (2018) Patel, Design of an automatic image detection algorithm for on-tree green citrus fruit

  • Jolliffe I (1986) Principal component analysis. Harrisonburg: R.R. Donnelley & Sons

  • Justin FT, Xiaoqian X (2006) Implementing Grab-Cut. Brigham Young University, Revised: April 7, 2006

  • K Mandeep, S Reecha (2015) ANN based technique for vegetable quality detection. J Electron Commun Eng 10(5):62–70

    Google Scholar 

  • Kamilaris A, Prenafeta-Boldu´ FX, (2018) Deep learning in agriculture: a survey. Comput Electron Agric 147:70–90

    Article  Google Scholar 

  • Khan MA, Lali MIU, Sharif M, Javed K, Aurangzeb K, Haider SI, Altamrah AS, Akram AT (2019) An optimized method for segmentation and classification of apple diseases based on strong correlation and genetic algorithm based feature selection. IEEE Access 7:46261–46277

    Article  Google Scholar 

  • Kalluri SR (2018) Apple, Orange, Banana Images are retrieved January 15, 2018 from https://www.kaggle.com/sriramr/fruits-fresh-and-rotten-for-classification. Accessed 9 Dec 2019

  • Kritik Seth https://www.kaggle.com/kritikseth/fruit-and-vegetable-image-recognition.

  • Kukreja V, Dhiman P (2020) A deep neural network based disease detection scheme for citrus fruits. Proc Int Conf Smart Electron Commun 97–101

  • Li L, Li Z,i Lan Y, Shi Y, Cu Y (2019) Design of a tomato classifier based on machine vision. PLOS ONE 1–16. https://doi.org/10.1371/journal.pone.0219803

  • Lou S, Jiang X, Scott PJ (2012) Algorithms for morphological profile filters and their comparison. Precis Eng 36(3):414–423

    Article  Google Scholar 

  • Luiz Fernando Santos Pereira, Sylvio Barbon Jr, Nektarios A. Valous, Douglas Fernandes Barbina (2018) Predicting the ripening of papaya fruit with digital imaging and random forests. Comput Electron Agric 145 76–82

  • Mamta S, Hemanga B, Bhawna T, Sweta J, Moreshwar K, Ranbir S, Pankaj G (2017) Horticultural statistics at a glance. Link: <http://nhb.gov.in/statistics/Publication/Horticulture%20At%20a%20Glance%202017%20for%20net%20uplod%20(2).pdf>. Accessed 28 Feb 2020

  • Markov Skranec http://www.vicos.si/Downloads/FIDS30

  • Mihai Oltean https://www.kaggle.com/moltean/fruits

  • Moallem P, Razmjooy N, Ashourian M (2013) Computer vision -based potato defect detection using neural networks and support vector machine. Int J Robot Autom 28(2):137–145

    Google Scholar 

  • Moallem P, Serajoddin A, Pourghassem H (2017) Computer vision based apple grading for golden delicious apples based on surface features. Inform Proc Agric 4:33–40

    Google Scholar 

  • Oltean M (2018) Avocado retrieved January 15, 2018 from https://www.kaggle.com/moltean/fruits

  • Ou X, Pan W, Xiao P (2014) Vivo skin capacitive imaging analysis by using grey level co-occurrence matrix (GLCM). Int J Pharm 460(2):28–32

    Article  CAS  Google Scholar 

  • Payne AB, Walsh KB, Subedi PP, Jarvis D (2013) Estimation of mango crop yield using image analysis - segmentation method. Comput Electron Agric 91:57–64

    Article  Google Scholar 

  • Prabha DS, Kumar JS (2013) Assessment of banana fruit maturity by image processing technique, J Food Sci Technol

  • Rahamathunnisa U, Nallakaruppan MK, Sendhil Kumar KS (2020) Vegetable disease detection using k-means clustering and Svm. International Conference on Advance Computing and Communication Systems 1308–1311

  • Raikar MM, Meena SM, Kuchanur C, Girraddi S, Benagi P (2020) Classification and grading of okra-ladies finger using deep learning. Third Int Conf Comput Net Commun Procedia Comput Sci 171 2380–2389

  • Rong D (2017) Xiuqin Rao ⇑, Yibin Ying, Computer vision detection of surface defect on oranges by means of a sliding comparison window local segmentation algorithm. Comput Electron Agric 137:59–68

    Article  Google Scholar 

  • Ruchita R, Mhaski PB, Chopade M, Dale (2015) Determination of ripeness and grading of tomato using image analysis on raspberry pi. Int Conf Commun Control Intel Syst 214–220

  • Seelan SK, Laguette S, Casady GM, Seielstad GA (2003) Remote sensing applications for precision agriculture: a learning community approach. Remote Sens Environ 88 (1) 157–169, https://doi.org/10.1016/j.rse.20 03.04.0 07. IKONOS Fine Spatial Resolution Land Observation

  • Sergio Cubero, Francisco Albert, Jos Manuel Prats-Moltalban, Daniel G Fernandez-Pacheco, Jose Blasco, Nuria Aleixos (2018) Application for the estimation of the standard citrus colour index (CCI) using image processing in mobile devices. Biosyst Eng 167 63–74

  • Si Y, Sankaran S, Richard Knowles N, Pavek MJ (2016) Potato tuber length-width ratio assessment using image analysis. Am J Potato Res 1–6

  • The economic times. GDP data; 2018. Link <https://economictimes.indiatimes.com/news/economy/indicators/ view-being-the-worlds-6th-largest-economy-means-littlefor- indias-future/articleshow/64966415.cms>

  • Unay & Gosselin (2005) Artificial neural network-based segmentation and apple grading by machine vision. International Conference on Image processing

  • Unay D, Gosselin B, Kleynen O, Leemans V, Destain M-F, Debeir O (2011) Automatic grading of Bi-colored apples by multispectral machine vision. Comput Electron Agric 75(1):204–212

    Article  Google Scholar 

  • Usha S, Karthik M, Jenifer R (2017) Automated sorting and grading of vegetables using image processing. Int J Eng Res Gen Sci 5(6):53–61

    Google Scholar 

  • Vadivambal R, Jayas D (2011) Applications of thermal imaging in agriculture and food industry review. Food Bioproc Tech 4:186–199. https://doi.org/10.1007/s11947-010-0333-5

    Article  Google Scholar 

  • Wang L, Qu J (2009) Satellite remote sensing applications for surface soil moisture monitoring: a review. Front Earth Sci China 3:237–247. https://doi.org/10.1007/s11707-009-0023-7

    Article  Google Scholar 

  • Wen X, Fang J, Diao M, Zhang C (2012) Artificial neural network modeling of dissolved oxygen in the Heihe River Northwestern China. Environ Monit Assess 185(5):4361–4371

    Article  Google Scholar 

  • Wright J, Yang AY, Ganesh A, Sastry SS, Yi M (2009) Robust face recognition via sparse representation. Pattern Anal Machine Intel IEEE Transact 31:210–227

    Article  Google Scholar 

  • Wu D, Sun D-W (2013) Color measurements by computer vision for food quality control–a review. Trends Food Sci Technol 29:5–20

    Article  Google Scholar 

  • Ying Y, Jing H, Tao Y, Zhang N (2003) Detecting stem and shape of pears using fourier transformation and an artificial neural network. Trans ASAE 46:157–162. https://doi.org/10.13031/2013.12538

    Article  Google Scholar 

  • Yuan B, Weiting L, Dinssa FF, Simon JE, Wu Q (2021) Free amino acids in African indigenous vegetables: analysis with improved hydrophilic interaction ultra-high performance liquid chromatography tandem mass spectrometry and interactive machine learning. J Chromatography 1637 461733

  • Zheng H, Hongfei Lu (2012) A least-squares support vector machine (LS-SVM) based on fractal analysis and CIELab parameters for the detection of browning degree on mango (Mangifera indica L.). Comput Electron Agric 83:47–51

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Anuja Bhargava.

Ethics declarations

Ethical Approval

This article does not contain any studies with human participants or animals performed by any of the authors.

Informed Consent

Not applicable.

Conflict of Interest

Anuja Bhargava declares that he has no conflict of interest. Atul Bansal declares that he has no conflict of interest. Vishal Goyal declares that he has no conflict of interest.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Bhargava, A., Bansal, A. & Goyal, V. Machine Learning–Based Detection and Sorting of Multiple Vegetables and Fruits. Food Anal. Methods 15, 228–242 (2022). https://doi.org/10.1007/s12161-021-02086-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s12161-021-02086-1

Keywords

Navigation