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

By generating pseudo-labels using the source model and the dynamic model during the model transfer process, and combining the difference and learning complexity to calculate the loss value, the problem of low efficiency of pseudo-labels is solved, and the training efficiency and accuracy of the target model are improved.

CN117010480BActive Publication Date: 2025-11-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211017332.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2025-11-21
Estimated Expiration
2042-08-23

AI Technical Summary

Technical Problem

In the process of model domain transfer, pseudo-labels are generated before the target model is trained, resulting in low efficiency of source model knowledge application and low training efficiency and accuracy of the target model.

Method used

By acquiring sample data, pseudo-labels are generated using the source model and the dynamic model. The loss value is determined based on the difference between the pseudo-labels and the sample prediction results. The target candidate model is then iteratively trained, and weights are allocated and weighted fusion is performed in combination with the learning complexity to gradually adjust the target model.

Benefits of technology

It improves the efficiency and accuracy of model transfer, achieves a smooth transfer from the source domain to the target domain, and enhances the training stability and accuracy of the target model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117010480B_ABST
    Figure CN117010480B_ABST
Patent Text Reader

Abstract

The application discloses a model training method and device, equipment, a storage medium and a program product, and relates to the field of machine learning. The method comprises the following steps: acquiring sample data of a first field; predicting the sample data by using a source model, outputting first pseudo labels, and predicting the transformed sample data by using a dynamic model, outputting second pseudo labels; predicting the sample data by using a target candidate model, and obtaining sample prediction results; determining a loss value based on the difference between the first pseudo labels, the second pseudo labels and the sample prediction results; and iteratively training the target candidate model based on the loss value, and obtaining a target model. The transition of the dynamic model is added, so that the sample data is transitioned from the source domain to a target domain corresponding to the target model through the dynamic model, and the model training efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the field of machine learning, and in particular to a model training method and device, equipment, storage medium and program product. BACKGROUND

[0002] In the field of machine learning, a trained model can be transferred between domains, so that the training effect is transferred from the source domain model to the target domain model. Illustratively, the source domain model is a retinal fundus segmentation model, which is transferred to a colon polyp segmentation model through domain transfer of the source domain model.

[0003] In related technologies, in the process of model domain transfer, pseudo labels are generated using the source model to constrain the prediction results of the subsequent target model, thereby completing the training process of the target model based on the source model.

[0004] However, since the pseudo labels are generated before the training of the target model, the knowledge of the source model cannot be applied outside the pseudo labels during the training process, resulting in low application efficiency of the source model knowledge and low training efficiency of the target model. SUMMARY

[0005] Embodiments of the present application provide a model training method, device, equipment, storage medium and program product, which can improve the efficiency and accuracy of model transfer. The technical solution is as follows.

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

[0007] obtaining sample data, the sample data being data collected in a first domain for training a target model;

[0008] predicting the sample data through a source model to output first pseudo labels, and predicting the sample data through a dynamic model to output second pseudo labels, the source model being a model pre-trained for data prediction in a second domain, the dynamic model being a model transformed from a target candidate model to be trained, and the transformed sample data being data transformed from the sample data;

[0009] predicting the sample data through the target candidate model to obtain a sample prediction result;

[0010] determining a loss value based on a first difference between the first pseudo labels and the sample prediction result, and a second difference between the second pseudo labels and the sample prediction result;

[0011] Train the target candidate model iteratively based on the loss value to obtain the target model, the target model being used for predicting data of the first domain.

[0012] In an optional embodiment, the determining of the loss value based on the first difference between the first pseudo label and the sample prediction result and the second difference between the second pseudo label and the sample prediction result comprises:

[0013] determining a first loss value between the first pseudo label and the sample prediction result;

[0014] determining a second loss value between the second pseudo label and the sample prediction result;

[0015] performing weighted fusion on the first loss value and the second loss value to obtain the loss value.

[0016] In an optional embodiment, after the obtaining of the sample data, the method further comprises:

[0017] performing discreteness analysis on output results of the sample data in the source model and the target candidate model to obtain a learning complexity corresponding to the sample data;

[0018] performing weight allocation on the sample data based on the learning complexity to obtain a weight parameter;

[0019] The performing of the weighted fusion on the first loss value and the second loss value to obtain the loss value comprises:

[0020] performing weighted fusion on the first loss value and the second loss value based on the weight parameter to obtain the loss value.

[0021] In an optional embodiment, the performing of the weight allocation on the sample data based on the learning complexity to obtain the weight parameter comprises:

[0022] obtaining a ratio between a current iteration cycle order and a preset iteration cycle number;

[0023] obtaining the candidate weight parameter based on the ratio;

[0024] performing weight allocation on the sample data based on the learning complexity and the candidate weight parameter to obtain the weight parameter.

[0025] In an optional embodiment, the performing of the weighted fusion on the first loss value and the second loss value based on the weight parameter to obtain the loss value comprises:

[0026] obtaining a first difference value between the preset threshold and the candidate weight parameter, and a second product of the first difference value and the second loss value;

[0027] obtaining a first difference value between the preset threshold and the candidate weight parameter, and a second product of the first difference value and the second loss value;

[0028] obtaining a first difference value between the preset threshold and the candidate weight parameter, and a second product of the first difference value and the second loss value;

[0029] In an optional embodiment, before the predicting the sample data by the source model and the dynamic model, the method further comprises:

[0030] deforming the target candidate model by a preset deformation parameter to obtain the dynamic model.

[0031] In an optional embodiment, the deforming the target candidate model by a preset deformation parameter to obtain the dynamic model comprises:

[0032] multiplying the model parameter of the dynamic model in the i-th iteration by the preset deformation parameter to obtain a first product parameter;

[0033] obtaining a second difference value between a preset parameter and the preset deformation parameter;

[0034] multiplying the model parameter of the target model obtained after the i-th iteration by the second difference value to obtain a second product parameter;

[0035] taking a sum of the first product parameter and the second product parameter as the model parameter of the dynamic model in the i+1-th iteration.

[0036] On the other hand, a model training device is provided, and the device comprises:

[0037] an obtaining module, configured to obtain sample data, the sample data being data collected in a first field and used for training a target model;

[0038] a predicting module, configured to predict the sample data by a source model to output a first pseudo label, and predict deformed sample data by a dynamic model to output a second pseudo label, the source model being a model pre-trained for data prediction in a second field, the dynamic model being a model deformed from a target candidate model to be trained, and the deformed sample data being data deformed from the sample data;

