Water level monitoring and early warning method combining yov8 and sam

By combining the water level monitoring and early warning methods with yolov8 and ppLiteSeg algorithms, the problem of insufficient accuracy and timeliness of early warning in the existing technology is solved, and more efficient and stable water level monitoring and early warning effects are achieved.

CN119723435APending Publication Date: 2025-03-28BEIJING CHINASOFT INT INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411506533.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing water level monitoring methods have shortcomings in accuracy, stability and early warning timeliness, making it difficult to comprehensively and accurately evaluate the water level risk status.

Method used

The water level monitoring and early warning method combined with the yolov8 object detection algorithm and the ppLiteSeg semantic segmentation algorithm is adopted. The data set is constructed by collecting E-shaped water ruler pictures, and the identification model is constructed and deployed to the web management platform. The cordon and configuration parameters are drawn. The water level abnormality is judged based on the model results and an acoustic and light alarm is issued.

Benefits of technology

It improves the accuracy, stability and comprehensiveness of water level monitoring, realizes timely and effective water level abnormal alarms, and enhances the in-depth analysis and utilization of water level change data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119723435A_ABST
    Figure CN119723435A_ABST
Patent Text Reader

Abstract

The invention discloses a water level monitoring and early warning method in combination with yov8 and sam, and relates to the technical field of hydraulic engineering, and the method comprises the following steps: collecting E-word water gauge pictures to construct a data set, carrying out initialization processing, and dividing a training set, a verification set and a test set; a first recognition model and a second recognition model are constructed by using a yov8 target detection algorithm and a ppLiteSeg semantic segmentation algorithm respectively, and machine learning is carried out. And deploying the two algorithms to a web management platform, drawing a warning line, configuring parameters and selecting an identifier. And judging that the water level is abnormal according to the results of the two models, and uploading alarm information and performing sound-light alarm if the water level is abnormal. The technical problem that an existing water level monitoring method is insufficient in accuracy, stability and early warning timeliness is solved, and the technical effect of improving the accuracy, stability and comprehensiveness of water level monitoring is achieved through timely and effective water level abnormity alarming.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of water conservancy engineering, and in particular to a water level monitoring and early warning method combining yolov8 and sam. Background Art

[0002] In the water level monitoring scenario, it is crucial to detect water level anomalies in a timely manner and issue effective warnings, and the contradiction between the needs is also prominent. Efficient water level monitoring and accurate warning have become crucial links in solving the safety problems of water conservancy projects. Traditional water level monitoring methods are often relatively simple and localized, relying only on conventional water level signs, and do not support sound and light alarms. Personnel are required to check video surveillance or field patrols every day. The overall control of water levels is insufficient, and there is a lack of in-depth analysis and utilization of water level change data, making it difficult to comprehensively and accurately assess water level risk conditions. In terms of resource allocation, there are unreasonable situations. The formulation of water level monitoring and early warning plans is relatively simple and fixed, and cannot cope well with the ever-changing actual water level conditions.

[0003] At present, relevant technologies still have technical problems in water level monitoring methods in terms of accuracy, stability and timeliness of early warning. Summary of the invention

[0004] This application provides a water level monitoring and early warning method combining yolov8 and sam, and uses the collection of E-shaped water gauge pictures to construct a data set, perform initialization processing and divide it into training set, verification set and test set. Use the yolov8 target detection algorithm and ppLiteSeg semantic segmentation algorithm to build the first and second recognition models and perform machine learning. Deploy the two algorithms to the web management platform, draw warning lines, configure parameters and select logos. According to the results of the two models, the water level is judged to be abnormal. If it is abnormal, the alarm information is uploaded and the sound and light alarm is sounded. Through timely and effective water level abnormality alarms, the technical effect of improving the accuracy, stability and comprehensiveness of water level monitoring is achieved.

[0005] The present application provides a water level monitoring and early warning method combining yolov8 and sam, including:

[0006] Collect E-shaped water gauge pictures of different standards and construct an E-shaped detection data set; initialize the E-shaped detection data set and divide it into training set, validation set and test set; use yolov8 target detection algorithm to build a first recognition model, and use the training set, validation set and test set for machine learning; use ppLiteSeg semantic segmentation algorithm to build a second recognition model, and use the training set, validation set and test set for machine learning; deploy yolov8 target detection algorithm and ppLiteSeg semantic segmentation algorithm to the web management platform, and draw warning lines, configure model parameters and select the E-shaped water gauge logo through the web management platform interface; judge the water level anomaly according to the recognition results of the first recognition model and the second recognition model. If there is a water level anomaly, upload the alarm information to the web management platform, and send the alarm information through sound and light.

[0007] The water level monitoring and early warning method combining yolov8 and sam proposed in this application first collects E-shaped water gauge images to construct a data set, performs initialization processing and divides the data into training set, validation set and test set. Use yolov8 target detection algorithm and ppLiteSeg semantic segmentation algorithm to construct the first and second recognition models and perform machine learning respectively. Deploy the two algorithms to the web management platform, draw warning lines, configure parameters and select logos. According to the results of the two models, the water level is judged to be abnormal. If it is abnormal, the alarm information is uploaded and the sound and light alarm is sounded. Through timely and effective water level abnormality alarm, the technical effect of improving the accuracy, stability and comprehensiveness of water level monitoring is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the technical solution of the embodiment of the present invention, the accompanying drawings of the embodiment of the present invention will be briefly introduced below. A flow chart is used in the present application to illustrate the operations performed by the system according to the embodiment of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, various steps can be processed in reverse order or simultaneously as needed. At the same time, other operations can also be added to these processes, or one or more operations can be removed from these processes.

[0009] Figure 1 A flow chart of a water level monitoring and early warning method combining yolov8 and sam provided in an embodiment of the present application;

[0010] Figure 2 A schematic diagram of the process of obtaining an E-word detection data set for a water level monitoring and early warning method combining yolov8 and sam provided in an embodiment of the present application. DETAILED DESCRIPTION

[0011] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below.

[0012] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0013] In the following description, reference is made to "some embodiments", which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict, and the terms "first\second" involved are merely to distinguish similar objects and do not represent a specific ordering of objects. The terms "including" and "having" and any variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products, or devices. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by technicians in the technical field of this application. The terms used herein are for the purpose of describing the embodiments of the present application only.

[0014] The present application embodiment provides a water level monitoring and early warning method combining yolov8 and sam, such as Figure 1 As shown, the method includes:

[0015] Step S100, collect E-shaped water gauge pictures of different standards and construct an E-shaped detection data set. Specifically, in order to construct an E-shaped detection data set, first clarify the various standards of the E-shaped water gauge in the water conservancy industry, and set collection targets covering different water levels and environmental conditions. The data collection sources include field shooting (simulating different angles, lighting conditions and water level changes), collecting regular source pictures on the Internet, and using computer graphics and water conservancy engineering simulation software for data simulation generation. Then the collected pictures are centralized and sorted, duplicates and pictures that do not meet the quality requirements are removed and uniformly named and numbered, and the E-shaped water gauge is labeled using labelImg software and the like and the labeling quality is checked. Finally, the labeled pictures and their annotation information are integrated into a data set, divided into a training set, a validation set and a test set according to a certain ratio, and a suitable storage method is selected to save, and a data directory structure is established to provide a data basis for subsequent model training and water level monitoring and early warning.

[0016] In one possible implementation, Figure 2 As shown, E-shaped water gauge pictures of different standards are collected to construct an E-shaped detection data set. Step S100 further includes step S110, based on the E-shaped water gauge pictures of different standards, a first E-shaped standard water gauge picture is randomly selected, and the E-shaped water gauge under different angles and different lighting conditions is simulated. Specifically, the acquired E-shaped water gauge pictures based on different standards are sorted and classified. The pictures may come from various channels, such as on-site shooting of water conservancy facilities, related databases, etc. A representative E-shaped standard water gauge picture is selected from them using a random sampling method and marked as "the first E-shaped standard water gauge picture". The random extraction process can be implemented with the help of a random number generation function in a programming language to ensure the randomness and fairness of the extraction, so as to avoid artificial selection bias, so that the subsequent operations and analyses based on the picture can be more universal and representative. Around the selected first E-shaped standard water gauge picture, an image processing software or a simulation device is used to simulate the angle change, and different rotation angles are set based on the plane where the water gauge is located. For example, starting from 0°, the rotation angle is gradually increased at a certain angle interval (such as 15°, 30°, etc.) until 360° (or a suitable angle range is determined according to actual needs), and a series of E-shaped water gauge images at different angles are generated. In the simulation process, it is necessary to ensure the clarity and accuracy of the image and reflect the situation of observing the water gauge at different angles in the actual scene as realistically as possible. For the simulation of lighting conditions, multiple factors need to be considered, including light intensity, light direction, and light color. Create different lighting environments by adjusting light source parameters or using lighting simulation software. For example, set different light intensity levels (such as strong light, medium light, and weak light) to simulate the intensity changes of sunlight at different time periods during the day; change the lighting direction and illuminate the water gauge from different angles, such as top light, side light, backlight, etc., to simulate the lighting effect of the sun on the water gauge at different positions; you can also adjust the light color to simulate the color temperature difference of light under different weather conditions (such as sunny and cloudy days). For each combination of lighting conditions, a corresponding E-shaped water gauge image is generated so that subsequent data collection and model training can adapt to various actual lighting conditions.

[0017] Step S120, at the same time, data collection is performed in the form of RGB to obtain the E-word detection data subset corresponding to the first E-word standard water gauge picture. Specifically, RGB is a common color mode, representing three color channels of red, green, and blue. In the data collection process, a device equipped with an RGB sensor (such as a digital camera, a video camera, etc.) is used to shoot the simulated first E-word standard water gauge picture under different angles and lighting conditions. The RGB sensor can capture the color information of the light reflected or emitted by the object and convert it into a digital signal. When shooting, it is necessary to ensure that the parameters of the device are reasonably set, such as exposure, white balance, etc., to accurately record the color and brightness characteristics of the E-word water gauge under different conditions. For each combination of angle and lighting conditions, multiple shots are taken to obtain a sufficient number of data samples to reduce the influence of random errors. The data obtained by these shots will be stored in RGB format, and each pixel point contains the values ​​of the three channels of red, green, and blue, which can accurately describe the color information of the image, and all the data collected in RGB form about the first E-word standard water gauge picture under different angles and lighting conditions are sorted and summarized. These data constitute a relatively small but rich and diverse data set, namely the "E-shaped detection data subset corresponding to the first E-shaped standard water gauge image". This subset contains the appearance feature information of the E-shaped water gauge in various simulation situations, providing basic data for subsequent further analysis and processing. A preliminary quality check is performed on the data subset to check whether the image is clear, whether there is any data missing or damaged, etc. If necessary, some simple pre-processing is performed on the data, such as cropping and resizing, to ensure data consistency and availability.

[0018] Step S130, based on the E-shaped water gauge pictures of different standards, data collection is performed in combination with data simulation to obtain the E-shaped detection data set. Specifically, the collection of E-shaped water gauge pictures of different standards collected initially is returned again. The pictures cover various types and styles of E-shaped water gauges in practical applications, reflecting different manufacturing standards, size specifications and material characteristics, etc. The pictures are deeply analyzed to extract their key features and parameters, such as the shape, size, and proportion of the E-shaped water gauge, the scale spacing and accuracy of the water gauge, etc., to provide a real reference basis for data simulation, and a virtual E-shaped water gauge environment is created by using computer simulation technology and professional simulation software. In this environment, a mathematical model is established according to the physical and optical properties of the actual E-shaped water gauge. By adjusting the parameters of the model, various different situations can be simulated, including the influence of different water level heights, water flow speeds, water surface fluctuations, water quality conditions, and the illumination and reflection of the surrounding environment on the appearance of the E-shaped water gauge. In the simulation process, a large amount of virtual E-shaped water gauge image data is generated, and the data can supplement the data under certain special situations or extreme conditions that may be missing in the actual collected data, such as rare water level change patterns, special illumination reflection situations, etc. At the same time, by precisely controlling the simulation parameters, data samples with specific attributes can be obtained for model training and verification to improve the generalization and adaptability of the model. The E-word detection data subset corresponding to the first E-word standard water gauge image obtained through actual data collection and the data generated by data simulation are merged and integrated. The merged data is further cleaned, screened and annotated to remove duplicate, invalid or non-compliant data, and the data is standardized to have a unified format and specification. Finally, a complete E-word detection data set containing rich and diverse information is obtained, which will be used for subsequent model training and the development of water level monitoring and early warning systems.

