Dam abnormal data generation method based on dynamic penalty weight CGAN

By using an AB-CGAN generator with dynamic penalty weights, combined with multi-head self-attention and BiLSTM structure, the problems of scarce abnormal samples and class imbalance in dam deformation monitoring are solved, generating high-quality abnormal samples that conform to temporal logic and physical laws, thus improving the performance of the detection model.

CN121935494APending Publication Date: 2026-04-28YUNNAN AGRICULTURAL UNIVERSITY +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YUNNAN AGRICULTURAL UNIVERSITY
Filing Date
2025-12-17
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In dam deformation monitoring, there is a scarcity of abnormal samples, imbalance of data categories, and insufficient performance of existing detection models. Traditional generative models suffer from poor training stability, weak environmental adaptability, and insufficient authenticity and physical consistency of generated samples, making it difficult to meet the needs of high-precision and high-reliability dam safety monitoring.

Method used

A conditional generative adversarial network based on dynamic penalty weights (AB-CGAN) is adopted, which combines multi-head self-attention and BiLSTM generator structure. Through dynamic gradient penalty weight mechanism and Wasserstein adversarial training, abnormal samples that conform to temporal logic and physical laws are generated.

Benefits of technology

It significantly improves the training stability and sample quality of generative adversarial networks in the task of generating abnormal data for dams. The generated abnormal samples conform to statistical distribution and satisfy physical laws, which alleviates the problems of abnormal sample scarcity and class imbalance, and improves the performance of the anomaly detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121935494A_ABST
    Figure CN121935494A_ABST
Patent Text Reader

Abstract

The invention discloses a dam abnormal data generation method based on a dynamic penalty weight CGAN, and belongs to the technical field of hydraulic structure safety monitoring and intelligent analysis. Aiming at the problems of unstable training, fixed penalty coefficient and insufficient authenticity of generated samples in dam monitoring data modeling of a traditional generative adversarial network, a dynamic penalty weight mechanism is introduced into a Wasserstein adversarial training framework, gradient penalty intensity is adaptively adjusted according to fluctuation of environmental variables such as water level and air temperature, and the dynamic penalty weight mechanism is introduced into the Wasserstein adversarial training framework. Keeping balance training of the model under different working conditions; and meanwhile, a multi-head self-attention mechanism and a bidirectional long-short-term memory network are combined in the generator to realize joint modeling of global association and local time sequence characteristics, so that a high-quality abnormal sample conforming to a dam physical rule is generated. Experiments show that the method can significantly improve the diversity and authenticity of generated data, enhances the accuracy, recall rate and AUC index of a downstream anomaly detection model, and has high engineering application value and popularization potential.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of safety monitoring and intelligent analysis of water conservancy and hydropower projects, and in particular to a method for generating dam anomaly data based on dynamic penalty weighted CGAN. Background Technology

[0002] As the core structure of water conservancy projects, dams are directly related to socio-economic development and the safety of people's lives and property. During long-term service, dams are affected by factors such as water level fluctuations, temperature changes, geological conditions, material aging, earthquakes, and floods, resulting in significant time-varying and complex structural deformation. Anomalies in deformation are often precursors to potential structural risks, and accurate identification of anomalous data is a crucial task for dam safety monitoring and risk early warning. However, in actual monitoring, anomalous data is generally scarce and complex in type. For example, isolated points, abrupt changes, and drift anomalies may all appear in time-series data, but their frequency is extremely low, causing severe imbalance in sample classes. This imbalance can cause classification models to favor the majority class (normal samples) during training, thus weakening the ability to identify anomalies. Furthermore, insufficient numbers of anomalous samples can limit the feature learning ability of deep learning models, leading to insufficient generalization performance.

[0003] Traditional statistical models (such as the HST model and multiple regression analysis) are simple in structure and highly interpretable, but they struggle to characterize complex nonlinear relationships and are sensitive to outliers. SMOTE generates new samples through feature space interpolation, but it cannot preserve the temporal dependencies and physical laws of the data. VAEs rely on prior distribution assumptions, resulting in insufficient diversity of generated samples. While traditional GANs can learn data distributions, they are prone to problems such as gradient vanishing and pattern collapse during training, limiting the authenticity and stability of generated samples. Furthermore, in dam deformation monitoring, environmental factors (such as water level and temperature) exhibit significant dynamic changes, and their nonlinear fluctuations directly affect the distribution characteristics of deformation responses, thus increasing the training difficulty of generative models. Dam deformation is closely related to environmental quantities such as water level and temperature, and this relationship is dynamic and nonlinear. Although traditional CGANs (Conditional Generative Adversarial Networks) introduce conditional information, their fixed loss weights and penalty mechanisms cannot adapt to the drastic fluctuations in environmental variables. When external operating conditions change, a fixed gradient penalty coefficient is insufficient to maintain the dynamic balance between the generator and discriminator, easily leading to training oscillations, gradient explosion, or mode collapse. Dam monitoring data is a typical multivariate time series, containing both local temporal dependencies and global physical correlations. The structural design of traditional generative models (such as standard GANs or VAEs) is difficult to effectively capture both of these characteristics simultaneously, resulting in generated anomalous samples that are logically illogical in their temporal sequence or violate the basic laws of dam structural mechanics, thus having low practicality. Therefore, there are significant shortcomings in the generation of dam anomaly data, such as poor training stability, weak environmental adaptability, and insufficient authenticity and physical consistency of generated samples, making it difficult to meet the requirements of high-precision, high-reliability dam safety monitoring for high-quality anomaly data. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a method for generating dam anomaly data based on Dynamic Penalty Weighted Anomaly AN (CGAN), which solves the problems of scarce anomaly samples, imbalanced data categories, and insufficient performance of existing detection models in dam deformation monitoring.