[0039] the predicting module is further configured to predict the sample data by the target candidate model to obtain a sample prediction result;

[0040] The determination module is used to determine a loss value based on a first difference between the first pseudo-label and the sample prediction result, and a second difference between the second pseudo-label and the sample prediction result;

[0041] The training module is used to iteratively train the target candidate model based on the loss value to obtain the target model, which is used to predict data in the first domain.

[0042] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement any of the model training methods described in the embodiments of this application above.

[0043] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored in the storage medium, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the model training method as described in any of the embodiments of this application above.

[0044] On the other hand, a computer program product is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the model training methods described in the above embodiments.

[0045] The beneficial effects of the technical solutions provided in this application include at least the following:

[0046] By transforming the target candidate model to obtain the dynamic model, a progressive training process is provided from the source model to the target model, and from the source model to the dynamic model. This assists in completing the training process from the source domain to the target domain. The training process stably adapts to the progressive transition from the source model to the target model, thereby controlling the smooth transfer of model training from the source domain to the target domain. In other words, by adding the transition of the dynamic model, sample data is transitioned from the source domain to the target domain corresponding to the target model through the dynamic model, improving model training efficiency and accuracy. In addition, since the dynamic model is obtained by transforming the target model, it is used to predict deformed sample data and obtain the corresponding second pseudo-label. Due to the deformation of the deformed sample data, the dynamic model assists the target model in predicting the deformation of the data during training, further improving the training accuracy of the target model. Attached Figure Description

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0048] Figure 1 A schematic diagram of a passive field adaptation process provided by an example embodiment of the present application is shown;

[0049] Figure 2 An implementation environment schematic diagram provided by an example embodiment of the present application is shown;

[0050] Figure 3 A flowchart of a model training method provided by an example embodiment of the present application is shown;

[0051] Figure 4 A flowchart of a model training method provided by another example embodiment of the present application is shown;

[0052] Figure 5 A structure schematic diagram of a basic model provided by the embodiment shown is shown; Figure 4

[0053] Figure 6 A structure schematic diagram of a basic model provided by the embodiment shown is shown; Figure 4 A schematic diagram corresponding to the hole convolution provided by the embodiment shown is shown;

[0054] Figure 7 A flowchart of a model training method provided by another example embodiment of the present application is shown;

[0055] Figure 8 A structure block diagram of a model training device provided by an example embodiment of the present application is shown;

[0056] Figure 9 A structure block diagram of a model training device provided by another example embodiment of the present application is shown;

[0057] Figure 10 A structure block diagram of a server provided by an example embodiment of the present application is shown. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail with reference to the drawings.

[0059] First, the terms involved in the embodiments of the present application are briefly introduced.

[0060] ​Artificial Intelligence (AI): is to use digital computer or digital computer controlled machine simulation, extension and expansion of human intelligence, perception of environment, acquisition of knowledge and use of knowledge to obtain the best results of theory, method, technology and application system. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0061] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software level technology. Artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, large feature representation extraction technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology and machine learning / deep learning, etc.

[0062] Machine Learning (ML): is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It is a special study of how computers simulate or implement human learning behavior to acquire new knowledge or skills, reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent, and its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning technologies.

[0063] Domain adaptation: refers to mapping different source domain data and target domain data to the same feature space, so that the distance of source domain data and target domain data in the feature space meets the distance requirement, so that the function trained on the source domain data in the feature space can be migrated to the target domain data for use, improving the prediction accuracy and efficiency of the target domain data.

[0064] The domain adaptation involved in the embodiments of the present application is passive domain adaptation, that is, on the basis of domain adaptation, it is set that the source data cannot be directly obtained, and the process of domain adaptation is performed.

[0065] However, the passive domain adaptation framework in the related art mainly focuses on the correction of pseudo-labels of target data, without considering the learning process.

[0066] As Figure 1As shown, taking the above data as an example of realizing image data, the passive field adaptive process involved in the embodiments of the present application mainly includes at least one of the two parts.

[0067] I. From easy to difficult 110

[0068] Please refer to Figure 1 which shows a schematic diagram of the process from easy to difficult 110 in the embodiments of the present application. As shown Figure 1 As shown, after inputting the sample images into the source model 111 and the target model 112, the dispersion analysis is performed according to the results output by the source model 111 and the results output by the target model 112, and finally the weight corresponding to each sample image is obtained, which represents the recognition complexity corresponding to the sample image. The higher the complexity of the image, the lower the weight corresponding to it, and the lower the complexity of the image, the higher the weight corresponding to it.

[0069] II. From source to target 120

[0070] After obtaining the sample images labeled with weights, the sample images are input for training in order of weight from high to low according to the weight corresponding to the sample images. The target model 112 is a model initialized based on the source model 111, and the target model 112 is deformed to obtain the dynamic model 113. The sample images are input into the source model 111 and the target model 112, and the images obtained by deforming the sample images are input into the dynamic model 113, so as to calculate the loss value according to the first pseudo label output by the source model 111, the sample prediction result output by the target model 112 and the second pseudo label output by the dynamic model 113, and to iteratively train the target model 112.

[0071] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions. For example, the source data and target data involved in the present application are obtained under sufficient authorization.

[0072] Secondly, the implementation environment involved in the embodiments of the present application is explained, and schematically, please refer to Figure 2 The implementation environment involves a terminal 210 and a server 220, and the terminal 210 and the server 220 are connected through a communication network 230.

[0073] In some embodiments, the terminal 210 is configured to send data to the server 220. In some embodiments, the terminal 210 is installed with an application program having a data analysis function (e.g., data category prediction, data identification, etc.), illustratively, the terminal 210 is installed with an image recognition application program. Optionally, the terminal 210 is installed with a search engine program, a travel application program, a life assistance application program, an instant messaging application program, a video program, a game program, etc., which are not limited in the embodiments of the present application.

[0074] The server 220 is configured to train the target model based on the source model, so as to provide the terminal 210 with a data analysis function through the target model. The target model is a model for data analysis in a first field, and the source model is a model for data analysis in a second field. For example, the target model is configured to segment images collected by device A in retinal fundus segmentation images, and the source model is configured to segment images collected by device B in retinal fundus segmentation images; or the target model is configured to identify animal images collected in a forest, and the source model is configured to identify animal images collected on a grassland. Optionally, the server 220 first acquires sample data. The server 220 performs discreteness analysis on the recognition results of the sample data by the source model and the target model to be trained, and obtains the weights corresponding to the respective sample data. The target model is a model obtained by initializing the source model. The first field and the second field belong to the same type of field. Optionally, the prediction result ranges of the source model and the target model are the same. Illustratively, the source model is configured to identify the image type of an image in type library A, and the target model is also configured to identify the image type of an image in type library A, but the source domain image corresponding to the source model and the target domain image corresponding to the target model are collected in different ways, e.g., the source domain image and the target domain image correspond to different collection devices, or correspond to different collection scenes, which are not limited in the embodiments of the present application.