[0019] In a possible implementation, at the same time, data is collected in the form of RGB to obtain an E-word detection data subset corresponding to the first E-word standard water gauge image. Step S120 further includes step S121. According to the actual on-site conditions of the target monitoring waters, the identification area is centered when the RGB sensor is installed, and the data is transmitted synchronously with the device through a network cable. Specifically, before implementing water level monitoring, it is necessary to conduct a comprehensive field survey of the target monitoring waters to understand the geographical environment, water flow characteristics, surrounding facilities, etc. of the waters. For example, observe the shape, size, and depth distribution of the waters, and whether there are special water flow phenomena such as turbulent water flow areas and whirlpools. At the same time, consider the surrounding topography and determine a suitable installation location to avoid terrain obstruction or other interference factors affecting the monitoring effect. It is also necessary to understand whether there are infrastructure conditions such as power supply and network signal coverage in the surrounding area to provide guarantees for subsequent equipment installation and operation. After selecting a suitable installation point, install the RGB sensor. Install the sensor in a position where the E-shaped water gauge can be clearly observed, and ensure that the sensor's recognition area can accurately cover the range of the E-shaped water gauge. In order to achieve accurate monitoring, the recognition area is placed in the center of the E-shaped water gauge. This can be done through precise measurement and adjustment. For example, use a measuring tool to determine the center position of the E-shaped water gauge, and then adjust the installation angle and position of the sensor so that the center of the sensor's field of view coincides with the center of the E-shaped water gauge. This ensures that when the sensor collects images, the E-shaped water gauge can be completely within the recognition area, reducing the possibility of edge distortion and information loss, and improving the accuracy of data collection. Use a network cable to connect the RGB sensor to a data receiving device (such as a server, edge computing device, etc.). The network cable connection has the advantages of high stability and fast data transmission speed, and can ensure real-time and reliable data transmission. During the connection process, ensure that the interface of the network cable is firmly connected to avoid data transmission interruption caused by looseness or poor contact. At the same time, according to the network environment and device configuration, make necessary network settings, such as setting parameters such as IP address, subnet mask, gateway, etc., to ensure that the sensor can communicate normally with the device in the same network. When the RGB sensor collects the image data of the E-shaped water gauge, the data is synchronously transmitted to the device end through the network cable for subsequent processing and analysis.

[0020] Step S122, deploy the trained first recognition model and the second recognition model to the web management platform. Specifically, after completing the training and optimization of the first recognition model (based on the yolov8 target detection algorithm) and the second recognition model (based on the ppLiteSeg semantic segmentation algorithm), they need to be deployed to the web management platform. First, the trained model files are packaged and organized to ensure that the structure, parameters and related dependent libraries of the model are complete and correct. Then, a suitable operating environment is created on the server where the web management platform is located, and software and libraries related to the model operation are installed. For example, for a Python-based model, it is necessary to install the corresponding Python interpreter, deep learning framework (such as TensorFlow or PyTorch) and other necessary dependencies. Upload the packaged model file to the server and configure the operating parameters of the model, such as memory allocation, GPU usage, etc. Through the interface of the web management platform, the model is integrated with the platform so that the platform can call the model for data processing and analysis. In this way, users can access the management platform through a web browser to achieve remote management and operation of water level monitoring.

[0021] Step S123, obtain the RGB data source, send it to the first recognition model and the second recognition model respectively, and obtain the first recognition result and the second recognition result. Specifically, the data source collected by the RGB sensor is obtained in real time through the data receiving device connected to the RGB sensor. These data sources are the state information of the E-shaped water gauge at different time points presented in the form of images. The data receiving device can perform preliminary caching and sorting on the collected data to ensure the integrity and order of the data. At the same time, as needed, some simple preprocessing can be performed on the data, such as format conversion, image compression, etc., to improve the efficiency of data transmission and processing. Prepare the obtained RGB data source so that it can be sent to the recognition model for analysis later, and input the obtained RGB data source into the first recognition model and the second recognition model respectively. For the first recognition model (yolov8 target detection model), it will perform target detection on the input image and identify the position and category information of the E-shaped water gauge. The model determines the specific position of the E-shaped water gauge in the image by analyzing and matching the features in the image, and judges the category to which it belongs (such as different types of E-shaped water gauges or different water level states, etc.) according to the trained classifier. After being processed by the model, the first recognition result is obtained, which is the relevant information about the location and category of the E-shaped water ruler. For the second recognition model (ppLiteSeg semantic segmentation model), it will perform semantic segmentation on the input image, accurately segment the E-shaped water ruler from the background, and provide semantic information about the water ruler. The model learns the pixel-level features in the image and distinguishes each pixel of the E-shaped water ruler from the background pixels, thereby obtaining the precise outline and area information of the water ruler. After processing, the second recognition result is obtained, which is the semantic segmentation result of the E-shaped water ruler, including information such as the shape, boundary, and relationship of the water ruler with the surrounding environment.

[0022] Step S124, the first recognition result and the second recognition result are fused. Specifically, after obtaining the first recognition result and the second recognition result, they need to be fused to comprehensively utilize the advantages of the two models and improve the accuracy and reliability of water level monitoring. First, analyze the characteristics and advantages of the two recognition results. For example, the first recognition model may perform better in quickly locating the position of the E-shaped water gauge, while the second recognition model has more advantages in accurately segmenting the water gauge and obtaining detailed information. According to these characteristics, a suitable fusion strategy is designed. A common fusion method is weight-based fusion. By calculating indicators such as the confidence or accuracy of the first recognition model and the second recognition model, a weight is assigned to each model. For models with high confidence or high accuracy, a larger weight is assigned, and vice versa. Then, the results of the two models are weighted fused according to the weights. For example, for the position information of the E-shaped water gauge, the position coordinates obtained by the first recognition model can be multiplied by its corresponding weight, and the position coordinates obtained by the second recognition model can be multiplied by its weight to obtain the fused position coordinates. For the semantic segmentation results, the classification results of each pixel can be similarly weighted fused to obtain more accurate water gauge segmentation and semantic information. In addition to weight-based fusion, other fusion strategies can also be used, such as decision-level fusion. That is, preliminary judgments are made based on the results of the two models, and then comprehensive decisions are made through certain rules (such as majority voting, logical judgment, etc.) to obtain the final fusion result. For example, if the first recognition model judges that the water level is normal, and the second recognition model judges that the water level is abnormal, the final water level judgment result is determined according to the pre-set rules (such as when the judgment results of the two models are inconsistent, the more accurate model result shall prevail). By fusing the first recognition result and the second recognition result, a more comprehensive and accurate water level monitoring result can be obtained, providing a more reliable basis for subsequent water level abnormality judgment and alarm.

[0023] In a possible implementation, the first recognition result and the second recognition result are fused, and step S124 further includes step S1241, calculating the fusion weight of the first recognition model and the fusion weight of the second recognition model through the score of the first recognition model and the score of the second recognition model. Specifically, after the first recognition model (based on the yolov8 target detection algorithm) and the second recognition model (based on the ppLiteSeg semantic segmentation algorithm) process the input RGB data source, they will each obtain a score and a corresponding recognition result. The score is an indicator of the accuracy of the model for this recognition task. For example, the score of the target detection model may reflect the reliability of the E-shaped water gauge position and category prediction detected by it; the score of the semantic segmentation model may indicate the degree of consistency between its segmentation result and the actual situation. In order to determine the fusion weight, a suitable calculation method is selected. It is common to allocate weights according to the proportion of model scores. Assume that the score of the first recognition model is A and the score of the second recognition model is B. Then the fusion weight of the first recognition model is the proportion of A in the sum of A and B, and the fusion weight of the second recognition model is the proportion of B in the sum of A and B. In simple terms, if A scores higher, it means that it performed better this time, and its weight in the fusion will be greater, which means that its impact on the final result will be more prominent. Of course, the weight can also be determined more flexibly by comprehensively considering factors such as the model's past performance and its effects in different scenarios.