[0005] To achieve the above technology, the specific steps are as follows: S1. Data Preprocessing and Condition Vector Construction: Input the original dam deformation monitoring time series data and the original environmental variable data. After missing value processing, outlier removal, normalization processing and time alignment operations, output the preprocessed deformation monitoring time series data and the time-aligned environmental condition vector. The original dam deformation monitoring time series data includes: horizontal displacement, vertical displacement, settlement, strain, and seepage pressure; The original environmental variable data includes: upstream water level, downstream water level, and temperature data.

[0006] S2. Construction of Simulated Anomaly Test Set: Based on the preprocessed deformation monitoring time series data, three types of simulated anomalies are manually inserted to obtain a simulated anomaly test set for Transformer encoder anomaly detection. The three types of simulated anomalies include: outlier anomalies, oscillation anomalies, and ridge anomalies.

[0007] S3. Constructing the AB-CGAN model structure: Based on random noise and time-aligned environmental condition vectors, abnormal time series data are generated through forward propagation of the generator, and the discriminator network outputs the authenticity score through forward propagation, thus completing the construction of the AB-CGAN model structure.

[0008] S3.1 Generator Network Forward Propagation Generates Abnormal Temporal Data: Input random noise vector and time-aligned environmental condition vector, pass through the generator's feature extraction layer, position encoding layer, multi-head self-attention layer, BiLSTM layer and output layer, and output the generated abnormal temporal data; The feature extraction layer is specifically a multilayer perceptron mapped to a 256-dimensional feature space, activated and batch normalized using the LeakyReLU function; Specifically, the location encoding layer expands the feature dimension to 256; The multi-head self-attention layer includes 4 attention heads; The BiLSTM layer consists of two bidirectional LSTM layers with a hidden dimension of 128. The output layer specifically outputs 24 time-steps of abnormal timing data after passing through a fully connected layer.

[0009] S3.2, Discriminator Network Forward Propagation: Input time series data and pair-aligned conditional vectors, after the conditional concatenation module of the discriminator outputs the conditional feature sequence, it passes through the self-attention mechanism module and the BiLSTM feature extraction module in sequence to output the global sequence feature vector, and then the feature fusion is performed to obtain the combined feature tensor. After passing through the discriminator layer module and the data encoder, the authenticity score is output. The time series data is either generated abnormal time series data or actual monitoring time series data; The conditional splicer is a multilayer perceptron consisting of a fully connected layer, a LeakyReLU activation function, and a one-dimensional batch normalization layer. The self-attention mechanism module includes: the number of attention heads is set to 4, the subspace dimension of each attention head is 64, and the hidden layer dimension is 256; The BiLSTM feature extraction module is configured as a 2-layer LSTM with an input feature dimension of 256, a hidden layer dimension of 128, and an output feature dimension of 256. The feature fusion specifically involves concatenating the global sequence feature vector and the last time step vector of the conditional feature sequence along the feature dimension. The discriminant layer module adopts a multilayer perceptron structure, specifically consisting of a fully connected layer that maps dimensions from 512 to 256, a LeakyReLU activation function, a regularization layer with a Dropout ratio of 0.3, and an output layer that maps dimensions from 256 to 1. The data encoder employs a two-layer fully connected network, with each layer followed by a LeakyReLU activation function to map the original input data to a 256-dimensional hidden space.

[0010] S4. Dynamic gradient penalty weight calculation: Based on the AB-CGAN model, the current batch environment condition vector is input, the dynamic gradient penalty weight mechanism is executed, and the dynamic gradient penalty weight is output.

[0011] Generator total loss L G It consists of a Wasserstein adversarial term and a gradient penalty term, L gp Here, λ(t) represents the gradient penalty term, and λ(t) represents the dynamic penalty weight. The expression for calculating the dynamic gradient penalty weight is as follows: in, λ 0∈[5,15] is the baseline penalty coefficient. This represents the volatility of the current batch's environmental condition vector. For historical average fluctuations, ∈[0.5,2.0] represents the environmental sensitivity coefficient. The gradient balance adjustment coefficient controls the gradient difference between the generator and the discriminator. λ(t) The rate of exponential decay, It is a constant. , These are the gradient norms of the generator and discriminator, respectively, for the current training step.

[0012] S5. Wasserstein target loss function calculation: Based on dynamic gradient penalty weights, authenticity scores, and interpolated samples, the Wasserstein target loss function is constructed. Through discriminator loss calculation and generator loss calculation, the discriminator loss value and generator loss value are output.

[0013] The expression for the Wasserstein objective loss function in this invention is as follows: In the formula, E is the expectation operator. For Euclidean norm operators, The gradient penalty coefficient is... , For fake samples generated by generator G, For positive samples from the real dataset, , Let c be the actual data distribution under the environmental condition vector. The generated data distribution is given by the environmental condition vector c. For gradient operators; The Wasserstein objective loss function of this invention is to maximize the generator loss and minimize the discriminator loss; The generator loss calculation expression is as follows: Among them, the total generator loss L G It consists of a Wasserstein adversarial term and a gradient penalty term, L gp Here, λ(t) represents the gradient penalty term, λ(t) represents the dynamic penalty weight, D represents the discriminator, G represents the generator, and E represents the expectation operator. Accordingly, the discriminator loss calculation expression is as follows: The discriminator loss consists of the Wasserstein distance between the real samples and the generated samples, as well as a gradient penalty term. x For real data, G ( z,c ) represents the generated sample, z is the random noise vector, c is the condition vector, and λ(t) is the dynamic penalty weight.