[0075] In addition, the target model is deformed to obtain a dynamic model. The loss value is calculated according to the recognition results of the sample data by the source model, the target model and the dynamic model, wherein the recognition results of the source model and the dynamic model are used as pseudo labels to constrain the recognition result of the target model.

[0076] The target model is iteratively trained according to the loss value to obtain a final target model applied to data analysis.

[0077] The terminal described above can be a mobile phone, a tablet computer, a desktop computer, a portable notebook computer, a smart television, a vehicle-mounted terminal, a smart home device, etc., which are not limited in the embodiments of the present application.

[0078] It is worth noting that the above-mentioned server can be a stand-alone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0079] The cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network to realize data calculation, storage, processing, and sharing in a wide area network or a local area network. The cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology applied based on a cloud computing business model, and can form a resource pool for on-demand use and flexible convenience. Cloud computing technology will become an important support. The background service of a technical network system requires a large amount of computing and storage resources, such as video websites, image websites, and more portals. With the high development and application of the Internet industry, every item may have its own identification mark in the future, and needs to be transmitted to the background system for logical processing. Different levels of data will be processed separately, and various industry data need strong system support, which can only be realized through cloud computing.

[0080] In some embodiments, the above-mentioned server can also be implemented as a node in a blockchain system.

[0081] In combination with the above-mentioned term introduction and application scenarios, the model training method provided in the present application is described. The method can be executed by a server or a terminal, or jointly executed by a server and a terminal. In the embodiments of the present application, the method is executed by the server as an example, as shown in Figure 3 The method includes the following steps.

[0082] Step 301: Obtain sample data. The sample data is data collected in a first field for training a target model.

[0083] Optionally, the sample data is data in a public data set acquired for the first field, for source-free field adaptation training of the target model.

[0084] Optionally, the server can receive sample data uploaded by the terminal; or the server can acquire public data in a public data set from other servers.

[0085] Illustratively, the sample data is data in a public data set acquired for the retinal image fundus segmentation field.

[0086] At step 302, the sample data is predicted by the source model to output first pseudo labels, and the deformed sample data is predicted by the dynamic model to output second pseudo labels.

[0087] The source model is a model pre-trained for data prediction in the second field, and the dynamic model is a model deformed from the target candidate model to be trained. The deformed sample data is data deformed from the sample data.

[0088] Optionally, the dynamic model is used to train the target candidate model to restore the deformed data.

[0089] The first field and the second field belong to the same type of field. Optionally, the prediction results of the source model and the target model are the same. Illustratively, the source model is used for image type identification in type library A, and the target model is also used for image type identification in type library A. However, the source domain image corresponding to the source model and the target domain image corresponding to the target model correspond to different acquisition methods, such as different acquisition devices or different acquisition scenes. This embodiment is not limited in this regard.

[0090] The source model is a model pre-trained in the second field. Optionally, the source model is a model whose training result meets the training requirements, such as a model whose training iteration number reaches a preset number, or a model whose loss value converges in the training process.

[0091] In order to make the model migrate more smoothly from the source field to the target field, the present application embodiment proposes a "source-to-target" curriculum learning algorithm, which uses pseudo labels generated from different models in different migration stages. In the present application embodiment, the sample data is input into a three-branch network structure, which includes a source model, a target model, and a dynamic model. The three models have the same network structure. The parameters of the source model are frozen, and the target model is a model initialized from the source model. The initialization method includes an AdaBN initialization method or other initialization methods. The dynamic model is a model deformed from the target candidate model to be trained according to a preset deformation method. Optionally, the dynamic model is obtained by parameter deformation of the target model.

[0092] Optionally, the target candidate model is deformed by a preset deformation parameter to obtain the dynamic model. Illustratively, the deformation process of the dynamic model is shown in the following formula one:

[0093] Formula one: f m ←τf m’ +(1-τ)f t

[0094] wherein τ is a preset deformation parameter, fm is a power model obtained by the current update, f m’ is a power model obtained by the last iteration, such as a power model updated according to the i th iteration, and the power model obtained by deforming the power model in the i+1 th iteration is f t is a target candidate model.

[0095] Through the three-branch structure of the source model, the target candidate model, and the power model, the curriculum learning and self-supervised learning task from the source model to the target model is completed. Among them, the complete self-supervised learning task is completed through the prediction between the power model and the target candidate model, and the curriculum learning is completed through the prediction of the source model, the power model, and the target candidate model. The curriculum learning involved in the embodiments of the present application refers to the learning process of the target model to the feature space of the source model.

[0096] Optionally, the first pseudo label can be a soft label or a hard label; and the second pseudo label can be a soft label or a hard label. The forms of the first pseudo label and the second pseudo label are the same or different. The soft label refers to a label assigning a probability value to each type of prediction, such as a probability of 0.95 for type A and a probability of 0.6 for type B; and the hard label refers to a label expressing whether the data type is data through binary expression, such as a hard label of 1 for type A, indicating that the data belongs to type A, and a hard label of 0 for type B, indicating that the data does not belong to type B.

[0097] In step 303, the target candidate model is used to predict the sample data to obtain a sample prediction result.

[0098] The target candidate model is a model to be trained at present, and the target candidate model is a model trained for data in the first field. When the target candidate model is trained, the target model is obtained. That is, the target candidate model is a model whose model parameters are to be adjusted. When the model parameters of the target candidate model are adjusted, the model parameters are frozen, and the target candidate model with the frozen model parameters is used as the target model.

[0099] After the sample data is input into the target candidate model, the sample data is predicted by the target candidate model to output a sample prediction result. The prediction of the sample data by the target candidate model includes classification prediction, recognition prediction, image processing result prediction, etc., which are not limited in the embodiments of the present application.

[0100] In step 304, a loss value is determined based on a first difference between the first pseudo label and the sample prediction result, and a second difference between the second pseudo label and the sample prediction result.

[0101] The sample prediction result includes at least one of a hard label result and a soft label result.

