Model migration method, device, equipment and medium based on trust and consistency
Through a model migration method based on trust and consistency, convolutional neural networks and dual classification networks are used to perform adaptive learning on unlabeled target domain data, which solves the model migration and adaptability problems caused by the lack of source domain data, significantly Improved the model's adaptive ability on target domain data.
Patent Information
- Application Number
- CN202210023290.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-10
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-01-10
AI Technical Summary
Existing unsupervised domain adaptation methods are difficult to effectively transfer knowledge and improve the adaptability of the model when the source domain data is missing. Especially when there is a significant difference between the target domain data and the source domain data, the transferability and adaptability of the model will be difficult. Restricted.
Adopt a model migration method based on trust and consistency, use convolutional neural networks and dual classification networks to perform feature extraction and label prediction through preset labeled source domain data, and perform model adaptation on unlabeled target domain data Learn, use trust and consistency mechanisms to optimize the model, generate pseudo labels and trustworthy samples for training, and improve the adaptive ability of the model.
It significantly improves the adaptability of the model on target domain data, can effectively transfer the knowledge of source domain data and adapt to the unique information distribution of the target domain, improving the performance of unsupervised learning.
Smart Images

Figure CN114528913B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a trust and consistency-based model migration method, device, equipment and medium. Background Art
[0002] At present, artificial intelligence technology based on deep learning often encounters the problem of performance degradation caused by information offset in practical applications, that is, the information distribution of the target data of the actual application and the source domain data of the model training is inconsistent. In order to solve this problem, academia and industry have studied the unsupervised domain adaptation (UDA) method, which aims to transfer the knowledge of the source domain data to the learning process of the target domain data. The methods in related technologies basically assume that in this domain adaptation learning process, the model can access a large amount of labeled source domain data, so the labeled source domain data and unlabeled target domain data are used for model training at the same time, and the final model is tested on the unlabeled target domain data.
[0003] Unsupervised domain adaptation methods in related technologies can be roughly divided into three categories: difference-based, reconstruction-based, and adversarial-based. Difference-based methods aim to optimize the evaluation function used to measure the difference between the distribution of source domain data and target domain data. Some popular works include Maximum Mean Discrepancy (MMD), high-order central moment difference, contrastive domain difference, and Wasserstein metric. Reconstruction-based methods usually introduce auxiliary reconstruction tasks to achieve shared representation of the two domains. Domain-specific reconstruction and cycle consistency are further proposed to improve the adaptation performance. Adversarial-based methods use generative adversarial networks to optimize the distance between different data distributions.
[0004] Although these methods are effective, they all assume that labeled source data is accessible during domain adaptation. However, in practical applications, this assumption cannot always be met due to data privacy or limited resources. For example, a lot of industrial data, such as medical diagnosis records, product defects, and user behavior information, are usually limited to internal maintenance. In addition, on terminal devices (such as cameras), storage and computing resources are usually very limited, which also brings great difficulties to big data access and model training.
[0005] In other words, migration and adaptability are the two key issues that need to be addressed in domain adaptation. Migration requires that the trained model can transfer the knowledge of the source domain data to the target domain in the learning process to the maximum extent, while adaptability aims to enable the model to perceive the unique information distribution of the target domain data and to flexibly adjust its own parameters to achieve the learning goal of the unique information. However, in the existing unsupervised domain adaptation methods that are independent of the source domain data, most methods aim to narrow the distance between the source domain information distribution and the target domain information distribution, thereby enhancing the migration of the model. In actual applications, there are obvious differences between the target domain data and the source domain data in terms of texture, color, and even background. Simply narrowing the distance between the target domain and the source domain will weaken the model's ability to learn the target domain's unique information and reduce the model's adaptability. Summary of the invention
[0006] The present application provides a trust-and-consistency-based model migration method, apparatus, device, and medium to solve the domain adaptation problem in the absence of source domain data, that is, given a source domain model and unlabeled target domain data, target domain adaptive learning is performed through a model migration method, thereby achieving unsupervised learning and significantly improving the model's adaptability.
[0007] The first aspect of the present application provides a model migration method based on trust and consistency, comprising the following steps:
[0008] Based on the preset labeled source domain data, a convolutional neural network is used as a feature extractor to extract the features of the source domain image.
[0009] Using a source domain classification layer to perform label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight normalization layer, and a cross entropy loss function is used for training optimization to obtain the pre-trained source domain model; and
[0010] Based on the pre-trained source domain model and unlabeled target domain data, a dual classification network is used to perform model adaptive learning, and a trust and consistency-based mechanism is used to perform training optimization to obtain a source domain model after adaptive learning.
[0011] Optionally, the use of a trust and consistency mechanism to perform training optimization to obtain a source domain model after adaptive learning includes:
[0012] When performing model migration on the target domain data, samples in the target domain data are input into the model to obtain a probability distribution;
[0013] Select the label with the highest probability as the pseudo label of the corresponding sample, and use entropy to measure the model's trust in the pseudo label;
[0014] All samples in the target domain data are sorted from small to large according to the entropy generated by the trust degree to obtain trusted samples, and the network is trained using the trusted samples and corresponding pseudo labels to obtain the adaptively learned source domain model.
[0015] Optionally, before using the even classification network to perform model adaptive learning, the method further includes:
[0016] The dual classification network is constructed, wherein the dual classification network includes a feature extractor and a dual classification head. During the training process, the parameters of the source classifier are fixed, and the feature extractor and the target classifier are updated by stochastic gradient descent.
[0017] Optionally, the using a trust and consistency mechanism to perform training optimization includes:
[0018] Extracting features of unlabeled samples in the target domain data, and obtaining a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier;
[0019] Based on the first distribution prediction result and the second distribution prediction result, the information entropy of the model prediction distribution is calculated to obtain the credibility of the model prediction.
[0020] Optionally, the using a trust and consistency mechanism to perform training optimization includes:
[0021] Randomly rotating the trusted sample by a preset angle to obtain a new trusted sample;
[0022] Inputting the trusted sample and the new trusted sample into the dual classification network to obtain features and predicted distribution results of the trusted sample and the new trusted sample respectively;
[0023] Using a preset loss function to make the features and probability distribution of the trusted sample and the new trusted sample consistent;
[0024] The preset classification layer is used to predict the rotation angle of the new trusted sample relative to the trusted sample, and the prediction loss of the rotation angle is calculated.
[0025] The second aspect of the present application provides a model migration device based on trust and consistency, including:
[0026] The extraction module is used to extract features of the source domain image based on the preset labeled source domain data using a convolutional neural network as a feature extractor;
[0027] an optimization module, configured to use a source domain classification layer to perform label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight normalization layer, and to use a cross entropy loss function for training optimization to obtain the pre-trained source domain model; and
[0028] The acquisition module is used to perform model adaptive learning using a dual classification network based on the pre-trained source domain model and unlabeled target domain data, and to perform training optimization using a trust and consistency mechanism to obtain a source domain model after adaptive learning.
[0029] Optionally, the optimization module is specifically used to:
[0030] When performing model migration on the target domain data, samples in the target domain data are input into the model to obtain a probability distribution;
[0031] Select the label with the highest probability as the pseudo label of the corresponding sample, and use entropy to measure the model's trust in the pseudo label;
[0032] All samples in the target domain data are sorted from small to large according to the entropy generated by the trust degree to obtain trusted samples, and the network is trained using the trusted samples and corresponding pseudo labels to obtain the adaptively learned source domain model.
[0033] Optionally, before using the dual classification network to perform model adaptive learning, the acquisition module is further used to:
[0034] The dual classification network is constructed, wherein the dual classification network includes a feature extractor and a dual classification head. During the training process, the parameters of the source classifier are fixed, and the feature extractor and the target classifier are updated by stochastic gradient descent.
[0035] Optionally, the optimization module is specifically used to:
[0036] Extracting features of unlabeled samples in the target domain data, and obtaining a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier;
[0037] Based on the first distribution prediction result and the second distribution prediction result, the information entropy of the model prediction distribution is calculated to obtain the credibility of the model prediction.
[0038] Optionally, the optimization module is specifically used to:
[0039] Randomly rotating the trusted sample by a preset angle to obtain a new trusted sample;
[0040] Inputting the trusted sample and the new trusted sample into the dual classification network to obtain features and predicted distribution results of the trusted sample and the new trusted sample respectively;
[0041] Using a preset loss function to make the features and probability distribution of the trusted sample and the new trusted sample consistent;
[0042] The preset classification layer is used to predict the rotation angle of the new trusted sample relative to the trusted sample, and the prediction loss of the rotation angle is calculated.
[0043] The third aspect of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the trust and consistency-based model migration method as described in the above embodiment.
[0044] The fourth aspect of the present application provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the trust and consistency-based model migration method as described in the above embodiments.
[0045] Therefore, in this method, based on the preset labeled source domain data, a convolutional neural network can be used as a feature extractor to extract the features of the source domain image, and a source domain classification layer can be used for label prediction, and the cross entropy loss function can be used for training optimization to obtain a pre-trained source domain model, and based on the pre-trained source domain model and unlabeled target domain data, a dual classification network can be used for model adaptive learning, and training optimization can be performed using a trust and consistency mechanism to obtain a source domain model after adaptive learning. In this way, the problem of domain adaptation in the absence of source domain data is solved, that is, given a source domain model and unlabeled target domain data, the target domain adaptive learning is performed through the model transfer method, thereby achieving unsupervised learning and significantly improving the adaptability of the model.
[0046] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0048] Figure 1 A flowchart of a model migration method based on trust and consistency provided according to an embodiment of the present application;
[0049] Figure 2An example diagram of a dual classification network framework according to an embodiment of the present application;
[0050] Figure 3 A schematic diagram of performance comparison on a VisDA dataset according to an embodiment of the present application;
[0051] Figure 4 is an example diagram of a model migration device based on trust and consistency according to an embodiment of the present application;
[0052] Figure 5 is an exemplary diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0053] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0054] The following describes the trust and consistency-based model migration method, device, equipment and medium of the embodiment of the present application with reference to the accompanying drawings. In view of the domain adaptation problem mentioned in the background technology center in the case of missing source domain data, the present application provides a model migration method based on trust and consistency. In this method, based on the preset labeled source domain data, a convolutional neural network can be used as a feature extractor to propose features of the source domain image, and a source domain classification layer can be used for label prediction, and a cross entropy loss function is used for training optimization to obtain a pre-trained source domain model, and based on the pre-trained source domain model and unlabeled target domain data, a dual classification network is used for model adaptive learning, and training optimization is performed using a trust and consistency mechanism to obtain a source domain model after adaptive learning. In this way, the domain adaptation problem in the case of missing source domain data is solved, that is, given a source domain model and unlabeled target domain data, the target domain adaptive learning is performed by the model migration method, thereby achieving unsupervised learning and significantly improving the adaptability of the model.
[0055] Specifically, Figure 1 A flowchart of a model migration method based on trust and consistency provided in an embodiment of the present application.
[0056] like Figure 1 As shown, the trust and consistency-based model migration method includes the following steps:
[0057] In step S101, based on preset labeled source domain data, a convolutional neural network is used as a feature extractor to extract features of the source domain image.
[0058] In step S102, a source domain classification layer is used for label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight normalization layer, and a cross entropy loss function is used for training optimization to obtain a pre-trained source domain model.
[0059] Specifically, the embodiment of the present application can be given a labeled source domain dataset and label set Y, for the sampled samples { s ,y s},in y s ∈Y, first build a neural network model θ s ={f s ,h s}, where f s is a feature extractor, using a convolutional neural network pre-trained on ImageNet to initialize f s Parameters, h s is a classifier, randomly initialized. During training, use f s Extract x s The features of h are then used s It is classified, and the output of the classifier is p s (x s )=h s (f s (x s )). Finally, the model θ is trained using cross entropy loss s :
[0060]
[0061] in, Represents sample x s The label is y s The probability P(y s |x s ), here is the output p of the classifier s (x s ) belongs to y s The probability value of . In step S103, based on the pre-trained source domain model and the unlabeled target domain data, the dual classification network is used to perform model adaptive learning, and the trust and consistency mechanism is used to perform training optimization to obtain the adaptively learned source domain model.
[0062] Among them, the structural diagram of the dual classification network can be shown as follows Figure 2 As shown by Figure 2It can be seen that the dual classification network can use a convolutional neural network as a feature extractor, and then use a dual classification head to classify the extracted features, where the dual classification head contains two different classification layers, each of which has a fully connected layer and a weight normalization layer. When the dual classification network is initialized, the feature extractor parameters of the source domain model are used to initialize the feature extractor parameters of the dual classification network, and the source domain classification layer parameters of the source domain model are used to initialize a classification layer of the dual classification head in the dual classification network, which is called the source classifier of the dual classification network. The other classification layer is initialized with a random floating point value, which is called the target classifier of the dual classification network. In the process of model migration on the target domain data, the parameters of the source classifier are not updated, while the parameters of the target classifier are updated using stochastic gradient descent.
[0063] Optionally, in some embodiments, before using the dual classification network for model adaptive learning, it also includes: constructing a dual classification network, wherein the dual classification network includes a feature extractor and a dual classification head, and during the training process, the parameters of the source classifier are fixed, while the feature extractor and the target classifier are updated by stochastic gradient descent.
[0064] It should be understood that the dual classification network θ constructed in the embodiment of the present application t Including feature extractor f t , and a dual classification head. The parameters of the feature extractor are initialized using the feature extractor of the model pre-trained on the source domain, i.e., f t =f s The dual classification head contains two classification layers, namely the source domain classification layer h′ s and the target domain classification layer h t , where the parameters of the source domain classification layer are initialized by the classification layer of the model pre-trained on the source domain, i.e. h′ s =h s , and the target domain classification layer h t Initialized by random values. The final dual classification network constructed is θ t ={f t ,h s ,h t During training, we fix the parameter h of the source classifier s , feature extractor f t and the target classifier h t Updated via stochastic gradient descent.
[0065] Optionally, in some embodiments, training optimization is performed based on a trust and consistency mechanism to obtain a source domain model after adaptive learning, including: when performing model migration on target domain data, samples in the target domain data are input into the model to obtain a probability distribution; the label with the maximum probability is selected as the pseudo-label of the corresponding sample, and entropy is used to measure the model's trust in the pseudo-label; all samples in the target domain data are sorted from small to large according to the entropy generated by the trust level to obtain trusted samples, and the network is trained using the trusted samples and the corresponding pseudo-labels to obtain the source domain model after adaptive learning.
[0066] Optionally, in some embodiments, training optimization is performed using a trust and consistency mechanism, including: extracting features of unlabeled samples in the target domain data, and obtaining a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier; based on the first distribution prediction result and the second distribution prediction result, calculating the information entropy of the model prediction distribution to obtain the credibility of the model prediction.
[0067] Specifically, during the training process, for the unlabeled samples in the target domain In this embodiment of the present application, a feature extractor f can be used t Extract sample x t The features are then input into two classifiers h s and h t In this paper, two distribution prediction results are obtained, namely p s (x t )=h s (f t (x t )) and p t (x s )=h t (f s (x t )). Next, the information entropy of the model prediction distribution is calculated to represent the credibility of the model prediction, which are:
[0068]
[0069]
[0070] in, Represents sample x t The label is y t The probability P(y t |x t ), here is the classifier h s The output p s (x t ) belongs to y t The probability value of It also represents the sample x t The label is y t The probability P(y t |x t ), but here is the classifier h t The output p t (x t ) belongs to y t The probability value of .
[0071] Furthermore, for any sample The embodiment of the present application can obtain its prediction credibility, where the classifier h is used t The calculated credibility, H t (x t Then, we sort the credibility from small to large and select the samples in the top r% to form the credible sample set. For any trusted sample The output of the model is and We use the label with the maximum probability value as its pseudo label y t ',Right now:
[0072]
[0073] You can also use The experimental results show that there is little difference between the two.
[0074] Finally, the present embodiment may only use samples in the trusted sample set. And the obtained pseudo label y t 'To calculate the loss value of the two classifiers:
[0075]
[0076]
[0077] in, Representation sample The label is y t The probability of Here is the classifier h s Output The above belongs to y t ′, similarly, Also means sample The label is y t The probability of But here is the classifier h t Output The above belongs to y t ′ is the probability value. is the expectation function.
[0078] Optionally, in some embodiments, training optimization is performed based on a trust and consistency mechanism, including: randomly rotating a trusted sample by a preset angle to obtain a new trusted sample; inputting the trusted sample and the new trusted sample into a dual classification network to obtain features and predicted distribution results of the trusted sample and the new trusted sample, respectively; using a preset loss function to keep the features and probability distribution of the trusted sample and the new trusted sample consistent; using a preset classification layer to predict the rotation angle of the new trusted sample relative to the trusted sample, and calculating the prediction loss of the rotation angle.
[0079] Specifically, the embodiment of the present application can use a self-supervisory approach to enhance feature learning. We get another version of it by randomly rotating it by a certain angle The angle can be any number among 0, 90, 180 and 270 degrees. Then, we will and Input into the dual classification network to obtain their respective features and And the predicted distribution results and Next, we use the following loss function to force and The features extracted by the model are consistent with the probability distribution:
[0080]
[0081]
[0082] in yes A rotated version of another image in Negative example, and yes A positive example. Representation sample The label is y t The probability of Here is the classifier h s Output The above belongs to y t ′, similarly, Also means sample The label is y t The probability of But here is the classifier h t Output The above belongs to yt ′ is the probability value. is the expectation function.
[0083] In addition, the present embodiment may use an additional classification layer h r To predict Relative to The rotation angle of the classification layer h r The predictive distribution of is: Where [a, b] means connecting two vectors together to form a new vector. Then calculate the relative rotation angle prediction loss:
[0084]
[0085] Among them, y r Is the relative rotation angle, one of 0-3, corresponding to 0 degrees, 90 degrees, 180 degrees and 270 degrees respectively. is the classifier h r Output The above belongs to y r The probability value of .
[0086] Furthermore, in order for the model to output a confident probability distribution, for any sample We calculate the maximum information entropy loss function:
[0087]
[0088]
[0089] The sum function adds all the elements of the vector. Finally, by integrating all loss functions and introducing a balance factor to adjust the gradient of each loss function:
[0090]
[0091] In summary, the trust and consistency-based model transfer method of the embodiment of the present application adopts a dual classification network, introduces a trust and consistency mechanism to train and optimize the dual classification network, wherein the basic framework of the model transfer method includes two stages: model pre-training on the source domain and model adaptive learning on the target domain, wherein:
[0092] The model pre-training on the source domain is as follows: given labeled source domain data, a convolutional neural network is used as a feature extractor to extract features of the source domain image, and then a source domain classification layer is used for label prediction, where the source domain classification layer consists of a fully connected layer and a weight normalization layer; the cross entropy loss function is used for training optimization to obtain the source domain model.
[0093] Model adaptive learning on the target domain is as follows: given a pre-trained source domain model and unlabeled target domain data, a dual classification network is used for model adaptive learning, and training optimization is performed using a trust and consistency-based mechanism.
[0094] The trust-based optimization mechanism is as follows: when migrating the model on the target domain data, we first input the target domain sample into the model to obtain the probability distribution, and then select the label with the maximum probability as the pseudo label of the sample. In addition, entropy is used to measure the model's trust in the pseudo label. The smaller the entropy, the more the model trusts the label. We sort all target samples from small to large according to entropy, select the first 80% of samples as trustworthy samples, and then use these samples and their pseudo labels to train the network.
[0095] The specific consistency-based optimization mechanism is as follows: for each image sample in the target domain, we randomly rotate an angle, which can be any number among 0, 90, 180 and 270 degrees, to obtain another image. The two images present the same information from different angles, but the features and probability distributions obtained after the dual classification network are different. Therefore, the embodiment of the present application uses contrast loss to shorten the feature distance between the two images, and uses cross entropy loss to shorten the probability distribution of the two images, to ensure that the two images maintain consistency in features and prediction results.
[0096] Therefore, the model migration method based on trust and consistency in the embodiment of the present application can not only enhance the migration and adaptability of the model, but also be of great help to the feature representation learning of the sample. Figure 3 It can be seen that the embodiments of the present application can significantly improve the performance of unsupervised domain adaptation that is independent of source domain data. On the commonly used VisDA standard evaluation set, compared with the leading method SHOT, the performance can be improved by 2.0% under the same conditions. Even compared with SHOT++ which uses an additional training method, this application also has a 0.2% improvement, which fully proves its effectiveness.
[0097] According to the trust and consistency-based model migration method proposed in the embodiment of the present application, based on the preset labeled source domain data, a convolutional neural network can be used as a feature extractor to extract features of the source domain image, and a source domain classification layer can be used for label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight norm layer, and a cross entropy loss function is used for training optimization to obtain a pre-trained source domain model, and based on the pre-trained source domain model and unlabeled target domain data, a dual classification network is used for model adaptive learning, and training optimization is performed using a trust and consistency mechanism to obtain a source domain model after adaptive learning. Thus, the domain adaptation problem in the case of missing source domain data is solved, that is, given a source domain model and unlabeled target domain data, the target domain adaptive learning is performed through the model migration method, thereby achieving unsupervised learning and significantly improving the adaptability of the model.
[0098] Next, a trust- and consistency-based model migration device proposed according to an embodiment of the present application is described with reference to the accompanying drawings.
[0099] Figure 4 It is a block diagram of a model migration device based on trust and consistency according to an embodiment of the present application.
[0100] like Figure 4 As shown, the trust and consistency-based model migration device 10 includes: an extraction module 100 , an optimization module 200 and an acquisition module 300 .
[0101] The extraction module 100 is used to extract features of the source domain image based on the preset labeled source domain data using a convolutional neural network as a feature extractor;
[0102] The optimization module 200 is used to use a source domain classification layer to perform label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight normalization layer, and a cross entropy loss function is used for training optimization to obtain a pre-trained source domain model; and
[0103] The acquisition module 300 is used to perform model adaptive learning based on the pre-trained source domain model and unlabeled target domain data using a dual classification network, and perform training optimization based on a trust and consistency mechanism to obtain a source domain model after adaptive learning.
[0104] Optionally, the optimization module 200 is specifically used for:
[0105] When performing model migration on target domain data, samples in the target domain data are input into the model to obtain a probability distribution;
[0106] Select the label with the highest probability as the pseudo label of the corresponding sample, and use entropy to measure the model's trust in the pseudo label;
[0107] According to the entropy generated by the degree of trust, all samples in the target domain data are sorted from small to large to obtain trusted samples, and the network is trained using the trusted samples and the corresponding pseudo labels to obtain the source domain model after adaptive learning.
[0108] Optionally, before using the dual classification network to perform model adaptive learning, the acquisition module 100 is further used to:
[0109] A dual classification network is constructed, where the dual classification network includes a feature extractor and a dual classification head. During the training process, the parameters of the source classifier are fixed, and the feature extractor and the target classifier are updated by stochastic gradient descent.
[0110] Optionally, the optimization module 200 is specifically used for:
[0111] Extracting features of unlabeled samples in the target domain data, and obtaining a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier;
[0112] Based on the first distribution prediction result and the second distribution prediction result, the information entropy of the model prediction distribution is calculated to obtain the credibility of the model prediction.
[0113] Optionally, the optimization module 200 is specifically used for:
[0114] Randomly rotate the trusted sample by a preset angle to obtain a new trusted sample;
[0115] Input the trusted samples and the new trusted samples into the dual classification network to obtain the features and predicted distribution results of the trusted samples and the new trusted samples respectively;
[0116] Use the preset loss function to make the features and probability distribution of the trusted samples and new trusted samples consistent;
[0117] The preset classification layer is used to predict the rotation angle of the new trusted sample relative to the trusted sample, and the prediction loss of the rotation angle is calculated.
[0118] It should be noted that the aforementioned explanation of the embodiment of the model migration method based on trust and consistency is also applicable to the model migration device based on trust and consistency of this embodiment, and will not be repeated here.
[0119] According to the model migration device based on trust and consistency proposed in the embodiment of the present application, based on the preset labeled source domain data, a convolutional neural network can be used as a feature extractor to extract features of the source domain image, and a source domain classification layer can be used for label prediction, wherein the source domain classification layer is composed of a fully connected layer and a weight norm layer, and a cross entropy loss function is used for training optimization to obtain a pre-trained source domain model, and based on the pre-trained source domain model and unlabeled target domain data, a dual classification network is used for model adaptive learning, and training optimization is performed using a trust and consistency mechanism to obtain a source domain model after adaptive learning. Thus, the problem of domain adaptation in the absence of source domain data is solved, that is, given a source domain model and unlabeled target domain data, the target domain adaptive learning is performed through the model migration method, thereby achieving unsupervised learning and significantly improving the adaptability of the model.
[0120] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device may include:
[0121] A memory 501 , a processor 502 , and a computer program stored in the memory 501 and executable on the processor 502 .
[0122] When the processor 502 executes the program, the trust-and-consistency-based model migration method provided in the above embodiment is implemented.
[0123] Furthermore, the electronic device further comprises:
[0124] The communication interface 503 is used for communication between the memory 501 and the processor 502 .
[0125] The memory 501 is used to store computer programs that can be executed on the processor 502 .
[0126] The memory 501 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0127] If the memory 501, the processor 502 and the communication interface 503 are implemented independently, the communication interface 503, the memory 501 and the processor 502 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0128] Optionally, in a specific implementation, if the memory 501, the processor 502 and the communication interface 503 are integrated on a chip, the memory 501, the processor 502 and the communication interface 503 can communicate with each other through an internal interface.
[0129] The processor 502 may be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0130] This embodiment also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned trust and consistency-based model migration method is implemented.
[0131] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0132] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0133] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0134] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or N wirings (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0135] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0136] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0137] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0138] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A model migration method based on trust and consistency, characterized in that: The following steps are involved: Based on the preset labeled source domain data, a convolutional neural network is used as a feature extractor to extract the features of the source domain image. Using a source domain classification layer for label prediction, where the source domain classification layer consists of a fully connected layer and a weight normalization layer, and is trained and optimized using a cross entropy loss function to obtain a pre-trained source domain model; and Based on the pre-trained source domain model and unlabeled target domain data, a dual classification network is used to perform model adaptive learning, and training optimization is performed using a trust and consistency mechanism to obtain a source domain model after adaptive learning; The method of using a trust and consistency mechanism to perform training optimization to obtain a source domain model after adaptive learning includes: when performing model migration on the target domain data, inputting samples in the target domain data into the model to obtain a probability distribution; selecting a label with the maximum probability as a pseudo label of the corresponding sample, and using entropy to measure the degree of trust of the model in the pseudo label; sorting all samples in the target domain data from small to large according to the entropy generated by the trust degree to obtain a trusted sample, and using the trusted sample and the corresponding pseudo label to train the network to obtain the source domain model after adaptive learning; Before using the dual classification network for model adaptive learning, the method further includes: constructing the dual classification network, wherein the dual classification network includes a feature extractor and a dual classification head, and during the training process, the parameters of the source classifier are fixed, while the feature extractor and the target classifier are updated by stochastic gradient descent; The use of the trust and consistency mechanism for training optimization includes: extracting features of unlabeled samples in the target domain data, obtaining a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier; based on the first distribution prediction result and the second distribution prediction result, calculating the information entropy of the model prediction distribution to obtain the credibility of the model prediction; The use of a trust and consistency mechanism-based training optimization includes: randomly rotating the trusted sample by a preset angle to obtain a new trusted sample; inputting the trusted sample and the new trusted sample into the dual classification network to obtain the features and predicted distribution results of the trusted sample and the new trusted sample, respectively; using a preset loss function to keep the features and probability distribution of the trusted sample and the new trusted sample consistent; using a preset classification layer to predict the rotation angle of the new trusted sample relative to the trusted sample, and calculating the prediction loss of the rotation angle.
2. A model migration device based on trust and consistency, characterized in that: include: The extraction module is used to extract features of the source domain image based on the preset labeled source domain data using a convolutional neural network as a feature extractor; An optimization module, for performing label prediction using a source domain classification layer, wherein the source domain classification layer is composed of a fully connected layer and a weight normalization layer, and is trained and optimized using a cross entropy loss function to obtain a pre-trained source domain model; and An acquisition module is used to perform model adaptive learning using a dual classification network based on the pre-trained source domain model and unlabeled target domain data, and to perform training optimization using a trust and consistency mechanism to obtain a source domain model after adaptive learning; The optimization module is specifically used to: when performing model migration on the target domain data, input samples in the target domain data into the model to obtain a probability distribution; select the label with the maximum probability as the pseudo label of the corresponding sample, and use entropy to measure the model's trust in the pseudo label; sort all samples in the target domain data from small to large according to the entropy generated by the trust level to obtain trusted samples, and use the trusted samples and the corresponding pseudo labels to train the network to obtain the source domain model after the adaptive learning; Before using the dual classification network for model adaptive learning, the acquisition module is further used to: construct the dual classification network, wherein the dual classification network includes a feature extractor and a dual classification head, and during the training process, the parameters of the source classifier are fixed, and the feature extractor and the target classifier are updated by stochastic gradient descent; The optimization module is specifically used to: extract features of unlabeled samples in the target domain data, obtain a first distribution prediction result and a second distribution prediction result based on a preset first classifier and a second classifier; based on the first distribution prediction result and the second distribution prediction result, calculate the information entropy of the model prediction distribution to obtain the credibility of the model prediction; The optimization module is specifically used to: randomly rotate the trusted sample by a preset angle to obtain a new trusted sample; input the trusted sample and the new trusted sample into the dual classification network to obtain the characteristics and predicted distribution results of the trusted sample and the new trusted sample respectively; use a preset loss function to make the characteristics and probability distribution of the trusted sample and the new trusted sample consistent; use a preset classification layer to predict the rotation angle of the new trusted sample relative to the trusted sample, and calculate the prediction loss of the rotation angle.
3. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the trust and consistency-based model migration method as claimed in claim 1.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the trust and consistency-based model migration method as claimed in claim 1.
Citation Information
Patent Citations
Cross-modal transfer learning method
CN113139664A
Image segmentation method and device, equipment and storage medium
CN113706551A
