Data annotation and model training method and related device
By obtaining small labeled samples in the target domain data for annotation and training the target model, the problem of model performance degradation caused by the large difference in data distribution between the source domain and the target domain is solved, and the good adaptation and performance performance of the target model in the target domain is achieved.
Patent Information
- Application Number
- CN202410047418.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-11
- Publication Date
- 2025-07-11
AI Technical Summary
In domain transfer learning, when there is a large difference in the data distribution between the source domain and the target domain, directly applying the source model to the target domain will lead to a degradation of the model performance, and the existing technology is difficult to effectively solve this problem.
By obtaining small labeled samples in the target domain data, performing annotation processing, and obtaining the target model, using this model to annotate the target domain data, narrowing the gap between the source domain and the target domain, and improving the performance of the target domain task.
Even when there are large differences between the source domain and the target domain, the target model can show good performance and quickly adapt to the target domain tasks.
Smart Images

Figure CN120296408A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular, to a data annotation and model training method and related devices. Background Art
[0002] Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.
[0003] Domain transfer learning is a technology in the field of artificial intelligence that helps solve new problems by transferring knowledge and experience from one domain to another related but different domain. In domain transfer learning, the data distributions of the source domain and the target domain are different, but the tasks are the same. The source model is trained based on the source domain data. When there is a large difference in the data distribution between the source domain and the target domain, directly applying the source model to the target domain will cause the performance of the model to decline. In related technologies, the target domain data is usually adaptively modified based on the difference between the source domain data and the target domain data. When the source domain data cannot be obtained, it will be difficult to process the target domain task according to the source model. Summary of the Invention
[0004] Embodiments of this application provide a data annotation and model training method and related devices, enabling the source model trained through the source domain to be better applied to the target domain.
[0005] The first aspect of this application provides a data annotation method, including:
[0006] Obtain a source model and target domain data, where the source model is trained based on source domain data;
[0007] Obtain N test samples, each test sample including sample data and its corresponding sample label, where the sample data belongs to the target domain data, and N is an integer greater than 1;
[0008] Perform annotation processing on the target domain data through the target model to obtain corresponding data labels, where the target model is trained based on the test samples for the source model.
[0009] In a possible implementation method, performing annotation processing on the target domain data through the target model to obtain corresponding data labels includes:
[0010] Perform annotation processing on the target domain data through the source model to obtain a first label;
[0011] Perform annotation processing on the target domain data through the target model to obtain a second label.
[0012] When the first label and the second label meet the preset conditions, a target sample is determined. The target sample includes target domain data and the second label, and the preset conditions indicate the consistency between the first label and the second label.
[0013] Perform annotation processing on the target domain data through an optimized model.
[0014] In a possible implementation method, obtain N test samples, including:
[0015] Sample the target domain data to obtain N sample data, where N is an integer greater than 1.
[0016] Obtain the sample labels corresponding to the N sample data, and determine the N test samples.
[0017] A second aspect of the present application provides a model training method, including:
[0018] Obtain a source model and target domain data, where the source model is trained based on source domain data.
[0019] Obtain N test samples, where each test sample includes sample data and its corresponding sample label, and the sample data belongs to the target domain data, and N is an integer greater than 1.
[0020] Train the source model based on the test samples to obtain a target model, and the target model is used to perform annotation processing on the target domain data to obtain corresponding data labels.
[0021] In a possible implementation method, after training the source model based on the test samples to obtain a target model, it further includes:
[0022] Perform annotation processing on the target domain data through the source model to obtain a first label.
[0023] Perform annotation processing on the target domain data through the target model to obtain a second label.
[0024] When the first label and the second label meet the preset conditions, determine a target sample, where the target sample includes target domain data and the second label, and the preset conditions indicate the consistency between the first label and the second label.
[0025] Train the target model based on the target sample.
[0026] In a possible implementation method, obtain N test samples, including:
[0027] Sample the target domain data to obtain N sample data.
[0028] Obtain the sample labels corresponding to the N sample data, and determine the N test samples.
[0029] In a possible implementation method, training the source model based on test samples to obtain a target model includes:
[0030] Performing feature extraction on the test samples to obtain sample features;
[0031] Performing feature combination based on multiple sample features to obtain new features;
[0032] Training the source model based on the sample features and the new features to obtain a target model.
[0033] In a possible implementation method, performing feature combination based on multiple sample features to obtain new features includes:
[0034] Mixing the feature statistics of any two sample features to obtain new features.
[0035] In a possible implementation method, training the source model based on test samples to obtain a target model includes:
[0036] Labeling the sample data through the source model to obtain predicted labels;
[0037] Training the source model according to the cross-entropy loss function term to obtain a target model, where the cross-entropy loss function term indicates the similarity between the predicted label and the sample label.
[0038] The third aspect of this application provides a data annotation device, including:
[0039] A first acquisition module, configured to acquire a source model and target domain data, where the source model is trained based on source domain data;
[0040] A first sampling module, which acquires N test samples, each test sample includes sample data and its corresponding sample label, the sample data belongs to the target domain data, and N is an integer greater than 1;
[0041] A labeling module, configured to perform labeling processing on the target domain data through the target model to obtain corresponding data labels, where the target model is trained based on the test samples on the source model.
[0042] In a possible implementation method,
[0043] The labeling module is specifically configured to perform labeling processing on the target domain data through the source model to obtain a first label; perform labeling processing on the target domain data through the target model to obtain a second label; when the first label and the second label meet a preset condition, determine a target sample, where the target sample includes the target domain data and the second label, and the preset condition represents the consistency between the first label and the second label; train the target model based on the target sample to obtain an optimized model; perform labeling processing on the target domain data through the optimized model.
[0044] In a possible implementation method,
[0045] The first sampling module is specifically configured to sample the target domain data to obtain N sample data, where N is an integer greater than 1; obtain the sample labels corresponding to the N sample data, and determine N test samples.
[0046] A model training device is provided in the fourth aspect of this application, including:
[0047] The second acquisition module is configured to acquire a source model and target domain data, where the source model is trained based on source domain data;
[0048] The second sampling module is configured to acquire N test samples, each test sample including sample data and its corresponding sample label, where the sample data belongs to the target domain data, and N is an integer greater than 1;
[0049] The training module is configured to train the source model based on the test samples to obtain a target model, where the target model is used to perform annotation processing on the target domain data to obtain corresponding data labels.
[0050] In a possible implementation method, it further includes:
[0051] The optimization module is configured to perform annotation processing on the target domain data through the source model to obtain a first label; perform annotation processing on the target domain data through the target model to obtain a second label; when the first label and the second label meet a preset condition, determine a target sample, where the target sample includes the target domain data and the second label, and the preset condition represents the consistency between the first label and the second label; train the target model based on the target sample.
[0052] In a possible implementation method,
[0053] The second sampling module is specifically configured to sample the target domain data to obtain N sample data; obtain the sample labels corresponding to the N sample data, and determine N test samples.
[0054] In a possible implementation method,
[0055] The training module is specifically configured to extract features from the test samples to obtain sample features; perform feature combination based on multiple sample features to obtain new features; train the source model based on the sample features and the new features to obtain a target model.
[0056] In a possible implementation method,
[0057] A training module, specifically used for annotating sample data through a source model to obtain predicted labels; training the source model according to a loss function to obtain a target model, where the loss function indicates the similarity between the predicted labels and the sample labels.
[0058] The present application provides a computer device in five aspects, including:
[0059] A memory, a transceiver, a processor, and a bus system;
[0060] Among them, the memory is used to store programs;
[0061] The processor is used to execute the programs in the memory, including executing the methods in the above aspects;
[0062] The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.
[0063] The present application provides a computer-readable storage medium in six aspects. Instructions are stored in the computer-readable storage medium, and when it runs on a computer, it causes the computer to execute the methods in the above aspects.
[0064] The present application provides a computer program product or a computer program in seven aspects. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to execute the methods provided in the above aspects.
[0065] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0066] The present application provides a data annotation and model training method and related devices. The method includes: obtaining a source model and target domain data, where the source model is trained based on source domain data; obtaining N test samples, each test sample including sample data and its corresponding sample label, and the sample data belongs to the target domain data, and N is an integer greater than 1; training the source model based on the test samples to obtain a target model; performing annotation processing on the target domain data through the target model to obtain corresponding data labels. Since the target model is trained based on some labeled target domain data, even when there are large differences between the source domain and the target domain, the target model can still have good performance. Description of the Drawings
[0067] Figure 1 It is a schematic structural diagram of an artificial intelligence main framework;
[0068] Figure 2 It is an application environment diagram of the data annotation method in the embodiments of the present application;
[0069] Figure 3 It is a flowchart of the model training method provided by the embodiment of the present application;
[0070] Figure 4 It is a flowchart of the model training method provided by the embodiment of the present application;
[0071] Figure 5 It is a schematic diagram of the model training method provided by the embodiment of the present application in stages;
[0072] Figure 6 It is a flowchart of the data annotation method provided by the embodiment of the present application;
[0073] Figure 7 It is a review flowchart of the image content review system provided by the embodiment of the present application;
[0074] Figure 8 It is a schematic diagram of an embodiment of the data annotation device in the embodiment of the present application;
[0075] Figure 9 It is a schematic diagram of an embodiment of the model training device in the embodiment of the present application;
[0076] Figure 10 It is a schematic diagram of a server structure provided by the embodiment of the present application. Detailed implementation manners
[0077] The embodiment of the present application provides a data annotation and model training method and related devices. By obtaining a part of data from the target domain data for annotation, and using the target domain data carrying labels as training samples to train the source model to obtain the target model, the target model is used for the annotation of the target domain data, so that the target model can quickly adapt to the target domain task. Since the target model is trained based on part of the labeled target domain data, even when there are large differences between the source domain and the target domain, the target model can still have good performance.
[0078] The terms "first", "second", "third", "fourth", etc. (if any) in the description, claims and the above-mentioned drawings of the present application are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0079] Artificial Intelligence (AI) is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable the machines to have the functions of perception, reasoning and decision-making.
[0080] Please refer to Figure 1 , Figure 1 It is a schematic structural diagram of an artificial intelligence main framework.
[0081] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level technologies and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. The basic technologies provide computing power support for artificial intelligence systems and realize communication with the external world. Data is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voices, texts, and also involves the Internet of Things data of traditional devices. Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods. After the data is processed, some general capabilities can be formed further based on the results of the data processing, such as algorithms or a general system. For example, software technologies such as translation, text analysis, computer vision processing, speech recognition, image recognition, etc. The artificial intelligence software technology mainly includes several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0082] Computer Vision Technology (CV) Computer vision is a science that studies how to enable machines to "see". More specifically, it refers to machine vision that uses cameras and computers to replace human eyes for target recognition and measurement, and further performs image processing to make the computer-processed images more suitable for human eyes to observe or be transmitted to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish artificial intelligence systems that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, etc. technologies, and also includes common biometric recognition technologies such as face recognition and fingerprint recognition.
[0083] The key technologies of Speech Technology include Automatic Speech Recognition (ASR), Text-to-Speech (TTS), and voiceprint recognition technology. Enabling computers to listen, see, speak, and feel is the future development direction of human-computer interaction. Among them, speech has become one of the most promising human-computer interaction methods in the future.
[0084] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers in natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, the research in this field will involve natural languages, that is, the languages used by people in daily life, so it has a close connection with the research of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph, etc. technologies.
[0085] Machine Learning (ML) is an interdisciplinary subject that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills, and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning.
[0086] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, robots, smart healthcare, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0087] The solution provided by the embodiments of this application relates to the transfer learning technology in the field of machine learning. It transfers the knowledge and experience of one domain (source domain) to another related but different domain (target domain) to help solve new problems. This technology can save the time of manually annotating samples. By transferring the existing labeled data (source domain data) to the unlabeled data (target domain data), it reduces the demand of machine learning for the sample size of the dataset.
[0088] The transfer learning technology can be combined with computer vision technology, speech technology, natural language processing technology, etc. For example, in the field of computer vision, a model trained on a large dataset such as ImageNet can be used as a pre-trained model and transferred to other computer vision tasks such as object detection, image segmentation, action recognition, etc.; in the field of speech recognition, a speech recognition model trained on a large amount of speech data can be used as a pre-trained model and transferred to other speech recognition tasks such as dialect recognition, speech recognition in specific fields, etc.; in the field of natural language processing, a language model trained on a large corpus can be used as a pre-trained model and transferred to other natural language processing tasks such as text classification, named entity recognition, sentiment analysis, etc.; in the field of recommendation systems, a recommendation model trained on a large dataset can be used as a pre-trained model and transferred to other recommendation systems such as movie recommendations, music recommendations, etc.
[0089] In transfer learning, the data distributions of the source domain and the target domain are different, but the tasks are the same. The source domain is used to train the source model. When there is a large difference in the data distribution between the source domain and the target domain, directly applying the source model to the target domain will cause the performance of the model to decline. To solve this problem, a test time adaptation (TTA) method has been proposed in related technologies to adjust the pre-trained source model to process out-of-distribution streaming target domain data. TTA can enable the model to be quickly fine-tuned and adjusted during testing, so as to be able to face the process of the continuous evolution of the distribution of this kind of data in actual applications.
[0090] Currently, the mainstream TTA solutions are divided into the following several types:
[0091] Entropy Minimization-based Model Update: This method uses the model of the source domain to assign probability labels to the online streaming data of the target domain, and then uses the probability labels to minimize the update of the source model to complete the adaptation process;
[0092] Statistics of Source Domain Data: This type of method additionally retains the statistical information of the source domain data during source domain training, and completes prediction and update by comparing with the target domain data during online adaptation;
[0093] Generative Model-based Methods: This type of method adds the training of diffusion models during source domain training, so that when adapting during online testing, the target domain data is closer to the source domain data when input through the Diffusion model.
[0094] However, the above TTA methods still have the following several disadvantages:
[0095] Unable to solve the situation of large domain differences: One application premise of TTA is that the distribution difference between the source domain and the target domain is within a reasonable range. If the difference is too large, it will directly cause the source model to be unable to give any information about the target domain, and the TTA method cannot be applied directly.
[0096] High requirements for the online target domain data stream: A good adaptation effect can only be achieved when the amount of target domain data is sufficient. Therefore, when the batch size of the target domain data stream is very small, it is difficult to adapt according to each batch of target domain data, resulting in many TTA methods being almost ineffective.
[0097] Without any label information of the target domain: The adaptation process during target domain testing is completely black-box, and only unlabeled target domain streaming data is used, making it difficult to break through the performance ceiling of adaptation.
[0098] To solve the above problems, the present application provides a data annotation and model training method and related device, which uses the small labeled samples in the target domain to train the source model, quickly narrow the gap between the source domain and the target domain, and improve the performance of the target domain task.
[0099] For ease of understanding, please refer to Figure 2 , Figure 2 which is the application environment diagram of the data annotation method in the embodiments of the present application, as Figure 2As shown in the figure, the data annotation method in the embodiments of the present application is applied to a data annotation system. The data annotation system includes: a server and a terminal device; wherein, the server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal and the server can be directly or indirectly connected through wired or wireless communication methods, and the embodiments of the present application do not limit this here.
[0100] The server first obtains a source model and target domain data, and the source model is trained based on the source domain data; then the server obtains a plurality of test samples according to the target domain data, and the test samples include sample data and corresponding sample labels, and the sample data therein comes from the target domain data; the source model is trained according to the test samples, so that the source model can quickly adapt to the target domain data, and a target model adapted to the target domain is obtained, and then the target domain data is labeled through the target model to obtain a corresponding labeling result, that is, the data label of the target domain data.
[0101] The present application also provides a model training method for training the above-mentioned target model. In the embodiments of the present application, the model training method is applied to a model training system. The model training system includes: a server and a terminal device, wherein the forms and communication methods of the server and the terminal device are similar to those in the above-mentioned data annotation system, and the embodiments of the present application do not limit this here.
[0102] Specifically, in the model training method provided by the embodiments of the present application, the server first obtains a source model and target domain data, and the source model is trained based on the source domain data; then the server obtains a plurality of test samples according to the target domain data, and the test samples include sample data and corresponding sample labels, and the sample data therein comes from the target domain data; finally, the server trains the source model according to the test samples, so that the source model can quickly adapt to the target domain data, and a target model is obtained, and the target model is used to label the target domain data to obtain a corresponding labeling result, that is, the data label of the target domain data.
[0103] Next, the embodiments of the present application first specifically introduce the model training method in the present application. Please refer to Figure 3 , Figure 3 which is the method flow chart of the model training method provided by the embodiments of the present application, and includes:
[0104] 301. Obtain a source model and target domain data, where the source model is trained based on source domain data.
[0105] It can be understood that the model training method provided in the embodiments of this application is applied to artificial intelligence in the transfer learning technology. The source model refers to a neural network model trained based on a certain domain (source domain). Usually, this source model is a pre-trained model for processing specific types of data, that is, the source domain data is difficult to obtain. In the method of the embodiments of this application, first, a source model and target domain data are obtained to facilitate transfer learning of the source model to adapt to the target domain data for predicting (annotating) the target domain data.
[0106] The source model can be an image processing model, an audio recognition model, a natural language processing model, etc. This application does not limit it, and it can be any model for processing specific types of data. Correspondingly, the target domain data can also be any type of data, such as image data, audio data, text data, etc. The target domain data can be data collected from a certain data source, database, API, or other sources. The target domain data can also be obtained in batches in the form of an online data stream, and each batch includes multiple target domain data.
[0107] 302. Obtain N test samples, each test sample including sample data and its corresponding sample label, where the sample data belongs to the target domain data, and N is an integer greater than 1.
[0108] It can be understood that during transfer learning, the source model has learned features and patterns from the source domain data, and these features and patterns may be related to the target domain data. However, the target domain data may have a distribution and characteristics different from those of the source domain data, so the source model needs to be adjusted to adapt to the target domain data.
[0109] After obtaining the source model in the method of the embodiments of this application, it is necessary to adapt the source model based on the target domain data. This adaptation process is specifically to train the source model so that the source model can be quickly adapted to the target domain task and reduce the domain difference. Since multiple training samples are required to train the model, in this embodiment, the training samples for the source model are the above-mentioned test samples. The test samples include sample data and sample labels, where the source of the sample data is the target domain data, and the sample label corresponds to the correct label of the sample data, which can be manually annotated or an annotation result with high confidence based on the technology of an artificial intelligence model. This artificial intelligence model can be other mature annotation models or directly use the source model. In short, the annotation result of the model for the sample data should be an accurate result.
[0110] 303. Train the source model based on the test samples to obtain a target model, which is used to label the target domain data to obtain corresponding data labels.
[0111] It can be understood that since the sample data in the test samples is from the target domain data, that is to say, the method provided in this embodiment obtains a part of the target domain data and labels the part of the target domain data to obtain test samples. Training the source model based on the test samples to obtain a target model can enable the target model to quickly adapt to the target domain task and solve the problem of poor performance caused by directly processing the target domain data based on the source model.
[0112] The model training method provided by the embodiments of the present application does not need to obtain source domain data. Only by obtaining a part of the data from the target domain for annotation and using the target domain data with labels as training samples to train the source model to obtain a target model, the target model can quickly adapt to the target domain task. Since the target model is trained based on part of the labeled target domain data, even when there are large distribution differences between the source domain and the target domain, the target model can still have good performance.
[0113] In the present application Figure 3 In an optional embodiment corresponding to the embodiment, please refer to Figure 4 , Figure 4 is the flowchart of the model training method provided by the embodiments of the present application, including:
[0114] 401. Obtain a source model and target domain data, where the source model is trained based on source domain data;
[0115] It can be understood that this step corresponds to step 301 in the above Figure 3 shown embodiment. For related descriptions, please refer to the above text and will not be elaborated here.
[0116] Among them, the source model parameters can be defined as f θ , which is trained on the source domain dataset. The source domain dataset can be expressed as {D s1 , D s2 , …, D sn}, and each element in the source domain dataset represents a source domain data.
[0117] 402. Sample the target domain data to obtain N sample data, where N is an integer greater than 1;
[0118] 403. Obtain the sample labels corresponding to the N sample data and determine N test samples.
[0119] It can be understood that steps 402 and 403 correspond to Figure 3Step 302 in the illustrated embodiment.
[0120] The purpose of this embodiment is to adapt the source model to the target domain without accessing the source domain data.
[0121] After obtaining the target domain data, sample N sample data from the target domain data. Sampling methods may include sampling strategies such as random sampling and stratified sampling; then label the sample data through manual or machine learning models to obtain the corresponding N sample labels. The labeling process is to convert the sample data into a form that the model can understand. For example, when processing image data, it may be necessary to mark the objects in the image; when processing text data, it may be necessary to classify the text or mark specific language patterns; if a machine learning model is used for labeling, the training process of the model may include steps such as selecting appropriate features, defining a loss function, and choosing an optimization algorithm.
[0122] Take the combination of the sample data and the corresponding sample labels as a test sample, and thus obtain N test samples. This test sample is the basis for your model training and testing.
[0123] The N test samples can be represented as a support set S = {(s i , y i )}, where s i represents the sample data, sourced from the target domain data D t , and y i is the label corresponding to s i . The support set S includes N test samples, and (s i , y i ) represents a test sample, where i is the serial number of the test sample.
[0124] In a possible implementation method, considering that the number of test samples is limited, the categories of the sample labels also have limitations, and there may be a risk of overfitting during the training of the source model. Overfitting means that the model selected during learning contains too many parameters (i.e., the model capacity is large), so that this model predicts well for known data but poorly for unknown data. To solve this problem, after obtaining the N test samples, it further includes:
[0125] 404. Extract features from the test samples to obtain sample features;
[0126] 405. Combine features based on multiple sample features to obtain new features;
[0127] In the embodiment of the present application, first extract features from the test samples to obtain sample features, and then enhance feature diversity based on the test samples.
[0128] Feature diversity enhancement is a method of adding new features or transforming existing features in a dataset to improve the performance of a model. In this embodiment, since the number of test samples is multiple, a corresponding number of sample features will be obtained after feature extraction. These features can be any descriptive attributes of the test samples, such as pixel intensity, frequency distribution, text word frequency, etc.
[0129] Through the way of feature combination, multiple sample features can be combined to obtain new features. This feature combination can refer to feature concatenation, or feature cross and fusion, etc. For example, in an image recognition task, pixel intensity and the size of local image patches can be used as two independent features, and new features can be generated through linear combination or non-linear transformation, etc.
[0130] The method of obtaining new features can enhance the diversity and richness of features, thus providing more information for the model to learn. At the same time, it also helps to solve the overfitting problem in the dataset and improve the generalization ability of the model.
[0131] It can be understood that in the art, there are also some commonly used methods for feature diversity enhancement, such as feature transformation, feature dimensionality reduction, etc. This application only provides one possible method for feature diversity enhancement and does not limit this.
[0132] Generally speaking, in a machine learning model, the feature extraction network layer (block) is an important part of the model. Therefore, the feature extraction step can be directly implemented through the corresponding feature extraction network layer (block) of the source model, and feature diversification enhancement is performed before entering the next network layer (block), that is, the feature enhancement step is directly embedded into the feature extraction network layer (block) of the source model. If the number of such network layers (blocks) is multiple, then between any two network layers (blocks), the above steps 404 and 405 can be embedded. In this way, feature enhancement and model optimization can be performed simultaneously during the training process of the model. This can avoid introducing additional computational overhead and enable feature enhancement to adapt to the structure and characteristics of the source model.
[0133] In a possible implementation method, step 405 is specifically: mixing the feature statistics of any two sample features to obtain new features.
[0134] In this embodiment, the method for enhancing sample features is specifically to mix statistical data among test samples. More specifically, coefficients are used to combine the feature statistical data of two test samples: First, for any two sample features, their feature statistical data is calculated; then the statistical data of the two sample features is mixed based on a preset coefficient to obtain a mixed parameter; finally, the mixed parameter is applied to the original test samples through instance normalization, thereby generating new features (additional features) to achieve the purpose of enhancing feature diversity.
[0135] 406, training the source model based on the sample features and the additional features to obtain the target model.
[0136] It can be understood that after obtaining the additional features, training the source model based on the sample features and the additional features can reduce the overfitting risk and improve the performance of the target model.
[0137] In a possible implementation method, training the source model specifically includes:
[0138] S1, annotating the sample data through the source model to obtain predicted labels;
[0139] S2, training the source model according to the loss function to obtain the target model, where the loss function indicates the similarity between the predicted labels and the sample labels.
[0140] In this embodiment, first, the sample data in the test samples is directly annotated through the source model to obtain corresponding predicted labels. Since the source model is trained based on source domain data, and the sample data is target domain data, due to the distribution difference between the source domain data and the target domain data, there may also be a difference between the predicted labels and the true labels (sample labels). To train the source model to be adapted to the target domain, this difference needs to be eliminated. The back propagation (BP) algorithm based on the loss function can be used to modify the parameters of the source model during the training process. The loss function indicates the similarity between the predicted labels and the sample labels, making the loss function smaller and smaller, thereby obtaining the target model. This target model can be used to annotate the target domain data to obtain corresponding data labels.
[0141] It can be understood that steps S1 and S2 correspond to Figure 3Step 303 in the illustrated embodiment. The test sample is equivalent to the training sample of the target model, and the sample data and sample labels are equivalent to the training data and training labels of the target model. After the test sample is feature-enhanced based on the above steps 404 and 405, the training sample of the target model includes sample features and newly added features. Similarly, the corresponding training can be performed using the back propagation (BP) algorithm based on the loss function.
[0142] In a possible implementation method, after obtaining the target model, an iterative method can be used to optimize and train the target model so that the target model can further meet the target domain task. Specifically, it includes:
[0143] 407, performing annotation processing on the target domain data through the source model to obtain the first label;
[0144] 408, performing annotation processing on the target domain data through the target model to obtain the second label.
[0145] 409, when the first label and the second label meet the preset conditions, determining the target sample, where the target sample includes the target domain data and the second label, and the preset condition represents the consistency between the first label and the second label;
[0146] 410, training the target model based on the target sample.
[0147] In the embodiment of the present application, after training the target model, annotation processing is respectively performed on the target domain data through the source model and the target model to obtain the corresponding first label and second label. According to the consistency between the first label and the second label, the target domain data and its second label that can be used to guide model update are determined as the target sample. The target model is trained based on the target sample to achieve the effect of optimizing the target model.
[0148] The model training method provided by the embodiment of the present application, after obtaining the target model, further includes obtaining the target sample based on the target domain data through consistency screening, and optimizing the target model through the target sample, thereby further improving the performance of the target model for the target domain task. At the same time, since this embodiment also includes the step of optimizing the target model, during the process of training the source model based on the test sample, only a small number of test samples can be obtained, adhering to the principle of less investment and greater gain, and reducing the blind exploration of the unknown target domain.
[0149] Next, in combination with Figure 5 introduce a training method for an annotation model applied to image classification.
[0150] For ease of understanding, the above Figure 4The model training method in the corresponding embodiment is divided into two stages, including the fine-tuning of the source model stage and the test-time adaptation stage. Among them, the fine-tuning of the source model stage corresponds to steps 404 to 406, and the test-time adaptation stage corresponds to steps 407 to 410. For details, please refer to Figure 5 , Figure 5 which is the flowchart of the phased model training method provided by the embodiment of the present application.
[0151] It can be understood that according to Figure 4 the relevant description of step 403 in the corresponding embodiment, N test samples can be represented as the support set S = {(s i , y i )}, where s i represents the sample data, which comes from the target domain data D t , and y i is the label corresponding to s i . The support set S includes N test samples, and (s i , y i ) represents a test sample, and i is the serial number of the test sample.
[0152] Phase 1: Fine-tuning the source model with a small sample support set:
[0153] The goal of this stage is to fine-tune the pre-trained source model using the small sample support set, promote the initial adaptation to the target domain, and lay a foundation for test-time adaptation. Considering that the number of samples in the support set is small, and thus the samples of each category included are limited, there may be a potential overfitting risk during the process of fine-tuning the source model. In this embodiment, a feature diversity enhancement module is proposed to improve the generalization ability of the model. Specifically, more features or statistical data are introduced between random support samples to enrich the input of the model.
[0154] The feature diversity enhancement module is embedded between the layers (blocks) of the pre-trained source domain backbone network. The source domain backbone network is equivalent to the feature extraction network before the source model, as shown in Figure 5 (a) Fine-tuning the pre-trained model in the source domain in the figure. More specifically, the feature diversity enhancement module uses coefficients to combine the feature statistics of two random samples. The calculations within the feature diversity enhancement module can be divided into the following three steps:
[0155] First, randomly select the sample features of two sample data in the support set, and calculate their first feature statistic μ and second feature statistic σ:
[0156]
[0157]
[0158] Among them, H and W respectively represent the height and width of the feature image data. Taking the sample feature f i and f j as an example, the statistical feature data (μ i , σ i ) and (μ j , σ j ) are extracted respectively.
[0159] Then, generate the mixture of two sets of randomly generated sample feature statistical data (μ j , σ j ) and (μ i , σ i ):
[0160] γ mix = λσ i + (1 - λ)σ j ;
[0161] β mix = λμ i + (1 - λ)μ j ;
[0162] Among them, λ represents the mixing ratio coefficient.
[0163] Finally, apply the mixture of the feature statistical data to the original sample feature through instance normalization (taking the sample feature f i as an example), so as to generate a new additional feature f i ′, achieving the effect of enhancing feature diversity:
[0164]
[0165] The additional feature f i ′ and the original sample feature f i can be used as training samples together to train the source model (classifier).
[0166] To update the source model parameters, the embodiments of this application adopt a supervised classification loss to fine-tune the pre-trained source model (classifier). The whole process is as shown in the process of Figure 5 in Phase I, and the supervised classification loss can be expressed as:
[0167]
[0168] Among them, represents the cross-entropy loss, y i represents the true label, s i represents a test sample in the support set, represents the predicted label.
[0169] Phase II, adaptation during testing:
[0170] During the adaptation process at test time, the online batch data refers to the online streaming data of the target domain. The online batch data is represented as a small batch of unlabeled target domain sample set x = {x1, x2,..., x B}, and the elements in the target domain samples belong to the target domain data. The online batch data can use the backbone network to generate image features for each target domain sample, and then predict the probability value p according to the classifier (the fine-tuned source domain model) i and the pseudo-labels
[0171] The adaptation process at test time is as Figure 5 shown in Phase II of
[0172] First, during the adaptation phase at test time, the embodiment of the present application can maintain a class prototype, which is used to generate source model-based labels for the small batch of target domain samples. The class prototype is initialized using the sample features f of the small sample support set S i , where the sample features f of the small sample support set S i can be extracted through the source domain backbone network (the feature extraction network of the source domain). The class prototype is defined as:
[0173]
[0174] where Π represents the indicator function, which generates a value of 1 if the parameter is true, otherwise it generates a value of 0 represents the initial moment of the class prototype of the c-th class
[0175] During the entire adaptation process at test time, the embodiment of the present application continuously updates the class prototype by merging the selected reliable samples with the pseudo-labels. Specifically, it generates class prototype-based labels and classifier pseudo-labels (classification labels) for each sample, screens the target domain samples that can update the model through the consistency of the two, and updates the model using the supervised cross-entropy loss
[0176] Based on this, the embodiment of the present application provides a method for screening reliable samples - entropy filtering. During the prediction process, the smaller the Shannon entropy value of the prediction value, the more confident the prediction, corresponding to the sample x i whose entropy can be calculated as:
[0177] H(p i ) = -∑(p i ) · log(p i );
[0178] where p i is the predicted probability value of the sample x i
[0179] Subsequently, the embodiments of the present application sort the entropy of all samples in the small batch of unlabeled target domain samples, and select the top α% of the samples with lower entropy to update the class prototypes.
[0180] Finally, the embodiments of the present application use the class prototypes to guide the model update.
[0181] In summary, the test-time adaptation process is as shown in Figure 5 Stage 2 in, where both the online batch data and the small sample support set can be used to extract features through the source domain backbone network (the feature extraction network of the source domain). Among them, the features extracted from the small sample support set are used to initialize the class prototypes, and the features extracted from the online batch data are the batch data features.
[0182] For the batch data features, they can be filtered through an entropy filter to obtain high-confidence batch data features to update the class prototypes. The filtered batch data features are used for prediction through a classifier (the target model, i.e., the fine-tuned source model) and the class prototypes, respectively obtaining classification labels and labels based on the class prototypes. When the classification labels and the labels based on the class prototypes meet the consistency requirements, the corresponding target domain data and its labels are used as reliable samples (s online , y online ), where s online represents the target domain data of the reliable sample, and y online represents the corresponding classification label or the label based on the class prototype. This online sample can be used to guide the update of the target model through the corresponding loss function L online , where L online is used to indicate the similarity between the predicted label of the reliable sample and y online .
[0183] The model training method provided by the embodiments of the present application proposes a two-stage model training framework. Through the fine-tuning source model stage, the source model is quickly adapted to the target domain task, reducing the domain difference; through the online test-time adaptation stage, the fine-tuned model is optimized and updated again using the online target domain streaming data.
[0184] The embodiments of the present application also provide a data annotation method. Please refer to Figure 6 , Figure 6 which is the flowchart of the data annotation method provided by the embodiments of the present application, including:
[0185] 601. Obtain a source model and target domain data, where the source model is trained based on source domain data;
[0186] 602. Obtain N test samples, each test sample including sample data and its corresponding sample label, where the sample data belongs to the target domain data, and N is an integer greater than 1;
[0187] 603. Process the target domain data through the target model to obtain corresponding data labels. The target model is obtained by training the source model based on test samples.
[0188] It can be understood that the data annotation method provided in the embodiments of the present application is implemented based on the target model in the above Figure 3 and Figure 4 corresponding embodiments. By obtaining the source model and the target domain data, then obtaining test samples based on the target domain data, and finally performing annotation processing on the target domain data through the target model obtained by training the source model based on the test samples, corresponding data labels are obtained. Since the target model is trained based on the target domain data, even when there are large differences between the source domain and the target domain, the data labels obtained based on the target model can have good accuracy.
[0189] In a possible implementation method, before processing the target domain data through the target model, an optimization step for the target model may further be included. That is, step 603 specifically includes:
[0190] 6031. Process the target domain data through the source model to obtain the first label;
[0191] 6032. Process the target domain data through the target model to obtain the second label.
[0192] 6033. When the first label and the second label meet the preset conditions, determine the target samples. The target samples include the target domain data and the second label. The preset conditions indicate the consistency between the first label and the second label;
[0193] 6034. Process the target domain data through the optimization model.
[0194] In the embodiments of the present application, before processing the target domain data through the target model, it further includes obtaining target samples based on the target domain data through consistency screening, and optimizing the target model through the target samples, thereby further improving the performance of the target model for target domain tasks. At the same time, since this embodiment further includes an optimization step for the target model, during the process of training the source model based on test samples, only a small number of test samples can be obtained, adhering to the principle of less investment and greater gain, and reducing the blind exploration of the unknown target domain.
[0195] In a possible implementation method, step 602 specifically includes:
[0196] 6021. Sample the target domain data to obtain N sample data, where N is an integer greater than 1;
[0197] 6022, obtain sample labels corresponding to N sample data and determine N test samples.
[0198] In an embodiment of the present application, a method for obtaining a test sample is as follows: after acquiring the target domain data, sampling the target domain data to obtain N sample data; then annotating the sample data through an artificial or machine learning model to obtain corresponding N sample labels, and taking the combination of the sample data and the corresponding sample label as a test sample, and obtaining N test samples in sequence.
[0199] See also Figure 7 The data annotation method provided in the embodiment of the present application can be applied to an image content review system. Figure 7 This is a review flow chart of the image content review system provided in the embodiment of the present application. After obtaining the review image, the review image is input into the image content review system, and the image content review system marks the review image as normal or illegal. The image content review system includes a target model, which is based on the present application. Figure 3 or Figure 4 The model training method in the corresponding embodiment is trained, and based on the target model, the overall effect of the final audit result can be improved, while the operational efficiency can be improved and the model effect can be quickly iterated and optimized.
[0200] The following is an example scenario: On a social media platform, users continue to upload a large number of images (target domain data). In order to ensure the compliance of the platform content, an image content review system is needed to automatically detect and filter illegal content. The review process is as follows:
[0201] Obtaining images for review: Social media platforms select some or all images that need to be reviewed from the images uploaded by users.
[0202] Input to the image content review system: Input the selected image into the trained image content review system. The training process of the review system includes: selecting a part of the images from a batch of images uploaded by users as sample images for classification and annotation to obtain test samples, which include sample images and annotated sample labels; then fine-tuning the source model through the test samples to obtain the target model, which is a classifier model pre-trained through source domain data. The target model is the trained image content review system.
[0203] Labeling process: The pre-trained image content review system will automatically analyze each image, identify the content, and determine whether the content violates the regulations based on predefined rules and algorithms.
[0204] Output: The image content review system marks each image as "normal" or "illegal". For illegal images, the system may give a specific violation type (such as the presence of violence, advertising, bloody images or illegal words, etc.).
[0205] Subsequent processing: Based on the system's annotation results, illegal images can be filtered, deleted, or other appropriate measures can be taken to ensure the compliance of platform content. Normal images can be displayed to users normally. In addition, images with high confidence and their annotation results can also be used as samples to optimize the image content review system.
[0206] The data annotation device in this application is described in detail below. Figure 8 . Figure 8 This is a schematic diagram of an embodiment of a data labeling device 800 in an embodiment of the present application. The data labeling device 800 includes:
[0207] The first acquisition module 801 is used to acquire a source model and target domain data, where the source model is trained based on the source domain data;
[0208] The first sampling module 802 obtains N test samples, each test sample includes sample data and its corresponding sample label, the sample data belongs to the target domain data, and N is an integer greater than 1;
[0209] The labeling module 803 is used to label the target domain data through the target model to obtain corresponding data labels. The target model is obtained by training the source model based on the test sample.
[0210] In a possible implementation method, the labeling module 803 is specifically used to label the target domain data through the source model to obtain a first label; label the target domain data through the target model to obtain a second label; when the first label and the second label meet the preset conditions, determine the target sample, the target sample includes the target domain data and the second label, and the preset condition indicates the consistency between the first label and the second label; train the target model based on the target sample to obtain an optimized model; label the target domain data through the optimized model.
[0211] In a possible implementation method, the first sampling module 802 is specifically used to sample the target domain data to obtain N sample data, where N is an integer greater than 1; obtain sample labels corresponding to the N sample data, and determine N test samples.
[0212] It is understandable that the data annotation device provided in the embodiment of the present application is different from the above Figure 6 For the data labeling method in the corresponding embodiment, please refer to the above for related description, which will not be repeated here.
[0213] The model training device in the present application will be described in detail below. Please refer to Figure 9 . Figure 9 FIG. 5 is a schematic diagram of an embodiment of a model training device 900 in an embodiment of the present application. The model training device 900 includes:
[0214] A second acquisition module 901, configured to acquire a source model and target domain data, where the source model is trained based on source domain data;
[0215] A second sampling module 902, configured to acquire N test samples, each test sample including sample data and its corresponding sample label, the sample data belonging to the target domain data, and N being an integer greater than 1;
[0216] A training module 903, configured to train the source model based on the test samples to obtain a target model, where the target model is used to perform annotation processing on the target domain data to obtain corresponding data labels.
[0217] In a possible implementation method, it further includes:
[0218] An optimization module 904, configured to perform annotation processing on the target domain data through the source model to obtain a first label; perform annotation processing on the target domain data through the target model to obtain a second label; when the first label and the second label meet a preset condition, determine a target sample, where the target sample includes the target domain data and the second label, and the preset condition indicates the consistency between the first label and the second label; train the target model based on the target sample.
[0219] In a possible implementation method, the second sampling module 902 is specifically configured to sample the target domain data to obtain N sample data; acquire the sample labels corresponding to the N sample data, and determine N test samples.
[0220] In a possible implementation method, the training module 903 is specifically configured to perform feature extraction on the test samples to obtain sample features; perform feature combination based on multiple sample features to obtain new features; train the source model based on the sample features and the new features to obtain a target model.
[0221] In a possible implementation method, the training module 903 is specifically configured to annotate the sample data through the source model to obtain a predicted label; train the source model according to a loss function to obtain a target model, where the loss function indicates the similarity between the predicted label and the sample label.
[0222] It can be understood that the model training device provided in the embodiment of the present application corresponds to the model training method in the corresponding embodiments above Figure 3 and Figure 4 . For related descriptions, please refer to the above, and details will not be repeated here.
[0223] Figure 10 This is a schematic diagram of a server structure provided by an embodiment of the present application. The server 300 may vary significantly due to configuration or performance differences, and may include one or more central processing units (CPUs) 322 (for example, one or more processors) and a memory 332, and one or more storage media 330 for storing application programs 342 or data 344 (for example, one or more mass storage devices). Among them, the memory 332 and the storage media 330 may be transient storage or persistent storage. The program stored in the storage media 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the central processing unit 322 may be configured to communicate with the storage media 330 and execute a series of instruction operations in the storage media 330 on the server 300.
[0224] The server 300 may further include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input / output interfaces 358, and / or one or more operating systems 341, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM and so on.
[0225] The steps performed by the server in the above embodiments may be based on the Figure 10 server structure shown.
[0226] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above may refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0227] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0228] In several embodiments provided by this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical, or other forms.
[0229] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0230] In addition, each functional unit in various embodiments of this application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0231] 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 technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of this application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.
[0232] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of various embodiments of this application.
Claims
1. A data annotation method, characterized in that, Including: Obtain a source model and target domain data, where the source model is trained based on source domain data; Obtain N test samples, each of the test samples including sample data and its corresponding sample label, the sample data belonging to the target domain data, and N being an integer greater than 1; Perform annotation processing on the target domain data through a target model to obtain corresponding data labels, where the target model is trained based on the test samples for the source model.
2. A model training method, characterized in that Including: Obtain a source model and target domain data, where the source model is trained based on source domain data; Obtain N test samples, each of the test samples including sample data and its corresponding sample label, the sample data belonging to the target domain data, and N being an integer greater than 1; Train the source model based on the test samples to obtain a target model, where the target model is used to perform annotation processing on the target domain data to obtain corresponding data labels.
3. The method according to claim 2, wherein After training the source model based on the test samples to obtain a target model, it further includes: Perform annotation processing on the target domain data through the source model to obtain a first label; Perform annotation processing on the target domain data through the target model to obtain a second label; When the first label and the second label meet a preset condition, determine a target sample, the target sample including the target domain data and the second label, where the preset condition represents the consistency between the first label and the second label; Train the target model based on the target sample.
4. The method according to claim 2, wherein The obtaining of N test samples includes: Sample the target domain data to obtain N pieces of the sample data; Obtain the sample labels corresponding to the N pieces of the sample data and determine N test samples.
5. The method according to claim 2, wherein The training of the source model based on the test samples to obtain a target model includes: Extract features from the test samples to obtain sample features; Perform feature combination based on multiple sample features to obtain new features; Train the source model based on the sample features and the new features to obtain the target model.
6. The method according to claim 5, characterized in that, The performing of feature combination based on multiple sample features to obtain new features includes: Mix the feature statistics of any two sample features to obtain the new features.
7. The method according to claim 2, wherein The training of the source model based on the test samples to obtain a target model includes: Annotate the sample data through the source model to obtain predicted labels; Train the source model according to a cross-entropy loss function term to obtain a target model, where the cross-entropy loss function term indicates the similarity between the predicted labels and the sample labels.
8. A data annotation device, characterized in that, Including: A first obtaining module, configured to obtain a source model and target domain data, where the source model is trained based on source domain data; A first sampling module, configured to obtain N test samples, each of the test samples including sample data and its corresponding sample label, the sample data belonging to the target domain data, and N being an integer greater than 1; An annotation module for performing annotation processing on the target domain data through a target model to obtain corresponding data labels, where the target model is obtained by training the source model based on the test samples.
9. A model training device, characterized in that, It includes: A second acquisition module for acquiring a source model and target domain data, where the source model is trained based on source domain data; A second sampling module for acquiring N test samples, each test sample including sample data and its corresponding sample label, the sample data belonging to the target domain data, and N being an integer greater than 1; A training module for training the source model based on the test samples to obtain a target model, where the target model is used to perform annotation processing on the target domain data to obtain corresponding data labels.
10. A computer device, characterized in that, It includes: A memory, a transceiver, a processor, and a bus system; Wherein, the memory is used to store programs; The processor is used to execute the programs in the memory, including executing the data annotation method described in claim 1, or executing the model training method described in any one of claims 2 to 7; The bus system is used to connect the memory and the processor to enable communication between the memory and the processor.
Citation Information
Cited By
Intelligent water conservancy Internet of Things data security storage method and system
CN120602229A