A method and device for training a classification model of an adaptive out-of-domain dataset
By combining self-supervised and semi-supervised learning, and utilizing domain-invariant feature mining and pseudo-label training, the poor performance of traditional models on out-of-domain datasets is solved, achieving higher classification accuracy and feature extraction capabilities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LIGHT CONTROL TESILIAN (CHONGQING) INFORMATION TECH CO LTD
- Filing Date
- 2023-03-23
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional machine learning models cannot effectively adapt to real-world application scenarios when faced with data distribution shifts, small amounts of target domain data, or unlabeled data, resulting in poor performance.
A self-supervised learning pre-trained model is adopted, which combines invariant feature learning and semi-supervised learning algorithms. The pre-trained model is generated by self-supervised learning, and an out-of-domain dataset classification model is generated by domain invariant feature mining and UPS semi-supervised algorithm. The model is trained with pseudo-labels until the performance no longer improves.
It improves classification accuracy on out-of-domain datasets, makes full use of unlabeled data, simplifies the training process, and enhances the model's feature extraction and generalization capabilities.
Smart Images

Figure CN116468105B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of machine learning data processing, and more particularly to a method and apparatus for training a classification model on an adaptive out-of-domain dataset. Background Technology
[0002] Traditional machine learning typically assumes that the data used for model training and the test data used for deployment satisfy the condition of independence and identical distribution, forming a mainstream training paradigm called "pre-training-fine-tuning." The data used in the pre-training stage generally consists of mainstream large-scale public datasets. Taking classification tasks as an example, the mainstream training method is to first perform large-scale pre-training using the ImageNet dataset. However, ImageNet data cannot cover datasets in many specific real-world application scenarios, causing a distribution shift between the source domain data (pre-training data) and the target domain data (real-world application scenario data) (technically known as dataset shift). Due to differences in data distribution, the small amount of target domain data, and the lack of labels in the target domain data, the pre-trained model cannot be used directly or cannot achieve good performance through fine-tuning (e.g., low accuracy). Summary of the Invention
[0003] This disclosure provides a method and apparatus for training a classification model on an adaptive out-of-domain dataset.
[0004] According to a first aspect of this disclosure, a method for training a classification model on an adaptive out-of-domain dataset is provided. The method includes:
[0005] Based on the target domain dataset and the pre-training dataset, a self-supervised learning algorithm is used to pre-train the network model to generate a pre-trained model.
[0006] The training model containing the invariant feature learner is initialized based on the model parameters of the pre-trained model;
[0007] Based on the source domain dataset corresponding to the pre-trained dataset, a supervised learning algorithm is used to perform a second training on the initialized training model to generate a second training model.
[0008] Based on the target domain dataset and the source domain dataset, a semi-supervised learning algorithm is used to train the sub-training model to generate an out-of-domain dataset classification model.
[0009] Furthermore, the target domain dataset is an unlabeled dataset;
[0010] The source domain dataset is a labeled dataset;
[0011] The pre-training dataset is an unlabeled dataset, wherein the samples in the source domain dataset are the same as the samples in the pre-training dataset.
[0012] Furthermore, the process of initializing the training model containing the invariant feature learner based on the model parameters of the pre-trained model includes:
[0013] The training model is pre-built, and the pre-built training model includes a first network model and a second network model; wherein, the first network model includes a backbone model part, an invariant feature learner, and a classifier; the second network model includes a backbone model part and an invariant feature learner.
[0014] The backbone model of the pre-built training model is initialized according to the model parameters of the pre-trained model, while the remaining parts of the first network model and the second network model are randomly initialized.
[0015] Furthermore, the step of generating a secondary training model by performing secondary training on the initialized training model using a supervised learning algorithm based on the source domain dataset corresponding to the pre-training dataset includes:
[0016] The source domain dataset corresponding to the pre-trained dataset is input into the initialized training model to generate intra-domain invariant features and inter-domain invariant features, and the loss function values of the intra-domain invariant features and the inter-domain invariant features are calculated and determined based on the category prediction probability.
[0017] Based on the overall loss function value, the backpropagation gradient is calculated on the initialized training model, and the sub-training model is updated.
[0018] Furthermore, the process of training the sub-training model using a semi-supervised learning algorithm based on the target domain dataset and the source domain dataset to generate an out-of-domain dataset classification model includes:
[0019] Based on the pseudo-label allocation strategy of the semi-supervised learning algorithm, generate highly reliable positive or negative sample labels for some samples in the target domain data; merge the samples of the target domain dataset with pseudo-labels into the source domain dataset, train the classifier of the secondary training model until the test classification performance of the secondary training model no longer improves within a preset number of times, and complete the training to generate an out-of-domain dataset classification model.
[0020] According to a second aspect of this disclosure, an adaptive classification model training apparatus for out-of-domain datasets is provided, the apparatus comprising:
[0021] The pre-trained model generation module is used to pre-train the network model and generate a pre-trained model based on the target domain dataset and the pre-trained dataset using a self-supervised learning algorithm.
[0022] An initialization module is used to initialize a training model containing an invariant feature learner based on the model parameters of the pre-trained model.
[0023] The sub-training model generation module is used to generate a sub-training model by performing sub-training on the initialized training model based on the source domain dataset corresponding to the pre-training dataset and using a supervised learning algorithm.
[0024] The out-of-domain dataset classification model generation module is used to train the sub-training model using a semi-supervised learning algorithm based on the target domain dataset and the source domain dataset to generate an out-of-domain dataset classification model.
[0025] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described above.
[0026] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the method described above.
[0027] This disclosure presents a method for training an adaptive classification model for out-of-domain data that combines self- / semi-supervised learning. It fully leverages the advantages of self-supervised learning, then employs a domain-invariant feature mining-based domain generalization method to adapt the model to out-of-domain data, thus mitigating the shortcomings of self-supervised learning from an optimization perspective. Finally, a UPS semi-supervised algorithm is used to generate reliable pseudo-labels for the unlabeled out-of-domain data for retraining. This final training step is repeated until the model's performance on the out-of-domain test data no longer improves, thereby enhancing the classification accuracy of the out-of-domain dataset classification model.
[0028] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of this disclosure, nor is it intended to restrict the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0029] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. The drawings are provided for a better understanding of the invention and are not intended to limit the scope of this disclosure. In the drawings, the same or similar reference numerals denote the same or similar elements, wherein:
[0030] Figure 1 A flowchart illustrating a method for training a classification model on an adaptive out-of-domain dataset according to an embodiment of the present disclosure is shown.
[0031] Figure 2A block diagram of an adaptive out-of-domain dataset classification model training apparatus according to an embodiment of the present disclosure is shown;
[0032] Figure 3 A block diagram of an exemplary electronic device capable of implementing embodiments of the present disclosure is shown. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0034] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0035] This disclosure proposes an adaptive classification model training method that combines self / semi-supervised learning with out-of-domain data, which solves the problem of poor model performance when out-of-domain distributed data is scarce or unlabeled.
[0036] Explanation of technical terms:
[0037] Supervised learning: A model training method that derives a prediction function from labeled training data.
[0038] Self-supervised learning: a model training method that mainly uses auxiliary tasks (pretext) to mine its own supervision information from large-scale unsupervised data. The network is trained with this constructed supervision information, thereby learning representations that are valuable for downstream tasks.
[0039] Semi-supervised learning: a model training method that uses a small amount of labeled data and a large amount of unlabeled data to train the model.
[0040] Backbone network model: refers to a series of neural network models used to extract features, such as the ResNet series, the BERT series, etc.
[0041] Out-of-Distribution (OOD) data: If a dataset and model training data do not meet the conditions of Independent Identical Distribution (IID), they are considered out-of-distribution data.
[0042] ImageNet dataset: A mainstream, large-scale public dataset containing over one million images covering 1,000 object classes.
[0043] Domain-invariant features are features related to classification tasks. They originate within a specific data domain and are unaffected by other data domains. They primarily capture the inherent semantic information of the data.
[0044] Inter-domain invariant features refer to cross-domain knowledge transfer, which is potential knowledge generated from multiple data domains and can be learned together.
[0045] Generalization ability: Generalization ability refers to the ability of a machine learning algorithm to adapt to new samples. Simply put, it's about adding new datasets to an existing dataset and training the algorithm to output a reasonable result. The goal of learning is to learn the patterns hidden behind the data. The trained network should also be able to provide appropriate outputs for data outside the learning set that exhibits the same patterns; this ability is called generalization ability.
[0046] Recently, pre-training based on self-supervised learning has made significant progress in computer vision, forming a mainstream training paradigm known as "pre-training-fine-tuning." The core idea of this paradigm is to train the model using large-scale unlabeled data to achieve good feature extraction capabilities, and then fine-tune it with a small amount of data to obtain a model suitable for a specific task. Therefore, self-supervised learning techniques alleviate, to some extent, the problem of poor model performance caused by insufficient or unlabeled training data for downstream tasks.
[0047] However, self-supervised learning still follows the "independent and identically distributed" assumption of traditional machine learning. It only attempts to enable the model to "recognize" more samples through larger-scale unlabeled data, but it still does not solve the problem of data distribution shift in cross-domain situations. In real-world application scenarios, the data is complex and noisy, making it difficult to satisfy the assumption of "independent and identically distributed relationship with the source domain data (pre-training data)".
[0048] The problem with the traditional training paradigm of self-supervised learning is that it still follows the "independent and identically distributed assumption" of traditional machine learning, attempting to alleviate data bias through a large amount of data, but it does not address the problem from the perspective of training methods or optimization.
[0049] Catastrophic forgetting assessment methods indirectly evaluate the interdomain differences between source and target domain data based on the similarity of two features under source and target domain model parameters. The principle is based on the assumption that if a model trained on downstream task data still performs better on the original data, then the two datasets can be considered similar. It does not require... Calculating similarity with data from all target domains significantly reduces computational costs. However, indirect similarity evaluation methods based on model parameters also have certain problems: model parameters are a medium for storing "knowledge" in the model, and can map low-dimensional information of data to a high-dimensional representation.
[0050] On the other hand, most inter-domain differences exist in low-dimensional spaces, but the similarity calculations used in the above schemes are cosine similarity calculations of features in high-dimensional spaces. There is a certain probability that the "curse of dimensionality" will occur, that is, as the dimension increases, the feature similarity of the data becomes smaller and smaller, eventually approaching 0, thus causing feature similarity to lose its meaning in high-dimensional spaces. In other words, the "catastrophic forgetting" assessment method has a certain probability of failure or assessment bias.
[0051] like Figure 1 The diagram shown is a flowchart of the classification model training method for this publicly disclosed adaptive out-of-domain dataset. The method includes the following steps:
[0052] S1: Based on the target domain dataset and the pre-training dataset, use a self-supervised learning algorithm to pre-train the network model to generate a pre-trained model.
[0053] Specifically, suppose we arbitrarily select a backbone network model M (classic backbone network models in machine vision include CNN, Transformer, etc.), given a large-scale unlabeled pre-training dataset and labeled training data (also the source domain dataset), D source ={U source , {X source Y source}} and a set of unlabeled datasets (also the target domain dataset) D from a specific real-world application scenario. target ={U target}, where U is an unlabeled sample, X is a labeled sample, and Y is the corresponding label of the labeled sample; this disclosure mainly relates to multi-class single-label classification problems, and this disclosure is mainly applied to image processing fields such as machine vision CV.
[0054] The adaptive out-of-domain dataset classification model training method disclosed herein has a first stage of self-supervised learning pre-training. This stage adopts an advanced self-supervised learning technique—the DINO algorithm, which is a contrastive learning method that borrows the idea of model distillation. As can be observed through heatmap experiments, it effectively improves the "attention" of the self-attention module in the model to objects with important semantics in the image, thereby improving the feature extraction capability of the model.
[0055] The steps for this stage are as follows:
[0056] (1) Put U source and U target Merge into a new unlabeled dataset D unlabel .
[0057] (2) Use the DINO algorithm to preset the hyperparameter P dino Using the unlabeled dataset D unlabel The selected backbone network model M is pre-trained using the DINO self-supervised algorithm.
[0058] (3) Save the completed backbone network model M*.
[0059] The above steps can be expressed by the following formula:
[0060] D unlabel ={U source U target}
[0061] M * =DINO(D unlabel |P dino ).
[0062] Among them, M * For the pre-trained model, U source For the pre-trained dataset and U target For the target domain dataset.
[0063] S2: Initialize the training model containing the invariant feature learner based on the model parameters of the pre-trained model.
[0064] Specifically, the source domain dataset corresponding to the pre-training dataset is input into the initialized training model to generate intra-domain invariant features and inter-domain invariant features, and the loss function values of the intra-domain invariant features and the inter-domain invariant features are calculated and determined based on the category prediction probability;
[0065] Based on the overall loss function value, the backpropagation gradient is calculated on the initialized training model, and the sub-trained model is updated. This disclosure uses a domain-invariant feature mining-based domain generalization method in S2 to achieve out-of-domain data adaptation. Furthermore, the domain-invariant feature mining-based domain generalization method in S2 is an improvement on the DIFEX algorithm. The core idea of the DIFEX algorithm is to decouple the features extracted by the pre-trained model into intra-domain invariant features and inter-domain invariant features, allowing the model to learn from both intra-domain and inter-domain perspectives, ultimately obtaining a model with better generalization performance.
[0066] In the original DIFEX algorithm, Fourier phase values are used as domain-invariant features. Then, through a distillation algorithm, the teacher model outputs features extracted based on Fourier phase values. The student model then directly fits these features (i.e., it can predict features based on Fourier phase values by inputting the original image data), thus enabling the entire model to achieve end-to-end computation without introducing additional Fourier phase value calculations.
[0067] Although the original DIFEX has the advantages of effectively utilizing Fourier phase value features and end-to-end computation, its training steps are too complicated, involving the phased training of multiple models: 1) The performance of the teacher model will indirectly affect the final training effect; 2) During the distillation process, the student model will lose some feature information during learning, which will also have a negative impact on the final training effect.
[0068] In this disclosure, since we observe through attention heatmaps that the DINO self-supervised algorithm enables the model to focus on objects with important category semantic information in the image as much as possible, we no longer use features based on Fourier phase values, but instead directly use M... * The extracted features are used as domain-invariant features f inter This eliminates the need for a distillation algorithm to fit features based on Fourier phase values, thus simplifying the overall training process. Specifically, compared to the original DIFEX method, this disclosure reduces the following three steps: (1) training the teacher model using features based on Fourier phase values; (2) training the student model using the teacher model to fit the Fourier phase value features (DIFEX uses this feature as an invariant feature within the domain); and (3) using the student model to output the fitted value of the Fourier phase value features, and using the fitted value to complete the training of the out-of-domain data adaptation stage.
[0069] This disclosure directly uses the features of M* as domain-invariant features, thus simplifying the overall training process. This improves training efficiency and addresses the problem of poor final training results caused by error accumulation between multiple training steps. Furthermore, the pre-trained backbone network M* does not require additional modules or computational overhead when generating domain-invariant features, thus enabling end-to-end computation.* The extracted residual features are then used as inter-domain invariant features f. mut .
[0070] Both invariant features have specially designed objective functions, where the objective function for the domain-invariant feature is:
[0071]
[0072] Where n is the size of a certain batch of data. To use M with source domain data as input * The extracted domain-invariant features, To use M with target domain data as input * The extracted intra-domain invariant features; the objective function for the corresponding inter-domain invariant features is the CORAL objective function:
[0073]
[0074]
[0075]
[0076] in, To use M with source domain data as input * The extracted inter-domain invariant features, To use M with target domain data as input * The extracted inter-domain invariant features, where d is the number of feature channels for the two inter-domain invariant features;
[0077] Finally, in order to obtain more diverse invariant features and reduce redundancy and duplication among features, we retain the regularization term from the original DIFEX algorithm:
[0078]
[0079] Wherein, NORM(f) represents the normalization operation along the feature channel.
[0080] S3: Based on the source domain dataset corresponding to the pre-trained dataset, a supervised learning algorithm is used to perform secondary training on the initialized training model to generate a secondary training model.
[0081] Specifically, the training model is pre-built, and the pre-built training model includes a first network model and a second network model; wherein, the first network model includes a backbone model part, an invariant feature learner, and a classifier; the second network model includes a backbone model part and an invariant feature learner; the backbone model part of the pre-built training model is initialized according to the model parameters of the pre-trained model, while the remaining parts of the first network model and the second network model are randomly initialized. Detailed steps are as follows:
[0082] (1) Simultaneously construct two models M src and M tar M src The model is the first network model, M tar This is the second network model. M src It consists of a backbone model, an invariant feature learner, and a classifier, M. tar It then consists of only a backbone model and an invariant feature learner. Furthermore, M src and M tar The backbone model part and the network structure of the invariant feature learner are exactly the same.
[0083] (2) All use M * The model parameters are used to initialize the backbone model parts of the two models mentioned above, while the rest of the two models are randomly initialized.
[0084] (3) X source Enter to M src Obtain invariant features and category prediction probability p cls .
[0085] (4) Will U target Enter to M tar To obtain invariant features and
[0086] (5) Based on class prediction probability p cls and Y source The classification loss L is calculated using the traditional cross-entropy loss function. cls .
[0087] (6) Based on invariant features and Calculate the values of the three loss functions mentioned above.
[0088] (7) Calculate the overall loss value L total =L cls +L inter +L mut +L expThen, based on the overall loss value, in M src Calculate the backpropagation gradient and then update M. src .
[0089] (8) When M src After the parameters are updated, the exponential moving average (EMA) method is used to adjust M. src Update the parameters to M tar .
[0090] Repeat steps (3) to (8) until the overall loss value stabilizes and no longer decreases, or until the maximum number of training epochs is reached, completing the training and obtaining the trained model M. ** .
[0091] S4: Based on the target domain dataset and the source domain dataset, train the training model using a semi-supervised learning algorithm to generate an out-of-domain dataset classification model.
[0092] Specifically, this disclosure uses the UPS semi-supervised learning algorithm, and assigns target domain data U according to the pseudo-label allocation strategy in the algorithm. target High-reliability positive sample labels G in the sample positive or negative sample label G negative After completing the pseudo-label assignment, the target domain samples with pseudo-labels are merged into the source domain dataset and M is trained again. ** The classifier can be used until the model's test classification performance no longer improves, which usually only takes about 3 to 5 rounds.
[0093] In practical applications, it's easy to find a vast number of unlabeled samples, but obtaining labeled samples requires specialized equipment or expensive and time-consuming manual labeling. This results in a very small number of labeled samples and an excess of unlabeled samples. Therefore, researchers have attempted to incorporate a large number of unlabeled samples into a limited set of labeled samples for training, thus introducing semi-supervised learning. The aim is to leverage unlabeled data to improve the final learning performance of the model.
[0094] Among them, the semi-supervised learning method is a pseudo-label assignment method. In this disclosure, the model M is first trained multiple times. ** Labeling is performed on the target domain dataset (unlabeled dataset). Then, highly reliable pseudo-labeled data is selected according to the filtering strategy and added to the original source domain dataset (which has limited representation of the dataset) to form a new dataset. M is then trained again. ** This process is repeated n times until the model's classification performance no longer improves after three consecutive tests, finally yielding the final model M. n (That is, a classification model for out-of-domain datasets).
[0095] According to the embodiments of this disclosure, the following technical effects are achieved:
[0096] (1) A large amount of unlabeled data from a specific application scenario can be incorporated into the source domain dataset, and then the unlabeled data can be utilized through self-supervised training.
[0097] (2) By using the domain-invariant feature mining domain generalization method, the features extracted by the pre-trained model are decoupled into intra-domain invariant features and inter-domain invariant features, so that the model can learn directly from both intra-domain and inter-domain perspectives without having to evaluate the differences between domains.
[0098] (3) By using the UPS semi-supervised algorithm, a large amount of unlabeled data in a specific application scenario can be reused to enable the model to further fit the data outside the domain.
[0099] (4) The advanced DINO self-supervised learning technology is used to combine unlabeled data from outside the domain with data from within the domain, which improves the feature extraction capability of the model.
[0100] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this disclosure is not limited to the described order of actions, because according to this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this disclosure.
[0101] The above is an introduction to the method embodiments. The following describes the solution described in this disclosure further through device embodiments.
[0102] Figure 2 A block diagram of an adaptive out-of-domain dataset classification model training apparatus 200 according to an embodiment of the present disclosure is shown. The apparatus 200 includes:
[0103] The pre-trained model generation module 210 is used to pre-train the network model and generate a pre-trained model based on the target domain dataset and the pre-trained dataset using a self-supervised learning algorithm.
[0104] Initialization module 220 is used to initialize the training model containing the invariant feature learner based on the model parameters of the pre-trained model;
[0105] The secondary training model generation module 230 is used to generate a secondary training model by performing secondary training on the initialized training model based on the source domain dataset corresponding to the pre-training dataset and using a supervised learning algorithm.
[0106] The out-of-domain dataset classification model generation module 240 is used to train the sub-training model using a semi-supervised learning algorithm based on the target domain dataset and the source domain dataset to generate an out-of-domain dataset classification model.
[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the described module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0108] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0109] Figure 3 A schematic block diagram of an electronic device 300 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0110] Electronic device 300 includes a computing unit 301, which can perform various appropriate actions and processes according to a computer program stored in ROM 302 or a computer program loaded into RAM 303 from storage unit 308. RAM 303 may also store various programs and data required for the operation of electronic device 300. The computing unit 301, ROM 302, and RAM 303 are interconnected via bus 304. I / O interface 305 is also connected to bus 304.
[0111] Multiple components in electronic device 300 are connected to I / O interface 305, including: input unit 306, such as keyboard, mouse, etc.; output unit 307, such as various types of displays, speakers, etc.; storage unit 308, such as disk, optical disk, etc.; and communication unit 309, such as network card, modem, wireless transceiver, etc. Communication unit 309 allows electronic device 300 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0112] The computing unit 301 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 301 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 301 performs the various methods and processes described above, such as the adaptive out-of-domain dataset classification model training method. For example, in some embodiments, the adaptive out-of-domain dataset classification model training method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 308. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 300 via ROM 302 and / or communication unit 309. When the computer program is loaded into RAM 303 and executed by the computing unit 301, one or more steps of the adaptive out-of-domain dataset classification model training method described above can be performed. Alternatively, in other embodiments, computing unit 301 may be configured by any other suitable means (e.g., by means of firmware) to perform a classification model training method for an adaptive out-of-domain dataset.
[0113] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0114] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0115] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0116] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including voice input, speech input, or tactile input).
[0117] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0118] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0119] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0120] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for training a classification model on an adaptive out-of-domain dataset, applied to the field of image processing, characterized in that, The method includes: Based on the target domain dataset and the pre-training dataset, a self-supervised learning algorithm is used to pre-train the network model to generate a pre-trained model; wherein, the target domain dataset and the pre-training dataset are unlabeled image datasets. The training model containing the invariant feature learner is initialized based on the model parameters of the pre-trained model; The source domain dataset corresponding to the pre-training dataset is input into the initialized training model to generate intra-domain invariant features and inter-domain invariant features, and the loss function values of the intra-domain invariant features and the inter-domain invariant features are calculated and determined based on the category prediction probability; wherein, the source domain dataset is a labeled image dataset, and the samples in the source domain dataset are the same as the samples in the pre-training dataset; The loss function for the domain-invariant features is defined as follows: in For a certain small batch of data, This is to use the domain-invariant features extracted by the trained model after initialization, taking source domain data as input. The domain-invariant features extracted by the trained model after initialization are used as input to target domain data; The loss function for the inter-domain invariant features adopts the CORAL objective function: in, This is to use the inter-domain invariant features extracted by the trained model after initialization, with source domain data as input. This is used to extract inter-domain invariant features from the trained model after initialization, taking target domain data as input. The number of feature channels for inter-domain invariant features; Based on the overall loss function value, the backpropagation gradient is calculated on the initialized training model, and the sub-training model is updated accordingly. Based on the target domain dataset and the source domain dataset, a semi-supervised learning algorithm is used to train the sub-training model to generate an out-of-domain dataset classification model.
2. The method according to claim 1, characterized in that, The process of initializing the training model containing the invariant feature learner based on the model parameters of the pre-trained model includes: The training model is pre-built, and the pre-built training model includes a first network model and a second network model; wherein, the first network model includes a backbone model part, an invariant feature learner, and a classifier; the second network model includes a backbone model part and an invariant feature learner. The backbone model of the pre-built training model is initialized according to the model parameters of the pre-trained model, while the remaining parts of the first network model and the second network model are randomly initialized.
3. The method according to claim 1, characterized in that, The process of training the sub-training model using a semi-supervised learning algorithm based on the target domain dataset and the source domain dataset to generate an out-of-domain dataset classification model includes: Based on the pseudo-label allocation strategy of the semi-supervised learning algorithm, generate highly reliable positive or negative sample labels for some samples in the target domain data; merge the samples of the target domain dataset with pseudo-labels into the source domain dataset, train the classifier of the secondary training model until the test classification performance of the secondary training model no longer improves within a preset number of times, and complete the training to generate an out-of-domain dataset classification model.
4. A classification model training device for adaptive out-of-domain datasets, applied in the field of image processing, characterized in that, The device includes: The pre-trained model generation module is used to generate a pre-trained model by pre-training the network model using a self-supervised learning algorithm based on the target domain dataset and the pre-trained dataset; wherein, the target domain dataset and the pre-trained dataset are unlabeled image datasets. An initialization module is used to initialize a training model containing an invariant feature learner based on the model parameters of the pre-trained model. The training model generation module is used to input the source domain dataset corresponding to the pre-training dataset into the initialized training model, generate intra-domain invariant features and inter-domain invariant features, and calculate and determine the loss function values of the intra-domain invariant features and the inter-domain invariant features based on the category prediction probability; wherein, the source domain dataset is a labeled image dataset, and the samples in the source domain dataset are the same as the samples in the pre-training dataset. The loss function for the domain-invariant features is defined as follows: in For a certain small batch of data, This is to use the domain-invariant features extracted by the trained model after initialization, taking source domain data as input. The domain-invariant features extracted by the trained model after initialization are used as input to target domain data; The loss function for the inter-domain invariant features adopts the CORAL objective function: in, This is to use the inter-domain invariant features extracted by the trained model after initialization, with source domain data as input. This is used to extract inter-domain invariant features from the trained model after initialization, taking target domain data as input. The number of feature channels for inter-domain invariant features; Based on the overall loss function value, the backpropagation gradient is calculated on the initialized training model, and the sub-training model is updated accordingly. The out-of-domain dataset classification model generation module is used to train the sub-training model using a semi-supervised learning algorithm based on the target domain dataset and the source domain dataset to generate an out-of-domain dataset classification model.
5. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 3.
6. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, in, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 3.