Model training method and device, equipment, storage medium and program product

By generating pseudo-samples using an adversarial generative network and determining predicted labels using a discriminative model, and iteratively training the loss function weights, this approach solves the problem of poor model performance caused by relying on empirical weight adjustments in existing technologies, and achieves optimal loss function weights and improved model performance.

CN116976401BActive Publication Date: 2026-05-05GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
Filing Date
2022-04-19
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In existing technologies, the weight adjustment of the loss function during model training relies on experience, resulting in poor performance of the final model.

Method used

Pseudo-samples are generated using an adversarial generative network, and the predicted labels of the pseudo-samples are determined using a discriminative model. The weights of the loss function are iteratively trained based on the predicted labels of the pseudo-samples and the actual labels until the convergence condition is met.

Benefits of technology

This ensures that each loss function learns the most appropriate weights, thus improving the effectiveness of the final target model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116976401B_ABST
    Figure CN116976401B_ABST
Patent Text Reader

Abstract

This application discloses a model training method, apparatus, device, storage medium, and program product, belonging to the field of machine learning technology. The method generates pseudo-samples based on a first generative model in an adversarial generative network (PGN). The predicted labels of the pseudo-samples are determined by a first discriminative model in the PGN. Based on the predicted and actual labels of the pseudo-samples, the weights of multiple loss functions of the first generative model are iteratively trained until the weights of the multiple loss functions satisfy a first convergence condition. The iterative training of the weights of the multiple loss functions ends, and a first target model is determined based on the weights of the multiple loss functions at the end of the iterative training. This method can learn the most suitable weights for each loss function during iterative training, ensuring the optimality of the weights for each loss function, thereby improving the performance of the final target model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning technology, and in particular to a model training method, apparatus, device, storage medium, and program product. Background Technology

[0002] The essence of model training is the process of minimizing the loss function. A model may perform multiple tasks, each task corresponds to a loss function, and each loss function corresponds to a weight. The size of the weight directly affects the performance of the model. Therefore, how to determine the weight corresponding to each loss function has become an urgent problem to be solved.

[0003] In related technologies, the main approach is for relevant personnel to first set the initial weights of each loss function based on their experience, then train the model for a period of time, adjust the weights of each loss function based on their experience and the training effect, and then continue training until the training effect meets the requirements, thus obtaining the final trained model.

[0004] However, the method in related technologies involves personnel adjusting the weights of the loss function based on experience. This method cannot guarantee the optimality of the determined weights, resulting in poor performance of the final trained model. Summary of the Invention

[0005] This application provides a model training method, apparatus, device, storage medium, and program product, which can improve the effectiveness of model usage. The technical solution is as follows:

[0006] On the one hand, a model training method is provided, the method comprising:

[0007] The second training sample is generated based on the first generative model in the adversarial generative network. The second training sample is a pseudo sample.

[0008] The predicted label of the second training sample is determined by the first discriminant model in the adversarial generative network;

[0009] Based on the predicted labels and actual labels of the second training samples, the weights of multiple loss functions of the first generation model are iteratively trained until the weights of the multiple loss functions meet the first convergence condition, and the iterative training of the weights of the multiple loss functions is determined to be over.

[0010] The first target model is determined based on the weights of multiple loss functions at the end of iterative training.

[0011] On the other hand, a model training apparatus is provided, the apparatus comprising:

[0012] The generation module is used to generate a second training sample based on the first generation model in the adversarial generative network. The second training sample is a pseudo sample.

[0013] The first determining module is used to determine the predicted label of the second training sample through the first discriminant model in the adversarial generative network;

[0014] The first training module is used to iteratively train the weights of multiple loss functions of the first generation model based on the predicted labels and actual labels of the second training samples, until the weights of the multiple loss functions meet the first convergence condition, and then determine that the iterative training of the weights of the multiple loss functions has ended.

[0015] The second determination module is used to determine the first target model based on the weights of multiple loss functions at the end of iterative training.

[0016] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one piece of program code, which is loaded and executed by the processor to implement the model training method described above.

[0017] On the other hand, a computer-readable storage medium is provided, wherein at least one piece of program code is stored in the computer-readable storage medium, the at least one piece of program code being loaded and executed by a processor to implement the model training method described above.

[0018] On the other hand, a computer program product is provided, which stores at least one piece of program code, which is loaded and executed by a processor to implement the model training method described above.

[0019] The beneficial effects of the technical solutions provided in this application are:

[0020] This application provides a model training method. The method generates pseudo-samples based on a first generative model, determines the predicted labels of the pseudo-samples through a first discriminative model, and iteratively trains the weights of multiple loss functions of the first generative model based on the predicted labels and actual labels of the pseudo-samples. During the iterative training process, this method can learn the most suitable weights for each loss function, ensuring the optimality of the weights of each loss function, thereby improving the performance of the final target model.

[0021] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this disclosure. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the implementation environment of a model training method provided in an embodiment of this application;

[0023] Figure 2This is a flowchart of a model training method provided in an embodiment of this application;

[0024] Figure 3 This is a flowchart of a model training method provided in an embodiment of this application;

[0025] Figure 4 This is a schematic diagram of the weights of a training loss function provided in an embodiment of this application;

[0026] Figure 5 This is a flowchart illustrating a speech recognition process using a first target model, as provided in an embodiment of this application.

[0027] Figure 6 This is a schematic diagram of the structure of a model training device provided in an embodiment of this application;

[0028] Figure 7 This is a structural block diagram of a terminal provided in an embodiment of this application;

[0029] Figure 8 This is a structural block diagram of a server provided in an embodiment of this application. Detailed Implementation

[0030] To make the technical solution and advantages of this application clearer, the embodiments of this application will be described in further detail below.

[0031] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0032] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the training samples, network parameters, loss functions, and their weights involved in this application were all obtained with full authorization.

[0033] Figure 1 This is a schematic diagram of the implementation environment of a model training method provided in an embodiment of this application. See also... Figure 1The implementation environment includes an electronic device, which can be provided as a terminal 101, a server 102, or both a terminal 101 and a server 102. The terminal 101 and the server 102 can be connected via a wireless or wired network. In this embodiment, the electronic device is not specifically limited.

[0034] If the electronic device is provided as terminal 101, then terminal 101 performs model training to obtain the first target model. This first target model can be deployed in terminal 101, so that terminal 101 can perform tasks through the first target model.

[0035] If the electronic device is provided as server 102, then server 102 performs model training to obtain the first target model. The first target model can be deployed to terminal 101. Accordingly, the implementation environment also includes terminal 101, which can be connected to server 102 via a wireless or wired network. Terminal 101 performs tasks using the first target model.

