A method and device for generating a water conservancy engineering model condition based on deep learning
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-08-11
AI Technical Summary
[0005]然而,现有的基于参数化特征序列的生成方法还存在一些缺陷,这种方式的三维模型生成过程为无条件生成,即生成器仅从随机噪声采样产生潜在向量,解码器输出完全由训练数据分布决定,用户无法输入任何设计参数,因此,这种方式生成的三维模型与用户的需求无关,难以直接应用于目标明确的工程场景,需要依赖于工作人员的工作经验在大量随机生成的结果中进行手动筛选并修改,效率低下
本申请通过将水利工程模型设计条件编码为条件参数向量,并与随机噪声共同输入条件生成对抗网络的生成器,使生成过程由无条件变为条件可控,从而能够根据泵站、水闸、大坝等具体水工建筑物的设计需求定向生成符合特定设备类型与性能参数的命令序列矩阵,避免了传统无条件生成模型输出与工程需求无关、需依赖人工筛选修改的低效问题。
Smart Images

Figure CN122548849A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of deep learning technology, and in particular to a method and apparatus for generating conditions for hydraulic engineering models based on deep learning. Background Technology
[0002] Hydraulic engineering models encompass various hydraulic structures and electromechanical equipment, including pumping stations, sluices, dams, canals, culverts, and powerhouses. The design process typically involves complex 3D geometric modeling. Traditional design methods rely primarily on engineers manually modeling in 3D computer-aided design (CAD) software. From sketching and feature creation to parameter definition, every step requires manual operation, which is not only time-consuming and labor-intensive but also makes it difficult to quickly generate multiple design schemes to adapt to different working conditions, thus hindering the effective improvement of design efficiency.
[0003] In the current design process, parametric feature modeling technology is generally used to represent a 3D model as a series of geometric features with editable parameters. This approach not only preserves the complete modeling process but also makes the 3D model highly editable. Users can quickly transform and reuse the 3D model by modifying parameters, which greatly supports engineering design and iteration.
[0004] In recent years, several technologies have emerged that utilize deep learning to construct 3D shapes, primarily falling into two categories: The first category employs voxel, point cloud, or mesh-based generation methods. These methods learn shape distributions from large amounts of 3D data and generate new 3D shapes. However, their output is a discrete geometric representation, lacking parametric feature information. The generated 3D models cannot be directly edited in CAD software, nor do they support parametric modifications, thus failing to meet the fundamental requirement for model editability in engineering design. The second category focuses on parametric feature sequence-based generation methods. By encoding the modeling history of CAD models into command sequences and utilizing models such as Transformer and WGAN networks to achieve sequence-to-sequence generation, parametric feature sequences can be learned and generated from general CAD models. The generated 3D models can be opened and their parameters directly modified in CAD software, opening new avenues for intelligent design.
[0005] However, existing generation methods based on parameterized feature sequences still have some drawbacks. The 3D model generation process in this way is unconditional, that is, the generator only generates potential vectors from random noise sampling, and the decoder output is completely determined by the distribution of training data. Users cannot input any design parameters. Therefore, the 3D model generated in this way is irrelevant to the user's needs and is difficult to apply directly to engineering scenarios with clear objectives. It requires the staff to rely on their work experience to manually screen and modify a large number of randomly generated results, which is inefficient.
[0006] Therefore, there is currently a lack of a user-controllable and continuously learning intelligent design method for parametric models of water conservancy projects. Summary of the Invention
[0007] This application provides a method and apparatus for generating conditions for hydraulic engineering models based on deep learning, in order to overcome the shortcomings of the aforementioned related technologies. The technical solution is as follows: Firstly, this application provides a method for generating conditions for hydraulic engineering models based on deep learning, including: Obtain the design conditions of the water conservancy project model, and obtain the condition parameter vector based on the encoding of the water conservancy project model design conditions; The conditional parameter vector and random noise sampled based on the standard normal distribution are concatenated and then input into the generator of the trained conditional generative adversarial network to obtain the generator's output latent vector. The generated latent vector and conditional parameter vector are input into the decoder of the trained autoencoder, and the command sequence matrix is obtained through the output layer of the autoencoder. Modeling is performed based on the command type and command parameter value of each modeling command in the command sequence matrix to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model. The autoencoder is trained based on a first sample set, which is constructed based on the sample condition parameter vector and sample command sequence matrix of multiple sample water conservancy engineering models. The conditional generative adversarial network is obtained by adversarial training of the generator and discriminator based on a second sample set, which is obtained by sampling the processing results of the first sample set by the trained autoencoder.
[0008] In one alternative embodiment of the first aspect, the process of constructing the sample condition parameter vector includes: Extract the hydraulic engineering model design conditions at the time of construction for each sample hydraulic engineering model, and determine the equipment type and performance parameters based on the hydraulic engineering model design conditions; The corresponding device type is searched in the predefined device type index table to obtain the device type embedding vector; Normalize each performance parameter, and fill the normalized result of the performance parameter into the corresponding position of the performance parameter list that predefines the number and order of performance parameter types according to the correspondence of performance parameter types. Set the first padding character in the blank position of the performance parameter list to obtain the performance parameter vector. The sample condition parameter vector is obtained by splicing the device type embedding vector and the performance parameter vector.
[0009] In one alternative embodiment of the first aspect, the construction process of the sample command sequence matrix includes: The sequence of modeling commands for constructing the sample water conservancy engineering model is extracted based on the modeling history of each sample water conservancy engineering model; Find the command type corresponding to each modeling command in the predefined command type index table to obtain the command type index; normalize each command parameter of each modeling command, fill the normalization result of the command parameter into the corresponding position of the command parameter list that predefines the number and order of command parameter types, and set the second padding character in the blank position of the command parameter list to obtain the command parameter vector. By concatenating the command type index and command parameter vector, the command sequence vector corresponding to each modeling command is obtained. Each command sequence vector is then concatenated in the order of the modeling commands in the sequence. Each command sequence vector is then used as a row of a matrix to construct the sample command sequence matrix. The construction process of the first sample set includes: The first sample set is constructed by using the sample command sequence matrix of each sample water conservancy engineering model as the sample label and the sample condition parameter vector as the sample input.
[0010] In one alternative embodiment of the first aspect, the autoencoder includes an embedding layer, an encoder, a decoder, and an output layer, and the training process of the autoencoder includes: Map the sample condition parameter vector to a first condition vector and a second condition vector; The command type index and command parameter vector of each modeling command in the input sample command sequence matrix are extracted by the embedding layer. A command embedding vector is constructed based on the command type index, and a parameter embedding vector is constructed based on the command parameter vector. The command embedding vector, parameter embedding vector and position encoding are fused to obtain a fused vector matrix. The encoder processes the global feature vector based on the first conditional vector and the fusion vector matrix to obtain the initial latent vector, and then compresses the global feature vector to obtain the initial latent vector. The initial latent vector is input into the decoder, which combines the learnable matrix, the second conditional vector, and the initial latent vector to obtain the deep feature matrix. The deep feature matrix is converted into the command type and command parameters predicted by the autoencoder through the output layer, resulting in the predicted command sequence matrix; An autoencoder loss function is constructed based on the difference between the predicted command sequence matrix and the corresponding sample labels. Backpropagation is then performed based on the autoencoder loss function to update the network parameters of the autoencoder, resulting in a trained autoencoder.
[0011] In one alternative to the first aspect, the construction process of the second sample set includes: The trained autoencoder processes each sample input from the first sample set. Based on the processing results of the trained autoencoder, sampling is performed to extract the sample latent vectors obtained by the encoder. Data pairs are constructed based on each sample latent vector and the corresponding sample condition parameter vector to obtain the second sample set.
[0012] In one alternative embodiment of the first aspect, the training process of the conditional generative adversarial network includes: To fix the network parameters of the generator, train the discriminator, including the following steps: The sample conditional parameter vector and random noise sampled based on the standard normal distribution are concatenated and then input into the generator of the conditional generative adversarial network to obtain the first predicted latent vector output by the generator. The first false sample is obtained by concatenating the first predicted latent vector and the corresponding sample condition parameter vector; the true sample is obtained by concatenating the sample latent vector and the corresponding sample condition parameter vector. The discriminator of the Generative Adversarial Network is generated by inputting the first fake sample and the real sample into the conditions. The discriminator obtains a first recognition score that identifies the sample type of the first fake sample as real and a second recognition score that identifies the sample type of the real sample as real. A discriminator loss function is constructed based on the first and second recognition scores, and the network parameters of the discriminator are updated by backpropagation based on the discriminator loss function. With the network parameters of the discriminator fixed, train the generator, including the following steps: The sample condition parameter vector and random noise sampled based on the standard normal distribution are concatenated and input into the generator to obtain the second predicted latent vector output by the generator. The second predicted latent vector and the corresponding sample condition parameter vector are concatenated to obtain the second fake sample. The second fake sample is input into the discriminator, and a third recognition score is obtained in which the discriminator identifies the sample type of the second fake sample as real. A generator loss function is constructed based on the third recognition score, and the network parameters of the generator are updated by backpropagation based on the generator loss function. The steps of training the discriminator and training the generator are performed alternately to obtain a trained conditional generative adversarial network.
[0013] In one alternative embodiment of the first aspect, before modeling based on the command type and command parameter values of each command in the command sequence matrix, the method further includes: If the user modifies the command type and / or command parameter value of any modeling command in the command sequence matrix output by the autoencoder, the modified command sequence matrix and the corresponding condition parameter vector are used as incremental samples and added to the incremental sample set. The number of samples in the incremental sample set is counted. If the number of samples is greater than the sample number threshold, the autoencoder and conditional generative adversarial network are incrementally trained based on the incremental sample set to obtain the incrementally trained autoencoder and conditional generative adversarial network. Evaluate the accuracy of the autoencoder and conditional generative adversarial network after incremental training on the original validation set, and evaluate the accuracy of the autoencoder and conditional generative adversarial network before incremental training on the original validation set. If the decrease in accuracy after incremental training relative to the accuracy before incremental training is greater than a preset threshold, then incremental training is terminated, and the network parameters of the autoencoder and conditional generative adversarial network before incremental training are maintained; otherwise, the network parameters of the autoencoder and conditional generative adversarial network after incremental training are maintained.
[0014] Secondly, this application also provides a deep learning-based hydraulic engineering model condition generation device, comprising: The data acquisition unit is used to acquire the design conditions of the water conservancy project model and to obtain the condition parameter vector based on the encoding of the design conditions of the water conservancy project model. The data processing unit is used to concatenate the conditional parameter vector and random noise sampled based on the standard normal distribution and input it into the generator of the trained conditional generative adversarial network to obtain the generator latent vector output by the generator. The data processing unit is also used to input the generated latent vector and conditional parameter vector into the decoder of the trained autoencoder, and obtain the command sequence matrix through the output layer of the autoencoder. The modeling unit is used to perform modeling based on the command type and command parameter value of each modeling command in the command sequence matrix, so as to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model. The autoencoder is trained based on a first sample set, which is constructed based on the sample condition parameter vector and sample command sequence matrix of multiple sample water conservancy engineering models. The conditional generative adversarial network is obtained by adversarial training of the generator and discriminator based on a second sample set, which is obtained by sampling the processing results of the first sample set by the trained autoencoder.
[0015] Thirdly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method provided by the first aspect of this application or any implementation thereof.
[0016] Fourthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided by the first aspect of this application or any implementation thereof.
[0017] The beneficial effects of the technical solution provided in this application include at least the following: This application encodes the design conditions of a hydraulic engineering model into a conditional parameter vector and inputs it along with random noise into the generator of a conditional generative adversarial network, making the generation process conditionally controllable instead of unconditional. This enables the generation of command sequence matrices that conform to specific equipment types and performance parameters based on the design requirements of specific hydraulic structures such as pumping stations, sluices, and dams. This avoids the inefficiency of traditional unconditional generation models, where the output is irrelevant to engineering requirements and requires manual screening and modification.
[0018] Meanwhile, this application uses an autoencoder to compress and reconstruct the sample condition parameter vector and command sequence matrix, enabling the decoder to accurately reconstruct the command type and command parameter value of the modeling command based on the latent vector. This ensures that the generated 3D model can retain complete parametric feature information and can be directly edited and modified in CAD software. This overcomes the shortcomings of generation methods based on voxels, point clouds, or meshes, which lack parametric information and cannot support iterative engineering design.
[0019] Furthermore, this application introduces incremental learning to automatically collect the user-modified command sequence matrix and its corresponding conditional parameter vector. By continuously fine-tuning the autoencoder and conditional generative adversarial network, the model can absorb practical engineering experience and continuously evolve. This solves the problem that existing generative models are fixed after training and cannot adapt to the complex and ever-changing working conditions of water conservancy projects, and significantly improves the intelligence level and efficiency of water conservancy project model design. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating a method for generating conditions for a water conservancy engineering model based on deep learning, provided in an embodiment of this application. Figure 2 This is a schematic diagram of a deep learning-based hydraulic engineering model condition generation device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0023] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or modules is not limited to the steps or modules listed, but may optionally include steps or modules not listed, or may optionally include other steps or modules inherent to such process, method, product, or apparatus.
[0024] It should be noted that the terms "first" and "second" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permitted. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in an order other than those described or illustrated herein.
[0025] The present application will now be described in detail with reference to specific embodiments.
[0026] Next, combine Figure 1 This application introduces a method for generating conditions for a water conservancy engineering model based on deep learning, as provided in its embodiments. For details, please refer to... Figure 1 , Figure 1 This illustration shows a flowchart of a method for generating conditions for a deep learning-based hydraulic engineering model, as provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps: S101, obtain the design conditions of the water conservancy project model, and obtain the condition parameter vector based on the encoding of the design conditions of the water conservancy project model.
[0027] S102, combining the condition parameter vector and random noise sampled based on the standard normal distribution. The concatenated vectors are input into the generator of the pre-trained conditional generative adversarial network to obtain the generator's output latent vectors.
[0028] S103 generates the latent vector and conditional parameter vector, which are then input into the decoder of the trained autoencoder. The output layer of the autoencoder processes the data to obtain the command sequence matrix.
[0029] S104, Modeling is performed based on the command type and command parameter value of each modeling command in the command sequence matrix to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model.
[0030] In some embodiments, the step of constructing the first sample set includes: S201, Collect sample water conservancy engineering models; Specifically, completed real engineering models can be obtained from design units or manufacturing enterprises as sample water conservancy engineering models, which can be three-dimensional models built based on CAD software such as CATIA and SolidWorks.
[0031] Specifically, the collected water conservancy engineering models can include various types of water conservancy engineering models, such as pump station models. Pump station models can specifically include equipment types such as centrifugal pumps, axial flow pumps, mixed flow pumps, motors, couplings, bases, and pipelines. This application embodiment does not limit the classification method of water conservancy engineering models.
[0032] Understandably, the collected hydraulic engineering models include complete parametric features and modeling history. The modeling history can be understood as the operational steps of using modeling commands to gradually adjust parametric features to construct a three-dimensional model during the parametric modeling process.
[0033] Alternatively, manual modeling can be performed in CAD software such as CATIA and SolidWorks to extract the modeling history recorded by macro commands.
[0034] S202, Extract the sample condition parameter vector corresponding to the sample hydraulic engineering model, including the following steps: S2021, Extract the design conditions of each sample water conservancy engineering model during construction, and determine the equipment type and performance parameters based on the design conditions of the water conservancy engineering model.
[0035] Understandably, the design conditions for a water conservancy project model refer to the design requirements for relevant equipment when constructing a water conservancy project model. Specifically, these include the equipment types and performance parameters of the required water conservancy project equipment, and each equipment type can have different types of performance parameters.
[0036] For example, if the equipment type is a centrifugal pump, performance parameters may include head, flow rate, speed, power, and efficiency. If the equipment type is an electric motor, performance parameters may include speed, power, efficiency, voltage, and current.
[0037] S2022, look up the corresponding device type in the predefined device type index table to obtain the device type embedding vector.
[0038] Specifically, a corresponding device index can be defined for each device type. The predefined device type index table includes the mapping relationship between each device index and the embedding vector. The embedding vector corresponding to each device index can be constructed by embedding encoding. The device index can be used to find the corresponding device type in the predefined device type index table, and then the device type embedding vector corresponding to the device type can be determined according to the mapping relationship.
[0039] For example, Table 1 illustrates the types of water conservancy engineering equipment, equipment indexes, and corresponding equipment type embedding vectors.
[0040] It should be noted that the specific values of the device index and embedding vector in Table 1 are only examples and are not intended to limit the embodiments of this application.
[0041] Table 1. Types of Water Conservancy Engineering Equipment, Equipment Indexes, and Corresponding Equipment Type Embedding Vectors
[0042] S2023, normalize each performance parameter, fill the normalized result of the performance parameter into the corresponding position of the performance parameter list that predefines the number and order of performance parameter types according to the correspondence of performance parameter types, and set the first padding character in the blank position of the performance parameter list to obtain the performance parameter vector.
[0043] Specifically, after normalizing each performance parameter, the value range of the performance parameter falls within [0,1].
[0044] It should be noted that a performance parameter list can be predefined for all equipment types. The performance parameter list can contain a variety of specified performance parameter types and be arranged in a preset order. For example, the performance parameters in the performance parameter list can be set to head (m), flow rate (m³ / s), speed (rpm), power (kW), efficiency (%), voltage (V), current (A), and height (m) in sequence. In actual operation, the number and order of the covered performance parameter types can be adjusted as needed.
[0045] Specifically, the performance parameter list may contain performance parameters that the device type does not have. For performance parameters that the device type does not have but appear in the performance parameter list (i.e., in blank positions), a first padding character (e.g., marked as 0) can be added.
[0046] For example, the performance parameters of a centrifugal pump may or may not include voltage, current, and height. You can add a filler character with a value of 0 for voltage, current, and height.
[0047] For example, the performance parameter list is shown in Table 2. Table 2 uses three equipment types, namely centrifugal pump, axial flow pump and motor, as examples and fills in the performance parameters of the corresponding equipment types.
[0048] Table 2 Performance Parameter List
[0049] As illustrated in Table 2, the normalized results of the performance parameters of the three types of equipment are filled into the performance parameter list, and the first filler character "0" is added to the blank positions. The resulting performance parameter vectors are: centrifugal pump [0.25, 0.03, 0.44, 0.11, 0.86, 0, 0, 0], axial flow pump [0.20, 0.45, 0.35, 0.15, 0.8, 0, 0, 0], and motor [0, 0, 0.38, 0.25, 0.9, 0.6, 0.1, 0].
[0050] S2024, the sample condition parameter vector is obtained by splicing the device type embedding vector and the performance parameter vector.
[0051] As shown in Table 3, Table 3 illustrates the sample condition parameter vector obtained by splicing the device type embedding vector and the performance parameter vector.
[0052] Table 3 Sample Condition Parameter Vector
[0053] S203, Extract the sample command sequence matrix corresponding to the sample hydraulic engineering model, including the following steps: S2031, based on the modeling history of each sample water conservancy engineering model, extract the sequence of modeling commands for constructing the sample water conservancy engineering model.
[0054] Specifically, the modeling history can be extracted through the CAD software's Application Programming Interface (API).
[0055] For example, the sequence of modeling commands can be: modeling command 1, modeling command 2, ..., modeling command max_len, and the maximum number of modeling commands in the sequence can be set to max_len.
[0056] Specifically, for sample water conservancy engineering models where the number of modeling commands is less than the upper limit, the command terminator EOS can be repeatedly added to the end of the sequence of modeling commands as a padding character until the number of modeling commands in the sequence reaches the upper limit max_len.
[0057] Specifically, if the number of modeling commands for the sample water conservancy engineering model exceeds the upper limit max_len, then only the modeling commands with the highest number of commands in the order will be retained.
[0058] S2032, find the command type corresponding to each modeling command in the predefined command type index table to obtain the command type index.
[0059] Specifically, a corresponding command type index can be defined for each modeling command, and a predefined command type index table can be obtained based on the mapping relationship between command types and command type indexes.
[0060] Understandably, the command type index can be found in the command type index table based on the mapping relationship between the command type corresponding to the modeling command and the command type index.
[0061] For example, modeling commands may include, but are not limited to, command start symbol SOL, line command LINE, arc command ARC, extrusion command EXT, punch command HOLE, and command end symbol EOS.
[0062] S2033, normalize each command parameter of each modeling command, fill the normalized result of the command parameter into the corresponding position of the command parameter list which predefines the number and order of command parameter types, and set a second filler in the blank position of the command parameter list to obtain the command parameter vector.
[0063] Specifically, during normalization, the maximum and minimum values of the command parameters for the corresponding terms of all sample hydraulic engineering models can be extracted. The normalization formula is expressed as: ; in, This represents the normalized result of the command parameters for the corresponding item. This indicates the actual value of the command parameter for the corresponding item. This indicates the minimum value of the command parameter for the corresponding item. This indicates the maximum value of the command parameter for the corresponding item. "round" means rounding, which can normalize the command parameter of the corresponding item to an integer between 0 and 255.
[0064] Furthermore, for discrete parameters such as Boolean flags, this type of command parameter can be directly encoded as 0 or 1.
[0065] It should be noted that a command parameter list can be predefined for all modeling commands. The command parameter list can contain N specified command parameter types, arranged in a preset order. For example, the command parameters in the command parameter list can be set as parameter 1, parameter 2, parameter 3, parameter 4, parameter 5, and parameter 6 in sequence. This is only an example of the number and order of command parameter types in the command parameter list. In actual operation, the number and order of the covered command parameter types can be adjusted as needed.
[0066] Specifically, the command parameter list may contain command parameters that the modeling command does not have. For command parameters that the modeling command does not have but appear in the command parameter list (i.e., in blank spaces in the command parameter list), a second filler character can be added (e.g., labeled as -1).
[0067] For example, the normalized result of the LINE command corresponding to parameter 1 is 20, the normalized result of parameter 2 is 20, the normalized result of parameter 3 is 50, and the normalized result of parameter 4 is 60. The command start symbol does not have parameters 5 and 6. By adding the second fill symbol -1, the command parameter vector of the command start symbol is constructed as [20, 20, 50, 60, -1, -1].
[0068] S2034, concatenate the command type index and command parameter vector to obtain the command sequence vector corresponding to each modeling command. Concatenate each command sequence vector in the order of the modeling commands in the sequence of modeling commands, and use each command sequence vector as a row of a matrix to construct the sample command sequence matrix.
[0069] Specifically, the shape of the sample command sequence matrix can be represented as (max_len, 1+N), where, The total number of modeling commands is given by N, where N represents the total number of command parameters defined in the command parameter list, and 1+N represents the dimension of the command sequence vector.
[0070] For example, Table 4 illustrates the command sequence matrix of a hydraulic engineering model. The first row of Table 4 is the header, and the first column is the command type index. Command type index "0" corresponds to the command start symbol SOL, command type index "1" corresponds to the command type LINE, command type index "2" corresponds to the command type ARC, command type index "3" corresponds to the command type EXT, command type index "4" corresponds to the command type HOLE, and command type index "5" corresponds to the command type EOS. The second row of Table 4 is the command sequence vector of the command start symbol SOL, and the remaining rows are the command sequence vectors of the corresponding modeling commands. The range from the second row to the last row and from the first column to the last column in Table 4 is the constructed command sequence matrix.
[0071] Table 4 Command Sequence Matrix
[0072] S204. Using the sample command sequence matrix of each sample water conservancy engineering model as the sample label and the sample condition parameter vector as the sample input, the first sample set is constructed.
[0073] In some embodiments, the autoencoder provided in this application is specifically a Transformer-based autoencoder, which includes an embedding layer, an encoder, a decoder, and an output layer. The process of training the autoencoder based on a first sample set includes the following steps: S301, map the sample condition parameter vector to the first condition vector and the second condition vector.
[0074] The sample condition parameter vector can be represented as c, which can be mapped to the first condition vector through two different linear layers. Second condition vector .
[0075] Wherein, the first condition vector Used to guide the encoder compression to obtain the latent vector, the second conditional vector. Used to boot the decoder The condition information is the constraint analytic compression vector, the first condition vector. Second condition vector All dimensions are represented as d_model.
[0076] S302, the command type index and command parameter vector of each modeling command in the input sample command sequence matrix are extracted by the embedding layer. The command embedding vector is constructed based on the command type index, and the parameter embedding vector is constructed based on the command parameter vector. The command embedding vector, the parameter embedding vector and the position encoding are fused to obtain the fused vector matrix.
[0077] Specifically, the batch size for a single training session can be set to "batch," which can be 100; the input shape of the sample command sequence matrix is... .
[0078] Specifically, for command type indexes, a learnable embedding table can be used to map the command type index to a d_model-dimensional command embedding vector.
[0079] Specifically, for the parameter embedding vector, the parameter value of each command parameter in the command parameter vector can be mapped to a 64-dimensional parameter vector through another learnable embedding table. For command parameters padded with a second padding character, it is mapped to a 64-dimensional all-zero parameter vector. The parameter vectors of N command parameters in the command parameter vector are concatenated to obtain an N*64-dimensional intermediate vector, which can then be processed through a linear layer. Compress the intermediate vector into a parameter embedding vector of dimension d_model.
[0080] Furthermore, commands can be embedded into vectors. Parameter embedding vector Adding the positional code P to obtain the fusion vector matrix H, expressed by the formula: The dimension of the fused vector matrix is .
[0081] Specifically, the position code P can be a fixed sine / cosine position code in the Transformer network.
[0082] S303, the encoder processes the global feature vector based on the first condition vector and the fusion vector matrix to obtain the initial latent vector, and compresses the global feature vector to obtain the initial latent vector.
[0083] Specifically, the encoder can be obtained by stacking multiple transformer encoder layers. For example, a 6-layer transformer encoder can be selected, with each encoder layer containing a multi-head attention mechanism and a feedforward neural network, using a Pre-Norm structure.
[0084] Specifically, in the first encoder layer, the input feature vector of the multi-head attention mechanism is the fusion vector matrix generated by S302, and the first conditional vector is... After being broadcast to the dimension of the fusion vector matrix, it is added element-wise to the fusion vector matrix processed by the multi-head attention mechanism. The result of the element-wise addition is input into the feedforward neural network of the first encoder layer to calculate the output feature vector of the first encoder layer. The output feature vector of the first encoder layer is used as the input of the next encoder layer.
[0085] Understandably, in the next encoder layer, the output feature vector calculated by the previous encoder layer is processed through a multi-head attention mechanism, and the first conditional vector is... After broadcasting to the dimension of the fusion vector matrix, the result is added element-wise to the result processed by the multi-head attention mechanism, and then processed by the feedforward neural network to calculate the output feature vector of the current encoder layer.
[0086] Based on the above description, after processing through multiple encoder layers, the output feature vector of the last encoder layer is extracted, i.e., the output result M. The dimension of the output result is M∈( ,max_len,d_model).
[0087] Furthermore, the output result M is subjected to average pooling, as expressed by the formula: ; in, Represents the global feature vector, with dimension . ;i represents the i-th modeling command, hereinafter referred to as the i-th command line. This indicates the i-th command line. dimensional vector; This is a command type mask value used to filter modeling commands that are placed using the EOS padding character when constructing the command sequence matrix. If the command type of the modeling command corresponding to the i-th command line does not belong to the command terminator EOS padding character, then it is a valid command line. =1, otherwise 0; This represents the summation of the vector over all valid command argument rows; This represents the number of valid command lines out of all command lines.
[0088] Next, the global feature vector is input into the latent space layer and further compressed into... =256 dimensions, then activated by the tanh activation function to obtain the initial latent vector z, the dimension of which is .
[0089] S304: Input the initial latent vector into the decoder. The decoder processes the learnable matrix, the second conditional vector, and the initial latent vector to obtain the deep feature matrix.
[0090] Specifically, the decoder can be stacked from multiple transformer decoder layers, for example, setting up 6 decoder layers. Each decoder layer includes a masked multi-head attention mechanism, a cross attention mechanism, and a feedforward neural network, using a Pre-Norm structure.
[0091] Specifically, the initial input to the first decoder layer is a learnable matrix. , dimension Initialized as a sine / cosine positional encoding P, the learnable matrix can be backpropagated during training. Update.
[0092] In the first decoder layer, the input feature vector of the masked multi-head attention mechanism is a learnable matrix. , the second condition vector Broadcast to Learnable Matrix After determining the dimension, the intermediate matrix is obtained by adding it element-wise to the output matrix processed by the mask multi-head attention mechanism. Then, the intermediate matrix obtained by element-wise addition is combined with the initial latent vector z to perform cross-attention calculation, specifically including: The initial latent vector z is mapped to a key vector using a K-linear matrix, and then mapped to a value vector using a V-linear matrix. The mapped key and value vectors are then extended to a shape. Simultaneously, the intermediate matrix is mapped to the query vector using a Q-linear matrix. Cross-attention is then calculated based on the expanded key vector, value vector, and query vector to incorporate global information contained in the initial latent vector z, yielding the result of the cross-attention calculation. Finally, the result of the cross-attention calculation is activated by a feedforward neural network and a ReLU function to obtain the deep feature matrix output by the first decoder layer. Subsequently, the deep feature matrix output by the first decoder layer is used as the input to the next decoder layer.
[0093] Understandably, in the next decoder layer, the deep feature matrix output from the previous decoder layer is used as the input feature vector for the masked multi-head attention mechanism, and the second conditional vector is used... Broadcast to Learnable Matrix After the dimension is determined, the intermediate matrix of the current decoder layer is obtained by adding it element-wise to the output matrix processed by the mask multi-head attention mechanism. Then, the intermediate matrix of the current decoder layer is combined with the initial latent vector z to perform cross-attention calculation. After processing by the feedforward neural network and ReLU function, the deep feature matrix output by the current decoder layer is obtained.
[0094] Based on the above description, after processing through multiple decoder layers, the deep feature matrix O output by the last decoder layer is obtained, with dimension O. .
[0095] S305 converts the deep feature matrix into the command type and command parameters predicted by the autoencoder through the output layer, thus obtaining the predicted command sequence matrix.
[0096] Specifically, the output layer can convert the deep feature matrix output by the decoder into the command type of the modeling command predicted by the autoencoder and the corresponding command parameter values.
[0097] Specifically, the output layer consists of a command classification layer and a parameter classification layer; The weight matrix of the command classification layer is as follows: cmd represents the total number of command types, with a bias of 0. Through the weight matrix The output deep feature matrix O is mapped to the prediction result of the command type for each sample at each time step, represented as follows: The output shape is .
[0098] The weight matrix of the parameter classification layer is: , bias is The prediction result for the command parameters is expressed as The output shape is Reshape it into This allows each command parameter of each modeling command to have a vector of length 256 representing the predicted result of the command parameter value.
[0099] In this way, the command type of each modeling command and the value of each command parameter can be predicted, resulting in a predicted command sequence matrix.
[0100] S306. Construct an autoencoder loss function based on the difference between the predicted command sequence matrix and the corresponding sample labels. Perform backpropagation based on the autoencoder loss function to update the network parameters of the autoencoder and obtain the trained autoencoder.
[0101] Specifically, a multi-class cross-entropy loss can be constructed based on the difference between each command type and its corresponding sample label (sample command sequence matrix) in the predicted command sequence matrix, expressed by the formula: ; in, This represents the cross-entropy loss for multi-class classification. This represents the prediction score (e.g., probability score) for predicting the i-th command line as the correct command type. In other words, the autoencoder outputs the probability score of the i-th command line in each command type. Based on the sample labels, the correct command type of each line can be determined, and thus the prediction score of the autoencoder predicting the correct command type can be easily extracted. exp represents the prediction score for the autoencoder to predict the i-th command pair as any command type; exp represents the exponential calculation.
[0102] Furthermore, the multi-class cross-entropy loss can be calculated based on the difference between the command parameter values of each modeling command in the prediction command sequence matrix and the corresponding sample labels, as expressed by the formula: ; in, This represents the multi-class cross-entropy loss, where s represents the s-th command parameter in the command line. This represents the prediction score for predicting the s-th command parameter in the i-th command line as the correct command parameter value. In other words, it is the probability score of each value of the s-th command parameter in the i-th command line output by the autoencoder in the range of 0-255. Based on the sample label, the correct value of each command parameter can be determined, and the prediction score of the correct value predicted by the autoencoder can be easily extracted. This represents the prediction score for predicting the s-th command parameter in the i-th command line as any value; This is the command parameter mask value, used to filter invalid command parameters that are placed by the second padding character when constructing the command sequence matrix. If the parameter value of the s-th command parameter in the i-th command line is not a padding character (i.e., the second padding character in S2033), it means that the s-th command parameter in the i-th command line is a valid command parameter. =1, otherwise 0.
[0103] Based on multi-class cross-entropy loss and multi-class cross-entropy loss The summation yields the autoencoder loss function. Minimize the autoencoder loss function The optimization goal of the entire autoencoder is to optimize the network parameters of the autoencoder (such as the learnable matrix, the weight parameters of each layer, etc.).
[0104] Optionally, during the training of the autoencoder, the Adam optimizer can be used to optimize the network parameters, with the initial learning rate set to 0.001, hyperparameter β1 set to 0.9, hyperparameter β2 set to 0.999, batch number set to 32, 64 or 128, and training epochs set to ≥500.
[0105] In this way, the autoencoder, guided by the input conditional parameter vector, can compress the input command sequence matrix into a latent vector during training, and learn the process of restoring the latent vector into a command sequence matrix. This allows the trained autoencoder to generate a true latent vector based on the input sample conditional parameter vector and sample command sequence matrix.
[0106] Next, a second sample set is constructed based on the trained autoencoder to train the conditional generative adversarial network, including the following steps: S401, the trained autoencoder processes each sample input from the first sample set.
[0107] Understandably, the processing procedure for the trained autoencoder is the same as described in S301-S305, and will not be repeated here.
[0108] S402, sampling is performed based on the processing results of the trained autoencoder, the sample latent vectors obtained by the encoder are extracted, and data pairs are constructed based on each sample latent vector and the corresponding sample condition parameter vector to obtain the second sample set.
[0109] The sample latent vector can be represented as: The data pair consisting of the sample latent vector and the corresponding sample condition parameter vector can be represented as: .
[0110] In some embodiments, adversarial training of the generator and discriminator of the conditional generative adversarial network is performed using a second sample set, including the steps of: S501, with fixed generator network parameters, trains the discriminator, including the following steps: S5011, combining the sample condition parameter vector c and random noise sampled based on the standard normal distribution. The concatenated input conditional generative adversarial network (GAN) generator is used to obtain the first predicted latent vector from the generator's output. .
[0111] Specifically, the sample condition parameter vector c and random noise The concatenated result is then processed through three linear network layers, including mapping, batch normalization, ReLU activation, and tanh activation, to obtain the first predicted latent vector. .
[0112] Among them, random noise The dimension is First predicted latent vector The dimension is .
[0113] S5012, concatenate the first predicted latent vector The first fake sample is obtained by combining the corresponding sample condition parameter vector c, denoted as: ; splicing sample latent vectors The true sample is obtained by combining the corresponding sample condition parameter vector c, denoted as: .
[0114] Furthermore, a discriminator is used to identify the real samples and the first fake sample separately, including: S5013, the discriminator of the Generative Adversarial Network is generated by inputting the first fake sample and the real sample into the conditions, and a first recognition score is obtained for the discriminator to identify the sample type of the first fake sample as real, and a second recognition score is obtained for the discriminator to identify the sample type of the real sample as real.
[0115] Wherein, the first recognition score is represented as The second recognition score is represented as D represents the discriminator.
[0116] Specifically, the recognition score, which identifies the input sample type as true by the discriminator, can be defined as the probability that the input sample is of true type.
[0117] S5014, construct the discriminator loss function based on the first recognition score and the second recognition score, and update the network parameters of the discriminator by backpropagation according to the discriminator loss function.
[0118] The discriminator loss function includes a Wasserstein distance term and a gradient penalty term. The formula for the Wasserstein distance term is as follows: ; in, Represents the Wasserstein distance term; This represents the data distribution of the first predicted latent vector and the corresponding sample condition parameter vector generated by the generator in S5011. Indicates the distribution of data The data pairs obtained through sampling; E represents the calculated mathematical expectation; This represents the data distribution of the latent vectors and corresponding sample condition parameter vectors in the second sample set. Indicates the distribution of data Data pairs obtained through sampling.
[0119] The formula for the gradient penalty term is expressed as: ; ; in, Represents the gradient penalty term; The gradient penalty coefficient is a hyperparameter that can take a value of 10; m represents the interpolated sample, based on the real sample. Compared with the first fake sample Interpolation calculation yielded the result. The coefficients calculated for interpolation can be based on the distribution. Determine the value to be taken; This represents the mixed distribution of the difference samples, specifically a uniform sampling distribution based on the line connecting the real sample and the first fake sample; Indicates a mixed distribution Take the expected value; The gradient operator represents the interpolated sample. This represents the gradient of the discriminator D with respect to the interpolated sample m; This indicates the calculation of the L2 norm.
[0120] Therefore, the discriminator loss function Represented as: ; When optimizing the network parameters of the discriminator, the goal is to minimize the discriminator loss function. The goal is to enable the discriminator to identify the sample type of the input sample as accurately as possible.
[0121] S502, with fixed network parameters for the discriminator, trains the generator, including the following steps: S5021, the sample condition parameter vector and random noise sampled based on the standard normal distribution are concatenated and input into the generator to obtain the second predicted latent vector output by the generator. The second predicted latent vector The second fake sample is obtained by concatenating the sample condition parameter vector c with the corresponding sample condition parameter vector c. .
[0122] S5022, the second fake sample Input the sample into the discriminator and obtain the third recognition score, which identifies the sample type of the second fake sample as real.
[0123] The third recognition score is represented as ; S5023: Construct a generator loss function based on the third recognition score, and update the generator's network parameters through backpropagation based on the generator loss function.
[0124] The generator loss function is expressed as follows: ; in, Let G represent the generator loss function, and G represent the generator.
[0125] Specifically, when updating the generator's network parameters through backpropagation based on the generator loss function, the generator loss function is minimized. For the objective, the generator loss function The smaller the value, the more difficult it is for the discriminator to distinguish the latent vector generated by the generator from the latent vector in the real sample. In this way, the new latent vector generated by the generator becomes closer and closer to the sample latent vector z compressed by the trained encoder, which is conducive to obtaining a more realistic latent vector.
[0126] S503, alternately execute the steps of training the discriminator and training the generator to obtain the trained conditional generative adversarial network.
[0127] Specifically, steps S5011-S5014 can be repeated several times to update the model parameters of the discriminator. Then, steps S5021-S5022 can be executed once to update the model parameters of the generator. For example, the discriminator can be updated 5 times, and then the generator can be updated once, until the model converges.
[0128] Optionally, when optimizing the model parameters of the generator and discriminator, the Adam optimizer can be used, with an initial learning rate set to 0.0002, and the hyperparameters... Set to 0.5, hyperparameter Set to 0.999, set the batch number to 32, 64 or 128, and set the training epochs to ≥500.
[0129] Next, based on the description of the above model training steps, we will introduce a method for generating conditions for a water conservancy engineering model based on deep learning, as provided in the embodiments of this application.
[0130] For S101, users can provide the design conditions for the hydraulic engineering model through a JSON configuration file, and then extract the corresponding condition parameter vector based on the design conditions of the hydraulic engineering model in the same way as in S2021-S2024. For details, please refer to the descriptions in S2021-S2024, which will not be repeated here.
[0131] For S102, the condition parameter vector and random noise based on standard normal distribution sampling After concatenation, the resulting vector is input into the trained generator to obtain the generator latent vector. The formula can be expressed as: ; Here, G represents the generator.
[0132] For S103, the trained autoencoder in S103 is based on the generated latent vector. and condition parameter vector The process of obtaining the command sequence matrix is the same as the steps in S304-S305. For details, please refer to the descriptions in S304-S305.
[0133] Specifically, referring to the steps in S304, a fixed learnable matrix can be determined based on the model parameters of the autoencoder after the training process is completed. In the decoder, this fixed learnable matrix and conditional parameter vector are then used as the basis for the learning matrix. and generating latent vectors The calculations are performed to obtain a new deep feature matrix output by the decoder.
[0134] Next, following the steps in S305, the new deep feature matrix is converted into command type and command parameters through the output layer to obtain the command sequence matrix.
[0135] Specifically, the prediction results for the command type can be extracted. and the prediction results of command parameters .
[0136] Then, prediction results can be based on command type. The last dimension is used to calculate argmax, resulting in the command index matrix. Where n represents the number of design conditions for the hydraulic engineering model input by S101, and the command index matrix. Each element in each column is an index of the command type for the corresponding hydraulic engineering model design conditions. Based on the mapping relationship between the command type index and the command type, the modeling command for the corresponding command type can be determined. Prediction results based on command parameters The last dimension is used to calculate argmax, resulting in the parameter index matrix. Each element in the parameter index matrix represents the predicted command parameter value.
[0137] Specifically, a dimension can be added to the command index matrix, outputting (n, ,1). Concatenate the command index matrix and the parameter index matrix in the last dimension to output n ( Command sequence matrices of shape 1+N, where the first column of these matrixes is the command type index and the remaining N columns are the command parameter values.
[0138] In this way, we can obtain the command sequence matrix corresponding to the design conditions of n water conservancy engineering models.
[0139] Specifically, in S104, the command sequence matrix can be stored as a .h5_dec file. Parametric modeling can be performed based on the .h5_dec file. The .h5_dec file can be directly converted into a 3D model file in the target format using the AI base tool and visualized using CAD software to obtain the constructed hydraulic engineering model. Users can modify the parameters in the CAD software, including the command type and / or command parameter value of any modeling command in the command sequence matrix, and then output the constructed hydraulic engineering model after adjustment.
[0140] In some embodiments, before S104 models based on the command type and command parameter values of each command in the command sequence matrix, the method further includes: If the user modifies the command type and / or command parameter value of any modeling command in the command sequence matrix output by the autoencoder, the modified command sequence matrix and the corresponding condition parameter vector are used as incremental samples and added to the incremental sample set. The number of samples in the incremental sample set is counted. If the number of samples is greater than the sample number threshold, the autoencoder and conditional generative adversarial network are incrementally trained based on the incremental sample set to obtain the incrementally trained autoencoder and conditional generative adversarial network. Evaluate the accuracy of the autoencoder and conditional generative adversarial network after incremental training on the original validation set, and evaluate the accuracy of the autoencoder and conditional generative adversarial network before incremental training on the original validation set. If the decrease in accuracy after incremental training relative to the accuracy before incremental training is greater than a preset threshold, for example, a preset threshold of 2%, then incremental training is terminated, and the network parameters of the autoencoder and conditional generative adversarial network before incremental training are maintained; otherwise, the network parameters of the autoencoder and conditional generative adversarial network after incremental training are maintained.
[0141] In this way, users' experience in modifying water conservancy engineering models can be incorporated, and the autoencoder and conditional generative adversarial network can be continuously optimized through incremental training, thus enabling the continuous evolution of the network.
[0142] The following are apparatus embodiments of this application, which can be used to execute the method embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments of this application.
[0143] Please see below. Figure 2 The image shows a schematic diagram of a deep learning-based hydraulic engineering model condition generation device, provided as an exemplary embodiment of this application. The device includes: The data acquisition unit is used to acquire the design conditions of the water conservancy project model and to obtain the condition parameter vector based on the encoding of the design conditions of the water conservancy project model. The data processing unit is used to concatenate the conditional parameter vector and random noise sampled based on the standard normal distribution and input it into the generator of the trained conditional generative adversarial network to obtain the generator latent vector output by the generator. The data processing unit is also used to input the generated latent vector and conditional parameter vector into the decoder of the trained autoencoder, and obtain the command sequence matrix through the output layer of the autoencoder. The modeling unit is used to perform modeling based on the command type and command parameter value of each modeling command in the command sequence matrix, so as to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model. The autoencoder is trained based on a first sample set, which is constructed based on the sample condition parameter vector and sample command sequence matrix of multiple sample water conservancy engineering models. The conditional generative adversarial network is obtained by adversarial training of the generator and discriminator based on a second sample set, which is obtained by sampling the processing results of the first sample set by the trained autoencoder.
[0144] It should be noted that the apparatus provided in the above embodiments, when executing a deep learning-based method for generating conditions for hydraulic engineering models, is only illustrated by the division of the aforementioned functional modules. In practical applications, the functions can be assigned to different functional modules as needed, that is, the internal structure of the equipment can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and their implementation process is detailed in the method embodiments, which will not be repeated here.
[0145] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.
[0146] Please see Figure 3 This is a structural block diagram of an electronic device provided in an embodiment of this application.
[0147] like Figure 3 As shown, the electronic device includes a processor and a memory.
[0148] In this embodiment, the processor is the control center of the computer system, and can be a processor of a physical machine or a processor of a virtual machine. The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor can be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array).
[0149] A processor can also include a main processor and a coprocessor. The main processor is used to process data in the wake-up state and is also called the CPU (Central Processing Unit). The coprocessor is a low-power processor used to process data in the standby state.
[0150] The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments of this application, the non-transitory computer-readable storage media in the memory are used to store at least one instruction, which is executed by a processor to implement the methods in the embodiments of this application.
[0151] In some embodiments, the electronic device further includes a peripheral device interface and at least one peripheral device. The processor, memory, and peripheral device interface are connected via a bus or signal line. Each peripheral device is connected to the peripheral device interface via a bus, signal line, or circuit board. Specifically, the peripheral device includes: a display screen, a camera, and audio circuitry. The peripheral device interface can be used to connect at least one I / O (Input / Output) related peripheral device to the processor and memory.
[0152] In some embodiments of this application, the processor, memory, and peripheral device interfaces are integrated on the same chip or circuit board; in other embodiments of this application, any one or two of the processor, memory, and peripheral device interfaces can be implemented on separate chips or circuit boards. This application does not specifically limit the implementation in this regard.
[0153] The electronic device structural block diagrams shown in the embodiments of this application do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0154] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the foregoing embodiments. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0155] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A deep learning-based water conservancy model condition generation method, characterized in that, include: Obtain the design conditions of the water conservancy project model, and obtain the condition parameter vector based on the encoding of the water conservancy project model design conditions; The conditional parameter vector and random noise sampled based on the standard normal distribution are concatenated and then input into the generator of the trained conditional generative adversarial network to obtain the generator's output latent vector. The generated latent vector and conditional parameter vector are input into the decoder of the trained autoencoder, and the command sequence matrix is obtained through the output layer of the autoencoder. Modeling is performed based on the command type and command parameter value of each modeling command in the command sequence matrix to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model. The autoencoder is trained based on a first sample set, which is constructed based on the sample condition parameter vector and sample command sequence matrix of multiple sample water conservancy engineering models. The conditional generative adversarial network is obtained by adversarial training of the generator and discriminator based on a second sample set, which is obtained by sampling the processing results of the first sample set by the trained autoencoder. 2.The deep learning-based hydraulic engineering model condition generation method of claim 1, wherein, The process of constructing the sample condition parameter vector includes: Extract the hydraulic engineering model design conditions at the time of construction for each sample hydraulic engineering model, and determine the equipment type and performance parameters based on the hydraulic engineering model design conditions; The corresponding device type is searched in the predefined device type index table to obtain the device type embedding vector; Normalize each performance parameter, and fill the normalized result of the performance parameter into the corresponding position of the performance parameter list that predefines the number and order of performance parameter types according to the correspondence of performance parameter types. Set the first padding character in the blank position of the performance parameter list to obtain the performance parameter vector. The sample condition parameter vector is obtained by splicing the device type embedding vector and the performance parameter vector. 3.The deep learning-based hydraulic engineering model condition generation method of claim 2, wherein, The construction process of the sample command sequence matrix includes: The sequence of modeling commands for constructing the sample water conservancy engineering model is extracted based on the modeling history of each sample water conservancy engineering model; Find the command type corresponding to each modeling command in the predefined command type index table to obtain the command type index; normalize each command parameter of each modeling command, fill the normalization result of the command parameter into the corresponding position of the command parameter list that predefines the number and order of command parameter types, and set the second padding character in the blank position of the command parameter list to obtain the command parameter vector. By concatenating the command type index and command parameter vector, the command sequence vector corresponding to each modeling command is obtained. Each command sequence vector is then concatenated in the order of the modeling commands in the sequence. Each command sequence vector is then used as a row of a matrix to construct the sample command sequence matrix. The construction process of the first sample set includes: The first sample set is constructed by using the sample command sequence matrix of each sample water conservancy engineering model as the sample label and the sample condition parameter vector as the sample input.
4. The deep learning-based hydraulic engineering model condition generation method according to claim 3, characterized in that, The autoencoder includes an embedding layer, an encoder, a decoder, and an output layer. The training process of the autoencoder includes: Map the sample condition parameter vector to a first condition vector and a second condition vector; The command type index and command parameter vector of each modeling command in the input sample command sequence matrix are extracted by the embedding layer. A command embedding vector is constructed based on the command type index, and a parameter embedding vector is constructed based on the command parameter vector. The command embedding vector, parameter embedding vector and position encoding are fused to obtain a fused vector matrix. The encoder processes the global feature vector based on the first conditional vector and the fusion vector matrix to obtain the initial latent vector, and then compresses the global feature vector to obtain the initial latent vector. The initial latent vector is input into the decoder, which combines the learnable matrix, the second conditional vector, and the initial latent vector to obtain the deep feature matrix. The deep feature matrix is converted into the command type and command parameters predicted by the autoencoder through the output layer, resulting in the predicted command sequence matrix; An autoencoder loss function is constructed based on the difference between the predicted command sequence matrix and the corresponding sample labels. Backpropagation is then performed based on the autoencoder loss function to update the network parameters of the autoencoder, resulting in a trained autoencoder.
5. The deep learning-based hydraulic engineering model condition generation method according to claim 4, characterized in that, The construction process of the second sample set includes: The trained autoencoder processes each sample input from the first sample set. Based on the processing results of the trained autoencoder, sampling is performed to extract the sample latent vectors obtained by the encoder. Data pairs are constructed based on each sample latent vector and the corresponding sample condition parameter vector to obtain the second sample set.
6. The method for generating conditions for a water conservancy engineering model based on deep learning according to claim 5, characterized in that, The training process of the conditional generative adversarial network includes: To fix the network parameters of the generator, train the discriminator, including the following steps: The sample conditional parameter vector and random noise sampled based on the standard normal distribution are concatenated and then input into the generator of the conditional generative adversarial network to obtain the first predicted latent vector output by the generator. The first false sample is obtained by concatenating the first predicted latent vector and the corresponding sample condition parameter vector; the true sample is obtained by concatenating the sample latent vector and the corresponding sample condition parameter vector. The discriminator of the Generative Adversarial Network is generated by inputting the first fake sample and the real sample into the conditions. The discriminator obtains a first recognition score that identifies the sample type of the first fake sample as real and a second recognition score that identifies the sample type of the real sample as real. A discriminator loss function is constructed based on the first and second recognition scores, and the network parameters of the discriminator are updated by backpropagation based on the discriminator loss function. With the network parameters of the discriminator fixed, train the generator, including the following steps: The sample condition parameter vector and random noise sampled based on the standard normal distribution are concatenated and input into the generator to obtain the second predicted latent vector output by the generator. The second predicted latent vector and the corresponding sample condition parameter vector are concatenated to obtain the second fake sample. The second fake sample is input into the discriminator, and a third recognition score is obtained in which the discriminator identifies the sample type of the second fake sample as real. A generator loss function is constructed based on the third recognition score, and the network parameters of the generator are updated by backpropagation based on the generator loss function. The steps of training the discriminator and training the generator are performed alternately to obtain a trained conditional generative adversarial network.
7. The method for generating hydraulic engineering model conditions based on deep learning according to any one of claims 1-6, characterized in that, Before modeling based on the command type and command parameter values of each command in the command sequence matrix, the method further includes: If the user modifies the command type and / or command parameter value of any modeling command in the command sequence matrix output by the autoencoder, the modified command sequence matrix and the corresponding condition parameter vector are used as incremental samples and added to the incremental sample set. The number of samples in the incremental sample set is counted. If the number of samples is greater than the sample number threshold, the autoencoder and conditional generative adversarial network are incrementally trained based on the incremental sample set to obtain the incrementally trained autoencoder and conditional generative adversarial network. Evaluate the accuracy of the autoencoder and conditional generative adversarial network after incremental training on the original validation set, and evaluate the accuracy of the autoencoder and conditional generative adversarial network before incremental training on the original validation set. If the decrease in accuracy after incremental training relative to the accuracy before incremental training is greater than a preset threshold, then incremental training is terminated, and the network parameters of the autoencoder and conditional generative adversarial network before incremental training are maintained; otherwise, the network parameters of the autoencoder and conditional generative adversarial network after incremental training are maintained.
8. A device for generating conditions for hydraulic engineering models based on deep learning, characterized in that, include: The data acquisition unit is used to acquire the design conditions of the water conservancy project model and to obtain the condition parameter vector based on the encoding of the design conditions of the water conservancy project model. The data processing unit is used to concatenate the conditional parameter vector and random noise sampled based on the standard normal distribution and input it into the generator of the trained conditional generative adversarial network to obtain the generator latent vector output by the generator. The data processing unit is also used to input the generated latent vector and conditional parameter vector into the decoder of the trained autoencoder, and obtain the command sequence matrix through the output layer of the autoencoder. The modeling unit is used to perform modeling based on the command type and command parameter value of each modeling command in the command sequence matrix, so as to obtain a water conservancy engineering model that meets the design conditions of the water conservancy engineering model. The autoencoder is trained based on a first sample set, which is constructed based on the sample condition parameter vector and sample command sequence matrix of multiple sample water conservancy engineering models. The conditional generative adversarial network is obtained by adversarial training of the generator and discriminator based on a second sample set, which is obtained by sampling the processing results of the first sample set by the trained autoencoder.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the deep learning-based hydraulic engineering model condition generation method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the deep learning-based hydraulic engineering model condition generation method as described in any one of claims 1 to 7.