A model training method, device and equipment based on data augmentation
By generating augmented data through encoding and decoding, and using the supervision and consistency loss value fusion training model, the problems of limited acquisition of training sample labels and inconvenient data augmentation are solved, and convenient model training and diversified data augmentation are achieved.
Patent Information
- Application Number
- CN202211261446.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-14
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-10-14
AI Technical Summary
In existing technologies, label acquisition of training samples is limited, conventional data augmentation lacks universality and requires manual operation, making model training inconvenient.
By obtaining a set of labeled and unlabeled samples, encoding to generate latent variables, decoding to generate augmented data, and using the fusion of supervision loss value and consistency loss value to train the model, the model can automatically generate augmented data.
No artificial data augmentation is required. Unlabeled samples are fully utilized to learn sample distribution, noise is added adaptively, and various augmented data types are used to achieve convenient model training.
Smart Images

Figure CN115964633B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of Internet technology, and in particular to a model training method, device, and equipment based on data augmentation. Background Art
[0002] During model training, both the quantity and quality of training samples are crucial. These training samples typically refer to labeled samples. However, in many practical scenarios, obtaining labeled samples is limited by time, money, or accessibility. Conventional data augmentation often lacks universality and requires manual work.
[0003] Based on this, a convenient model training solution based on data augmentation is needed. Summary of the Invention
[0004] The embodiments of this specification provide a model training method, apparatus, device and storage medium based on data augmentation to solve the following technical problem: a convenient model training solution based on data augmentation is needed.
[0005] To solve the above technical problems, one or more embodiments of this specification are implemented as follows:
[0006] In a first aspect, an embodiment of the present specification provides a model training method based on data augmentation, comprising: obtaining a set of training samples, wherein the set includes labeled samples and unlabeled samples; encoding and generating a first latent variable corresponding to the labeled samples, and encoding and generating a second latent variable corresponding to the unlabeled samples; generating a first classification result based on the first latent variable, and determining a supervision loss value between the first classification result and the labeled samples; decoding the second latent variable to generate augmented data, and encoding the augmented data to generate a third latent variable; generating a second classification result based on the second latent variable, and generating a third classification result based on the third latent variable, and determining a consistency loss value between the second classification result and the third classification result; and fusing the supervision loss value and the consistency loss value to train the model.
[0007] In a second aspect, an embodiment of the present specification provides a model training device based on data augmentation, the device comprising: an acquisition module, acquiring a set of training samples, wherein the set includes labeled samples and unlabeled samples; an encoder, encoding and generating a first latent variable corresponding to the labeled sample, and encoding and generating a second latent variable corresponding to the unlabeled sample; a classifier, generating a first classification result based on the first latent variable, and determining a supervision loss value between the first classification result and the labeled sample; a decoder, decoding the second latent variable to generate augmented data, and encoding the augmented data to generate a third latent variable; the classifier is further used to generate a second classification result based on the second latent variable, and to generate a third classification result based on the third latent variable, and determine a consistency loss value between the second classification result and the third classification result; a fusion module, fusing the supervision loss value and the consistency loss value to train the model.
[0008] In a third aspect, one or more embodiments of this specification provide an electronic device, including:
[0009] at least one processor; and,
[0010] a memory communicatively connected to the at least one processor; wherein,
[0011] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0012] In a fourth aspect, an embodiment of this specification provides a non-volatile computer storage medium storing computer-executable instructions. When a computer reads the computer-executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0013] At least one of the above-mentioned technical solutions adopted in one or more embodiments of this specification can achieve the following beneficial effects: by obtaining a set of training samples, wherein the set includes labeled samples and unlabeled samples; encoding and generating a first latent variable corresponding to the labeled samples, and encoding and generating a second latent variable corresponding to the unlabeled samples; generating a first classification result based on the first latent variable, and determining the supervision loss value of the first classification result and the labeled samples; decoding the second latent variable to generate augmented data, encoding the augmented data to generate a third latent variable; generating a second classification result based on the second latent variable, and generating a third classification result based on the third latent variable, and determining the consistency loss value of the second classification result and the third classification result; fusing the supervision loss value and the consistency loss value to train the model, thereby achieving the goal of not requiring manual data augmentation, allowing the model to augment the data itself, and making full use of the unlabeled samples to learn the overall distribution of the sample set during the augmentation process, adaptively adding suitable noise, and making the types of augmented data more diverse, thereby completing convenient model training. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0015] Figure 1 A schematic diagram of data augmentation for an image;
[0016] Figure 2 A flowchart of a model training method based on data augmentation provided in an embodiment of this specification;
[0017] Figure 3 A schematic diagram of a system framework provided in an embodiment of this specification;
[0018] Figure 4 A schematic diagram of a multi-task learning process provided in an embodiment of this specification;
[0019] Figure 5 A schematic diagram of the structure of a model training device based on data augmentation provided in an embodiment of this specification;
[0020] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0021] The embodiments of this specification provide a method, apparatus, device, and storage medium for a model training method based on data augmentation.
[0022] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0023] In current model training, data augmentation is often performed by slightly changing the original samples. For example, when augmenting images or text, operations such as rotation, cropping, and inversion can be performed on labeled images. Figure 1 As shown, Figure 1 This is a diagram of data augmentation for images. By scaling or rotating the original image, additional labeled samples are generated. Similar operations can be performed on text. For example, a sentence can be rewritten, such as by replacing synonyms, translating the text into another language and then back again, or obscuring parts of a sentence. Furthermore, this data augmentation method often requires manual work, which is tedious.
[0024] However, this conventional approach may not be suitable for semantically sensitive samples. For example, in tabular data, the meaning of each column is relatively independent and abstract. In a specific business scenario, not everyone knows which perturbations will not change the semantics. In this case, arbitrarily blocking or filling columns or rows may change the semantics of the data itself. Based on this, this manual provides a convenient model training solution based on data augmentation.
[0025] In the first aspect, Figure 2 As shown, Figure 2 A flow chart of a model training method based on data augmentation provided in an embodiment of this specification includes:
[0026] S201 , obtaining a set of training samples, wherein the set includes labeled samples and unlabeled samples.
[0027] The set of labeled samples can be denoted as D L ={(x i ,y i )|1≤i≤n}, the set of unlabeled samples D U ={(x i ,y i)|n < i ≤ m}, generally speaking, m is much larger than n.
[0028] S203, encode to generate the first latent variable corresponding to the labeled sample, and encode to generate the second latent variable corresponding to the unlabeled sample.
[0029] As Figure 3 shown, Figure 3 is a schematic framework diagram of a system provided by an embodiment of this specification. "Encoder" in this schematic diagram is the encoder. The labeled sample (i.e., Figure 3 x in l ) and the unlabeled sample (i.e., Figure 3 x in u ) are both encoded by the encoder to generate the corresponding first latent variable and second latent variable. p(z|x) in this schematic diagram refers to encoding the input samples (including labeled samples and unlabeled samples) into the latent variable z. P in this specification represents a preset mapping method (including encoding or decoding).
[0030] The specific form of the encoder can adopt the form of a traditional autoencoder or a variational autoencoder.
[0031] S205, generate a first classification result according to the first latent variable, and determine the supervised loss value between the first classification result and the labeled sample.
[0032] As Figure 3 shown, the classifier corresponding to P(y|z) classifies the generated first latent variable, that is, classifies the first latent variable into q categories in Y = {y1, y2,..., y q} to generate a first classification result. Since the first latent variable is generated from the labeled sample, therefore, the loss value can be calculated based on the difference between the first classification result and the labeled sample. This process is actually a supervised training process. Therefore, this loss value can also be called the supervised loss value.
[0033] For example, the calculation method of the supervised loss value can be where y is the label value, h is the predicted value, and CE is the cross entropy.
[0034] S207, decode the second latent variable to generate augmented data, and encode the augmented data to generate a third latent variable.
[0035] The decoder part uses a preset mapping method to decode the generated second latent variable to obtain augmented data Obviously, for an unlabeled sample x, after encoding and decoding (i.e. ), the augmented data obtained (the augmented data is still unlabeled) is somewhat different from the original unlabeled samples. Therefore, there must be some difference between the third latent variable obtained by encoding the augmented data and the second latent variable obtained by encoding the original unlabeled samples.
[0036] In one embodiment, a certain amount of noise can be added to the latent variable z obtained above to generate the feature to be decoded Right now The decoder part can be used The Δ is the noise, and the specific method of adding noise can be determined based on the actual situation.
[0037] For example, one approach to adding noise is to sample from the distribution of the second latent variable based on the distribution of the second latent variable to obtain the features to be decoded. Because sampling is random, noise is introduced during the sampling process. At the same time, the features to be decoded obtained in this way clearly conform to the distribution of the second latent variable. Therefore, the augmented data obtained can conform to the distribution of the training sample set itself.
[0038] S209: Generate a second classification result according to the second latent variable, and generate a third classification result according to the third latent variable, and determine a consistency loss value between the second classification result and the third classification result.
[0039] Then, based on the aforementioned classifier, the second latent variable and the third latent variable corresponding to the same unlabeled sample can be simultaneously classified to obtain the second and third classification results. The consistency loss value is calculated based on the difference between the second and third classification results. The consistency loss value here actually reflects the difference between the augmented data and the unlabeled sample.
[0040] For example, the consistency loss value can be calculated as Here h is the generated prediction value, KL refers to KL divergence, SG refers to stop gradient, and λ is the preset hyperparameter.
[0041] S211, fusing the supervision loss value and the consistency loss value to train the model.
[0042] Generally speaking, the supervision loss and consistency loss values can be directly added together to obtain the final model loss value, and the model can be trained based on the final model loss value. Alternatively, a certain weight distribution can be preset, and the supervision loss and consistency loss values can be weighted summed based on the weight distribution to obtain the final model loss value, and the model can be trained based on the final model loss value.
[0043] For example, the final model loss value can be calculated as:
[0044]
[0045] Training the model includes training the parameters in the encoder, the decoder, and the classifier at the same time. In other words, in the embodiment of this specification, it actually includes two tasks: the classification task for labeled samples and the data augmentation task. These two tasks are performed simultaneously and share the training parameters in the encoder, decoder, and classifier. Figure 4 As shown, Figure 4 This is a flow chart of a multi-task learning process provided by the embodiment of this specification. Where x is the set of original training samples, This is the augmented data obtained by augmentation.
[0046] In the embodiments of this specification, as training progresses, the parameters of the encoder, decoder, and classifier are constantly updated. Therefore, even if the same unlabeled sample is reconstructed at different times, the augmented data will be different, which increases the diversity of the augmented data to a certain extent.
[0047] In addition, when the model training reaches convergence, it generally means that the final model loss value is less than the preset value. In other words, when the model converges, it can be considered that the supervised training task and the data augmentation task for the labeled samples have converged simultaneously. That is, the trained model can accurately classify the labeled samples, and at the same time, the augmented data obtained by augmentation is close enough to the original unlabeled samples. Therefore, through the joint training method of multiple tasks, during the model training process, the model can automatically generate augmented data to train an accurate classification model. Finally, when the model training converges, only the encoder and classifier on the right side need to be retained to classify any input sample to be classified.
[0048] By obtaining a set of training samples, wherein the set includes labeled samples and unlabeled samples; encoding and generating a first latent variable corresponding to the labeled samples, and encoding and generating a second latent variable corresponding to the unlabeled samples; generating a first classification result according to the first latent variable, and determining a supervision loss value between the first classification result and the labeled samples; decoding the second latent variable to generate augmented data, encoding the augmented data to generate a third latent variable; generating a second classification result according to the second latent variable, and generating a third classification result according to the third latent variable, and determining a consistency loss value between the second classification result and the third classification result; fusing the supervision loss value and the consistency loss value to train the model, thereby achieving the goal of not requiring manual data augmentation, allowing the model to augment the data itself, and making full use of the unlabeled samples to learn the overall distribution of the sample set in the augmentation process, adaptively adding suitable noise, and making the types of augmented data more diverse, thereby completing convenient model training.
[0049] In one embodiment, when sampling from the distribution of the second latent variable, random sampling can be performed from the distribution of the second latent variable, or the expectation and variance of the distribution of the second latent variable can be determined, and random sampling can be performed from the distribution of the second latent variable based on the expectation and variance.
[0050] For example, the distribution of the second latent variable may be a binomial distribution, an exponential distribution, a Weibull distribution, or a Gaussian distribution. For any of these distributions, the corresponding expectation and variance can be calculated, and sampling that conforms to the distribution can be performed based on the distribution type and the corresponding expectation and variance, thereby obtaining features to be decoded that conform to the distribution of the second latent variable.
[0051] Furthermore, assuming that the distribution of the second latent variable conforms to the Gaussian distribution, then, accordingly, its corresponding expectation γ and variance X can be confirmed, that is, assuming that the distribution of the second latent variable conforms to the following Gaussian distribution N(γ,std(X) 2 ), then the distribution of the second latent variable can be converted to a standard Gaussian distribution based on the expectation and variance, and random sampling can be performed from the standard Gaussian distribution. By converting the general Gaussian distribution to a standard Gaussian distribution, sampling can be facilitated and computational efficiency can be improved.
[0052] In one embodiment, when the supervision loss value and the consistency loss value are integrated to train the model, in addition to considering the supervision loss value and the consistency loss value, other loss values may also be introduced.
[0053] For example, when using an autovariation encoder to encode augmented data, there may be corresponding encoding loss values due to factors of the encoder itself. If it is assumed that the latent variable z conforms to the normal distribution N(μ,σ 2), the encoding loss can be measured as follows:
[0054]
[0055] Among them, α is a hyperparameter, Ex is the expected value when p(x) is used as the sampling probability, and KL is the divergence.
[0056] In other words, the difference between the generated augmented data and the unlabeled data can be measured by encoding the loss value. When calculating the KL divergence (often used to measure the distance between two probability distributions), the goal becomes to minimize the KL divergence term contained in the aforementioned loss value. At this point, the final model loss value can be modified to L = L ssl +L aug .
[0057] In one embodiment, when fusing the supervised loss and the consistency loss to train the model, a related regularized loss may also be considered. Specifically, a regularized loss corresponding to the distribution of the first latent variable and the second latent variable is determined; and the supervised loss, the consistency loss, and the regularized loss are then fused to train the model.
[0058] For example, the calculation of the regularization loss value can be done as follows: in, β is a hyperparameter, so the final loss value at this time is L=L ssl +L reg .
[0059] The regularized loss value actually decays the weight to a smaller value, which to a certain extent reduces the overfitting of the augmented data to the unlabeled data, reduces the overfitting phenomenon of the model, and thus improves the adaptability of the model.
[0060] In one embodiment, the encoding loss value and the regularization loss value can be simultaneously regarded as the loss value generated when augmenting the data, that is, the encoding loss value can be recorded as:
[0061]
[0062] Where l is the dimension of z. Because the data augmentation step is implemented on the latent variable stage representation, this method can actually be adapted to both categorical features and numerical features. At this time, the overall loss value is L = L ssl +L aug .
[0063] Based on the above, we can see that the encoder encodes the latent variables and uses the decoder to decode the latent variables (in which case noise can also be added based on the distribution of the latent variables) to automatically obtain augmented data. The model has no relationship with the semantics of the input samples, and the process of augmenting the data does not involve modifying the original samples. Therefore, in addition to being applicable to data augmentation in commonly used images and text, the solution of this specification can also be applied to tabular data.
[0064] Based on the same idea, one or more embodiments of this specification also provide devices and apparatuses corresponding to the above methods, such as Figure 5 、 Figure 6 shown.
[0065] In the second aspect, Figure 5 As shown, Figure 5 A schematic diagram of a model training device based on data augmentation provided in an embodiment of this specification, the device comprising:
[0066] An acquisition module 501 acquires a set of training samples, wherein the set includes labeled samples and unlabeled samples;
[0067] Encoder 503, encoding and generating a first latent variable corresponding to the labeled sample, and encoding and generating a second latent variable corresponding to the unlabeled sample;
[0068] A classifier 505 generates a first classification result based on the first latent variable, and determines a supervision loss value between the first classification result and the labeled sample;
[0069] Decoder 507, decoding the second latent variable to generate augmented data, and encoding the augmented data to generate a third latent variable;
[0070] The classifier 503 is further configured to generate a second classification result based on the second latent variable, and generate a third classification result based on the third latent variable, and determine a consistency loss value between the second classification result and the third classification result;
[0071] The fusion module 509 fuses the supervision loss value and the consistency loss value to train the model.
[0072] Optionally, the decoder 507 determines the distribution of the second latent variable; samples from the distribution of the second latent variable to generate features to be decoded; and decodes the features to be decoded to generate augmented data.
[0073] Optionally, the decoder 507 randomly samples from the distribution of the second latent variable; or determines the expectation and variance of the distribution of the second latent variable, and randomly samples from the distribution of the second latent variable according to the expectation and variance.
[0074] Optionally, the decoder 507 converts the distribution of the second latent variable into a standard Gaussian distribution according to the expectation and variance; and performs random sampling from the standard Gaussian distribution.
[0075] Optionally, the fusion module 509 determines the distribution of the augmented data and the distribution of the unlabeled samples; determines the encoding loss value based on the difference between the distribution of the augmented data and the distribution of the unlabeled samples; and trains the model by fusing the supervision loss value, the consistency loss value and the encoding loss value.
[0076] Optionally, the fusion module 509 determines a regularization loss value corresponding to the distribution of the first latent variable and the second latent variable; and trains the model by fusing the supervision loss value, the consistency loss value, and the regularization loss value.
[0077] Optionally, in the device, the training samples include pictures, text or table data.
[0078] In the third aspect, Figure 6 As shown, Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification, the device comprising:
[0079] at least one processor; and,
[0080] a memory communicatively connected to the at least one processor; wherein,
[0081] The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect.
[0082] In the fourth aspect, based on the same idea, an embodiment of this specification also provides a non-volatile computer storage medium corresponding to the above method, which stores computer-executable instructions. When a computer reads the computer-executable instructions in the storage medium, the instructions enable one or more processors to execute the method described in the first aspect.
[0083] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0084] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.
[0085] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0086] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0087] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0089] These computer program instructions may 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 produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0091] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0092] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0093] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0094] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0095] This specification may be described in the general context of computer-executable instructions, such as program modules, executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media, including storage devices.
[0096] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, apparatus, and non-volatile computer storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For relevant details, refer to the descriptions of the method embodiments.
[0097] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0098] The foregoing description is merely one or more embodiments of this specification and is not intended to limit this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of one or more embodiments of this specification are intended to be within the scope of the claims of this specification.
Claims
1. A model training method based on data augmentation, comprising: Obtaining a set of training samples, wherein the set includes labeled samples and unlabeled samples; Encoding and generating a first latent variable corresponding to the labeled sample, and encoding and generating a second latent variable corresponding to the unlabeled sample; Generate a first classification result according to the first latent variable, and determine a supervision loss value between the first classification result and the labeled sample; decoding the second latent variable to generate augmented data, and encoding the augmented data to generate a third latent variable; generating a second classification result according to the second latent variable, and generating a third classification result according to the third latent variable, and determining a consistency loss value between the second classification result and the third classification result; The model is trained by fusing the supervision loss value and the consistency loss value.
2. The method according to claim 1, wherein Decoding the second latent variable to generate augmented data includes: determining the distribution of the second latent variable; Sampling from the distribution of the second latent variable to generate features to be decoded; The to-be-decoded feature is decoded to generate augmented data.
3. The method according to claim 2, wherein: Sampling from the distribution of the second latent variable includes: Randomly sample from the distribution of the second latent variable; or, Determine the expectation and variance of the distribution of the second latent variable, and randomly sample from the distribution of the second latent variable according to the expectation and variance.
4. The method according to claim 3, wherein: When the distribution of the second latent variable is a Gaussian distribution, randomly sampling from the distribution of the second latent variable according to the expectation and variance includes: Converting the distribution of the second latent variable into a standard Gaussian distribution according to the expectation and variance; Random sampling is performed from the standard Gaussian distribution.
5. The method according to claims 1 to 4, wherein: The model is trained by fusing the supervision loss value and the consistency loss value, including: Determining the distribution of the augmented data, and determining the distribution of the unlabeled samples; Determining a coding loss value according to a difference between a distribution of the augmented data and a distribution of the unlabeled samples; The model is trained by fusing the supervision loss value, the consistency loss value, and the encoding loss value.
6. The method of claim 1, wherein: The model is trained by fusing the supervision loss value and the consistency loss value, including: Determining a regularization loss value corresponding to the distribution of the first latent variable and the second latent variable; The model is trained by fusing the supervision loss value, the consistency loss value, and the regularization loss value.
7. The method of claim 1, wherein: The training samples include pictures, text or table data.
8. A model training device based on data augmentation, the device comprising: An acquisition module acquires a set of training samples, wherein the set includes labeled samples and unlabeled samples; An encoder, encoding and generating a first latent variable corresponding to the labeled sample, and encoding and generating a second latent variable corresponding to the unlabeled sample; A classifier, generating a first classification result based on the first latent variable, and determining a supervision loss value between the first classification result and the labeled sample; A decoder, configured to decode the second latent variable to generate augmented data, and encode the augmented data to generate a third latent variable; The classifier is further configured to generate a second classification result based on the second latent variable, and generate a third classification result based on the third latent variable, and determine a consistency loss value between the second classification result and the third classification result; A fusion module is used to train the model by fusing the supervision loss value and the consistency loss value.
9. An electronic device comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Model training method and device
CN112580720A
Motor fault data augmentation method and system
CN114943299A