Multiple Defect Classification Method for Green Plum Surfaces Based on Vision Transformer
Abstract
:1. Introduction
2. Materials and Methods
2.1. Data Collection and Processing
2.2. Dataset Processing Methods
2.3. Multiple Defect Detection Model of Green Plum Based on Vision Transformer
3. Results
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Fyfe, S.; Schirra, H.J.; Rychlik, M.; van Doorn, A.; Tinngi, U.; Sultanbawa, Y.; Smyth, H.E. Future flavours from the past: Sensory and nutritional profiles of green plum (Buchanania obovata), red bush apple (Syzygium suborbiculare) and wild peach (Terminalia carpentariae) from East Arnhem Land, Australia. Future Foods 2022, 5, 100136. [Google Scholar] [CrossRef]
- Mahanti, N.K.; Pandiselvam, R.; Kothakota, A.; Ishwarya, S.P.; Chakraborty, S.K.; Kumar, M.; Cozzolino, D. Emerging non-destructive imaging techniques for fruit damage detection: Image processing and analysis. Trends Food Sci. Technol. 2022, 120, 418–438. [Google Scholar] [CrossRef]
- Cubero, S.; Aleixos, N.; Molto, E.; Gomez-Sanchis, J.; Blasco, J. Advances in Machine Vision Applications for Automatic Inspection and Quality Evaluation of Fruits and Vegetables. Food Bioprocess Technol. 2011, 4, 829–830. [Google Scholar] [CrossRef] [Green Version]
- Bhargava, A.; Bansal, A.; Goyal, V. Detection and Grading of Different Vegetable Using Machine Learning. Adv. Data Inf. Sci. 2022, 318, 9. [Google Scholar] [CrossRef]
- Bhargava, A.; Bansal, A.; Goyal, V. Machine Learning-Based Detection and Sorting of Multiple Vegetables and Fruits. Food Anal. Meth. 2022, 15, 15. [Google Scholar] [CrossRef]
- Knott, M.; Perez-Cruz, F.; Defraeye, T. Facilitated machine learning for image-based fruit quality assessment. J. Food Eng. 2023, 345, 9. [Google Scholar] [CrossRef]
- Nturambirwe, J.F.I.; Hussein, E.A.; Vaccari, M.; Thron, C.; Perold, W.J.; Opara, U.L. Feature Reduction for the Classification of Bruise Damage to Apple Fruit Using a Contactless FT-NIR Spectroscopy with Machine Learning. Foods 2023, 12, 210. [Google Scholar] [CrossRef] [PubMed]
- Jiang, H.; Jiang, X.; Ru, Y.; Chen, Q.; Li, X.; Xu, L.; Zhou, H.; Shi, M. Rapid and non-destructive detection of natural mildew degree of postharvest Camellia oleifera fruit based on hyperspectral imaging. Infrared Phys. Technol. 2022, 123, 11. [Google Scholar] [CrossRef]
- Yao, J.; Qi, J.M.; Zhang, J.; Shao, H.M.; Yang, J.; Li, X. A Real-Time Detection Algorithm for Kiwifruit Defects Based on YOLOv5. Electronics 2021, 10, 1711. [Google Scholar] [CrossRef]
- Nithya, R.; Santhi, B.; Manikandan, R.; Rahimi, M.; Gandomi, A.H. Computer Vision System for Mango Fruit Defect Detection Using Deep Convolutional Neural Network. Foods 2022, 11, 3483. [Google Scholar] [CrossRef]
- Huang, Y.P.; Yang, Y.T.; Sun, Y.; Zhou, H.Y.; Chen, K.J. Identification of Apple Varieties Using a Multichannel Hyperspectral Imaging System. Sensors 2020, 20, 5120. [Google Scholar] [CrossRef] [PubMed]
- Zhou, H.Y.; Zhuang, Z.L.; Liu, Y.; Liu, Y.; Zhang, X. Defect Classification of Green Plums Based on Deep Learning. Sensors 2020, 20, 6933. [Google Scholar] [CrossRef] [PubMed]
- Zhou, C.X.; Wang, H.H.; Liu, Y.; Ni, X.Y.; Liu, Y. Green Plums Surface Defect Detection Based on Deep Learning Methods. IEEE Access 2022, 10, 100397–100407. [Google Scholar] [CrossRef]
- Zhu, Z.; Zhao, Y.; Guo, Y.; Zhang, R.; Pan, Y.; Zhou, T. A novel additional carbon source derived from rotten fruits: Application for the denitrification from mature landfill leachate and evaluation the economic benefits. Bioresour. Technol. 2021, 334, 125244. [Google Scholar] [CrossRef]
- Bhargava, A.; Bansal, A. Fruits and vegetables quality evaluation using computer vision: A review. J. King Saud Univ. Comput. Inf. Sci. 2021, 33, 243–257. [Google Scholar] [CrossRef]
- Sun, M.L.; Zhao, R.N.; Yin, X.; Xu, L.C.; Ruan, C.Z.; Jia, W.K. FBoT-Net: Focal bottleneck transformer network for small green apple detection. Comput. Electron. Agric. 2023, 205, 107609. [Google Scholar] [CrossRef]
- Xie, W.J.; Wang, F.H.; Yang, D.Y. Research on Carrot Grading Based on Machine Vision Feature Parameters. IFAC Pap. 2019, 52, 30–35. [Google Scholar] [CrossRef]
- Liang, C.X.; Xiong, J.T.; Zheng, Z.H.; Zhong, Z.; Li, Z.H.; Chen, S.M.; Yang, Z.G. A visual detection method for nighttime litchi fruits and fruiting stems. Comput. Electron. Agric. 2020, 169, 105192. [Google Scholar] [CrossRef]
- Zhang, X.; Huo, L.T.; Liu, Y.; Zhuang, Z.L.; Yang, Y.T.; Gou, B.L. Research on 3D Phenotypic Reconstruction and Micro-Defect Detection of Green Plum Based on Multi-View Images. Forests 2023, 14, 218. [Google Scholar] [CrossRef]
- Guo, Z.X.; Wang, C.S.; Yang, G.; Huang, Z.Y.; Li, G. MSFT-YOLO: Improved YOLOv5 Based on Transformer for Detecting Defects of Steel Surface. Sensors 2022, 22, 3467. [Google Scholar] [CrossRef]
- Liu, Y.; Wang, H.H.; Fei, Y.Q.; Liu, Y.; Shen, L.X.; Zhuang, Z.L.; Zhang, X. Research on the Prediction of Green Plum Acidity Based on Improved XGBoost. Sensors 2021, 21, 930. [Google Scholar] [CrossRef]
- Xie, W.J.; Wei, S.; Zheng, Z.H.; Yang, D.Y. A CNN-based lightweight ensemble model for detecting defective carrots. Biosyst. Eng. 2021, 208, 287–299. [Google Scholar] [CrossRef]
- Lu, P.; Zhao, Y.; Xu, Y. A Two-Stream CNN Model with Adaptive Adjustment of Receptive Field Dedicated to Flame Region Detection. Symmetry 2021, 13, 397. [Google Scholar] [CrossRef]
- Jannat, F.E.; Willis, A.R. Improving Classification of Remotely Sensed Images with the Swin Transformer; IEEE: Piscataway, NJ, USA, 2022; pp. 611–618. [Google Scholar]
- Li, A.; Zhao, Y.; Zheng, Z. Novel Recursive BiFPN Combining with Swin Transformer for Wildland Fire Smoke Detection. Forests 2022, 13, 2032. [Google Scholar] [CrossRef]
- Chen, R.Y.; Zhan, S.Y.; Chen, Y. Underwater Target Detection Algorithm Based on YOLO and Swin Transformer for Sonar Images; IEEE: Piscataway, NJ, USA, 2022. [Google Scholar]
- Zheng, H.; Wang, G.H.; Li, X.C. Swin-MLP: A strawberry appearance quality identification method by Swin Transformer and multi-layer perceptron. J. Food Meas. Charact. 2022, 16, 2789–2800. [Google Scholar] [CrossRef]
- Liang, X.T.; Jia, X.Y.; Huang, W.Q.; He, X.; Li, L.J.; Fan, S.X.; Li, J.B.; Zhao, C.J.; Zhang, C. Real-Time Grading of Defect Apples Using Semantic Segmentation Combination with a Pruned YOLO V4 Network. Foods 2022, 11, 3150. [Google Scholar] [CrossRef] [PubMed]
- Yang, Y.T.; Wang, H.H.; Jiang, D.; Hu, Z.K. Surface Detection of Solid Wood Defects Based on SSD Improved with ResNet. Forests 2021, 12, 1419. [Google Scholar] [CrossRef]
- Ding, F.L.; Zhuang, Z.L.; Liu, Y.; Jiang, D.; Yan, X.A.; Wang, Z.G. Detecting Defects on Solid Wood Panels Based on an Improved SSD Algorithm. Sensors 2020, 20, 5315. [Google Scholar] [CrossRef] [PubMed]
- Xie, W.J.; Wei, S.; Zheng, Z.H.; Jiang, Y.; Yang, D.Y. Recognition of Defective Carrots Based on Deep Learning and Transfer Learning. Food Bioprocess Technol. 2021, 14, 1361–1374. [Google Scholar] [CrossRef]
Number | Class | Original Data Set | Data Augmentation | Validation Set | Training Set | Test Set |
---|---|---|---|---|---|---|
1 | scar | 168 | 1680 | 168 | 1344 | 168 |
2 | scar + rot | 34 | 340 | 34 | 272 | 34 |
3 | scar + stem | 312 | 3120 | 312 | 2496 | 312 |
4 | scar + stem + spot | 37 | 370 | 37 | 296 | 37 |
5 | scar + spot | 18 | 180 | 18 | 144 | 18 |
6 | rot | 546 | 5460 | 546 | 4368 | 546 |
7 | rot + flaw | 62 | 620 | 62 | 496 | 62 |
8 | rot + stem | 130 | 1300 | 130 | 1040 | 130 |
9 | rot + stem + spot | 67 | 670 | 67 | 536 | 34 |
10 | rot + spot | 178 | 1780 | 178 | 1424 | 178 |
11 | intact | 616 | 6160 | 616 | 4928 | 616 |
12 | flaw | 114 | 1140 | 114 | 912 | 114 |
13 | flaw + stem | 62 | 620 | 62 | 496 | 62 |
14 | flaw + stem + spot | 30 | 300 | 30 | 240 | 30 |
15 | flaw + spot | 23 | 230 | 23 | 184 | 23 |
16 | stem | 54 | 540 | 54 | 432 | 54 |
17 | stem + spot | 60 | 600 | 60 | 480 | 60 |
18 | spot | 288 | 2880 | 288 | 2304 | 288 |
Software and Hardware | Name |
---|---|
System | Windows 10 × 64 |
CPU | Inter I7 [email protected] GHz |
GPU | Nvidia GeForce RTX 3080Ti(12G) |
Environment configuration | PyCharm 2022.3.3 + Pytorch 1.7.1 + Python 3.7.7 Cuda 10.2 + cudnn 7.6.5 + tensorboardX 2.1 |
Methods | Vision Transformer | |
---|---|---|
Major Defect Classification Accuracy | Scar | 94.02% |
Rot | 98.62% | |
Intact | 93.89% | |
Flaw | 96.42% | |
Spot | 93.68% | |
Accuracy | 96.21% | |
Loss | 0.078 |
Accuracy of Surface Defect Classification | Accuracy | Average Test Time | |||||
---|---|---|---|---|---|---|---|
Network Name | Scar | Rot | Intact | Flaw | Spot | ||
ResNet18 | 86.54% | 90.95% | 79.04% | 94.18% | 93.10% | 89.92% | 0.88 ms |
WideResNet50 | 89.53% | 89.68% | 94.48% | 86.03% | 88.51% | 91.39% | 1.05 ms |
Desnet121 | 93.83% | 92.63% | 96.57% | 89.52% | 97.70% | 94.14% | 1.39 ms |
VGG16 | 92.34% | 95.18% | 98.06% | 90.83% | 97.17% | 95.42% | 0.96 ms |
Vision Transformer | 94.02% | 98.62% | 93.89% | 96.42% | 93.68% | 96.21% | 1.43 ms |
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. |
© 2023 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
Su, W.; Yang, Y.; Zhou, C.; Zhuang, Z.; Liu, Y. Multiple Defect Classification Method for Green Plum Surfaces Based on Vision Transformer. Forests 2023, 14, 1323. https://doi.org/10.3390/f14071323
Su W, Yang Y, Zhou C, Zhuang Z, Liu Y. Multiple Defect Classification Method for Green Plum Surfaces Based on Vision Transformer. Forests. 2023; 14(7):1323. https://doi.org/10.3390/f14071323
Chicago/Turabian StyleSu, Weihao, Yutu Yang, Chenxin Zhou, Zilong Zhuang, and Ying Liu. 2023. "Multiple Defect Classification Method for Green Plum Surfaces Based on Vision Transformer" Forests 14, no. 7: 1323. https://doi.org/10.3390/f14071323
APA StyleSu, W., Yang, Y., Zhou, C., Zhuang, Z., & Liu, Y. (2023). Multiple Defect Classification Method for Green Plum Surfaces Based on Vision Transformer. Forests, 14(7), 1323. https://doi.org/10.3390/f14071323