[0102] The first pseudo label and the second pseudo label are in the form of a first pseudo label and a second pseudo label, and the sample prediction result in the corresponding form is compared in difference. Taking the first pseudo label as an example, if the first pseudo label is implemented in the form of a hard label, the hard label result of the sample prediction result is compared in difference with the first pseudo label; if the first pseudo label is implemented in the form of a soft label, the soft label result of the sample prediction result is compared in difference with the first pseudo label.

[0103] In some embodiments, the first difference between the first pseudo label and the sample prediction result is determined by a first preset loss function; and the second difference between the second pseudo label and the sample prediction result is determined by a second preset loss function.

[0104] The loss value is determined according to the first difference and the second difference, and the target candidate model is trained based on the loss value.

[0105] In step 305, the target candidate model is iteratively trained based on the loss value to obtain the target model.

[0106] The target model is used to predict data in the first field, that is, the target model is used to map the feature representation of the data into the same feature space as the source model, so as to obtain the prediction result of the data according to the mapping of the feature representation in the feature space.

[0107] Optionally, in each round of iterative training, the target candidate model in the round of iterative training is trained by the loss value obtained by calculation to obtain the target candidate model in the next round of iterative training, and subsequent training is continued until the target model is obtained.

[0108] Illustratively, in the i th round of iterative training, the target candidate model obtained in the i th round of iterative training is used to deform the target candidate model obtained in the i th round of iterative training to obtain the dynamic model in the i+1 th round of iterative training, the loss value is determined according to the source model, the dynamic model in the i th round of iterative training and the target candidate model obtained in the i th round of iterative training, and the target candidate model obtained in the i th round of iterative training is trained based on the loss value to obtain the target candidate model obtained in the i th round of iterative training. The target candidate model is repeatedly trained until the target model is obtained after the training meets the training requirements.

[0109] As described above, the method provided by the embodiment provides a gradual training process from the source model to the target model and from the source model to the dynamic model by deforming the target candidate model, assists in completing the training process from the source domain to the target domain, makes the training process stable and adapt to the transition from the source model to the target model, and thus controls the model training to smoothly transition from the source domain to the target domain, that is, by increasing the transition of the dynamic model, the sample data is transitioned from the source domain to the target domain corresponding to the target model through the dynamic model, and the model training efficiency and accuracy are improved.

[0110] In an optional embodiment, the iterative loop training process comprises training of the target candidate model, and a dynamic model generated after training of the target candidate model. Figure 4 FIG. 1 is a flowchart of a model training method provided by another exemplary embodiment of the present application, which can be executed by a server or a terminal, or executed by both the server and the terminal. In the present embodiment, the method is taken as an example of being executed by the server, as shown in FIG. 1, which comprises the following steps. Figure 4

[0111] In step 401, sample data is acquired, which is data collected in a first domain for training of a target model.

[0112] Optionally, the sample data is data in a public data set acquired for the first domain, for passive domain adaptation training of the target model.

[0113] In step 402, the sample data is predicted by a source model, to output first pseudo labels, and the transformed sample data is predicted by a dynamic model obtained through i-th iteration, to output second pseudo labels, where i is a positive integer.

[0114] The source model is a model pre-trained for data prediction of a second domain, and the dynamic model is a model transformed from the target candidate model to be trained.

[0115] Optionally, the dynamic model is a model transformed from the target candidate model obtained through i-th iteration. In some embodiments, a dynamic model obtained through (i+1)-th iteration is transformed based on the dynamic model in the i-th iteration and the target candidate model obtained after the i-th iteration. As shown in Formula I above, f m is the dynamic model updated in the current (i+1)-th iteration, f m’ is the dynamic model updated in the i-th iteration, and f t is the target candidate model trained through the i-th iteration.

[0116] In the iterative loop training process of the target candidate model, the sample data is predicted by the source model, and the transformed sample data is predicted by the dynamic model in the (i+1)-th loop iteration, the target candidate model trained through the i-th loop iteration is trained according to the prediction results, to obtain the target candidate model trained through the (i+1)-th loop iteration, and the dynamic model in the (i+1)-th loop iteration is transformed according to the target candidate model trained through the (i+1)-th loop iteration, to obtain the dynamic model in the (i+2)-th loop iteration, and the process is repeated until the target model is trained.

[0117] ​The deformed sample data is data obtained by deforming sample data input to the source model. Taking sample data as an image as an example, the sample data is image transformed to obtain the deformed sample data. The image transformation mode includes at least one of a horizontal flip, a vertical flip, and a clipping transformation mode.

[0118] The deformed sample data after image transformation is input to the power model, and the second pseudo label is output by the power model.

[0119] The source model is a model that is pre-trained to map a feature representation of sample data to a preset feature space. The preset feature space is a feature space generated by the source model when training on second field data. The preset feature space includes a feature center vector corresponding to each prediction classification. The feature center vector corresponding to each prediction classification is used to match the mapping result of the feature representation of the sample data in the feature space.

[0120] After the source model extracts the feature representation of the sample data, the feature representation is mapped to the preset feature space to obtain a feature vector of the sample data in the preset feature space. The feature vector is matched with the feature center vector corresponding to each prediction classification to determine the first pseudo label corresponding to the sample data. When the first pseudo label is a hard label, the prediction classification corresponding to the feature center vector closest to the feature vector is taken as the hard label. When the first pseudo label is a soft label, the probability of the prediction classification corresponding to the sample data is determined according to the distance between each feature center vector and the feature vector, and is taken as the soft label.

[0121] The power model is a model deformed on the basis of the target candidate model obtained in the i-th iteration. The mapping of the feature and the parameters of the feature space are different from those of the source model. The process of obtaining the second pseudo label by the power model is similar to the process of obtaining the first pseudo label by the source model. After the feature representation of the deformed sample data is extracted, the feature representation of the deformed sample data is mapped to the feature space corresponding to the power model, and is matched with the feature center vector of each prediction classification in the feature space of the power model, so as to obtain the second pseudo label. When the second pseudo label is a hard label, the prediction classification corresponding to the feature center vector closest to the feature representation of the deformed sample data is taken as the hard label. When the second pseudo label is a soft label, the probability of the prediction classification corresponding to the sample data is determined according to the distance between each feature center vector and the feature representation of the deformed sample data, and is taken as the soft label.