[0024] Step S1242, obtain the fusion processing result through the fusion weight of the first recognition model and the first recognition result, the fusion weight of the second recognition model and the second recognition result. Specifically, after having the fusion weight of the first recognition model and the fusion weight of the second recognition model, the recognition results of the two models can be fused. Assuming that the first recognition result contains the position, category and other information of the E-shaped water gauge, and the second recognition result contains the semantic segmentation and other information of the E-shaped water gauge, for the fusion of position information, if the position of the E-shaped water gauge in the first recognition result is a certain point, and the position in the second recognition result is another point, then the fused position is the new position obtained by weighted averaging the two points according to the fusion weights of the two models. For example, if the weight of the first recognition model is large, the fused position will be closer to the position in the first recognition result. For category information, if the two models have different judgments on the category of the E-shaped water gauge, a more reliable category can be selected according to the weight or a more reasonable category can be obtained by comprehensive judgment. For semantic segmentation information, the classification results of each pixel are also synthesized according to the weight to obtain a fused semantic segmentation map. In this way, by fusing the results of the two models, we can obtain more comprehensive and accurate information, providing a better basis for judging water level anomalies.

[0025] Step S1243, the water level abnormality is judged by the fusion processing result. If the water level is judged to be abnormal, it is inquired whether to upload the alarm information to the cloud platform. Specifically, the result obtained by the fusion processing is used to judge whether the water level is abnormal. This requires analyzing the relevant information in the result according to the rules and standards set in advance. For example, the height of the water level can be inferred based on the position of the E-shaped water gauge in the image and the semantic segmentation information. If the part of the E-shaped water gauge submerged by water exceeds the normal range, or the speed of the water level change is too fast, it is judged that the water level is abnormal. When the water level is judged to be abnormal, the system will initiate an inquiry to ask whether to upload the alarm information to the cloud platform. The inquiry can be made by displaying prompts or sending notifications in the management interface. For example, sometimes it may be necessary to further confirm the abnormal situation first, or take some measures on site before deciding whether to upload the alarm information to prevent false alarms or unnecessary alarms.

[0026] Step S1244, if the answer to the inquiry is yes, the abnormal water level signal is reported to the cloud platform. Specifically, if the operator or manager replies and agrees to upload the alarm information, the system will organize the relevant information of the abnormal water level, including the time, location, degree of abnormality, etc. Then, through network communication, use the appropriate protocol to send this information to the cloud platform. After receiving the signal, the cloud platform can perform operations such as storage, push notifications to relevant personnel, and start emergency processing procedures. In this way, more people can be informed of the abnormal water level in a timely manner so that measures can be taken to ensure the safety of water conservancy facilities and the stability of the surrounding environment.

[0027] In a possible implementation, if the answer to the inquiry is yes, the abnormal water level signal is reported to the cloud platform, and step S1244 further includes step S12441, and through the fusion processing result, it is determined whether to use the sound and light method to issue an alarm message. Specifically, the fusion processing result is first analyzed to extract key information related to the water level state, such as the position of the E-shaped water gauge, the degree of flooding, and the trend of water level changes, and compare these information with the pre-set threshold (determined according to the safety standards of water conservancy projects, historical data and actual needs). Then, the evaluation is conducted by comprehensively considering the situation where multiple key information exceeds the threshold, the severity of exceeding the threshold, whether the current time is a period of frequent personnel activities, and whether the surrounding environment is suitable for sound and light alarms. Finally, based on the comprehensive evaluation results, it is determined whether to use sound and light to issue an alarm message. If necessary, the sound and light alarm device is triggered to convey different degrees of emergency by adjusting parameters such as the frequency, intensity and mode of the sound and light; if it is not suitable to use the sound and light alarm immediately, other methods are selected to notify relevant personnel and continue to closely monitor the water level changes to adjust the alarm method at any time.

[0028] Step S200, the E-word detection data set is initialized and divided into a training set, a validation set, and a test set. Specifically, when the E-word detection data set is initialized, data cleaning is first performed to check and process the image blur, distortion, damage, duplication, and other issues as well as the accuracy and consistency of the annotation information; then labelImg software is used for precise annotation, including detection frame annotation and detailed annotation of each part of the water gauge when necessary, and the sam segmentation algorithm is used for segmentation and annotation; then data enhancement is performed through image transformations such as flipping, rotating, scaling, cropping, color transformation, adding noise, and other operations. After that, the initialized data set is divided into a training set, a validation set, and a test set. A random division method is used to shuffle the order of the data set and then distribute it according to a certain ratio, such as the common 7:2:1 ratio. When dividing, it is necessary to ensure that the data distribution is representative and random, and ensure that each subset contains E-word water gauge images in different situations and the data is independent, providing a reliable basis for subsequent model training and evaluation.

[0029] In a possible implementation, the E-word detection data set is initialized and divided into a training set, a validation set, and a test set. Step S200 further includes step S210, and the E-word detection data set is cleaned. Specifically, first, all images in the E-word detection data set are checked one by one. Check whether the image has quality problems, such as blurriness, which may be caused by factors such as inaccurate focusing of the device during shooting and water vapor in the shooting environment. For blurred images, if the blurriness is relatively light, you can try to use an image enhancement algorithm to repair them to a certain extent to improve their clarity so that subsequent annotations and model training can make better use of these images. If the blurriness is severe and cannot be improved by repair means, it will be removed from the data set to avoid its negative impact on model training, and check whether the image is distorted, such as deformation and distortion of the geometric shape of the image. This distortion may be caused during image acquisition or transmission. For distorted images, it is necessary to analyze the cause of the distortion. If it is a problem that can be corrected, such as geometric deformation caused by the shooting angle, it can be corrected by image processing technology; if the distortion cannot be repaired or the cause is difficult to determine, it will be deleted to ensure the quality of the dataset. Check whether the image has distortion, such as deformation or distortion of the geometric shape of the image. This distortion may be caused during the image acquisition or transmission process. For distorted images, it is necessary to analyze the cause of the distortion. If it is a problem that can be corrected, such as geometric deformation caused by the shooting angle, it can be corrected by image processing technology; if the distortion cannot be repaired or the cause is difficult to determine, it will be deleted to ensure the quality of the dataset. Remove duplicate images from the dataset. Duplicate images are identified by comparing the image's pixel value, file size, hash value and other features. Duplicate images not only increase the workload of data processing, but may also cause the model to over-learn certain specific samples during training, thereby affecting the generalization ability of the model. Only one of the duplicate images is retained to ensure the simplicity and effectiveness of the dataset. At the same time, the annotation information in the dataset is checked and cleaned. Check whether the annotation is consistent with the actual situation of the E-shaped water ruler in the image, for example, whether the detection box annotation accurately surrounds the E-shaped water ruler, whether the annotation category is correct, etc. If the annotation is wrong, make corrections; if the annotation is inconsistent, re-annotate after unifying the annotation standards to ensure the accuracy and consistency of the annotation information, and provide a reliable basis for subsequent model training.

