Application of Deep Learning Techniques in Water Level Measurement: Combining Improved SegFormer-UNet Model with Virtual Water Gauge
Abstract
:1. Introduction
- (1)
- The proposal of a new water level measurement method that avoids the flaws of traditional computer vision water level detection methods and achieves ruler-free measurement after calibration when the camera imaging angle is fixed;
- (2)
- The proposal of a water segmentation model based on an improved SegFormer-UNet that achieves better results in the water segmentation task;
- (3)
- The use of the water segmentation model to obtain the pixel coordinates of the water level line directly from the segmentation result, reducing algorithm complexity and enhancing real-time performance.
2. Related Works
3. Methodology
3.1. Image Segmentation
3.2. SegFormer Network Model
4. Principle and Implementation
4.1. Water Gauge Mapping Relationship Establishment
4.2. Water Segmentation Model
4.2.1. SegFormer-UNet Network Structure
4.2.2. Encoder Design
4.2.3. Decoder Design
4.3. Water Level Line Detection
4.4. Calculation of Water Level Values
5. Analysis of Results and Field Testing
5.1. Dataset and Experimental Environment
5.2. Evaluation Indicators
5.3. Results of The Experiment
5.3.1. Objective Comparison of Segmentation Performance
5.3.2. Subjective Comparison of Segmentation Performance
5.4. Ablation Experiments
5.4.1. Influence of Encoder Size
5.4.2. Influence of Encoder Composition Structure
5.5. Field Tests
5.5.1. Water Level Line Detection Test and Analysis
5.5.2. Water Level Measurement Test and Analysis
5.5.3. Measurement Test without a Water Gauge
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Muste, M.; Ho, H.C.; Kim, D. Considerations on direct stream flow measurements using video imagery:Outlook and research needs. J. Hydro Environ. Res. 2011, 5, 289–300. [Google Scholar] [CrossRef]
- Zhang, K.; Wang, J.; Zhang, G.; Liu, M. Review of image water level detection. Electron. Meas. Technol. 2021, 44, 104–113. [Google Scholar]
- Zhang, Y. A Brief Discussion on Model Selection of Water Level Gauge for Mountain River. Water Resour. Informatiz. 2008, 4, 45–46. [Google Scholar]
- Cheng, G. Research on Water Level Scale Recognition Based on Digital Image Processing; South China University of Technology: Guangzhou, China, 2017. [Google Scholar]
- Nie, H.; Liu, K.; Ou, Z. A review of water level measurement methods and equipment. South. Agric. Mach. 2020, 51, 48–49. [Google Scholar]
- Zhang, Y.; Zong, J.; Jiang, D.; Li, S. Design and implementation of bubble pressure type water level meter field detection device. Hydrology 2021, 41, 60–65. [Google Scholar]
- Ma, Y. Analysis of radar water level meter and artificial observation water level ratio at Wushenggong hydrological station. Groundwater 2022, 44, 205–206. [Google Scholar]
- Feng, X. Analysis of ultrasonic water level meter in Shule River irrigation area bucket mouth measurement test application. Agric. Technol. Inf. 2020, 7, 123–125, 128. [Google Scholar]
- Chen, X. Application of laser water level meter in Yantan hydropower station. Hongshui River 2015, 34, 101–104. [Google Scholar]
- Seibert, J.; Strobl, B.; Etter, S.; Hummer, P.; van Meerveld, H.J. Virtual Staff Gauges for Crowd Based Stream Level Observations. Front. Earth Sci. 2019, 7, 70. [Google Scholar] [CrossRef]
- Liu, M.; Che, G.; Zhang, K.; Wang, J.; Ouyang, X. A water level measurement method for indefinite water gauge image. Chin. J. Sci. Instrum. 2021, 42, 250–258. [Google Scholar]
- Lee, C.J.; Seo, M.B.; Kim, D.G.; Kwon, S.I. A novel water surface detection method based on correlation analysis for rectangular control area. J. Korea Water Resour. Assoc. 2012, 45, 1227–1241. [Google Scholar] [CrossRef]
- Kim, J.; Han, Y.; Hahn, H. Image-based water level measurement method under stained ruler. J. Meas. Sci. Instrum. 2010, 1, 28–31. [Google Scholar]
- Sun, W.; Wang, D.; Xu, S.; Wang, J.; Ma, Z. Water Level Detection Algorithm Based on Computer Vision. J. Appl. Sci. 2022, 40, 434–447. [Google Scholar]
- Cheng, S.; Zhao, K.; Zhang, S.; Zhang, D. Water Level Detection Based on U-net. Acta Metrol. Sin. 2019, 40, 361–366. [Google Scholar]
- Wang, L.; Chen, M.; Meng, K. Research on water level recognition method based on deep learning algorithms. Water Resour. Informatiz. 2020, 3, 39–43. [Google Scholar]
- Ma, R.; Zhou, W.; Zou, Y. Water Level Recognition Method Based on Traditional Image Processing Algorithm and YOLOv4. Comput. Meas. Control 2022, 30, 219–225. [Google Scholar]
- Zhang, R.; Zhang, G.; Xie, Z.; Liu, M. Research on water gauge water level detection method under small area guidance. J. Yunnan Univ. 2023, 3, 1–13. [Google Scholar]
- Deeparani, K.; Sudhakar, P. Efficient image segmentation and implementation of K-means clustering. Mater. Today Proc. 2021, 45, 8076–8079. [Google Scholar] [CrossRef]
- Long, J.; Shelhamer, E.; Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 3431–3440. [Google Scholar]
- Ronneberger, O.; Fischer, P.; Brox, T. U-net: Convolutional networks for biomedical image segmentation. In Proceedings of the International Conference on Medical Image Computing and Computer-Assisted Intervention, Munich, Germany, 5–9 October 2015; pp. 234–241. [Google Scholar]
- Chen, L.C.; Papandreou, G.; Kokkinos, I.; Murphy, K.; Yuille, A.L. Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv 2014, arXiv:1412.7062. [Google Scholar]
- Chen, L.C.; Papandreou, G.; Schroff, F.; Adam, H. Rethinking atrous convolution for semantic image segmentation. arXiv 2017, arXiv:1706.05587. [Google Scholar]
- Chen, L.C.; Zhu, Y.; Papandreou, G.; Schroff, F.; Adam, H. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 801–818. [Google Scholar]
- 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]
- Zheng, S.; Lu, J.; Zhao, H.; Zhu, X.; Luo, Z.; Wang, Y.; Fu, Y.; Feng, J.; Xiang, T.; Torr, P.H.; et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 14–19 June 2021; pp. 6881–6890. [Google Scholar]
- Xie, E.; Wang, W.; Yu, Z.; An kumar, A.; Alvarez, J.M.; Luo, P. SegFormer: Simple and efficient design for semantic segmentation with transformers. Adv. Neural Inf. Process. Syst. 2021, 34, 12077–12090. [Google Scholar]
- Chen, Z.; Tang, X.; Lin, Z. Research and implementation of adaptive correction and quality enhancement algorithm for distorted image. J. Comput. Appl. 2020, 40, 180–184. [Google Scholar]
- Guo, M.H.; Lu, C.Z.; Hou, Q.; Liu, Z.; Cheng, M.M.; Hu, S.M. Segnext: Rethinking convolutional attention design for semantic segmentation. arXiv 2022, arXiv:2209.08575. [Google Scholar]
- Wang, W.; Xie, E.; Li, X.; Fan, D.P.; Song, K.; Liang, D.; Lu, T.; Luo, P.; Shao, L. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 11–17 October 2021; pp. 568–578. [Google Scholar]
- Canny, J. A computational approach to edge detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, 6, 679–698. [Google Scholar] [CrossRef]
- Loshchilov, I.; Hutter, F. Sgdr: Stochastic gradient descent with warm restarts. arXiv 2016, arXiv:1608.03983. [Google Scholar]
- Zhao, H.; Shi, J.; Qi, X.; Wang, X.; Jia, J. Pyramid scene parsing network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 2881–2890. [Google Scholar]
- Wang, J.; Sun, K.; Cheng, T.; Jiang, B.; Deng, C.; Zhao, Y.; Liu, D.; Mu, Y.; Tan, M.; Wang, X.; et al. Deep high-resolution representation learning for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 2020, 43, 3349–3364. [Google Scholar] [CrossRef]
- Lin, F.; Yu, Z.; Jin, Q.; You, A. Semantic segmentation and scale recognition based water-level monitoring algorithm. J. Coast. Res. 2020, 105, 185–189. [Google Scholar] [CrossRef]
Stages | Output Size | Layer Name | CTA-B0 | CTA-B1 | CTA-B2 | CTA-B3 |
---|---|---|---|---|---|---|
1 | Overlapping Path Embedding | ; ; | ||||
Multiscale Convolutional Attention Encoder | ||||||
2 | Overlapping Path Embedding | ; ; | ||||
Multiscale Convolutional Attention Encoder | ||||||
3 | Overlapping Path Embedding | ; ; | ||||
Transformer Encoder | ||||||
4 | Overlapping Path Embedding | ; ; | ||||
Transformer Encoder |
Method | Params (M) | GFLOPs (G) | mIoU (%) | mPA (%) |
---|---|---|---|---|
FCN [20] | 32.95 | 138.86 | 96.06 (2.28↓) | 97.84 (1.26↓) |
UNet [21] | 24.89 | 225.84 | 96.17 (2.17↓) | 97.89 (1.21↓) |
DeepLab V3+ [24] | 54.71 | 83.42 | 97.47 (0.87↓) | 98.85 (0.25↓) |
PSPNet [33] | 46.71 | 59.21 | 96.66 (1.68↓) | 98.17 (0.93↓) |
HRNet [34] | 65.85 | 93.83 | 96.88 (1.46↓) | 98.29 (0.81↓) |
SegFormer-B5 [27] | 84.60 | 99.75 | 96.57 (1.77↓) | 98.22 (0.88↓) |
SegFormer-UNet-B3 (Ours) | 46.56 | 49.43 | 98.34 | 99.10 |
Method | Backbone | Params (M) | GFLOPs (G) | mIoU (%) | mPA (%) |
---|---|---|---|---|---|
SegFormer-UNet | B0 | 5.54 | 14.49 | 96.76 | 98.2 |
SegFormer | B0 | 3.72 | 6.77 | 93.03 | 96.04 |
SegFormer-UNet | B1 | 15.78 | 23.50 | 97.14 | 98.46 |
SegFormer | B1 | 13.28 | 26.48 | 95.30 | 97.55 |
SegFormer-UNet | B2 | 26.00 | 32.04 | 97.43 | 98.62 |
SegFormer | B2 | 27.35 | 56.71 | 96.35 | 98.12 |
SegFormer-UNet | B3 | 46.56 | 49.43 | 98.34 | 99.10 |
SegFormer | B3 | 47.22 | 71.36 | 96.43 | 98.10 |
SegFormer | B4 | 63.99 | 85.43 | 96.30 | 98.00 |
SegFormer | B5 | 84.60 | 99.76 | 96.66 | 98.22 |
Method | Architecture | Params (M) | GFLOPs (G) | mIoU (%) | mPA (%) | |||
---|---|---|---|---|---|---|---|---|
Stage 1 | Stage 2 | Stage 3 | Stage 4 | |||||
SegFormer-UNet-B0 | CA | CA | CA | CA | 6.17 | 15.41 | 94.26 | 96.95 |
CA | CA | CA | TA | 6.24 | 15.43 | 96.65 | 97.56 | |
CA | CA | TA | TA | 5.54 | 14.49 | 96.76 | 98.29 | |
CA | TA | TA | TA | 5.58 | 14.07 | 96.69 | 98.22 | |
SegFormer-UNet-B1 | CA | CA | CA | CA | 16.76 | 25.76 | 95.67 | 97.73 |
CA | CA | CA | TA | 17.18 | 25.87 | 97.06 | 98.16 | |
CA | CA | TA | TA | 15.78 | 23.50 | 97.14 | 98.46 | |
CA | TA | TA | TA | 16.30 | 23.42 | 97.12 | 98.42 | |
SegFormer-UNet-B2 | CA | CA | CA | CA | 29.59 | 38.97 | 95.70 | 97.67 |
CA | CA | CA | TA | 30.20 | 39.13 | 97.16 | 98.47 | |
CA | CA | TA | TA | 26.00 | 32.04 | 97.43 | 98.62 | |
CA | TA | TA | TA | 26.80 | 31.90 | 97.37 | 98.61 | |
SegFormer-UNet-B3 | CA | CA | CA | CA | 47.93 | 59.74 | 96.21 | 97.70 |
CA | CA | CA | TA | 48.55 | 59.90 | 97.26 | 98.57 | |
CA | CA | TA | TA | 46.56 | 49.43 | 98.34 | 99.10 | |
CA | TA | TA | TA | 46.67 | 46.55 | 97.27 | 98.55 |
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
Xie, Z.; Jin, J.; Wang, J.; Zhang, R.; Li, S. Application of Deep Learning Techniques in Water Level Measurement: Combining Improved SegFormer-UNet Model with Virtual Water Gauge. Appl. Sci. 2023, 13, 5614. https://doi.org/10.3390/app13095614
Xie Z, Jin J, Wang J, Zhang R, Li S. Application of Deep Learning Techniques in Water Level Measurement: Combining Improved SegFormer-UNet Model with Virtual Water Gauge. Applied Sciences. 2023; 13(9):5614. https://doi.org/10.3390/app13095614
Chicago/Turabian StyleXie, Zhifeng, Jianhui Jin, Jianping Wang, Rongxing Zhang, and Shenghong Li. 2023. "Application of Deep Learning Techniques in Water Level Measurement: Combining Improved SegFormer-UNet Model with Virtual Water Gauge" Applied Sciences 13, no. 9: 5614. https://doi.org/10.3390/app13095614
APA StyleXie, Z., Jin, J., Wang, J., Zhang, R., & Li, S. (2023). Application of Deep Learning Techniques in Water Level Measurement: Combining Improved SegFormer-UNet Model with Virtual Water Gauge. Applied Sciences, 13(9), 5614. https://doi.org/10.3390/app13095614