Sample generation method, system, computer device, and storage medium
The generative adversarial network model trained through intelligent self-learning method, combined with distributed system optimization generation and discriminant models, solves the problems of low generated samples and low training efficiency, and realizes the expansion of the grid sample set and the improvement of the accuracy of the artificial intelligence model.
Patent Information
- Application Number
- CN202210297061.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2042-03-24
AI Technical Summary
The existing generative adversarial network models lack intelligent self-learning capabilities during training, resulting in low quality of generated samples and low training efficiency, which limits the application accuracy and efficiency of artificial intelligence algorithms in power grids and other fields.
The generative adversarial network model trained using intelligent self-learning method is trained through a distributed system, and the coordinator unit optimizes the combination of generation and discriminative models to improve the quality of the generated sample and improve training efficiency.
Effectively expanding the sample set of the grid improves the prediction accuracy and training efficiency of the artificial intelligence model, and solves the problems of insufficient and unbalanced samples.
Smart Images

Figure CN114626526B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power automation, and relates to a sample generation method, system, computer device and storage medium. Background Art
[0002] At present, with the continuous expansion of the scale of the power grid, the pressure of work such as the operation and maintenance of the power grid is increasing day by day. In the work of power grid operation and maintenance, artificial intelligence technology is generally adopted. The application of artificial intelligence technology significantly reduces the labor intensity of personnel and the amount of manual input, greatly improves work efficiency, and provides strong technical support for the safe operation of the power grid. The artificial intelligence technology applied in the power grid is mainly based on deep learning. The main application process includes: First, collect on-site data of power operations, such as device pictures, transformer audio, and work order texts, and label these data to form a sample data set; Then, design an artificial intelligence algorithm model and use a certain method to learn the sample data set. The learning process is usually called training; Finally, deploy the trained model to the operating environment, input the real data of the business site, and the model will output the results of intelligent recognition. The process of model operation is usually called inference. By adopting the above steps for the application of artificial intelligence technology, good application results have been achieved.
[0003] However, in the data collection stage of the application of artificial intelligence technology, due to the problems of few fault samples or defect samples and unevenness of various samples, the artificial intelligence algorithm based on deep learning is highly dependent on samples. The problems of insufficient sample quantity or uneven samples greatly limit the improvement of the accuracy of the artificial intelligence algorithm. Therefore, for power grid services and other services with extremely high requirements for the reliability and accuracy of samples, in the case of insufficient sample quantity or uneven samples, the application of artificial intelligence algorithms in such services is greatly restricted, and there is an urgent need for a sample expansion technology to expand the number of samples in the sample set. Summary of the Invention
[0004] The purpose of the present invention is to overcome the above-mentioned disadvantages of the prior art and provide a sample generation method, system, computer device and storage medium.
[0005] To achieve the above purpose, the present invention adopts the following technical solutions:
[0006] In the first aspect of the present invention, a sample generation method includes:
[0007] Obtain sample generation information;
[0008] Call a preset sample generation model and input the sample generation information into the sample generation model; wherein, the sample generation model is at least one of the generation models of the generative adversarial network model trained by using real samples in an intelligent self-learning manner;
[0009] Generate and output generated samples through the sample generation model.
[0010] Optionally, when calling the preset sample generation model, the sample generation model is constructed in the following manner:
[0011] Construct a generative adversarial network model including a coordinator unit, a number of generation models, and a number of discriminant models;
[0012] Randomly assign a one-to-one corresponding discriminant model to each generation model through the coordinator unit to obtain a number of generation-discriminant model groups, obtain real samples, and initially train each generation-discriminant model group according to the real samples to obtain a number of initially trained generation models and a number of initially trained discriminant models;
[0013] Iterate the retraining step until the loss function of the generative adversarial network model converges stably to obtain a number of finally trained generation models and a number of finally trained discriminant models; Retraining step: Randomly assign a one-to-one corresponding initially trained discriminant model to each initially trained generation model through the coordinator unit to obtain a number of initially trained generation-discriminant model groups, and iteratively train each initially trained generation-discriminant model group according to the real samples;
[0014] Obtain the generation capabilities of each finally trained generation model, and select the first preset number of finally trained generation models with the strongest generation capabilities to obtain the sample generation model.
[0015] Optionally, the initial training of each generation-discriminant model group according to the real samples includes:
[0016] Iteratively train each generation-discriminant model group according to the real samples until the correct judgment rate of the discriminant model for the real samples in each generation-discriminant model group is greater than the first preset value, and the misjudgment rate of the discriminant model for the generated samples generated by the generation model is greater than the second preset value, to obtain a number of initially trained generation models and a number of initially trained discriminant models.
[0017] Optionally, the obtaining of the generation capabilities of each finally trained generation model includes:
[0018] Obtain the second preset number of generated samples generated by each finally trained generation model;
[0019] Input the third preset quantity of real samples and the second preset quantity of generated samples generated by each final trained generation model into each final trained discrimination model, and count the total quantity of the generated samples output as fake samples and the real samples output as real samples by each final trained discrimination model, so as to obtain the discrimination ability of each final trained discrimination model;
[0020] Input the second preset quantity of generated samples generated by each final trained generation model into the first fourth preset quantity of final trained discrimination models with the highest discrimination ability, and sequentially count the total quantity of the generated samples output as true samples by the first fourth preset quantity of final trained discrimination models with the highest discrimination ability, so as to obtain the generation ability of each final trained generation model.
[0021] Optionally, the obtaining of a plurality of final trained generation models and a plurality of final trained discrimination models further includes:
[0022] Update each final trained generation model and each final trained discrimination model in the following manner:
[0023] Obtain the generation ability of each final trained generation model and the discrimination ability of each final trained discrimination model;
[0024] Use the model data of the first fifth preset quantity of final trained generation models with the highest generation ability to replace the model data of the first fifth preset quantity of final trained generation models with the highest generation ability;
[0025] Use the model data of the first sixth preset quantity of final trained discrimination models with the highest discrimination ability to replace the model data of the last sixth preset quantity of final trained discrimination models with the lowest discrimination ability;
[0026] Iteratively update the training steps until the loss function of the generative adversarial network model converges stably; Update the training steps: Randomly assign a one-to-one corresponding final trained discrimination model to each final trained generation model through the coordinator unit to obtain a plurality of final trained generation-discrimination model groups; Iteratively train each final trained generation-discrimination model group according to the real samples.
[0027] Optionally, when initially training each generation-discrimination model group according to the real samples and iteratively training each initially trained generation-discrimination model group according to the real samples, the training is all performed on a distributed system;
[0028] Wherein, when the generation model and the corresponding discrimination model are not in the same node of the distributed system, the discrimination model is moved to the node where the corresponding generation model is located through the coordinator unit; When the initially trained generation model and the corresponding initially trained discrimination model are not in the same node of the distributed system, the initially trained discrimination model is moved to the node where the corresponding initially trained generation model is located through the coordinator unit.
[0029] In the second aspect of the present invention, a sample generation system includes:
[0030] A data acquisition module for acquiring sample generation information;
[0031] A model calling module for calling a preset sample generation model and inputting the sample generation information into the sample generation model; wherein, the sample generation model is at least one of the generation models of a generative adversarial network model trained by a real sample in an intelligent self-learning manner;
[0032] A data output module for generating and outputting generated samples through the sample generation model.
[0033] Optionally, the preset sample generation model called by the model calling module is constructed by a sample model construction module;
[0034] The sample model construction module includes:
[0035] An initial model construction module for constructing a generative adversarial network model including a coordinator unit, a plurality of generation models, and a plurality of discriminant models;
[0036] An initial training module for randomly assigning a discriminant model corresponding to each generation model through the coordinator unit to obtain a plurality of generation-discriminant model groups, acquiring real samples, and initially training each generation-discriminant model group according to the real samples to obtain a plurality of initially trained generation models and a plurality of initially trained discriminant models;
[0037] A retraining module for iteratively retraining steps until the loss function of the generative adversarial network model converges stably, obtaining a plurality of finally trained generation models and a plurality of finally trained discriminant models; retraining steps: randomly assigning an initially trained discriminant model corresponding to each initially trained generation model through the coordinator unit to obtain a plurality of initially trained generation-discriminant model groups, and iteratively training each initially trained generation-discriminant model group according to the real samples;
[0038] A model generation module for obtaining the generation capabilities of each finally trained generation model, selecting the first preset number of finally trained generation models with the top generation capabilities to obtain a sample generation model.
[0039] In the third aspect of the present invention, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above sample generation method are implemented.
[0040] In the fourth aspect of the present invention, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above sample generation method are implemented.
[0041] Compared with the prior art, the present invention has the following beneficial effects:
[0042] The sample generation method of the present invention obtains sample generation information, then calls a preset sample generation model, inputs the sample generation information into the sample generation model, and finally generates and outputs a generated sample through the sample generation model, realizing the effective expansion of samples in the power field. Moreover, the sample generation model used is at least one of the generation models of the generative adversarial network model trained by means of intelligent self-learning with real samples, effectively solving the deficiency that the existing generative adversarial network model adopts a fixed training method. Through the training method of intelligent self-learning, the quality of the generated samples generated by the sample generation model is effectively improved, and further the prediction accuracy of the artificial intelligence model trained by using it is improved. Brief Description of the Drawings
[0043] Figure 1 It is a flowchart of the sample generation method according to an embodiment of the present invention;
[0044] Figure 2 It is a flowchart of the construction of the sample generation model according to an embodiment of the present invention;
[0045] Figure 3 It is a schematic diagram of the structure of the sample generation model according to an embodiment of the present invention;
[0046] Figure 4 It is a block diagram of the structure of the sample generation system according to an embodiment of the present invention. Detailed Embodiments
[0047] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0048] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0049] The present invention will be further described in detail below with reference to the accompanying drawings:
[0050] In view of the problems in the prior art, the small-sample generation technology based on the generative adversarial technology has achieved certain results in sample expansion. However, the existing generative adversarial network model does not have the ability of intelligent self-learning during the training process, and rarely uses distributed methods to improve the training speed of the generative adversarial network model. Therefore, based on the fixed training method of the existing generative adversarial network model, due to the defect that the training process cannot be intelligently and automatically controlled, the quality of the samples generated by the existing generative adversarial network model is not high, resulting in a low accuracy of the artificial intelligence model trained with these samples and not meeting the training requirements. Secondly, the training process of the existing generative adversarial network model usually uses a single machine, with low training efficiency, resulting in slow algorithm training iteration and restricting the practical application of artificial intelligence technology.
[0051] See Figure 1 , in an embodiment of the present invention, a sample generation method is provided. By using a sample generation model trained with intelligent automatic control to generate generated samples, the quality of the generated samples can be effectively improved. In this embodiment, the sample generation method is described by taking its application in the power grid field as an example, but it is not limited thereto. Other fields that require sample generation, such as the communication field, mining field, and machining field, can also apply this sample generation method. Among them, the following power grid sample generation information, power grid real samples, and power grid generated samples can be understood as the instantiation of sample generation information, real samples, and generated samples in the power grid field. Undoubtedly, different instantiations can be carried out in different application fields.
[0052] Specifically, the sample generation method includes the following steps:
[0053] S1: Obtain power grid sample generation information.
[0054] S2: Call a preset sample generation model and input the power grid sample generation information into the sample generation model.
[0055] Among them, the sample generation model is at least one of the generation models of the generative adversarial network model trained by using intelligent self-learning with power grid real samples.
[0056] S3: Generate and output power grid generated samples through the sample generation model.
[0057] In a possible implementation manner, in step S1, the power grid sample generation information can be a real power grid sample or a random variable. For example, when the sample to be generated is a picture of a power device, the power grid sample generation information can be an existing picture of a power device, or it can also be a randomly generated picture that meets the input requirements of a preset sample generation model.
[0058] See Figure 2 , in a possible implementation manner, in step S2, the preset sample generation model can be constructed in the following manner:
[0059] S201: Construct a generative adversarial network model including a coordinator unit, a number of generation models, and a number of discriminant models.
[0060] Specifically, see Figure 3 , design N generation models and N discriminant models. The generation models take random variables or real power grid samples as inputs, and the discriminant models take the power grid generated samples generated by the generation models and real power grid samples as inputs. The loss function is determined by the structure of the generative adversarial network model adopted, such as DCGAN or CycleGAN, etc., and can be the same as the loss function of the existing generative adversarial network model. That is, the loss function of the discriminant model is positively correlated with the misjudgment rate of the discriminant model, and the loss function of the generation model is positively correlated with the probability that the power grid generated sample is judged as not a real power grid sample after passing through the discriminant model. For example, the loss function of the generation model is: the cross-entropy between the output of the discriminant model after the power grid generated sample generated by the generation model is input into the discriminant model and the vector with all values of 1; the loss function of the discriminant model is: the cross-entropy between the predicted value of the discriminant model for the real power grid sample and the vector with all values of 1 plus the cross-entropy between the predicted value of the discriminant model for the power grid generated sample and the vector with all values of 0.
[0061] Then, through the real power grid samples, use the intelligent self-learning method shown in steps S202 to S204 to train the above constructed generative adversarial network model.
[0062] S202: Randomly assign a one-to-one corresponding discriminant model to each generation model through the coordinator unit to obtain a number of generation-discriminant model groups, obtain real power grid samples, and initially train each generation-discriminant model group according to the real power grid samples to obtain a number of initially trained generation models and a number of initially trained discriminant models.
[0063] Specifically, the coordinator unit is used to determine the one-to-one corresponding combination of the generation model and the discriminant model. The one-to-one corresponding combination means that each generation model has a corresponding discriminant model, and the discriminant models corresponding to any two generation models are different.
[0064] Specifically, the initial training of each generation-discrimination model group based on the real power grid samples includes: iteratively training each generation-discrimination model group based on the real power grid samples until the correct judgment rate of the discrimination model in each generation-discrimination model group for the real power grid samples is greater than the first preset value, and the misjudgment rate of the discrimination model for the power grid generation samples generated by the generation model is greater than the second preset value, so as to obtain a number of initially trained generation models and a number of initially trained discrimination models.
[0065] Among them, in this embodiment, the first preset value is set to 0.7, and the second preset value is set to 0.3, but it is not limited thereto and can be set according to actual training requirements.
[0066] S203: Iterative retraining step, until the loss function of the generative adversarial network model converges stably, to obtain a number of finally trained generation models and a number of finally trained discrimination models; Retraining step: Randomly assign a corresponding initially trained discrimination model to each initially trained generation model through the coordinator unit to obtain a number of initially trained generation-discrimination model groups, and iteratively train each initially trained generation-discrimination model group based on the real power grid samples.
[0067] Among them, the stable convergence of the loss function can be that the loss function value no longer decreases, or the decrease value of the loss function is within a preset threshold range.
[0068] Specifically, when iteratively training each initially trained generation-discrimination model group based on the real power grid samples, the training process can be controlled by setting a preset number of iterations.
[0069] S204: Obtain the generation capabilities of each finally trained generation model, and select the first preset number of finally trained generation models with the top generation capabilities to obtain sample generation models.
[0070] Among them, in this embodiment, the first preset number is 40% of the total number of finally trained generation models, but it is not limited thereto and can be set according to the actual situation.
[0071] Specifically, the obtaining of the generation capabilities of each finally trained generation model includes: obtaining the second preset number of power grid generation samples generated by each finally trained generation model; inputting the third preset number of real power grid samples and the second preset number of power grid generation samples generated by each finally trained generation model into each finally trained discrimination model, and counting the total number of times each finally trained discrimination model outputs the power grid generation samples as false samples and the real power grid samples as real samples to obtain the discrimination capabilities of each finally trained discrimination model; inputting the second preset number of power grid generation samples generated by each finally trained generation model into the first fourth preset number of finally trained discrimination models with the top discrimination capabilities, and sequentially counting the total number of times the first fourth preset number of finally trained discrimination models output as true samples to obtain the generation capabilities of each finally trained generation model.
[0072] Among them, in this embodiment, the fourth preset quantity is 80% of the total number of the final training discriminant models. In actual applications, the second preset quantity, the third preset quantity, and the fourth preset quantity can be set according to actual application situations and are not limited herein.
[0073] Among them, the total quantity Y of the grid generation samples output as false samples and the grid real samples output as real samples by each final training discriminant model represents the discriminant ability of the final training discriminant model. The larger Y is, the greater the discriminant ability of the final training discriminant model. The total quantity X of the true samples output by the final training discriminant models with the top fourth preset quantity in terms of discriminant ability represents the discriminant ability of the final training generation model. The larger Y is, the greater the generation ability of the final training generation model.
[0074] In a possible implementation manner, the obtaining of a plurality of final training generation models and a plurality of final training discriminant models further includes: updating each final training generation model and each final training discriminant model in the following manner:
[0075] Obtain the generation ability of each final training generation model and the discriminant ability of each final training discriminant model; use the model data of the final training generation models with the top fifth preset quantity in terms of generation ability to replace the model data of the final training generation models with the top fifth preset quantity; use the model data of the final training discriminant models with the top sixth preset quantity in terms of discriminant ability to replace the model data of the final training discriminant models with the bottom sixth preset quantity; randomly assign a one-to-one corresponding final training discriminant model to each final training generation model through a coordinator unit to obtain a plurality of final training generation-discriminant model groups; iteratively train each final training generation-discriminant model group according to the grid real samples until the loss function of the generative adversarial network model converges stably.
[0076] Among them, in the process of updating each final training generation model and each final training discriminant model, the principle of obtaining the generation ability of each final training generation model and the discriminant ability of each final training discriminant model can be the same as the principle of obtaining the generation ability of each final training generation model in step S206. In specific applications, the fourth preset quantity can be set to the total number of the final training discriminant models.
[0077] Among them, in this embodiment, the fifth preset quantity is 20% of the total number of the final training generation models, and the sixth preset quantity is 20% of the total number of the final training discriminant models, but it is not limited thereto and can be set according to actual situations.
[0078] Specifically, by using the model data of the generative models and discriminative models with higher ability rankings to overwrite the model data of the generative models and discriminative models with lower rankings, that is, replacing the part of the generative models and discriminative models with the weakest ability, and retraining and updating the current final trained generative models and final trained discriminative models to achieve further optimization of the generative models and discriminative models.
[0079] In a possible implementation manner, when initially training each generative-discriminative model group according to the real power grid samples and iteratively training each initially trained generative-discriminative model group according to the real power grid samples, the training is all carried out on a distributed system; wherein, when the generative model and the corresponding discriminative model are not in the same node of the distributed system, the discriminative model is moved to the node where the corresponding generative model is located through the coordinator unit; when the initially trained generative model and the corresponding initially trained discriminative model are not in the same node of the distributed system, the initially trained discriminative model is moved to the node where the corresponding initially trained generative model is located through the coordinator unit.
[0080] Specifically, the construction process of the sample generation model can be carried out in a distributed system. Each generative model and the corresponding discriminative model are trained in a computing node of the distributed system. The coordinator unit can run on any node of the distributed system or a separate computing power node. The separate computing power node refers to a node without a generative model and the corresponding discriminative model. When the computing power and storage space are sufficient, the construction process of the sample generation model can also be completed in a single node. The addition of the coordinator unit endows the construction process of the sample generation model with the ability of intelligent self-learning. It can effectively overcome the drawbacks existing in the training process of the sample generation model usually adopting a single-machine method. By using a distributed system to train the model, the training efficiency is improved, and the algorithm training can be iterated quickly to support the training of large models.
[0081] In a possible implementation manner, the sample generation method of the present invention is implemented by the following technical route: First, a generative adversarial network model (GANs) with a new structure is designed. The differences between it and various existing generative adversarial network models are as follows: a) In the same network, there are N independent generative models and N independent discriminant models; b) A coordinator unit is added to change the connection between the generative model and the discriminant model at different stages of model training; c) The entire model training process is carried out in a distributed system. The discriminant model corresponding to each generative model is trained in a computing node, and the coordinator unit can run on any node or a separate computing power node. When the computing power and storage space are sufficient, the entire model can also be trained in a single node. The addition of the coordinator module enables the entire model to have intelligent self-learning ability. Second, the entire model is trained using real samples of the existing power grid until the model accuracy reaches the expectation. During the training process, after training for a period of time, the coordinator unit will evaluate the accuracy of the N generative models and N discriminant models. According to the evaluation results, the training of some combinations of generative models and discriminant models will be suspended, or new combinations of generative models and discriminant models will be recombined, and then the next stage of training will continue until the training result is optimized. Finally, the discriminant model selects the M generative models with the highest accuracy from the N finally trained generative models as the sample generation models, and uses the sample generation models to generate new power grid generation samples to achieve the purpose of expanding the sample set.
[0082] In summary, the sample generation method of the present invention obtains power grid sample generation information, then calls a preset sample generation model, inputs the power grid sample generation information into the sample generation model, and finally generates and outputs power grid generation samples through the sample generation model to effectively expand the samples in the power field. Moreover, the sample generation model used is at least one of the generative models of the generative adversarial network model trained by real power grid samples in an intelligent self-learning manner, effectively solving the deficiency of the existing generative adversarial network model using a fixed training method. Through the intelligent self-learning training method, the quality of the power grid generation samples generated by the sample generation model is effectively improved, and further the prediction accuracy of the artificial intelligence model trained by it is improved.
[0083] The following is an apparatus embodiment of the present invention, which can be used to execute the method embodiment of the present invention. For details not disclosed in the apparatus embodiment, please refer to the method embodiment of the present invention.
[0084] See Figure 4, in another embodiment of the present invention, a sample generation system is provided, which can be used to implement the above-mentioned sample generation method. Specifically, the sample generation system includes a data acquisition module, a model calling module, and a data output module. Among them, the data acquisition module is used to acquire power grid sample generation information; the model calling module is used to call a preset sample generation model and input the power grid sample generation information into the sample generation model. Among them, the sample generation model is at least one of the generation models of the generative adversarial network model trained by using real power grid samples in an intelligent self-learning manner; the data output module is used to generate and output power grid generated samples through the sample generation model.
[0085] In a possible implementation manner, the preset sample generation model called by the model calling module is constructed by a sample model construction module; the sample model construction module includes: an initial model construction module, which is used to construct a generative adversarial network model including a coordinator unit, a plurality of generation models, and a plurality of discriminant models; an initial training module, which is used to randomly assign a corresponding discriminant model to each generation model through the coordinator unit to obtain a plurality of generation-discriminant model groups, acquire real power grid samples, and initially train each generation-discriminant model group according to the real power grid samples to obtain a plurality of initially trained generation models and a plurality of initially trained discriminant models; a retraining module, which is used to iterate the retraining step until the loss function of the generative adversarial network model converges stably to obtain a plurality of finally trained generation models and a plurality of finally trained discriminant models; the retraining step: randomly assign a corresponding initially trained discriminant model to each initially trained generation model through the coordinator unit to obtain a plurality of initially trained generation-discriminant model groups, and iteratively train each initially trained generation-discriminant model group according to the real power grid samples; a model generation module, which is used to obtain the generation capabilities of each finally trained generation model, select the first preset number of finally trained generation models with the top generation capabilities to obtain the sample generation model.
[0086] In a possible implementation manner, the initial training of each generation-discriminant model group according to the real power grid samples includes: iteratively training each generation-discriminant model group according to the real power grid samples until the correct judgment rate of the discriminant model for the real power grid samples in each generation-discriminant model group is greater than a first preset value, and the misjudgment rate of the discriminant model for the power grid generated samples generated by the generation model is greater than a second preset value, to obtain a plurality of initially trained generation models and a plurality of initially trained discriminant models.
[0087] In a possible implementation, the obtaining of the generation capabilities of the respective finally trained generation models includes: obtaining a second preset number of power grid generation samples generated by the respective finally trained generation models; inputting a third preset number of power grid real samples and the second preset number of power grid generation samples generated by the respective finally trained generation models into the respective finally trained discriminant models, and counting the total number of times the respective finally trained discriminant models output the power grid generation samples as false samples and the power grid real samples as real samples to obtain the discrimination capabilities of the respective finally trained discriminant models; inputting the second preset number of power grid generation samples generated by the respective finally trained generation models into the first fourth preset number of finally trained discriminant models before the discrimination capabilities, and successively counting the total number of times the first fourth preset number of finally trained discriminant models before the discrimination capabilities output as true samples to obtain the generation capabilities of the respective finally trained generation models.
[0088] In a possible implementation, the obtaining of a plurality of finally trained generation models and a plurality of finally trained discriminant models further includes: updating the respective finally trained generation models and the respective finally trained discriminant models in the following manner: obtaining the generation capabilities of the respective finally trained generation models and the discrimination capabilities of the respective finally trained discriminant models; using the model data of the first fifth preset number of finally trained generation models with the top-ranked generation capabilities to replace the model data of the first fifth preset number of finally trained generation models; using the model data of the first sixth preset number of finally trained discriminant models with the top-ranked discrimination capabilities to replace the model data of the last sixth preset number of finally trained discriminant models; iteratively updating the training steps until the loss function of the generative adversarial network model converges stably; updating the training steps: randomly assigning a corresponding finally trained discriminant model to each finally trained generation model by the coordinator unit to obtain a plurality of finally trained generation-discriminant model groups; iteratively training each finally trained generation-discriminant model group according to the power grid real samples.
[0089] In a possible implementation, both the initial training of each generation-discriminant model group according to the power grid real samples and the iterative training of each initially trained generation-discriminant model group according to the power grid real samples are performed on a distributed system; wherein, when the generation model and the corresponding discriminant model are not in the same node of the distributed system, the discriminant model is moved to the node where the corresponding generation model is located by the coordinator unit; when the initially trained generation model and the corresponding initially trained discriminant model are not in the same node of the distributed system, the initially trained discriminant model is moved to the node where the corresponding initially trained generation model is located by the coordinator unit.
[0090] All relevant content of each step involved in the embodiment of the foregoing sample generation method can be cited in the function description of the corresponding functional module of the sample generation system in the embodiment of the present invention, and will not be repeated here. The division of modules in the embodiments of the present invention is illustrative, and is only a logical function division. In actual implementation, there may be other division methods. In addition, in each embodiment of the present invention, each functional module may be integrated in one processor, or may exist physically alone, or two or more modules may be integrated in one module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0091] In another embodiment of the present invention, a computer device is provided. The computer device includes a processor and a memory. The memory is used to store a computer program. The computer program includes program instructions. The processor is used to execute the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing core and control core of the terminal, and is suitable for implementing one or more instructions. Specifically, it is suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function. The processor described in the embodiment of the present invention can be used for the operation of the sample generation method.
[0092] In another embodiment of the present invention, the present invention further provides a storage medium, specifically a computer-readable storage medium (Memory). The computer-readable storage medium is a memory device in a computer device and is used to store programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and, of course, the extended storage medium supported by the computer device. The computer-readable storage medium provides a storage space, and the operating system of the terminal is stored in this storage space. Moreover, one or more instructions suitable for being loaded and executed by the processor are stored in this storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. One or more instructions stored in the computer-readable storage medium can be loaded and executed by the processor to implement the corresponding steps of the sample generation method in the above embodiment.
[0093] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0094] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0095] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the functions in Figure 1 one flow or multiple flows and / or blocks Figure 1The functions specified in one or more boxes.
[0096] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide for implementing the steps of the functions specified in one Figure 1 one process or more processes and / or boxes Figure 1 or more boxes.
[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the above embodiments, those of ordinary skill in the art should understand that: modifications or equivalent replacements can still be made to the specific implementation manners of the present invention, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be covered by the protection scope of the claims of the present invention.
Claims
1. A method for generating a sample, characterized in that, Including: Obtain sample generation information; Call a preset sample generation model and input the sample generation information into the sample generation model; wherein, the sample generation model is at least one of the generation models of a generative adversarial network model trained by a real sample in an intelligent self-learning manner; Generate and output a generated sample through the sample generation model; Wherein, the sample generation information is a picture; The sample generation model is constructed in the following manner: Construct a generative adversarial network model including a coordinator unit, a plurality of generation models, and a plurality of discriminant models; Randomly assign a one-to-one corresponding discriminant model to each generation model through the coordinator unit to obtain a plurality of generation-discriminant model groups, obtain real samples, and initially train each generation-discriminant model group according to the real samples to obtain a plurality of initially trained generation models and a plurality of initially trained discriminant models; Iteratively retrain until the loss function of the generative adversarial network model converges stably to obtain a plurality of finally trained generation models and a plurality of finally trained discriminant models; The retraining step: Randomly assign a one-to-one corresponding initially trained discriminant model to each initially trained generation model through the coordinator unit to obtain a plurality of initially trained generation-discriminant model groups, and iteratively train each initially trained generation-discriminant model group according to the real samples; Obtain the generation capabilities of each finally trained generation model, and select the first preset number of finally trained generation models with the top generation capabilities to obtain a sample generation model.
2. The sample generation method according to claim 1, wherein The initial training of each generation-discriminant model group according to the real samples includes: Iteratively train each generation-discriminant model group according to the real samples until the correct judgment rate of the discriminant model for the real samples in each generation-discriminant model group is greater than the first preset value, and the misjudgment rate of the discriminant model for the generated samples generated by the generation model is greater than the second preset value, to obtain a plurality of initially trained generation models and a plurality of initially trained discriminant models.
3. The sample generation method according to claim 1, wherein, The obtaining of the generation capabilities of each finally trained generation model includes: Obtain the second preset number of generated samples generated by each finally trained generation model; Input the third preset number of real samples and the second preset number of generated samples generated by each finally trained generation model into each finally trained discriminant model, and count the total number of times each finally trained discriminant model outputs the generated sample as a false sample and outputs the real sample as a real sample to obtain the discriminant capabilities of each finally trained discriminant model; Input the second preset number of generated samples generated by each finally trained generation model into the first fourth preset number of finally trained discriminant models with the top discriminant capabilities, and sequentially count the total number of times the first fourth preset number of finally trained discriminant models output the generated sample as a true sample to obtain the generation capabilities of each finally trained generation model.
4. The sample generation method according to claim 1, wherein The obtaining of a plurality of finally trained generation models and a plurality of finally trained discriminant models further includes: Update each finally trained generation model and each finally trained discriminant model in the following manner: Obtain the generation capabilities of each finally trained generation model and the discriminant capabilities of each finally trained discriminant model; Use the model data of the first fifth preset number of finally trained generation models with the top generation capabilities to replace the model data of the last fifth preset number of finally trained generation models; Replace the model data of the final trained discriminant models ranked after the sixth preset quantity in terms of discriminant ability with the model data of the final trained discriminant models ranked among the top sixth preset quantity in terms of discriminant ability; Iteratively update the training steps until the loss function of the generative adversarial network model converges stably; Update the training steps: Randomly assign a one-to-one corresponding final trained discriminant model to each final trained generative model through the coordinator unit to obtain a number of final trained generative-discriminant model groups; Iteratively train each final trained generative-discriminant model group according to the real samples.
5. The sample generation method according to claim 1, wherein When initially training each generative-discriminant model group according to the real samples and when iteratively training each initially trained generative-discriminant model group according to the real samples, the training is all carried out on a distributed system; Among them, when the generative model and the corresponding discriminant model are not in the same node of the distributed system, move the discriminant model to the node where the corresponding generative model is located through the coordinator unit; When the initially trained generative model and the corresponding initially trained discriminant model are not in the same node of the distributed system, move the initially trained discriminant model to the node where the corresponding initially trained generative model is located through the coordinator unit.
6. A sample generation system, characterized in that, It includes: A data acquisition module, configured to acquire sample generation information; A model calling module, configured to call a preset sample generation model and input the sample generation information into the sample generation model; Among them, the sample generation model is at least one of the generative models of the generative adversarial network model trained by using the intelligent self-learning method through real samples; A data output module, configured to generate and output generated samples through the sample generation model; Among them, the sample generation information is a picture; The preset sample generation model called by the model calling module is constructed through a sample model construction module; The sample model construction module includes: An initial model construction module, configured to construct a generative adversarial network model including a coordinator unit, a number of generative models, and a number of discriminant models; An initial training module, configured to randomly assign a one-to-one corresponding discriminant model to each generative model through the coordinator unit to obtain a number of generative-discriminant model groups, acquire real samples and initially train each generative-discriminant model group according to the real samples to obtain a number of initially trained generative models and a number of initially trained discriminant models; A retraining module, configured to iteratively perform the retraining steps until the loss function of the generative adversarial network model converges stably to obtain a number of final trained generative models and a number of final trained discriminant models; Retraining steps: Randomly assign a one-to-one corresponding initially trained discriminant model to each initially trained generative model through the coordinator unit to obtain a number of initially trained generative-discriminant model groups, and iteratively train each initially trained generative-discriminant model group according to the real samples; A model generation module, configured to obtain the generation ability of each final trained generative model, select the final trained generative models ranked among the top first preset quantity in terms of generation ability to obtain the sample generation model.
7. A computer 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 computer program, it implements the steps of the sample generation method according to any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the sample generation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Enhanced generative countermeasure network and target sample identification method
CN109063724A