Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks
Abstract
:1. Introduction
2. Methodology
2.1. Dataset and Preparation
2.2. Methodology
2.2.1. Vision Transformer
2.2.2. MobileNetV2
2.2.3. ResNet18
2.3. Hyperparameter Optimization and Attention Mechanism
2.4. Power Units
2.5. Evaluation Metrics
3. Results
4. Discussion
5. Future Work
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Shorif Uddin, M.; Bansal, J.C. Computer Vision and Machine Learning in Agriculture. Algorithms for Intelligent Systems; Springer: Singapore, 2021; Volume 2. [Google Scholar]
- Hadipour-Rokni, R.; Askari Asli-Ardeh, E.; Jahanbakhshi, A.; Esmaili paeen-Afrakoti, I.; Sabzi, S. Intelligent Detection of Citrus Fruit Pests Using Machine Vision System and Convolutional Neural Network through Transfer Learning Technique. Comput. Biol. Med. 2023, 155, 106611. [Google Scholar] [CrossRef] [PubMed]
- Zhou, C.; Hu, J.; Xu, Z.; Yue, J.; Ye, H.; Yang, G. A Novel Greenhouse-Based System for the Detection and Plumpness Assessment of Strawberry Using an Improved Deep Learning Technique. Front. Plant Sci. 2020, 11, 559. [Google Scholar] [CrossRef] [PubMed]
- Lello, F.; Dida, M.; Mkiramweni, M.; Matiko, J.; Akol, R.; Nsabagwa, M.; Katumba, A. Fruit Fly Automatic Detection and Monitoring Techniques: A Review. Smart Agric. Technol. 2023, 5, 100294. [Google Scholar] [CrossRef]
- Suryanarayana, T.M.V. Principal Component Regression for Crop Yield Estimation [Electronic Resource], 1st ed.; Springer Briefs in Applied Sciences and Technology; Springer: Singapore, 2016; ISBN 978-981-10-0663-0. [Google Scholar]
- Chen, Y.; Lee, W.S.; Gan, H.; Peres, N.; Fraisse, C.; Zhang, Y.; He, Y. Strawberry Yield Prediction Based on a Deep Neural Network Using High-Resolution Aerial Orthoimages. Remote Sens. 2019, 11, 1584. [Google Scholar] [CrossRef]
- Afzaal, U.; Bhattarai, B.; Pandeya, Y.R.; Lee, J. An Instance Segmentation Model for Strawberry Diseases Based on Mask R-CNN. Sensors 2021, 21, 6565. [Google Scholar] [CrossRef]
- Daubney, H.A. Cultivated Berries. In The Canadian Encyclopedia; Hurtig Publishers Ltd.: Toronto, ON, Canada, 2015. [Google Scholar]
- Rahamathunnisa, U.; Nallakaruppan, M.K.; Anith, A.; Kumar KS, S. Vegetable Disease Detection Using K-Means Clustering and svm. In Proceedings of the 2020 6th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 6–7 March 2020; pp. 1308–1311. [Google Scholar]
- Puttemans, S.; Tits, L.; Vanbrabant, Y.; Goedeme, T. Automated Visual Fruit Detection for Harvest Estimation and Robotic Harvesting. In Proceedings of the 2016 Sixth International Conference on Image Processing Theory, Tools and Applications (IPTA), Oulu, Finland, 12–15 December 2016. [Google Scholar]
- Pérez-Borrero, I.; Marín-Santos, D.; Gegúndez-Arias, M.E.; Cortés-Ancos, E. A Fast and Accurate Deep Learning Method for Strawberry Instance Segmentation. Comput. Electron. Agric. 2020, 178, 105736. [Google Scholar] [CrossRef]
- Vuttipittayamongkol, P.; Elyan, E.; Petrovski, A. On the Class Overlap Problem in Imbalanced Data Classification. Knowl.-Based Syst. 2021, 212, 106631. [Google Scholar] [CrossRef]
- Ojo, M.O.; Zahid, A. Improving Deep Learning Classifiers Performance via Preprocessing and Class Imbalance Approaches in a Plant Disease Detection Pipeline. Agronomy 2023, 13, 887. [Google Scholar] [CrossRef]
- Buda, M.; Maki, A.; Mazurowski, M.A. A Systematic Study of the Class Imbalance Problem in Convolutional Neural Networks. Neural Netw. 2018, 106, 249–259. [Google Scholar] [CrossRef]
- Ketabforoosh, K. Strawberry Images 2023. Available online: https://osf.io/ej5qv/ (accessed on 13 February 2023).
- Rezaei-Dastjerdehei, M.R.; Mijani, A.; Fatemizadeh, E. Addressing Imbalance in Multi-Label Classification Using Weighted Cross Entropy Loss Function. In Proceedings of the 2020 27th National and 5th International Iranian Conference on Biomedical Engineering (ICBME), Tehran, Iran, 26–27 November 2020; pp. 333–338. [Google Scholar] [CrossRef]
- PyTorch Documentation—PyTorch 2.1 Documentation. Available online: https://pytorch.org/docs/stable/index (accessed on 6 December 2023).
- Dosovitskiy, A.; Beyer, L.; Kolesnikov, A.; Weissenborn, D.; Zhai, X.; Unterthiner, T.; Dehghani, M.; Minderer, M.; Heigold, G.; Gelly, S.; et al. An Image Is Worth 16x16 Words: Transformers for Image Recognition at Scale. arXiv, 2020; arXiv:2010.11929. [Google Scholar] [CrossRef]
- Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.-C. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019. [Google Scholar] [CrossRef]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep Residual Learning for Image Recognition. In Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar] [CrossRef]
- Caron, M.; Touvron, H.; Misra, I.; Jégou, H.; Mairal, J.; Bojanowski, P.; Joulin, A. Emerging Properties in Self-Supervised Vision Transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, QC, Canada, 10–17 October 2021. [Google Scholar] [CrossRef]
- Howard, A.G.; Zhu, M.; Chen, B.; Kalenichenko, D.; Wang, W.; Weyand, T.; Andreetto, M.; Adam, H. MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications. arXiv 2017, arXiv:1704.04861. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. In Proceedings of the Neural Information Processing Systems, New Orleans, LA, USA, 10—16 December 2023; Volume 30. [Google Scholar] [CrossRef]
- LeCun, Y.; Boser, B.; Denker, J.S.; Henderson, D.; Howard, R.E.; Hubbard, W.; Jackel, L.D. Backpropagation Applied to Handwritten Zip Code Recognition. Neural Comput. 1989, 1, 541–551. [Google Scholar] [CrossRef]
- Chen, J.; Zhang, D.; Suzauddola, M.; Zeb, A. Identifying Crop Diseases Using Attention Embedded MobileNet-V2 Model. Appl. Soft Comput. 2021, 113, 107901. [Google Scholar] [CrossRef]
- Szegedy, C.; Liu, W.; Jia, Y.; Sermanet, P.; Reed, S.; Anguelov, D.; Erhan, D.; Vanhoucke, V.; Rabinovich, A. Going Deeper with Convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014. [Google Scholar] [CrossRef]
- Andonie, R. Hyperparameter Optimization in Learning Systems. J. Membr. Comput. 2019, 1, 279–291. [Google Scholar] [CrossRef]
- Great Learning Team Hyperparameter Tuning with GridSearchCV. Available online: https://www.mygreatlearning.com/blog/gridsearchcv/ (accessed on 4 March 2024).
- Niu, Z.; Zhong, G.; Yu, H. A Review on the Attention Mechanism of Deep Learning. Neurocomputing 2021, 452, 48–62. [Google Scholar] [CrossRef]
- Digital Research Alliance of Canada. Available online: https://alliancecan.ca/en/node/10 (accessed on 6 December 2023).
- Gad, A.F. Accuracy, Precision, and Recall in Deep Learning. Available online: https://blog.paperspace.com/deep-learning-metrics-precision-recall-accuracy/ (accessed on 6 December 2023).
- Zheng, Z.; Hu, Y.; Guo, T.; Qiao, Y.; He, Y.; Zhang, Y.; Huang, Y. AGHRNet: An Attention Ghost-HRNet for Confirmation of Catch-and-shake Locations in Jujube Fruits Vibration Harvesting. Comput. Electron. Agric. 2023, 210, 107921. [Google Scholar] [CrossRef]
- Girotto, F.; Alibardi, L.; Cossu, R. Food Waste Generation and Industrial Uses: A Review. Waste Manag. 2015, 45, 32–41. [Google Scholar] [CrossRef]
- Dhiman, S. Sustainable Social Entrepreneurship: Serving the Destitute, Feeding the Hungry, and Reducing the Food Waste. In Social Entrepreneurship and Corporate Social Responsibility; Springer: Berlin/Heidelberg, Germany, 2020; pp. 193–208. ISBN 978-3-030-39675-6. [Google Scholar] [CrossRef]
- Denkenberger, D.; Pearce, J. Feeding Everyone No Matter What: Managing Food Security after Global Catastrophe; Academic Press: Cambridge, MA, USA, 2014; ISBN 978-0-12-802150-7. [Google Scholar]
- Meyer, T.; Pearce, J. How Easy Is It to Feed Everyone? Economic Alternatives to Eliminate Human Nutrition Deficits. Food Ethics 2022, 8, 3. [Google Scholar] [CrossRef]
- Oğuz, İ.; Oğuz, H.İ.; Kafkas, N.E.; Oğuz, İ.; Oğuz, H.İ.; Kafkas, N.E. Strawberry Cultivation Techniques. In Recent Studies on Strawberries; IntechOpen: London, UK, 2022; ISBN 978-1-80355-199-9. [Google Scholar] [CrossRef]
- Zacharaki, K.; Monaghan, J.; Bromley, J.; Vickers, L. Opportunities and Challenges for Strawberry Cultivation in Urban Food Production Systems. Plants People Planet 2024, 6, 611–621. [Google Scholar] [CrossRef]
- Dinesh, H.; Pearce, J.M. The Potential of Agrivoltaic Systems. Renew. Sustain. Energy Rev. 2016, 54, 299–308. [Google Scholar] [CrossRef]
- Widmer, J.; Christ, B.; Grenz, J.; Norgrove, L. Agrivoltaics, a Promising New Tool for Electricity and Food Production: A Systematic Review. Renew. Sustain. Energy Rev. 2024, 192, 114277. [Google Scholar] [CrossRef]
- Wydra, K.; Vollmer, V.; Busch, C.; Prichta, S.; Wydra, K.; Vollmer, V.; Busch, C.; Prichta, S. Agrivoltaic: Solar Radiation for Clean Energy and Sustainable Agriculture with Positive Impact on Nature; IntechOpen: London, UK, 2023; ISBN 978-1-83768-216-4. [Google Scholar] [CrossRef]
- Woo, S.; Uyeh, D.D.; Kim, J.; Kim, Y.; Kang, S.; Kim, K.C.; Lee, S.Y.; Ha, Y.; Lee, W.S. Analyses of Work Efficiency of a Strawberry-Harvesting Robot in an Automated Greenhouse. Agronomy 2020, 10, 1751. [Google Scholar] [CrossRef]
- Xiao, J.-R.; Chung, P.-C.; Wu, H.-Y.; Phan, Q.-H.; Yeh, J.-L.A.; Hou, M.T.-K. Detection of Strawberry Diseases Using a Convolutional Neural Network. Plants 2020, 10, 31. [Google Scholar] [CrossRef] [PubMed]
- Kamilaris, A.; Prenafeta-Boldú, F.X. Deep Learning in Agriculture: A Survey. Comput. Electron. Agric. 2018, 147, 70–90. [Google Scholar] [CrossRef]
- Türkoğlu, M.; Hanbay, D. Plant Disease and Pest Detection Using Deep Learning-Based Features. Turk. J. Electr. Eng. Comput. Sci. 2019, 27, 1636–1651. [Google Scholar] [CrossRef]
- Lee, S.H.; Chan, C.S.; Mayo, S.; Remagnino, P. How Deep Learning Extracts and Learns Leaf Features for Plant Classification. Pattern Recognit. 2017, 71, 1–13. [Google Scholar] [CrossRef]
Preprocessing | Value |
---|---|
Resize | (256, 256) |
Center Crop | (224, 224) |
Normalize (mean) | [0.485, 0.456, 0.406] |
Normalize (std) | [0.229, 0.224, 0.225] |
Class Name | Angular Leaf Spot | Anthracnose Fruit Rot | Blossom Blight | Gray Mold | Leaf Spot | Powdery Mildew Fruit Rot | Powdery Mildew Leaf | Ripe Strawberries | Unripe Strawberries |
---|---|---|---|---|---|---|---|---|---|
No. of Original | 245 | 54 | 117 | 255 | 382 | 80 | 319 | 230 | 243 |
After Addition | 245 | 100 | 150 | 255 | 382 | 151 | 319 | 230 | 243 |
Class weights | 0.8569 | 3.8847 | 1.7481 | 0.7438 | 0.5406 | 2.6757 | 0.6490 | 1.0724 | 1.0385 |
Parameter | Value |
---|---|
Optimizer | SGD |
Batch size | 32 |
Learning rate | 0.001 |
Epoch | 200 |
Momentum | 0.9 |
Training GPU | Digital Alliance Canada (sharcnet) A100 (Google Colab) |
Model | Precision | Recall | F1 Score | Accuracy |
---|---|---|---|---|
Vision transformer | 0.983 | 0.983 | 0.983 | 0.984 |
MobileNetV2 | 0.980 | 0.979 | 0.979 | 0.981 |
ResNet18 | 0.979 | 0.978 | 0.978 | 0.979 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Aghamohammadesmaeilketabforoosh, K.; Nikan, S.; Antonini, G.; Pearce, J.M. Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks. Foods 2024, 13, 1869. https://doi.org/10.3390/foods13121869
Aghamohammadesmaeilketabforoosh K, Nikan S, Antonini G, Pearce JM. Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks. Foods. 2024; 13(12):1869. https://doi.org/10.3390/foods13121869
Chicago/Turabian StyleAghamohammadesmaeilketabforoosh, Kimia, Soodeh Nikan, Giorgio Antonini, and Joshua M. Pearce. 2024. "Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks" Foods 13, no. 12: 1869. https://doi.org/10.3390/foods13121869
APA StyleAghamohammadesmaeilketabforoosh, K., Nikan, S., Antonini, G., & Pearce, J. M. (2024). Optimizing Strawberry Disease and Quality Detection with Vision Transformers and Attention-Based Convolutional Neural Networks. Foods, 13(12), 1869. https://doi.org/10.3390/foods13121869