[0122] Optionally, the deformation sample data is predicted by the dynamic model, and a second candidate pseudo label is output. The second pseudo label is obtained by inverse deformation processing of the second candidate pseudo label. The deformation manner of the inverse deformation processing is opposite to the deformation manner of the deformation sample data. For example, if the deformation sample data is obtained by horizontal flipping of the sample data, the inverse deformation refers to a deformation manner of re-flipping the candidate pseudo label to obtain the second pseudo label.

[0123] In step 403, the target candidate model obtained by the i-th iteration training is used to predict the sample data, and a sample prediction result is obtained.

[0124] The target candidate model is a model to be trained at present, and the target candidate model is a model trained for data of the first field. When the target candidate model is trained, a target model is obtained. That is, the target candidate model is a model whose model parameters are to be adjusted. When the model parameters of the target candidate model are adjusted, the model parameters are frozen, and the target candidate model with the frozen model parameters is used as the target model.

[0125] After the sample data is input into the target candidate model obtained by the i-th iteration training, the target candidate model obtained by the i-th iteration training is used to predict the sample data, and a sample prediction result is output.

[0126] In step 404, a loss value is determined based on a first difference between the first pseudo label and the sample prediction result, and a second difference between the second pseudo label and the sample prediction result.

[0127] The sample prediction result includes at least one of a hard label result and a soft label result. The loss value is a loss value in the i+1-th iteration, that is, the loss value used to evaluate the target candidate model obtained by the i-th iteration training after the target candidate model obtained by the i-th iteration training is used for prediction.

[0128] In some embodiments, the first difference between the first pseudo label and the sample prediction result is determined by a first preset loss function, and the second difference between the second pseudo label and the sample prediction result is determined by a second preset loss function.

[0129] The loss value is determined according to the first difference and the second difference, and the target candidate model is trained based on the loss value.

[0130] First, the second difference between the second pseudo label input into the dynamic model and the sample prediction result is described. The second loss value is determined according to the second difference between the second pseudo label and the sample prediction result. The loss function corresponding to the second loss value is shown in the following Formula Two and Formula Three.

[0131] Formula two: y psd = softmax(T -1 (f m (T(x t ))))

[0132] Formula three:

[0133] wherein y psd is a second pseudo label predicted by the power model, T is a deformation operation on a sample image, f m is the power model, T -1 is an inverse deformation on the predicted result. is a second loss value, W and H are width and height of the sample image, (u, v) is a coordinate of a pixel in the sample image, p t is a predicted result output by the target candidate model.

[0134] In the source-to-target curriculum learning, the first pseudo label y src generated from the source model is used to start learning, and the learning object is gradually migrated to the second pseudo label y psd generated by the power model, and the loss function is as shown in the following formula four:

[0135] Formula four:

[0136] wherein, is a total loss value, is a first loss value corresponding to the source model, and ω and α are weight parameters.

[0137] Step 405, training the target candidate model obtained in the ith iteration based on the loss value in the (i+1)th iteration to obtain the target candidate model after the (i+1)th iteration.

[0138] Optionally, the model parameters of the target candidate model obtained in the ith iteration are adjusted based on the loss value in the (i+1)th iteration to obtain the target candidate model after the (i+1)th iteration.

[0139] The target model is used to predict data in the first field, that is, the target model is used to map the feature representation of the data into the same feature space as the source model, so as to obtain the predicted result of the data according to the mapping of the feature representation in the feature space.

[0140] Step 406, in response to the target candidate model meeting the training requirement, determining the target candidate model as the target model.

[0141] Optionally, in each round of iterative training, the target candidate model in the round of iterative training is trained by calculating the loss value, to obtain the target candidate model in the next round of iterative training, and subsequent training is continued until the target model is obtained.

[0142] Illustratively, in the i-th round of iterative training, the target candidate model obtained in the i-th round of iterative training is used to deform the target candidate model obtained in the i-th round of iterative training to obtain a dynamic model in the i+1-th round of iterative training, the loss value is determined according to the source model, the dynamic model in the i-th round of iterative training and the target candidate model obtained in the i-th round of iterative training, and the target candidate model obtained in the i-th round of iterative training is trained based on the loss value. The target candidate model is repeatedly iteratively trained until the target model is obtained after the training meets the training requirements.

[0143] Optionally, the training requirements include at least one of the number of iterations, the loss value convergence condition and the like.

[0144] Optionally, the source model, the target model and the dynamic model in the embodiment of the present application all use the same basic model, illustratively, DeepLab-V3 is used as the basic model, and the model structure is as shown in Figure 5 The model 500 contains multiple different scale hole convolutions 510, which can increase the extraction ability of the model multi-scale features and help better identify the lesions in the picture.

[0145] The structure of the hole convolution 510 is as shown in Figure 6 Compared with the normal convolution 600 Figure 6 , the leftmost), the hole convolution 510 leaves a gap between the respective convolution parameters, which can achieve the purpose of increasing the convolution receptive field.

[0146] In summary, the method provided in the embodiment provides a gradual training process from the source model to the target model and from the source model to the dynamic model, which assists in completing the training process from the source domain to the target domain, makes the training process stable and adapt to the transition from the source model to the target model, and thus controls the model training to smoothly transfer from the source domain to the target domain, that is, by increasing the transition of the dynamic model, the sample data is transitioned from the source domain to the target domain corresponding to the target model through the dynamic model, and the model training efficiency and accuracy are improved.

[0147] The method provided in the embodiment improves the training efficiency and accuracy of the target model by predicting the deformed sample data through the dynamic model and predicting the sample data through the source model, assisting the target model in training data restoration ability through the dynamic model, and improving the mapping accuracy of the target model in the feature space through the source model.

[0148] The method provided by the embodiment can improve the data comparison accuracy and efficiency by deforming the sample data, predicting a second candidate pseudo label from the deformed sample data by using the dynamic model, and deforming the second candidate pseudo label again by using the inverse deformation to obtain the second pseudo label, and comparing the second pseudo label with the sample prediction result.

[0149] The method provided by the embodiment can improve the training efficiency and accuracy of the target model by continuously deforming the target candidate model obtained in each iteration to obtain a dynamic model of the next round, and iteratively updating the dynamic model and the target candidate model.

[0150] In an optional embodiment, each sample data further includes a complexity, and the target model is trained from easy to difficult according to the complexity. Figure 7 FIG. 1 is a flowchart of a model training method provided by an exemplary embodiment of the present application. The method can be executed by a server or a terminal, or can be executed by the server and the terminal together. In the embodiment of the present application, the method is taken as an example of being executed by the server, and the method includes the following steps, as shown in FIG. 1. Figure 7 The method includes the following steps.

