Water level real-time prediction method, system, electronic device and storage medium
By constructing a water level monitoring system based on residual neural networks and long short-term memory networks, the problems of insufficient accuracy and reliability of traditional equipment have been solved, enabling precise monitoring and prediction of water levels and improving the level of intelligence in flood control work.
Patent Information
- Application Number
- CN202411665905.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2026-01-20
- Estimated Expiration
- 2044-11-20
AI Technical Summary
Traditional flood control monitoring equipment suffers from low accuracy, high failure rate, and limited service life, resulting in large errors in monitoring data, high equipment maintenance costs, and difficulty in meeting long-term stable monitoring needs.
A water level monitoring model based on residual neural networks is used for feature extraction, combined with a long short-term memory network for water level prediction. High-definition cameras are used to collect water level images and perform preprocessing. Deep learning algorithms are then used to achieve accurate analysis and prediction of water levels.
It improved the accuracy and real-time performance of water level monitoring, reduced equipment failure rate and operating costs, provided scientific support for flood control decision-making, and reduced the impact of floods.
Smart Images

Figure CN119540770B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of smart city construction and information technology, and particularly relates to a water level real-time prediction method and system, an electronic device and a storage medium. BACKGROUND
[0002] In the process of smart city construction, the flood control system as an important part of urban infrastructure, its accuracy and efficiency are directly related to the city's flood control capacity and the safety of residents' life and property. Traditional flood control monitoring equipment, such as water level gauge, flow meter, etc., can realize real-time monitoring of water level to some extent, but has many limitations.
[0003] The accuracy of traditional monitoring equipment is affected by many factors, such as environmental interference, equipment aging, etc., resulting in errors in monitoring data, which is difficult to accurately reflect the actual water level. This not only affects the accuracy of flood control decision-making, but also may cause safety hazards to the city. The failure rate of traditional monitoring equipment is high, especially in bad weather conditions, the equipment is easy to be damaged or fail, resulting in interruption or distortion of monitoring data. This not only increases the maintenance cost, but also may delay the development of flood control work. The service life of traditional monitoring equipment is limited, as the use time increases, the performance of the equipment gradually decreases, which cannot meet the long-term stable monitoring demand. This requires the city management department to continuously invest funds for equipment updating and replacement, increasing the operation cost. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a water level real-time prediction method, system, electronic device and storage medium, which can solve the problems of low accuracy, high failure rate and limited service life of traditional flood control monitoring equipment.
[0005] In a first aspect, the embodiments of the present application provide a water level real-time prediction method, comprising:
[0006] Collecting a water level image of a monitoring area, and pre-processing the water level image to obtain a target water level image;
[0007] Using a pre-constructed water level monitoring model to extract features of the target water level image, obtaining feature data corresponding to the target water level data, and determining real-time information of the current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network;
[0008] Inputting time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model, so that the water level prediction model predicts future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network.
[0009] Optionally, the construction process of the water level monitoring model comprises:
[0010] Collect and label the water level image dataset, normalize the water level image dataset, and divide the normalized water level image dataset into training set images, validation set images and test set images;
[0011] Load the pre-trained residual neural network and change the number of fully connected layers to two to adapt to the output requirements of the water level classification task;
[0012] Input the training set images into the residual neural network, perform forward propagation to calculate the prediction results, use the loss function to calculate the difference between the prediction results and the true labels, and calculate the gradient;
[0013] The gradient is propagated back to the residual neural network through the back propagation algorithm, and the parameters are updated. At the end of each training round, the performance of the water level monitoring model is evaluated using the validation set images, and the initial water level monitoring model that meets the requirements is recorded.
[0014] After the training is completed, the performance of the initial water level monitoring model is evaluated using the test set images, and the target water level monitoring model is obtained.
[0015] The architecture of the water level monitoring model comprises: an input layer, a convolutional layer, a pooling layer, a residual block and a fully connected layer.
[0016] Optionally, the process of propagating the gradient back to the residual neural network through the back propagation algorithm and updating the parameters comprises:
[0017] The loss function is used to calculate the error between the predicted value of the water level monitoring model and the true label to guide the back propagation process.
[0018] The partial derivative of the loss function with respect to the output layer activation value is calculated to obtain the gradient of the output layer.
[0019] Using the chain rule, the gradient of the output layer is propagated back to the hidden layer, and the gradient of the hidden layer is calculated.
[0020] According to the gradient of the hidden layer, the gradients of the weights and biases in the residual neural network are calculated, and the weights and biases are updated according to the gradient descent method.
[0021] Optionally, the gradient descent method update formula is:
[0022]
[0023] In the formula, represents the parameter value at time t, represents the parameter value at time t+1, represents the learning rate, loss function at the gradient.
[0024] Optionally, the loss function of the water level prediction model is as follows:
[0025]
[0026] wherein n represents the number of samples, represents the actual observation value of the i-th sample; represents the predicted value of the i-th sample.
[0027] Optionally, time series data corresponding to real-time information of the current water level is input into a pre-trained water level prediction model, so that the water level prediction model predicts future water level changes, including:
[0028] The time series data corresponding to the real-time information of the current water level is input into an input layer of the water level prediction model, and the output of the input layer is input into a short-term time memory network layer in the water level prediction model, to obtain an output of the short-term time memory network layer;
[0029] The output of the short-term time memory network layer is input into a long-term time memory network layer in the water level prediction model, to obtain an output of the long-term time memory network layer;
[0030] The output of the long-term time memory network layer is input into a prediction layer in the water level prediction model, to output a water level prediction result at a series of time nodes, and to determine a trend and a rule of water level changes based on the water level prediction result.
[0031] In a second aspect, the embodiments of the present application further provide a water level real-time prediction system, including:
[0032] A data acquisition unit is configured to acquire a water level image of a monitored area, and to pre-process the water level image to obtain a target water level image;
[0033] A feature extraction unit is configured to perform feature extraction on the target water level image by using a pre-constructed water level monitoring model, to obtain feature data corresponding to target water level data, and to determine real-time information of a current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network;
[0034] A water level prediction unit is configured to input time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model, so that the water level prediction model predicts future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network.
[0035] Optionally, the water level prediction unit is specifically configured to:
[0036] input the time sequence data corresponding to the real-time information of the current water level into an input layer of a water level prediction model, and input an output of the input layer into a short-term time memory network layer in the water level prediction model to obtain an output of the short-term time memory network layer;
[0037] input the output of the short-term time memory network layer into a long-term time memory network layer in the water level prediction model to obtain an output of the long-term time memory network layer;
[0038] input the output of the long-term time memory network layer into a prediction layer in the water level prediction model, output a water level prediction result under a series of time nodes, and determine a trend and a rule of water level change based on the water level prediction result.
[0039] In a third aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the water level real-time prediction method when executing the program.
[0040] In a fourth aspect, a storage medium is provided, having a computer program stored thereon, and the computer program implements the steps of the water level real-time prediction method when executed by a processor.
[0041] As can be seen from the above technical solutions, the present application has the following advantages:
[0042] The water level real-time prediction method, system, electronic device, and storage medium provided by the present application combine the powerful image processing capability of ResNet and the analysis capability of LSTM on time sequence data, realize accurate monitoring and accurate prediction of water level height, provide strong support for flood control and disaster reduction, water resource management, and other fields, and have high scalability and flexibility, and can be applicable to water level monitoring and prediction requirements in different scenarios. BRIEF DESCRIPTION OF DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed to be used in the description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0044] Figure 1 A flowchart of a water level real-time prediction method provided by an embodiment of the present application;
[0045] Figure 2 A construction process schematic diagram of a water level monitoring model provided by an embodiment of the present application;
[0046] Figure 3A flow chart of a water level prediction model provided by an embodiment of the present application for water level prediction;
[0047] Figure 4 A detailed flow chart of a water level real-time prediction method provided by an embodiment of the present application;
[0048] Figure 5 An experimental result data comparison chart provided by an embodiment of the present application;
[0049] Figure 6 A structural schematic diagram of a water level real-time prediction system provided by an embodiment of the present application;
[0050] Figure 7 A hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0051] Various embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. The present disclosure can have various embodiments, and adjustments and changes can be made therein. However, it should be understood that there is no intention to limit various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to encompass all adjustments, equivalents and / or alternatives falling within the spirit and scope of various embodiments of the present disclosure.
[0052] Hereinafter, the term "include" or "may include" used in various embodiments of the present disclosure indicates the presence of the disclosed functions or operations, and does not limit the addition of one or more functions or operations. In addition, as used in various embodiments of the present disclosure, the terms "include", "have" and their cognates merely mean to indicate the presence of a specific feature, number, step, operation or combination of the foregoing, and should not be understood as first excluding the presence or possibility of addition of one or more other features, numbers, steps, operations or combinations of the foregoing.
[0053] In various embodiments of the present disclosure, the expression "or" or "at least one of A or / and B" includes any combination of the listed terms or all combinations thereof. For example, the expression "A or B" or "at least one of A or / and B" can include A, can include B, or can include both A and B.
[0054] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0055] ReferenceFigure 1 Fig. 1 shows a flowchart of a water level real-time prediction method in an embodiment, including the following execution steps:
[0056] Step 100: Collect the water level image of the monitoring area, and pre-process the water level image to obtain the target water level image.
[0057] Specifically, a high-definition network camera or other image acquisition device is used to capture the water level of the monitoring area, ensuring that the image is clear, complete, and contains sufficient water level information. The captured color water level image is converted to a grayscale image, the grayscale image is filtered to remove noise and blur components in the image, and the filtered image is enhanced to improve the contrast and clarity of the image. If the captured image has geometric distortion, such as tilt, distortion, etc., geometric correction is performed by rotating, scaling, translating, etc. to transform the image into a standard shape for subsequent processing and analysis.
[0058] For example, when filtering the grayscale image, the filtering method that can be used includes mean filtering, median filtering, or Gaussian filtering. For image enhancement after filtering, the image enhancement method that can be used includes histogram equalization or contrast stretching.
[0059] Step 101: Using a pre-constructed water level monitoring model to extract features from the target water level image, obtaining feature data corresponding to the target water level data, and determining the real-time information of the current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network.
[0060] In an embodiment of the present application, based on the construction process of the water level monitoring model, a possible embodiment will be given below to non-restrictively describe the specific implementation scheme, referring to Figure 2 As shown, including the following execution steps:
[0061] S1: Collect and label the water level image dataset, and normalize the water level image dataset, and divide the normalized water level image dataset into training set images, validation set images and test set images.
[0062] For example, an automatic tool is used to mark the position of the water level line or the water level height in the image to obtain the labeled water level image dataset.
[0063] S2: Load the pre-trained residual neural network, and change the number of fully connected layers to two to adapt to the output requirements of the water level classification task.
[0064] S3: input the training set image into the residual neural network, perform forward propagation to calculate the prediction result, use the loss function to calculate the difference between the prediction result and the true label, and calculate the gradient.
[0065] S4: propagate the gradient back to the residual neural network through the back propagation algorithm, and update the parameters, at the end of each training round, use the validation set image to evaluate the performance of the water level monitoring model, and record the initial water level monitoring model that meets the requirements.
[0066] Specifically, when step S4 is executed, the following steps can be specifically executed:
[0067] S40: use the loss function to calculate the error between the water level monitoring model prediction value and the true label to guide the back propagation process.
[0068] For example, the loss function formula used in the embodiment is as follows:
[0069]
[0070] In the formula, n is the number of samples, is the prediction value of the model for the ith sample, and y(i) is the actual value of the ith sample.
[0071] S41: calculate the partial derivative of the loss function with respect to the output layer activation value to obtain the gradient of the output layer.
[0072] S42: use the chain rule to propagate the gradient of the output layer back to the hidden layer, and calculate the gradient of the hidden layer.
[0073] S43: according to the gradient of the hidden layer, calculate the gradient of the weights and biases in the residual neural network, and update the weights and biases according to the gradient descent method.
[0074] Specifically, the gradient descent method update formula is:
[0075]
[0076] In the formula, represents the parameter value at time t, represents the parameter value at time t+1, represents the learning rate, represents the loss function at the gradient.
[0077] S5: after the training is completed, use the test set image to evaluate the performance of the initial water level monitoring model, and obtain the target water level monitoring model. The architecture of the water level monitoring model includes: input layer, convolutional layer, pooling layer, residual block and fully connected layer.
[0078] In some embodiments, the ResNet-based water level monitoring model selects the ResNet architecture of ResNet-18. The ResNet-18 architecture mainly consists of the following key parts: an input layer that usually receives fixed-size image inputs; a convolutional layer that includes 1 7X7 convolutional layer for extracting local features in the image; a pooling layer that is used to reduce the resolution of the feature map, reduce the amount of calculation, and extract more abstract features; residual blocks to alleviate the gradient vanishing problem in deep network training. Each residual block contains two convolutional layers, and a shortcut connection that directly adds the input to the output. A fully connected layer: at the last part of the network, there is usually a fully connected layer to map the extracted features to the final output.
[0079] Step 102: input the time series data corresponding to the real-time information of the current water level into the pre-trained water level prediction model to make the water level prediction model predict the future water level change, wherein the water level prediction model is constructed based on a long short-term memory network.
[0080] Specifically, the loss function of the water level prediction model is as follows:
[0081]
[0082] In the formula, n represents the number of samples, represents the actual observation value of the ith sample; represents the predicted value of the ith sample.
[0083] In some implementations, the following steps are performed before step 102: Designing a water level prediction model based on a Long Short-Term Memory (LSTM) network and combining it with the water level information sequence generated by ResNet as input data is a complex but effective process. The training and optimization process of the LSTM model is described in detail below: Loss Function Selection: The Mean Absolute Error (MAE) is selected as the loss function to measure the difference between the model's predicted result and the actual water level value. Optimizer Selection: SGD is selected as the optimizer to update the model's weights and biases. Training Process: 1) Input the training set data into the LSTM model and perform forward propagation to calculate the prediction result. 2) Use the loss function to calculate the difference between the predicted result and the actual water level value, and calculate the gradient. 3) Propagate the gradient back to the network using the backpropagation algorithm and update the model's weights and biases. 4) Repeat the above process until a preset number of training rounds is reached or other stopping conditions are met. The number of neurons, layers, and learning rate of the LSTM model are adjusted using a grid search method to find the optimal model configuration. Regularization methods: Use L1 or L2 regularization to prevent overfitting. Regularization can be achieved by adding a regularization term to the loss function. Data augmentation: Perform data augmentation on water level information sequences and historical water level data, increasing data diversity and model robustness by adding noise and time shifting. Early stopping: During training, stop training if the loss on the validation set stops decreasing or begins to increase to avoid overfitting.
[0084] Specifically, the SGD function is as follows:
[0085]
[0086] In the formula, Indicates model parameters; Indicates the learning rate; This represents the loss function, which measures the model's performance on samples. Prediction error on; This indicates the loss function with respect to the parameters. The gradient; and Let represent the features and label of the i-th sample, respectively.
[0087] In one specific implementation, see [reference] Figure 3 As shown, when executing step 102, the following steps can be specifically performed:
[0088] S1020: Input the real-time information of the current water level, historical water level data, rainfall data, water level-flow relationship data, topographic data, and meteorological data corresponding to the time series data into the input layer of the water level prediction model, and input the output of the input layer into the short-term time memory network layer in the water level prediction model to obtain the output of the short-term time memory network layer.
[0089] The historical water level data is the basis for predicting future water levels. By analyzing past water level changes, the rules and trends of water level changes can be understood, and future water levels can be predicted. These data are usually obtained from long-term water level monitoring stations and record water level heights at different time periods. Rainfall is one of the main factors that cause water levels to rise, so accurate rainfall data are crucial for predicting water levels. These data can be collected in real time by rain sensors, rain gauges, and other devices, or obtained from meteorological department forecasts and observations. The water level-flow relationship refers to the correspondence between water levels and river flow. By analyzing this relationship, the flow of a river at different water levels can be understood, and future changes in water levels can be predicted. These data are usually obtained through water level and flow measurement devices at hydrological monitoring stations. Topography has an important influence on water level changes. For example, the direction of a river, the shape of a riverbed, and the slope of the riverbanks all affect water level changes. Therefore, when predicting water levels, topographic factors need to be considered, and relevant topographic data need to be obtained. Meteorological conditions such as wind speed, wind direction, and air pressure also affect water level changes. For example, strong winds can cause water surface fluctuations, affecting water level measurements; changes in air pressure can affect the density and volume of water, which in turn affects water levels. Therefore, meteorological factors need to be considered when predicting water levels.
[0090] S1021: Input the output of the short-term time memory network layer into the long-term time memory network layer in the water level prediction model to obtain the output of the long-term time memory network layer.
[0091] S1022: Input the output of the long-term time memory network layer into the prediction layer in the water level prediction model, output the water level prediction results at the series of time nodes, and determine the trend and rules of water level changes based on the water level prediction results.
[0092] In this embodiment, neural network technology is used to address the shortcomings of traditional flood prevention monitoring equipment in terms of accuracy, reliability, and real-time performance. The goal is to use deep learning algorithms to accurately analyze and predict water level data, ensuring the accuracy and real-time performance of water level monitoring data. It also provides scientific and reasonable decision support for flood prevention work, allowing for the development of measures to prevent the impact of floods on cities and improve the intelligent level of city management.
[0093] Further, the real-time monitored water level information and the prediction results of future water level changes are displayed to the user in a visual form, such as water level change curve graphs, prediction trend graphs, etc. According to the prediction results, decision support for flood control work is provided, such as warning level division, response measure suggestion, etc. With the passage of time and the accumulation of data, the water level monitoring model and the water level prediction model are periodically optimized and updated to improve the accuracy and robustness of the model. The performance of the monitoring model is monitored, and abnormal situations are promptly investigated and handled.
[0094] In an embodiment, Figure 4 For a detailed flowchart of the water level real-time prediction method provided by the embodiment of the present application, the embodiment is further optimized and expanded on the basis of the above-mentioned embodiments. First, data collection and preprocessing are performed, ResNet model training is performed, model parameters are adjusted to obtain an optimal model, water level image features are extracted using the optimal model, a water level information time series is obtained, an LSTM model is trained using the water level information time series and historical water level data, an optimal prediction model is obtained through model parameter adjustment and optimization, and the future water level change trend is predicted based on the model.
[0095] It should be understood that the size of the serial number of each step in the above-mentioned embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0096] In a specific embodiment, in order to verify the effectiveness of the ResNet model used in this paper in the field of reservoir water level monitoring and the feasibility in practical application, a large reservoir, a medium-sized reservoir and a small reservoir were selected as experimental objects from May 1, 2024 to May 10, 2024 to ensure the comprehensiveness and representativeness of the experimental results. During the experiment, the water level of the three reservoirs was monitored in real time using high-precision water level gauges, and the ResNet model was run at the same time to predict the water level. By comparing and analyzing the actual monitoring data of the water level gauge and the monitoring data of the ResNet model, the accuracy and reliability of the ResNet model in water level monitoring can be evaluated, and the experimental result data comparison is shown in the following table 2. Figure 5
[0097] The water level prediction model based on the long short-term memory network (LSTM) takes the monitored water level information sequence generated by the ResNet as input data, and combines historical water level data to train the LSTM model. The future water level change is predicted, and the monitoring data of the water level gauge and the prediction data are compared in detail as shown in Table 1.
[0098] Table 1: Comparison of monitoring data and LSTM model prediction data
[0099]
[0100] As Figure 6 shown in the following, the water level real-time prediction system provided by the embodiments of the present disclosure is the same inventive concept as the water level real-time prediction method described above, and the details not described in the embodiments of the water level real-time prediction system can be referred to the embodiments of the water level real-time prediction method.
[0101] The data acquisition unit 60 is configured to acquire a water level image of a monitoring area, and pre-process the water level image to obtain a target water level image.
[0102] The feature extraction unit 61 is configured to extract features of the target water level image by using a pre-constructed water level monitoring model, to obtain feature data corresponding to the target water level data, and determine real-time information of a current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network.
[0103] The water level prediction unit 62 is configured to input time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model, so that the water level prediction model predicts future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network.
[0104] In some embodiments, the water level prediction unit 62 is specifically configured to:
[0105] input the time series data corresponding to the real-time information of the current water level into an input layer of the water level prediction model, and input an output of the input layer into a short-term time memory network layer in the water level prediction model, to obtain an output of the short-term time memory network layer;
[0106] input the output of the short-term time memory network layer into a long-term time memory network layer in the water level prediction model, to obtain an output of the long-term time memory network layer;
[0107] input the output of the long-term time memory network layer into a prediction layer in the water level prediction model, to output water level prediction results at a series of time nodes, and determine a trend and a rule of water level changes based on the water level prediction results.
[0108] Figure 7 is a hardware structure schematic diagram of an electronic device for implementing various embodiments of the present disclosure.
[0109] The water level real-time prediction method provided by the embodiments of the present application can be applied to an electronic device. Those skilled in the art can understand that the structure of the electronic device involved in the embodiments of the present application does not constitute a limitation on the electronic device, and the electronic device can include more or fewer components than the illustration, or combine certain components, or different component arrangements. In the embodiments of the present application, the electronic device includes but is not limited to a laptop computer, a desktop computer, a workstation, a personal digital assistant, a server, a blade server, a mainframe computer and other suitable computers. The electronic device can also represent various forms of mobile devices, such as a personal digital processor, a cellular phone, a smart phone, a wearable device and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described and / or claimed herein.
[0110] The electronic device can include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charge management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, a key, a camera, a display screen, and a SIM card interface, etc.
[0111] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device can include more or fewer components than the illustration, or combine certain components, or split certain components, or different component arrangements. The illustrated components can be implemented in hardware, software or a combination of software and hardware.
[0112] The processor can include one or more processing units, such as: the processor can include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices, or can be integrated in one or more processors.
[0113] The processor can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0114] The processor can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. The memory can save instructions or data that the processor has just used or repeatedly uses. If the processor needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor, thereby improving system efficiency.
[0115] The external memory interface can be used to connect an external memory card, such as a MicroSD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor through the external memory interface to realize data storage functions. For example, music, video, and other files are saved in the external memory card.
[0116] The internal memory can be used to store computer executable program codes, which include instructions. The processor executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory. The internal memory can include a program storage area and a data storage area. The internal memory can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0117] The wireless communication function of the electronic device can be realized through an antenna, a wireless communication module, a modem processor, a baseband processor, etc.
[0118] The wireless communication module can provide a wireless communication solution including wireless local area network (WLAN) (such as a wireless fidelity (Wi-Fi) network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. applied to the electronic device.
[0119] The electronic device can realize audio functions, etc. through an audio module, a speaker, a receiver, a microphone, an earphone interface, and an application processor, etc.
[0120] The electronic device can implement the photographing function through an ISP, a camera, a video codec, a GPU, a display screen, and an application processor.
[0121] The electronic device can implement the display function through a GPU, a display screen, and an application processor.
[0122] The GPU is a microprocessor for image processing, connected to the display screen and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor can include one or more GPUs that execute program instructions to generate or change display information.
[0123] The display screen is used to display images, videos, and the like. The display screen includes a display panel.
[0124] The above electronic device implements the technical solution of the water level real-time prediction method subject name of the present application, achieving accurate monitoring and accurate prediction of water level height, providing strong support for flood control and disaster reduction, water resource management, and the like. It has high scalability and flexibility, and can be applied to water level monitoring and prediction requirements in different scenarios.
[0125] In the storage medium provided in the present application, a program product capable of implementing the water level real-time prediction method is stored.
[0126] The water level real-time prediction method comprises: collecting a water level image of a monitored area, and pre-processing the water level image to obtain a target water level image; using a pre-constructed water level monitoring model to extract features from the target water level image to obtain feature data corresponding to target water level data, and determining real-time information of a current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network; inputting time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model to enable the water level prediction model to predict future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network.
[0127] In some possible implementations, the water level real-time prediction method subject name of the present disclosure can be implemented in the form of a program product, which includes program code for causing a terminal device to perform the steps described in the above “Exemplary Method” section of the present specification according to various exemplary embodiments of the present disclosure when the program product is run on the terminal device.
[0128] The storage medium of the present disclosure can employ any combination of one or more computer-readable media. The computer-readable media can be a computer- readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0129] The foregoing description of the disclosed embodiments enables a person skilled in the art to implement or use the invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the invention. Accordingly, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A water level real-time prediction method, characterized in that, The method comprises the following steps: Collecting water level images of a monitoring area and preprocessing the water level images to obtain target water level images; Using a pre-constructed water level monitoring model to extract features from the target water level images to obtain feature data corresponding to the target water level data, and determining real-time information of a current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network; Inputting time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model to enable the water level prediction model to predict future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network; The construction process of the water level monitoring model comprises: Collecting and labeling a water level image dataset, normalizing the water level image dataset, and dividing the normalized water level image dataset into training set images, validation set images, and test set images; Loading a pre-trained residual neural network and changing the number of fully connected layers to two to adapt to the output requirements of the water level classification task; Inputting the training set images into the residual neural network to calculate the prediction results through forward propagation, calculating the difference between the prediction results and the true labels using a loss function, and calculating the gradient; Propagating the gradient back to the residual neural network through a backpropagation algorithm and updating the parameters, and at the end of each training round, evaluating the performance of the water level monitoring model using the validation set images and recording the initial water level monitoring model that meets the requirements; After the training is completed, the performance of the initial water level monitoring model is evaluated using the test set images to obtain a target water level monitoring model; The architecture of the water level monitoring model comprises an input layer, a convolutional layer, a pooling layer, a residual block, and a fully connected layer; The process of propagating the gradient back to the residual neural network through the backpropagation algorithm and updating the parameters comprises: Using a loss function to calculate the error between the predicted value of the water level monitoring model and the true label to guide the backpropagation process; Calculating the partial derivative of the loss function with respect to the output layer activation value to obtain the gradient of the output layer; Using the chain rule to propagate the gradient of the output layer back to the hidden layer and calculating the gradient of the hidden layer; According to the gradient of the hidden layer, calculating the gradient of the weights and biases in the residual neural network, and updating the weights and biases according to the gradient descent method.
2. The water level real-time prediction method according to claim 1, characterized in that, The gradient descent method update formula is: wherein denotes the parameter value at time t, denotes the parameter value at time t+1, denotes the learning rate, denotes the loss function the gradient at .
3. The real-time water level prediction method of claim 1, wherein, The loss function of the water level prediction model is as follows: where n represents the number of samples, represents the actual observation value of the i-th sample; represents the predicted value of the i-th sample.
4. The real-time water level prediction method of claim 1, wherein Inputting time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model to enable the water level prediction model to predict future water level changes, comprising: Inputting time series data corresponding to the real-time information of the current water level, historical water level data, rainfall data, water level-flow relationship data, topographic data, and meteorological data into the input layer of the water level prediction model, and inputting the output of the input layer into the short-term memory network layer in the water level prediction model to obtain the output of the short-term memory network layer; Inputting the output of the short-term memory network layer into the long-term memory network layer in the water level prediction model to obtain the output of the long-term memory network layer; The output of the long-term time memory network layer is input into a prediction layer in the water level prediction model, and a water level prediction result at a series of time nodes is output.
5. A real-time water level prediction system characterized by, Comprise: A data acquisition unit is configured to acquire water level images of a monitoring area, and pre-process the water level images to obtain target water level images; A feature extraction unit is configured to extract features of the target water level images by using a pre-constructed water level monitoring model, to obtain feature data corresponding to target water level data, and to determine real-time information of a current water level based on the feature data, wherein the water level monitoring model is constructed based on a residual neural network; A water level prediction unit is configured to input time series data corresponding to the real-time information of the current water level into a pre-trained water level prediction model, so that the water level prediction model predicts future water level changes, wherein the water level prediction model is constructed based on a long short-term memory network; The construction process of the water level monitoring model comprises: Collect and label water level image data sets, normalize the water level image data sets, and divide the normalized water level image data sets into training set images, validation set images, and test set images; Load a pre-trained residual neural network, and change the number of fully connected layers to two to adapt to the output requirements of the water level classification task; Input the training set images into the residual neural network, perform forward propagation to calculate the prediction results, use a loss function to calculate the difference between the prediction results and the true labels, and calculate the gradient; The gradient is propagated back to the residual neural network through a back propagation algorithm, and the parameters are updated, at the end of each training round, the performance of the water level monitoring model is evaluated using the validation set images, and the initial water level monitoring model that meets the requirements is recorded; After the training is completed, the performance of the initial water level monitoring model is evaluated using the test set images, and a target water level monitoring model is obtained; The architecture of the water level monitoring model comprises: an input layer, a convolutional layer, a pooling layer, a residual block, and a fully connected layer; The process of propagating the gradient back to the residual neural network through the back propagation algorithm and updating the parameters comprises: Use a loss function to calculate the error between the predicted value of the water level monitoring model and the true label to guide the back propagation process; Calculate the partial derivative of the loss function with respect to the output layer activation value to obtain the gradient of the output layer; Use the chain rule to propagate the gradient of the output layer back to the hidden layer and calculate the gradient of the hidden layer; According to the gradient of the hidden layer, the gradients of the weights and biases in the residual neural network are calculated, and the weights and biases are updated according to the gradient descent method.
6. The real-time water level prediction system of claim 5, wherein, The water level prediction unit is specifically configured to: Input time series data corresponding to the real-time information of the current water level, historical water level data, rainfall data, water level flow relationship data, topographic data, and meteorological data into the input layer of the water level prediction model, and input the output of the input layer into the short-term time memory network layer in the water level prediction model to obtain the output of the short-term time memory network layer; Input the output of the short-term time memory network layer into the long-term time memory network layer in the water level prediction model to obtain the output of the long-term time memory network layer; The output of the long-term time memory network layer is input into a prediction layer in the water level prediction model, and a water level prediction result at a series of time nodes is output.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the steps of the water level real-time prediction method according to any one of claims 1 to 4 when executing the program.
8. A storage medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the water level real-time prediction method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Water level monitoring method and device, electronic device and storage medium
CN109543596A
River water quality inversion method based on deep learning, electronic equipment and storage medium
CN117392564A