[0036] If the electronic device is provided as terminal 101 and server 102, then server 102 performs model training to obtain a first target model, and then the first target model is deployed to terminal 101, so that terminal 101 can perform tasks through the first target model.

[0037] Terminal 101 is at least one of a mobile phone, tablet computer, and PC (Personal Computer) device. Server 102 can be at least one of a single server, a server cluster consisting of multiple servers, a cloud server, a cloud computing platform, and a virtualization center.

[0038] In this embodiment, the method can be applied to optimize the weights of the loss function of supervised learning models of any field and structure, such as image processing, face recognition, speech recognition, speech generation, natural language processing, and robot control. For example, when applied to the field of image processing, the first target model is an image processing model that can process image color difference, brightness, texture, etc. Each processing can be considered a task. Therefore, the image processing model needs to perform multiple tasks, each task corresponding to a loss function, and each loss function corresponding to a weight. The method provided in this embodiment can learn the most suitable weight for each loss function, ensuring the optimality of the weights for each loss function, thereby improving the performance of the image processing model.

[0039] Figure 2 This is a flowchart of a model training method provided in an embodiment of this application. See also... Figure 2 The method includes:

[0040] Step 201: Generate a second training sample based on the first generative model in the adversarial generative network. The second training sample is a pseudo-sample.

[0041] Step 202: Determine the predicted labels of the second training samples using the first discriminant model in the adversarial generative network.

[0042] Step 203: Based on the predicted labels and actual labels of the second training samples, iteratively train the weights of multiple loss functions of the first generative model until the weights of multiple loss functions meet the first convergence condition, and determine that the iterative training of the weights of multiple loss functions has ended.

[0043] Step 204: Determine the first target model based on the weights of multiple loss functions at the end of iterative training.

[0044] In one possible implementation, based on the predicted and actual labels of the second training samples, the weights of multiple loss functions of the first generative model are iteratively trained, including:

[0045] Based on the predicted labels and actual labels of the second training sample, the prediction accuracy of the second training sample is determined.

[0046] Based on the first training sample, the second training sample, and the current weights of multiple loss functions, determine the first loss value of multiple loss functions, where the first training sample is the real sample;

[0047] Based on prediction accuracy and the first loss value, the weights of multiple loss functions are iteratively trained.

[0048] In another possible implementation, the weights of multiple loss functions are iteratively trained based on prediction accuracy and a first loss value, including:

[0049] Obtain the weights of the first loss value;

[0050] The total loss value is determined based on the weight of the first loss value, the first loss value, and the prediction accuracy.

[0051] Based on the total loss value, the weights of multiple loss functions are iteratively trained.

[0052] In another possible implementation, based on the first training samples and the second training samples, a first loss value for multiple loss functions is determined, including:

[0053] Based on the complexity of multiple loss functions, at least one loss function is separated from the multiple loss functions to obtain the target loss function;

[0054] Based on the first training sample, the second training sample, and the current weights of the target loss function, determine the first loss value of the target loss function;

[0055] Based on prediction accuracy and the first loss value, the weights of multiple loss functions are iteratively trained, including:

[0056] Based on the first training sample, the second training sample, and the current weights of at least one loss function, determine the second loss value of at least one loss function;

[0057] The weights of the target loss function are iteratively trained based on the first loss value, prediction accuracy, and second loss value.

[0058] In another possible implementation, the predicted labels for the second training samples are determined by a first discriminative model in an adversarial generative network, including:

[0059] Based on the first training sample and the second training sample, the first discriminant model is iteratively trained until the first discriminant model satisfies the second convergence condition, and the first training sample is the real sample.

[0060] Based on the first discriminant model obtained through training, the predicted label of the second training sample is determined.

[0061] In another possible implementation, the first discriminative model is iteratively trained based on the first training samples and the second training samples, including:

[0062] The actual labels of the first training sample are labeled as true labels, and the actual labels of the second training sample are labeled as false labels.

[0063] The first discrimination model is iteratively trained based on the actual labels of the first training sample and the actual labels of the second training sample.

[0064] In another possible implementation, the first discriminative model is iteratively trained based on the first training samples and the second training samples, including:

[0065] The actual label of the first training sample is labeled as the true label, the first actual label of the second training sample is labeled as the pseudo label, and the second actual label of the second training sample is labeled as the true label.

[0066] The first discriminant model is iteratively trained based on the actual labels of the first training sample, the first actual label of the second training sample, and the second actual label.

[0067] In another possible implementation, before generating the second training samples based on the first generative model in the adversarial generative network, the method further includes:

[0068] Based on the first training sample, the network parameters of the first generative model are iteratively trained until the network parameters of the first generative model meet the third convergence condition. Then, the step of generating the second training sample based on the first generative model in the adversarial generative network is executed. The first training sample is a real sample.

[0069] In another possible implementation, the first target model is determined based on the weights of multiple loss functions at the end of iterative training, including:

[0070] The second target model is determined based on the weights of multiple loss functions at the end of iterative training;

[0071] Based on the third training sample, the network parameters of the second target model are iteratively trained until the network parameters of the second target model meet the fourth convergence condition, thus obtaining the first target model. The third training sample is used as the training sample for training the second target model.

[0072] In another possible implementation, the network parameters of the second target model are iteratively trained based on the third training samples, including:

[0073] Based on the third training sample, iteratively train the current network parameters of the second target model; or...

[0074] The network parameters of the second target model are initialized, and the network parameters of the second target model are iteratively trained based on the third training sample.

[0075] This application provides a model training method. The method generates pseudo-samples based on a first generative model, determines the predicted labels of the pseudo-samples through a first discriminative model, and iteratively trains the weights of multiple loss functions of the first generative model based on the predicted labels and actual labels of the pseudo-samples. During the iterative training process, this method can learn the most suitable weights for each loss function, ensuring the optimality of the weights of each loss function, thereby improving the performance of the final target model.

[0076] Figure 3 This is a flowchart of a model training method provided in an embodiment of this application, executed by an electronic device. See also... Figure 3 The method includes:

[0077] Step 301: The electronic device iteratively trains the network parameters of the first generative model in the adversarial generative network based on the first training sample until the network parameters of the first generative model satisfy the third convergence condition.

[0078] The network parameters are the parameters in the first generative model other than the weights of the loss function. For example, if the first generative model is a neural network, then the network parameters are the weights of neurons or the weights of convolutional layers, etc. The first training sample is a real sample.

[0079] In this step, the input to the model is a vector. Therefore, the training sample in this embodiment refers to the sample vector, which can be obtained by extracting features from the sample data. In this embodiment, the method of obtaining the sample vector is not specifically limited.