[0030] Step S220, use labelImg software to mark the detection frame of the E-shaped water ruler. Specifically, open labelImg software and import the images in the E-shaped detection data set into the software. For each image, use the annotation tool provided by the software to manually draw a detection frame around the E-shaped water ruler on the image. When annotating, make sure that the detection frame tightly and accurately surrounds the E-shaped water ruler, and it cannot be too large or too small. An overly large detection frame may contain too much background information, affecting the model's learning of the E-shaped water ruler features; an overly small detection frame may not be able to fully contain the E-shaped water ruler, resulting in information loss. During the annotation process, add a corresponding label to each detection frame to indicate that it is an E-shaped water ruler. The labels can be further subdivided as needed, for example, different types or specifications of E-shaped water rulers are distinguished and labeled so that the model can learn the feature differences of different types of E-shaped water rulers during the training process. In the case where there are multiple E-shaped water rulers in the image, each E-shaped water ruler must be accurately annotated with a detection frame to ensure that each water ruler has corresponding annotation information. After the annotation is completed, save the annotation results and associate them with the corresponding image files so that the annotation information can be read and used in subsequent model training. Regularly spot check and review the annotated images to check the accuracy and consistency of the annotations. If any problems are found in the annotations, correct them in time to ensure the quality of the annotations. You can invite multiple annotators to do the annotations, and cross-check and discuss their annotation results to further improve the accuracy and reliability of the annotations.

[0031] Step S230, use the SAM segmentation algorithm to segment the E-shaped water ruler. Specifically, first, ensure that the environment and related software libraries required by the SAM segmentation algorithm have been installed and configured. Input the image in the E-shaped detection data set into the processing flow of the SAM segmentation algorithm. The algorithm analyzes the image and tries to accurately segment the E-shaped water ruler from the background of the image by learning the feature differences between the E-shaped water ruler and the background in the image. During the segmentation process, the algorithm will judge and divide the image based on various features such as pixel information, color features, texture, etc. The segmentation results need to be checked and evaluated. Check whether the segmentation is accurate, whether the E-shaped water ruler is completely separated from the background, and whether the boundaries are clear. If there are inaccuracies in the segmentation results, such as part of the water gauge area being misjudged as the background or the background being mistakenly included in the water gauge segmentation area, the algorithm parameters can be adjusted or the image can be preprocessed (such as contrast enhancement) and then segmented again to improve the accuracy of the segmentation. The segmented E-shaped water gauge image can be saved as a separate file or the segmented area can be marked on the original image so that these segmentation results can be conveniently used for model training or other related processing later. The segmented E-shaped water gauge data can be used for the training of semantic segmentation models, so that the model can better understand the shape and structural features of the E-shaped water gauge, thereby improving the accuracy of water level monitoring and identification. The parameters and settings used in the segmentation process are recorded so that they can be referenced and adjusted when processing similar data sets or optimizing the segmentation effect in the future, ensuring the repeatability and stability of the segmentation work.

[0032] Step S300, uses yolov8 target detection algorithm to build the first recognition model, and uses the training set, validation set, and test set for machine learning. Specifically, first build and prepare the operating environment required for the yolov8 target detection algorithm, understand its architecture and principle, and initialize the model based on the architecture. According to the situation, a suitable initialization method such as using a pre-trained model can be selected. Then the training set data is organized into a format suitable for algorithm input, loaded by a data loader, and the image data is input during the training process for forward propagation calculation prediction results. The loss function is calculated according to the prediction results and the real annotations, and the model parameters are updated using the optimization algorithm. The training state and parameters are regularly saved and the changes in related indicators are recorded. During the training process, the model is regularly evaluated with a validation set, and the validation set data is pre-processed and input into the model to obtain the prediction results, and the evaluation indicators are calculated. The model parameters or structure are adjusted according to the results, and the optimization is continuously optimized until good performance is achieved on the validation set. When the model is stable and has good performance, it is finally evaluated using the test set. The test set data is preprocessed and input into the model to obtain the prediction results. The evaluation indicators are calculated and the results are analyzed to determine whether they meet the requirements. If not, it is necessary to re-collect data, adjust the algorithm, or improve the model structure, etc., and re-train and evaluate until a satisfactory first recognition model is obtained for E-shaped water gauge detection and water level monitoring tasks.

