Self-adaptive model training method and device and terminal equipment
Through the adaptive model training method, the initial training model is used to update the classification weight, which solves the prediction problem of cross-domain data, improves the clustering and generalization capabilities of the model, reduces the cost of data labeling, and is suitable for medical image analysis and other fields.
Patent Information
- Application Number
- CN202411034529.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-11-22
AI Technical Summary
In practical applications, training data and sample data often come from the joint distribution of different environments, making it difficult for traditional supervised learning methods to effectively use existing training data for prediction. Especially in the fields of medical image analysis, data annotation is expensive, how to improve the data in Predictive model performance on sample data has become an important issue.
An adaptive model training method is proposed. By obtaining the initial training model of the target domain, using the classifier in the initial training model to classify the sample data, applying different sample processing strategies to calculate the classification loss, and updating the classification weight until a predetermined one is detected Until the number of times is adjusted, the target training model of the target domain is obtained, and the clustering and generalization capabilities of the model are improved.
This method can more effectively use the initial training model to update classification weights, improve the clustering and generalization capabilities of the target model, reduce the cost of data annotation, and is suitable for cross-domain classification tasks.
Smart Images

Figure CN119004236A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of cross-domain classification technology, and in particular, relates to a training method, apparatus and terminal device for an adaptive model. Background Art
[0002] In recent years, with the rapid development of information technology, machine learning has played an important role in people's daily lives. Supervised learning is one of the most mature and widely used branches of machine learning. Traditional supervised learning requires that both training data and sample data come from the same joint probability distribution. Under this condition, the model learned using labeled training data can make good predictions for unlabeled sample data. Unfortunately, this assumption is often not easy to hold in actual application problems, such as document classification, sentiment analysis, object recognition, remote sensing image classification, etc. In more cases, training data and sample data are collected in different environments (joint distribution). In order to train a good prediction model, the most direct approach is to collect and annotate a batch of training data in a test environment to replace the original training data.
[0003] However, re-collecting and labeling data often requires a high amount of time and manpower. For example, in the field of medical image analysis, requiring professional doctors to label medical images takes a lot of time and money. At this time, how to effectively use the existing training data to obtain a prediction model that performs well on sample data becomes a crucial issue. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus and terminal device for training an adaptive model, which can better realize the transfer of knowledge while improving the clustering ability and generalization ability of the target model.
[0005] In a first aspect, an embodiment of the present application provides a method for training an adaptive model, comprising:
[0006] Acquire an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights;
[0007] Using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets;
[0008] Using different sample processing strategies to perform sample classification processing on each sample set in multiple sample sets, and calculating the classification loss corresponding to each processed sample set;
[0009] Update the classification weight of the second classifier according to the classification loss corresponding to each processed sample set;
[0010] Return to the step of using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets, until it is detected that the second classifier in the initial training model is adjusted a predetermined number of times, and the initial training model is used as the target training model of the target domain.
[0011] In a second aspect, an embodiment of the present application provides a training device for an adaptive model, comprising:
[0012] An acquisition module is used to acquire an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights;
[0013] A classification module, used to classify the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets;
[0014] A processing module, used to perform sample classification processing on each sample set in the multiple sample sets by adopting different sample processing strategies, and calculate the classification loss corresponding to each processed sample set;
[0015] An updating module, used for updating the classification weight of the second classifier according to the classification loss corresponding to each processed sample set;
[0016] A determination module is used to return to the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, and the initial training model is used as the target training model of the target domain.
[0017] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any method of the first aspect when executing the computer program.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of any one of the first aspects is implemented.
[0019] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any one of the methods in the first aspect.
[0020] An adaptive model training method, apparatus and terminal device provided in an embodiment of the present application include: obtaining an initial training model of a target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights; using the first classifier and the second classifier in the initial training model to classify sample data in the sample data set to obtain multiple sample sets; using different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculating the classification loss corresponding to each processed sample set; updating the classification weight of the second classifier according to the classification loss corresponding to each processed sample set; returning to execute the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, and then using the initial training model as the target training model of the target domain. By using the above technical solution, the sample data in the sample data set is classified by using the initial training model to obtain multiple sample sets, and different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, and the classification loss corresponding to each processed sample set is calculated. The classification weight of the second classifier can be better updated, the training of the initial training model is completed to obtain the target training model of the target domain, and the clustering ability and generalization ability of the target model are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 It is a flowchart of a training method of an adaptive model provided in one embodiment of the present application;
[0023] Figure 2 is a flowchart of a training method for an adaptive model provided in another embodiment of the present application;
[0024] Figure 3 It is a schematic diagram of the overall process of a training method for an adaptive model provided in one embodiment of the present application;
[0025] Figure 4 is a dynamic schematic diagram of a sample data set provided by an embodiment of the present application;
[0026] Figure 5 This is a schematic diagram of a classification recognition effect provided by an embodiment of the present application;
[0027] Figure 6 This is another schematic diagram of the effect of classification recognition provided by an embodiment of the present application;
[0028] Figure 7 It is a structural block diagram of a training device for an adaptive model provided in one embodiment of the present application;
[0029] Figure 8 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0030] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0031] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0032] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0033] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0034] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0035] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0036] It is confirmed that deep neural networks (DNNs) have achieved multiple breakthroughs in visual recognition tasks. However, when DNN models are applied to domain transfer of unknown target domains, their performance degrades. To address this problem, various unsupervised domain adaptation (UDA) methods have been proposed, focusing on transferring knowledge from labeled source domains to unlabeled target domains. Most UDA techniques require access to unlabeled target domain data and labeled source domain data during the adaptation process, aiming to address the distribution gap and reduce the impact of domain transfer.
[0037] However, the application of UDA technology is limited in some practical scenarios with private source data or devices with limited computing power. Compared with UDA, Source-free Domain Adaptation (SFDA) is a more practical setting where the training model adapts to the target domain without access to the source data. But although previous work mainly focuses on clustering target domain samples in continuous training, it is still a challenge that more and more source domain knowledge is forgotten as the number of training times increases.
[0038] Meanwhile, in early studies, the Most Meaningful Difference (MMD) established a method based on the nearest neighbor classifier to find the subspace where the target center point moves and iteratively make it move smaller and smaller. Later, inspired by Heterogeneous Transfer Learning (HTL), the Source HypOthesis Transfer (SHOT) framework was proposed. It freezes the classifier of the source model and learns a target-specific feature extractor, which is achieved by information maximization and self-supervised pseudo-labels to align the features of the target domain with the source hypothesis in a hidden way. In fact, information maximization is to iteratively reduce the uncertainty of the prediction, which is similar to data-driven. In addition, the pseudo-labels are obtained by weighted k-means clustering and nearest neighbor classifiers. Later, SHOT was further extended with a new label transfer strategy, called SHOT++. It divides the target data into two parts according to the confidence of the prediction, and then improves the accuracy of the prediction with lower confidence in the target domain through semi-supervised learning.
[0039] On the basis of following SHOT, progressive knowledge distillation (KD) and mixed parameter Mixup technology can be introduced, adaptive batch normalization is used to update the target data, and then pseudo labels are generated through deep transfer clustering. In addition, the target set can be divided into clean and noisy parts, and stable training is performed using the exponential momentum averaging method (EMA). G-SFDA (Generalized-Source-free Domain Adaptation) is a generalized SFDA method that unifies local structure clustering and sparse domains. The former uses local neighborhood information in the feature space to cluster each target instance with its nearest neighbors to achieve self-supervised adaptation, while the latter aims to maintain the information of the source domain by regularizing the back-propagated gradient.
[0040] In addition, existing techniques propose semantic constraints hidden in the local geometry of individual data to encourage robust clustering of the target domain; introduce semantic credibility constraints in new geometries; and exploit the intrinsic neighborhood structure by defining local affinities of target data to encourage consistency between class and neighborhood affinities.
[0041] In addition to addressing the fundamental challenges of SFDA, there are also works that focus on other specific SFDA scenarios. U-SFDA is a two-stage learning framework for addressing the general passive domain adaptation problem. In the initial stage, it equips the future passive deployment model with an artificially generated negative dataset. This motivates the generation of a well-classified tight source cluster. In the deployment stage, it defines the passive domain adaptation target by leveraging the source similarity metric. To address the multi-source data-free adaptation problem, the target labels of all source models are weighted combined using information maximization and clustering-based pseudo-labeling strategies. Based on the existing research on SHOT, a new problem is proposed, namely, unsupervised robust domain adaptation in a passive setting. Similarly, SHOT can be extended to Transformer-based networks, and a self-distilled SFDA framework with EMA is proposed to transfer cluster label knowledge to the target network. Different from existing methods that focus on the training stage, it focuses on the testing stage for domain generalization, which uses unlabeled target data to calculate a pseudo-prototype representation for each category, and then classifies each sample based on its distance to the pseudo-prototype.
[0042] However, although previous works mainly focus on clustering target domain samples with continuous training, they still suffer from the problem that as the number of training times increases, more and more source domain knowledge is forgotten and the sample discrimination ability of source style decreases.
[0043] Based on this, this embodiment proposes a training method for an adaptive model, which can divide samples into cluster cores and response scatter points, and proposes a new hierarchical clustering and separation technology, which uses the cluster cores generated by the earlier split samples to attract response scatter points; it also proposes a separation method for these response scatter points, which can effectively divide samples of different categories, etc.
[0044] Figure 1 It is a flowchart of a training method for an adaptive model provided in one embodiment of the present application. As an example but not a limitation, the method can be applied to a terminal device.
[0045] The training method of the adaptive model provided in the embodiment of the present application can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific type of terminal devices.
[0046] S101. Obtain an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights.
[0047] The initial training model may refer to a model initially corresponding to the target domain, and the initial training model may be further trained and learned to obtain a corresponding target training model, wherein the initial training model may be obtained by initializing the source domain model based on a sample data set of the target domain, and the initial training model may include a first classifier and a second classifier with different classification weights, that is, the classification weights of the first classifier and the second classifier may be different. Exemplarily, the first classifier may be a classifier corresponding to the source domain model, and the second classifier may be a classifier obtained by preliminary learning based on the sample data set of the target domain on the basis of the first classifier, or the classification weights of the first classifier and the second classifier may both be classifiers obtained by learning and training based on the classifier corresponding to the source domain model, and they differ only in classification weights.
[0048] The initial training model may further include a feature extractor for extracting feature data of each sample data; the sample data set may be a data set of the target domain, which is used to continuously train the initial training model to obtain a target training model.
[0049] The source domain model can be a model trained by the server side based on the source domain data set, which can be used to identify various styles of the source domain. The purpose of this embodiment is to migrate the source domain model from the source domain to the target domain through transfer learning, using only the sample data set of the target domain, so as to be used for the recognition of various styles of the target domain.
[0050] This embodiment does not limit the method of obtaining the initial training model of the target domain. For example, the terminal device itself may initialize the source domain model based on the sample data set of the target domain and obtain it. Alternatively, other devices may initialize the source domain model based on the sample data set of the target domain and send it to the terminal device. In this way, the terminal device can directly obtain the initial training model from other devices. This embodiment does not limit this.
[0051] S102: using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets.
[0052] In this embodiment, the classification weights of the first classifier and the second classifier are different, so the principles of classifying the same data set are different, and the classification results obtained are also different. Therefore, this embodiment can classify the sample data set according to the first classifier and the second classifier to obtain multiple sample sets, and the sample data in each sample set has the same characteristics. For example, the multiple sample sets may include a core sample set, a neighbor sample set, and a confusion sample set. The sample data set may also be divided into other types of data sets, etc., which can be determined according to the actual configuration.
[0053] After obtaining the initial training model of the target domain, the first classifier and the second classifier in the initial training model can be used to classify each sample data in the sample data set to obtain multiple sample sets. The specific classification process is not limited. For example, the classification parameters of each sample data can be calculated to achieve classification of the sample data, or classification can be achieved by identifying certain fields in the sample data, etc. This embodiment will not be further elaborated on this.
[0054] S103 , respectively adopting different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculating the classification loss corresponding to each processed sample set.
[0055] The classification loss may refer to the loss corresponding to the classification processing of multiple sample sets. The loss types corresponding to different classification processing may be different. For example, the classification loss corresponding to the centralized processing of the core sample set may be the cross entropy loss.
[0056] After multiple sample sets are obtained through classification, this step can use different sample processing strategies for each sample set to perform sample classification processing, so as to calculate the classification loss corresponding to each processed sample set, so as to perform subsequent updates. The content of the specific sample processing strategy and the calculation of the classification loss can be configured by relevant personnel according to the actual situation of the sample set. The specific content is not limited here, as long as the corresponding classification loss can be calculated.
[0057] S104: Update the classification weight of the second classifier according to the classification loss corresponding to each processed sample set.
[0058] S105, return to the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the second classifier in the initial training model is adjusted a predetermined number of times, and the initial training model is used as the target training model of the target domain.
[0059] After obtaining the classification loss corresponding to each processed sample set through the above steps, the initial training model can be adjusted according to the total loss, such as updating the classification weight of the second classifier, or updating the feature extractor contained in the initial training model at the same time, so as to implement one training of the initial training model, and then return to execute the step of using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets, and continue to further train the initial training model to better meet the needs of the target domain, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, then the current training can be considered to be completed, and the final initial training model can be used as the target training model of the target domain. Among them, the predetermined number of times can be used to determine when to end the training of the initial training model, and the specific value can be determined by relevant personnel based on experience.
[0060] The present embodiment provides a training method for an adaptive model, which obtains an initial training model of a target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights; the first classifier and the second classifier in the initial training model are used to classify sample data in the sample data set to obtain multiple sample sets; different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, and the classification loss corresponding to each processed sample set is calculated; the classification weight of the second classifier is updated according to the classification loss corresponding to each processed sample set; the step of returning to execute the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, and the initial training model is used as the target training model of the target domain. Using this method, by using the initial training model to classify the sample data in the sample data set to obtain multiple sample sets, and using different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculating the classification loss corresponding to each processed sample set, the classification weight of the second classifier can be better updated, the training of the initial training model is completed to obtain the target training model of the target domain, and the clustering ability and generalization ability of the target model are improved.
[0061] In some embodiments, obtaining an initial training model of the target domain includes:
[0062] Obtain a sample data set of the target domain and a source domain model, where the source domain model includes a first classifier;
[0063] Using a first classifier to classify sample data in the sample data set to obtain at least two sample sets;
[0064] Using different sample processing strategies to perform sample classification processing on each sample set in at least two sample sets, and calculating the classification loss corresponding to each processed sample set;
[0065] According to the classification loss corresponding to each processed sample set, the classification weight of the first classifier is modified to obtain the second classifier;
[0066] The source domain model is adjusted based on the first classifier and the second classifier to obtain an initial training model of the target domain.
[0067] In a specific implementation, the initial training model may be a model obtained by initializing the source domain model based on the sample data set of the target domain on the terminal device side. For example, a sample data set and a source domain model of the target domain may be obtained, and the sample data set may be classified using the first classifier in the source domain model to obtain at least two sample sets. Different sample processing strategies may be used to preliminarily calculate the corresponding classification loss, thereby correcting the classification weight of the first classifier and obtaining the second classifier. Thus, the source domain model may be adjusted based on the first classifier and the corrected second classifier to obtain the initial training model of the target domain.
[0068] Figure 2 It is a flow chart of a training method of an adaptive model provided by another embodiment of the present application. In this embodiment, multiple sample sets include: a core sample set, a neighbor sample set and a confusion sample set. The first classifier is a fixed weight classifier, and the second classifier is a target classifier whose classification weight is updated according to the classification loss in the training process. The first classifier and the second classifier in the initial training model are used to classify the sample data in the sample data set, and the multiple sample sets are further optimized as follows: for each sample data in the sample data set, the core classification parameter of each sample data is calculated using the fixed weight classifier; for each sample data in the sample data set, the confusion classification parameter of each sample data is calculated using the target classifier; if the core classification parameter of the target sample data is a core preset parameter, the target sample data is classified into the core sample set; if the confusion classification parameter of the target sample data is a confusion preset parameter, and the confusion classification parameter of the target sample data is a core preset parameter, the target sample data is classified into the neighbor sample set; if the core classification parameter of the target sample data is a confusion preset parameter, and the confusion classification parameter of the target sample data is a confusion preset parameter, the target sample data is classified into the confusion sample set, and the target sample data is any sample data in the sample data set.
[0069] like Figure 2As shown, the method includes:
[0070] S201. Obtain an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights, wherein the first classifier is a fixed weight classifier, and the second classifier is a target classifier whose classification weight is updated according to the classification loss in the training process.
[0071] S202: For each sample data in the sample data set, use a fixed weight classifier to calculate the core classification parameters of each sample data.
[0072] S203: For each sample data in the sample data set, use the target classifier to calculate the confusion classification parameter of each sample data.
[0073] The core classification parameters can be understood as parameters used to determine whether to classify sample data into the core sample set, and the confusion classification parameters can be understood as parameters used to determine whether to classify sample data into the confusion sample set. The specific calculation method is not limited here; the confusion classification parameters and the core classification parameters can be used in combination to classify sample data. For example, the sample data can be comprehensively judged to which sample set it belongs based on the core classification parameters and confusion classification parameters actually corresponding to the sample data.
[0074] In some embodiments, for each sample data in the sample data set, a fixed weight classifier is used to calculate the core classification parameter of each sample data, including:
[0075] For each sample data in the sample data set, extract feature data of each sample data;
[0076] Determine at least one first category probability corresponding to each sample data according to the fixed weight classifier and the feature data, where the first category probability is used to characterize the probability that each sample data determined according to the fixed weight classifier belongs to the candidate category;
[0077] Calculate the first category probability difference and the maximum first category probability corresponding to each sample data, where the first category probability difference is the difference between two first category probabilities that meet a preset probability condition in at least one first category probability;
[0078] The core classification parameters of each sample data are determined based on the first category probability difference and the maximum first category probability.
[0079] Among them, the first category probability can be used to characterize the probability that each sample data determined by the fixed weight classifier belongs to the candidate category. Since there is at least one candidate category, the number of specific first category probabilities can be one or more; when the number of first category probabilities is multiple, the first category probability difference can be considered as the difference between two first category probabilities that meet the preset probability conditions in at least one first category probability. The content of the preset probability condition is not limited, such as the first category probability exceeding the set probability value, or it can be the first category probability with a larger probability value in at least one first category probability, such as the maximum first category probability and / or the second largest first category probability. In the specific implementation process, at least one first category probability can be arranged in order from large to small, the maximum first category probability is the first category probability ranked first in the sorting result, and the second largest first category probability is the first category probability ranked second in the sorting result.
[0080] Specifically, for each sample data in the sample data set, feature data of each sample data can be extracted by a feature extractor, and then at least one first category probability corresponding to each sample data can be determined based on a fixed weight classifier. The first category probability difference and the maximum first category probability corresponding to each sample data can be calculated according to the specific numerical value of at least one first category probability. Finally, the corresponding core classification parameters can be determined by the size of the first category probability difference and the maximum first category probability. For example, the corresponding core classification parameters can be obtained by respectively comparing the values of the first category probability difference and the maximum first category probability, or by performing a series of calculations to determine the core classification parameters.
[0081] In some embodiments, for each sample data in the sample data set, using the target classifier to calculate the confusion classification parameter of each sample data includes:
[0082] For each sample data in the sample data set, extract feature data of each sample data;
[0083] Determine at least one second category probability corresponding to each sample data according to the target classifier and the feature data, where the second category probability is used to characterize the probability that each sample data determined according to the target classifier belongs to the candidate category;
[0084] Calculate the second category probability difference corresponding to each sample data, where the second category probability difference is the difference between two second category probabilities that meet a preset probability condition in at least one second category probability;
[0085] The confusion classification parameter of each sample data is determined based on the second category probability difference.
[0086] Among them, the second category probability can be used to characterize the probability that each sample data determined by the target classifier belongs to the candidate category; similar to the first category probability, the number of second category probabilities can be one or more. When the number of second category probabilities is multiple, the calculation method of the second category probability difference can refer to the first category probability difference.
[0087] Specifically, for each sample data in the sample data set, feature data of each sample data can be extracted by a feature extractor, and then at least one second category probability corresponding to each sample data can be determined, and the second category probability difference corresponding to each sample data can be calculated according to the specific numerical value of at least one second category probability. Finally, the corresponding confusion classification parameter can be determined by the size of the second category probability difference. For example, the corresponding confusion classification parameter can be obtained by comparing the numerical values of the second category probability difference, or by performing a series of calculations to determine the confusion classification parameter.
[0088] For example, an unlabeled target domain dataset can be defined and its samples N. Then, the model is parameterized by θ, which consists of two components, namely the feature extractor and the classifier. The feature extractor lets f θ :x i →z i ∈R k , where k is the dimension of the feature space and is represented as a k-dimensional feature; the classifier is an unbiased linear network with a normalization layer, so that c θ :z i →y i ∈R n , where n represents the number of prediction categories and y is the predicted output.
[0089] First, we can describe the two-step segmentation process. At the beginning of training, the source classifier is introduced, and depending on whether the weight changes in the subsequent process, it is set as two classifiers with the same weight, that is, the fixed weight classifier C fix and the target classifier C. In the first step of segmentation, a fixed weight classifier is used to segment all samples into cluster cores (i.e., core samples) and response scatters.
[0090] Specifically, the probability of the first category can be p1(x)=C fix (f θ (x)), normalized category probability σ1(x) = softmax(p1(x)); the first category probability difference K(p) = TopK(p,0)-TopK(p,1).
[0091] The core difference threshold is The maximum probability threshold is
[0092] By comparing the first category probability difference with the core difference threshold, the maximum first category probability with the maximum probability threshold, the core classification parameters corresponding to each target domain data can be determined.
[0093] Among them, TopK(·,k) can represent the top k values of the predicted category probability output, TopK(p,0) and is the maximum probability of the first category, TopK(p,1) is the second maximum probability of the first category, λ1 can be the first hyperparameter of the segmentation, which determines the segmentation ratio; N is the total number of sample data. That is, when Category1 i =1, the i-th sample will be assigned to the cluster core; otherwise, it will be a response scatter point.
[0094] Then, for Category1 i = 0, use the target classifier to further divide them into two categories: confusion points (i.e., confusion samples) and neighbor points (i.e., neighbor samples), and the probability of the second category is p2(x) = C(f θ (x)), confusion difference threshold The confusion classification parameter can be determined by comparing the second category probability difference with the confusion difference threshold Among them, λ2 represents the second hyperparameter used to determine the split ratio. That is, when Category2 i = 1, the i-th sample will be set as a neighbor scatter point; otherwise it will be set as a chaotic scatter point.
[0095] S204: If the core classification parameter of the target sample data is a core preset parameter, classify the target sample data into a core sample set.
[0096] S205: If the core classification parameter of the target sample data is a confusion preset parameter, and the confusion classification parameter of the target sample data is a core preset parameter, classify the target sample data into a neighbor sample set.
[0097] S206: If the core classification parameter of the target sample data is a confusion preset parameter and the confusion classification parameter of the target sample data is a confusion preset parameter, the target sample data is classified into a confusion sample set, and the target sample data is any sample data in the sample data set.
[0098] The target sample data may be any sample data in the sample data set, and the core preset parameter and the obfuscation preset parameter may be preset values. Optionally, the core preset parameter may be 1, and the obfuscation preset parameter may be 0.
[0099] After obtaining the core classification parameters and confusion classification parameters of each sample data through the above steps, classification can be performed according to specific values. For example, the sample data can be further classified into the corresponding sample set by determining whether the core classification parameters and confusion classification parameters are the core preset parameters and confusion preset parameters.
[0100] In a specific implementation, if the core classification parameter Category1 of the target sample data i is i =1, the target sample data i can be classified into the core sample set; if the core classification parameter Category1 of the target sample data i i = 0 and confuses the classification parameter Category2 i =1, then the target sample data i can be classified into the neighbor sample set; if the core classification parameter Category1 of the target sample data i i = 0 and confuses the classification parameter Category2 i =0, then the target sample data i can be classified into the confusion sample set.
[0101] S207 , respectively adopting different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculating the classification loss corresponding to each processed sample set.
[0102] S208: Update the classification weight of the target classifier according to the classification loss corresponding to each processed sample set.
[0103] S209, return to execute the step of calculating the core classification parameters of each sample data using a fixed weight classifier for each sample data in the sample data set, until it is detected that the adjustment of the target classifier in the initial training model reaches a predetermined number of times, and the initial training model is used as the target training model of the target domain.
[0104] This embodiment provides an adaptive model training method, which calculates the core classification parameters and confusion classification parameters of each sample data using a fixed weight classifier and a target classifier respectively, classifies the sample data set into multiple sample sets, improves the classification accuracy, and provides an accurate data basis for subsequent training of the initial training model.
[0105] In some embodiments, different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, including:
[0106] For each core sample in the core sample set, calculate the pseudo label of each core sample;
[0107] Each core sample is centralized according to its pseudo-label.
[0108] For different sample sets, this solution can adopt different strategies to perform sample classification processing. In this embodiment, a clustering strategy is proposed to concentrate core samples and disperse neighbor samples to the core samples according to the distances between multiple samples.
[0109] First, we can simply focus on the core samples and use the cross entropy loss to determine the cluster center, and the class probability p(x) = c θ (f θ (x)), Among them, B is the core sample set in the same batch; Y i Denotes the predicted pseudo label of the i-th core sample, and the predicted maximum likelihood classification is used as its pseudo label. In the pre-training stage, this cross entropy loss is used to train the source model, where B is replaced with all source domain samples. This cross entropy loss can quickly aggregate the core of each class, thereby greatly reducing the subsequent clustering cost.
[0110] In some embodiments, different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, including:
[0111] For each neighbor sample in the neighbor sample set, calculate the core sample distance between each neighbor sample and each core sample in the core sample set;
[0112] According to the distances of each core sample corresponding to each neighbor sample, it is determined whether to adjust each neighbor sample to the core sample set.
[0113] In a specific implementation, the prediction of the core sample can be used for self-supervision during training, and the neighbor samples can be guided by the distance value. The calculation of this process can be as follows:
[0114]
[0115] Among them, σ(·) represents the softmax function, D KL (·) is the Kullback-Leibler divergence function, and R represents the neighbor samples in the same training batch.
[0116] Because L ce and L dis are two stages of clustering, so they are both designed to minimize intra-class variance. We combine these losses into L clu =L dis +αL ce, where α is a hyperparameter used to adjust the offset of similar samples. The clustering strategy proposed in this embodiment can cluster the entire sample quickly and effectively, but its effect on some samples in the confusion area is still limited. In the following section, this problem can be solved from the perspective of sample refinement.
[0117] In some embodiments, different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, including:
[0118] For each confused sample in the confused sample set, a confused sample distance between each confused sample and at least one adjacent sample is calculated, where the at least one adjacent sample is a confused sample or a neighboring sample adjacent to each confused sample;
[0119] According to the distances of the confused samples corresponding to each confused sample, it is determined whether to adjust each confused sample to the neighbor sample set.
[0120] In a specific implementation, the characteristic data of all sample data is G=[f θ (x 0 ),f θ (x 1 ),...,f θ (x i )] T , i∈N, the normalized category probability of all sample data is S=[σ(p(x 0 )),σ(p(x 1 )),...,σ(p(x i ))] T ,i∈N.
[0121] Furthermore, for the set of confused samples, the pairwise feature similarity pseudo-labels of the response scatter points in the mini-batch can be used, and the Kullback-Leibler divergence can be used to establish pairwise attraction between the confused scatter points (i.e., confused samples) and other scatter points (such as confused samples or neighboring samples). The calculation formula can be:
[0122]
[0123] Among them, F is the set of confused scattered points in the mini-batch (i.e., the set of confused samples), S F is the storage bank of the current batch; G Fis a confusion scatter feature library and is part of G; sim(α,β,φ) is the cosine similarity between α and β, and its output is the index of the first φ samples similar to α; φ represents a hyperparameter used to determine whether the confusion scatter points are affected by the number of neighbors. For example, in the proposed strategy, the confused scatterers can be attracted by the neighbor samples, and their attraction can be determined by the feature similarity distance (i.e., the confusion sample distance).
[0124] Figure 3 FIG. 1 is a schematic diagram of the overall process of a training method for an adaptive model provided in an embodiment of the present application. Figure 3 As shown, in the initial training stage, the target model can be a source domain model. By using the target domain samples to perform the first training on the source domain model, the parameters of the source domain model can be initialized to obtain the initial training model of the target domain. The initial training model can include a fixed weight classifier and a dynamic target classifier with different classification weights.
[0125] The fixed weight classifier can be responsible for dividing the target domain samples into core samples and non-core samples (including neighbor samples and confused samples). On the one hand, the cluster core can be made more compact by establishing a label aggregation mechanism, so as to calculate the cross entropy loss L ce On the other hand, a clustering strategy can be designed to attract response scattering to the cluster core and calculate the classification loss L dis Because L ce and L dis are two stages of clustering, so they are both designed to minimize intra-class differences. These losses can be combined into L clu =L dis +αL ce .
[0126] At the same time, the target classifier can be responsible for applying different learning losses to identify the confused boundary samples by calculating and selecting samples from these three categories. As shown in the right figure, the calculation module can receive the input of the confused sample and find similar non-core samples from the feature repository for pairing, so as to calculate the classification loss L sep .
[0127] In addition, a contrastive learning method is introduced to increase prediction diversity and discriminability to address the domain shift problem, which maximizes the nuclear norm loss in the classification response matrix, which can be expressed as L cl =P T P-diag(P T P), where diag(·) represents a diagonal matrix function and P represents the classification prediction of samples in a small batch. On this basis, contrastive learning can avoid model prediction degradation.
[0128] Finally, the total loss corresponding to one training process can be L total =L clu +L sep +L cl , which is used to update the classification weights of the dynamic target classifier in the initial training model.
[0129] Figure 4 is a dynamic schematic diagram of a sample data set provided by an embodiment of the present application, such as Figure 4 As shown in Fig. 1, we can first use the source discriminator (i.e., fixed weight classifier) and the dynamic target discriminator (i.e., target classifier) to Figure 4 The target domain samples (i.e., target data set) in (a) are classified to obtain core samples, neighbor samples, and confusion samples. For example, the segmentation mechanism can initially divide the target domain samples into two groups through the source discriminator. The classification results include selected edge samples (i.e., core boundary samples or core samples) and unselected edge samples. Then, the segmentation mechanism further divides the unselected edge samples into two groups, i.e., neighbor samples and confusion samples (i.e., confusion boundary samples). Subsequently, a cohesion strategy can be adopted for the selected edge samples, and an aggregation strategy can be adopted for the neighbor samples based on the selected edge samples, such as Figure 4 (b) and Figure 4 As shown in (c) in .
[0130] At the same time, for Figure 4 The confuse boundary samples (i.e., samples with dashed edges) shown in (d) can be solved as follows Figure 4 The distance-based sample separation strategy is used in (g) to obtain Figure 4 (e) in Figure 4 The result in (e) shows that the confused domains are completely separated. Finally, the dynamic object discriminator can be updated according to the clustering loss to promote cross-domain clustering feature alignment, as Figure 4 As shown in (f) in .
[0131] In the specific implementation steps, it can be carried out on four datasets, including Office, Office-Home, VisDA and DomainNet. The Office dataset is a commonly used domain adaptation dataset, consisting of 31 categories in three domains: Dslr (D), Webcam (W) and Amazon (a).
[0132] In the experiment, all 6 pairs of domain scenes were completed; Office-Home is a widely used domain adaptation dataset, which contains 4 domains with 65 categories, including Real(R), Clipart(C), Art(a), Product(P). There are 12 adaptation scenarios, which need to overcome domain gaps of different sizes; VisDA is a large benchmark dataset for domain adaptation tasks, which poses a greater challenge from 12 categories from synthetic to real; DomainNet is a large domain adaptation dataset, which has more categories than previous datasets, consisting of 126 categories in 4 domains, including Real(R), Clipart(C), Painting(P) and Sketch(S). Based on other datasets frequently used for evaluation, 7 adaptation scenarios can be further established.
[0133] In this work, the focus of this embodiment is mainly on solving the SFDA problem. Therefore, some related SFDA methods can be compared with the ME-SFDA method using all 4 datasets, and the SSDA of ME-SSDA in 1-shot and 3-shot scenarios is verified using the Office and Office-Home datasets.
[0134] In all experiments, this embodiment can select ResNet as the backbone of SFDA and SSDA to initialize the feature encoder, where ResNet-50 can be used for Office, Office-Home and DomainNet; ResNet-101 is used for VisDA. After SHOT, batch normalization is applied after the bottleneck layer to reduce the shift of the internal dataset, the weight norm technique is used on the classifier, and the fully connected layer is replaced with a 256-dimensional bottleneck layer and a task-specific fully connected classification layer.
[0135] To initialize the source model, the ImageNet pre-trained weights can be used. Exemplarily, in the experiment, this embodiment can use the SGD optimizer, and set the weight decay to 0.0005, the momentum to 0.9, the feature layer learning rate to 0.0001, and the learning rate of other layers to 0.001. The hyperparameter scaling in Eq. (3.16) is set to 3, and the parameter value of the hyperparameter is 1.0. The settings of the hyperparameter λ1 in Eq. (3.3) and the hyperparameter λ2 in Eq. (3.6) need to be changed according to the size of the data set, and are generally set to about 1.0 and 1.6, respectively. In SSDA, the labeled samples are distributed as evenly as possible to each small batch, and the hyperparameters are kept basically the same as the hyperparameters used by SFDA during training.
[0136] In addition, this embodiment further conducts all experiments based on the GeForce RTX4090 GPU.
[0137] The following are the comparative results of each experiment, wherein Table 1 is as follows:
[0138]
[0139] Table 1 shows the performance of the Office-Home dataset using the ResNet-50 backbone under the SFDA(√) and SSDA(x) settings. The best performing methods in the corresponding fields are highlighted in bold. (1 / 3) indicates the 1 / 3 labeled target domain samples used in SSDA.
[0140] Table 2
[0141]
[0142] Among them, Table 2 can be considered as the performance comparison of the Office dataset using the ResNet-50 backbone network under the SFDA (√) and SSDA (x) settings. The best performing methods in the corresponding fields are highlighted in bold, and (1 / 3) can be understood as the target domain samples labeled 1 / 3 times used in SSDA.
[0143] Table 3
[0144] Method R→C R→P P→C C→S S→P R→S P→R Mean SHOT 67.7 68.4 66.9 60.1 66.1 59.9 80.8 67.1 AdaContrast 70.2 69.8 68.6 58 65.9 61.5 80.5 67.8 C-SFDA 70.8 71.1 68.5 62.1 67.4 62.7 80.4 69 GPUE 74.2 70.4 68.8 64 67.5 65.7 76.5 69.6 ME-SFDA 71.6 70.4 72.6 63 69.7 60.5 84.2 70.3
[0145] Table 3 shows the performance of the DomainNet dataset in the SFDA setting using the ResNet-50 backbone. The best performing methods in the corresponding fields are highlighted in bold.
[0146] Table 4
[0147]
[0148] Table 4 shows the performance of the VisDA dataset in the SFDA setting using the ResNet-101 backbone. The best performing methods in the corresponding fields are highlighted in bold.
[0149] Furthermore, this embodiment can also provide a visual display.
[0150] Figure 5 is a schematic diagram of a classification recognition effect provided by an embodiment of the present application, such as Figure 5As shown in the figure, the results of classifying the same target sample set using three models (i.e., source domain model, GPUE, and target training model provided in this embodiment). Among them, the ResNet-50 backbone network and SFDA setting are used to use all classes from A to R on Office-Home. Each point in the figure represents a target sample, and different color depths represent the true classification of the sample. Figure 5 (a) and Figure 5 In (b), the source model and GPUE embedding space have the highest accuracy of 75.0% and 78.0% respectively. Figure 5 In (c), the target training model provided in this embodiment achieves a best accuracy of 82.9% in its embedding space.
[0151] Figure 6 This is another schematic diagram of the effect of classification recognition provided by an embodiment of the present application. Figure 6 As shown in the figure, the results of classifying the same target sample set using two models (i.e., the ProML model and the target training model provided in this embodiment). Among them, the ResNet-50 backbone network and the 3-shot SSDA setting are used on Office-Home to use all classes from A to R. Each point in the figure represents a target sample, and different colors represent the true classification of the sample. Figure 6 In (a), the embedding space of the ProML model achieves the best accuracy of 82.4%. Figure 6 In (b), the target training model (ie, ME-SSDA) provided in this embodiment achieves the best accuracy of 84.7% in its embedding space.
[0152] The feature representations at different training stages in the SFDA task are visualized by using the nonlinear dimensionality reduction method t-SNE (t-Distributed Stochastic Neighbor Embedding). This means that the model trained using the ME-SFDA method proposed in this embodiment can produce highly discriminative target features, which helps to improve the performance of SSDA and SFDA tasks. This further proves that the method has good clustering and generalization capabilities.
[0153] It can be found from the above description that the training method of the adaptive model provided in this embodiment can be called the novel SFDA method of ME-SFDA, which can enhance similar knowledge aggregation and improve learning efficiency based on exploratory learning of marginal adaptation and sample attraction. Specifically, by using the similarity between edge samples at the decision boundary, different strategies are used for the two diagonal boundary samples to aggregate similar samples into samples with the largest inter-domain difference. Unlike the existing SFDA method, ME-SFDA does not attract each other as adjacent samples, but designs a two-step segmentation strategy to divide samples into three strategies representing different levels of knowledge value. For example, by designing a reliable edge sample partitioning module, the samples are divided into cluster cores and response scatter points. Then a new hierarchical clustering and separation technique is proposed, which uses the cluster core generated by the earlier split sample to attract the response scatter points. The purpose of this is to make the maximum difference boundary with other classes more compact; a label aggregation mechanism is established to make the cluster core more compact.
[0154] Secondly, in order to effectively divide samples of different categories, a distance-based boundary separation strategy is proposed to divide the response scatter into confusion scatter and neighbor scatter. The confusion scatter points usually do not change much in the clustering strategy because they are usually far away from the clustering cores of two different domains.
[0155] In addition, a nuclear norm loss is introduced to encourage clear cluster assignments and avoid extractor degradation. In this work, the semi-supervised domain adaptation (SSDA) problem is also discussed to verify the generality of the method, which utilizes some labeled target domain samples based on UDA. Extensive experiments on four standard benchmark datasets (i.e., Office, Office-Home, VisDA, and DomainNet) show that the method of this embodiment outperforms the previous state-of-the-art SFDA method.
[0156] In summary, the training method of the adaptive model provided in this embodiment proposes a new SFDA method ME-SFDA, which separates samples in the confusion domain without abandoning misleading samples and clusters the samples to the classifier boundary with the largest inter-domain difference. This method is robust for improving the aggregation of similar knowledge and improving process efficiency.
[0157] At the same time, a new two-step segmentation mechanism is designed to divide samples into cluster cores and response points, and further divide response points into confusion points and adjacent points. For different refined sample types, the proposed method adopts an exclusive strategy to support the method of this embodiment.
[0158] Finally, extensive experiments are conducted to verify the effectiveness of the proposed method on DomainNet, VisDA, Office and Office-home datasets. The results show that ME-SFDA achieves state-of-the-art performance on the main SFDA benchmark; ME-SSDA, extended from ME-SFDA, also achieves new state-of-the-art performance on the challenging Office and Office-home datasets.
[0159] Corresponding to the training method of the adaptive model in the above embodiment, Figure 7 This is a structural block diagram of an adaptive model training device provided in one embodiment of the present application. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0160] Reference Figure 7 , the device comprises:
[0161] An acquisition module 301 is used to acquire an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights;
[0162] A classification module 302, configured to classify the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets;
[0163] The processing module 303 is used to perform sample classification processing on each sample set in the multiple sample sets by using different sample processing strategies, and calculate the classification loss corresponding to each processed sample set;
[0164] An updating module 304, configured to update the classification weight of the second classifier according to the classification loss corresponding to each processed sample set;
[0165] Determine module 305, which is used to return to the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, and then use the initial training model as the target training model of the target domain.
[0166] The present embodiment provides a training device for an adaptive model, which obtains an initial training model of a target domain through an acquisition module, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights; the classification module adopts the first classifier and the second classifier in the initial training model to classify sample data in the sample data set to obtain multiple sample sets; the processing module adopts different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculates the classification loss corresponding to each processed sample set; the updating module updates the classification weight of the second classifier according to the classification loss corresponding to each processed sample set; the determination module returns to execute the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the adjustment of the second classifier in the initial training model reaches a predetermined number of times, and the initial training model is used as the target training model of the target domain. By using the device, the sample data in the sample data set is classified by using the initial training model to obtain multiple sample sets, and different sample processing strategies are used to perform sample classification processing on each sample set in the multiple sample sets, and the classification loss corresponding to each processed sample set is calculated. The classification weight of the second classifier can be better updated, the training of the initial training model is completed to obtain the target training model of the target domain, and the clustering ability and generalization ability of the target model are improved.
[0167] Optionally, the multiple sample sets include: a core sample set, a neighbor sample set, and a confusion sample set, the first classifier is a fixed weight classifier, and the second classifier is a target classifier whose classification weight is updated according to the classification loss in the training process;
[0168] The classification modules include:
[0169] A core calculation unit, used for calculating the core classification parameters of each sample data in the sample data set by using a fixed weight classifier;
[0170] A confusion calculation unit, used for calculating the confusion classification parameter of each sample data using the target classifier for each sample data in the sample data set;
[0171] A first classification unit, configured to classify the target sample data into a core sample set if the core classification parameter of the target sample data is a core preset parameter;
[0172] A second classification unit, configured to classify the target sample data into a neighbor sample set if the core classification parameter of the target sample data is a confusion preset parameter and the confusion classification parameter of the target sample data is a core preset parameter;
[0173] The third classification unit is used to classify the target sample data into a confused sample set if the core classification parameter of the target sample data is a confused preset parameter and the confused classification parameter of the target sample data is a confused preset parameter, and the target sample data is any sample data in the sample data set.
[0174] Optionally, the processing module is specifically used for:
[0175] For each core sample in the core sample set, calculate the pseudo label of each core sample;
[0176] Each core sample is centralized according to its pseudo-label.
[0177] Optionally, the processing module is specifically used for:
[0178] For each neighbor sample in the neighbor sample set, calculate the core sample distance between each neighbor sample and each core sample in the core sample set;
[0179] According to the distances of each core sample corresponding to each neighbor sample, it is determined whether to adjust each neighbor sample to the core sample set.
[0180] Optionally, the processing module is specifically used for:
[0181] For each confused sample in the confused sample set, a confused sample distance between each confused sample and at least one adjacent sample is calculated, where the at least one adjacent sample is a confused sample or a neighboring sample adjacent to each confused sample;
[0182] According to the distances of the confused samples corresponding to each confused sample, it is determined whether to adjust each confused sample to the neighbor sample set.
[0183] Optionally, the core computing unit is specifically used for:
[0184] For each sample data in the sample data set, extract feature data of each sample data;
[0185] Determine at least one first category probability corresponding to each sample data according to the fixed weight classifier and the feature data, where the first category probability is used to characterize the probability that each sample data determined according to the fixed weight classifier belongs to the candidate category;
[0186] Calculate the first category probability difference and the maximum first category probability corresponding to each sample data, where the first category probability difference is the difference between two first category probabilities that meet a preset probability condition in at least one first category probability;
[0187] The core classification parameters of each sample data are determined based on the first category probability difference and the maximum first category probability.
[0188] Optionally, the obfuscation calculation unit is specifically used for:
[0189] For each sample data in the sample data set, extract feature data of each sample data;
[0190] Determine at least one second category probability corresponding to each sample data according to the target classifier and the feature data, where the second category probability is used to characterize the probability that each sample data determined according to the target classifier belongs to the candidate category;
[0191] Calculate the second category probability difference corresponding to each sample data, where the second category probability difference is the difference between two second category probabilities that meet a preset probability condition in at least one second category probability;
[0192] The confusion classification parameter of each sample data is determined based on the second category probability difference.
[0193] Optionally, the acquisition module is specifically used to:
[0194] Obtain a sample data set of the target domain and a source domain model, where the source domain model includes a first classifier;
[0195] Using a first classifier to classify sample data in the sample data set to obtain at least two sample sets;
[0196] Using different sample processing strategies to perform sample classification processing on each sample set in at least two sample sets, and calculating the classification loss corresponding to each processed sample set;
[0197] According to the classification loss corresponding to each processed sample set, the classification weight of the first classifier is modified to obtain the second classifier;
[0198] The source domain model is adjusted based on the first classifier and the second classifier to obtain an initial training model of the target domain.
[0199] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0200] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0201] The present application also provides a terminal device, Figure 8 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application, such as Figure 8 As shown, the terminal device includes: at least one processor 401, a memory 402, an input device 403, an output device 404, and a computer program stored in the memory 402 and executable on at least one processor 401. When the processor 401 executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
[0202] The input device 403 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the terminal device. The output device 404 may include a display device such as a display screen.
[0203] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by the processor 401, the steps in the above-mentioned method embodiments can be implemented.
[0204] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0205] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can be executed by the processor 401. The steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device that can carry the computer program code to the device / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0206] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0207] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0208] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0209] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0210] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A training method for an adaptive model, characterized in that: include: Acquire an initial training model of the target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier with different classification weights; Using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets; Using different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets, and calculating the classification loss corresponding to each processed sample set; updating the classification weight of the second classifier according to the classification loss corresponding to each processed sample set; Return to the step of using the first classifier and the second classifier in the initial training model to classify the sample data in the sample data set to obtain multiple sample sets, until it is detected that the second classifier in the initial training model is adjusted a predetermined number of times, and then use the initial training model as the target training model of the target domain.
2. The training method of the adaptive model according to claim 1, characterized in that: The multiple sample sets include: a core sample set, a neighbor sample set and a confusion sample set, the first classifier is a fixed weight classifier, and the second classifier is a target classifier whose classification weight is updated according to the classification loss in the training process; The first classifier and the second classifier in the initial training model are used to classify the sample data in the sample data set to obtain multiple sample sets, including: For each sample data in the sample data set, using the fixed weight classifier to calculate the core classification parameter of each sample data; For each sample data in the sample data set, using the target classifier to calculate the confusion classification parameter of each sample data; If the core classification parameter of the target sample data is a core preset parameter, classifying the target sample data into a core sample set; If the core classification parameter of the target sample data is a confusion preset parameter, and the confusion classification parameter of the target sample data is a core preset parameter, classifying the target sample data into a neighbor sample set; If the core classification parameter of the target sample data is a confusion preset parameter and the confusion classification parameter of the target sample data is a confusion preset parameter, the target sample data is classified into a confusion sample set, and the target sample data is any sample data in the sample data set.
3. The training method of the adaptive model according to claim 2, characterized in that: The adopting different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets includes: For each core sample in the core sample set, calculating a pseudo label of each core sample; Each of the core samples is centrally processed according to the pseudo label of each of the core samples.
4. The method for training an adaptive model as claimed in claim 2, characterized in that: The adopting different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets includes: For each neighbor sample in the neighbor sample set, calculating the core sample distance between each neighbor sample and each core sample in the core sample set; According to the distances of the core samples corresponding to each of the neighbor samples, it is determined whether to adjust each of the neighbor samples to the core sample set.
5. The method for training an adaptive model as claimed in claim 2, characterized in that: The adopting different sample processing strategies to perform sample classification processing on each sample set in the multiple sample sets includes: For each confused sample in the confused sample set, calculating a confused sample distance between each confused sample and at least one adjacent sample, where the at least one adjacent sample is a confused sample or a neighboring sample adjacent to each confused sample; According to each confused sample distance corresponding to each confused sample, it is determined whether to adjust each confused sample to the neighbor sample set.
6. The method for training an adaptive model as claimed in claim 2, characterized in that: The step of calculating the core classification parameter of each sample data in the sample data set by using the fixed weight classifier includes: For each sample data in the sample data set, extract feature data of each sample data; Determine, according to the fixed weight classifier and the feature data, at least one first category probability corresponding to each of the sample data, wherein the first category probability is used to characterize the probability that each of the sample data determined according to the fixed weight classifier belongs to a candidate category; Calculating a first category probability difference value and a maximum first category probability corresponding to each of the sample data, wherein the first category probability difference value is a difference between two first category probabilities that meet a preset probability condition in the at least one first category probability; The core classification parameter of each of the sample data is determined based on the first category probability difference and the maximum first category probability.
7. The training method of the adaptive model according to claim 2, characterized in that: The step of calculating the confusion classification parameter of each sample data in the sample data set by using the target classifier includes: For each sample data in the sample data set, extract feature data of each sample data; Determine, according to the second classifier and the feature data, at least one second category probability corresponding to each of the sample data, wherein the second category probability is used to characterize the probability that each of the sample data determined according to the fixed weight classifier belongs to a candidate category; Calculating a second category probability difference corresponding to each sample data, where the second category probability difference is a difference between two second category probabilities that meet a preset probability condition in the at least one second category probability; A confusion classification parameter for each of the sample data is determined based on the second category probability difference.
8. The method for training an adaptive model according to claim 1, wherein: The obtaining of the initial training model of the target domain includes: Acquire a sample data set of a target domain and a source domain model, wherein the source domain model includes a first classifier; Using the first classifier to classify the sample data in the sample data set to obtain at least two sample sets; Using different sample processing strategies to classify each sample set in the at least two sample sets, and calculating the classification loss corresponding to each processed sample set; According to the classification loss corresponding to each processed sample set, the classification weight of the first classifier is modified to obtain a second classifier; The source domain model is adjusted based on the first classifier and the second classifier to obtain an initial training model of the target domain.
9. A training device for an adaptive model, characterized in that: include: An acquisition module, configured to acquire an initial training model of a target domain, wherein the initial training model is obtained by initializing a source domain model based on a sample data set of the target domain, and the initial training model includes a first classifier and a second classifier having different classification weights; A classification module, used to classify the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets; A processing module, used to perform sample classification processing on each sample set in the multiple sample sets by adopting different sample processing strategies respectively, and calculate the classification loss corresponding to each processed sample set; An updating module, used for updating the classification weight of the second classifier according to the classification loss corresponding to each processed sample set; A determination module is used to return to the step of classifying the sample data in the sample data set using the first classifier and the second classifier in the initial training model to obtain multiple sample sets, until it is detected that the second classifier in the initial training model is adjusted a predetermined number of times, and the initial training model is used as the target training model of the target domain.
10. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Domain-adaptive image recognition and classification method in passive continuous scene, storage medium and electronic equipment
CN120088538A
A domain adaptation image recognition classification method in a passive continuous scene, a storage medium and an electronic device
CN120088538B