[0080] Electronic devices can acquire corresponding training samples based on the intended use of the final target model. For example, if the first target model is used for face recognition, the training samples can be face feature vectors obtained by extracting face features from face images. If the first target model is used for speech recognition, the training samples can be audio feature vectors obtained by extracting audio features from audio.

[0081] When training the network parameters, the electronic device keeps the current weights of multiple loss functions in the first generative model unchanged, inputs the real first training samples into the first generative model, and iteratively trains the network parameters of the first generative model using the first training samples.

[0082] In this embodiment, the process between updating the weights of two loss functions is called an iterative process. An iterative process includes one or more traversals of the entire training set, each traversal being called a generation. In each generation, the electronic device inputs training samples into the model in batches for training. A batch of data can contain one or more training samples. For each batch of data, it is allowed to traverse the batch of data one or more times, each traversal being called a step. Based on this, the electronic device can traverse the first training samples in the training set one or more times to train the network parameters of the first generative model for one or more generations. Each generation of training can input one or more batches of training samples into the first generative model, and each batch of training samples contains one or more training samples.

[0083] The third convergence condition can be that the difference between the network parameters of the first generative model in the training process of the two generations is less than a first preset threshold, the difference between the loss values ​​of the first generative model in the training process of the two generations is less than a second preset threshold, or the number of training generations reaches the first number of training generations. That is, if the network parameters of the first generative model meet any of the third convergence conditions, the electronic device executes step 302; if the network parameters of the first generative model do not meet any of the third convergence conditions, the electronic device continues to train the network parameters of the first generative model.

[0084] It's important to note that, given a fixed number of training algebras, the expressive power of a non-converged model is proportional to that of a eventually converged model. Therefore, even if a model doesn't converge, as long as the same number of training algebras is used, it's still sufficient to predict its relative performance. Thus, electronic devices can choose to train network parameters for a finite number of algebras, saving computational power per iteration.

[0085] Before step 301, the electronic device can query the computation graph definition of the first generative model to determine whether the weights of each loss function in the computation graph are trainable. If they are not trainable, they are adjusted to be trainable and initialized, and then step 301 is executed. If they are trainable, step 301 is executed directly.

[0086] In the embodiments of this application, the first generation model can be a floating-point model (a model with floating-point parameters), or a fixed-point model, an integer model, or even a binarized model with any bit width (e.g., 16 bits, 12 bits, 11 bits, 10 bits, 8 bits, 7 bits, 4 bits, 2 bits, etc.), without any specific limitation.

[0087] Step 302: The electronic device generates a second training sample based on the first generative model.

[0088] The first generative model is the generative model trained in step 301, and the second training sample is the pseudo-sample generated by the first generative model.

[0089] In this step, the electronic device can determine the pseudo-samples generated by the first generative model after forward inference as the second training samples. Alternatively, the electronic device can acquire noise samples, input them into the first generative model after training, and generate pseudo-samples through the first generative model to obtain the second training samples. In this embodiment, the method by which the first generative model generates pseudo-samples after training is not specifically limited.

[0090] Step 303: The electronic device iteratively trains the first discriminant model in the adversarial generative network based on the first training sample and the second training sample until the first discriminant model satisfies the second convergence condition.

[0091] In this embodiment, although the second training sample is a pseudo-sample, the electronic device can label the actual label of the second training sample as a pseudo-label, or simultaneously label it as a true label and a pseudo-label. If the actual label of the second training sample is a pseudo-label, the electronic device can iteratively train the first discriminant model using the first implementation method below. If the actual label of the second training sample is both a true label and a pseudo-label, the electronic device can iteratively train the first discriminant model using the second implementation method below.

[0092] In the first implementation, the electronic device labels the actual label of the first training sample as the true label and the actual label of the second training sample as the pseudo label; based on the actual labels of the first training sample and the actual labels of the second training sample, the first discrimination model is iteratively trained.

[0093] In this implementation, the electronic device categorizes real samples and fake samples into "real" and "fake" categories, respectively, and iteratively trains the first discrimination model based on the real labels corresponding to real samples and the fake labels corresponding to fake samples.

[0094] In the second implementation, the electronic device labels the actual label of the first training sample as the true label, the first actual label of the second training sample as the pseudo label, and the second actual label of the second training sample as the true label; based on the actual label of the first training sample, the first actual label of the second training sample, and the second actual label of the second training sample, the first discrimination model is iteratively trained.

[0095] In this implementation, the electronic device simultaneously labels the actual labels of the pseudo-samples as both real and pseudo-labels. During the training process, the first discrimination model is iteratively trained using real samples with real labels, pseudo samples with real labels, and pseudo samples with pseudo labels.

[0096] In this embodiment of the application, by labeling the pseudo-samples as both pseudo-labels and true labels, the overfitting of the first discriminative model to the generative model at any stage of the training process can be avoided, thus affecting the training effect of the generative model.

[0097] In this step, the second convergence condition can be that the difference between the loss values ​​of the first discriminant model before and after two generations of training is less than a third preset threshold, or it can be that the number of training generations reaches the second number of training generations. That is, if the first discriminant model meets any of the second convergence conditions, the electronic device executes step 304; if the first discriminant model does not meet any of the second convergence conditions, the electronic device continues to train the first discriminant model.

[0098] In this embodiment, an adversarial generative network (PGN) is introduced, comprising a generative model and a discriminative model. The generative model randomly generates pseudo-samples that are as close as possible to the real samples in the training set, while the discriminative model tries to distinguish whether the input sample is a real sample or a pseudo-sample. Therefore, the goal of the generative model is to maximize the error rate of the discriminative model, while the goal of the discriminative model is to minimize its error rate. After a period of relative adversarial training, when the model finally converges, the discriminative model will be unable to determine whether the sample generated by the generative model is a real sample or a pseudo-sample. Currently, this method has led to a series of applications, including old video restoration, style transfer (such as replacing landscape photos and portrait photos with anime style), and deepfake.

[0099] In this embodiment, the electronic device can determine any machine learning model as the discriminant model. However, considering that the structure of current deep learning models is becoming increasingly complex and it is not easy to compare their expressive power with other models, the discriminant model's ability is too low. It will not have the same powerful expressive power of learning high-order features of samples as the generative model, which will lead to a large loss of accuracy in the final generative model (because it can easily fool the discriminant model without sufficient learning). In another extreme case, if the discriminant model's ability is much greater than that of the generative model, it is very easy for the generative model to become confused, resulting in large gradient jumps, unstable training process, and difficulty in convergence.

[0100] Based on this, in the embodiments of this application, the discriminative model can use the same or similar structural design as the generative model as much as possible. For example, when the generative model is a semantic segmentation network (U-Net), the discriminative model can also be a U-Net network. The advantages of doing so are at least the following two:

[0101] First, the generative and discriminative models have similar structures and expressive capabilities, and can use similar training methods (learning rate, optimizer, etc.), thereby minimizing many training problems caused by the difference in expressive capabilities between the generative and discriminative models. These problems include both the initial gap due to structural differences and the capability gap that may gradually widen as training progresses, especially when the generative and discriminative models use training strategies that may not be consistent.

[0102] Secondly, considering that many deep learning models can be understood as an "encoder-decoder" architecture, shallower layers are responsible for extracting features from input samples, gradually increasing in order, while deeper layers are responsible for deriving features more relevant to the learning task itself, such as specific item categories in classification, and character / complex shape output component features in image super-resolution / denoising. If two models have similar structures and tasks that are somewhat similar but not necessarily identical, such as image denoising and super-resolution, they are likely to have some common detection features. Therefore, they can benefit from sharing network parameters of certain layers (especially shallow layers) to achieve faster training and better accuracy. This is especially true in adversarial generative networks, which are notoriously difficult to train. Initializing network parameters is crucial. Using the same set of network parameters to initialize both the generative and discriminative models ensures that both models start learning from the same point, allowing for better control of training progress and balance, promoting stable convergence, and reducing the chance of getting stuck in local optima in traditional training.

[0103] If the generative and discriminative models use the same or similar structures, they can choose to share some or all of the network parameters. This is beneficial for stable training and can even enable co-training, reducing computational load and improving interpretability.

[0104] In the embodiments of this application, the generative model and the discriminative model can employ neural networks, or other deep learning models other than neural networks, such as Support Vector Machines (SVMs), k-Nearest Neighbors (KNN), and Random Forests. Furthermore, when creating the discriminative model, the network parameters of the discriminative model can be reinitialized or recovered from a pre-trained network, i.e., network parameters trained using other training networks.

[0105] Step 304: The electronic device determines the predicted label of the second training sample based on the first discriminant model obtained from training.

[0106] In this step, the electronic device can predict the second training sample based on the first discriminant model trained in step 303 to determine the predicted label of the second training sample. Then, based on the predicted label of the second training sample by the first discriminant model and the actual label of the second training sample, the weights of multiple loss functions of the first generative model are trained, i.e., step 305 is executed.

[0107] In this embodiment, the first discriminant model can accurately identify real samples but cannot identify fake samples when it converges. Therefore, the electronic device mainly uses the first discriminant model to predict fake samples.

[0108] Step 305: The electronic device iteratively trains the weights of multiple loss functions of the first generative model based on the predicted and actual labels of the second training samples.

[0109] This step can be achieved through the following steps (1) to (3), including:

[0110] (1) The electronic device determines the discrimination accuracy of the first discrimination model for the second training sample based on the predicted label and the actual label of the second training sample.

[0111] The electronic device can first count the total number of second training samples, then, based on the prediction results of the first discriminant model for the second training samples, count the first number of second training samples whose predicted labels match the actual labels, and determine the ratio of this first number to the total number to obtain the discrimination accuracy. Alternatively, the electronic device can also, based on the prediction results of the first discriminant model for the second training samples, count the second number of second training samples whose predicted labels do not match the actual labels, determine the ratio of this second number to the total number, and obtain the discrimination accuracy.

[0112] In this embodiment, the trained first discriminative model discriminates the labels of pseudo-samples and generates a loss between the pseudo-samples and the known actual labels. This loss can be backpropagated to the weights of the loss function. The updated weights of the loss function are used to train the generative model for the next iteration, and so on.

[0113] When the discrimination accuracy is low, it means that the first discrimination model mistakenly predicts the fake sample as the real sample. In this case, the fake sample generated by the first generation model is enough to fool people. When the first discrimination model cannot distinguish the authenticity of the input training sample, the weight of the loss function in the convergence state is the optimal weight.

[0114] (2) The electronic device determines the first loss value of multiple loss functions based on the first training sample, the second training sample and the current weights of multiple loss functions.

[0115] In this step, the electronic device can determine the complexity of multiple loss functions and, based on this complexity, determine whether to separate the loss function from the multiple loss functions. If the complexity is low, the electronic device directly determines the first loss value of the multiple loss functions, which is the first implementation method below. If the complexity is high, the electronic device separates at least one loss function from the multiple loss functions to obtain the target loss function and determines the first loss value of the target loss function, which is the second implementation method below.

[0116] In the first implementation, the electronic device determines the third loss value of each loss function based on the first and second training samples, and then performs a weighted sum of multiple third loss values ​​based on the current weight of each loss function to obtain the first loss value.

[0117] In this implementation, for each loss function, the electronic device determines the loss value between the real sample and the pseudo sample corresponding to the loss function to obtain the third loss value. Based on the current weight of each loss function, multiple third loss values ​​are weighted and summed to obtain the first loss value.

[0118] For example, the first loss value of an electronic device can be expressed by the following formula:

[0119]

[0120] Among them, Loss data1 Let α represent the first loss value. i L represents the current weights of the loss function. i Let represent the i-th loss value, n represent the total number of loss functions, and i represent the order of the loss functions. Both n and i are integers greater than 0.

[0121] In the second implementation, the electronic device separates at least one loss function from multiple loss functions to obtain a target loss function. Based on the first and second training samples, a fourth loss value is determined for each loss function in the target loss function. Based on the current weight of each loss function in the target loss function and its corresponding fourth loss value, the target loss function is weighted and summed to obtain a first loss value.

[0122] The target loss function is the remaining loss function after separating at least one loss function from a plurality of loss functions. The number of target loss functions can be one or more. Furthermore, the separated at least one loss function can be any one or more loss functions from the plurality of loss functions, or it can be a loss function with higher importance among the plurality of loss functions; there is no specific limitation in this regard. For example, an electronic device can separate the loss function for perceptual loss from a plurality of loss functions, or an electronic device can separate the loss function for signal-to-noise ratio from a plurality of loss functions, or an electronic device can separate the loss function for color difference from a plurality of loss functions.

[0123] In this embodiment, the electronic device can determine the complexity of multiple loss functions based on the number of loss functions. If the number of loss functions is small, for example, less than a preset number, the electronic device determines the complexity of the loss functions to be low. If the number of loss functions is large, for example, greater than a preset number, the electronic device determines the complexity of the loss functions to be high.

[0124] Electronic devices can also determine the complexity of multiple loss functions based on the number of loss functions and the level of detail of the task corresponding to each loss function. The more loss functions there are, the higher the precision and complexity of the task.

[0125] In the embodiments of this application, the electronic device may execute step (1) first and then step (2), or it may execute step (2) first and then step (1), or it may execute steps (1) and (2) simultaneously. No specific limitation is made in this regard.

