Flood discharge detection model training method and device, equipment and medium

By employing various sample augmentation strategies and improving the feature extraction and fusion modules of the YOLOv8 model, the overfitting and cross-domain transfer problems of the reservoir flood discharge detection model under limited sample data were solved, achieving efficient and accurate flood discharge detection.

CN121095696AActive Publication Date: 2025-12-09GUANGDONG RES INST OF WATER RESOURCES & HYDROPOWER

Patent Information

Application Number
CN202511176935.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-12-09
Estimated Expiration
2045-08-21

AI Technical Summary

Technical Problem

Existing reservoir discharge detection models suffer from high requirements for sample quantity and quality, and are trained with few samples of reservoir discharge events. This results in problems such as high data noise, large domain differences, class imbalance, and lack of representativeness in scenarios with few samples, leading to overfitting and poor cross-domain transfer performance, making it difficult to achieve high-precision real-time detection.

Method used

Multiple sample augmentation strategies are employed, such as noise injection, color transformation, geometric transformation, weather simulation, and mosaicking. Combined with an improved YOLOv8 model, the model's generalization ability and robustness are enhanced through flood discharge convolution feature extraction and feature fusion modules, while reducing computational load and achieving lightweight and high-precision detection.

Benefits of technology

In scenarios with limited sample data, the computational efficiency and target detection accuracy of the flood discharge detection model were improved, and the stability and accuracy of the model under complex weather conditions were enhanced, achieving real-time and high-precision flood discharge detection of reservoirs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121095696A_ABST
    Figure CN121095696A_ABST
Patent Text Reader

Abstract

The invention discloses a flood discharge detection model training method, device and equipment and a medium, and the method comprises the steps: taking pre-collected video image data of a reservoir spillway as a first training sample set, and carrying out the sample enhancement of the first training sample set according to a preset sample enhancement strategy, and obtaining a second training sample set; wherein the sample enhancement strategy comprises one or more combinations of the following: an independent enhancement strategy, a combined enhancement strategy or a mosaic enhancement strategy; according to the second training sample set, training a pre-constructed initial flood discharge detection model to obtain a final flood discharge detection model; wherein the initial flood discharge detection model is an improved YOLOv8 model obtained through reconstruction of a flood discharge convolution feature extraction module and updating of a feature fusion module. According to the method, the calculation efficiency and the target detection precision of the flood discharge detection model can be improved under the scene of few sample data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence image processing, and in particular to a method, apparatus, equipment and medium for training a flood discharge detection model. Background Technology

[0002] Reservoirs are crucial water conservancy facilities for both flood control and water resource utilization. Spillways, as an important component of reservoirs, play a key role in ensuring their flood control function. Traditional methods for addressing flood discharge safety hazards in reservoirs primarily rely on manual inspections or video monitoring combined with manual analysis. These methods suffer from drawbacks such as large management blind spots, poor monitoring timeliness, delayed hazard analysis, and low levels of intelligence, leading to increased safety risks associated with spillway discharge during the flood season. Based on deep learning image recognition theory, this research aims to construct an intelligent flood discharge detection model for reservoirs based on video images. This will further enhance the reservoir's perception capabilities and safety management level, ensuring safe and stable operation of reservoirs during the flood season and accelerating the realization of modern reservoir management and the development goals of smart water conservancy in the new stage. This is of great significance.

[0003] However, mainstream object detection models have high requirements for both the quantity and quality of samples, while reservoir discharge is not a regular occurrence. Therefore, reservoir discharge detection models are typical models trained with few samples. As is well known, few-sample data suffers from many problems such as high data noise, large domain differences, class imbalance, and lack of representativeness. This leads to object recognition models trained with such data being prone to overfitting and poor cross-domain transfer performance, resulting in significant limitations in production applications.

[0004] Therefore, constructing a lightweight reservoir discharge detection model that can adapt to limited sample data, complex weather environments, and high-precision real-time detection is of great application value in addressing these issues. Summary of the Invention

[0005] This invention provides a method, apparatus, equipment, and medium for training a flood discharge detection model, which can improve the computational efficiency and target detection accuracy of the flood discharge detection model in scenarios with limited sample data.

[0006] In a first aspect, embodiments of the present invention provide a method for training a flood discharge detection model, comprising:

[0007] The pre-collected video image data of the reservoir spillway is used as the first training sample set, and the first training sample set is augmented according to the preset sample augmentation strategy to obtain the second training sample set; wherein, the sample augmentation strategy includes one or more combinations of the following: independent augmentation strategy, combined augmentation strategy or mosaic augmentation strategy.

[0008] Based on the second training sample set, the pre-constructed initial flood discharge detection model is trained to obtain the final flood discharge detection model; wherein, the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction module and updating the feature fusion module.

[0009] This invention addresses the problem of limited sample size and narrow coverage due to low flood discharge event incidence by providing multiple sample augmentation strategies to balance sample distribution and increase sample quantity, thereby improving the model's generalization ability and robustness. It also reduces the computational load of the YOLOv8 model through lightweight modifications, ensuring real-time flood discharge detection. Furthermore, it enhances the model's feature extraction capabilities by modifying the feature fusion module, thus improving detection accuracy. Finally, the second training sample set obtained through sample augmentation is used to train the initial flood discharge detection model obtained through structural modifications, resulting in a high-precision and robust final flood discharge detection model. Compared with existing technologies, this invention improves the computational efficiency and target detection accuracy of the flood discharge detection model in scenarios with limited sample data.

[0010] Furthermore, the independent enhancement strategy includes one or more combinations of the following: noise injection strategy, color transformation strategy, geometric transformation strategy, or weather simulation strategy;

[0011] The step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes:

[0012] When the sample augmentation strategy is a noise injection strategy, a noise map of any noise type is superimposed on each original sample image in the first training sample set to obtain a second training sample set.

[0013] When the sample enhancement strategy is a color transformation strategy, each original sample image in the first training sample set is color transformed according to any color transformation mode to obtain the second training sample set; wherein, the color transformation mode includes HSV transformation mode, mean blur mode, contrast adjustment mode, brightness adjustment mode or histogram equalization mode.

[0014] When the sample augmentation strategy is a geometric transformation strategy, the original sample images in the first training sample set are subjected to geometric transformation according to any geometric transformation type to obtain the second training sample set; wherein, the geometric transformation type includes translation transformation, rotation transformation, scaling transformation, mirror flipping or image distortion;

[0015] When the sample enhancement strategy is a weather simulation strategy, the second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set through simulation technology.

[0016] This invention employs a noise injection strategy to generate enhanced sample images with injected noise, thereby improving the noise resistance of the flood discharge recognition model; a color transformation strategy to simulate the effects of images under different lighting and imaging conditions, thereby enhancing the model's adaptability to lighting changes; a geometric transformation strategy to simulate changes in camera viewpoint, enriching the diversity of the sample space and enhancing the model's detection accuracy for images from different viewpoints; a weather simulation strategy to cover scarce weather scenarios, addressing the problem of environmental uniformity in sample images; and finally, through multi-dimensional sample enhancement strategies, specifically improving the model's detection stability and accuracy in complex natural environments.

