Abstract:In view of the susceptibility of traditional image processing water level detection algorithms to environmental factors, a water level detection algorithm has thus been proposed with attention mechanism incorporated. Firstly, the YOLO v5 object detection model, with CBAM attention mechanism incorporated, is utilized to obtain the categorical classification of the water gauge and its corresponding coordinate information. Secondly, the segmentation of water gauge and background can be achieved through the DeepLabv3+ semantic segmentation model with ECA attention mechanism incorporated. Then, an edge detection algorithms is applied to obtain water level information. Finally, the pixel values are converted to the true water level values based on the digital information of the ruler and the water level information. The experimental results show that the error between the optimized water level detection algorithm and manual reading is within 2 cm, which meets the requirements of water level detection standards.