YOLOv5-Atn: An Algorithm for Residual Film Detection in Farmland Combined with an Attention Mechanism
Abstract
:1. Introduction
- In order to verify the improved model, a small and medium sized dataset for the detection of residual film is made by using residual film images captured in the natural environment;
- A two-stage training method for the residual film task was designed to improve the problem of less residual film data, effectively improving the model’s accuracy and generalization;
- An adaptive multi-scale feature fusion module (ASFF) is proposed, which adds learnable adaptive weights to allow the model to adaptively select the appropriate size of feature maps, effectively solving the problem of model missed detection due to the different sizes of residual film;
- An inter-feature cross-attention (FCA) module is proposed to improve the existing skip-connection mechanism of the model. The correlation feature information of the shallow layer and deep layer is effectively used, and the interference noise in the shallow layer is eliminated.
2. Dataset
2.1. Data Acquisition
2.2. Data Annotation
2.3. Data Augmentation
3. Method
3.1. YOLOv5
3.2. An Improvement of the YOLOv5 Model: YOLOv5-Atn
3.2.1. Two-Stage Training Strategy
3.2.2. ASFF
3.2.3. FCA
4. Experiments
4.1. Experimental Setup
4.2. Evaluation Indicators
5. Results
5.1. Ablation Experiments
5.2. Comparison Experiments
5.3. First-Stage Training Parameters
5.4. Atrous Convolution Interval Selection
5.5. FCA Location Combination
6. Discussion
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Zhao, Y.; Chen, X.; Wen, H.; Zheng, X.; Niu, Q.; Kang, J. Research Status and Prospect of Control Technology for Residual Plastic Film Pollution in Farmland. Trans. Chin. Soc. Agric. Mach. 2017, 48, 1–14. [Google Scholar]
- Bu, L.D.; Liu, J.L.; Zhu, L.; Luo, S.S.; Chen, X.P.; Li, S.Q.; Hill, R.L.; Zhao, Y. The effects of mulching on maize growth, yield and water use in a semi-arid region. Agric. Water Manag. 2013, 123, 71–78. [Google Scholar] [CrossRef]
- Bai, L.; Hai, J.; Han, Q.; Jia, Z. Effects of mulching with different kinds of plastic film on growth and water use efficiency of winter wheat in Weibei Highland. Agric. Res. Arid Areas 2010, 28, 135–139. [Google Scholar]
- Lin, T.; Tang, Q.X.; Hao, W.P.; Wu, F.Q.; Lei, L.; Yan, C.R.; He, W.Q.; Mei, X.R. Effects of plastic film residue rate on root zone water environment and root distribution of cotton under drip irrigation condition. Trans. Chin. Soc. Agric. Eng. 2019, 35, 117–125. [Google Scholar]
- Yan, C.R.; Liu, S.K.; Shu, F.; Liu, Q.; Liu, S.; He, W.Q. Review of agricultural plastic mulching and its residual pollution and prevention measures in China. J. Agric. Resour. Environ. 2014, 31, 95–102. [Google Scholar]
- Pei, X.M.; Jin, X.Q. Research on farmland residual film recycling mechanization technology popularization and application in Xinjiang. J. Chin. Agric. Mech. 2014, 35, 275–279. [Google Scholar]
- Shi, Z.; Zhang, X.; Liu, X.; Kang, M.; Yao, J.; Guo, L. Analysis and Test of the Tillage Layer Roll-Type Residual Film Recovery Mechanism. Appl. Sci. 2023, 13, 7598. [Google Scholar] [CrossRef]
- You, J.; Zhang, B.; Wen, H.; Kang, J.; Song, Y.; Chen, X. Design and Test Optimization on Spade and Tine Combined Residual Plastic Film Device. Trans. Chin. Soc. Agric. Mach. 2017, 48, 97–104. [Google Scholar]
- Kang, J.; Peng, Q.; Wang, S.; Song, Y.; Cao, S.; He, L. Improved Design and Experiment on Pickup Unit of Spring-tooth Residual Plastic Film Collector. Trans. Chin. Soc. Agric. Mach. 2018, 49, 295–303. [Google Scholar]
- Xie, J.; Yang, Y.; Cao, S.; Zhang, Y.; Zhou, Y.; Ma, W. Design and experiments of rake type surface residual film recycling machine with guide chain. Trans. Chin. Soc. Agric. Eng. 2020, 36, 76–86. [Google Scholar]
- Haq, M.A.; Khan, M.Y.A. Crop water requirements with changing climate in an arid region of Saudi Arabia. Sustainability 2022, 14, 13554. [Google Scholar] [CrossRef]
- Haq, M.A. Planetscope Nanosatellites Image Classification Using Machine Learning. Comput. Syst. Sci. Eng. 2022, 42, 1031–1046. [Google Scholar]
- Jiang, S.; Zhang, H.; Hua, Y. Research on location of residual plastic film based on computer vision. J. Chin. Agric. Mech. 2016, 37, 150–154. [Google Scholar]
- Zhu, X.; Li, S.; Xiao, G. Method on extraction of area and distribution of plastic-mulched farmland based on UAV images. Trans. Chin. Soc. Agric. Eng. 2019, 35, 106–113. [Google Scholar]
- Fu, C.; Cheng, L.; Qin, S.; Tariq, A.; Liu, P.; Zou, K.; Chang, L. Timely plastic-mulched cropland extraction method from complex mixed surfaces in arid regions. Remote Sens. 2022, 14, 4051. [Google Scholar] [CrossRef]
- Hasituya; Chen, Z.; Wang, L.; Wu, W.; Jiang, Z.; Li, H. Monitoring plastic-mulched farmland by Landsat-8 OLI imagery using spectral and textural features. Remote Sens. 2016, 8, 353. [Google Scholar] [CrossRef] [Green Version]
- Lu, L.; Tao, Y.; Di, L. Object-based plastic-mulched landcover extraction using integrated Sentinel-1 and Sentinel-2 data. Remote Sens. 2018, 10, 1820. [Google Scholar] [CrossRef] [Green Version]
- Sun, Y.; Han, J.; Chen, Z.; Shi, M.; Fu, H.; Yang, M. Monitoring Method for UAV Image of Greenhouse and Plastic-mulched Landcover Based on Deep Learning. Trans. Chin. Soc. Agric. Mach. 2018, 49, 133–140. [Google Scholar]
- Yang, Q.; Liu, M.; Zhang, Z.; Yang, S.; Ning, J.; Han, W. Mapping plastic mulched farmland for high resolution images of unmanned aerial vehicle using deep semantic segmentation. Remote Sens. 2019, 11, 2008. [Google Scholar] [CrossRef] [Green Version]
- Ning, J.; Ni, J.; He, J.; Li, L.; Zhao, Z.; Zhang, Z. Convolutional Attention Based Plastic Mulching Farmland Identification via UAV Multispectral Remote Sensing Image. Trans. Chin. Soc. Agric. Mach. 2021, 52, 213–220. [Google Scholar]
- Zhang, X.; Huang, S.; Jin, W.; Yan, J.; Shi, Z.; Zhou, X.; Zhang, C. Identification Method of Agricultural Film Residue Based on Improved Faster R-CNN. J. Hunan Univ. 2021, 48, 161–168. [Google Scholar]
- Zhou, T.; Jiang, Y.; Wang, X.; Xie, J.; Wang, C.; Shi, Q.; Zhang, Y. Detection of Residual Film on the Field Surface Based on Faster R-CNN Multiscale Feature Fusion. Agriculture 2023, 13, 1158. [Google Scholar] [CrossRef]
- Wu, X.; Liang, C.; Zhang, D.; Yu, L.; Zhang, F. Identification Method of Plastic Film Residue Based on UAV Remote Sensing Images. Trans. Chin. Soc. Agric. Mach. 2020, 51, 189–195. [Google Scholar]
- Lin, T.Y.; Maire, M.; Belongie, S.; Hays, J.; Perona, P.; Ramanan, D.; Dollár, P.; Zitnick, C.L. Microsoft coco: Common objects in context. In Proceedings of the Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, 6–12 September 2014; Proceedings, Part V 13. pp. 740–755. [Google Scholar]
- Ren, S.; He, K.; Girshick, R.; Sun, J. Faster r-cnn: Towards real-time object detection with region proposal networks. Adv. Neural Inf. Process. Syst. 2015, 28, 1–9. [Google Scholar] [CrossRef] [Green Version]
- Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.Y.; Berg, A.C. Ssd: Single shot multibox detector. In Proceedings of the Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, 11–14 October 2016; pp. 21–37. [Google Scholar]
- Lin, T.Y.; Dollár, P.; Girshick, R.; He, K.; Hariharan, B.; Belongie, S. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2117–2125. [Google Scholar]
- Liu, S.; Qi, L.; Qin, H.; Shi, J.; Jia, J. Path aggregation network for instance segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 8759–8768. [Google Scholar]
- Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Proceedings of the Medical Image Computing and Computer-Assisted Intervention–MICCAI 2015: 18th International Conference, Munich, Germany, 5–9 October 2015; pp. 234–241. [Google Scholar]
- Liu, R.; Mi, L.; Chen, Z. AFNet: Adaptive fusion network for remote sensing image semantic segmentation. IEEE Trans. Geosci. Remote Sens. 2020, 59, 7871–7886. [Google Scholar] [CrossRef]
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30, 1–11. [Google Scholar]
- Liu, P.; Yin, H. YOLOv7-Peach: An Algorithm for Immature Small Yellow Peaches Detection in Complex Natural Environments. Sensors 2023, 23, 5096. [Google Scholar] [CrossRef] [PubMed]
- Hu, Z.; Yang, H.; Yan, H. Attention-Guided Instance Segmentation for Group-Raised Pigs. Animals 2023, 13, 2181. [Google Scholar] [CrossRef]
- Chang, Y.; Li, D.; Gao, Y.; Su, Y.; Jia, X. An Improved YOLO Model for UAV Fuzzy Small Target Image Detection. Appl. Sci. 2023, 13, 5409. [Google Scholar] [CrossRef]
Two-Stage | ASFF | FCA | mAP/% | P/% | R/% | F1/% | [email protected]:0.95/% |
---|---|---|---|---|---|---|---|
- | - | - | 75.08 | 72.62 | 67.94 | 70.20 | 44.60 |
√ | - | - | 76.16 | 74.78 | 68.47 | 71.49 | 46.41 |
√ | √ | - | 78.04 | 76.67 | 70.07 | 73.22 | 47.74 |
√ | - | √ | 78.10 | 76.70 | 69.54 | 72.94 | 47.98 |
√ | √ | √ | 79.03 | 78.01 | 69.96 | 73.77 | 48.56 |
Model | mAP/% | P/% | R/% | F1/% | [email protected]:0.95/% |
---|---|---|---|---|---|
Faster R-CNN | 59.50 | 58.10 | 44.90 | 50.65 | 29.30 |
YOLOv3 | 72.60 | 70.50 | 52.30 | 60.05 | 37.40 |
YOLOv5 | 75.08 | 72.62 | 67.94 | 70.20 | 44.60 |
YOLOv7 | 75.60 | 75.60 | 68.10 | 71.65 | 43.60 |
YOLOv8 | 76.40 | 75.80 | 70.40 | 73.00 | 43.00 |
YOLOv5-Atn | 79.03 | 78.01 | 69.96 | 73.77 | 48.56 |
Model | FLOPs/G | Model Size/MB | FPS | Inference Time/ms |
---|---|---|---|---|
Faster-RCNN | 262.6 | 315 | 34.40 | 29.07 |
YOLOv3 | 135.2 | 234 | 73.76 | 13.56 |
YOLOv5 | 15.8 | 13.7 | 79.52 | 12.58 |
YOLOv7 | 56.3 | 71.3 | 48.16 | 20.76 |
YOLOv8 | 28.4 | 17.5 | 52.48 | 19.05 |
YOLOv5-Atn | 36.5 | 25 | 77.92 | 12.83 |
Interval Size | mAP/% | P/% | R/% | F1/% | [email protected]:0.95/% |
---|---|---|---|---|---|
d(2, 3, 4) | 77.16 | 75.47 | 70.50 | 72.90 | 45.85 |
d(4, 6, 8) | 77.19 | 77.52 | 67.50 | 72.16 | 45.90 |
d(2, 6, 10) | 78.04 | 76.67 | 70.07 | 73.22 | 47.74 |
P1 | P2 | P3 | mAP/% | P/% | R/% | F1/% | [email protected]:0.95/% |
---|---|---|---|---|---|---|---|
- | - | - | 76.16 | 74.78 | 68.47 | 71.49 | 46.41 |
√ | - | - | 76.63 | 74.20 | 68.65 | 71.32 | 45.12 |
- | √ | - | 76.54 | 76.73 | 66.79 | 71.41 | 45.95 |
- | - | √ | 76.87 | 78.22 | 66.67 | 71.99 | 46.87 |
√ | √ | - | 77.15 | 75.08 | 68.50 | 71.64 | 46.10 |
√ | - | √ | 77.43 | 76.93 | 68.12 | 72.26 | 47.23 |
- | √ | √ | 77.11 | 76.59 | 68.12 | 72.11 | 46.43 |
√ | √ | √ | 78.10 | 76.70 | 69.54 | 72.94 | 47.98 |
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
Lin, Y.; Zhang, J.; Jiang, Z.; Tang, Y. YOLOv5-Atn: An Algorithm for Residual Film Detection in Farmland Combined with an Attention Mechanism. Sensors 2023, 23, 7035. https://doi.org/10.3390/s23167035
Lin Y, Zhang J, Jiang Z, Tang Y. YOLOv5-Atn: An Algorithm for Residual Film Detection in Farmland Combined with an Attention Mechanism. Sensors. 2023; 23(16):7035. https://doi.org/10.3390/s23167035
Chicago/Turabian StyleLin, Ying, Jianjie Zhang, Zhangzhen Jiang, and Yiyu Tang. 2023. "YOLOv5-Atn: An Algorithm for Residual Film Detection in Farmland Combined with an Attention Mechanism" Sensors 23, no. 16: 7035. https://doi.org/10.3390/s23167035
APA StyleLin, Y., Zhang, J., Jiang, Z., & Tang, Y. (2023). YOLOv5-Atn: An Algorithm for Residual Film Detection in Farmland Combined with an Attention Mechanism. Sensors, 23(16), 7035. https://doi.org/10.3390/s23167035