[0017] Furthermore, the weather simulation strategy includes a sunshine simulation strategy, a rain simulation strategy, a cloud and fog simulation strategy, or a snowflake simulation strategy.

[0018] The second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set using simulation technology, including:

[0019] When the weather simulation strategy is a sunlight simulation strategy, the pre-generated halo map is linearly superimposed with each original sample image in the first training sample set through image fusion technology to obtain the second training sample set; wherein, the halo map is generated by performing attenuation simulation calculation of the light source component of randomly generated light source points in the corresponding original sample image through a mirror attenuation function.

[0020] When the weather simulation strategy is a rain simulation strategy, the pre-generated rain pattern image is linearly superimposed with each original sample image in the first training sample set using image fusion technology to obtain the second training sample set; wherein, the rain pattern image is generated by color modulation and transparency control of the pre-generated rain line image; the rain line image is generated by drawing the length and tilt angle of the rain line with each raindrop as the starting point in the pre-created basic raindrop noise image;

[0021] When the weather simulation strategy is a cloud and fog simulation strategy, fogging is applied to each original sample image in the first training sample set using a preset transmittance map to obtain a second training sample set.

[0022] When the weather simulation strategy is a snowflake simulation strategy, the pre-generated final snowflake image is superimposed on each of the original sample images in the first training sample set using image fusion technology to obtain the second training sample set. The final snowflake image is generated by adjusting the transparency and controlling the brightness of several snowflakes in the pre-generated initial snowflake image. The initial snowflake image is obtained by generating several snowflakes on the corresponding original sample image through random point generation and masking operations.

[0023] This invention employs a sunlight simulation strategy to simulate strong light reflection interference, avoiding feature loss caused by overexposure; a rain simulation strategy to simulate rain streaks and improve target recognition in rainy weather; a cloud and fog simulation strategy to simulate fog concentration differences; a snowflake simulation strategy to adapt to snowy weather scenarios; and multiple weather simulation strategies to accurately simulate complex weather, compensate for insufficient real data, and ensure the reliability of the model under extreme weather conditions.

[0024] Furthermore, the step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes:

[0025] When the sample augmentation strategy is a mosaic augmentation strategy, several original sample images are randomly selected from the first training sample set, and the original sample images are scaled to obtain scaled sample images, so as to stitch the scaled sample images into a new image with the same size as each original sample image.

[0026] Continue to randomly select the same number of original sample images from the remaining original sample images in the first training sample set to stitch them together into a new image of the same size, until all original sample images have been stitched together;

[0027] The newly stitched images are used as the second training sample set.

[0028] This invention employs a mosaic enhancement strategy, randomly scaling multiple samples and stitching them into a single image. On one hand, while expanding the sample pool through independent and combined enhancement strategies, it reduces the consumption of local storage resources, thereby reducing the model's hardware performance requirements. On the other hand, it increases the number of targets in a single image, thus enriching the positive samples and alleviating the problem of insufficient model detection performance caused by the imbalance between positive and negative samples.

[0029] Furthermore, the step of training the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model includes:

[0030] The second training sample set is input into the backbone network layer of the initial flood discharge detection model to extract features through the stacked flood discharge convolutional feature extraction module and generate an initial feature map set; wherein, the flood discharge convolutional feature extraction module includes a CBS module, a lightweight modified C2f module, an SPPF module and a CSAM hybrid attention mechanism;

[0031] The initial feature map set is fused using a pre-defined multi-scale feature fusion module to obtain a multi-scale feature map; wherein, the multi-scale feature fusion module is obtained by parallel connection of dilated convolution kernels and attention mechanism;

[0032] Based on the multi-scale feature map, output prediction is performed to obtain the output prediction result. Then, the target prediction result is evaluated for loss using a preset comprehensive loss function to obtain the loss evaluation result. The comprehensive loss function includes a classification loss function, a boundary regression loss function, and a focus loss function.

[0033] Based on the loss assessment results, the parameters of the initial flood discharge detection model are updated to obtain the final flood discharge detection model.

[0034] This invention employs a flood discharge convolutional feature extraction module, composed of a CBS module, a lightweight modified C2f module, an SPPF module, and a CSAM hybrid attention mechanism, to extract initial feature maps. This allows for the use of depthwise separable convolution instead of ordinary convolution, thus achieving lightweight feature extraction. A multi-scale feature fusion module integrates features from different levels to enhance multi-scale target detection capabilities. Classification loss optimizes the distinction between flood discharge and non-flood discharge states, boundary regression loss accurately locates targets such as gates and water flow, and focus loss discretizes coordinate prediction to adapt to targets with ambiguous or difficult-to-define boundaries, improving robustness. Finally, model structure modification and loss function updates enhance the model's detection accuracy and efficiency.

[0035] Furthermore, the feature extraction through the stacked flood discharge convolution feature extraction module to generate an initial feature map set is specifically as follows:

[0036] By using several layers of consecutive combined convolutional modules, multiple ordinary convolutions and depthwise separable convolutions are performed on the second training sample set in sequence to obtain a first feature map set containing feature maps at different levels; wherein, the combined convolutional module includes the CBS module and the C2f module after lightweight modification;

[0037] The SPPF module performs multi-scale spatial pooling on the highest-level feature map in the first feature map set to obtain the second feature map.

[0038] The second feature map is enhanced using the CSAM hybrid attention mechanism to obtain the third feature map;

[0039] The first feature map set, the second feature map, and the third feature map are merged to obtain the initial feature map set.

[0040] In this embodiment of the invention, a modified flood discharge convolutional feature extraction module is used to extract convolutional feature maps, thereby using depthwise separable convolution instead of ordinary convolution to reduce the computational load of the model. By using a hybrid attention mechanism, key features are enhanced and background interference is suppressed, thereby achieving a balance between model lightweighting and feature enhancement, improving the small target detection capability while reducing resource consumption.

[0041] Furthermore, the initial feature map set is fused using a preset multi-scale feature fusion module to obtain a multi-scale feature map, specifically as follows:

[0042] By performing convolution operations on the initial feature map set using several convolutional blocks with different dilation rates, several first intermediate feature maps are obtained.

[0043] By using a pre-defined hybrid attention mechanism, the first intermediate feature map is enhanced to obtain several second intermediate feature maps;

[0044] The second intermediate feature map is then stitched together to obtain a multi-scale feature map.

[0045] This invention expands the receptive field and captures contextual information at different scales through multi-diffraction convolutional blocks; it highlights key features and suppresses background interference through a hybrid attention mechanism; and it integrates feature information from different sources through a splicing operation to improve feature richness, ultimately enhancing the detection robustness of complex scenes.

[0046] Secondly, embodiments of the present invention provide a flood discharge detection model training device, including a sample acquisition module and a model training module, wherein,

[0047] The sample acquisition module is used to select a portion of pre-collected video image data of the reservoir spillway as a first training sample set, and perform sample enhancement on the first training sample set according to a preset sample enhancement strategy to obtain a second training sample set; wherein, the sample enhancement strategy includes independent enhancement strategy, combined enhancement strategy and mosaic enhancement strategy.