[0033] In a possible implementation, a first recognition model is constructed using the yolov8 target detection algorithm, and the training set, validation set, and test set are used for machine learning. Step S300 further includes step S310, performing data enhancement operations on the E-word detection data set to obtain an expanded data set. Specifically, first, the original E-word detection data set is analyzed to understand its data distribution and characteristics, including various postures, lighting conditions, background environments, and the like of the E-word water ruler in the image. Based on these analyses, a suitable data enhancement strategy is formulated, and an angle is randomly selected within a certain angle range (e.g., -30° to 30°) to rotate the image. This allows the model to learn the features of the E-word water ruler at different angles and enhance its adaptability to different shooting angles. For example, for a horizontally placed E-word water ruler image, image samples with different tilt angles can be obtained by rotation, simulating various observation angles that may appear in actual scenes, and randomly selecting an angle within a certain angle range (e.g., -30° to 30°) to rotate the image. This allows the model to learn the features of the E-word water ruler at different angles and enhance its adaptability to different shooting angles. For example, for a horizontally placed E-shaped water gauge image, image samples with different tilt angles can be obtained by rotating it, simulating various viewing angles that may appear in actual scenes. The image is randomly scaled according to a certain scale range (such as 0.8 to 1.2 times). The scaling operation can simulate E-shaped water gauge images taken at different distances, so that the model can adapt to target objects of different sizes. A smaller scaling ratio can produce the effect of shooting from a distance, while a larger scaling ratio is similar to the situation of shooting at a close distance, which helps to improve the scale invariance of the model. A region is randomly selected from the original image for cropping. The size and position of the cropped region can be randomly determined according to certain rules, such as the side length of the cropped region is a certain ratio of the side length of the original image (such as 0.5 to 1 times), and the position is randomly distributed within the image range. The cropping operation can remove some irrelevant parts of the image, highlight the characteristics of the E-shaped water gauge, and also increase the diversity of the data, avoiding the model from over-relying on specific areas of the image. The brightness value of the image is randomly adjusted within a certain range (such as -0.2 to 0.2). Brightness adjustment can simulate E-shaped water gauge images under different light intensities, making the model more robust to light changes. Darker brightness values ​​can simulate low-light conditions such as cloudy days or night, while brighter brightness values ​​are similar to strong light conditions, randomly changing the contrast of the image by a certain amount (such as 0.8 to 1.2 times). Contrast adjustment can make the difference between the E-shaped water gauge and the background more obvious or blurred, helping the model learn more general features that do not rely solely on specific contrast conditions. Randomly adjust the color saturation of the image within a certain range (such as 0.8 to 1.2 times). Changes in color saturation can simulate the effects of images taken under different weather conditions or different camera settings, allowing the model to adapt to E-shaped water gauge recognition in various color environments.Add Gaussian noise with a mean of 0 and a standard deviation within a certain range (such as 0.01 to 0.05) to the image. Gaussian noise simulates the random interference that the image may be subject to during acquisition or transmission, so that the model can learn to accurately identify the E-shaped water ruler in a noisy environment and improve its anti-interference ability. Randomly set some pixels in the image to 0 (black) or 255 (white) with a certain probability (such as 0.01 to 0.05) to simulate salt and pepper noise in the image. This noise can help the model deal with sudden interference points in the image and enhance its tolerance to abnormal pixel values. Through the above various data augmentation operations, each image in the original data set is transformed multiple times to generate a large number of new image samples. These newly generated samples are merged with the original data set to obtain an expanded data set, thereby increasing the diversity and quantity of the data, providing richer learning materials for model training, and helping to improve the generalization and robustness of the model.

[0034] Step S320, builds the yolov8 target detection algorithm operating environment, and uses the model architecture associated with the yolov8 target detection algorithm to perform model training at the first preset resolution. Specifically, first, install the required deep learning framework, such as PyTorch, etc., to ensure that the system has the basic environment to support the operation of the yolov8 algorithm. According to the hardware configuration (such as GPU model, memory size, etc.), corresponding settings and optimizations are performed to give full play to the hardware performance. For example, a driver compatible with the GPU is installed, the acceleration library is configured to increase the speed of model training, and the relevant code and model files of the yolov8 target detection algorithm are downloaded or obtained. It can be obtained from the official code library or a reliable open source platform, and the integrity and correctness of the code are ensured. The code is integrated into the project, and a suitable project structure is established, including the settings of data storage path, model save path, logging path, etc. The dependent libraries and environment variables required for the configuration project are configured. According to the requirements of yolov8, the relevant Python library is installed, and the necessary environment variables, such as Python path, project path, etc., are set to ensure that the project can run normally and call the required resources, and the model architecture associated with the yolov8 target detection algorithm is used to make appropriate adjustments and configurations according to the task requirements. For the E-water gauge detection task, determine the input and output formats and category settings of the model. Define and encode the categories of the E-water gauge so that the model can recognize and classify E-water gauges of different states or characteristics (such as E-water gauges of normal water level, E-water gauges of high water level, etc., if there is such a classification requirement), set the training parameters, including the first preset resolution. Here it is set to 640x352, and the image data is adjusted to this resolution before inputting into the model for training. The selection of this resolution needs to comprehensively consider the performance of the model and the limitations of computing resources. A smaller resolution can speed up the training, but may lose some image details; a larger resolution can provide richer information, but will increase the amount of calculation and memory requirements. Weigh it according to the actual situation. 640x352 is a relatively balanced choice while ensuring a certain accuracy. The expanded data set is input into the model for training according to a certain batch size. The selection of batch size should be adjusted according to hardware resources (such as GPU memory) and training efficiency. Generally, a larger batch size within a reasonable range can use the parallel computing power of the hardware to increase the training speed, but it may also cause problems such as insufficient memory. During the training process, the model calculates the prediction results through forward propagation, and then calculates the loss function based on the prediction results and the true annotation (the annotation information of the E-scale in the data set). For example, common target detection loss functions include bounding box regression loss and classification loss. The parameters of the model are updated through the back-propagation algorithm, so that the loss function gradually decreases and the prediction results of the model continue to approach the true value. The optimization algorithm is used to adjust the update step size and direction of the parameters. The selection of the optimization algorithm and the parameter setting will also affect the training effect and convergence speed.During the training process, the model parameters and training status are saved regularly so that the training can be resumed or the model performance at different stages can be compared when the training is interrupted or subsequent analysis is required. At the same time, the changes in indicators such as loss value, accuracy, and recall rate during the training process are recorded so that the model training progress and performance can be monitored in real time, problems can be found in time, and training strategies can be adjusted.

[0035] Step S330, after the model training is completed, test the effect of the first model, and gradually optimize it to obtain the first recognition model. Specifically, when the model training reaches the preset number of training rounds or meets other stopping conditions (such as the loss function no longer decreases significantly, etc.), stop training. Use the test set to test the effect of the trained model. The test set is independently divided from the training set and the verification set in the data preprocessing stage, and contains image data that has not been used in the training process. It is used to evaluate the generalization ability of the model in practical applications. The image data in the test set is processed according to the same preprocessing method as that during training (such as adjusting the resolution to 640x352, normalization, etc.), and then input into the trained model for prediction. The model's detection results for the E-shaped water ruler in the test set image are obtained, including the position prediction and category prediction of the E-shaped water ruler. According to the prediction results of the model and the real annotation information of the image in the test set, a series of evaluation indicators are calculated to measure the performance of the model. Commonly used evaluation indicators include accuracy, which is the proportion of samples correctly predicted by the model to the total number of samples; recall, which indicates the proportion of correctly predicted samples to the actual number of samples; and mean precision, which comprehensively considers the detection accuracy under different categories and different confidence thresholds and is a more comprehensive and important evaluation indicator in the target detection task. Through these indicators, we can fully understand the accuracy, completeness and comprehensive performance of the model in detecting E-water scales, and analyze the problems and shortcomings of the model based on the test results. If the model is found to be overfitting (i.e., it performs well on the training set, but the performance decreases on the test set, which is manifested as high accuracy but low recall), some regularization measures may need to be taken, such as adding L1 or L2 regularization terms to limit the size of model parameters to prevent the model from being too complex and overfitting the training data; or adopting data enhancement strategies to further increase the diversity of the data so that the model can learn more general features. If the model is underfitting (i.e., the performance on both the training set and the test set is not ideal, as shown by low accuracy and recall), it may be necessary to adjust the structure of the model, such as increasing the depth or width of the network layer to improve the learning ability of the model; or adjust the training parameters, such as increasing the number of training rounds, optimizing the learning rate, etc., so that the model can better learn the features and patterns in the data. Based on the analysis results, the model is adjusted and optimized accordingly, and then trained and tested again. Repeat this process, constantly adjust the model structure, parameters, and data processing methods, until the model achieves satisfactory performance indicators on the test set. For example, by repeatedly testing different parameter combinations and model structure adjustments, observe the changes in indicators such as accuracy, recall, and mAP on the test set. When these indicators reach a relatively stable and high level and meet the needs of practical applications, it is considered that the model has been optimized. The model obtained at this time is the first recognition model, which can be used in subsequent practical tasks such as E-shaped water gauge detection and water level monitoring and early warning.