[0151] Step 701: Obtain sample data. The sample data is data collected in a first field and used for training a target model.

[0152] Optionally, the sample data is data in a public data set obtained for the first field, and is used for passive field self-adaptive training of the target model.

[0153] Step 702: Perform discreteness analysis on output results of the sample data in a source model and a target candidate model to obtain a learning complexity corresponding to the sample data.

[0154] That is, the sample data is input into the source model to output a first prediction result, and the sample data is input into the target candidate model to output a sample prediction result. The learning complexity is obtained by performing discreteness analysis on the sample data based on the first prediction result and the sample prediction result.

[0155] Optionally, taking a sample data realized as a sample image as an example, the prediction manner of the learning complexity is shown in the following Formula Five.

[0156] Formula Five:

[0157] Wherein, d represents the learning complexity, KL represents a discreteness algorithm, p s is a prediction probability output by the source model, and p t represents a probability output by the target model. The probability represents a probability of a pixel point (u, v) belonging to a certain category.

[0158] Step 703, weight assignment is performed on the sample data based on the learning complexity, and a weight parameter is obtained.

[0159] Optionally, in each batch of training, in order to realize the learning of the target model from simple samples to difficult samples, the samples are weight assigned according to the learning complexity d, and the weight assignment manner is shown in the following formula six:

[0160] Formula six:

[0161] Wherein, ω b is the weight parameter, δ is a preset constant, B is the total number of sample data in the batch, b is the bth sample data in the batch, and α is the candidate weight parameter.

[0162] Optionally, in the calculation process of the weight parameter and the candidate weight parameter, a ratio between the current iteration cycle order and the preset iteration cycle number is obtained; the candidate weight parameter is obtained based on the ratio; and the sample data is weight assigned based on the learning complexity and the candidate weight parameter, and the weight parameter is obtained.

[0163] Wherein, the calculation manner of the candidate weight parameter α is shown in the following formula seven:

[0164] Formula seven:

[0165] Wherein, R refers to the Rth iteration training, R max refers to the maximum number of iteration training.

[0166] Optionally, the higher the learning complexity of the sample data, the smaller the corresponding weight parameter; the lower the learning complexity of the sample data, the larger the corresponding weight parameter.

[0167] Optionally, when the sample data is obtained to train the target candidate model, the sample data with a large weight parameter is selected first, and then the sample data with a small weight parameter is selected to train the target candidate model.

[0168] Step 704, the sample data is predicted by the source model, and a first pseudo label is output; and the deformed sample data is predicted by the power model obtained through the ith iteration, and a second pseudo label is output, i being a positive integer.

[0169] Optionally, since the process of outputting the first prediction result is performed in the above step 702, the first prediction result is the same as the first pseudo label, or the first pseudo label is a pseudo label obtained based on the first prediction result, so the prediction process of the source model in step 704 can be omitted.

[0170] The source model is a model pre-trained for data prediction of the second field, and the dynamic model is a model transformed from the target candidate model to be trained.

[0171] Optionally, the dynamic model is a model transformed from the target candidate model obtained in the i th iteration. In some embodiments, the dynamic model obtained in the i+1 th iteration is transformed based on the dynamic model in the i th iteration and the target candidate model obtained after the i th iteration.

[0172] The source model is a model pre-trained to map the feature representation of the sample data to a preset feature space, and the preset feature space is a feature space generated by the source model when training data of the second field. The preset feature space includes a feature center vector corresponding to each prediction classification, and the feature center vector corresponding to each prediction classification is used to match the mapping result of the feature representation of the sample data in the feature space.

[0173] The dynamic model is a model transformed from the target candidate model obtained in the i th iteration, and the mapping of the feature and the parameters of the feature space are different from those of the source model.

[0174] In step 705, the target candidate model obtained by the i th iteration is used to predict the sample data to obtain a sample prediction result.

[0175] Optionally, since the output sample prediction result process is performed in step 702, the prediction process in step 705 can be omitted.

[0176] The target candidate model is the current model to be trained, and the target candidate model is a model trained for data of the first field. When the target candidate model is trained, the target model is obtained. That is, the target candidate model is a model whose model parameters need to be adjusted. When the model parameters of the target candidate model are adjusted, the model parameters are frozen, and the target candidate model with frozen model parameters is used as the target model.

[0177] After inputting the sample data into the target candidate model obtained by the i th iteration, the target candidate model obtained by the i th iteration is used to predict the sample data to output a sample prediction result. The prediction of the sample data by the target candidate model includes classification prediction, identification prediction, image processing result prediction, etc., which are not limited in the embodiments of the present application.

[0178] In step 706, a first loss value between the first pseudo label and the sample prediction result is determined.

[0179] In step 707, a second loss value between the second pseudo label and the sample prediction result is determined.

[0180] Optionally, the calculation of the first loss value and the second loss value is described in detail in step 404, which will not be repeated here.

[0181] In step 708, the first loss value and the second loss value are weighted and fused based on the weight parameter to obtain a loss value.

[0182] That is, the weight parameter ω in formula four and the candidate weight parameter α are the parameters calculated based on the iteration process and the sample data in formula six and formula seven.

[0183] Optionally, the first product of the candidate weight parameter and the first loss value is obtained, the first difference between the preset threshold value and the candidate weight parameter is obtained, and the second product of the first difference and the second loss value is obtained; and the sum of the first product and the second product is taken as the loss value. As shown in formula four, the preset threshold value is 1. Optionally, the value of the candidate weight parameter is between 0 and 1.

[0184] In step 709, the target candidate model obtained in the i th iteration is trained based on the loss value in the i+1 th iteration to obtain the target candidate model after the i+1 th iteration.

[0185] Optionally, the model parameters of the target candidate model obtained in the i th iteration are adjusted based on the loss value in the i+1 th iteration to obtain the target candidate model after the i+1 th iteration.

[0186] The target model is used to predict the data in the first field, that is, the target model is used to map the feature representation of the data into the same feature space as the source model, so as to obtain the prediction result of the data according to the mapping of the feature representation in the feature space.

[0187] In step 710, the target candidate model is determined as the target model in response to the target candidate model meeting the training requirement.

[0188] Optionally, in each round of iteration training, the target candidate model in the round of iteration is trained by the loss value calculated to obtain the target candidate model in the next round of iteration, and the subsequent training is continued until the target model is obtained.