[0126] (3) The electronic device iteratively trains the weights of multiple loss functions based on the discrimination accuracy and the first loss value.

[0127] If step (2) is implemented using the first method, then in this step, the electronic device obtains the weight of the first loss value, determines the total loss value based on the weight of the first loss value, the first loss value and the prediction accuracy, and iteratively trains the weights of multiple loss functions based on the total loss value.

[0128] In this implementation, the weight of the first loss value is a pre-set hyperparameter, and this weight is the weight of the first loss value relative to the prediction accuracy. That is, the weight of the prediction accuracy is 1. The weight of the first loss value can be greater than 1, greater than 0 and less than 1, or equal to 1.

[0129] The process by which the electronic device determines the total loss value can be as follows: the electronic device determines the weight of the first loss value and the product of the first loss value to obtain the fifth loss value, and then determines the sum of the fifth loss value and the prediction accuracy to obtain the total loss value.

[0130] The total loss value can be expressed by the following formula:

[0131] Loss G =μ×Loss data1 +Loss GAN ,

[0132] Among them, Loss G The total loss value is μ, where μ is the weight of the first loss value, and Loss is... GAN To improve prediction accuracy.

[0133] The electronic device iteratively trains the weights of multiple loss functions based on the total loss value.

[0134] In this embodiment, the first loss value is obtained by weighted summation of the loss values ​​of multiple loss functions based on their weights. The first loss value is then weighted and added to the training of the weights of the multiple loss functions. This allows for a clear focus during training, enabling more targeted training of the weights of the multiple loss functions, thereby ultimately improving the model's performance.

[0135] If step (2) is implemented in the second way, then in this step, the electronic device determines the second loss value of at least one loss function based on the first training sample, the second training sample and the current weight of at least one loss function, and iteratively trains the weight of the target loss function based on the first loss value, the prediction accuracy and the second loss value.

[0136] In this implementation, the electronic device determines the sixth loss value of each loss function in at least one loss function based on the first training sample and the second training sample. Based on the current weight of each loss function, the sixth loss values ​​of the at least one loss function are weighted and summed to obtain the second loss value.

[0137] The electronic device obtains the weights of the first loss value, determines the product of the weights of the first loss value and the first loss value to obtain the seventh loss value, determines the sum of the seventh loss value, the prediction accuracy and the second loss value to obtain the total loss value, and iteratively trains the weights of the target loss function based on the total loss value.

[0138] The total loss value can be expressed by the following formula:

[0139] Loss G =μ×Loss data1 +Loss GAN +Loss data2 ,

[0140] Among them, Loss data2 This is the second loss value.

[0141] In this embodiment, at least one loss function separated from multiple loss functions is also added to the training of the weights of the target loss function, thereby training the first generative model in a targeted manner and ultimately improving the model's performance.

[0142] In this embodiment, both the network parameters of the first generative model and the weights of the loss function are considered trainable parameter types. Although their properties differ, they can still be trained. Furthermore, before the weights of the loss function converge, it is undesirable to excessively update the network parameters based on non-optimal loss function weights to prevent the network parameters from getting trapped in local optima. Therefore, the training focus can be shifted to the weights of the loss function rather than the network parameters by adjusting the learning rate, training algebras, etc. For example, the learning rate of the network parameters is greater than the learning rate of the loss function weights, or the training algebras of the loss function weights are greater than the training algebras of the network parameters.

[0143] In addition, in this embodiment of the application, the electronic device can first train the network parameters of the first generative model, train the first discriminative model based on the pseudo samples and real samples generated by the trained first generative model, and train the weights of the loss function according to the predicted labels of the pseudo samples by the trained first discriminative model, that is, execute steps 301 to 305 in sequence.

[0144] The electronic device can also first train the first discriminative model, and then simultaneously train the network parameters of the first generative model and the weights of multiple loss functions. That is, the electronic device first executes steps 303 to 304, then executes steps 301 to 302 and step 305, and then loops back to steps 303 to 304 until the weights of multiple loss functions satisfy the first convergence condition.

[0145] In this implementation, the electronic device can first generate a second training sample based on an initial first generative model. Then, based on the first and second training samples, the first discriminative model is trained in the current iteration. Based on the trained first discriminative model, the predicted label of the second training sample is determined. Then, based on the first training sample, the network parameters of the first generative model are trained in the next iteration until the network parameters of the first generative model meet the third convergence condition. Then, based on the predicted and actual labels of the second training sample, the weights of multiple loss functions of the first generative model are trained in the next iteration until the weights of multiple loss functions meet the first convergence condition, and the iterative training of the weights of multiple loss functions ends.

[0146] In this implementation, the electronic device determines the predicted label of the second training sample based on the first discriminant model obtained from the previous iteration of training, and then performs current iteration training on the network parameters of the first generative model and the weights of multiple loss functions.

[0147] Step 306: If the weights of multiple loss functions do not meet the first convergence condition, the electronic device re-executes step 301. If the weights of multiple loss functions meet the first convergence condition, the electronic device determines that the iterative training of the weights of multiple loss functions has ended.

[0148] The first convergence condition can be that the difference between the weights of multiple loss functions in the training process of two generations is less than the fourth preset threshold, the difference between the loss values ​​of the first generative model in the training of two generations is less than the fifth preset threshold, or the number of training iterations reaches the first preset number of iterations.

[0149] In this embodiment, each time the electronic device performs iterative training on the weights of multiple loss functions, it determines whether the weights of the multiple loss functions satisfy any one of the first convergence conditions. If the weights of the multiple loss functions do not satisfy any one of the first convergence conditions, the electronic device re-executes step 301. If the weights of the multiple loss functions satisfy any one of the first convergence conditions, the electronic device can directly determine that the iterative training of the weights of the multiple loss functions has ended and then execute step 307. Alternatively, it can determine whether the first discriminant model satisfies the second convergence condition. If the weights of the multiple loss functions satisfy any one of the first convergence conditions and the first discriminant model satisfies any one of the second convergence conditions, the electronic device determines that the iterative training of the weights of the multiple loss functions has ended and then executes step 307. If the weights of the multiple loss functions satisfy any one of the first convergence conditions, but the first discriminant model does not satisfy any one of the second convergence conditions, the electronic device re-executes step 301.

[0150] Step 307: The electronic device determines the first target model based on the weights of multiple loss functions at the end of iterative training.

[0151] In this step, for scenarios where model accuracy requirements are not high, such as image classification scenarios, the electronic device can directly determine the generator model corresponding to the weights of multiple loss functions at the end of iterative training as the first target model. For scenarios where model accuracy requirements are high, such as image restoration scenarios, the electronic device can determine the first target model through the following steps (1) to (2), including:

[0152] (1) The electronic device determines the second target model based on the weights of multiple loss functions at the end of iterative training.

[0153] When the weights of multiple loss functions are at the end of iterative training, the electronic device can determine the generative model corresponding to the weights of multiple loss functions at the end of iterative training as the second target model.

[0154] (2) The electronic device iteratively trains the network parameters of the second target model based on the third training sample until the network parameters of the second target model meet the fourth convergence condition, thus obtaining the first target model.

[0155] The third training sample is used to train the second target model. The third training sample can be the same as or different from the first training sample, and there is no specific limitation on this.

[0156] The electronic device can iteratively train the network parameters of the second target model in any of the following ways.

[0157] In the first implementation, the electronic device iteratively trains the current network parameters of the second target model based on the third training sample.

[0158] In this implementation, if the network parameters of the first generative model do not fully converge or have only been trained for a finite number of algebras during iterative training of the network parameters of the first generative model by the electronic device, the electronic device continues to train the current network parameters of the second target model based on the third training sample.

[0159] In the second implementation method, the electronic device initializes the network parameters of the second target model, and then iteratively trains the initialized network parameters of the second target model based on the third training sample.

[0160] As can be seen from step 305 above, the network parameters and weights of the loss function of the first generative model can be trained simultaneously. If the network parameters and weights of the loss function are trained simultaneously, the bias of the network parameters during training may be more sensitive in some applications with high accuracy requirements. In this case, the network parameters can be backtracked to the initial values ​​before iterative training of the network parameters, that is, the network parameters are initialized, and then the network parameters are iteratively trained again based on the third training sample.

[0161] Of course, if the network parameters are trained first and then the weights of the loss function are trained in the order of steps 301 to 305, the electronic device can also initialize the second target network parameters after the weights of the loss function have been trained iteratively, and then retrain the network parameters based on the third training sample.

[0162] In this step, the fourth convergence condition can be that the difference between the network parameters of the second target model in the two generations of training is less than the sixth preset threshold, the loss value of the second target model in the two generations of training is less than the seventh preset threshold, or the number of iterations reaches the second preset number of iterations. That is, if the network parameters of the second target model do not meet any of the fourth convergence conditions, the electronic device continues to train the network parameters of the second target model. If the network parameters of the second target model meet any of the fourth convergence conditions, the electronic device determines that the iterative training of the network parameters of the second target model has ended and obtains the first target model.

[0163] If the first training sample is a facial feature vector obtained based on facial features, then the first target model can be a face recognition model. If the first training sample is an audio feature vector obtained based on audio features, then the first target model can be a speech recognition model. The first target model can also be other models, without specific limitations.

[0164] In the embodiments of this application, after the electronic device determines the first target model, it can also perform other processing on the first target model. For example, if the first target model requires that it cannot contain any other trainable parameters besides network parameters, the electronic device can set the weights of multiple loss functions of the first target model to be untrainable, or freeze the weights of multiple loss functions.

[0165] See Figure 4 ,from Figure 4As can be seen, if the first generative model is a neural network, the weights of multiple loss functions are set to be trainable, and a first discriminative model is created, then iterative training is performed based on the first generative model and the first discriminative model. The iterative training process mainly involves: inputting the first training samples into the first generative model to train the network parameters of the first generative model; then generating pseudo-samples, i.e., the second training samples, using the trained first generative model; training the first discriminative model using the second training samples and the first training samples; training the weights of multiple loss functions in the first generative model based on the predicted and actual labels of the second training samples; continuing training when the weights of multiple loss functions in the first generative model do not meet the first convergence condition; and obtaining the second target model when the weights of multiple loss functions in the first generative model meet the first convergence condition. Further processing of the second target model yields the first target model.

[0166] This application provides a model training method. The method generates pseudo-samples based on a first generative model, determines the predicted labels of the pseudo-samples through a first discriminative model, and iteratively trains the weights of multiple loss functions of the first generative model based on the predicted labels and actual labels of the pseudo-samples. During the iterative training process, this method can learn the most suitable weights for each loss function, ensuring the optimality of the weights of each loss function, thereby improving the performance of the final target model.

[0167] In this embodiment, the adversarial generative network (PGN) is a network for solving unsupervised learning problems. This application treats the determination of the weights of the loss function as unsupervised learning for training. By introducing trainable loss function weights, these weights directly participate in the training and backpropagation updates of the generative model, replacing the traditional method of independently determining the weights of the loss function. Furthermore, by introducing trainable loss function weights, this method can automatically learn the most suitable weights for all loss functions as training progresses, and supports simultaneous adjustment of the weights of multiple loss functions without manual adjustment or the time-consuming and laborious manual adjustment from multiple rounds of training, achieving more precise, flexible, and stable control. Additionally, by introducing trainable loss function weights, the determination process of the loss function weights can be decoupled from the training of network parameters, avoiding overfitting. Moreover, the discriminative model in the adversarial generative network innovatively adopts the same or similar network structure as the generative model, better controlling the relative expressive power and training process between the two, reducing the convergence difficulty.

[0168] In this embodiment, the first target model can be applied to multiple fields such as image processing, face recognition, speech recognition, speech generation, natural language processing, and robot control. In this embodiment, the application of the first target model to speech recognition is used as an example for illustration.

[0169] For ease of distinction, the electronic device used in the training model described above is referred to as the first electronic device, and the electronic device in this embodiment is referred to as the second electronic device. The first electronic device and the second electronic device can be the same electronic device or different electronic devices, and there is no specific limitation in this regard.

[0170] Figure 5 This is a flowchart illustrating speech recognition using a first target model, as provided in an embodiment of this application, executed by a second electronic device. See also... Figure 5 The method includes:

[0171] Step 501: The second electronic device extracts the audio features of the audio to be identified and obtains the audio feature vector.

[0172] The audio to be identified can be human voice or non-human voice audio. The second electronic device first acquires the audio to be identified, and then extracts the audio features of the audio to obtain an audio feature vector.

[0173] Step 502: The second electronic device inputs the audio feature vector into the first target model to obtain the audio recognition result.

[0174] The second electronic device inputs the audio feature vector into the first target model, which then identifies the audio feature vector. The first target model can distinguish between human and non-human audio. If the audio is human, it determines whether it contains a wake-up word. If it does, it identifies the audio other than the wake-up word and controls the second electronic device to perform corresponding operations based on the control command corresponding to that audio, such as opening a map application or a music application.

[0175] Therefore, the first target model can perform multiple tasks, each task corresponding to a loss function. The electronic device can predetermine the optimal weight of each loss function using the method provided in the embodiments of this application. In this way, when performing audio recognition through the first target model, the audio can be accurately recognized, thereby improving the accuracy of audio recognition.