[0014] S6, AB-CGAN model training: Based on the discriminator loss value and the generator loss value, the model parameters of the generator and discriminator are updated by the Adam optimizer and the preset discriminator and generator update ratio, so as to obtain the trained generator and discriminator.

[0015] S7. Downstream Anomaly Detection Model Training and Evaluation: After generating anomaly samples through the trained generator, the anomaly samples are merged with real data to form an augmented dataset. The augmented dataset and the simulated anomaly test dataset are input, and the downstream anomaly detection model is trained using a Transformer encoder. The performance evaluation metrics are then output.

[0016] The performance evaluation metrics include: accuracy, precision, recall, F1 score, and ROC-AUC; The Transformer encoder contains two stacked encoder layers, each containing a multi-head self-attention mechanism and a feedforward neural network. The hidden layer feature dimension of the Transformer encoder is set to 64. The feedforward neural network is located after the multi-head attention mechanism and consists of two linear transformation layers and an activation function in between; the dimension of the hidden layer is set to 128, and the operation of first increasing the dimension and then decreasing the dimension is performed: 64 → 128 → 64.

[0017] The beneficial effects of this invention are: (1) This invention significantly improves the training stability and sample quality of generative adversarial networks in the task of generating abnormal dam data by introducing an environment-adaptive dynamic penalty weight mechanism into Wasserstein adversarial training and combining it with a multi-head self-attention and BiLSTM generator structure. This method can adaptively adjust the penalty intensity according to environmental fluctuations such as water level and temperature, ensuring balanced training of the model under different working conditions; the designed generator can collaboratively capture the global correlation and local dependency of time-series data, so that the generated abnormal samples conform to both statistical distribution and physical laws, effectively alleviating the problems of abnormal sample scarcity and class imbalance.

[0018] (2) This invention achieves effective complementarity between BiLSTM and multi-head self-attention mechanism in the generator. BiLSTM accurately captures local temporal dependencies, while the self-attention mechanism controls the global feature association across time steps. The two work together to ensure that the generated samples have both local realism and global rationality. The Wasserstein loss framework and dynamic gradient penalty mechanism work together in depth. The latter, as a bridge connecting the dynamics of the environment and the training state of the model, realizes the adaptive adjustment of environmental sensitivity against training intensity, so that the model can maintain efficient and stable learning under different working conditions. Attached Figure Description

[0019] Figure 1 This is a flowchart of a method for generating dam anomaly data based on dynamic penalty weighted CGAN according to the present invention; Figure 2 This is a technical roadmap of the present invention; Figure 3 This is a schematic diagram of the multi-head self-attention mechanism of the present invention; Figure 4 This is a schematic diagram of the BiLSTM structure of the present invention; Figure 5 This is a schematic diagram of the AB-CGAN architecture of the present invention; Figure 6 This is a bar chart showing the performance indicators of the present invention; Figure 7 This is a comparison chart of the ROC curves of the present invention. Detailed Implementation

[0020] The present invention will be further described in detail below with reference to specific embodiments.

[0021] like Figures 1-2 As shown, the dam deformation anomaly data generation method based on improved conditional generative adversarial network (AB-CGAN) proposed in this invention mainly includes two parts: time series feature extraction process and WGAN-GP training process. The specific steps are as follows: S1. Data Preprocessing and Condition Vector Construction: Input the original dam deformation monitoring time series data and the original environmental variable data. After missing value processing, outlier removal, normalization processing and time alignment operations, output the preprocessed deformation monitoring time series data and the time-aligned environmental condition vector. The original dam deformation monitoring time series data includes: horizontal displacement, vertical displacement, settlement, strain, and seepage pressure; The original environmental variable data includes: upstream water level, downstream water level, and temperature data; This embodiment selects a concrete hyperbolic arch dam as the research object, and collects deformation monitoring data of the concrete hyperbolic arch dam for many consecutive years, as well as corresponding environmental variable data, including upstream water level, downstream water level and temperature data.

[0022] To ensure the integrity and consistency of the input data, this invention employs a systematic preprocessing workflow, specifically including the following steps: (1) Handling missing values: Data is filled by combining forward filling and backward filling.

[0023] (2) Outlier removal: Deleting outlier measurement points according to the 3σ principle.

[0024] (3) Normalization: Use MinMaxScaler to map the data to the [0,1] interval to unify the features of different dimensions.

[0025] (4) Time alignment: Unify the time index to ensure that data from different sensors are aligned on the time axis.

[0026] (5) Constructing condition vectors: For each dam deformation monitoring time series data with a length of 24, select the environmental variable data corresponding to the last time step of the sequence as the condition vector.

[0027] Specifically, the process begins with time format standardization, converting the time columns of both the original dam deformation monitoring time series data and the original environmental variable data into a standardized time format. Next, independent completion is performed, using linear interpolation and forward / backward padding strategies to handle missing values ​​in both the deformation and environmental data before merging. Then, timestamp-based merging is executed, using the time column as the key and outer joins to align the two types of data, ensuring all time points are preserved. Subsequently, overall interpolation is performed, again linearly interpolating or padding for missing values ​​resulting from inconsistent sampling frequencies after merging, ensuring data integrity at each time step. Finally, sequence-condition alignment is performed when building the model input; for each 24-byte dam deformation monitoring time series, the environmental variable data corresponding to the last time step of the sequence is selected as the condition input, achieving a strict correspondence between time series characteristics and environmental conditions.

