Abstract
As technology progresses, automation is increasingly gaining importance, and one area where it holds significant potential is fruit classification. This research endeavors to develop a fruit classification system utilizing computer vision techniques. To this end, this work modified the adoption of deep learning-based approaches, specifically a customized Convolutional Neural Network (CNN) and a Vision Transformer. The dataset employed in this study consists of 12 distinct fruit classes, encompassing six categories of healthy fruits and six categories of unhealthy fruits. A total of 12000 data from 12 different classes have been used for training and testing. Extensive preprocessing techniques were applied to enhance the performance of the models, accompanied by data augmentation methods. These steps aimed to ensure the models’ ability to effectively capture and differentiate the unique characteristics and features of various fruits. To optimize the models’ performance, a series of systematic research trials were conducted, involving the adjustment of various parameters. Through this iterative process, the models were fine-tuned to achieve the highest average classification accuracy. Notably, the vision transformer approach emerged as the most successful, attaining an outstanding average accuracy of 98.05%. The findings of this research demonstrate the efficacy of deep learning methodologies in fruit classification tasks, particularly the Vision Transformer architecture. The modified system exhibits remarkable accuracy, highlighting its potential for accurate and reliable fruit classification. By automating the fruit classification process through image classification techniques, this research contributes to the broader goal of streamlining and optimizing fruit quality assessment.
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig1_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig2_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig3_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig4_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig5_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig6_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig7_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig8_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig9_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig10_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig11_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig12_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig13_HTML.png)
![](http://media.springernature.com/m312/springer-static/image/art%3A10.1007%2Fs11042-024-19172-1/MediaObjects/11042_2024_19172_Fig14_HTML.png)
Similar content being viewed by others
Data Availability
The FRUITGB dataset[24] is openly available online and can be accessed through the https://ieee-dataport.org/open-access/fruitsgb-top-indian-fruits-quality.
References
Agarwal M, Agarwal S, Ahmad S, Singh R, Jayahari K (2021) Food loss and waste in india: the knowns and the unknowns. Mumbai, India, World Resources Institute India
Bazi Y, Bashmal L, Rahhal MMA, Dayil RA, Ajlan NA (2021) Vision transformers for remote sensing image classification. Remote Sensing 13(3). https://doi.org/10.3390/rs13030516, https://www.mdpi.com/2072-4292/13/3/516
Behera SK, Rath AK, Sethy PK (2021) Fruits yield estimation using faster r-cnn with miou. Multimedia Tools and Applications 80(12):19043–19056
Bolle RM, Connell JH, Haas N, Mohan R, Taubin G (1996) Veggievision: A produce recognition system. In: Proceedings Third IEEE Workshop on Applications of Computer Vision. WACV’96, pp. 244–251. IEEE
Brownlee J (2019) A gentle introduction to the rectified linear unit (relu). Machine learning mastery 6
Carion N, Massa F, Synnaeve G, Usunier N, Kirillov A, Zagoruyko S (2020) End-to-end object detection with transformers. In: European conference on computer vision, pp. 213–229. Springer
Chen H, Wang Y, Guo T, Xu C, Deng Y, Liu Z, Ma S, Xu C, Xu C, Gao W (2021) Pre-trained image processing transformer. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12299–12310
Chen M, Radford A, Child R, Wu J, Jun H, Luan D, Sutskever I (2020) Generative pretraining from pixels. In: International conference on machine learning, pp. 1691–1703. PMLR
Cheng H, Damerow L, Sun Y, Blanke M (2017) Early yield prediction using image analysis of apple fruit and tree canopy features with neural networks. Journal of Imaging 3(1):6
Cordonnier JB, Loukas A, Jaggi M (2019) On the relationship between self-attention and convolutional layers. ar**v:1911.03584
Devlin J, Chang MW, Lee K, Toutanova K (2018) Bert: Pre-training of deep bidirectional transformers for language understanding. ar**v:1810.04805
Dosovitskiy A, Beyer L, Kolesnikov A, Weissenborn D, Zhai X, Unterthiner T, Dehghani M, Minderer M, Heigold G, Gelly S et al (2020) An image is worth 16x16 words: Transformers for image recognition at scale. ar**v:2010.11929
Garcia F, Cervantes J, López A, Alvarado M (2016) Fruit classification by extracting color chromaticity, shape and texture features: towards an application for supermarkets. IEEE Lat Am Trans 14(7):3434–3443
Goodfellow I, Bengio Y, Courville A (2018) Softmax units for multinoulli output distributions. deep learning
Hendrycks D, Gimpel K (2016) Bridging nonlinearities and stochastic regularizers with gaussian error linear units
Kang J, Gwak J (2021) Ensemble of multi-task deep convolutional neural networks using transfer learning for fruit freshness classification. Multimedia Tools and Applications pp. 1–23
Kazi A, Panda SP (2022) Determining the freshness of fruits in the food industry by image classification using transfer learning. Multimedia Tools and Applications 81(6):7611–7624
Krizhevsky A, Sutskever I, Hinton GE (2012) Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems 25
Kumari A, Pankaj PP, Baskarm P (2015) Post-harvest losses of agricultural products: Management and future challenges in india. Recent Trends in Post harvest management. First Edn. Mangalam Publishers, New Delhi, pp 141–153
Lu S, Lu Z, Aok S, Graham L (2018) Fruit classification based on six layer convolutional neural network. In: 2018 IEEE 23rd International Conference on Digital Signal Processing (DSP), pp. 1–5. IEEE
Ma M, Ma W, Jiao L, Liu X, Li L, Feng Z, liu F, Yang S, (2023) A multimodal hyper-fusion transformer for remote sensing image classification. Information Fusion 96:66–79
Macanhã PA, Eler DM, Garcia RE, Junior WEM (2018) Handwritten feature descriptor methods applied to fruit classification. In: Information Technology-New Generations,pp. 699–705. Springer
Maurício J, Domingues I, Bernardino J (2023) Comparing vision transformers and convolutional neural networks for image classification: A literature review. Applied Sciences 13(9). https://doi.org/10.3390/app13095521. https://www.mdpi.com/2076-3417/13/9/5521
Meshram V, Thanomliang K, Ruangkan S, Chumchu P, Patil K (2020) Fruitsgb: Top indian fruits with quality. https://doi.org/10.21227/gzkn-f379. https://dx.doi.org/10.21227/gzkn-f379
Popescu MC, Balas VE, Perescu-Popescu L, Mastorakis N (2009) Multilayer perceptron and neural networks. WSEAS Transactions on Circuits and Systems 8(7):579–588
Qi Z, MaungMaung A, Kinoshita Y, Kiya H (2022) Privacy-preserving image classification using vision transformer. In: 2022 30th European Signal Processing Conference (EUSIPCO), pp. 543–547. https://doi.org/10.23919/EUSIPCO55093.2022.9909972
Radford A, Narasimhan K, Salimans T, Sutskever I, et al (2018) Improving language understanding by generative pre-training
Raffel C, Shazeer N, Roberts A, Lee K, Narang S, Matena M, Zhou Y, Li W, Liu PJ et al (2020) Exploring the limits of transfer learning with a unified text-to-text transformer. J Mach Learn Res 21(140):1–67
Seng WC, Mirisaee SH (2009) A new method for fruits recognition system. In: 2009 international conference on electrical engineering and informatics, vol. 1, pp. 130–134. IEEE
Shahi TB, Sitaula C, Neupane A, Guo W (2022) Fruit classification using attention-based mobilenetv2 for industrial applications. PLoS ONE 17(2):e0264586
Shamshad F, Khan S, Zamir SW, Khan MH, Hayat M, Khan FS, Fu H (2023) Transformers in medical imaging: A survey. Med Image Anal 88:102802
Srivastava N, Hinton G, Krizhevsky A, Sutskever I, Salakhutdinov R (2014) Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research 15(1):1929–1958
Vaswani A, Shazeer N, Parmar N, Uszkoreit J, Jones L, Gomez AN, Kaiser L, Polosukhin I (2017) Attention is all you need. Advances in neural information processing systems 30
Wang Q, Nuske S, Bergerman M, Singh S (2013) Automated crop yield estimation for apple orchards. In: Experimental robotics, pp. 745–758. Springer
Wang SH, Chen Y (2020) Fruit category classification via an eight-layer convolutional neural network with parametric rectified linear unit and dropout technique. Multimedia Tools and Applications 79(21):15117–15133
Zeng P, Li L (2019) Research on fruit image classification and recognition based on convolutional neural network. Mech. Des. Res 35:23–26
Zhang Y, Wang S, Ji G, Phillips P (2014) Fruit classification using computer vision and feedforward neural network. J Food Eng 143:167–177
Zheng S, Lu J, Zhao H, Zhu X, Luo Z, Wang Y, Fu Y, Feng J, **ang T, Torr PH, et al (2021) Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6881–6890
Zhou L, Zhou Y, Corso JJ, Socher R, **ong C (2018) End-to-end dense video captioning with masked transformer. In: Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8739–8748
Zhu X, Su W, Lu L, Li B, Wang X, Dai J F DD (2021) Deformable transformers for end-to-end object detection. In: Proceedings of the 9th International Conference on Learning Representations. Virtual Event, Austria: OpenReview. net
Funding
No funding was received to assist with the preparation of this manuscript.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflicts of interest
The authors declare that they have 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
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Zala, S., Goyal, V., Sharma, S. et al. Transformer based fruits disease classification. Multimed Tools Appl (2024). https://doi.org/10.1007/s11042-024-19172-1
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11042-024-19172-1