[0036] Step S400, use the ppLiteSeg semantic segmentation algorithm to build a second recognition model, and perform machine learning on the training set, validation set, and test set. Specifically, first, deeply understand the principles and characteristics of the ppLiteSeg semantic segmentation algorithm, prepare the divided training set, validation set, and test set, and process their images to meet the algorithm input requirements. Then build the ppLiteSeg algorithm operating environment, create a project structure, initialize the model based on the algorithm architecture, and consider initializing based on the pre-trained model. Then use the data loader to load and process the training set image data and annotation data, input them into the model for forward propagation calculation to predict the probability distribution of the category, calculate the loss function based on the prediction results and the true annotations, update the parameters with the optimization algorithm, and regularly save the training status and parameters and record the relevant indicators. During training, the validation set is regularly evaluated, and the model is input into the model after processing to obtain the prediction results, and the evaluation indicators such as pixel accuracy and average intersection-over-union ratio are calculated. According to the results, the model is adjusted, such as taking measures such as regularization or increasing complexity, and training and evaluation are continued after optimization. When the model performance is good, it is evaluated with the test set. After processing, the input model is used to obtain the prediction results and calculate the evaluation indicators. The results are analyzed to determine whether they meet the requirements. If not, the model structure needs to be readjusted, parameters optimized, etc., and re-trained and evaluated until a satisfactory second recognition model is obtained for E-shaped water gauge semantic segmentation and water level monitoring tasks, which can be used together with the first recognition model to improve the accuracy and reliability of water level monitoring.

[0037] In a possible implementation, the ppLiteSeg semantic segmentation algorithm is used to construct a second recognition model, and the training set, validation set, and test set are used for machine learning. Step S400 further includes step S410, constructing a ppLiteSeg semantic segmentation algorithm operating environment, and using the model architecture associated with the ppLiteSeg semantic segmentation algorithm to perform model training at a second preset resolution. Specifically, the required deep learning framework and related dependencies are installed, such as the common TensorFlow or PyTorch, to ensure that the system's hardware configuration (such as GPU, etc.) can meet the algorithm operation requirements, and to make appropriate settings, such as installing the corresponding GPU driver, configuring CUDA and other acceleration environments, downloading or obtaining the relevant code and model files of the ppLiteSeg algorithm, integrating them into the project, and establishing a clear project directory structure, including data storage paths, model save paths, etc. Configure the environment variables required for the project, such as the Python path, to ensure that the project can run smoothly and call the required resources, and use the model architecture associated with the ppLiteSeg semantic segmentation algorithm to make necessary adjustments according to the characteristics of the E-shaped water gauge detection task. Determine the input and output formats of the model to adapt it to the semantic segmentation task of the E-shaped water ruler. For example, define the encoding of the E-shaped water ruler and background, set the second preset resolution to 480x480, adjust the image data in the training set to this resolution and input the model for training. The choice of this resolution takes into account the balance between algorithm performance and computing resources, which can ensure the model's ability to capture the details of the E-shaped water ruler to a certain extent without excessively increasing the computing burden. Input the processed image data into the model according to the appropriate batch size (determined by factors such as hardware memory). The model calculates the predicted category of each pixel through forward propagation, and calculates the loss function based on the prediction results and the real annotations of the images in the training set (pixel-level annotations, indicating whether each pixel belongs to the E-shaped water ruler or background, etc.). Common semantic segmentation loss functions such as cross entropy loss are used to measure the difference between the prediction and the truth. Update the parameters of the model through the back propagation algorithm to gradually reduce the loss to optimize the model. Use a suitable optimization algorithm (such as Adam, etc.) to adjust the parameter update process, save the model parameters and training status regularly during the training process, and record the changes in indicators such as the loss value during the training process to monitor the training progress and performance.

[0038] Step S420, after the model training work is completed, the second model effect is tested, and gradually optimized to obtain the second recognition model. Specifically, when the model training reaches the preset conditions (such as completing a certain number of training rounds or the loss no longer decreases significantly), the training is stopped. Use the test set to test the effect of the trained model. The image data in the test set is preprocessed in the same way as during training, that is, the resolution is adjusted to 480x480 and necessary normalization and other operations are performed, and then input into the model for prediction to obtain the predicted category result of each pixel. According to the prediction results and the true annotation of the test set, the evaluation index is calculated to measure the model performance, such as pixel accuracy (the proportion of correctly classified pixels to the total number of pixels), average intersection ratio (measurement of the overlap between the predicted segmentation area and the true segmentation area), etc. These indicators are used to comprehensively evaluate the semantic segmentation effect of the model on the E-shaped water gauge, and the advantages and disadvantages of the model are analyzed based on the test results. If there is overfitting (good performance in the training set but decreased performance in the test set), measures such as adding dropout layers and data enhancement can be taken; if there is underfitting (poor performance in both the training set and the test set), consider increasing the complexity of the model (such as increasing the number of layers, etc.) or adjusting the training parameters (such as increasing the learning rate, extending the number of training rounds, etc.), adjust the model according to the analysis results, retrain and test, and repeat this process until the model achieves satisfactory performance indicators on the test set. The model obtained at this time is the second recognition model, which can be used in subsequent tasks such as water level monitoring, and work in conjunction with other models (such as the first recognition model) to improve the accuracy and reliability of water level monitoring.