[0028] In this invention, environmental variable data is extracted separately and input as conditional variables into the subsequent model so that the generative adversarial network can generate time series samples that conform to physical laws under given environmental conditions.

[0029] S2. Construction of Simulated Anomaly Test Set: Based on the preprocessed deformation monitoring time series data, three types of simulated anomalies are manually inserted to obtain a simulated anomaly test set for Transformer encoder anomaly detection. The three types of simulated anomalies include: outlier anomalies, oscillation anomalies, and ridge anomalies; Because abnormal samples are scarce in real monitoring data, this invention constructs a test dataset for transformer anomaly detection by manually inserting anomalies to verify the effectiveness of the data augmentation method. This invention simulates three typical anomalies, specifically including the following steps: (1) Outlier anomalies are used to simulate spike responses caused by sensor failures or transient shocks; for The time period is randomly selected from the sequence. For each time point, the mathematical expression is: in, For the original detection data in time The value, For outlier amplitude, For Dirac functions, t i For randomly selected abnormal locations, For small perturbations, Δt =24 is the length of the abnormal window. For time indexing, This is the start time of the exception window.

[0030] (2) Oscillation anomalies are used to simulate oscillation responses caused by periodic loads or resonance effects: for The time period, expressed mathematically, is: in, The amplitude of the fluctuation. It is a period of oscillation. This is a small perturbation.

[0031] (3) Ridge anomalies are used to simulate the abnormal trend of a slow rise followed by a rapid fall caused by accumulated load: for The time period, expressed mathematically, is: in, For the amplitude of the ridge anomaly, For the Hanning window function, , This is a small perturbation.

[0032] The insertion location and magnitude of the three types of anomalies are determined by a random strategy, and the anomaly window length Δt is set to 24 hours.

[0033] S3. Constructing the AB-CGAN model structure: Based on random noise and time-aligned environmental condition vectors, abnormal time series data are generated through forward propagation of the generator, and the discriminator network outputs the authenticity score through forward propagation, thus completing the construction of the AB-CGAN model structure.

[0034] S3.1 Generator Network Forward Propagation Generates Abnormal Temporal Data: Input random noise vector and time-aligned environmental condition vector, pass through the generator's feature extraction layer, position encoding layer, multi-head self-attention layer, BiLSTM layer and output layer, and output the generated abnormal temporal data; In this invention, the random noise vector z and the time-aligned environmental condition vector c are processed through the generator's feature extraction layer, position encoding layer, multi-head self-attention layer, BiLSTM layer and output layer to output the generated abnormal time series data. The feature extraction layer is specifically a multilayer perceptron mapped to a 256-dimensional feature space, activated and batch normalized using the LeakyReLU function.

[0035] The positional encoding layer specifically involves introducing learnable positional encoding to maintain sequence order, thereby expanding the features to [batch size, 24, 256].

[0036] The multi-head self-attention layer specifically consists of four attention heads that capture global dependencies at different time steps.

[0037] The BiLSTM layer consists of two bidirectional LSTM layers with a hidden dimension of 128.

[0038] The output layer specifically outputs 24 time-steps of abnormal timing data after passing through a fully connected layer.

[0039] After embedding environmental data, this invention uses an improved conditional generative adversarial network (AB-CGAN) based on a multi-head self-attention mechanism and a bidirectional long short-term memory network (BiLSTM) to generate anomalous data.

[0040] Among them, multi-head self-attention mechanisms can effectively capture long-range dependencies in time-series data, improving the model's cross-dimensional modeling capabilities, such as... Figure 3 As shown, the specific implementation includes three stages, including the following steps: (1) Decoupling of characteristic subspace: Timing input matrix (T is the time step, d is the feature dimension), heterogeneous feature representations are generated through h independent linear projection layers: in, Each set of projection parameters learns a different feature map. Extract query features related to the target location. Extract key features for comparison with other locations. Extract the features of the content to be aggregated.

[0041] (2) Parallel attention head computation: Perform scaled dot product attention independently in each subspace: In the formula, It is an unnormalized incidence matrix. This is a scaling factor to prevent the softmax gradient from vanishing due to excessively large dot product magnitudes. This is the softmax activation function.

[0042] (3) Multi-head feature fusion: The outputs of each attention point are concatenated, and heterogeneous information is integrated using learnable weights: in To reconstruct the feature matrix, the features will be spliced ​​together. Map back to the original dimension.

[0043] Bidirectional Long Short-Term Memory (BiLSTM) networks, as an advanced variant of recurrent neural networks (RNNs), effectively overcome the limitation of traditional unidirectional recurrent networks that can only utilize contextual information by fusing LSTM units in both forward and backward directions. This enables bidirectional temporal dependency modeling of time series data, as illustrated in the diagram below. Figure 4 As shown, its specific implementation formula is as follows: (1) Forget Gate: In the formula, f t Is the Gate of Oblivion in Time Step t The output, σ It is the sigmoid function. W f and b f These are the weights and biases of the forget gate. h t-1 It is the hidden state of the previous time step. x t This is the input for the current time step.

[0044] (2) Input Gate: In the formula, i t Is the Gate of Oblivion in Time Step t The output, σ yes sigmoid function, W i and b i These are the weights and biases of the input gate.

[0045] (3) Cell State Renewal: In the formula, It is a new cellular state. W c and b c These are weights and biases related to cell state updates.

