Weakly supervised machine learning optimization method, device, equipment and storage medium
By combining supervised and self-supervised training of machine learning models, locking specific structures for training, the problem of poor training of a small amount of labeled data in the existing technology is solved, and efficient model training and prediction effect is improved.
Patent Information
- Application Number
- CN202010084922.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-10
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-02-10
AI Technical Summary
The existing weakly supervised machine learning method based on self-encoding decoder fails to effectively consider the randomness of self-supervised when training models with a small amount of labeled data, resulting in poor model prediction results, increasing training costs and reducing efficiency.
By conducting supervised training on the training model, the encoder and predictor are updated, and then some structures related to supervised training are locked for self-supervised training, the unlocked partial structure is updated, and finally the entire encoder is locked for supervised training, and the predictor is updated. , to ensure that the model obtains good prediction results under a small amount of labeled data.
It realizes a model with good prediction effect training under a small amount of labeled data, reduces the training cost of machine learning models, improves training efficiency, and makes full use of labelless data to improve model performance.
Smart Images

Figure CN111325320B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a weakly supervised machine learning optimization method, device, equipment and storage medium. Background Art
[0002] With the development of artificial intelligence technology, machine learning is increasingly being applied to various fields. Today's machine learning usually requires a large amount of labeled data to train machine learning models in order to obtain good model prediction results. Training data may be easy to obtain, but labeling requires specialized manpower, resulting in high model training costs and low training efficiency. Therefore, there are usually fewer labeled data and more unlabeled data, which results in machine learning being unable to obtain good model prediction results. Therefore, weakly supervised machine learning is currently a research direction in the industry.
[0003] Although the existing weakly supervised machine learning method based on self-encoder-decoder can realize machine learning using a small amount of labeled data, this method does not take into account the randomness of self-supervision. Self-supervised learning may destroy the results of supervised learning, resulting in poor prediction effect of the trained model. Therefore, how to use a small amount of labeled data to train a model with good prediction effect, so as to reduce the cost of model training and improve training efficiency, has become an urgent problem to be solved. Summary of the invention
[0004] The main purpose of the present invention is to provide a weakly supervised machine learning optimization method, device, equipment and storage medium, aiming to solve the problem of how to use a small amount of labeled data to train a model with good prediction effect, so as to reduce the cost of model training and improve training efficiency.
[0005] To achieve the above object, the present invention provides a weakly supervised machine learning optimization method, which comprises the following steps:
[0006] Performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor;
[0007] Locking a partial structure of the second encoder related to supervised training, performing self-supervised training on the model to be trained to update an unlocked partial structure of the second encoder, and obtaining a third encoder;
[0008] The third encoder is locked, supervised training is performed on the model to be trained to update the second predictor, and a target model corresponding to the model to be trained is obtained based on the third encoder and the updated second predictor.
[0009] Optionally, the step of performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor comprises:
[0010] Calling the first encoder to perform feature extraction on a first labeled sample used for training the model to be trained to obtain a first prediction feature;
[0011] Calling the first predictor to perform prediction processing on the first prediction feature to obtain a first prediction label;
[0012] A first supervised loss function is calculated according to the first predicted label and the true label of the first labeled sample, and the first encoder and the first predictor are updated according to the first supervised loss function, and the corresponding second encoder and second predictor are obtained after cyclic updating for at least one generation.
[0013] Optionally, the step of locking a partial structure related to supervised training in the second encoder, performing self-supervised training on the model to be trained to update an unlocked partial structure of the second encoder, and obtaining a third encoder comprises:
[0014] Locking a partial structure of the second encoder related to the first prediction feature;
[0015] Calling the second encoder to perform feature extraction on the unlabeled samples used to train the model to be trained, to obtain a second prediction feature and a first augmented feature;
[0016] Calling the decoder of the model to be trained to decode the second prediction feature and the first augmented feature to obtain decoded data;
[0017] A self-supervised loss function is calculated according to the decoded data and the unlabeled samples, and an unlocked partial structure of the second encoder is updated according to the self-supervised loss function, and a third encoder is obtained after cyclic updating for at least one generation.
[0018] Optionally, the step of locking the third encoder and performing supervised training on the model to be trained to update the second predictor comprises:
[0019] Locking the third encoder;
[0020] Calling the third encoder to perform feature extraction on the second labeled sample used for training the model to be trained, to obtain a third prediction feature and a second augmented feature;
[0021] Calling the full parameter predictor of the model to be trained to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label;
[0022] Calculating a second supervised loss function according to the second predicted label and the true label of the second labeled sample, and updating the full parameter predictor according to the second supervised loss function;
[0023] The second predictor is updated according to the updated full parameter predictor, and the update is cyclically performed for at least one generation.
[0024] Optionally, the step of updating the second predictor according to the updated full parameter predictor comprises:
[0025] Pruning is performed on the part of the updated full parameter predictor that has a structure different from that of the second predictor, and the pruned full parameter predictor is used as the updated second predictor.
[0026] Optionally, the second encoder includes an encoder head and an encoder feature augmenter, and the step of calling the second encoder to extract features from the unlabeled sample to obtain the second predicted feature and the first augmented feature includes:
[0027] Calling the encoder head to pre-encode the unlabeled sample to obtain pre-encoded data;
[0028] The encoder feature augmentor is called to perform feature extraction on the pre-encoded data to obtain a second prediction feature and a first augmented feature.
[0029] Optionally, the step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor includes:
[0030] Detecting whether the number of cyclic training of the model to be trained reaches a preset number;
[0031] If the number of cyclic training reaches the preset number, the training is stopped to obtain a target model including the third encoder and the updated second predictor;
[0032] If the number of cyclic training times does not reach the preset number of times, the updated second predictor is used as the first predictor, and the third encoder is used as the first encoder, and then the step of: performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor.
[0033] Optionally, the target model is used to detect the position of a face in an image.
[0034] After the step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor, the method further includes:
[0035] Calling the encoder of the target model to perform feature extraction on the image to be detected to obtain a fourth prediction feature;
[0036] The predictor of the target model is called to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected.
[0037] To achieve the above object, the present invention also provides a weakly supervised machine learning optimization device, the weakly supervised machine learning optimization device comprising:
[0038] A first supervised training module, used for performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor;
[0039] A self-supervised training module, used for locking the partial structure of the second encoder related to the supervised training, performing self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder, and obtaining a third encoder;
[0040] The second supervised training module is used to lock the third encoder, perform supervised training on the model to be trained to update the second predictor, and obtain a target model corresponding to the model to be trained based on the third encoder and the updated second predictor.
[0041] To achieve the above-mentioned objectives, the present invention also provides a weakly supervised machine learning optimization device, which includes: a memory, a processor, and a weakly supervised machine learning optimization program stored in the memory and executable on the processor, and the weakly supervised machine learning optimization program, when executed by the processor, implements the steps of the weakly supervised machine learning optimization method as described above.
[0042] In addition, to achieve the above-mentioned objectives, the present invention also proposes a computer-readable storage medium, on which a weakly supervised machine learning optimization program is stored, and when the weakly supervised machine learning optimization program is executed by a processor, the steps of the weakly supervised machine learning optimization method as described above are implemented.
[0043] In the present invention, supervised training is first performed on the training model, and the encoder and predictor of the training model are updated to provide guidance for model convergence, so that the entire model can converge and converge towards the supervised target direction; then, self-supervised training is performed on the training model after locking the partial structure related to supervised training in the encoder, and the unlocked partial structure of the encoder is updated, so that the encoder learns more features from a large number of unlabeled samples through self-supervised training, and fully utilizes the unlabeled samples to improve the performance of the model, while avoiding the features learned by the encoder in supervised training from being destroyed by the randomness of self-supervised training, thereby ensuring that the feature extraction performance of the encoder is still improved towards the target direction of supervised training; then, the entire encoder is locked, supervised training is performed on the training model, and the predictor is updated, so that the predictor can fully learn to predict according to the features learned by the encoder in supervised training and self-supervised training, thereby improving the prediction accuracy of the predictor, and improving the prediction accuracy of the target model as a whole. Thus, even if only a small number of labeled samples are used in the training process, a target model with a good prediction effect can be trained, reducing the training cost of the machine learning model and improving the model training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of the structure of the hardware operating environment involved in the embodiment of the present invention;
[0045] Figure 2 A schematic diagram of the process flow of the first embodiment of the weakly supervised machine learning optimization method of the present invention;
[0046] Figure 3 A schematic diagram of a machine learning model training architecture involved in an embodiment of the present invention;
[0047] Figure 4 Functional schematic module diagram of a preferred embodiment of the weakly supervised machine learning optimization device of the present invention.
[0048] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0050] like Figure 1 As shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention.
[0051] It should be noted that the weakly supervised machine learning optimization device in the embodiment of the present invention can be a smart phone, a personal computer, a server and other devices, and no specific limitation is made here.
[0052] like Figure 1 As shown, the weakly supervised machine learning optimization device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0053] Those skilled in the art will understand that Figure 1 The device structure shown in the figure does not constitute a limitation of the weakly supervised machine learning optimization device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0054] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a weakly supervised machine learning optimization program. Among them, the operating system is a program that manages and controls the hardware and software resources of the device, and supports the operation of the weakly supervised machine learning optimization program and other software or programs.
[0055] exist Figure 1 In the device shown, the user interface 1003 is mainly used to communicate data with the client; the network interface 1004 is mainly used to establish a communication connection with the server; and the processor 1001 can be used to call the weakly supervised machine learning optimization program stored in the memory 1005 and perform the following operations:
[0056] Performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor;
[0057] Locking a partial structure of the second encoder related to supervised training, performing self-supervised training on the model to be trained to update an unlocked partial structure of the second encoder, and obtaining a third encoder;
[0058] The third encoder is locked, supervised training is performed on the model to be trained to update the second predictor, and a target model corresponding to the model to be trained is obtained based on the third encoder and the updated second predictor.
[0059] Furthermore, the step of performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor includes:
[0060] Calling the first encoder to perform feature extraction on a first labeled sample used for training the model to be trained to obtain a first prediction feature;
[0061] Calling the first predictor to perform prediction processing on the first prediction feature to obtain a first prediction label;
[0062] A first supervised loss function is calculated according to the first predicted label and the true label of the first labeled sample, and the first encoder and the first predictor are updated according to the first supervised loss function, and the corresponding second encoder and second predictor are obtained after cyclic updating for at least one generation.
[0063] Furthermore, the step of locking the partial structure of the second encoder related to the supervised training, performing self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder, and obtaining the third encoder comprises:
[0064] Locking a partial structure of the second encoder related to the first prediction feature;
[0065] Calling the second encoder to perform feature extraction on the unlabeled samples used to train the model to be trained, to obtain a second prediction feature and a first augmented feature;
[0066] Calling the decoder of the model to be trained to decode the second prediction feature and the first augmented feature to obtain decoded data;
[0067] A self-supervised loss function is calculated according to the decoded data and the unlabeled samples, and an unlocked partial structure of the second encoder is updated according to the self-supervised loss function, and a third encoder is obtained after cyclic updating for at least one generation.
[0068] Furthermore, the step of locking the third encoder and performing supervised training on the model to be trained to update the second predictor includes:
[0069] Locking the third encoder;
[0070] Calling the third encoder to perform feature extraction on the second labeled sample used for training the model to be trained, to obtain a third prediction feature and a second augmented feature;
[0071] Calling the full parameter predictor of the model to be trained to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label;
[0072] Calculating a second supervised loss function according to the second predicted label and the true label of the second labeled sample, and updating the full parameter predictor according to the second supervised loss function;
[0073] The second predictor is updated according to the updated full parameter predictor, and the update is cyclically performed for at least one generation.
[0074] Further, the step of updating the second predictor according to the updated full parameter predictor comprises:
[0075] Pruning is performed on the part of the updated full parameter predictor that has a structure different from that of the second predictor, and the pruned full parameter predictor is used as the updated second predictor.
[0076] Furthermore, the second encoder includes an encoder head and an encoder feature augmenter, and the step of calling the second encoder to extract features from the unlabeled sample to obtain the second prediction feature and the first augmented feature includes:
[0077] Calling the encoder head to pre-encode the unlabeled sample to obtain pre-encoded data;
[0078] The encoder feature augmentor is called to perform feature extraction on the pre-encoded data to obtain a second prediction feature and a first augmented feature.
[0079] Further, the step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor includes:
[0080] Detecting whether the number of cyclic training of the model to be trained reaches a preset number;
[0081] If the number of cyclic training reaches the preset number, the training is stopped to obtain a target model including the third encoder and the updated second predictor;
[0082] If the number of cyclic training times does not reach the preset number of times, the updated second predictor is used as the first predictor, and the third encoder is used as the first encoder, and then the step of: performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor.
[0083] Furthermore, the target model is used to detect the position of a face in an image.
[0084] After the step of obtaining the target model corresponding to the model to be trained based on the third encoder and the updated second predictor, the processor 1001 may also be used to call the weakly supervised machine learning optimization program stored in the memory 1005 to perform the following operations:
[0085] Calling the encoder of the target model to perform feature extraction on the image to be detected to obtain a fourth prediction feature;
[0086] The predictor of the target model is called to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected.
[0087] Based on the above structure, various embodiments of the weakly supervised machine learning optimization method are proposed.
[0088] Reference Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the weakly supervised machine learning optimization method of the present invention.
[0089] The embodiments of the present invention provide embodiments of the weakly supervised machine learning optimization method. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than here. The execution subjects of each embodiment of the weakly supervised machine learning optimization method of the present invention may be devices such as smart phones, personal computers, and servers. For ease of description, the execution subjects are omitted in the following embodiments for elaboration. In this embodiment, the weakly supervised machine learning optimization method includes:
[0090] Step S10, performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor;
[0091] In this embodiment, a machine learning model to be trained (hereinafter referred to as the model to be trained) can be pre-built. According to different machine learning tasks, different types of models can be built. For example, different types of neural network models can be built, such as deep neural network models, convolutional neural network models or recurrent neural network models, etc., or neural network models with various types of neural network structures can be built. The model to be trained includes at least an encoder, a decoder and a predictor. Among them, the encoder can be composed of a multi-layer neural network, set in front of the model to be trained, for example, it can be set to connect the input layer, and the encoder is used to extract features from the input data of the training model to obtain a reduced-dimensional feature vector; the decoder can also be composed of a multi-layer neural network, set to connect the encoder, and is used to reconstruct the result of the encoder encoding, aiming to copy the input to the output, that is, the output data is intended to restore the input data as much as possible; the predictor can also be composed of a multi-layer neural network, set to connect the encoder, and is used to predict according to the result of the encoder encoding to obtain a prediction label. According to different machine learning tasks, the prediction label is different. For example, if the machine learning task is image classification, the prediction label can be the confidence level representing the image category. That is, the decoder and predictor of the model to be trained are both connected to the encoder to form two outputs of the model to be trained, wherein the output of the predictor is the output related to the machine learning task.
[0092] After constructing the model to be trained, the model to be trained can be initialized first, that is, the model parameters of the model to be trained can be initialized first, which at least include encoder parameters, decoder parameters and predictor parameters. The model parameters can be randomly generated or set according to experience.
[0093] The training model can be trained in multiple rounds. The training process of one round can be as follows:
[0094] Before a round of training begins, the encoder and predictor of the model to be trained are respectively referred to as the first encoder and the first predictor to distinguish them.
[0095] The model to be trained may be first subjected to supervised training, and the first encoder and the first predictor of the model to be trained may be updated through the supervised training process to obtain the corresponding second encoder and the second predictor. The second encoder is the updated first encoder, and the second predictor is the same. Updating the encoder and the predictor may specifically refer to updating the parameters in the encoder and the predictor.
[0096] Specifically, the supervised training process can use labeled samples for training. Labeled samples are samples with real labels. For example, when the machine learning task is to detect faces on images, the labeled samples can be images, and the corresponding real labels can be the face positions in the manually labeled images. The number of labeled samples does not need to be too much to save the manpower and material resources of manual labeling, thereby saving the cost of model training and improving the efficiency of model training. The supervised training process can use the traditional supervised training method to train the first encoder and the first predictor of the training model, and the decoder does not participate in the training. The goal of supervised training is to make the output of the model to be trained closer to the real label. The supervised training process can be carried out in one or more generations. One generation means that all labeled samples are used for training once. When the labeled samples are divided into multiple small batches and each small batch is used for supervised training, a generation is a complete traversal of each small batch.
[0097] Through supervised training, guidance can be provided for model convergence, so that the entire model can converge and converge towards the supervised target direction, ensuring the prediction accuracy of the final model; and making full use of labeled samples.
[0098] Step S20, locking the partial structure of the second encoder related to the supervised training, performing self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder, and obtaining a third encoder;
[0099] After supervised training, the model to be trained can be subjected to self-supervised training. During the self-supervised training process, part of the structure in the second encoder related to the supervised training can be locked first. Specifically, a part of the structure in the second encoder is related to supervised training, and locking this part of the structure can specifically lock the model parameters in this part of the structure, that is, during the self-supervised training process, the locked model parameters are not updated. For example: if the encoder is a fully connected network layer, some of the connection weights therein can be pre-set to be related to supervised training, and this part of the connection weights can be locked, that is, during the self-supervised training process, this part of the connection weights is kept unchanged.
[0100] After locking the partial structure related to the supervised training in the second encoder, the training model is subjected to self-supervised training, and the unlocked partial structure of the second encoder is updated through the self-supervised training process to obtain the third encoder, wherein the third encoder is the updated second encoder.
[0101] Specifically, the self-supervised training process can be trained with unlabeled samples, which are samples without real labels, that is, they are not labeled. Therefore, unlabeled samples are relatively easy to obtain. For example, when the machine learning task is to perform face detection on an image, the unlabeled sample can be an image, which can be taken by a camera. The number of unlabeled samples can be greater than the number of labeled samples to save manpower and material resources for manual annotation, thereby saving the cost of model training and improving the efficiency of model training. The self-supervised training process can adopt the traditional self-supervised training method to train the second encoder and decoder of the training model, and the second predictor does not participate in the training. During the training process, since the partial structure of the second encoder related to the supervised training is locked, only the unlocked part of the second encoder is updated, while the locked part remains unchanged. Specifically, only the parameters of the unlocked part of the second encoder are updated, and the parameters of the locked part are kept unchanged; the self-supervised training process can also update the parameters of the decoder. The goal of self-supervised training is to make the output of the model to be trained closer to the input. The self-supervised training process can be carried out in one or more generations. One generation means that all unlabeled samples are used for training once. When the unlabeled samples are divided into multiple small batches and each small batch is used for self-supervised training, one generation is the completion of traversing all small batches.
[0102] Through self-supervised training, the unlocked part of the structure in the encoder is updated, so that the encoder can learn more features from a large number of unlabeled samples through self-supervised learning, that is, the feature extraction performance of the encoder is continuously explored through self-supervised training, and full use of the unlabeled samples is made to improve the performance of the model; and, since the goal of self-supervised training is different from that of supervised training, the randomness of self-supervised training may destroy the features learned by the encoder in supervised training. In this embodiment, during the self-supervised training process, some structures in the encoder related to the supervised training are locked, so that the features learned by the encoder in the supervised training will not be destroyed by the randomness of the self-supervised training, thereby ensuring that the feature extraction performance of the encoder is still improved towards the goal direction of supervised training.
[0103] Step S30, locking the third encoder, performing supervised training on the model to be trained to update the second predictor, and obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor;
[0104] After self-supervised training, the model to be trained can be subjected to supervised training again. The supervised training at this time can adopt the same training method as the supervised training in step S10. The difference is that in the supervised training process at this time, the third encoder is locked, that is, the entire encoder is locked. After locking the third encoder, supervised training is performed on the model to be trained, and the second predictor is updated through supervised training, and the decoder does not participate in the training. Specifically, the same labeled samples as in step S10 can be used for supervised training at this time, or different labeled samples can be used. The supervised training at this time can also be iterated for one or more generations.
[0105] After self-supervised training, the encoder is locked to perform supervised training on the model to be trained, and the predictor of the model to be trained is updated, so that the predictor can fully learn to make predictions based on the features learned by the encoder in supervised training and self-supervised training, thereby improving the prediction accuracy of the predictor and thus improving the prediction accuracy of the model to be trained as a whole.
[0106] After performing the above-mentioned supervised training, self-supervised training and supervised training of the locked encoder, a round of training is completed. The model to be trained can be trained for multiple rounds until a preset stop condition is detected to be met, and the target model is obtained based on the third encoder and the updated second predictor. The preset stop condition can be a pre-set condition, for example, stopping when the number of cycles reaches a preset number, or stopping when the training time reaches a preset maximum time, or stopping when it is detected that the model to be trained converges, etc., where the convergence of the model to be trained can refer to the convergence of the loss function in the supervised training process. After stopping the training, the encoder, decoder and predictor with determined parameters are obtained, and the target model can at least include the final encoder and predictor.
[0107] Specifically, the step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor in step S30 includes:
[0108] Step a, detecting whether the number of cyclic training of the model to be trained reaches a preset number;
[0109] Step b, if the number of cyclic training reaches the preset number, stop the training and obtain a target model including the third encoder and the updated second predictor;
[0110] Step c, if the number of cyclic training times does not reach the preset number, the updated second predictor is used as the first predictor, and the third encoder is used as the first encoder, and then the step of: performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained, and obtaining the corresponding second encoder and second predictor.
[0111] After performing supervised training of the locked encoder, it can be detected whether the number of loop trainings for the model to be trained reaches a preset number, wherein the preset number can be set according to specific needs; if it is detected that the number of loop trainings reaches the preset number, the training can be stopped, and the target model is obtained based on the third encoder and the updated second predictor, that is, the target model at least includes the third encoder and the updated second predictor; if it is detected that the number of loop trainings does not reach the preset number, the cycle can be continued, specifically using the updated second predictor as the first predictor, the third encoder as the first encoder, increasing the number of loop trainings by one, and then performing supervised training for the model to be trained, updating the first encoder and the first predictor, as well as subsequent self-supervised training, supervised training of the locked encoder and detection of the number of loop trainings, until it is detected that the number of loop trainings reaches the preset number.
[0112] In this embodiment, supervised training is first performed on the training model, and the encoder and predictor of the training model are updated to provide guidance for model convergence, so that the entire model can converge and converge towards the supervised target direction; then, self-supervised training is performed on the training model after locking the partial structure related to the supervised training in the encoder, and the unlocked partial structure of the encoder is updated, so that the encoder learns more features from a large number of unlabeled samples through self-supervised training, and fully utilizes the unlabeled samples to improve the performance of the model, while avoiding the features learned by the encoder in the supervised training from being destroyed by the randomness of the self-supervised training, thereby ensuring that the feature extraction performance of the encoder is still improved towards the target direction of the supervised training; then, the entire encoder is locked, supervised training is performed on the training model, and the predictor is updated, so that the predictor can fully learn to predict according to the features learned by the encoder in the supervised training and self-supervised training, thereby improving the prediction accuracy of the predictor and improving the prediction accuracy of the target model as a whole. Thus, even if only a small number of labeled samples are used in the training process, a target model with good prediction effect can be trained, reducing the training cost of the machine learning model and improving the model training efficiency.
[0113] Furthermore, the target model is used to detect the face position of the image, and after step S30, the following steps are further included:
[0114] Step S40, calling the encoder of the target model to perform feature extraction on the image to be detected to obtain a fourth prediction feature;
[0115] When the machine learning task is to detect the face position of an image, the training samples (labeled samples and unlabeled samples) are images containing faces, and the real labels of the labeled samples are the position annotations of the faces in the images. Since images are easily collected through camera terminals, but face position annotations need to be manually annotated one by one, it will cost more manpower, material resources and time, resulting in high cost and low efficiency of model training. To overcome this problem, the weakly supervised machine learning optimization scheme in the above embodiment can be used to train the training model using image training samples containing a large number of unlabeled samples and a small number of labeled samples to obtain a target model for face position detection of images.
[0116] After obtaining the target model, the target model can be used to detect the face position of the image to be detected. Specifically, the image to be detected can be obtained, input into the target model, and the encoder of the target model can be called to extract features from the image to be detected to obtain the fourth prediction feature.
[0117] Step S50, calling the predictor of the target model to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected.
[0118] The predictor of the target model is called to perform prediction processing on the fourth prediction feature to obtain the detection result of the face position in the image to be detected. It should be noted that, depending on the structural design of the model, the form of the face position detection result is different, which can be outputting the coordinates representing the position of the face, or outputting a picture with a face area with a different color from other areas, which is not specifically limited here.
[0119] By adopting the weakly supervised machine learning optimization scheme in the above-mentioned embodiment to train the machine learning model for detecting the face position, it is possible to obtain a machine learning model with high accuracy in face position detection even when there are few labeled samples, thereby reducing the manpower and material resources for manual data collection and manual labeling, reducing the cost of model training, and improving the efficiency of model training.
[0120] It should be noted that the machine learning model involved in the embodiment of the present invention can also be applied to other prediction or classification tasks, such as performance level prediction, paper value evaluation, etc.
[0121] Further, based on the above first embodiment, a second embodiment of the weakly supervised machine learning optimization method of the present invention is proposed. In this embodiment, step S10 includes:
[0122] Step S101, calling the first encoder to extract features from a first labeled sample used to train the model to be trained, to obtain a first prediction feature;
[0123] In this embodiment, the supervised training process may specifically be:
[0124] The first encoder is called to perform feature extraction on the first labeled sample to obtain the first prediction feature. The first labeled sample may be a sample collected in advance for supervised training of the training model. Specifically, the sample data of the first labeled sample is input into the first encoder, and the first encoder is used to extract features from the sample data and then output a feature vector of reduced dimension expression. The feature vector represents the features of various aspects of the sample data, including features related to the prediction task and other features. Features related to the prediction task can be extracted from the feature vector as prediction features. The method of extracting prediction features from the feature vector can be pre-specified. For example, the feature vector obtained is a 100-dimensional vector, and the elements of the first 50 dimensions are extracted as prediction features. Taking the machine learning task of face detection on an image as an example, the image data as a labeled sample is input into the first encoder, and the feature extraction layer (for example, a convolutional layer) in the first encoder extracts features from the image data to obtain a feature vector of reduced dimension expression, and the first prediction feature is extracted from the feature vector.
[0125] Step S102, calling the first predictor to perform prediction processing on the first prediction feature to obtain a first prediction label;
[0126] After obtaining the first prediction feature, call the first predictor to perform prediction processing on the first prediction feature to obtain the first prediction label. Specifically, the first prediction feature is input into the first predictor, and the first predictor is used to output the first prediction label after predicting the first prediction feature, wherein the form of the result output by the first predictor may be different depending on the machine learning task. For example, when the machine learning task is to detect the position of a face in an image, the first prediction label may be a confidence matrix, in which each confidence in the matrix corresponds to each pixel of the image, indicating the probability that the corresponding pixel belongs to a face. For another example, when the machine learning task is to classify an image, the first prediction label may be 0 or 1, which is used to indicate whether the image belongs to the target type.
[0127] Step S103, calculating a first supervised loss function according to the first predicted label and the true label of the first labeled sample, and updating the first encoder and the first predictor according to the first supervised loss function, and obtaining the corresponding second encoder and second predictor after cyclically updating for at least one generation.
[0128] After obtaining the first predicted label, the first supervised loss function (also referred to as the predictor loss function) is calculated according to the first predicted label and the true label of the first labeled sample. The specific calculation method of the supervised loss function can refer to the existing calculation method of the supervised loss function, which will not be described in detail here. After calculating the first supervised loss function, the gradient of the first supervised loss function to each parameter in the first encoder and the gradient to each parameter in the first predictor are calculated respectively. According to the calculated gradient, each parameter in the first encoder is updated in the direction of reducing the loss value of the first supervised loss function, and each parameter in the first predictor is updated to complete an update of the first encoder and the first predictor. The above steps can be repeated to update the first encoder and the first predictor for at least one generation. Specifically, the number of supervised training cycles can be set in advance.
[0129] In this embodiment, the first encoder and the first predictor are called in sequence to process the first labeled sample to obtain the first predicted label, and the first supervised loss function is calculated according to the first predicted label and the true label of the first labeled sample, the first encoder and the first predictor are updated according to the first supervised loss function, and the update is cyclically performed for at least one generation, so that the encoder and the predictor are trained with labeled samples, so that the encoder and the predictor can learn the characteristics of the labeled samples, and the model to be trained can converge towards the target direction of supervised training, provide guidance for subsequent self-supervised training, avoid deviation in the model convergence direction, and improve the prediction effect of the target model finally obtained; and the number of labeled samples used in supervised training does not need to be too large, thereby greatly reducing the manpower and material resources of manual labeling, saving the cost of model training, and improving the efficiency of model training.
[0130] Furthermore, the step S20 includes:
[0131] Step S201, locking a partial structure of the second encoder related to the first prediction feature;
[0132] In this embodiment, the process of self-supervised training may specifically be:
[0133] After the second encoder and the second predictor are obtained through supervised training, the part of the second encoder related to the first prediction feature is locked. Specifically, as mentioned above, the first prediction feature is a part of the feature extracted from the feature vector output by the first encoder, then there is a part of the structure in the encoder that is related to the part of the feature, and locking the part of the second encoder related to the first prediction feature can be locking the structure of the second encoder related to the part of the feature, specifically keeping the parameters in the structure unchanged during the self-supervised training process.
[0134] Step S202, calling the second encoder to perform feature extraction on the unlabeled samples used to train the model to be trained, to obtain a second prediction feature and a first augmented feature;
[0135] After locking the partial structure related to the first prediction feature in the second encoder, the second encoder is called to extract features from the unlabeled sample to obtain the second prediction feature and the first augmented feature. Specifically, the unlabeled sample can be a pre-collected sample for self-supervised training of the training model; the sample data of the unlabeled sample is input into the second encoder, and the second encoder is used to extract features from the sample data and then output a feature vector. Similarly, the feature vector represents various features of the sample data, including features related to the prediction task and other features. The features related to the prediction task are called prediction features, and other features are called augmented features.
[0136] Further, the second encoder includes an encoder head and an encoder feature augmenter, and the step S202 includes:
[0137] Step S2021, calling the encoder head to pre-encode the unlabeled sample to obtain pre-encoded data;
[0138] Step S1012: Call the encoder feature augmentor to perform feature extraction on the pre-encoded data to obtain a second prediction feature and a first augmented feature.
[0139] Furthermore, the encoder of the model to be trained may include two parts: an encoder head and an encoder feature augmenter; the encoder head is used to pre-encode the sample data and extract the basic features of the sample data to obtain the pre-encoded data; the encoder feature augmenter is used to perform feature augmentation on the pre-encoded data and expand the features of the sample data that may be related to the predicted label.
[0140] The encoder head may be called to pre-encode the unlabeled sample to obtain pre-encoded data, and then the encoder feature augmentor may be called to extract features from the pre-encoded data to obtain the second predicted feature and the first augmented feature.
[0141] When the second encoder includes an encoder head and an encoder feature augmentor, during the self-supervised training process, a portion of the encoder feature augmentor related to the first prediction feature can be locked, and the encoder head can be locked.
[0142] Step S203, calling the decoder of the model to be trained to decode the second prediction feature and the first augmented feature to obtain decoded data;
[0143] The decoder of the model to be trained is called to decode the second prediction feature and the first augmented feature to obtain decoded data. Specifically, the second prediction feature and the first augmented feature are input into the decoder, that is, the feature vector output by the second encoder is input into the decoder, and the decoder is used to decode the input feature vector and then output decoded data.
[0144] Step S204, calculating a self-supervised loss function according to the decoded data and the unlabeled sample, and updating the unlocked partial structure of the second encoder according to the self-supervised loss function, and obtaining a third encoder after cyclically updating for at least one generation.
[0145] After obtaining the decoded data, the self-supervised loss function (also referred to as the self-encoder-decoder loss function) is calculated based on the decoded data and the sample data of the unlabeled samples. The specific calculation method of the self-supervised loss function can refer to the calculation process of the existing self-supervised loss function, which will not be described in detail here. After calculating the self-supervised loss function, the gradient of the self-supervised loss function to the parameters in the unlocked partial structure of the second encoder is calculated, and the gradient of the self-supervised loss function to the parameters in the decoder is calculated. According to the calculated gradient, the parameters in the unlocked partial structure of the second encoder and the parameters in the decoder are updated in the direction of reducing the loss value of the self-supervised loss function to complete an update of the unlocked partial structure of the second encoder and the decoder. The gradient is not calculated for the parameters of the locked partial structure in the second encoder. The above steps can be repeated to update the unlocked partial structure of the second encoder and the decoder for at least one generation. Specifically, the number of cycles of self-supervised training can be set in advance.
[0146] In this embodiment, after locking the partial structure related to the first prediction feature in the second encoder, the second encoder is called to perform feature extraction on the unlabeled sample to obtain the second prediction feature and the first augmented feature, the decoder is called to decode the second prediction feature and the first augmented feature to obtain decoded data, the self-supervised loss function is calculated according to the decoded data and the unlabeled sample, the unlocked partial structure of the second encoder is updated according to the self-supervised loss function, and the update is cyclically performed for at least one generation, thereby realizing the use of unlabeled samples to train the encoder and decoder, so that the encoder can continuously learn the features of the unlabeled samples during the self-supervised training process, thereby making full use of the unlabeled samples to improve the feature extraction performance of the encoder; and, by locking the partial structure related to the first prediction feature in the second encoder, the features of the labeled samples learned by the encoder during the supervised training process will not be destroyed during the self-supervised training process, so that the self-supervised training converges towards the target direction of the supervised training and avoids the deviation of the direction of the self-supervised training.
[0147] Furthermore, the step S30 includes:
[0148] Step S301, locking the third encoder;
[0149] In this embodiment, the process of locking the encoder to perform supervised training may specifically be:
[0150] After the second predictor is obtained through the supervised training process of the unlocked encoder, and the third encoder is obtained through self-supervised training, the third encoder is locked and supervised training of the locked encoder is performed. Specifically, during the supervised training process of the locked encoder, the parameters of the third encoder are kept unchanged.
[0151] Step S302, calling the third encoder to perform feature extraction on the second labeled sample used to train the model to be trained, to obtain a third prediction feature and a second augmented feature;
[0152] After locking the third encoder, call the third encoder to extract features from the second labeled sample to obtain a third prediction feature and a second augmented feature. The second labeled sample is a pre-collected sample for supervised training of the model to be trained. The second labeled sample may be the same as or different from the first labeled sample. Specifically, the sample data of the second labeled sample is input into the third encoder, and the third encoder is used to extract features from the sample data and then output a feature vector. Similarly, the feature vector represents various features of the sample data, including features related to the prediction task and other features. The features related to the prediction task are called prediction features, and other features are called augmented features.
[0153] Step S303, calling the full parameter predictor of the model to be trained to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label;
[0154] The full parameter predictor of the model to be trained is called to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label. Specifically, the model to be trained may also include a full parameter predictor. The structure of the full parameter predictor may be different from the structure of the predictor. For example, the input data of the predictor is the prediction feature, and the input data of the full parameter predictor is the prediction feature and the augmented feature. The full parameter predictor is used to predict all features extracted by the entire encoder from the sample data and output a prediction label. By continuously training the full parameter predictor, the prediction effect of the full parameter predictor based on all features can be improved.
[0155] Step S304, calculating a second supervised loss function according to the second predicted label and the true label of the second labeled sample, and updating the full parameter predictor according to the second supervised loss function;
[0156] After obtaining the second predicted label, the second supervised loss function (also referred to as the predictor loss function) is calculated according to the second predicted label and the true label of the second labeled sample. The specific calculation method of the supervised loss function can refer to the calculation method of the existing supervised loss function, which will not be described in detail here. After calculating the second supervised loss function, the gradient of the second supervised loss function for each parameter in the full parameter predictor is calculated respectively, and the parameters in the full parameter predictor are updated in the direction of reducing the loss value of the second supervised loss function according to the calculated gradient, so as to complete an update of the full parameter predictor. The gradient is not calculated for the parameters of the third encoder.
[0157] Step S304, updating the second predictor according to the updated full parameter predictor, cyclically updating at least one generation.
[0158] The second predictor is updated according to the updated full parameter predictor. Specifically, the second predictor may be updated by using the part of the full parameter predictor that has the same structure as the second predictor, such as updating the parameters of the second predictor by using the parameters of the part of the full parameter predictor that has the same structure as the second predictor. The above steps may be repeated to update the second predictor for at least one generation. Specifically, the number of cycles of supervised training may be preset.
[0159] Furthermore, the part of the updated full parameter predictor that is different from the second predictor in structure may be pruned, and the pruned full parameter predictor may be used as the updated second predictor. For example, if the full parameter predictor has more neurons and connections between neurons than the second predictor, the connections between these neurons and neurons are deleted, which is called pruning, and the remaining part is used as the new second predictor.
[0160] Through self-supervised training, more feature extraction possibilities of the encoder are explored, and through supervised training, more possibilities of the full parameter predictor for prediction based on all features are explored, so that even if there are only a small number of labeled samples, the prediction accuracy of the model to be trained can be improved through training with unlabeled samples. In addition, the updated second predictor is obtained by pruning the full parameter predictor, so that in each cycle, the part of the full parameter predictor related to the supervised target is always retained, and the part with low possibility is deleted, so that the model convergence has directionality, thereby improving the prediction effect of the trained target model.
[0161] As a preferred embodiment, Figure 3 The machine learning model training architecture shown treats the training model ( Figure 3 The machine learning model in is trained. Figure 3There are three training routes, namely (a) supervised training route, (b) self-supervised training route and (c) supervised full-feature training route. The machine learning model is divided into five parts: encoder head, encoder feature augmenter, decoder, full-parameter predictor and predictor. The model parameters of each part are W e , W hd , W d , W hdp and W p For the training model, follow the three routes (a), (b), and (c) in turn. The training steps are as follows:
[0162] 1. Initialize model parameters W e , W hd , W d , W hdp and W p .
[0163] 2. Update the model parameters W along the supervised training route (a) e , W hd and W p , (one or more generations).
[0164] 3. Lock W e , and lock W hd The parameters related to Fp in (b) are used to update the model parameters W along the self-supervised training route. hd and W d The updateable part (one or more generations).
[0165] 4. Lock W e and W hd , and update the model parameters W along the (c) supervised full-feature training route hdp (One or more generations).
[0166] 5. Use the model pruning method to W hdp Prune to W p .
[0167] 6. Check whether the preset stop condition is met. If it is met, stop training. If not, loop through 2 to 6.
[0168] In addition, the present invention also provides a weakly supervised machine learning optimization device, referring to Figure 4 , the weakly supervised machine learning optimization device comprises:
[0169] A first supervised training module 10 is used to perform supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor;
[0170] A self-supervised training module 20, used to lock the partial structure of the second encoder related to the supervised training, and perform self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder to obtain a third encoder;
[0171] The second supervised training module 30 is used to lock the third encoder, perform supervised training on the model to be trained, and obtain a target model corresponding to the model to be trained based on the third encoder and the updated second predictor.
[0172] Furthermore, the first supervised training module 10 includes:
[0173] A first feature extraction unit, used for calling the first encoder to extract features from a first labeled sample used for training the model to be trained, to obtain a first prediction feature;
[0174] A first prediction unit, configured to call the first predictor to perform prediction processing on the first prediction feature to obtain a first prediction label;
[0175] A first computing unit is used to calculate a first supervised loss function according to the first predicted label and the true label of the first labeled sample, and to update the first encoder and the first predictor according to the first supervised loss function, and to obtain the corresponding second encoder and second predictor after cyclically updating for at least one generation.
[0176] Furthermore, the self-supervised training module 20 includes:
[0177] A first locking unit, used to lock a partial structure of the second encoder related to the first prediction feature;
[0178] A second feature extraction unit, used for calling the second encoder to extract features from the unlabeled samples to obtain a second prediction feature and a first augmented feature;
[0179] A decoding unit, used for calling the decoder of the model to be trained to decode the second prediction feature and the first augmented feature used for training the model to be trained, so as to obtain decoded data;
[0180] The second calculation unit is used to calculate a self-supervised loss function according to the decoded data and the unlabeled sample, and update the unlocked partial structure of the second encoder according to the self-supervised loss function, and obtain a third encoder after cyclically updating for at least one generation.
[0181] Furthermore, the second supervised training module 30 includes:
[0182] A second locking unit, used to lock the third encoder;
[0183] A third feature extraction unit is used to call the third encoder to extract features from the second labeled sample used to train the model to be trained, so as to obtain a third prediction feature and a second augmented feature;
[0184] A second prediction unit is used to call the full parameter predictor of the model to be trained to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label;
[0185] a third computing unit, configured to compute a second supervised loss function according to the second predicted label and the true label of the second labeled sample, and update the full parameter predictor according to the second supervised loss function;
[0186] An updating unit is used to update the second predictor according to the updated full parameter predictor, and cyclically update at least one generation.
[0187] Furthermore, the updating unit is further configured to prune a portion of the updated full parameter predictor having a structure different from that of the second predictor, and use the pruned full parameter predictor as the updated second predictor.
[0188] Further, the second encoder includes an encoder head and an encoder feature augmenter, and the second feature extraction unit includes:
[0189] A precoding subunit, configured to call the encoder head to precode the unlabeled sample to obtain precoded data;
[0190] The feature extraction subunit is used to call the encoder feature augmentor to perform feature extraction on the pre-encoded data to obtain the second prediction feature and the first augmented feature.
[0191] Furthermore, the second supervised training module 30 includes:
[0192] A detection unit, used to detect whether the number of cyclic training of the model to be trained reaches a preset number;
[0193] A stopping unit, configured to stop the training if the number of cyclic training reaches the preset number, and obtain a target model including the third encoder and the updated second predictor;
[0194] A loop unit is used for, if the number of loop training times does not reach the preset number, using the updated second predictor as the first predictor and the third encoder as the first encoder, and then executing the step of: performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and second predictor.
[0195] Furthermore, the target model is used to detect the position of a face in an image.
[0196] The weakly supervised machine learning optimization device also includes:
[0197] A feature extraction module, used for calling the encoder of the target model to extract features from the image to be detected, and obtaining a fourth prediction feature;
[0198] The prediction module is used to call the predictor of the target model to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected.
[0199] The expanded content of the specific implementation method of the weakly supervised machine learning optimization device of the present invention is basically the same as the various embodiments of the above-mentioned weakly supervised machine learning optimization method, and will not be repeated here.
[0200] In addition, an embodiment of the present invention also proposes a computer-readable storage medium, on which a weakly supervised machine learning optimization program is stored. When the weakly supervised machine learning optimization program is executed by a processor, the steps of the weakly supervised machine learning optimization method described below are implemented.
[0201] The various embodiments of the weakly supervised machine learning optimization device and computer-readable storage medium of the present invention can all refer to the various embodiments of the weakly supervised machine learning optimization method of the present invention, and will not be repeated here.
[0202] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0203] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0204] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0205] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A weakly supervised machine learning optimization method, characterized in that: The weakly supervised machine learning optimization method comprises the following steps: Performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor; Locking a partial structure of the second encoder related to supervised training, the partial structure including model parameters, performing self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder, and obtaining a third encoder; Locking the third encoder, keeping the parameters of the third encoder unchanged, performing supervised training on the model to be trained to update the second predictor, and obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor; The target model is used to detect the face position of the image. After the step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor, the method further includes: Calling the encoder of the target model to perform feature extraction on the image to be detected to obtain a fourth prediction feature; The predictor of the target model is called to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected.
2. The weakly supervised machine learning optimization method according to claim 1, characterized in that: The step of performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor comprises: Calling the first encoder to perform feature extraction on a first labeled sample used for training the model to be trained to obtain a first prediction feature; Calling the first predictor to perform prediction processing on the first prediction feature to obtain a first prediction label; A first supervised loss function is calculated according to the first predicted label and the true label of the first labeled sample, and the first encoder and the first predictor are updated according to the first supervised loss function, and the corresponding second encoder and second predictor are obtained after cyclic updating for at least one generation.
3. The weakly supervised machine learning optimization method according to claim 2, characterized in that: The step of locking the partial structure of the second encoder related to the supervised training, performing self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder, and obtaining the third encoder comprises: Locking a partial structure of the second encoder related to the first prediction feature; Calling the second encoder to perform feature extraction on the unlabeled samples used to train the model to be trained, to obtain a second prediction feature and a first augmented feature, wherein the augmented feature is other features unrelated to the prediction task; Calling the decoder of the model to be trained to decode the second prediction feature and the first augmented feature to obtain decoded data; A self-supervised loss function is calculated according to the decoded data and the unlabeled samples, and an unlocked partial structure of the second encoder is updated according to the self-supervised loss function, and a third encoder is obtained after cyclic updating for at least one generation.
4. The weakly supervised machine learning optimization method according to claim 3, characterized in that: The step of locking the third encoder and performing supervised training on the model to be trained to update the second predictor comprises: Locking the third encoder; Calling the third encoder to perform feature extraction on the second labeled sample used for training the model to be trained, to obtain a third prediction feature and a second augmented feature; Calling the full parameter predictor of the model to be trained to perform prediction processing on the third prediction feature and the second augmented feature to obtain a second prediction label; Calculating a second supervised loss function according to the second predicted label and the true label of the second labeled sample, and updating the full parameter predictor according to the second supervised loss function; The second predictor is updated according to the updated full parameter predictor, and the update is cyclically performed for at least one generation.
5. The weakly supervised machine learning optimization method according to claim 4, characterized in that: The step of updating the second predictor according to the updated full parameter predictor comprises: Pruning is performed on the part of the updated full parameter predictor that has a structure different from that of the second predictor, and the pruned full parameter predictor is used as the updated second predictor.
6. The weakly supervised machine learning optimization method according to claim 3, characterized in that: The second encoder includes an encoder head and an encoder feature augmenter, and the step of calling the second encoder to extract features from the unlabeled sample to obtain the second prediction feature and the first augmented feature includes: Calling the encoder head to pre-encode the unlabeled sample to obtain pre-encoded data; The encoder feature augmentor is called to perform feature extraction on the pre-encoded data to obtain a second prediction feature and a first augmented feature.
7. The weakly supervised machine learning optimization method according to claim 1, characterized in that: The step of obtaining a target model corresponding to the model to be trained based on the third encoder and the updated second predictor comprises: Detecting whether the number of cyclic training of the model to be trained reaches a preset number; If the number of cyclic training reaches the preset number, the training is stopped to obtain a target model including the third encoder and the updated second predictor; If the number of cyclic training times does not reach the preset number of times, the updated second predictor is used as the first predictor, and the third encoder is used as the first encoder, and then the step of: performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor.
8. A weakly supervised machine learning optimization device, characterized in that: The weakly supervised machine learning optimization device comprises: A first supervised training module, used for performing supervised training on the model to be trained to update the first encoder and the first predictor of the model to be trained to obtain the corresponding second encoder and the second predictor; A self-supervised training module, used to lock a partial structure of the second encoder related to the supervised training, the partial structure including model parameters, and perform self-supervised training on the model to be trained to update the unlocked partial structure of the second encoder to obtain a third encoder; A second supervised training module is used to lock the third encoder, keep the parameters of the third encoder unchanged, perform supervised training on the model to be trained to update the second predictor, and obtain a target model corresponding to the model to be trained based on the third encoder and the updated second predictor; Wherein, the weakly supervised machine learning optimization device also includes: Calling the encoder of the target model to perform feature extraction on the image to be detected to obtain a fourth prediction feature; The predictor of the target model is called to perform prediction processing on the fourth prediction feature to obtain a detection result of the face position in the image to be detected, wherein the target model is used to perform face position detection on the image.
9. A weakly supervised machine learning optimization device, characterized in that: The weakly supervised machine learning optimization device comprises: a memory, a processor, and a weakly supervised machine learning optimization program stored in the memory and executable on the processor, wherein the weakly supervised machine learning optimization program, when executed by the processor, implements the steps of the weakly supervised machine learning optimization method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a weakly supervised machine learning optimization program, which, when executed by a processor, implements the steps of the weakly supervised machine learning optimization method as described in any one of claims 1 to 7.
