Log in

Transformer based fruits disease classification

  • Published:
Multimedia Tools and Applications Aims and scope Submit manuscript

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.

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
Fig. 13
Fig. 14

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

  1. 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

    Google Scholar 

  2. 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

  3. Behera SK, Rath AK, Sethy PK (2021) Fruits yield estimation using faster r-cnn with miou. Multimedia Tools and Applications 80(12):19043–19056

    Article  Google Scholar 

  4. 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

  5. Brownlee J (2019) A gentle introduction to the rectified linear unit (relu). Machine learning mastery 6

  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

  7. 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

  8. 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

  9. 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

    Article  Google Scholar 

  10. Cordonnier JB, Loukas A, Jaggi M (2019) On the relationship between self-attention and convolutional layers. ar**v:1911.03584

  11. Devlin J, Chang MW, Lee K, Toutanova K (2018) Bert: Pre-training of deep bidirectional transformers for language understanding. ar**v:1810.04805

  12. 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

  13. 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

    Article  Google Scholar 

  14. Goodfellow I, Bengio Y, Courville A (2018) Softmax units for multinoulli output distributions. deep learning

  15. Hendrycks D, Gimpel K (2016) Bridging nonlinearities and stochastic regularizers with gaussian error linear units

  16. 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

  17. 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

    Article  Google Scholar 

  18. Krizhevsky A, Sutskever I, Hinton GE (2012) Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems 25

  19. 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

    Google Scholar 

  20. 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

  21. 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

  22. 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

  23. 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

  24. 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

  25. 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

    Google Scholar 

  26. 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

  27. Radford A, Narasimhan K, Salimans T, Sutskever I, et al (2018) Improving language understanding by generative pre-training

  28. 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

    MathSciNet  Google Scholar 

  29. 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

  30. Shahi TB, Sitaula C, Neupane A, Guo W (2022) Fruit classification using attention-based mobilenetv2 for industrial applications. PLoS ONE 17(2):e0264586

    Article  Google Scholar 

  31. 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

  32. 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

    MathSciNet  Google Scholar 

  33. 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

  34. Wang Q, Nuske S, Bergerman M, Singh S (2013) Automated crop yield estimation for apple orchards. In: Experimental robotics, pp. 745–758. Springer

  35. 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

    Article  Google Scholar 

  36. Zeng P, Li L (2019) Research on fruit image classification and recognition based on convolutional neural network. Mech. Des. Res 35:23–26

    Google Scholar 

  37. Zhang Y, Wang S, Ji G, Phillips P (2014) Fruit classification using computer vision and feedforward neural network. J Food Eng 143:167–177

    Article  Google Scholar 

  38. 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

  39. 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

  40. 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

Download references

Funding

No funding was received to assist with the preparation of this manuscript.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vinat Goyal.

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.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

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

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11042-024-19172-1

Keywords

Navigation