Imperfect Wheat Grain Recognition Combined with an Attention Mechanism and Residual Network
Abstract
:1. Introduction
2. Model and Methods
2.1. Attention Mechanism
2.1.1. Channel Attention
2.1.2. Spatial Attention Module
2.2. ResNet Model
2.3. The Residual Block Integrates with the Attention Mechanism
3. Results and Discussion
3.1. Data Acquisition
3.2. Hardware and Software Preparation
3.3. Model Training and Test Results
3.4. Comparison of Identification Results
3.5. Network Visualization with Grad-CAM
3.6. Optimize Learning Rate Results
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Chen, F.N. Real-Time Detection of Kernel-like Impurity and Unsound Kernel in Wheat Using Machine Vision. Ph.D. Thesis, Zhejiang University, Zhejiang, China, 2012. [Google Scholar]
- Vithu, P.; Moses, J.A. Machine vision system for food grain quality evaluation: A review. Trends Food Sci. Technol. 2016, 56, 13–20. [Google Scholar] [CrossRef]
- Manickavasagan, A.; Sathya, G.; Jayas, D.S. Comparison of illuminations to identify wheat classes using monochrome images. Comput. Electron. Agric. 2008, 63, 237–244. [Google Scholar] [CrossRef]
- Pourreza, A.; Pourreza, H.; Abbaspour-Fard, M.H.; Sadrnia, H. Identification of nine Iranian wheat seed varieties by textural analysis with image processing. Comput. Electron. Agric. 2012, 83, 102–108. [Google Scholar] [CrossRef]
- Choudhary, R.; Paliwal, J.; Jayas, D.S. Classification of cereal grains using wavelet, morphological, colour, and textural features of non-touching kernel images. Biosyst. Eng. 2008, 99, 330–337. [Google Scholar] [CrossRef]
- Zhijun, W.; Peisheng, C.; Jialu, Z.; Zhongliang, Z. Method for identification of external quality of wheat grain based on image processing and artificial neural network. Trans. Chin. Soc. Agric. Eng. 2007, 23, 158–161. [Google Scholar]
- Da, Z.H.; Rong, Z.Y.; Yu, W.W.; Qing, Z.X.; Sai, C.S. Identification method of maize quality grades based on machine vision. Sci. Technol. Cereals Oils Foods 2016, 24, 50–56. [Google Scholar]
- Rong, Z.Y.; Sai, C.S.; Qing, Z.X.; Yu, W.W.; Qiong, W.; Rong, W.H. Identification of unsound kernels in wheat based on image processing and neural network. Sci. Technol. Cereals Oils Foods 2014, 22, 59–63. [Google Scholar]
- Xie, F.; Pearson, T.; Dowell, F.; Zhang, N. Detecting vitreous wheat kernels using reflectance and transmittance image analysis. Cereal Chem. 2004, 81, 594–597. [Google Scholar] [CrossRef] [Green Version]
- Barbedo, J.G.A. A review on the main challenges in automatic plant disease identification based on visible range images. Biosyst. Eng. 2016, 144, 52–60. [Google Scholar] [CrossRef]
- Kamilaris, A.; Prenafeta-Boldu, F.X. Deep learning in agriculture: A survey. Comput. Electron. Agric. 2018, 147, 70–90. [Google Scholar] [CrossRef] [Green Version]
- Dyrmann, M.; Karstoft, H.; Midtiby, H.S. Plant species classification using deep convolutional neural network. Biosyst. Eng. 2016, 151, 72–80. [Google Scholar] [CrossRef]
- Cheng, X.; Zhang, Y.; Chen, Y.; Wu, Y.; Yue, Y. Pest identification via deep residual learning in complex background. Comput. Electron. Agric. 2017, 141, 351–356. [Google Scholar] [CrossRef]
- Fuente, A.; Yoon, S.; Kim, S.; Park, D. A robust deep-learning-based detector for real-time tomato plant diseases and pests recognition. Sensors 2017, 17, 2022. [Google Scholar] [CrossRef] [Green Version]
- Rahnemoonfar, M.; Sheppard, C. Deep count: Fruit counting based on deep simulated learning. Sensors 2017, 17, 905. [Google Scholar] [CrossRef] [Green Version]
- Lee, S.H.; Chan, C.S.; Mayo, S.J.; Remagnino, P. How deep learning extracts and learns leaf features for plant classification. Pattern Recognit. 2017, 71, 1–13. [Google Scholar] [CrossRef] [Green Version]
- Yu, S.; Yuan, L.; Guan, W.; Haiyan, Z. Deep learning for plant identification in natural environment. Comput. Intell. Neurosci. 2017, 2017, 7361042. [Google Scholar]
- Elavarasan, D.; Vincent, D.R.; Sharma, V.; Zomaya, A.Y.; Srinivasan, K. Forecasting yield by integrating agrarian factors and machine learning models: A survey. Comput. Electron. Agric. 2018, 155, 257–282. [Google Scholar] [CrossRef]
- Cheng, F.; Chen, F.N.; Ying, Y.B. Image recognition of unsound wheat using artificial neural network. In Proceedings of the 2010 Second WRI Global Congress on Intelligent Systems, Wuhan, China, 16–17 December 2010; pp. 172–175. [Google Scholar]
- Ting-Cui, C.; Xiao-Hai, H.; De-Liang, D.; Heng, S.; Shu-Hua, X. Identification of unsound kernels in wheat based on CNN deep model. Mod. Comput. 2017, 36, 9–14. [Google Scholar]
- Le, Y.; Chao, W.; Jingzhu, W.; Yan, C.; Yangyang, L.; Yao, W. Identification method of unsound kernel wheat based on hyperspectral and convolution neural network. J. Electron. Meas. Instrum. 2017, 31, 1297–1303. [Google Scholar]
- Zhu, S.; Zhuo, J.; Huang, H.; Li, G. Wheat grain integrity image detection system based on CNN. Trans. Chin. Soc. Agric. Mach. 2020, 51, 36–42. [Google Scholar]
- He, J.; Wu, X.; He, X.; Hu, J.; Qin, L. Imperfect wheat kernel recognition combined with image enhancement and conventional neural network. Comput. Appl. 2021, 41, 911–916. [Google Scholar]
- Luo, J.H.; Wu, J.X. A survey on fine-grained image categorization using deep convolutional features. Acta Autom. Sin. 2017, 43, 1306–1318. [Google Scholar]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Aidan; Kaiser, L.; Polosukhin, I. Attention is all you need. arXiv 2017, arXiv:1706.03762. [Google Scholar]
- Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. CBAM: Convolutional Block Attention Module; European Conference on Computer Vision Springer: Cham, Switzerland, 2018. [Google Scholar]
- Xu, L. Research on Fine-Grained Object Classification Method Based on Attention Mechanism. Master’s Thesis, Agricultural University of Hebei, Baoding, China, 2019. [Google Scholar]
- Sun, P.; Chen, G.; Cao, L. Image recognition of soybean pests based on attention convolutional neural network. J. Chin. Agric. Mech. 2020, 41, 171–176. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision & Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
- Selvaraju, R.R.; Cogswell, M.; Das, A.; Vedantam, R.; Parikh, D.; Batra, D. Grad-CAM: Visual explanations from deep networks via gradient-based localization. Int. J. Comput. Vis. 2020, 128, 336–359. [Google Scholar] [CrossRef] [Green Version]
Method | Batch | Parameters | Epoch | Time | Accuracy (%) |
---|---|---|---|---|---|
ResNet-18 | 32 | 11,189,190 | 100 | 1 h 27 m 25 s | 94.17 |
ResNet-34 | 32 | 21,304,774 | 100 | 2 h 27 m 54 s | 94.83 |
ResNet-50 | 32 | 23,573,446 | 100 | 3 h 27 m 54 s | 95.33 |
ResNet-101 | 32 | 42,617,798 | 100 | 5 h 34 m 21 s | 95.17 |
ResNet-152 | 32 | 58,307,526 | 100 | 7 h 45 m 19 s | 95.17 |
Method (Attention) | Batch | Parameters | Epoch | Time | Accuracy (%) |
---|---|---|---|---|---|
ResNet-18 | 32 | 11,279,054 | 100 | 2 h 13 m 9 s | 95.17 |
ResNet-34 | 32 | 21,467,538 | 100 | 3 h 59 m 52 s | 95.50 |
ResNet-50 | 32 | 26,106,006 | 100 | 5 h 24 m 52 s | 96.50 |
ResNet-101 | 32 | 47,398,744 | 100 | 9 h 42 m 9 s | 96.17 |
ResNet-152 | 15 | 64,941,466 | 100 | 24 h 26 m 34 s | 94.83 |
Grains Type of Wheat | Predicted Species | Classification Performance | |||||||
---|---|---|---|---|---|---|---|---|---|
Scab | Insect-Damaged | Sprouted | Mildew | Broken | Perfect | Precision | Recall | F-Measure | |
Scab | 98 | 0 | 0 | 0 | 0 | 2 | 95.15 | 98 | 96.55 |
Insect-damaged | 2 | 93 | 1 | 3 | 1 | 0 | 97.89 | 93 | 95.38 |
Sprouted | 1 | 0 | 93 | 1 | 4 | 1 | 95.88 | 93 | 94.41 |
Mildew | 2 | 0 | 1 | 96 | 0 | 1 | 94.12 | 96 | 95.05 |
Broken | 0 | 0 | 1 | 1 | 96 | 2 | 95.05 | 96 | 95.52 |
Perfect | 0 | 2 | 1 | 1 | 0 | 96 | 94.12 | 96 | 95.05 |
Grains Type of Wheat | Predicted Species | Classification Performance | |||||||
---|---|---|---|---|---|---|---|---|---|
Scab | Insect-Damaged | Sprouted | Mildew | Broken | Perfect | Precision | Recall | F-Measure | |
Scab | 100 | 0 | 0 | 0 | 0 | 0 | 96.15 | 100 | 98.04 |
Insect-damaged | 0 | 100 | 0 | 0 | 0 | 0 | 95.24 | 100 | 97.56 |
Sprouted | 0 | 1 | 98 | 0 | 0 | 1 | 92.45 | 98 | 95.65 |
Mildew | 3 | 1 | 6 | 90 | 0 | 0 | 98.9 | 90 | 95.14 |
Broken | 1 | 1 | 1 | 0 | 95 | 2 | 100 | 95 | 97.43 |
Perfect | 0 | 2 | 1 | 1 | 0 | 96 | 96.97 | 96 | 96.48 |
Learning Rate | Batch | Epoch | Time | Accuracy (%) |
---|---|---|---|---|
0.0001 | 32 | 100 | 5 h 24 m 52 s | 96.33 |
0.0002 | 32 | 100 | 5 h 25 m 6 s | 97 |
0.0003 | 32 | 100 | 5 h 24 m 1 s | 97.5 |
0.0004 | 32 | 100 | 5 h 34 m 16 s | 97.17 |
0.0005 | 32 | 100 | 5 h 34 m 16 s | 96.5 |
0.001 | 32 | 100 | 5 h 43 m 52 s | 95.5 |
0.01 | 32 | 100 | 5 h 59 m 59 s | 93.33 |
Grains Type of Wheat | Predicted Species | Classification Performance | |||||||
---|---|---|---|---|---|---|---|---|---|
Scab | Insect-Damaged | Sprouted | Mildew | Broken | Perfect | Precision | Recall | F-Measure | |
Scab | 97 | 0 | 0 | 1 | 0 | 2 | 98.98 | 97 | 97.98 |
Insect-damaged | 0 | 99 | 1 | 0 | 0 | 0 | 100 | 99 | 99.5 |
Sprouted | 0 | 0 | 99 | 1 | 0 | 0 | 93.4 | 99 | 96.12 |
Mildew | 1 | 0 | 4 | 95 | 0 | 0 | 97.94 | 95 | 96.43 |
Broken | 0 | 0 | 1 | 0 | 96 | 3 | 100 | 96 | 97.96 |
Perfect | 0 | 0 | 1 | 0 | 0 | 99 | 95.19 | 99 | 97.06 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 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
Zhang, W.; Ma, H.; Li, X.; Liu, X.; Jiao, J.; Zhang, P.; Gu, L.; Wang, Q.; Bao, W.; Cao, S. Imperfect Wheat Grain Recognition Combined with an Attention Mechanism and Residual Network. Appl. Sci. 2021, 11, 5139. https://doi.org/10.3390/app11115139
Zhang W, Ma H, Li X, Liu X, Jiao J, Zhang P, Gu L, Wang Q, Bao W, Cao S. Imperfect Wheat Grain Recognition Combined with an Attention Mechanism and Residual Network. Applied Sciences. 2021; 11(11):5139. https://doi.org/10.3390/app11115139
Chicago/Turabian StyleZhang, Weiwei, Huimin Ma, Xiaohong Li, Xiaoli Liu, Jun Jiao, Pengfei Zhang, Lichuan Gu, Qi Wang, Wenxia Bao, and Shengnan Cao. 2021. "Imperfect Wheat Grain Recognition Combined with an Attention Mechanism and Residual Network" Applied Sciences 11, no. 11: 5139. https://doi.org/10.3390/app11115139
APA StyleZhang, W., Ma, H., Li, X., Liu, X., Jiao, J., Zhang, P., Gu, L., Wang, Q., Bao, W., & Cao, S. (2021). Imperfect Wheat Grain Recognition Combined with an Attention Mechanism and Residual Network. Applied Sciences, 11(11), 5139. https://doi.org/10.3390/app11115139