[0048] The model training module is used to train the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model; wherein the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction module and updating the feature fusion module.

[0049] This invention provides multiple sample enhancement strategies through a sample acquisition module to balance sample distribution and increase the number of samples, addressing the problem of insufficient sample size and narrow coverage due to the low incidence of flood discharge events, thereby improving the model's generalization ability and robustness. Through a model training module, the YOLOv8 model is lightweighted to reduce computational load, ensuring real-time flood discharge detection. Furthermore, the YOLOv8 model's feature fusion module is modified to enhance feature extraction capabilities, improving detection accuracy. Finally, the second training sample set obtained through sample enhancement is used to train the initial flood discharge detection model obtained through structural modification, resulting in a high-precision and robust final flood discharge detection model.

[0050] Thirdly, embodiments of the present invention provide a terminal device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;

[0051] The memory is used to store at least one executable instruction that causes the processor to perform the operation of the flood discharge detection model training method as described in any of the above.

[0052] Fourthly, embodiments of the present invention provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device or apparatus where the computer-readable storage medium is located to perform the flood discharge detection model training method as described in any of the above.

[0053] The above description is merely an overview of the technical solutions of the embodiments of the present invention. In order to better understand the technical means of the embodiments of the present invention and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0054] Figure 1 This is a schematic diagram of a flood discharge detection model training method provided in an embodiment of the present invention;

[0055] Figure 2 This is a diagram of the RSD-YOLO network structure provided in an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of the DWBlock and CBS module structure provided in an embodiment of the present invention;

[0057] Figure 4 This is a schematic diagram of the LW_C2f module structure provided in an embodiment of the present invention;

[0058] Figure 5 This is a schematic diagram of the SPPF module structure provided in an embodiment of the present invention;

[0059] Figure 6 This is a schematic diagram of the CSAM module structure provided in an embodiment of the present invention;

[0060] Figure 7 This is a schematic diagram of the multi-scale feature fusion module MSFF results provided in an embodiment of the present invention;

[0061] Figure 8 This is a technical roadmap for a flood discharge detection model provided in an embodiment of the present invention;

[0062] Figure 9 This is a structural diagram of a flood discharge detection model training device provided in an embodiment of the present invention. Detailed Implementation

[0063] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0064] Example 1:

[0065] like Figure 1 As shown, an embodiment of the present invention provides a method for training a flood discharge detection model, which includes the following steps:

[0066] S11, the pre-collected video image data of the reservoir spillway is used as the first training sample set, and the first training sample set is augmented according to the preset sample augmentation strategy to obtain the second training sample set; wherein, the sample augmentation strategy includes one or more of the following: independent augmentation strategy, combined augmentation strategy or mosaic augmentation strategy.

[0067] In one specific embodiment, the process of acquiring video image data of the reservoir spillway includes: acquiring real-time video images of the reservoir spillway through a video monitoring system; if the spillway is currently discharging floodwater (generally in the case of a predicted flood), adjusting the camera to focus on capturing images of the gates, inlet section, spillway section, and sidewalls of the spillway, avoiding chaotic areas such as the stilling basin and the end of the energy-saving facility; images of each area need to be captured and saved locally; then, fixing a certain viewing angle, continuously adjusting the focal length to change the image magnification (the image magnification starts from 1 and goes up to the maximum, magnifying by 2 times each time) to obtain images at different magnifications under a fixed viewing angle; the flood discharge samples of the same reservoir should cover different weather conditions such as sunny, cloudy, rainy, and foggy days as much as possible (if this is not possible, sample enhancement can be used to compensate), increasing the number of reservoir flood discharge image samples. Using the above method, another round of image data of the spillway when it is not discharging floodwater is collected, covering key areas such as the gates, inlet section, spillway section, and sidewalls, as well as different weather conditions.

[0068] In one specific embodiment, sample annotation is performed before sample augmentation. The annotation process involves using Labelme annotation software to annotate video images of the spillway. The annotation categories are divided into two main types: flood discharge and no flood discharge. During annotation, a rectangular bounding box is drawn to identify the target type. To reduce the impact of category imbalance on accuracy evaluation errors, the number of sample images in the flood discharge and no-flood discharge states should be kept as close as possible, with the ratio ideally controlled within the range of [0.2, 5]. After annotation, the results are saved in YOLO format (class_id, x_center, y_center, width, height). The annotation file and image data are linked by the filename and saved in the images and labels folders respectively, serving as training samples for the RSD-YOLO model. Then, the samples are divided into training and validation sets at a 2:1 ratio for model training and model evaluation, respectively.

[0069] It should be noted that reservoir discharge is a planned and controlled process by which reservoir management units release water into downstream river channels through spillways (spill tunnels) to control reservoir water levels and ensure downstream flood control safety. Therefore, reservoir discharge is a proactive, controlled, and dynamic process. The discharge status is spatially dependent on the water flow, spillway, and gates. Only when the spillway and gates serve as the background for water flow can the presence of reservoir discharge be accurately identified and determined. This differs from conventional detection targets. If water accumulation on the spillway surface is due to stilling basin storage or natural rainfall, it does not constitute discharge. Therefore, it is crucial to distinguish between spillway water accumulation and spillway discharge during labeling.

[0070] In this embodiment, the independent enhancement strategy includes one or more combinations of the following: noise injection strategy, color transformation strategy, geometric transformation strategy, or weather simulation strategy;

[0071] The step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes:

[0072] When the sample augmentation strategy is a noise injection strategy, a noise map of any noise type is superimposed on each original sample image in the first training sample set to obtain a second training sample set.

[0073] When the sample enhancement strategy is a color transformation strategy, each original sample image in the first training sample set is color transformed according to any color transformation mode to obtain the second training sample set; wherein, the color transformation mode includes HSV transformation mode, mean blur mode, contrast adjustment mode, brightness adjustment mode or histogram equalization mode.

[0074] When the sample augmentation strategy is a geometric transformation strategy, the original sample images in the first training sample set are subjected to geometric transformation according to any geometric transformation type to obtain the second training sample set; wherein, the geometric transformation type includes translation transformation, rotation transformation, scaling transformation, mirror flipping or image distortion;

[0075] When the sample enhancement strategy is a weather simulation strategy, the second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set through simulation technology.

[0076] In one specific embodiment, the noise injection strategy involves randomly selecting one of Poisson noise, uniform noise, and Gaussian noise to generate a noise map of the same size as the input image. This noise map is then superimposed onto the input image to produce an enhanced sample image with injected noise. This method helps improve the noise resistance of the flood discharge identification model. Its mathematical principle is as follows:

[0077] I out =I in +I noise

[0078] Among them, I in Indicates the input image, I noise Represents a noisy image, I out This indicates the output image.

[0079] In one specific embodiment, the color transformation strategy is as follows: randomly selecting one mode from HSV transform, mean blur, contrast adjustment, brightness adjustment, and histogram equalization to perform color transformation on the input image. The specific implementation methods of each color transformation mode are as follows:

[0080] HSV transformation is the process of converting an image from the RGB color space to the HSV color space, which can be achieved through OpenCV's built-in functions.

[0081] Mean smoothing: Replace the original value of a pixel with the average value of all pixels in its neighborhood (e.g., a 3x3 neighborhood). This can be achieved using a built-in OpenCV function.

[0082] Contrast adjustment: First, perform HSV transformation on the image, then adjust the value range of the luminance component V (e.g., limit it to 5% to 95%), and then return to the RGB space through inverse operation. By adjusting the size of the difference between the brightness and darkness of the image, the contrast can be enhanced / reduced. This can be achieved through OpenCV built-in functions.

[0083] Brightness adjustment: First, perform HSV transformation on the image, then increase or decrease the same value in the luminance component V for all pixels, and then return to the RGB space through inverse operation. By adjusting the overall or local brightness values ​​of the image, the brightness of the image can be improved, thereby improving the visual experience. This can be achieved through OpenCV built-in functions.

[0084] Histogram equalization: This function maps the gray levels of an input image to the output image using a transformation function, making the gray levels of the output image relatively uniformly distributed, thereby enhancing the contrast of the image. It can be implemented using built-in OpenCV functions.

[0085] In one specific embodiment, the geometric transformation strategy is as follows: randomly select one mode from translation transformation, rotation transformation, scaling transformation, mirror flipping, and image distortion to perform geometric transformation on the input image, simulating the scene effects of the camera under different imaging conditions such as changes in position, focal length, and viewing angle, so as to enrich the quantity and type of image samples.

[0086] In this embodiment, the weather simulation strategy includes a sunshine simulation strategy, a rain simulation strategy, a cloud and fog simulation strategy, or a snowflake simulation strategy.

[0087] The second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set using simulation technology, including:

[0088] When the weather simulation strategy is a sunlight simulation strategy, the pre-generated halo map is linearly superimposed with each original sample image in the first training sample set through image fusion technology to obtain the second training sample set; wherein, the halo map is generated by performing attenuation simulation calculation of the light source component of randomly generated light source points in the corresponding original sample image through a mirror attenuation function.

[0089] When the weather simulation strategy is a rain simulation strategy, the pre-generated rain pattern image is linearly superimposed with each original sample image in the first training sample set using image fusion technology to obtain the second training sample set; wherein, the rain pattern image is generated by color modulation and transparency control of the pre-generated rain line image; the rain line image is generated by drawing the length and tilt angle of the rain line with each raindrop as the starting point in the pre-created basic raindrop noise image;

[0090] When the weather simulation strategy is a cloud and fog simulation strategy, fogging is applied to each original sample image in the first training sample set using a preset transmittance map to obtain a second training sample set.

[0091] When the weather simulation strategy is a snowflake simulation strategy, the pre-generated final snowflake image is superimposed on each of the original sample images in the first training sample set using image fusion technology to obtain the second training sample set. The final snowflake image is generated by adjusting the transparency and controlling the brightness of several snowflakes in the pre-generated initial snowflake image. The initial snowflake image is obtained by generating several snowflakes on the corresponding original sample image through random point generation and masking operations.

[0092] In one specific embodiment, the sunlight simulation strategy is as follows: First, a rectangular area is randomly selected in the image as the simulated illumination area, and a point is randomly selected within it as the center of the sunlight. Next, assuming the color value of the light source S is (255, 235, 205), a radial decay function is used at the center of the light source to simulate the attenuation of its brightness component, generating a halo image with gradually decreasing brightness centered on the light source. Then, a Gaussian blur function is applied to smooth the halo image. Finally, image fusion technology is used to linearly superimpose the generated halo image with the background image, thereby achieving the effect of simulating sunlight illumination. The calculation method for the radial decay function is as follows:

[0093]

[0094] I out = (1-α)×I in +α×I sun

[0095] Where λ is the attenuation coefficient, R represents the radius of the solar spot, and I sun This represents a simulated halo diagram, where S represents the color value of the light source. c Indicates the center position of the light spot, I in Indicates the input image, I out This represents the output image, and α represents the weight, which is generally in the range of [0,1], with a default value of 0.2.

[0096] In one specific embodiment, the rain simulation strategy is as follows: First, a basic raindrop noise map is created using a random number generator. Then, starting with each raindrop, a rain line map is drawn based on the length and tilt angle (i.e., the angle with the vertical direction) of the rain line. The appearance characteristics of the rain streaks are controlled by adjusting the color and transparency attributes of the raindrops. Then, Gaussian smoothing is applied to blur the rain streaks. Next, image fusion technology is used to linearly superimpose the generated rain streak image with the background image. Finally, histogram equalization is applied to the fused image to simulate the scene effect of a rainy day. The core mathematical expression is as follows:

[0097] I out = (1-α)×I in +α×I rain

[0098] Among them, I out Represents rain map, I in Represents the background image, I rain It is a rain pattern image, where α represents the weight, which is generally between [0,1] and defaults to 0.2.

[0099] In a specific embodiment, the cloud and fog simulation strategy is as follows: First, a point is randomly selected in the image as the fog center point, and its atmospheric light value A can be set to (255,255,255) or a color value close to white. At the same time, a transmittance map of the same size as the input image is set, and the default initial value of the transmittance map is 0. Then, multiple rectangular / circular regions are randomly set as fog regions, and the distance from each pixel in the fog region to the fog center point is calculated. Based on the distance, the transmittance value of each pixel can be calculated according to the transmittance calculation formula (6). The corresponding pixel value in the transmittance map is updated with this transmittance value to obtain the complete transmittance map of the corresponding input image. Then, it is substituted into the fog model to obtain the fogged image. Finally, the contrast enhancement algorithm is used to enhance the brightness and change the color of the fogged image, thereby realizing the simulation of the fog scene. The process of simulating the fog map and the transmittance calculation are as follows:

[0100] I haze =I in t(x) + A[1-t(x)];

[0101] t(x)=e -βd(x)

[0102] Among them, I haze Represents simulated fog map, I in Here, t(x) represents the background image, A represents the atmospheric light value, d(x) represents the distance from the pixel to the fog center, and β represents the scattering coefficient, which defaults to -0.3502. By adjusting the scattering coefficient β in the formula, different concentrations of cloud and fog effects can be simulated, making the simulation effects of cloud and fog scenes richer.

[0103] In one specific embodiment, the snowflake simulation strategy is as follows: First, a random number generator is used to generate random points within the image range, which serve as the center positions of the snowflakes; then, the shape of the snowflakes is set to a circle, and the size of the snowflakes is defined by adjusting the radius of the pixels; next, the generation density and distribution range of the snowflakes are controlled by adjusting the generation frequency of the random points, and mask operations are used to increase or decrease the generation of snowflakes in specific areas of the image; the appearance characteristics of the snowflakes are controlled by adjusting their transparency and brightness attributes to simulate the snow scene effect under different lighting conditions; then, image fusion technology is used to overlay the generated snowflake image with the original image, and finally, the color and contrast of the fused image are adjusted to ensure that the visual effect of the image after adding snow is natural, thereby achieving the simulation of a snowy scene. The core mathematical expression is as follows:

[0104] I out = (1-α)×I in +α×I snow

[0105] Among them, I out Represents rain map, I in Represents the background image, I snow It is a rain pattern image, where α represents the weight, with a value between [0,1] and a default value of 0.2.

[0106] In a specific embodiment, to simulate complex natural environmental conditions, a combined enhancement strategy is designed to simulate complex scenes, thereby expanding the scene types and sample size, and supplementing and improving single enhancement strategies. There are various implementation forms of combined enhancement, including binary combination, ternary combination, etc., which can be rationally selected according to the characteristics of the sample size and the target scene to balance computational efficiency and sample size. Binary combination can use any two strategies from ①noise injection, ②color transformation, ③geometric transformation, and ④weather simulation to generate new scene composite images. Each single strategy has multiple mode selections; therefore, binary combination can be a combination of different strategies or a combination of different modes within a single strategy, thus greatly increasing the number of combinations and improving scene richness. Ternary combination can be implemented analogously to the binary combination strategy, except that the number of combined strategies is increased to three; the rest can be implemented similarly.

[0107] In this embodiment, the step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes:

[0108] When the sample augmentation strategy is a mosaic augmentation strategy, several original sample images are randomly selected from the first training sample set, and the original sample images are scaled to obtain scaled sample images, so as to stitch the scaled sample images into a new image with the same size as each original sample image.

[0109] Continue to randomly select the same number of original sample images from the remaining original sample images in the first training sample set to stitch them together into a new image of the same size, until all original sample images have been stitched together;

[0110] The newly stitched images are used as the second training sample set.

[0111] In one specific embodiment, the mosaic enhancement strategy is as follows: four sample images are spliced ​​together to form a large image as a new training sample image by randomly scaling, cropping, and arranging them. This approach can, on the one hand, increase the number of targets in a single image, thereby enriching the positive samples and alleviating the problem of insufficient model detection performance caused by the imbalance of positive and negative samples. On the other hand, it can also reduce the consumption of local storage resources by dynamically generating in memory, thereby reducing the performance requirements of the model on the hardware. The specific implementation process is as follows: First, construct a set of all image samples in the current directory. Starting from the first sample, loop through the remaining N-1 sample images and randomly select 3 images to form 4 sample images with the current sample. Then, generate a new image with a completely black background, whose size is consistent with a single image sample. Randomly select a point in this image and divide the new image into 4 sub-regions using the horizontal and vertical coordinates of this point as boundaries. Then, replace each sub-region with these 4 images. During the replacement process, to maintain the integrity of the image, the image to be replaced can be scaled or cropped as necessary. While scaling or cropping the image, the processing should be mapped to the labeled target bounding box. When filling the region, the coordinates of the target bounding box should also be adjusted synchronously according to the difference of the origin to ensure that the sample image and the detection target are transformed synchronously, thereby completing the mosaic enhancement of the sample.

[0112] S12, Based on the second training sample set, the pre-constructed initial flood discharge detection model is trained to obtain the final flood discharge detection model; wherein, the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction module and updating the feature fusion module.

[0113] In one specific embodiment, the flood discharge detection model trained by the present invention (hereinafter referred to as the RSD-YOLO model) is obtained by modifying and optimizing the YOLOv8 model, such as... Figure 2 As shown, the RSD-YOLO model consists of three parts: a backbone network, a neck network, and a head. The backbone network primarily extracts shallow spatial and deep semantic features. The neck network fuses features from different layers by aggregating two multi-layered network structures: FPN (bottom-up) and PAN (top-down). The head predicts the target type and performs boundary regression. Figure 3As shown, the CBS module is a basic module that includes three basic operations: two-dimensional convolution (Conv2d), batch normalization (BatchNormalize), and activation function (SiLU). Each execution of the CBS module downsamples the feature map (the width and height of the feature map become half of the original). DWBlock, on the other hand, borrows the design concept of ResNet residual network, summing the input feature map with the feature map after two depthwise separable convolutions. This can overcome the gradient vanishing or gradient exploding problems that are prone to occur when deep learning networks are deepened, and achieve deeper feature extraction and representation.

[0114] like Figure 4 As shown, the LW_C2f module is also a feature extraction module, but this module does not change the size of the feature map. By adjusting the number of DWBlocks, the shallow features within the module can be transferred and reused. Moreover, DWBlocks use depthwise separable convolutions instead of ordinary convolutions, which can further reduce the number of parameters and make the model more lightweight.

[0115] like Figure 5 As shown, the SPPF module is a spatial multi-scale feature fusion unit that uses a serial cascaded approach to perform max pooling operations on the same feature map using multiple pooling kernels of different sizes (such as 5x5, 9x9, 13x13) to simulate different receptive fields capturing contextual information at different scales in the feature map, thereby enhancing the model's ability to understand objects of different sizes.

[0116] like Figure 6 As shown, the CSAM attention module is a lightweight hybrid attention mechanism composed of channel attention and spatial attention connected in series. It can not only enhance channel information, but also enhance spatial information, highlight key features, suppress background interference, and improve the detection capability of small targets.

[0117] Upsample is an upsampling operation and a key component of the Feature Pyramid (FPN). Its core function is to increase the spatial resolution of the feature map through nearest neighbor / bilinear interpolation algorithms to adapt to the need for feature fusion at higher resolution scales.

[0118] Concat is a tile operation that can stack feature maps of the same size in the channel dimension, combining feature information from different sources and improving feature richness.

[0119] like Figure 7As shown, MSFF is a cross-domain feature fusion module. The MSFF module first simulates convolution operations with different receptive fields through three convolutional blocks with different dilation rates. Then, it performs feature enhancement through the CSAM module. Finally, it stitches the three sets of features together and performs gradient flow optimization through the residual module. Finally, it restores the number of channels through 1*1 convolution, so as to efficiently fuse low-resolution but semantically rich deep features with high-resolution and detailed shallow feature information.

[0120] In this embodiment, training the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model includes: inputting the second training sample set into the backbone network layer of the initial flood discharge detection model to extract features through a stacked flood discharge convolutional feature extraction module to generate an initial feature map set; wherein the flood discharge convolutional feature extraction module includes a CBS module, a lightweight modified C2f module, an SPPF module, and a CSAM hybrid attention mechanism; fusing the initial feature map set through a preset multi-scale feature fusion module to obtain a multi-scale feature map; wherein the multi-scale feature fusion module is obtained by parallel connection of dilated convolutional kernels and attention mechanisms; performing output prediction based on the multi-scale feature map to obtain an output prediction result, and evaluating the loss of the target prediction result through a preset comprehensive loss function to obtain a loss evaluation result; wherein the comprehensive loss function includes a classification loss function, a boundary regression loss function, and a focus loss function; updating the parameters of the initial flood discharge detection model based on the loss evaluation result to obtain the final flood discharge detection model.