[0176] In this embodiment, speech recognition is performed using a first target model. Since the weights of multiple loss functions in the first target model are obtained through iterative training of an adversarial generative network, the most suitable weights can be learned for each loss function during the iterative training process, ensuring the optimality of the weights of each loss function. In this way, the first target model can accurately recognize audio, thereby improving the accuracy of audio recognition.

[0177] Figure 6 This is a schematic diagram of the structure of a model training device provided in an embodiment of this application. See also... Figure 6 The device includes:

[0178] The generation module 601 is used to generate a second training sample based on the first generation model in the adversarial generative network. The second training sample is a pseudo sample.

[0179] The first determining module 602 is used to determine the predicted label of the second training sample through the first discriminant model in the adversarial generative network;

[0180] The first training module 603 is used to iteratively train the weights of multiple loss functions of the first generative model based on the predicted labels and actual labels of the second training samples until the weights of the multiple loss functions meet the first convergence condition, and then determine that the iterative training of the weights of the multiple loss functions has ended.

[0181] The second determining module 604 is used to determine the first target model based on the weights of multiple loss functions at the end of iterative training.

[0182] In one possible implementation, the first training module 603 is used to determine the prediction accuracy of the second training sample based on the predicted label and the actual label of the second training sample; determine the first loss value of the multiple loss functions based on the first training sample, the second training sample and the current weights of the multiple loss functions, wherein the first training sample is the real sample; and iteratively train the weights of the multiple loss functions based on the prediction accuracy and the first loss value.

[0183] In another possible implementation, a first training module 603 is used to obtain the weights of a first loss value; determine a total loss value based on the weights of the first loss value, the first loss value, and the prediction accuracy; and iteratively train the weights of multiple loss functions based on the total loss value.

[0184] In another possible implementation, the first training module 603 is used to separate at least one loss function from multiple loss functions based on the complexity of the multiple loss functions to obtain a target loss function; determine a first loss value of the target loss function based on a first training sample, a second training sample and the current weights of the target loss function; determine a second loss value of at least one loss function based on the first training sample, the second training sample and the current weights of the at least one loss function; and iteratively train the weights of the target loss function based on the first loss value, the prediction accuracy and the second loss value.

[0185] In another possible implementation, the first determining module 602 is used to iteratively train the first discriminant model based on the first training sample and the second training sample until the first discriminant model satisfies the second convergence condition and the first training sample is a real sample; and to determine the predicted label of the second training sample based on the trained first discriminant model.

[0186] In another possible implementation, the first determining module 602 is used to label the actual label of the first training sample as a true label and the actual label of the second training sample as a false label; and to iteratively train the first discriminant model based on the actual labels of the first training sample and the actual labels of the second training sample.

[0187] In another possible implementation, the first determining module 602 is used to label the actual label of the first training sample as a true label, the first actual label of the second training sample as a false label, and the second actual label of the second training sample as a true label; and to iteratively train the first discriminant model based on the actual label of the first training sample, the first actual label of the second training sample, and the second actual label.

[0188] In another possible implementation, the device also includes:

[0189] The second training module is used to iteratively train the network parameters of the first generative model based on the first training samples until the network parameters of the first generative model meet the third convergence condition, and generate the second training samples based on the first generative model in the adversarial generative network. The first training samples are real samples.

[0190] In another possible implementation, the second determining module 604 is used to determine the second target model based on the weights of multiple loss functions at the end of iterative training; and to iteratively train the network parameters of the second target model based on the third training samples until the network parameters of the second target model satisfy the fourth convergence condition to obtain the first target model, wherein the third training samples are training samples used to train the second target model.

[0191] In another possible implementation, the second determining module 604 is used to iteratively train the current network parameters of the second target model based on the third training samples; or, to initialize the network parameters of the second target model and iteratively train the initialized network parameters of the second target model based on the third training samples.

[0192] This application provides a model training device that generates pseudo-samples based on a first generative model, determines the predicted labels of the pseudo-samples through a first discriminative model, and iteratively trains the weights of multiple loss functions of the first generative model based on the predicted and actual labels of the pseudo-samples. During the iterative training process, the device can learn the most suitable weights for each loss function, ensuring the optimality of the weights of each loss function, thereby improving the performance of the final target model.

[0193] If the electronic device is provided as a terminal, please refer to... Figure 7This diagram illustrates a structural block diagram of a terminal 700 according to an exemplary embodiment of this application. The terminal 700 can be a smartphone, tablet computer, or other device with the function of controlling other devices. The terminal 700 in this application may include one or more of the following components: a processor 710 and a memory 720.

[0194] The processor 710 may include one or more processing cores. The processor 710 connects to various parts within the terminal 700 using various interfaces and lines, and performs various functions and processes data of the terminal 700 by running or executing program code, programs, code sets, or program code sets stored in the memory 720, and by calling data stored in the memory 720. Optionally, the processor 710 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 710 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Neural-network Processing Unit (NPU), and modem. Specifically, the CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display on the screen; the NPU is used to implement Artificial Intelligence (AI) functions; and the modem is used for wireless communication. Understandably, the aforementioned modem may also be implemented separately as a single chip, rather than being integrated into the processor 710.

[0195] The memory 720 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 720 may include a non-transitory computer-readable storage medium. The memory 720 may be used to store program code, programs, code, code sets, or program code sets. The memory 720 may include a program storage area and a data storage area, wherein the program storage area may store program code for implementing an operating system, program code for at least one function (such as touch function, sound playback function, image playback function, etc.), program code for implementing the various method embodiments described above, etc.; the data storage area may store data created based on the use of the terminal 700 (such as audio data, phone book, etc.).

[0196] In addition, those skilled in the art will understand that the structure of the terminal 700 shown in the above figures does not constitute a limitation on the terminal 700. The terminal 700 may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the terminal 700 may also include a microphone, speaker, radio frequency circuit, input unit, sensor, audio circuit, Wireless Fidelity (Wi-Fi) module, power supply, Bluetooth module, etc., which will not be described in detail here.

[0197] If the electronic device is provided as a server, see [link to relevant documentation]. Figure 8 , Figure 8 This is a structural block diagram of a server provided in an embodiment of this application. The server 800 can vary considerably due to different configurations or performance. It may include a processor (central processing unit, CPU) 801 and a memory 802. The memory 802 stores at least one line of program code, which is loaded and executed by the processor 801 to implement the methods provided in the above-described method embodiments. Of course, the server 800 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server 800 may also include other components for implementing device functions, which will not be elaborated here.

[0198] If the electronic device is provided as a terminal and a server, the block diagrams of the terminal and server can be found separately. Figure 7 and Figure 8 .

