A real-time waterlogging warning method for urban waterlogging monitoring platform based on deep learning
By using the MobileNetV2 deep neural network model and optimization training method in the video data, combining the ternary loss function and Momentum stochastic gradient descent method, the accuracy and real-time problems of flooding recognition in the video data are solved, and efficient flooding prediction and Identify.
Patent Information
- Application Number
- CN202410466184.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-04-18
AI Technical Summary
The prior art is difficult to accurately identify the waterlogging situation from video data, and the deep learning model may be affected by interference factors, causing misjudgment, making it difficult to effectively distinguish between waterlogging and non-waterlogging situations.
Using the deep neural network model based on MobileNetV2, combined with the SGD optimizer and learning rate scheduling function, the model is optimized to improve the recognition ability of flooding features through the iterative process of the freezing and thawing training stages. .
Accurate prediction of flooding conditions is achieved, the accuracy and real-time identification of the model in video data is improved, the risks of false alarms and underreport are reduced, and it is more efficient than traditional methods and does not require complex numerical model parameters.
Smart Images

Figure CN118366096B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer vision and deep learning, and specifically relates to a real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning. Background Art
[0002] In modern society, video surveillance systems have been widely used for monitoring and security management. These systems usually include various types of cameras to capture real-time video streams as well as historical video data. However, effectively extracting useful information from these video data, such as waterlogging prediction, has always been a challenging problem. Waterlogging usually refers to the accumulation of water in a specific area due to precipitation or drainage problems. In the past, the detection of waterlogging usually relied on manual patrols or physical models based on hydrodynamics, which are costly and not real-time enough. Therefore, an automated method based on deep learning is needed to accurately identify waterlogging situations from video data in real time.
[0003] In the application of deep neural network models, the network architecture plays a key role. The choice of network architecture directly affects whether the model can effectively extract high-quality waterlogging features. Therefore, choosing a suitable network architecture becomes an important issue in waterlogging prediction. This problem involves how to design a deep neural network so that it can accurately identify waterlogging in video data.
[0004] In addition, deep learning models may be affected by some interference factors in practical applications, such as road shadows, which may cause the model to misjudge and thus lead to incorrect waterlogging predictions. Therefore, how to further improve the model to better distinguish between waterlogging and non-waterlogging situations, making the difference between the two situations more significant, is also a problem that needs to be studied in depth. Summary of the invention
[0005] The purpose of the present invention is to provide a real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning, which can accurately predict the occurrence of waterlogging events, thereby providing important waterlogging warning information to platform operators and helping users make timely decisions.
[0006] The technical solution adopted by the present invention is as follows:
[0007] A real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning, the method comprising the following steps:
[0008] S1: Obtain the camera live video stream data from the video platform;
[0009] S2: Capture images from the live video stream data of the camera to build a waterlogging recognition dataset;
[0010] S3: Create a deep neural network model based on MobileNetV2 and load the model weights;
[0011] S4: Configure the SGD optimizer and learning rate scheduling function during training to perform parameter updates and learning rate adjustments when training deep neural network models;
[0012] S5: Perform freezing phase training of the deep neural network model;
[0013] The specific steps of S5 are as follows:
[0014] S51: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training;
[0015] In S51, when the number of iterations is less than the number of preheating iterations, the learning rate gradually increases from the preheating learning rate to the initial learning rate. The specific formula is:
[0016]
[0017] Where lr is the initial learning rate, w_lr is the starting learning rate in the warm-up phase, i is the current iteration number, and w_i is the warm-up iteration number. When the iteration number is greater than or equal to the total iteration number minus the number of iterations without data enhancement, the learning rate is set to the minimum learning rate m_lr. In other cases, the learning rate is calculated using cosine annealing, which is calculated as follows:
[0018]
[0019] Among them, m_lr is the minimum learning rate, lr is the initial learning rate, i is the current iteration number, w_i is the number of warm-up iterations, t_i is the total number of iterations, and na_i is the number of iterations without data enhancement.
[0020] S52: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data;
[0021] In S52, the classification loss value is calculated by a binary cross entropy loss function, which is calculated as follows:
[0022]
[0023] in, is the probability that the model predicts that the sample is a positive class, y is the sample label, if the sample is a positive class, y = 1, otherwise it is 0; before calculating the ternary loss value, a triplet must be constructed, and the triplet is determined according to the label of the data in the batch. Assuming that a certain data in the batch is an anchor point, the data with the same label as the anchor point is a positive example, and the data with a different label from the anchor point is a negative example. The calculation method of the ternary loss is:
[0024] triLoss=max(d(a,p)-d(a,n)+margin,0)
[0025] Among them, a is the anchor point, p is the positive example, and n is the negative example; margin is an interval that forces the model to learn so that the distance between the anchor point a and the negative example n is larger in the vector space, and the distance between the anchor point a and the positive example p is smaller in the vector space; the accuracy is calculated as follows:
[0026]
[0027] Among them, TP represents the number of instances where both the true result and the predicted result are positive; FP represents the number of instances where the true result is negative but the predicted result is positive; TN represents the number of instances where both the true result and the predicted result are negative; FN represents the number of instances where the true result is positive but the predicted result is negative.
[0028] S53: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed based on the total loss value to fine-tune the model;
[0029] In S53, after obtaining the difference between the input and the true value through the loss function, the stochastic gradient descent method is used to back propagate and train the deep neural network model. The formula of stochastic gradient descent is:
[0030] p t+1 =p t -lr×dp t
[0031] Among them, p t is the model parameter after the tth iteration, lr is the learning rate, dp t For p t gradient.
[0032] Momentum is introduced in the stochastic gradient descent method. Momentum considers the direction and size of the last update each time the parameters are updated, so that the parameters gain more momentum in the gradient direction. It is combined with Nesterov Momentum, which updates the parameters slightly before calculating the gradient, then calculates the gradient, and finally uses the gradient to perform the actual parameter update. The Nesterov Momentum update formula is:
[0033] x' t =x t +m·v t-1
[0034] v t =m·v t-1 -lr·dx' t
[0035] x t+1 =x t +v t
[0036] Among them, x t is the model parameter after the tth iteration, m is the Momentum parameter, v t-1 is the gradient updated in the last iteration, lr is the learning rate, dx' t is the gradient of the model parameters after the tth iteration, x t+1 is the model parameter after the t+1th iteration.
[0037] S54: Repeat S52 and S53 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set;
[0038] S55: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results;
[0039] S56: Repeat S55 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data;
[0040] S57: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight.
[0041] S58: Repeat S51 and S57 for no less than 50 times.
[0042] S6: Perform unfreezing phase training of the deep neural network model;
[0043] The specific steps of S6 are as follows:
[0044] S61: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training;
[0045] S62: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data;
[0046] S63: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed according to the total loss value to update all network parameters of the model;
[0047] S64: Repeat S62 and S63 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set;
[0048] S65: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results;
[0049] S66: Repeat S65 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data;
[0050] S67: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight.
[0051] S68: Repeat S61 and S67 for no less than 150 times.
[0052] S7: deploy the saved optimal model parameters to the video platform;
[0053] S8: Obtain the point image of each camera through the frame fetching operation, and determine the probability of waterlogging in the point image;
[0054] S9: Based on the point images obtained in S8, the results are stored in a database to display whether waterlogging occurs on the video platform.
[0055] The technical effects achieved by the present invention are:
[0056] The present invention discloses a real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning, which extracts features from a large amount of data through multi-layer neural network learning, and these features can be used to identify complex patterns and objects; in urban waterlogging prediction, the deep learning model can learn waterlogging features under different weather conditions from historical video data, thereby achieving accurate prediction of waterlogging conditions; compared with traditional hydrodynamic models or numerical simulation methods, this method can more efficiently predict waterlogging and does not require complex calculations and a large number of numerical model parameters. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 is a schematic diagram of a flow chart of an embodiment of the present invention;
[0058] Figure 2 This is a graph showing the change in accuracy of waterlogging recognition in the verification set under continuous iterative training according to an embodiment of the present invention;
[0059] Figure 3 This is a comparison chart of the accuracy of waterlogging recognition between the model used in the embodiment of the present invention and other models on the same test set. DETAILED DESCRIPTION
[0060] In order to make the purpose and advantages of the present invention more clearly understood, the present invention is specifically described below in conjunction with embodiments. It should be understood that the following text is only used to describe one or several specific embodiments of the present invention, and does not strictly limit the scope of protection of the specific claims of the present invention.
[0061] Deep learning is a powerful machine learning technique that has been widely used in the field of computer vision. In this solution, deep learning technology is used to automate the detection and prediction of urban waterlogging. The core idea of deep learning is to extract features from large amounts of data through multi-layer neural network learning, which can be used to identify complex patterns and objects. In urban waterlogging prediction, deep learning models can learn waterlogging features under different weather conditions from historical video data, thereby achieving accurate prediction of waterlogging conditions. This method can be more efficient in waterlogging prediction than traditional hydrodynamic models or numerical simulation methods because it does not require complex calculations and a large number of numerical model parameters.
[0062] In this proposal, it is reasonable to choose MobileNetV2 as the basis of the deep neural network model. MobileNetV2 is lightweight and efficient, which makes it suitable for deployment on video platforms. The choice of this lightweight model is based on real-time and efficiency considerations, because we need to be able to quickly identify waterlogging in video streams. The architecture of MobileNetV2 is optimized to effectively extract image features, which is very suitable for urban waterlogging prediction tasks. In addition, MobileNetV2 has fewer trainable parameters, making the training process more efficient. This choice helps to ensure the real-time and performance of the waterlogging detection model on video platforms. In order to more effectively identify waterlogging, we introduced a ternary loss function to improve the feature representation ability of the model. This loss function aims to strengthen the deep learning model's learning of the difference between waterlogging features and non-waterlogging features. The application of this loss function enables the model to better distinguish between waterlogging and non-waterlogging situations. Compared with traditional loss functions, the ternary loss function has better performance in waterlogging detection tasks because it emphasizes the recognition and differentiation of waterlogging features. This enables our model to more accurately locate and predict waterlogging events in videos, reducing the risk of false positives and false negatives, thereby improving the accuracy and credibility of urban waterlogging predictions.
[0063] like Figure 1-Figure 3 As shown, a real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning is provided, and the method comprises the following steps:
[0064] S1: Obtain the camera live video stream data from the video platform;
[0065] S2: Capture images from the live video stream data of the camera to build a waterlogging recognition dataset;
[0066] S3: Create a deep neural network model based on MobileNetV2 and load the model weights;
[0067] S4: Configure the SGD optimizer and learning rate scheduling function during training to perform parameter updates and learning rate adjustments when training deep neural network models;
[0068] S5: Perform freezing phase training of the deep neural network model;
[0069] The specific steps of S5 are as follows:
[0070] S51: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training;
[0071] In S51, when the number of iterations is less than the number of preheating iterations, the learning rate gradually increases from the preheating learning rate to the initial learning rate. The specific formula is:
[0072]
[0073] Where lr is the initial learning rate, w_lr is the starting learning rate in the warm-up phase, i is the current iteration number, and w_i is the warm-up iteration number. When the iteration number is greater than or equal to the total iteration number minus the number of iterations without data enhancement, the learning rate is set to the minimum learning rate m_lr. In other cases, the learning rate is calculated using cosine annealing, which is calculated as follows:
[0074]
[0075] Among them, m_lr is the minimum learning rate, lr is the initial learning rate, i is the current iteration number, w_i is the number of warm-up iterations, t_i is the total number of iterations, and na_i is the number of iterations without data enhancement.
[0076] S52: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data;
[0077] In S52, the classification loss value is calculated by the binary cross entropy loss function, which is calculated as follows:
[0078]
[0079] in, is the probability that the model predicts that the sample is a positive class, y is the sample label, if the sample is a positive class, y = 1, otherwise it is 0; before calculating the ternary loss value, a triplet must be constructed, and the triplet is determined according to the label of the data in the batch. Assuming that a certain data in the batch is an anchor point, the data with the same label as the anchor point is a positive example, and the data with a different label from the anchor point is a negative example. The calculation method of the ternary loss is:
[0080] triLoss=max(d(a,p)-d(a,n)+margin,0)
[0081] Among them, a is the anchor point, p is the positive example, and n is the negative example; margin is an interval that forces the model to learn so that the distance between the anchor point a and the negative example n is larger in the vector space, and the distance between the anchor point a and the positive example p is smaller in the vector space; the accuracy is calculated as follows:
[0082]
[0083] Among them, TP (True Positive) represents the number of instances where both the true result and the predicted result are positive; FP (False Positive) represents the number of instances where the true result is negative but the predicted result is positive; TN (True Negative) represents the number of instances where both the true result and the predicted result are negative; FN (False Negative) represents the number of instances where the true result is positive but the predicted result is negative.
[0084] S53: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed based on the total loss value to fine-tune the model;
[0085] In S53, after obtaining the difference between the input and the true value through the loss function, the stochastic gradient descent method is used to back propagate and train the deep neural network model. The formula of stochastic gradient descent is:
[0086] p t+1 =p t -lr×dp t
[0087] Among them, p t is the model parameter after the tth iteration, lr is the learning rate, dp t For p t The standard stochastic gradient descent method may encounter some problems during training, especially in the presence of noisy or irregularly shaped loss functions. In these cases, stochastic gradient descent may suffer from oscillations or get stuck in local minima.
[0088] Momentum is introduced in the stochastic gradient descent method. Momentum considers the direction and size of the previous update each time the parameters are updated, so that the parameters gain more momentum in the gradient direction, and is combined with Nesterov Momentum, which helps the stochastic gradient descent method converge faster during training and can reduce oscillations. Although Momentum can improve the performance of the stochastic gradient descent method, it may sometimes cause some problems, such as excessive oscillations when approaching the minimum point. Before calculating the gradient, the parameters are slightly updated, and then the gradient is calculated. Finally, the gradient is used to perform the actual parameter update. This advance update method makes the algorithm more stable when approaching the minimum point and reduces the possibility of oscillation; the Nesterov Momentum update formula is:
[0089] x' t =x t +m·v t-1
[0090] v t =m·vt-1 -lr·dx' t
[0091] x t+1 =x t +v t
[0092] Among them, x t is the model parameter after the tth iteration, m is the Momentum parameter, v t-1 is the gradient updated in the last iteration, lr is the learning rate, dx' t is the gradient of the model parameters after the tth iteration, x t+1 is the model parameter after the t+1th iteration.
[0093] S54: Repeat S52 and S53 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set;
[0094] S55: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results;
[0095] S56: Repeat S55 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data;
[0096] S57: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight.
[0097] S58: Repeat S51 and S57 for no less than 50 times.
[0098] S6: Perform unfreezing phase training of the deep neural network model;
[0099] The specific steps of S6 are as follows:
[0100] S61: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training;
[0101] S62: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data;
[0102] S63: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed according to the total loss value to update all network parameters of the model;
[0103] S64: Repeat S62 and S63 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set;
[0104] S65: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results;
[0105] S66: Repeat S65 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data;
[0106] S67: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight.
[0107] S68: Repeat S61 and S67 for no less than 150 times.
[0108] S7: deploy the saved optimal model parameters to the video platform;
[0109] S8: Obtain the point image of each camera through the frame operation, and determine the probability of waterlogging in the point image; because the frame operation may fail during frame acquisition, the camera point image may also be distorted. In addition, it is too hasty to identify a single image to determine whether waterlogging has occurred. Therefore, after conducting a control variable experiment on the number of camera point images, 36 images were selected at each camera point to determine whether waterlogging has occurred. Specifically, for a camera point, the model will output the probability of whether these images have waterlogging. When the probability of more than half of the images is greater than 0.8, it is determined that waterlogging has occurred at this camera point.
[0110] S9: Based on the point images obtained in S8, the results are stored in a database to display whether waterlogging occurs on the video platform.
[0111] like Figure 2As shown in the figure, the accuracy rate of waterlogging recognition in the verification set of the present invention changes under continuous iterative training. It can be seen that in the first 50 rounds of model freezing training, the feature extraction network remains unchanged, and the model is fine-tuned. As the number of training rounds increases, the recognition accuracy fluctuates around 94%, and the performance has no obvious improvement. In the thawing training stage after 50 rounds, the feature extraction network changes. As the number of training rounds increases, the recognition accuracy is significantly improved, the performance is enhanced, and the recognition rate reaches a peak around 100 rounds and tends to be flat.
[0112] like Figure 3 As shown in FIG. 1 , the optimization model used in the present invention and other models are compared in terms of accuracy of waterlogging recognition in the same test set. It can be seen that the accuracy of the model used in our invention is significantly higher than that of the general model, and the present invention has significant advantages in urban waterlogging monitoring applications.
[0113] The above is only a preferred embodiment of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications should also be considered as the protection scope of the present invention. The structures, devices and operating methods not specifically described and explained in the present invention shall be implemented according to the conventional means in the art unless otherwise specified and limited.
Claims
1. A real-time waterlogging warning method for an urban waterlogging monitoring platform based on deep learning, characterized in that: The method comprises the following steps: S1: Obtain the camera live video stream data from the video platform; S2: Capture images from the live video stream data of the camera to build a waterlogging recognition dataset; S3: Create a deep neural network model based on MobileNetV2 and load the model weights; S4: Configure the SGD optimizer and learning rate scheduling function during training; S5: Perform freezing phase training of the deep neural network model; The specific steps of S5 are as follows: S51: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training; In S51, when the number of iterations is less than the number of preheating iterations, the learning rate gradually increases from the preheating learning rate to the initial learning rate. The specific formula is: Where lr is the initial learning rate, w_lr is the starting learning rate in the warm-up phase, i is the current iteration number, and w_i is the warm-up iteration number. When the iteration number is greater than or equal to the total iteration number minus the number of iterations without data enhancement, the learning rate is set to the minimum learning rate m_lr. In other cases, the learning rate is calculated using cosine annealing, which is calculated as follows: Among them, m_lr is the minimum learning rate, lr is the initial learning rate, i is the current iteration number, w_i is the warm-up iteration number, t_i is the total iteration number, and na_i is the number of iterations without data enhancement; S52: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data; In S52, the classification loss value is calculated by a binary cross entropy loss function, which is calculated as follows: in, is the probability that the model predicts that the sample is a positive class, y is the sample label, if the sample is a positive class, y = 1, otherwise it is 0; before calculating the ternary loss value, a triplet must be constructed, and the triplet is determined according to the label of the data in the batch. Assuming that a certain data in the batch is an anchor point, the data with the same label as the anchor point is a positive example, and the data with a different label from the anchor point is a negative example. The calculation method of the ternary loss is: triLoss=max(d(a,p)-d(a,n)+margin,0) Among them, a is the anchor point, p is the positive example, and n is the negative example; margin is an interval that forces the model to learn so that the distance between the anchor point a and the negative example n is larger in the vector space, and the distance between the anchor point a and the positive example p is smaller in the vector space; the accuracy is calculated as follows: Among them, TP represents the number of instances where both the true result and the predicted result are positive; FP represents the number of instances where the true result is negative but the predicted result is positive; TN represents the number of instances where both the true result and the predicted result are negative; FN represents the number of instances where the true result is positive but the predicted result is negative. S53: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed based on the total loss value to fine-tune the model; In S53, after obtaining the difference between the input and the true value through the loss function, the stochastic gradient descent method is used to back propagate and train the deep neural network model. The formula of stochastic gradient descent is: p t+1 =p t -lr×dp t Among them, p t is the model parameter after the tth iteration, lr is the learning rate, dp t For p t The gradient of Momentum is introduced in the stochastic gradient descent method. Momentum considers the direction and size of the last update each time the parameters are updated, so that the parameters gain more momentum in the gradient direction. It is combined with Nesterov Momentum, which updates the parameters slightly before calculating the gradient, then calculates the gradient, and finally uses the gradient to perform the actual parameter update. The Nesterov Momentum update formula is: x′ t =x t +m·v t-1 v t =m·v t-1 -lr·dx′ t x t+1 =x t +v t Among them, x t is the model parameter after the tth iteration, m is the Momentum parameter, v t-1 is the gradient updated in the last iteration, lr is the learning rate, dx′ t is the gradient of the model parameters after the tth iteration, x t+1 is the model parameter after the t+1th iteration; S54: Repeat S52 and S53 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set; S55: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results; S56: Repeat S55 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data; S57: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight. S58: Repeat S51 and S57 for no less than 50 times; S6: Perform unfreezing phase training of the deep neural network model; The specific steps of S6 are as follows: S61: Set the learning rate of the optimizer according to the specified learning rate scheduling function lr_scheduler_func and the number of epochs of the current training; S62: randomly select a batch of data from the training set, input it into the model, output the prediction result, calculate the classification loss value between the prediction result and the true result and the ternary loss value of the batch of data, and calculate the prediction accuracy of the batch of data; S63: The weighted sum of the classification loss value and the ternary loss value is taken as the total loss value, and back propagation is performed according to the total loss value to update all network parameters of the model; S64: Repeat S62 and S63 until the entire training set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value and accuracy rate of the entire training set; S65: Randomly select a batch of data from the validation set, input it into the model, output the prediction results, and calculate the classification loss value and accuracy of the prediction results and the true results; S66: Repeat S65 until the entire validation set is traversed, and perform cumulative averaging operations on the classification loss value and the accuracy rate to obtain the classification loss value of the entire validation set and the prediction accuracy rate of the batch of data; S67: Save the model weight. If the classification loss value of the validation set is less than or equal to the minimum classification loss value, the model weight will be saved again as the optimal model weight. S68: Repeat S61 and S67 not less than 150 times; S7: deploy the saved optimal model parameters to the video platform; S8: Obtain the point image of each camera through the frame fetching operation, and determine the probability of waterlogging in the point image; S9: Based on the point images obtained in S8, it is determined whether waterlogging occurs in the point images of each camera, and the results are stored in a database to display whether waterlogging occurs on the video platform.