[0121] In this embodiment, the feature extraction through stacked flood discharge convolutional feature extraction modules to generate an initial feature map set specifically involves: performing multiple ordinary convolutions and depthwise separable convolutions on the second training sample set sequentially using several layers of consecutive combined convolutional modules to obtain a first feature map set containing feature maps of different levels; wherein, the combined convolutional modules include the CBS module and the C2f module after lightweight modification; multi-scale spatial pooling is performed on the highest-level feature map in the first feature map set using the SPPF module to obtain a second feature map; the second feature map is enhanced using the CSAM hybrid attention mechanism to obtain a third feature map; and the first feature map set, the second feature map, and the third feature map are merged to obtain the initial feature map set.

[0122] In one specific embodiment, the initial feature map generation process is implemented by the backbone network module of the RSD-YOLO model; the specific process of the backbone network module generating the initial feature map is as follows: the image sample is first subjected to feature extraction through two CBS modules, and the width and height of the extracted feature map are reduced to 1 / 4 of the input, while the number of feature channels is increased to 128 dimensions; then, the shallow feature information is continuously transferred to the deep features through multiple DWBlocks of the LW_C2f module, while keeping the feature map size unchanged, to obtain the feature map at level P1; then... The CBS+LW_C2f module is executed three times to obtain feature maps at levels P2, P3, and P4, respectively. Then, the SPPF module is used to perform multi-scale spatial pooling on the feature map at level P4 to obtain the feature map P5, capturing contextual information at different scales and enhancing the feature representation capability for targets of different sizes. Next, the CSAM module is used to further enhance the important channel and positional information of the feature map at level P4 to obtain the feature map P6, suppressing redundancy and noise information. Finally, the initial feature maps P2, P3, and P6 are fed into the neck network layer for multi-scale feature fusion.

[0123] In this embodiment, the step of fusing the initial feature map set to obtain a multi-scale feature map through a preset multi-scale feature fusion module specifically involves: performing a convolution operation on the initial feature map set using several convolutional blocks with different dilation rates to obtain several first intermediate feature maps; performing feature enhancement on the first intermediate feature maps using a preset hybrid attention mechanism to obtain several second intermediate feature maps; and performing a concatenation operation on the second intermediate feature maps to obtain the multi-scale feature map.

[0124] In one specific embodiment, the generation process of the multi-scale feature map is implemented by the neck network module of the RSD-YOLO model. The specific process of the neck network module generating the multi-scale feature map is as follows: the P6 feature map output by the CSAM module at the end of the backbone layer network is upsampled by 2x and then concatenated with the feature map of the P3 layer through concat, and then adaptively fused through the MSFF module to obtain the P7 feature map; P7 is upsampled by 2x again and concatenated with the P2 feature map through concat, and then adaptively fused through the MSFF module to obtain the P8 feature map; P8 is downsampled by two-dimensional convolution and then concatenated with the P7 feature map to obtain the P9 feature map; P9 is downsampled by two-dimensional convolution and then concatenated with the P6 feature map to obtain the P10 feature map; finally, the feature maps of the three layers P8, P9 and P10 are combined to form a multi-scale feature map.

[0125] In one specific embodiment, the object detection head performs category prediction and regression prediction on the multi-scale feature maps composed of P8, P9, and P10, respectively. The decoupling head uses a comprehensive loss function that includes classification loss, regression loss, and object loss to evaluate training accuracy and update the backpropagation gradient. The comprehensive loss function is generally divided into classification loss L... cls Boundary regression loss L bbox and focus loss L dfl Three parts:

[0126] L=λ1L cls +λ2L bbox +λ3L dfl

[0127] Among them, L cls L represents the classification loss between the predicted target type and the true type. bbox L represents the regression loss between the predicted boundary and the true boundary. dfl λ represents the focal loss between the predicted boundary and the true boundary; λ1, λ2, and λ3 represent the weights of the three types of losses, respectively. Considering that accurate bounding box localization is crucial for flood discharge scene recognition, and category is secondary, λ1 = 2, λ2 = 7, and λ3 = 1 are chosen in this invention.

[0128] L cls The classification loss is measured using a binary form of cross-entropy loss, and its mathematical expression is as follows:

[0129]

[0130] Where c represents the category number, y c This represents the probability that the model accurately predicts that the target belongs to class c, where C is the total number of classes.

[0131] L bbox The boundary regression loss is a further optimization based on CIoU. By comprehensively considering three factors—area, center point, and aspect ratio—the predicted bounding box becomes more accurate and converges faster. The boundary regression loss function calculated in this paper is shown in the following equation:

[0132]

[0133] Where IoU is the ratio of the intersection area to the union area of ​​the predicted bounding box and the ground truth bounding box (Intersection-Union Ratio), d represents the diagonal length of the minimum bounding rectangle of the predicted bounding box and the ground truth bounding box, and α is an adjustable penalty term. The larger α is, the more significant the penalty effect. The default value is 1. ρ(b,b) gt ) represents the Euclidean distance between the center of the predicted bounding box and the center of the ground truth bounding box.

[0134] DFL models continuous coordinate values ​​as probability distributions over discrete intervals, and obtains the final predicted coordinates through weighted summation (integration). Assuming the true coordinates of the target boundary are y, they are discretized into n coordinate points {y0, y1, y2, ..., y...}. n-1 The model predicts the coordinates y. i The probability is P(y) i If the boundary coordinates of the target are then predicted, the final predicted boundary coordinates are:

[0135]

[0136] L dfl The focus loss uses a binary form of cross-entropy loss metric, selecting the interval [y] closest to the predicted value y. i ,y i+1 To simplify the calculation, the focus loss is calculated as follows:

[0137] L dfl =-[(y i+1 -y)log(P(y i ))+(yy i )log(P(y i+1 ))]

[0138] Among them, y i y represents the discrete coordinates of the ground truth bounding box, and y represents the coordinates of the bounding box predicted by the model.

[0139] In one specific embodiment, the training process of the RSD-YOLO model is as follows:

[0140] 1) First, convert the annotation files of the spillway images to the standard YOLO format, and then place them in the same directory as the corresponding image data as training samples. Divide the training samples into training set and validation set at a ratio of 2:1, and use few-shot augmentation technology to expand the training set data to increase the number of training set samples by at least 10 times.

[0141] 2) The weights and bias parameters of the RSD-YOLO model were initialized using random numbers (ranging from [0,1]). The total number of iteration epochs was set to 100, the initial learning rate was 0.001, the gradient descent was solved using the AdamW algorithm, the number of samples in a single batch was 8, the momentum of the weight update was 0.937, and the decay rate of the weights was 0.00005.

[0142] 3) Starting from the first round of training, the training set data of the first batch is read in a loop. The RSD-YOLO model is initialized with the current w and b to perform forward calculation of the loss and gradient value of the batch. The weights w and bias parameters b are updated through the backpropagation rule. It is determined whether all batches of samples have been read. If so, the next round of training is performed. Otherwise, the loop of the next batch continues.