[0189] Illustratively, in the i th round of iteration training, the target candidate model obtained in the i th round of iteration training is used to deform the target candidate model obtained in the i th round of iteration training to obtain a dynamic model in the i+1 th round of iteration training, the loss value is determined according to the source model, the dynamic model in the i th round of iteration training, and the target candidate model obtained in the i th round of iteration training, and the target candidate model obtained in the i th round of iteration training is trained based on the loss value to obtain the target candidate model obtained in the i th round of iteration training. The target candidate model is repeatedly trained until the target model is obtained after the training meets the training requirement.

[0190] In summary, the method provided by the embodiment provides a dynamic model by deforming the target candidate model, thereby providing a gradual training process from the source model to the target model and from the source model to the dynamic model, assisting in completing the training process from the source domain to the target domain, making the training process adapt to the transition from the source model to the target model, thereby controlling the model training to smoothly transition from the source domain to the target domain, that is, by increasing the transition of the dynamic model, the sample data is transitioned from the source domain to the target domain corresponding to the target model through the dynamic model, thereby improving the model training efficiency and accuracy.

[0191] The method provided by the embodiment calculates the learning complexity of the sample data, thereby determining the weight parameters corresponding to the sample data, and when selecting sample data for training, first selects data with low learning complexity for training, and then selects data with high learning complexity for training, thereby realizing a gradual learning process from the source domain to the target domain.

[0192] The method provided by the embodiment calculates the learning complexity of the sample data, thereby determining the weight parameters corresponding to the sample data, and applies the weight parameters to the calculation process of the loss value, thereby avoiding training the model with the same step length for sample data with different complexities, and improving the training accuracy of the model.

[0193] Figure 8 is a structural block diagram of a model training device provided by an exemplary embodiment of the present application, as shown in Figure 8 The device comprises:

[0194] The acquisition module 810 is configured to acquire sample data, wherein the sample data is data collected in a first domain and used for training a target model.

[0195] The prediction module 820 is configured to predict the sample data by using a source model to output a first pseudo label, and predict the deformed sample data by using a dynamic model to output a second pseudo label, wherein the source model is a model pre-trained for data prediction in a second domain, the dynamic model is a model deformed from a target candidate model to be trained, and the deformed sample data is data deformed from the sample data.

[0196] The prediction module 820 is further configured to predict the sample data by using the target candidate model to obtain a sample prediction result.

[0197] The determination module 830 is configured to determine a loss value based on a first difference between the first pseudo label and the sample prediction result, and a second difference between the second pseudo label and the sample prediction result.

[0198] The training module 840 is configured to perform iterative training on the target candidate model based on the loss value, to obtain the target model, and the target model is configured to perform prediction on data in the first domain.

[0199] In an optional embodiment, the power model is a model obtained by deforming the target candidate model in the i th iteration;

[0200] The training module 840 is further configured to train the target candidate model in the i th iteration based on a loss value in the (i+1) th iteration, to obtain the target candidate model after the (i+1) th iteration, and i is a positive integer.

[0201] The determination module 830 is further configured to determine the target candidate model as the target model in response to the target candidate model meeting a training requirement.

[0202] In an optional embodiment, the prediction module 820 is further configured to perform prediction on the sample data by using the source model to output a first pseudo label, and perform prediction on the deformed sample data by using the power model in the i th iteration to output the second pseudo label.

[0203] The prediction module 820 is further configured to perform prediction on the sample data by using the target candidate model in the i th iteration to obtain the sample prediction result in the i th iteration.

[0204] In an optional embodiment, the prediction module 820 is further configured to perform prediction on the deformed sample data by using the power model to output a second candidate pseudo label.

[0205] As shown in Figure 9 The apparatus further includes:

[0206] The deformation module 850 is configured to perform inverse deformation processing on the second candidate pseudo label to obtain the second pseudo label, and a deformation manner of the inverse deformation processing is opposite to a deformation manner of the deformed sample data.

[0207] In an optional embodiment, the determination module 830 is further configured to determine a first loss value between the first pseudo label and the sample prediction result.

[0208] The determination module 830 is further configured to determine a second loss value between the second pseudo label and the sample prediction result.

[0209] The apparatus further includes:

[0210] The fusion module 860 is configured to perform weighted fusion on the first loss value and the second loss value to obtain the loss value.

[0211] In an optional embodiment, the apparatus further comprises:

[0212] an analysis module 870 configured to analyze a discrete degree between output results of the sample data in the source model and the target candidate model, to obtain a learning complexity corresponding to the sample data;

[0213] an allocation module 880 configured to perform weight allocation on the sample data based on the learning complexity, to obtain a weight parameter;

[0214] The fusion module 860 is further configured to perform weighted fusion on the first loss value and the second loss value based on the weight parameter, to obtain the loss value.

[0215] In an optional embodiment, the allocation module 880 is further configured to obtain a ratio between a current iteration cycle order and a preset iteration cycle number; obtain the candidate weight parameter based on the ratio; and perform weight allocation on the sample data based on the learning complexity and the candidate weight parameter, to obtain the weight parameter.

[0216] In an optional embodiment, the fusion module 860 is further configured to obtain a first product of the candidate weight parameter and the weight parameter and the first loss value; obtain a first difference between a preset threshold value and the candidate weight parameter, and a second product of the first difference and the second loss value; and take a sum of the first product and the second product as the loss value.

[0217] In an optional embodiment, the apparatus further comprises:

[0218] a deformation module 850 configured to perform deformation processing on the target candidate model by using a preset deformation parameter, to obtain the dynamic model.

[0219] In an optional embodiment, the deformation module 850 is further configured to multiply model parameters of the dynamic model in the i-th iteration by the preset deformation parameter, to obtain a first product parameter; obtain a second difference between a preset parameter and the preset deformation parameter; multiply model parameters of the target model obtained after the i-th iteration by the second difference, to obtain a second product parameter; and take a sum of the first product parameter and the second product parameter as the model parameters of the dynamic model in the i+1-th iteration.

[0220] To sum up, the device provided in the embodiment provides a dynamic model by deforming the target candidate model, thereby providing a gradual training process from the source model to the target model and from the source model to the dynamic model, assisting in completing the training process from the source domain to the target domain, and stably adapting the gradual training process from the source model to the target model, so as to control the model training to smoothly transfer from the source domain to the target domain, that is, by increasing the transition of the dynamic model, the sample data is transitioned from the source domain to the target domain corresponding to the target model through the dynamic model, and the model training efficiency and accuracy are improved.

