Simulation data generation method, terminal device and readable storage medium
By inputting real data into the pre-trained generative model, latent vectors are generated and spliced with conditional vectors, the problem of low simulation data generation efficiency is solved, efficient and diversified simulation data generation is achieved, real data distribution is automatically learned, and generation is improved. quality.
Patent Information
- Application Number
- CN202411118346.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-15
AI Technical Summary
The simulation data generation efficiency in the existing technology is low, and it is necessary to construct a directed acyclic graph and specify the probability distribution of real data in advance, resulting in low generation efficiency and insufficient diversity.
By inputting real data into a pre-trained generative model, latent vectors are generated and spliced with conditional vectors to generate simulated data. The generative model is used to automatically learn the distribution of real data, improve generation efficiency, and generate diverse simulated data through different conditional vectors.
It improves the efficiency and diversity of simulation data generation, avoids the analysis of massive real data, realizes automatic learning of potential distributions, and generates high-quality simulation data.
Smart Images

Figure CN118643351B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method for generating simulation data, a terminal device and a readable storage medium. Background Art
[0002] Simulated data refers to a set of artificial data generated based on real data. The generated simulated data has similar distribution and characteristics to the real data. Simulated data can be used for various purposes, such as data analysis, model verification, algorithm testing, etc.
[0003] In the related art, a Bayesian network is usually used to generate simulated data. The directed acyclic graph in the Bayesian network and the probability distribution of real data are key factors affecting the quality of the generated simulated data. However, before the real data is input into the Bayesian network to generate simulated data, a directed acyclic graph needs to be constructed in advance based on domain knowledge, expert experience or the results of previous studies to determine the dependencies between the real data. It is also necessary to specify the probability distribution of the real data in advance or obtain clear prior knowledge to be used as parameter estimates for each node when generating simulated data, so that the generated simulated data is consistent with the distribution of the real data and can reflect the distribution characteristics of the real data. However, the construction of the directed acyclic graph and the probability distribution of the real data require the analysis of a large amount of real data to obtain, which will result in low efficiency in generating simulated data.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The present invention aims to solve the technical problem of low generation efficiency of simulation data by providing a method for generating simulation data, a terminal device and a computer-readable storage medium.
[0006] To achieve the above object, an embodiment of the present invention provides a method for generating simulation data, and the method for generating simulation data includes the following steps:
[0007] Inputting real data into a pre-trained generative model, and generating a latent vector of the real data based on an encoder of the generative model;
[0008] The generator based on the generative model concatenates the latent vector and the set conditional vector to obtain a concatenated vector;
[0009] According to the splicing vector, simulated data corresponding to the real data is generated.
[0010] Optionally, the generator based on the generative model concatenates the potential vector and the set conditional vector to obtain a concatenated vector, comprising:
[0011] Obtaining a first dimension of the conditional vector and a second dimension of the latent vector;
[0012] When the difference between the first dimension and the second dimension is greater than a set threshold, splicing the latent vector and the conditional vector using a first splicing rule to obtain the splicing vector;
[0013] When the difference between the first dimension and the second dimension is less than or equal to a set threshold, using a second splicing rule to splice the latent vector and the conditional vector to obtain the splicing vector;
[0014] The first splicing rule is to splice the latent vector and the conditional vector as a whole; the second splicing rule is to splice each component element of the latent vector with each component element of the conditional vector respectively.
[0015] Optionally, before the step of using the second splicing rule to splice the potential vector and the conditional vector to obtain the spliced vector, the step includes:
[0016] When the first dimension is smaller than the second dimension, randomly selecting a preset number of target constituent elements from constituent elements of the conditional vector, the preset number being the difference between the first dimension and the second dimension;
[0017] The target component is updated to the conditional vector so that a first dimension of the conditional vector is the same as a second dimension of the latent vector.
[0018] Optionally, before the step of using the second splicing rule to splice the potential vector and the conditional vector to obtain the spliced vector, the step further includes:
[0019] When the first dimension is greater than the second dimension, selecting a preset number of target constituent elements from constituent elements of the conditional vector, where the preset number is the difference between the first dimension and the second dimension;
[0020] The target component elements are randomly concatenated with the component elements in the conditional vector so that the first dimension of the conditional vector and the second dimension of the latent vector are the same.
[0021] Optionally, the step of inputting the real data into a pre-trained generative model and generating a latent vector of the real data based on an encoder of the generative model comprises:
[0022] determining a mean and a variance of the real data based on the encoder;
[0023] The latent vector of the real data is generated according to the mean and variance.
[0024] Optionally, before the step of generating the potential vector of the real data according to the mean and the variance, the step includes:
[0025] Obtaining random noise corresponding to the real data;
[0026] The latent vector of the real data is generated according to the mean, the variance and the random noise.
[0027] Optionally, before the step of inputting the real data into a pre-trained generative model and generating a latent vector of the real data based on an encoder of the generative model, the step comprises:
[0028] Acquire a training data set corresponding to the real data;
[0029] Inputting the training data set into the generative model to obtain simulation data generated by the generative model based on the generator;
[0030] Inputting the simulated data into the discriminator of the generative model, wherein the discriminator determines a loss value of a set loss function based on the generated simulated data;
[0031] Back-propagating the loss value to update the model parameters of the generative model;
[0032] Optionally, the step of obtaining a training data set corresponding to the real data is continued until the loss value is within a preset threshold range.
[0033] The encoder of the generative model is composed of an encoder of a variational autoencoder network, and the generator and discriminator of the generative model are composed of a generator and a discriminator of a conditional generative adversarial network.
[0034] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal device, which includes: a memory, a processor, and a simulation data generation program stored in the memory and executable on the processor, and the simulation data generation program, when executed by the processor, implements the steps of the simulation data generation method as described above.
[0035] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a simulation data generation program is stored, and when the simulation data generation program is executed by a processor, the steps of the simulation data generation method as described above are implemented.
[0036] The present invention proposes a method for generating simulated data, a terminal device, and a computer-readable storage medium, which inputs real data into a pre-trained generative model, generates a latent vector of the real data based on an encoder of the generative model, and splices the latent vector with a set conditional vector by a generator based on the generative model to obtain a spliced vector, and generates simulated data corresponding to the real data according to the spliced vector. The present invention can automatically learn the latent distribution of the real data based on the input real data through the pre-trained generative model, without specifying the probability distribution of the real data by analyzing a large amount of real data in advance, thereby improving the generation efficiency of the simulated data, and the present invention can generate any type of simulated data by inputting different conditional vectors, thereby increasing the diversity of the simulated data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flowchart of a first embodiment of a method for generating simulation data of the present invention;
[0038] Figure 2 A schematic flow chart of a second embodiment of a method for generating simulation data according to the present invention;
[0039] Figure 3 is a flow chart of a third embodiment of a method for generating simulation data of the present invention;
[0040] Figure 4 A model framework diagram of the method for generating simulation data of the present invention;
[0041] Figure 5 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.
[0042] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0044] In the related art, a Bayesian network is usually used to generate simulated data. The directed acyclic graph in the Bayesian network and the probability distribution of real data are key factors affecting the quality of the generated simulated data. However, before the real data is input into the Bayesian network to generate simulated data, a directed acyclic graph needs to be constructed in advance based on domain knowledge, expert experience or the results of previous studies to determine the dependencies between the real data. It is also necessary to specify the probability distribution of the real data in advance or obtain clear prior knowledge to be used as parameter estimates for each node when generating simulated data, so that the generated simulated data is consistent with the distribution of the real data and can reflect the distribution characteristics of the real data. However, the construction of the directed acyclic graph and the probability distribution of the real data require the analysis of a large amount of real data to obtain, which will result in low efficiency in generating simulated data.
[0045] In order to solve the above defects in the related art, the present invention proposes a method for generating simulation data, and its main solution steps include the following:
[0046] By inputting real data into a pre-trained generative model, an encoder based on the generative model generates a latent vector of the real data, and a generator based on the generative model splices the latent vector and the set conditional vector to obtain a spliced vector, and generates simulated data corresponding to the real data according to the spliced vector. The present invention can automatically learn the latent distribution of real data according to the input real data through a pre-trained generative model, without specifying the probability distribution of real data by analyzing massive real data in advance, thereby improving the generation efficiency of simulated data, and the present invention can generate any type of simulated data by inputting different conditional vectors, thereby increasing the diversity of simulated data.
[0047] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.
[0048] Reference Figure 1 In a first embodiment of a method for generating simulation data of the present invention, the method for generating simulation data comprises the following steps:
[0049] Step S10: inputting real data into a pre-trained generative model, and generating a latent vector of the real data based on an encoder of the generative model;
[0050] The generative model of the present invention is composed of an encoder, a generator and a discriminator. The generator can also be called a decoder, wherein the discriminator is only used when training the generative model.
[0051] In this embodiment, the encoder of the generative model can be composed of an autoencoder (AE). After the structured real data is input into the generative model, the input real data is converted and processed through a series of neural network layers of the encoder to determine the mean and variance of the real data, and then the potential distribution of the real data is learned based on the mean and variance of the real data to generate the potential vector of the real data, without having to specify the specific distribution of the real data by analyzing the massive real data in advance, thereby improving the generation efficiency of the simulated data.
[0052] For example, the input n real data is , after the autoencoder performs a series of transformations and processing on the input real data, it determines the mean of the real data and variance , and then the encoder further generates the latent vector of the real data according to the mean and variance . And the dimension m of the latent vector is much smaller than the dimension n of the real data X.
[0053] Alternatively, the generative expression of the latent vector can be expressed as:
[0054] ,i=1,...,m
[0055] Optionally, to avoid leakage of real data and protect the privacy of real data, before generating a latent vector of the real data according to the mean and variance of the real data, random noise corresponding to the real data may be obtained, and then a latent vector of the real data may be generated according to the mean, variance and random noise.
[0056] In this embodiment, the encoder of the generative model can be composed of a variational autoencoder (VAE). After the structured real data is input into the generative model, the input real data is converted and processed through a series of neural network layers of the encoder to determine the mean and variance of the real data, and then when learning the potential distribution of the real data based on the mean and variance of the real data, random noise is added to generate a potential vector of the real data, thereby achieving the purpose of protecting the privacy of the real data.
[0057] For example, the input n real data is , after the autoencoder performs a series of transformations and processing on the input real data, it determines the mean of the real data and variance , and then the encoder further obtains the random noise of the real data, according to the mean and variance and random noise Generating latent vectors for real data . And the dimension m of the latent vector is much smaller than the dimension n of the real data X.
[0058] Alternatively, the generative expression of the latent vector can be expressed as:
[0059] ,i=1,...,m
[0060] Step S20: The generator based on the generative model concatenates the potential vector and the set conditional vector to obtain a concatenated vector;
[0061] In this embodiment, the generator may be composed of a generator of conditional generative adversarial networks (cGANs). In order to improve the quality of simulation data generation, conditional vectors are introduced into the generator to control the data type of the generated simulation data through the conditional vectors, thereby increasing the diversity of the simulation data. The generator obtains a splicing vector by splicing the potential vector with the set conditional vector according to the set rules, so that when the simulation data is subsequently generated according to the splicing vector, the corresponding type of simulation data can be generated according to the conditional information of the conditional vector fused in the splicing vector, thereby increasing the diversity of the simulation data and improving the user experience.
[0062] Optionally, the conditional vector can be any form of additional information, such as category labels, descriptions, etc.
[0063] For example, in the simulation of a database table, each element in the condition vector can be corresponded to each column of the table, and then the database table with specific column attributes can be generated by controlling the value of the condition vector. This ensures that the generated table contains the required columns and has the correct attributes.
[0064] Step S30: Generate simulation data corresponding to the real data according to the splicing vector.
[0065] In this embodiment, after obtaining the splicing vector, the generator processes and transforms the splicing vector through several neural network layers, maps the splicing vector to the same dimensional space as the real data, simulates the data distribution of the real data, and generates simulated data.
[0066] It should be noted that the generative model constructed by combining the conditional adversarial network with the variational autoencoder or the autoencoder in the present invention has high robustness, good quality of the generated simulation data, and increased diversity of the simulation data. It avoids the problem of mode collapse caused by the encoder of the conditional adversarial network, that is, the conditional adversarial network generator falls into the problem of having an optimal solution.
[0067] In the technical solution provided in this embodiment, by inputting real data into a pre-trained generative model, an encoder based on the generative model generates a latent vector of the real data, a generator based on the generative model splices the latent vector and the set conditional vector to obtain a spliced vector, and generates simulated data corresponding to the real data according to the spliced vector. The present invention can automatically learn the latent distribution of real data based on the input real data through a pre-trained generative model, without having to specify the probability distribution of real data by analyzing massive real data in advance, thereby improving the generation efficiency of simulated data, and the present invention can generate any type of simulated data by inputting different conditional vectors, thereby increasing the diversity of simulated data.
[0068] Reference Figure 2 In the second embodiment, based on the first embodiment, the step S20 includes:
[0069] Step S21: obtaining the first dimension of the conditional vector and the second dimension of the potential vector;
[0070] In this embodiment, the conditional vector and the latent vector are both composed of a corresponding number of constituent elements. The number of constituent elements is the corresponding dimension. Therefore, the constituent elements of the conditional vector can be counted to determine the first dimension of the conditional vector, and the constituent elements of the latent vector can be counted to determine the second dimension of the latent vector.
[0071] Step S22: when the difference between the first dimension and the second dimension is greater than a set threshold, the potential vector and the conditional vector are spliced using a first splicing rule to obtain the spliced vector;
[0072] In this embodiment, when the first dimension and the second dimension are not equal, in order to avoid information loss of the conditional vector, the unjoined components in the conditional vector need to be joined again with the joined components in the latent vector. However, when the components of the latent vector join too many components in the conditional vector, it will cause the focus to be placed on the conditional information in the conditional vector while ignoring the potential distribution of the real data in the latent vector when generating the simulated data, resulting in poor quality of the generated simulated data. Therefore, the threshold value set in the present invention is the maximum number of components of the conditional vector that can be joined by a component of the latent vector. The threshold value is set to be at least greater than 1. The first joining rule refers to treating the various components of the latent vector as a whole, treating the various components of the conditional vector as a whole, and directly joining the latent vector and the conditional vector as a whole to improve the quality of the generated simulated data. The dimension of the joined vector obtained after joining is the sum of the first dimension and the second dimension.
[0073] For example, if you want to generate simulated data for a table of employee information for a specific position, you can use the position information as the condition vector , the first dimension is k. The latent vector is , the second dimension is m. The difference of |km| is greater than the set threshold. At this time, the first splicing rule is used to splice the two vectors as a whole to obtain the splicing vector: = , the dimension is (m+k).
[0074] Step S23: when the difference between the first dimension and the second dimension is less than or equal to a set threshold, the potential vector and the conditional vector are spliced using a second splicing rule to obtain the spliced vector;
[0075] Step S24: the first concatenation rule is to concatenate the latent vector and the conditional vector as a whole; the second concatenation rule is to concatenate each component element of the latent vector with each component element of the conditional vector respectively.
[0076] In this embodiment, the second splicing rule refers to sequentially aligning and splicing each component element of the latent vector with each component element of the conditional vector, and the dimension of the splicing vector obtained after splicing is the second dimension.
[0077] Optionally, when the difference between the first dimension and the second dimension is 0, it indicates that the first dimension and the second dimension are equal, and at this time, each component element of the latent vector is just aligned and spliced with each component element of the conditional vector.
[0078] For example, if you want to generate simulated data for a table of employee information for a specific position, you can use the position information as the condition vector , the first dimension is k. The latent vector is , the second dimension is m. The difference of |km| is greater than the set threshold. At this time, the second splicing rule is used to splice the two vectors as a whole to obtain the splicing vector: = , with dimension k.
[0079] Optionally, before the step of splicing the latent vector and the conditional vector by using the second splicing rule to obtain the spliced vector, the step includes: when the first dimension is smaller than the second dimension, randomly selecting a preset number of target constituent elements from the constituent elements of the conditional vector, where the preset number is the difference between the first dimension and the second dimension, and updating the target constituent elements to the conditional vector so that the first dimension of the conditional vector and the second dimension of the latent vector are the same.
[0080] In this embodiment, when the first dimension is smaller than the second dimension, if the latent vector and the conditional vector are directly spliced, the latent vector will have unspliced components, resulting in inconsistency between the components of the spliced vector corresponding to the latent vector, and the existence of simulated data of the data type corresponding to the conditional vector in the subsequently generated simulation data. Therefore, the present invention randomly selects a preset number of components from the conditional vector, and adds the selected components as extended elements to the conditional vector to expand the components of the conditional vector, so that the dimension of the conditional vector is consistent with the dimension of the latent vector, while not introducing other elements unrelated to the conditional vector, avoiding inconsistency between the components of the spliced vector obtained after splicing, and improving the generation quality of the simulation data.
[0081] Optionally, before the step of splicing the latent vector and the conditional vector by using the second splicing rule to obtain the spliced vector, the step includes: when the first dimension is greater than the second dimension, screening a preset number of target constituent elements from the constituent elements of the conditional vector, the preset number being the difference between the first dimension and the second dimension, and randomly splicing the target constituent elements with the constituent elements in the conditional vector so that the first dimension of the conditional vector and the second dimension of the latent vector are the same.
[0082] In this embodiment, when the first dimension is greater than the second dimension, if the potential vector and the conditional vector are directly spliced, some components in the conditional vector will not be able to be spliced with the potential vector, resulting in the conditional information of the conditional vector being discarded. Therefore, the present invention randomly selects a preset number of target components from the conditional vector, and the second dimension of the selected conditional vector is consistent with the first dimension of the potential vector, and then randomly splices each target component selected from the conditional vector with the corresponding component in the conditional vector to avoid information loss of the conditional vector.
[0083] In the technical solution provided in this embodiment, by obtaining the first dimension of the conditional vector and the second dimension of the latent vector, when the difference between the first dimension and the second dimension is greater than the set threshold, the first splicing rule is used to splice the latent vector and the conditional vector to obtain a spliced vector, and when the difference between the first dimension and the second dimension is less than or equal to the set threshold, the second splicing rule is used to splice the latent vector and the conditional vector to obtain a spliced vector. The first splicing rule is to splice the latent vector and the conditional vector as a whole, and the second splicing rule is to splice each component element of the latent vector with each component element of the conditional vector respectively, so that the spliced vector obtained by splicing is fully integrated with the conditional information in the conditional vector to generate simulation data consistent with the conditional vector type, thereby increasing the diversity of the simulation data and improving the generation quality of the simulation data.
[0084] Reference Figure 3In a third embodiment, based on any of the above embodiments, before step S10, the steps include:
[0085] Step S40: obtaining a training data set corresponding to the real data;
[0086] Step S50: inputting the training data set into the generative model to obtain simulation data generated by the generative model based on the generator;
[0087] In this embodiment, the generative model needs to be trained before it is put into use. The generative model generates a latent vector of the training data set based on the encoder by inputting the training data set into the generative model, and the latent vector and the set conditional vector are spliced based on the generator to obtain a spliced vector, and then the simulation data corresponding to the training data set is generated according to the spliced vector. The specific implementation steps can be referred to the above-mentioned embodiments, which will not be repeated here.
[0088] Step S60: inputting the simulation data into the discriminator of the generation model, and the discriminator determines the loss value of the set loss function based on the generated simulation data;
[0089] In this embodiment, after the generative model generates simulated data of the training data set, the loss value of the loss function is calculated based on the discriminator.
[0090] The loss function expression of the present invention is:
[0091]
[0092] in, represents the loss value of the encoder, is the loss value of the generator.
[0093] Further, and The expression can be expressed as:
[0094]
[0095]
[0096] Among them, D(x) is the discriminant function, G(x) is the generating function, the discriminant function is used to judge the probability that the generated simulated data is the real data, and the generating function is used to judge the probability of generating simulated data. x is the real data, y is the conditional vector, and z is the potential vector. Represents the probability that the generator generates real data when the conditional vector y is given; represents the probability that the encoder generates the latent vector z given the conditional vector y; represents the probability that the generator generates real data when the conditional vector y is given and the encoder generates the latent vector z; p(x|z) represents the probability that the generator generates real data x when the latent vector z is given; q(z|x) represents the probability that the encoder generates the latent vector z when the real data x is given; and so on. Indicates a given The probability that the generator generates real data x when , which will not be described here. KL(q||p) is the KL divergence of probability distributions q and p.
[0097] In this embodiment, the difference between the simulated data and the real data is measured by using the KL divergence. A larger KL divergence indicates a larger difference between the simulated data and the real data.
[0098] Optionally, the loss function KL divergence can be replaced by Wasserstein distance, which is not specifically limited in this embodiment. Wasserstein distance measures the difference between the generated sample distribution and the true sample distribution. Unlike KL divergence, Wasserstein distance is symmetric and satisfies the triangle inequality. Wasserstein distance is more robust when dealing with sparse regions, and it can provide a meaningful bounded distance for two distributions with different support sets.
[0099] Step S70: back-propagating the loss value to update the model parameters of the generation model;
[0100] In this embodiment, during the training phase of the generative model, the discriminator of the generative model automatically calculates the loss value according to the loss function, and then back-propagates the loss value in the generative model to continuously update the model parameters of the generative model.
[0101] Step S80: Continue to execute the step of obtaining a training data set corresponding to the real data until the loss value is within a preset threshold range.
[0102] In this embodiment, the present invention can determine whether to end the training of the generative model according to the loss value, that is, whether the generative model meets the conditions for generating simulated data. The present invention does not pursue the minimum KL divergence, but controls the KL divergence within a reasonable range to control the loss value within a preset threshold range, thereby ensuring that the simulated data is diverse and available, while not being too close to the real data to protect the privacy of the real data.
[0103] For example, refer to Figure 4 , Figure 4The model framework diagram of the method for generating simulated data of the present invention. The generation model is composed of an encoder, a generator and a discriminator. Among them, the encoder is a variational autoencoder, the generator is a conditional adversarial network generator, and the discriminator is a conditional adversarial network discriminator.
[0104] In the technical solution provided in this embodiment, a training data set corresponding to the real data is obtained, the training data set is input into the generative model, the simulated data generated by the generative model based on the generator is obtained, and then the simulated data is input into the discriminator of the generative model. The discriminator determines the loss value of the set loss function based on the generated simulated data, back-propagates the loss value, updates the model parameters of the generative model, and then continues to execute the step of obtaining the training data set corresponding to the real data until the loss value is within the preset threshold range, so as to ensure that the simulated data is diverse and available, and at the same time not too close to the real data, so as to achieve the purpose of protecting the privacy of the real data.
[0105] Reference Figure 5 , Figure 5 The figure is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention.
[0106] like Figure 5 As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), a mouse, etc., and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0107] Those skilled in the art will understand that Figure 5 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0108] like Figure 5 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a simulation data generation program.
[0109] exist Figure 5In the terminal shown, the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server; the processor 1001 can be used to call the simulation data generation program stored in the memory 1005 and perform the following operations:
[0110] Inputting real data into a pre-trained generative model, and generating a latent vector of the real data based on an encoder of the generative model;
[0111] The generator based on the generative model concatenates the latent vector and the set conditional vector to obtain a concatenated vector;
[0112] According to the splicing vector, simulated data corresponding to the real data is generated.
[0113] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0114] Obtaining a first dimension of the conditional vector and a second dimension of the latent vector;
[0115] When the difference between the first dimension and the second dimension is greater than a set threshold, splicing the latent vector and the conditional vector using a first splicing rule to obtain the splicing vector;
[0116] When the difference between the first dimension and the second dimension is less than or equal to a set threshold, using a second splicing rule to splice the latent vector and the conditional vector to obtain the splicing vector;
[0117] The first splicing rule is to splice the latent vector and the conditional vector as a whole; the second splicing rule is to splice each component element of the latent vector with each component element of the conditional vector respectively.
[0118] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0119] When the first dimension is smaller than the second dimension, randomly selecting a preset number of target constituent elements from constituent elements of the conditional vector, the preset number being the difference between the first dimension and the second dimension;
[0120] The target component is updated to the conditional vector so that a first dimension of the conditional vector is the same as a second dimension of the latent vector.
[0121] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0122] When the first dimension is greater than the second dimension, selecting a preset number of target constituent elements from constituent elements of the conditional vector, where the preset number is the difference between the first dimension and the second dimension;
[0123] The target component elements are randomly concatenated with the component elements in the conditional vector so that the first dimension of the conditional vector and the second dimension of the latent vector are the same.
[0124] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0125] determining a mean and a variance of the real data based on the encoder;
[0126] The latent vector of the real data is generated according to the mean and variance.
[0127] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0128] Obtaining random noise corresponding to the real data;
[0129] The latent vector of the real data is generated according to the mean, the variance and the random noise.
[0130] Further, the processor 1001 may call a simulation data generation program stored in the memory 1005, and further perform the following operations:
[0131] Acquire a training data set corresponding to the real data;
[0132] Inputting the training data set into the generative model to obtain simulation data generated by the generative model based on the generator;
[0133] Inputting the simulated data into the discriminator of the generative model, wherein the discriminator determines a loss value of a set loss function based on the generated simulated data;
[0134] Back-propagating the loss value to update the model parameters of the generative model;
[0135] Continue to execute the step of obtaining a training data set corresponding to the real data until the loss value is within a preset threshold range.
[0136] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal device, which includes: a memory, a processor, and a simulation data generation program stored in the memory and executable on the processor, and the simulation data generation program, when executed by the processor, implements the steps of the simulation data generation method as described above.
[0137] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a simulation data generation program is stored, and when the simulation data generation program is executed by a processor, the steps of the simulation data generation method as described above are implemented.
[0138] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0139] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0140] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer) to execute the methods described in each embodiment of the present invention.
[0141] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for generating simulation data, characterized in that: The method for generating the simulation data comprises: Inputting real data into a pre-trained generative model, and generating a latent vector of the real data based on an encoder of the generative model; Obtaining a first dimension of a set conditional vector and a second dimension of the potential vector; When the difference between the first dimension and the second dimension is greater than a set threshold, the potential vector and the conditional vector are spliced using a first splicing rule to obtain the splicing vector, wherein the first splicing rule is to splice the potential vector and the conditional vector as a whole; When the difference between the first dimension and the second dimension is less than or equal to a set threshold, using a second splicing rule to splice the latent vector and the conditional vector to obtain the splicing vector; The first concatenation rule is to concatenate the latent vector and the conditional vector as a whole, wherein the second concatenation rule is to concatenate each component element of the latent vector with each component element of the conditional vector respectively; Generate simulation data corresponding to the real data according to the splicing vector; Wherein, before the step of using the second splicing rule to splice the potential vector and the conditional vector to obtain the splicing vector, the step includes: When the first dimension is smaller than the second dimension, randomly selecting a preset number of target constituent elements from constituent elements of the conditional vector, the preset number being the difference between the first dimension and the second dimension; Updating the target component to the conditional vector so that the first dimension of the conditional vector is the same as the second dimension of the latent vector; When the first dimension is greater than the second dimension, selecting a preset number of target constituent elements from constituent elements of the conditional vector, where the preset number is the difference between the first dimension and the second dimension; The target component elements are randomly concatenated with the component elements in the conditional vector so that the first dimension of the conditional vector and the second dimension of the latent vector are the same.
2. The method according to claim 1, characterized in that The step of inputting real data into a pre-trained generative model and generating a latent vector of the real data based on an encoder of the generative model comprises: determining a mean and a variance of the real data based on the encoder; The latent vector of the real data is generated according to the mean and variance.
3. The method according to claim 2, characterized in that Before the step of generating the potential vector of the real data according to the mean and the variance, the method further comprises: Obtaining random noise corresponding to the real data; The latent vector of the real data is generated according to the mean, the variance and the random noise.
4. The method according to claim 1, characterized in that Before the step of inputting the real data into the pre-trained generative model and generating the latent vector of the real data based on the encoder of the generative model, the method includes: Acquire a training data set corresponding to the real data; Inputting the training data set into the generative model to obtain simulation data generated by the generative model based on the generator; Inputting the simulated data into the discriminator of the generative model, wherein the discriminator determines a loss value of a set loss function based on the generated simulated data; Back-propagating the loss value to update the model parameters of the generative model; Continue to execute the step of obtaining a training data set corresponding to the real data until the loss value is within a preset threshold range.
5. The method according to claim 4, characterized in that The encoder of the generative model is composed of an encoder of a variational autoencoder network, and the generator and discriminator of the generative model are composed of a generator and a discriminator of a conditional generative adversarial network.
6. A terminal device, characterized in that: The terminal device includes: a memory, a processor, and a program for generating simulation data of the terminal device stored in the memory and executable on the processor. When the program for generating simulation data of the terminal device is executed by the processor, the steps of the method for generating simulation data as described in any one of claims 1 to 5 are implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for generating simulation data of a terminal device, and when the program for generating simulation data of the terminal device is executed by a processor, the steps of the method for generating simulation data according to any one of claims 1 to 5 are implemented.