[0199] In an exemplary embodiment, a computer-readable medium is also provided, which stores at least one piece of program code that is loaded and executed by a processor to implement the model training method in the above embodiments.

[0200] In an exemplary embodiment, a computer program product is also provided, which stores at least one piece of program code, which is loaded and executed by a processor to implement the model training method in the above embodiments.

[0201] In some embodiments, the computer program involved in the present application embodiments may be deployed and executed on a computer device, or executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network. Multiple computer devices distributed in multiple locations and interconnected through a communication network may constitute a blockchain system.

[0202] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0203] The above description is only for the purpose of enabling those skilled in the art to understand the technical solution of this application, and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A model training method, characterized in that, The method includes: The second training sample is generated based on the first generative model in the adversarial generative network. The second training sample is a pseudo sample. The predicted label of the second training sample is determined by the first discriminant model in the adversarial generative network; Based on the predicted label and the actual label of the second training sample, the prediction accuracy of the second training sample is determined; based on the first training sample, the second training sample, and the current weights of multiple loss functions of the first generative model, the first loss value of the multiple loss functions is determined, where the first training sample is a real sample; based on the prediction accuracy and the first loss value, the weights of the multiple loss functions are iteratively trained until the weights of the multiple loss functions meet the first convergence condition, and the iterative training of the weights of the multiple loss functions is determined to be over. The multiple loss functions of the first generative model include loss functions corresponding to multiple tasks of the first generative model. The first convergence condition is that the difference between the weights of the multiple loss functions in two consecutive iterations of training is less than a fourth preset threshold, or the difference between the loss values ​​of the first generative model in two consecutive iterations of training is less than a fifth preset threshold, or the number of iterations of the first generative model reaches a first preset number of iterations. Based on the weights of multiple loss functions at the end of iterative training, a first target model is determined. The first target model is an image processing model, or the first target model is used for speech recognition.

2. The method according to claim 1, characterized in that, The iterative training of the weights of the plurality of loss functions based on the prediction accuracy and the first loss value includes: Obtain the weight of the first loss value; The total loss value is determined based on the weight of the first loss value, the first loss value, and the prediction accuracy. Based on the total loss value, the weights of the multiple loss functions are iteratively trained.

3. The method according to claim 1, characterized in that, The determination of the first loss value of the multiple loss functions based on the current weights of the first training sample, the second training sample, and the first generative model includes: Based on the complexity of the multiple loss functions, at least one loss function is separated from the multiple loss functions to obtain the target loss function; Based on the first training sample, the second training sample, and the current weights of the target loss function, a first loss value of the target loss function is determined; The iterative training of the weights of the plurality of loss functions based on the prediction accuracy and the first loss value includes: Based on the first training sample, the second training sample, and the current weights of the at least one loss function, determine the second loss value of the at least one loss function; The weights of the target loss function are iteratively trained based on the first loss value, the prediction accuracy, and the second loss value.

4. The method according to claim 1, characterized in that, Determining the predicted label of the second training sample through the first discriminant model in the adversarial generative network includes: Based on the first training sample and the second training sample, the first discrimination model is iteratively trained until the first discrimination model satisfies the second convergence condition. Based on the first discriminant model obtained through training, the predicted label of the second training sample is determined.

5. The method according to claim 4, characterized in that, The iterative training of the first discrimination model based on the first training samples and the second training samples includes: The actual labels of the first training sample are labeled as true labels, and the actual labels of the second training sample are labeled as false labels. The first discrimination model is iteratively trained based on the actual labels of the first training samples and the actual labels of the second training samples.

6. The method according to claim 4, characterized in that, The iterative training of the first discrimination model based on the first training samples and the second training samples includes: The actual label of the first training sample is labeled as the true label, the first actual label of the second training sample is labeled as the pseudo label, and the second actual label of the second training sample is labeled as the true label. The first discrimination model is iteratively trained based on the actual labels of the first training samples, the first actual labels of the second training samples, and the second actual labels.

7. The method according to claim 1, characterized in that, Before the first generative model in the adversarial generative network generates the second training sample, the method further includes: Based on the first training sample, the network parameters of the first generative model are iteratively trained until the network parameters of the first generative model meet the third convergence condition, and then the step of generating the second training sample based on the first generative model in the adversarial generative network is executed.

8. The method according to claim 1, characterized in that, The process of determining the first target model based on the weights of multiple loss functions corresponding to the first generative model at the end of iterative training includes: Based on the first generative model corresponding to the weights of the multiple loss functions at the end of iterative training, the second target model is determined; Based on the third training sample, the network parameters of the second target model are iteratively trained until the network parameters of the second target model meet the fourth convergence condition, thus obtaining the first target model. The third training sample is the training sample used to train the second target model.

9. The method according to claim 8, characterized in that, The iterative training of the network parameters of the second target model based on the third training samples includes: Based on the third training sample, iteratively train the current network parameters of the second target model; or... The network parameters of the second target model are initialized, and the network parameters of the second target model are iteratively trained based on the third training sample.

10. A model training device, characterized in that, The device includes: The generation module is used to generate a second training sample based on the first generation model in the adversarial generative network. The second training sample is a pseudo sample. The first determining module is used to determine the predicted label of the second training sample through the first discriminant model in the adversarial generative network; A first training module is used to determine the prediction accuracy of the second training sample based on the predicted label and the actual label of the second training sample; determine the first loss value of the multiple loss functions based on the first training sample, the second training sample, and the current weights of the multiple loss functions of the first generative model, wherein the first training sample is a real sample; and iteratively train the weights of the multiple loss functions based on the prediction accuracy and the first loss value until the weights of the multiple loss functions meet a first convergence condition, thereby determining that the iterative training of the weights of the multiple loss functions has ended. The multiple loss functions of the first generative model include loss functions corresponding to multiple tasks of the first generative model. The first convergence condition is that the difference between the weights of the multiple loss functions in two consecutive iterations of training is less than a fourth preset threshold, or the difference between the loss values ​​of the first generative model in two consecutive iterations of training is less than a fifth preset threshold, or the number of iterations of the first generative model reaches a first preset number of iterations. The second determining module is used to determine a first target model based on the generative model corresponding to the weights of multiple loss functions at the end of iterative training. The first target model is an image processing model, or the first target model is used for speech recognition.

11. An electronic device, characterized in that, The electronic device includes a processor and a memory, the memory storing at least one line of program code, which is loaded and executed by the processor to implement the model training method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one piece of program code, which is loaded and executed by a processor to implement the model training method as described in any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product stores at least one piece of program code, which is loaded and executed by a processor to implement the model training method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Training method and device for generating generative model of adversarial text

    CN111241287A

  • Facial expression synthesis method based on geometric prior adversarial generative adversarial network

    CN112634392A