[0046] (4) Cell State: In the formula, C t It represents the cell state at the current time step. C t-1It represents the cell state at the previous time step.

[0047] (5) Output Gate: In the formula, the output gate in time t The output is o t The weights and bias terms of the output gate are respectively W o and b o .

[0048] (6) Hidden State Update: In the formula, h t It is the hidden state of the current time step.

[0049] In BiLSTM, the forward LSTM layer generates a forward hidden state sequence. The inverse LSTM layer generates a sequence of inverse hidden states. The final output of BiLSTM is the concatenation of these two hidden state sequences. .

[0050] S3.2 Discriminator Network Forward Propagation: Input time series data and pair-aligned conditional vectors, after the conditional concatenation module of the discriminator outputs the conditional feature sequence, it passes through the self-attention mechanism module and the BiLSTM feature extraction module in sequence to output the global sequence feature vector, and then performs feature fusion to obtain the combined feature tensor. Finally, it passes through the discriminator layer module and the data encoder to output the authenticity score.

[0051] Specifically, in this invention, the discriminator module receives time-series deformation data and environmental condition vectors, and outputs a data authenticity score. The specific configuration is as follows, where the batch size is 64: The time series data is either generated abnormal time series data or actual monitoring time series data; The dimensions of the time-series data tensor are set to [batch size, 24, 1], representing a single-dimensional deformable feature sequence containing 24 time steps; The dimension of the conditional vector for pair alignment is set to [batch size, 3], and it includes three environmental features: upstream water level, downstream water level, and air temperature. In terms of feature processing and concatenation, the conditional vectors for pair alignment are first input to a conditional encoder, which is implemented by a multilayer perceptron (MLP) consisting of fully connected layers, a LeakyReLU activation function, and a one-dimensional batch normalization layer (BatchNorm1d), mapping it to a 256-dimensional hidden layer space. Subsequently, the encoded conditional feature vectors are expanded to a shape of [batch size, 24, 256] to align with the deformed feature sequence in the temporal dimension, resulting in a conditional feature sequence.

[0052] The discriminator also integrates a self-attention module, placed before the BiLSTM module. This attention module employs a multi-head attention mechanism, treating the data features themselves as queries, keys, and values ​​for computation. The number of attention heads is set to four, with each attention head having a subspace dimension of 64, maintaining a total hidden layer dimension of 256, thus effectively capturing long-distance temporal dependencies.

[0053] The discriminator includes a Bidirectional Long Short-Term Memory (BiLSTM) module for extracting temporal features. This BiLSTM module is configured with two layers, with an input feature dimension of 256 and a hidden layer dimension of 128. Due to the bidirectional structure, the outputs of the forward and backward passes are concatenated, and the final output feature dimension remains at 256. Furthermore, the BiLSTM is set to batch_first=True mode and integrates a Dropout layer to prevent overfitting. The feature sequence output by the BiLSTM undergoes global average pooling to obtain a global sequence feature vector with dimensions [batch size, 256].

[0054] During the feature fusion stage, the global sequence feature vector output by the BiLSTM and the last time step vector of the conditional feature sequence, with dimensions [batch size, 256], are concatenated along the feature dimension to form a combined feature tensor with dimensions [batch size, 512].

[0055] The combined feature tensor is then input to the discriminant layer module, which also employs a multilayer perceptron structure, comprising: a fully connected layer mapping dimensions from 512 to 256, a LeakyReLU activation function, a regularization layer with a Dropout ratio of 0.3, and an output layer mapping dimensions from 256 to 1. The final output is a tensor with dimensions [batch size, 1], representing the probability score that the input sample is real data.

[0056] The data encoder employs a two-layer fully connected network, with each layer followed by a LeakyReLU activation function, mapping the raw input data to a 256-dimensional hidden space. The entire network structure is trained end-to-end to distinguish between synthetic data generated by the generator and real monitoring data, ultimately outputting a realism score. The AB-CGAN model structure is as follows: Figure 5 As shown.

[0057] S4. Dynamic gradient penalty weight calculation: Based on the AB-CGAN model, input the current batch environment condition vector, execute the dynamic gradient penalty weight mechanism, and output the dynamic gradient penalty weight; Generator total loss L G It consists of a Wasserstein adversarial term and a gradient penalty term, L gp Here, λ(t) represents the gradient penalty term, and λ(t) represents the dynamic penalty weight. The expression for calculating the dynamic gradient penalty weight is as follows: in, λ 0∈[5,15] is the baseline penalty coefficient. This represents the volatility of the current batch's environmental condition vector. For historical average fluctuations, ∈[0.5,2.0] represents the environmental sensitivity coefficient. The gradient balance adjustment coefficient controls the gradient difference between the generator and the discriminator. λ(t) The rate of exponential decay, It is a constant. , These are the gradient norms of the generator and discriminator, respectively, for the current training step.

[0058] In this study, a baseline penalty coefficient λ0 < 5 indicates a weak gradient constraint, which may cause the discriminator to overfit the real samples, making it difficult for the generator to effectively combat outliers and resulting in decreased generation quality. Conversely, if λ0 > 15, the gradient constraint is too strong, leading to overly smooth training and making it difficult for the generator to fit subtle perturbations in real deformation data, such as minor seasonal variations. Dam deformation data exhibits multi-scale fluctuations, including stable, periodic, and abrupt changes. Therefore, λ0 must fall within a range that allows for stable training without smoothing out real perturbations. Experiments on dam monitoring data have shown that λ0 is optimal between 5 and 15.