[0143] 4) Calculate the average of the loss values ​​of all batches of training data as the loss value of the current round, and calculate the current accuracy index. Determine whether the current round has reached the set maximum number of iterations or whether the training accuracy can no longer be improved. If so, stop the iteration calculation, output the final model weight w and bias parameter b, otherwise continue to the next round of training.

[0144] 5) The trained RSD-YOLO model is evaluated for accuracy using validation set data. Mean average precision (mAP) is commonly used in object detection to evaluate model performance. This invention draws on previous research and uses two evaluation metrics: mAP0.5 and mAP0.5:0.9, representing the mAP value at an IoU threshold of 0.5 and the average mAP value within the IoU threshold range of [0.5, 0.55, 0.6, ..., 0.95], respectively. AP represents the area under the precision and recall curves; a higher value indicates higher model detection accuracy, and there is an inverse constraint relationship between the two. The formulas for calculating precision, recall, and AP are shown below:

[0145]

[0146] Where P represents precision, R represents recall, TP represents the number of correctly classified positive samples, FP represents the number of falsely reported negative samples, and FN represents the number of falsely reported positive samples.

[0147] In one specific embodiment, the construction of the RSD-YOLO model is complete when the loss function value of the model on the training set tends to stabilize and the accuracy on the validation set is higher than 90%. The inference phase mainly involves acquiring real-time video image data of the reservoir through the Guangdong Water Conservancy Video Monitoring System. Each frame of the image is then read and the RSD-YOLO model is called for real-time detection and analysis, outputting the current flood discharge status information of the reservoir and providing early warnings for abnormal flood discharge phenomena. This helps reservoir managers to promptly identify potential safety hazards in the spillway and reduce the risk of inadequate flood discharge.

[0148] For a better explanation of the working principle and process of this invention, see [link to relevant documentation]. Figure 8 One example is a technical roadmap of a flood discharge detection model provided in an embodiment of the present invention.

[0149] This invention addresses the problem of limited sample size and narrow coverage due to low flood discharge event incidence by providing multiple sample augmentation strategies to balance sample distribution and increase sample quantity, thereby improving the model's generalization ability and robustness. It also reduces the computational load of the YOLOv8 model through lightweight modifications, ensuring real-time flood discharge detection. Furthermore, it enhances the model's feature extraction capabilities by modifying the feature fusion module, thus improving detection accuracy. Finally, the initial flood discharge detection model, obtained through structural modifications, is trained using a second training sample set obtained after sample augmentation, resulting in a high-precision and robust final flood discharge detection model. Compared to existing technologies, this invention improves the computational efficiency and target detection accuracy of flood discharge detection models in scenarios with limited sample data.

[0150] Example 2:

[0151] like Figure 9 As shown, this embodiment provides a flood discharge detection model training device, including a sample acquisition module 001 and a model training module 002, wherein,

[0152] The sample acquisition module 001 is used to select a portion of pre-collected video image data of the reservoir spillway as a first training sample set, and perform sample enhancement on the first training sample set according to a preset sample enhancement strategy to obtain a second training sample set; wherein, the sample enhancement strategy includes an independent enhancement strategy, a combined enhancement strategy, and a mosaic enhancement strategy.

[0153] In this embodiment, the independent enhancement strategy includes one or more combinations of the following: noise injection strategy, color transformation strategy, geometric transformation strategy, or weather simulation strategy; the sample acquisition module 001 performs sample enhancement on the first training sample set according to the preset sample enhancement strategy to obtain the second training sample set, including:

[0154] When the sample augmentation strategy is a noise injection strategy, a noise map of any noise type is superimposed on each original sample image in the first training sample set to obtain a second training sample set.

[0155] When the sample enhancement strategy is a color transformation strategy, each original sample image in the first training sample set is color transformed according to any color transformation mode to obtain the second training sample set; wherein, the color transformation mode includes HSV transformation mode, mean blur mode, contrast adjustment mode, brightness adjustment mode or histogram equalization mode.

[0156] When the sample augmentation strategy is a geometric transformation strategy, the original sample images in the first training sample set are subjected to geometric transformation according to any geometric transformation type to obtain the second training sample set; wherein, the geometric transformation type includes translation transformation, rotation transformation, scaling transformation, mirror flipping or image distortion;

[0157] When the sample enhancement strategy is a weather simulation strategy, the second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set through simulation technology.

[0158] The model training module 002 is used to train the pre-constructed initial flood discharge detection model according to the second training sample set to obtain the final flood discharge detection model; wherein, the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction and updating the feature fusion module.

[0159] In this embodiment, the model training module 002 trains the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model. This includes: the model training module 002 inputs the second training sample set into the backbone network layer of the initial flood discharge detection model to extract features through a stacked flood discharge convolutional feature extraction module, generating an initial feature map set; wherein the flood discharge convolutional feature extraction module includes a CBS module, a lightweight modified C2f module, an SPPF module, and a CSAM hybrid attention mechanism; and a preset multi-scale feature fusion module... The initial feature map set is fused to obtain a multi-scale feature map; wherein the multi-scale feature fusion module is obtained by parallel connection of dilated convolutional kernels and attention mechanism; based on the multi-scale feature map, output prediction is performed to obtain the output prediction result, and the target prediction result is evaluated by a preset comprehensive loss function to obtain the loss evaluation result; wherein the comprehensive loss function includes a classification loss function, a boundary regression loss function, and a focus loss function; based on the loss evaluation result, the parameters of the initial flood discharge detection model are updated to obtain the final flood discharge detection model.

[0160] For a more detailed explanation of the working principle and procedures of this embodiment, please refer to the relevant description in Embodiment 1.

[0161] This invention provides multiple sample enhancement strategies through the sample acquisition module 001 to balance sample distribution and increase the number of samples, solving the problem of insufficient sample size and narrow coverage caused by the low incidence of flood discharge events, thereby improving the model's generalization ability and robustness. Through the model training module 002, the YOLOv8 model is lightweighted to reduce the model's computational load, thereby ensuring the real-time performance of flood discharge detection. Furthermore, by modifying the YOLOv8 model's feature fusion module, the model's feature extraction capability is enhanced, thereby improving detection accuracy. Finally, the second training sample set obtained after sample enhancement is used to train the initial flood discharge detection model obtained after structural modification, thereby obtaining a high-precision and robust final flood discharge detection model.

[0162] Example 3:

[0163] This embodiment provides a terminal device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;

[0164] The memory is used to store at least one executable instruction that causes the processor to perform the operation of the flood discharge detection model training method as described in any of the above.

[0165] Example 4:

[0166] This invention provides a computer-readable storage medium including a stored computer program, wherein the computer program, when running, controls the device or apparatus containing the computer-readable storage medium to execute the flood discharge detection model training method as described in any of the above embodiments.

[0167] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0168] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A method for training a flood discharge detection model, characterized in that, include: The pre-collected video image data of the reservoir spillway is used as the first training sample set, and the first training sample set is augmented according to the preset sample augmentation strategy to obtain the second training sample set; wherein, the sample augmentation strategy includes one or more combinations of the following: independent augmentation strategy, combined augmentation strategy or mosaic augmentation strategy. Based on the second training sample set, the pre-constructed initial flood discharge detection model is trained to obtain the final flood discharge detection model; wherein, the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction module and updating the feature fusion module.