[0221] It should be noted that: the model training device provided in the above embodiment is only exemplified by the division of the above functional modules, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the model training device and the model training method provided in the above embodiment belong to the same concept, and the specific implementation process is described in detail in the method embodiment, which will not be repeated here.

[0222] Figure 10 The structure of the server provided in an example embodiment of the present application is shown. The server can be a server as shown in Figure 2 .

[0223] Specifically: the server 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The server 1000 further includes a mass storage device 1006 for storing an operating system 1013, application programs 1014 and other program modules 1015.

[0224] The mass storage device 1006 is connected to the central processing unit 1001 through a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1006 and its associated computer readable medium provide non-volatile storage for the server 1000. That is, the mass storage device 1006 can include a computer readable medium (not shown) such as a hard disk or a compact disc read only memory (CD-ROM) drive.

[0225] Without loss of generality, the computer readable medium can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other solid state memory technology, CD-ROM, Digital Versatile Disc (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. It should be understood by those skilled in the art that computer storage media does not limit to the above-mentioned several kinds. The system memory 1004 and the mass storage device 1006 mentioned above can be collectively referred to as memory.

[0226] According to various embodiments of the present application, the server 1000 can also run on a remote computer connected to the network through a network such as the Internet. That is, the server 1000 can be connected to the network 1012 through the network interface unit 1011 connected to the system bus 1005, or can be connected to other types of networks or remote computer systems (not shown) using the network interface unit 1011.

[0227] The above-mentioned memory further includes one or more programs, one or more programs are stored in the memory and are configured to be executed by the CPU.

[0228] Embodiments of the present application also provide a computer device, which can be implemented as a terminal or a server as shown in Figure 2 The computer device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the model training method provided by the above-mentioned method embodiments.

[0229] Embodiments of the present application also provide a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the model training method provided by the above-mentioned method embodiments.

[0230] Embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the model training methods described in the above embodiments.

[0231] Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drives (SSDs), or optical discs, etc. The random access memory may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). The sequence numbers of the embodiments in this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0232] 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.

[0233] The above description is merely an optional embodiment 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 comprises: obtaining sample data collected in a first field for training a target model, the sample data comprising sample images; predicting the sample data by a source model to output first pseudo labels, and predicting transformed sample data by a dynamic model to output second pseudo labels; the source model is a model pre-trained for data prediction in a second field, the dynamic model is a model transformed from a target candidate model to be trained, and the transformed sample data comprises transformed sample images obtained by image transformation on the sample images; predicting the sample data by the target candidate model to obtain sample prediction results, the sample prediction results comprising image segmentation results of the sample images; determining a loss value based on a first difference between the first pseudo labels and the sample prediction results, and a second difference between the second pseudo labels and the sample prediction results; iteratively training the target candidate model based on the loss value to obtain the target model, the target model being used for image segmentation of images in the first field.

2. The method of claim 1, wherein, The dynamic model is a model transformed from a target candidate model obtained in the i-th iteration; The iteratively training the target candidate model based on the loss value to obtain the target model comprises: training the target candidate model obtained in the i-th iteration based on a loss value in the (i+1)-th iteration to obtain the target candidate model after the (i+1)-th iteration, i being a positive integer; in response to the target candidate model meeting training requirements, determining the target candidate model as the target model.

3. The method of claim 2, wherein, The predicting the sample data by the source model to output first pseudo labels, and predicting transformed sample data by a dynamic model to output second pseudo labels comprises: predicting the sample data by the source model to output first pseudo labels, and predicting the transformed sample data by the dynamic model obtained in the i-th iteration to output the second pseudo labels; The predicting the sample data by the target candidate model to obtain sample prediction results comprises: predicting the sample data by the target candidate model obtained in the i-th iteration to obtain the sample prediction results in the i-th iteration.

4. The method according to any one of claims 1 to 3, characterized in that, The predicting the transformed sample data by the dynamic model to output second pseudo labels comprises: predicting the transformed sample data by the dynamic model to output second candidate pseudo labels; performing inverse transformation processing on the second candidate pseudo labels to obtain the second pseudo labels, the transformation mode of the inverse transformation processing being opposite to that of the transformed sample data.

5. The method according to any one of claims 1 to 3, characterized in that, The determining a loss value based on a first difference between the first pseudo labels and the sample prediction results, and a second difference between the second pseudo labels and the sample prediction results comprises: determining a first loss value between the first pseudo labels and the sample prediction results; determining a second loss value between the second pseudo labels and the sample prediction results; The first loss value and the second loss value are fused by weighting to obtain the loss value.

6. The method of claim 5, wherein, After the sample data is obtained, the method further includes: Performing discreteness analysis on output results of the sample data in the source model and the target candidate model to obtain a learning complexity corresponding to the sample data; Weighting the sample data based on the learning complexity to obtain a weight parameter; The first loss value and the second loss value are fused by weighting to obtain the loss value, including: The first loss value and the second loss value are fused by weighting based on the weight parameter to obtain the loss value.

7. The method of claim 6, wherein, The weighting of the sample data based on the learning complexity to obtain the weight parameter includes: Obtaining a ratio between a current iteration cycle order and a preset iteration cycle number; Obtaining a candidate weight parameter based on the ratio; Weighting the sample data based on the learning complexity and the candidate weight parameter to obtain the weight parameter.

8. A model training apparatus, comprising: The device includes: An acquisition module configured to acquire sample data, the sample data being data collected in a first field for training a target model, the sample data including sample images; A prediction module configured to predict the sample data by a source model to output first pseudo labels, and predict deformed sample data by a dynamic model to output second pseudo labels; the source model being a model pre-trained for data prediction in a second field, the dynamic model being a model deformed from the target candidate model to be trained, and the deformed sample data including deformed sample images obtained by image transformation on the sample images; The prediction module is further configured to predict the sample data by the target candidate model to obtain sample prediction results, the sample prediction results including image segmentation results of the sample images; A determination module configured to determine a loss value based on a first difference between the first pseudo labels and the sample prediction results, and a second difference between the second pseudo labels and the sample prediction results; A training module configured to iteratively train the target candidate model based on the loss value to obtain the target model, the target model being used for image segmentation of images in the first field.

9. A computer device, comprising: The computer device includes a processor and a memory, the memory storing at least one program, the at least one program being loaded and executed by the processor to implement the model training method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The storage medium stores at least one program, the at least one program being loaded and executed by the processor to implement the model training method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Pedestrian identity re-identification method and device, electronic equipment and storage medium

    CN112861695A