[0059] Due to environmental sensitivity coefficient η To amplify the relative fluctuation term of environmental disturbances, and to avoid excessive compression or amplification of environmental changes, this invention will... η Limited to multiples of 1 above and below. If η If the gradient value is less than 0.5, the impact of environmental changes on the gradient penalty will be significantly weakened, and the dynamic adjustment effect will be insufficient; if η If the value is greater than 2.0, environmental disturbances will be excessively amplified, causing severe oscillations in the penalty weight λ(t), thus affecting the stability of adversarial training. Through theoretical stability analysis and extensive experimental verification, η The optimal interval is [0.5, 2.0].

[0060] S5. Wasserstein target loss function calculation: Based on dynamic gradient penalty weights, authenticity scores and interpolated samples, the Wasserstein target loss function is constructed. Through discriminator loss calculation and generator loss calculation, the discriminator loss value and generator loss value are output. This invention uses Wasserstein distance as the loss function and introduces a dynamic penalty coefficient adjustment module to improve training stability. Specifically: From a mathematical perspective, when using the Wasserstein distance optimization framework (i.e., Wasserstein GAN, WGAN), its core advantage lies in providing effective gradient signals even when the generated distribution does not overlap with the real distribution. The expression for the Wasserstein objective loss function is: In the formula, E is the expectation operator. For Euclidean norm operators, The gradient penalty coefficient is... , For fake samples generated by generator G, For positive samples from the real dataset, , Let c be the actual data distribution under the environmental condition vector. The generated data distribution is given by the environmental condition vector c. This is the gradient operator.

[0061] In the adversarial training process of this invention, considering the characteristics of periodicity and abrupt changes in environmental variables such as water level and temperature during dam operation, a dynamic penalty coefficient adjustment module is used to achieve gradient balance optimization.

[0062] Specifically, the generator loss is calculated as follows: Among them, the total generator loss L G It consists of a Wasserstein adversarial term and a gradient penalty term, L gp Here, λ(t) represents the gradient penalty term, λ(t) represents the dynamic penalty weight, D represents the discriminator, G represents the generator, and E represents the expectation operator. Accordingly, the discriminator loss calculation can be expressed as: The discriminator loss consists of the Wasserstein distance between the real samples and the generated samples, as well as a gradient penalty term. x For real data, G ( z,c ) represents the generated sample, z is the random noise vector, c is the condition vector, and λ(t) is the dynamic penalty weight.

[0063] The module calculates the fluctuation indicators (standard deviation or rate of change) of environmental variables in real time through a sliding window, and dynamically adjusts the penalty weight λ(t) based on the gradient difference between the generator and discriminator, thereby achieving adaptive adjustment of Wasserstein training. This module can update λ(t) every few training batches (e.g., 5–10), improving training stability while maintaining the strength of adversarial constraints.

[0064] S6, AB-CGAN model training: Based on the discriminator loss value and the generator loss value, the model parameters of the generator and discriminator are updated by the Adam optimizer and the preset discriminator and generator update ratio, so as to obtain the trained generator and discriminator, and complete the dam anomaly data generation method based on dynamic penalty weight CGAN. The specific training strategy in this embodiment is as follows: the optimizer is Adam, and the learning rate is 1×10⁻⁶. -4 β1=0, β2=0.9; the discriminator to generator update ratio is 5:1; training iterations continue until the Wasserstein loss converges.

[0065] S7. Downstream Anomaly Detection Model Training and Evaluation: After generating anomaly samples through the trained generator, the anomaly samples are merged with real data to form an augmented dataset. The augmented dataset and the simulated anomaly test dataset are input, and the downstream anomaly detection model is trained by using a Transformer encoder, and the performance evaluation index is output. The downstream anomaly detection model is a time-series classifier based on the Transformer architecture. Its input is a monitoring sequence, and its output is the probability that the sequence is an anomaly. After training, anomaly samples are generated under different environmental conditions using a generator, and then merged with real data to form an augmented dataset. A Transformer encoder is used as the downstream anomaly detection classifier, and the performance of the original data, SMOTE, VAE, GAN, and the augmented AB-CGAN of this invention are compared.

[0066] The Transformer encoder module is used to extract deep features from time-series data, and its network structure consists of multiple stacked encoder layers. Specific parameter configurations are as follows: The Transformer encoder contains two stacked encoder layers. Each encoder layer contains a multi-head self-attention mechanism and a feedforward neural network. The encoder layer also introduces a random deactivation mechanism with a dropout value of 0.15. The hidden layer feature dimension of the Transformer encoder is set to 64.

[0067] The multi-head self-attention mechanism is configured with four attention heads that are computed in parallel. During the self-attention computation, the input features are linearly projected into query, key, and value vectors, where the subspace dimension corresponding to each attention head is 16 (i.e., the total dimension of 64 divided by the number of heads of 4), to ensure the efficiency of multi-head parallel computation and the diversity of feature extraction.

[0068] The feedforward neural network, located after the multi-head attention mechanism, consists of two linear transformation layers and an intermediate activation function. Its internal hidden layers have a dimension of 128; by first increasing the dimension and then decreasing it (64 → 128 → 64), the model's ability to fit nonlinear features is enhanced.

[0069] Furthermore, to improve the model's generalization ability and prevent overfitting, a random deactivation mechanism with a Dropout value of 0.15 is introduced into the encoder layer, and layer normalization is used to standardize the features. Through this hierarchical structure, the entire Transformer encoder effectively captures long-range dependencies and complex patterns in the input time-series data.

