Disclosure of Invention
The embodiment of the invention provides a data augmentation method and electronic equipment, which are used for solving the technical problems in the background technology or at least partially solving the technical problems in the background technology.
In a first aspect, an embodiment of the present invention provides a data augmentation method, including:
acquiring working condition label data, and manufacturing any number of random data with the same size as the working condition label data as initialization data of the augmentation data;
inputting the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain augmentation working condition data;
the trained data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
More specifically, before the step of acquiring the operating mode tag data, the method further includes:
splitting industrial original data into real tag non-working condition data and working condition tag data;
and cleaning abnormal points in the real tag non-working condition data to obtain real tag normal data.
More specifically, the trained operating mode data augmentation model comprises a trained generator and a trained arbiter.
More specifically, before the step of inputting the operating condition label data and the initialization data of the augmentation data into the trained operating condition data augmentation model, the method further comprises:
acquiring normal data of a real tag, and manufacturing initialization sample augmentation data of any number of random data with the same size as the normal data of the real tag;
inputting the initialized sample augmentation data into a generator in a data augmentation model to obtain sample augmentation false data with false labels, taking the sample augmentation false data with false labels as the initialized sample augmentation data, inputting the initialized sample augmentation data into the generator in the data augmentation model again to train until the loss function of the generator reaches stable convergence, and obtaining a trained generator;
mixing sample augmentation false data with false labels and real label normal data to input a discriminator in a data augmentation model, and obtaining a trained discriminator when a loss function of the discriminator reaches stable convergence;
and obtaining a trained data augmentation model according to the trained generator and the trained arbiter.
More specifically, before the step of inputting the operating condition label data and the initialization data of the augmentation data into the trained operating condition data augmentation model, the method further comprises:
acquiring normal data of a real tag, and manufacturing initialization sample augmentation data of any number of random data with the same size as the normal data of the real tag;
inputting the initialized sample augmentation data into a generator in a data augmentation model to obtain sample augmentation false data with false labels, taking the sample augmentation false data with false labels as the initialized sample augmentation data, inputting the initialized sample augmentation data into the generator in the data augmentation model again to train until the loss function of the generator reaches stable convergence, and obtaining a trained generator;
mixing sample augmentation false data with false labels and real label normal data to input a discriminator in a data augmentation model, and obtaining a trained discriminator when a loss function of the discriminator reaches stable convergence;
and obtaining a trained data augmentation model according to the trained generator and the trained arbiter.
More specifically, the generator in the data augmentation model is composed of a convolutional neural network encoder and a convolutional neural network decoder in combination.
More specifically, the loss function of the generator is specifically:
according to a convolutional neural network encoder, calculating real tag normal data and initialization sample augmentation data respectively, extracting real tag normal data feature vectors and initial augmentation feature vectors, and obtaining a first loss function according to mean square errors of the real tag normal data feature vectors and the initial augmentation feature vectors;
decoding the initial augmentation feature vector according to the convolutional neural network decoding to obtain sample augmentation false data, and obtaining a second loss function according to the mean square error of the sample augmentation false data and real label normal data;
obtaining a third loss function according to the cosine distance between the fast Fourier function transformation result of the sample augmentation false data and the fast Fourier transformation result of the real label normal data;
and respectively weighting the first loss function, the second loss function and the third loss function to obtain the loss function of the generator.
More specifically, the loss function of the generator is specifically:
according to a convolutional neural network encoder, calculating real tag normal data and initialization sample augmentation data respectively, extracting real tag normal data feature vectors and initial augmentation feature vectors, and obtaining a first loss function according to mean square errors of the real tag normal data feature vectors and the initial augmentation feature vectors;
decoding the initial augmentation feature vector according to the convolutional neural network decoding to obtain sample augmentation false data, and obtaining a second loss function according to the mean square error of the sample augmentation false data and real label normal data;
obtaining a third loss function according to the cosine distance between the fast Fourier function transformation result of the sample augmentation false data and the fast Fourier transformation result of the real label normal data;
and respectively weighting the first loss function, the second loss function and the third loss function to obtain the loss function of the generator.
In a second aspect, an embodiment of the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the data augmentation method of the first aspect when the program is executed.
In a third aspect, embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the data augmentation method of the first aspect.
According to the data augmentation method and the electronic device, the data augmentation model which is similar to the large sample label data of the device is constructed by starting from the large sample data of the device, and then the data augmentation model is adjusted according to the small sample working condition label data, so that the small sample working condition label data can be augmented, the distribution space of the small sample augmentation data is enabled to be closer to the distribution breadth of the large sample data, the data augmentation model is enabled to reasonably expand the distribution breadth of the small sample, and the augmentation data credibility at the distribution edge of the small sample is guaranteed.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of 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, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
FIG. 1 is a flow chart of a data augmentation method according to an embodiment of the present invention, as shown in FIG. 1, comprising:
step S1, acquiring working condition label data, and manufacturing any number of random data with the same size as the working condition label data as initialization data of the augmentation data;
s2, inputting the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain the augmentation working condition data;
the trained data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
The working condition label data described in the embodiment of the invention refer to fault information in industrial mechanical equipment, and the fault information also comprises a working condition label.
The initialization data of the augmentation data described in the embodiment of the invention refers to randomly generated data, and the data size of the data is consistent with the working condition label data and is used as the initialization data of the augmentation data.
The trained working condition data augmentation model described in the embodiment of the invention is applied to the field of modern industrial machinery, and can input working condition label data into the trained working condition data augmentation model to augment the working condition label data to obtain augmented working condition data aiming at the problem of fewer working condition samples of an automatic learning model of industrial machinery.
The augmented working condition data described in the embodiment of the invention are a plurality of extended working condition data, and the accuracy of an automatic learning model aiming at industrial mechanical equipment can be effectively improved when the augmented working condition data are obtained.
The trained working condition data augmentation model described in the embodiment of the invention is obtained through initialization sample augmentation data of real label normal data and false labels and training.
The real tag normal data described herein is data of a large data volume with a real data tag, and the real data tag described in the embodiment of the present invention represents data that is not randomly generated but is obtained from real data. The spurious labels described in the embodiments of the present invention refer to data randomly generated by a generator in a data expansion model,
firstly, training to obtain a model capable of realizing data augmentation of a large data sample through initializing samples of normal data of a real tag and random data with random numbers consistent with the normal data of the real tag, and training the base model through working condition data by taking the model as the base model, so as to obtain a trained working condition data augmentation model capable of expanding the working condition data.
According to the embodiment of the invention, the data augmentation model which can augment the similarity of the equipment large sample label data is constructed from the equipment large sample data, and then the data augmentation model is adjusted according to the small sample working condition label data, so that the small sample working condition label data can be augmented, the reasonable expansion of the distribution breadth of the small sample by the data augmentation model is ensured, and the augmented data credibility at the distribution edge of the small sample is ensured.
On the basis of the foregoing embodiment, before the step of acquiring the operating mode tag data, the method further includes:
splitting industrial original data into real tag non-working condition data and working condition tag data;
and cleaning abnormal points in the real tag non-working condition data to obtain real tag normal data.
Specifically, the industrial raw data described in the embodiments of the present invention is raw data directly extracted from an industrial machinery system.
The real tag non-working condition data described in the embodiment of the invention refers to real large sample data in an industrial mechanical equipment system, and the working condition tag data refers to small sample real working condition data in the industrial mechanical equipment system.
According to the embodiment of the invention, the data reliability is improved by cleaning the abnormal points in the real tag non-working condition data, and the real tag non-working condition data and the working condition tag data are distinguished; therefore, model training can be effectively performed on working condition data.
On the basis of the embodiment, the trained working condition data augmentation model comprises a trained generator and a trained arbiter.
Before the step of inputting the operating condition label data and the initialization data of the augmentation data into the trained operating condition data augmentation model, the method further comprises:
acquiring normal data of a real tag, and manufacturing initialization sample augmentation data of any number of random data with the same size as the normal data of the real tag;
inputting the initialized sample augmentation data into a generator in a data augmentation model to obtain sample augmentation false data with false labels, taking the sample augmentation false data with false labels as the initialized sample augmentation data, inputting the initialized sample augmentation data into the generator in the data augmentation model again to train until the loss function of the generator reaches stable convergence, and obtaining a trained generator;
mixing sample augmentation false data with false labels and real label normal data to input a discriminator in a data augmentation model, and obtaining a trained discriminator when a loss function of the discriminator reaches stable convergence;
and obtaining a trained data augmentation model according to the trained generator and the trained arbiter.
Specifically, the data format of the initialization sample augmentation data is consistent with the normal data size of the real tag, wherein the data is randomly generated in any amount by the initialization sample augmentation data.
The method comprises the steps of respectively calculating the initialization sample augmentation data and the real tag normal data by using a convolutional neural network encoder to obtain an initial augmentation feature vector and a real tag normal data feature vector, and calculating the mean square error of the real tag normal data feature vector and the initial augmentation feature vector to obtain a first loss function;
decoding the initial augmentation feature vector by using a convolutional neural network decoder to obtain sample augmentation false data, and calculating the mean square error of the sample augmentation false data and real tag normal data to obtain a second loss function;
obtaining a third loss function according to the cosine distance between the fast Fourier function transformation result of the sample augmentation false data and the fast Fourier transformation result of the real label normal data;
and taking the convolutional neural network encoder and the convolutional neural network decoder as generators of a data augmentation model, and then weighting the first loss function, the second loss function and the third loss function respectively to obtain the loss functions of the generators.
And in the initial training stage, inputting the initialized sample augmentation data into a generator in a data augmentation model to obtain sample augmentation false data with false labels, if the loss function of the generator does not stably converge, continuing to perform cyclic training, and at the moment, replacing the initialized sample augmentation false data with the false labels output by the generator with the sample augmentation false data as input, performing cyclic training until the loss function of the generator stably converges, and stopping training to obtain the trained generator.
In each round of training process of the generator, the output of the generator is used as the input in the subsequent training process of the generator again, the output of the generator is used as the output of the discriminator, meanwhile, the input of the discriminator also comprises real label normal data, the discriminator carries out multiple training along with the cyclic training of the generator, the two steps are carried out alternately, the discriminator is trained once after training the generator once, the loss function of the discriminator reaches stable convergence, and finally, the data augmentation model capable of amplifying large sample data is obtained.
According to the embodiment of the invention, the training of the data augmentation model capable of realizing a large amount of sample data can be conveniently guided to the training of the small sample data augmentation model, and the working condition data distribution space of the working condition data augmentation model trained by using the data augmentation model as a base model can be more reasonably expanded, so that the data distribution space is more approximate to the distribution breadth of large sample data.
On the basis of the above embodiment, after the step of obtaining a trained data augmentation model according to the trained generator and trained arbiter, the method further comprises:
acquiring sample working condition label data and manufacturing any number of initialized sample working condition augmentation data consistent with the sample working condition label data in size;
and continuously training the base model according to the initialized sample working condition augmentation data and the sample working condition label data by taking the trained data augmentation model as the base model, and obtaining the trained working condition data augmentation model when the loss function of the base model achieves stable convergence.
Specifically, the data augmentation model is used as a base model, real label normal data are replaced with working condition label data, the base model is trained, and the trained augmentation working condition label data are obtained when the loss function of the base model is stably converged.
According to the embodiment of the invention, the data augmentation model which can augment the similarity of the equipment large sample label data is constructed from the equipment large sample data, and then the data augmentation model is adjusted according to the small sample working condition label data, so that the small sample working condition label data can be augmented, the distribution space of the small sample augmentation data is more similar to the distribution breadth of the large sample data, the reasonable expansion of the distribution breadth of the small sample by the data augmentation model is ensured, and the augmentation data credibility at the distribution edge of the small sample is ensured.
On the basis of the above embodiment, the loss function of the generator is specifically:
according to a convolutional neural network encoder, calculating real tag normal data and initialization sample augmentation data respectively, extracting real tag normal data feature vectors and initial augmentation feature vectors, and obtaining a first loss function according to mean square errors of the real tag normal data feature vectors and the initial augmentation feature vectors;
decoding the initial augmentation feature vector according to the convolutional neural network decoding to obtain sample augmentation false data, and obtaining a second loss function according to the mean square error of the sample augmentation false data and real label normal data;
obtaining a third loss function according to the cosine distance between the fast Fourier function transformation result of the sample augmentation false data and the fast Fourier transformation result of the real label normal data;
and respectively weighting the first loss function, the second loss function and the third loss function to obtain the loss function of the generator.
The convolutional neural network is used as a discriminator, a real label or a false label is used as a label, and cross entropy is used as a loss function of the discriminator.
After the augmented operating condition data is obtained, the method further comprises:
and inputting the augmented working condition data into an automatic learning lifting algorithm of industrial mechanical equipment, effectively lifting the accuracy of the automatic learning algorithm, and finally combining the automatic learning algorithm to form the automatic learning lifting algorithm.
The embodiment of the invention starts from the small sample working condition data directly, but starts from the large sample of the same equipment with larger distribution breadth, and then adjusts the small sample, so that the distribution breadth of the small sample can be reasonably expanded by the parameters of the augmentation model, and the classification accuracy of the data points at the distribution edge of the small sample is ensured.
Fig. 2 is a schematic structural diagram of a data amplifying apparatus according to an embodiment of the present invention, as shown in fig. 2, including: an acquisition module 210 and an augmentation module 220; the acquiring module 210 is configured to acquire the working condition tag data, and manufacture any number of random data with a size consistent with the working condition tag data as initialization data of the augmentation data; the augmentation module 220 is configured to input the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain augmented working condition data; the trained working condition data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
The apparatus provided in the embodiments of the present invention is used to execute the above embodiments of the method, and specific flow and details refer to the above embodiments, which are not repeated herein.
According to the embodiment of the invention, the data augmentation model which can augment the similarity of the equipment large sample label data is constructed from the equipment large sample data, and then the data augmentation model is adjusted according to the small sample working condition label data, so that the small sample working condition label data can be augmented, the distribution space of the small sample augmentation data is more similar to the distribution breadth of the large sample data, the reasonable expansion of the distribution breadth of the small sample by the data augmentation model is ensured, and the augmentation data credibility at the distribution edge of the small sample is ensured.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and as shown in fig. 3, the electronic device may include: processor 310, communication interface (Communications Interface) 320, memory 330 and communication bus 340, wherein processor 310, communication interface 320, memory 330 accomplish communication with each other through communication bus 340. The processor 310 may call logic instructions in the memory 330 to perform the following method: acquiring working condition label data, and manufacturing any number of random data with the same size as the working condition label data as initialization data of the augmentation data; inputting the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain augmentation working condition data; the trained data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
Further, the logic instructions in the memory 330 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the method embodiments described above, for example comprising: acquiring working condition label data, and manufacturing any number of random data with the same size as the working condition label data as initialization data of the augmentation data; inputting the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain augmentation working condition data; the trained data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
Embodiments of the present invention provide a non-transitory computer readable storage medium storing server instructions that cause a computer to perform the methods provided by the above embodiments, for example, including: acquiring working condition label data, and manufacturing any number of random data with the same size as the working condition label data as initialization data of the augmentation data; inputting the working condition label data and the initialization data of the augmentation data into a trained working condition data augmentation model to obtain augmentation working condition data; the trained data augmentation model is obtained through initialization sample augmentation data of real label normal data and false labels and training.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.