2. The flood discharge detection model training method as described in claim 1, characterized in that, The independent enhancement strategies include one or more combinations of the following: noise injection strategy, color transformation strategy, geometric transformation strategy, or weather simulation strategy; The step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes: When the sample augmentation strategy is a noise injection strategy, a noise map of any noise type is superimposed on each original sample image in the first training sample set to obtain a second training sample set. When the sample enhancement strategy is a color transformation strategy, each original sample image in the first training sample set is color transformed according to any color transformation mode to obtain the second training sample set; wherein, the color transformation mode includes HSV transformation mode, mean blur mode, contrast adjustment mode, brightness adjustment mode or histogram equalization mode. When the sample augmentation strategy is a geometric transformation strategy, the original sample images in the first training sample set are subjected to geometric transformation according to any geometric transformation type to obtain the second training sample set; wherein, the geometric transformation type includes translation transformation, rotation transformation, scaling transformation, mirror flipping or image distortion; When the sample enhancement strategy is a weather simulation strategy, the second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set through simulation technology.

3. The flood discharge detection model training method as described in claim 2, characterized in that, The weather simulation strategy includes a sunshine simulation strategy, a rain simulation strategy, a cloud and fog simulation strategy, or a snowflake simulation strategy. The second training sample set is obtained by performing weather simulation processing on each original sample image in the first training sample set using simulation technology, including: When the weather simulation strategy is a sunlight simulation strategy, the pre-generated halo map is linearly superimposed with each original sample image in the first training sample set through image fusion technology to obtain the second training sample set; wherein, the halo map is generated by performing attenuation simulation calculation of the light source component of randomly generated light source points in the corresponding original sample image through a mirror attenuation function. When the weather simulation strategy is a rain simulation strategy, the pre-generated rain pattern image is linearly superimposed with each original sample image in the first training sample set using image fusion technology to obtain the second training sample set; wherein, the rain pattern image is generated by color modulation and transparency control of the pre-generated rain line image; the rain line image is generated by drawing the length and tilt angle of the rain line with each raindrop as the starting point in the pre-created basic raindrop noise image; When the weather simulation strategy is a cloud and fog simulation strategy, fogging is applied to each original sample image in the first training sample set using a preset transmittance map to obtain a second training sample set. When the weather simulation strategy is a snowflake simulation strategy, the pre-generated final snowflake image is superimposed on each of the original sample images in the first training sample set using image fusion technology to obtain the second training sample set. The final snowflake image is generated by adjusting the transparency and controlling the brightness of several snowflakes in the pre-generated initial snowflake image. The initial snowflake image is obtained by generating several snowflakes on the corresponding original sample image through random point generation and masking operations.

4. The flood discharge detection model training method as described in claim 1, characterized in that, The step of performing sample augmentation on the first training sample set according to a preset sample augmentation strategy to obtain a second training sample set includes: When the sample augmentation strategy is a mosaic augmentation strategy, several original sample images are randomly selected from the first training sample set, and the original sample images are scaled to obtain scaled sample images, so as to stitch the scaled sample images into a new image with the same size as each original sample image. Continue to randomly select the same number of original sample images from the remaining original sample images in the first training sample set to stitch them together into a new image of the same size, until all original sample images have been stitched together; The newly stitched images are used as the second training sample set.

5. The flood discharge detection model training method as described in claim 1, characterized in that, The step of training the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model includes: The second training sample set is input into the backbone network layer of the initial flood discharge detection model to extract features through the stacked flood discharge convolutional feature extraction module and generate an initial feature map set; wherein, the flood discharge convolutional feature extraction module includes a CBS module, a lightweight modified C2f module, an SPPF module and a CSAM hybrid attention mechanism; The initial feature map set is fused using a pre-defined multi-scale feature fusion module to obtain a multi-scale feature map; wherein, the multi-scale feature fusion module is obtained by parallel connection of dilated convolution kernels and attention mechanism; Based on the multi-scale feature map, output prediction is performed to obtain the output prediction result. Then, the target prediction result is evaluated for loss using a preset comprehensive loss function to obtain the loss evaluation result. The comprehensive loss function includes a classification loss function, a boundary regression loss function, and a focus loss function. Based on the loss assessment results, the parameters of the initial flood discharge detection model are updated to obtain the final flood discharge detection model.

6. The flood discharge detection model training method as described in claim 5, characterized in that, The feature extraction process, which uses stacked flood discharge convolutional feature extraction modules to generate an initial feature map set, specifically involves: By using several layers of consecutive combined convolutional modules, multiple ordinary convolutions and depthwise separable convolutions are performed on the second training sample set in sequence to obtain a first feature map set containing feature maps at different levels; wherein, the combined convolutional module includes the CBS module and the C2f module after lightweight modification; The SPPF module is used to perform multi-scale spatial pooling on the highest-level feature map in the first feature map set to obtain the second feature map. The second feature map is enhanced using the CSAM hybrid attention mechanism to obtain the third feature map; The first feature map set, the second feature map, and the third feature map are merged to obtain the initial feature map set.

7. The flood discharge detection model training method as described in claim 5, characterized in that, The initial feature map set is fused using a preset multi-scale feature fusion module to obtain a multi-scale feature map, specifically as follows: By performing convolution operations on the initial feature map set using several convolutional blocks with different dilation rates, several first intermediate feature maps are obtained. By using a pre-defined hybrid attention mechanism, the first intermediate feature map is enhanced to obtain several second intermediate feature maps; The second intermediate feature map is then stitched together to obtain a multi-scale feature map.

8. A flood discharge detection model training device, characterized in that, It includes a sample acquisition module and a model training module, among which, The sample acquisition module is used to select a portion of pre-collected video image data of the reservoir spillway as a first training sample set, and perform sample enhancement on the first training sample set according to a preset sample enhancement strategy to obtain a second training sample set; wherein, the sample enhancement strategy includes independent enhancement strategy, combined enhancement strategy and mosaic enhancement strategy. The model training module is used to train the pre-constructed initial flood discharge detection model based on the second training sample set to obtain the final flood discharge detection model; wherein the initial flood discharge detection model is an improved YOLOv8 model obtained by modifying the flood discharge convolution feature extraction module and updating the feature fusion module.

9. A terminal device, characterized in that, include: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction that causes the processor to perform the operation of the flood discharge detection model training method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device or apparatus containing the computer-readable storage medium to perform the flood discharge detection model training method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent dike crack dangerous case identification method based on edge enhancement

    CN118865184A

  • Remote sensing target detection large model construction method based on context feature deep learning

    CN120356096A

  • Steel plate surface defect detection method based on improved YOLOv8

    CN120374543A

  • Method for detecting image target in smart home environment

    WO2021244079A1

Cited By

  • Motion detection and evaluation method based on single-stage model

    CN121686573A