[0039] Step S500, deploy the yolov8 target detection algorithm and ppLiteSeg semantic segmentation algorithm to the web management platform, and through the web management platform interface, draw warning lines, configure model parameters and select the E-shaped water gauge mark. Specifically, first prepare the operating environment on the server where the Web management platform is located, including installing the operating system, configuring the network and software dependencies. Package the trained yolov8 target detection model and ppLiteSeg semantic segmentation model and upload them to the server. Tools such as Docker can be used to create container images to ensure portability, and then configure the Web application on the server to load and run the model, write server-side code to create a RESTful API and specify the model loading path and related parameters, and reasonably allocate server resources. On the Web management platform interface, users can enter the water level monitoring function module to draw warning lines. According to the actual water level safety requirements and the scale range of the E-shaped water gauge, they can use the mouse or touch screen to determine the position, set the color and thickness, and add annotations. They can also configure model parameters, such as the confidence threshold and non-maximum suppression threshold of yolov8 and the segmentation resolution and pixel classification threshold of ppLiteSeg. At the same time, they can select the E-shaped water gauge logo in the image display area, confirm the selection and mark it by clicking or touching the mouse, associate it with the monitoring process, and set the priority and add notes. Through these operations, the front-end settings and configurations of the water level monitoring and early warning system are realized.

[0040] Step S600, according to the recognition results of the first recognition model and the second recognition model, the water level abnormality is judged. If there is a water level abnormality, the alarm information is uploaded to the web management platform, and the alarm information is issued by sound and light. Specifically, the recognition results are first obtained from the deployed first recognition model (yolov8 target detection algorithm) and the second recognition model (ppLiteSeg semantic segmentation algorithm) and sorted and analyzed, such as analyzing the position change and category information of the E-shaped water gauge in the first recognition model and the proportion of pixels flooded by water in the second recognition model. Then, the water level abnormality judgment standard is set according to actual needs, and the factors such as the position change of the E-shaped water gauge, the degree of flooding, and the speed of water level change are comprehensively considered. The results of multiple factors can be judged by using logical judgment or weighted average. When it is judged that the water level is abnormal, the system automatically uploads the alarm information to the web management platform, including the time, location, specific situation and possible cause analysis of the abnormality, etc., and sends it to the server through the network communication protocol for storage and display on the platform interface. At the same time, the sound and light alarm device is triggered, and the device installed at the monitoring site or control center emits a loud alarm and eye-catching light. The sound volume and frequency, light intensity and flashing frequency can be adjusted according to actual conditions to effectively realize the water level monitoring and early warning function and ensure the safety of water conservancy facilities and the surrounding environment.

[0041] The embodiment of the present application uses the collection of E-shaped water gauge pictures to construct a data set, performs initialization processing and divides it into training set, validation set and test set. The first and second recognition models are constructed using the yolov8 target detection algorithm and the ppLiteSeg semantic segmentation algorithm respectively and machine learning is performed. The two algorithms are deployed to the web management platform, warning lines are drawn, parameters are configured and logos are selected. The water level is judged to be abnormal based on the results of the two models. If it is abnormal, the alarm information is uploaded and the sound and light alarm is sounded, achieving the technical effect of improving the accuracy, stability and comprehensiveness of water level monitoring through timely and effective water level abnormality alarm.

[0042] The above specific implementation manner does not constitute a limitation to the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the protection scope of the present application. In some cases, the actions or steps recorded in the present application can be performed in an order different from that in the embodiment and can still achieve the desired results. In addition, the process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. A water level monitoring and early warning method combining yolov8 and sam, characterized in that: The method comprises: Collect E-shaped water gauge images of different standards and build an E-shaped detection dataset; Initialize the E-word detection data set and divide it into a training set, a validation set, and a test set; Use the yolov8 target detection algorithm to build a first recognition model, and use the training set, validation set, and test set to perform machine learning; Use the ppLiteSeg semantic segmentation algorithm to build a second recognition model, and perform machine learning on the training set, validation set, and test set; Deploy the yolov8 target detection algorithm and ppLiteSeg semantic segmentation algorithm to the web management platform, and draw warning lines, configure model parameters and select the E-shaped water gauge mark through the web management platform interface; The water level abnormality is judged based on the recognition results of the first recognition model and the second recognition model. If there is a water level abnormality, the alarm information is uploaded to the web management platform and the alarm information is issued by sound and light.

2. The method according to claim 1, characterized in that Collect E-shaped water gauge images of different standards and construct an E-shaped detection data set. The method includes: Based on the E-shaped water gauge pictures of different standards, the first E-shaped standard water gauge picture is randomly selected, and the E-shaped water gauges at different angles and different lighting conditions are simulated; At the same time, data is collected in the form of RGB to obtain the E-word detection data subset corresponding to the first E-word standard water gauge image; Based on E-shaped water gauge images of different standards, data collection is performed in combination with data simulation to obtain the E-shaped detection data set.

3. The method according to claim 2, characterized in that Initializing the E-word detection data set, the method comprising: Performing cleaning processing on the E-word detection data set; Use labelImg software to mark the detection frame of the E-shaped water ruler; Use the sam split everything algorithm to segment the E-shaped water ruler.

4. The method according to claim 1, characterized in that The first recognition model is constructed using the yolov8 target detection algorithm, and the training set, the validation set, and the test set are used for machine learning, the method comprising: Performing a data enhancement operation on the E-word detection data set to obtain an expanded data set; Build the operating environment of the yolov8 target detection algorithm, and use the model architecture associated with the yolov8 target detection algorithm to perform model training at the first preset resolution; After the model training is completed, the effect of the first model is tested and gradually optimized to obtain the first recognition model.

5. The method according to claim 4, characterized in that The second recognition model is constructed using the ppLiteSeg semantic segmentation algorithm, and the training set, the validation set, and the test set are used for machine learning, and the method includes: Build the ppLiteSeg semantic segmentation algorithm operating environment, and use the model architecture associated with the ppLiteSeg semantic segmentation algorithm to perform model training at the second preset resolution; After the model training is completed, the effect of the second model is tested and gradually optimized to obtain the second recognition model.

6. The method according to claim 2, characterized in that Data is collected in the form of RGB to obtain an E-word detection data subset corresponding to the first E-word standard water gauge image, and the method further includes: According to the actual situation of the target monitoring waters, the recognition area is centered when installing the RGB sensor, and the data is transmitted synchronously with the device through the network cable; Deploy the trained first recognition model and the second recognition model to the web management platform; Obtain an RGB data source, and input it into the first recognition model and the second recognition model respectively, to obtain a first recognition result and a second recognition result; The first recognition result and the second recognition result are fused.

7. The method according to claim 6, characterized in that The method comprises: Calculate the fusion weight of the first recognition model and the fusion weight of the second recognition model through the score of the first recognition model and the score of the second recognition model; Obtaining a fusion processing result through the fusion weight of the first recognition model and the first recognition result, and the fusion weight of the second recognition model and the second recognition result; The water level abnormality is judged by the fusion processing result. If the water level abnormality is judged, it is inquired whether to upload the alarm information to the cloud platform; If the answer to the query is yes, the abnormal water level signal will be reported to the cloud platform.

8. The method according to claim 7, characterized in that The method comprises: Based on the fusion processing result, it is determined whether to issue an alarm message in an audible or visual manner.