[0070] Evaluation metrics: Accuracy, Precision, Recall, F1 score, and ROC-AUC. Specifically: (1) Accuracy: Represents the proportion of correctly classified samples out of the total samples, and is expressed as follows: (2) Precision: Represents the proportion of samples that are actually abnormal out of all those predicted as abnormal. The expression is as follows: (3) Recall: Represents the proportion of samples that are truly anomalous that are successfully predicted by the model. The expression is as follows: (4) F1 score: The harmonic mean of precision and recall, which is an important indicator for evaluating the overall performance of the model. The expression is as follows: (5) The ROC curve (Receiver Operating Characteristic Curve) is a powerful tool for evaluating the performance of binary classification models. It visually demonstrates the model's performance at different thresholds by comparing the relationship between the model's predicted probabilities and the true labels. The expression is shown below: In the formula, T PR F PR Here are the ordinates and abscissas of the ROC curve; the closer the ROC curve is to the upper left corner, the better the model's performance. A UC AUC area (m 2 The AUC value ranges from 0 to 1. The closer the AUC value is to 1, the better the classification performance of the model, because it represents the probability that the model will rank a randomly selected positive sample before a negative sample.

[0071] like Figure 6 and Figure 7 As shown, experimental results demonstrate that, in order to verify this invention, the following is true: The model trained on the original dataset had an AUC of only 0.725; SMOTE, VAE, and GAN improved the AUC to 0.755, 0.860, and 0.895, respectively; the AB-CGAN augmented data model of this invention achieved an AUC of 0.952 and an F1 score of 86.43%, significantly outperforming other methods in terms of accuracy, recall, and other metrics.

[0072] In summary, this invention proposes a method for generating abnormal dam deformation data based on a conditional generative adversarial network (AB-CGAN) with multi-source environmental coupling and dynamic penalty weights, and makes targeted improvements to both the model structure and training strategy. Compared with traditional GAN-like methods, this invention has the following comprehensive advantages: (1) Dual feature capture mechanism: By combining a multi-head self-attention mechanism with a bidirectional long short-term memory network (BiLSTM) in the generator, we can achieve collaborative modeling of global dependencies and local temporal features, which can capture long-term trend changes while maintaining the integrity of short-term response features.

[0073] (2) Dynamic gradient penalty balancing strategy: In the Wasserstein adversarial training framework, a dynamic penalty weight coefficient based on environmental variable fluctuations is introduced, allowing the gradient regularization strength to adaptively adjust with environmental changes. This mechanism enhances stability under drastic operating conditions and accelerates convergence under stable conditions, effectively improving the training efficiency and generation quality of the model.

[0074] The abnormal data generation effect is significant: Experimental results show that the abnormal samples generated by the method of this invention can significantly expand the dataset size, alleviate the problems of abnormal sample scarcity and class imbalance, and enable the anomaly detection model to significantly improve the accuracy, recall, F1 score and AUC of traditional SMOTE, VAE and standard GAN.

[0075] (3) High engineering adaptability and promotion value: The algorithm of this invention can be embedded into existing dam safety monitoring systems to achieve online data enhancement and intelligent early warning. It has good versatility and scalability and can be extended to other engineering monitoring fields such as bridge health monitoring, tunnel deformation analysis and subway structural safety assessment.

[0076] Through the above innovative design, this invention not only solves the problems of training instability, lack of environmental modeling and insufficient physical constraints in the generation of abnormal dam deformation data by traditional CGAN, but also provides a new technical approach for realizing intelligent and data-driven dam safety monitoring.

[0077] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for generating dam anomaly data based on Dynamic Penalty Weighted Anomaly AN, characterized in that, Specifically, the following steps are included: S1. Data Preprocessing and Condition Vector Construction: Input the original dam deformation monitoring time series data and the original environmental variable data. After missing value processing, outlier removal, normalization processing and time alignment operations, output the preprocessed deformation monitoring time series data and the time-aligned environmental condition vector. The original dam deformation monitoring time series data includes: horizontal displacement, vertical displacement, settlement, strain, and seepage pressure; The original environmental variable data includes: upstream water level, downstream water level, and temperature data; S2. Construction of Simulated Anomaly Test Set: Based on the preprocessed deformation monitoring time series data, three types of simulated anomalies are manually inserted to obtain a simulated anomaly test set for Transformer encoder anomaly detection; The three types of simulated anomalies include: outlier anomalies, oscillation anomalies, and ridge anomalies; S3. Constructing the AB-CGAN model structure: Based on random noise and time-aligned environmental condition vectors, abnormal time series data are generated through forward propagation of the generator, and the discriminator network outputs the authenticity score through forward propagation, thus completing the construction of the AB-CGAN model structure. S4. Dynamic gradient penalty weight calculation: Based on the AB-CGAN model, input the current batch environment condition vector, execute the dynamic gradient penalty weight mechanism, and output the dynamic gradient penalty weight; S5. Wasserstein target loss function calculation: Based on dynamic gradient penalty weights, authenticity scores and interpolated samples, the Wasserstein target loss function is constructed. Through discriminator loss calculation and generator loss calculation, the discriminator loss value and generator loss value are output. S6, AB-CGAN model training: Based on the discriminator loss value and the generator loss value, the model parameters of the generator and discriminator are updated by the Adam optimizer and the preset discriminator and generator update ratio, so as to obtain the trained generator and discriminator, and complete the dam anomaly data generation method based on dynamic penalty weight CGAN. S7. Downstream Anomaly Detection Model Training and Evaluation: After generating anomaly samples through the trained generator, the anomaly samples are merged with real data to form an augmented dataset. The augmented dataset and the simulated anomaly test dataset are input, and the downstream anomaly detection model is trained by using a Transformer encoder, and the performance evaluation index is output. The performance evaluation metrics include: accuracy, precision, recall, F1 score, and ROC-AUC.

2. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S1, the construction of the condition vector specifically involves selecting the environmental variable data corresponding to the last time step of the dam deformation monitoring time series data with a preset length of 24 as the condition vector.

3. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S2, the mathematical expression for outlier anomalies is: in, For the original detection data in time The value, For outlier amplitude, For Dirac functions, t i For randomly selected abnormal locations, For small perturbations, Δt =24 is the length of the abnormal window. For time indexing, This refers to the start time of the abnormal window; The mathematical expression for oscillation anomalies is: in, The amplitude of the fluctuation. It is a period of oscillation. For small perturbations; The mathematical expression for spinal abnormalities is: in, The amplitude of the ridge anomaly. For the Hanning window function, , This is a small perturbation.

4. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, S3 specifically includes the following steps: S3.1 Generator Network Forward Propagation Generates Abnormal Temporal Data: Input random noise vector and time-aligned environmental condition vector, pass through the generator's feature extraction layer, position encoding layer, multi-head self-attention layer, BiLSTM layer and output layer, and output the generated abnormal temporal data; The feature extraction layer is specifically a multilayer perceptron mapped to a 256-dimensional feature space, activated and batch normalized using the LeakyReLU function; Specifically, the location encoding layer expands the feature dimension to 256; The multi-head self-attention layer includes 4 attention heads; The BiLSTM layer consists of two bidirectional LSTM layers with a hidden dimension of 128. Specifically, the output layer outputs 24 time-steps of abnormal time-series data after passing through a fully connected layer; S3.2, Discriminator Network Forward Propagation: Input time series data and pair-aligned environmental condition vectors, after the discriminator's conditional splicer outputs the conditional feature sequence, it then passes through the self-attention mechanism module and the BiLSTM feature extraction module to output the global sequence feature vector. After feature fusion to obtain the combined feature tensor, it passes through the discriminator layer module and the data encoder to output the authenticity score. The time series data is either generated abnormal time series data or actual monitoring time series data; The conditional splicer is a multilayer perceptron consisting of a fully connected layer, a LeakyReLU activation function, and a one-dimensional batch normalization layer. The self-attention mechanism module includes: the number of attention heads is set to 4, the subspace dimension of each attention head is 64, and the hidden layer dimension is 256; The BiLSTM feature extraction module is configured as a 2-layer LSTM with an input feature dimension of 256, a hidden layer dimension of 128, and an output feature dimension of 256. The feature fusion specifically involves concatenating the global sequence feature vector and the last time step vector of the conditional feature sequence along the feature dimension. The discriminant layer module adopts a multilayer perceptron structure, specifically consisting of a fully connected layer that maps dimensions from 512 to 256, a LeakyReLU activation function, a regularization layer with a Dropout ratio of 0.3, and an output layer that maps dimensions from 256 to 1. The data encoder employs a two-layer fully connected network, with each layer followed by a LeakyReLU activation function to map the original input data to a 256-dimensional hidden space.

5. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S4, the expression for calculating the dynamic gradient penalty weight is: in, λ 0∈[5,15] is the baseline penalty coefficient. This represents the volatility of the current batch's environmental condition vector. For historical average fluctuations, ∈[0.5,2.0] represents the environmental sensitivity coefficient. The gradient balance adjustment coefficient controls the gradient difference between the generator and the discriminator. λ(t) The rate of exponential decay, It is a constant. , These are the gradient norms of the generator and discriminator, respectively, for the current training step.

6. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S5, the Wasserstein objective loss function maximizes the generator loss and minimizes the discriminator loss. The expression for the Wasserstein objective loss function is: In the formula, E is the expectation operator. For Euclidean norm operators, The gradient penalty coefficient is... , For fake samples generated by generator G, For positive samples from the real dataset, , Let c be the actual data distribution under the environmental condition vector. The generated data distribution is given by the environmental condition vector c. This is the gradient operator.

7. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 6, characterized in that, In S5, the expression for the Wasserstein objective loss function is: The generator loss calculation expression is as follows: Among them, the total generator loss L G It consists of a Wasserstein adversarial term and a gradient penalty term, L gp λ(t) is the gradient penalty term, λ(t) is the dynamic penalty weight, D is the discriminator, G is the generator, and E is the expectation operator.

8. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 6, characterized in that, In S5, the expression for the Wasserstein objective loss function is: The discriminator loss calculation expression is as follows: The discriminator loss consists of the Wasserstein distance between the real samples and the generated samples, as well as a gradient penalty term. x For real data, G ( z,c ) represents the generated sample, z is the random noise vector, c is the condition vector, and λ(t) is the dynamic penalty weight.

9. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S7, the Transformer encoder contains two stacked encoder layers. Each encoder layer contains a multi-head self-attention mechanism and a feedforward neural network. A random deactivation mechanism with a Dropout value of 0.15 is introduced into the encoder layer. The hidden layer feature dimension of the Transformer encoder is set to 64.

10. The method for generating dam anomaly data based on Dynamic Penalty Weighted CGAN according to claim 1, characterized in that, In S7, the feedforward neural network is located after the multi-head attention mechanism and consists of two linear transformation layers and an activation function in between; the dimension of the hidden layer is set to 128, and the operation of first increasing the dimension and then decreasing the dimension is performed: 64 → 128 → 64.