Domain adaptive method, domain adaptive component, electronic equipment and readable medium

By adopting the domain adaptation method in model training, the pre-trained initial model adapts from the synthetic domain to the natural domain, solving the problems of insufficient natural sample size and feature label limitation, achieving more efficient model training and better domain adaptation performance.

CN119599091APending Publication Date: 2025-03-11CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411640210.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

During model training, especially when the number of natural samples is small in the application field, existing methods require large amounts of synthetic samples for data amplification, and natural samples with feature labels need to be transferred learning or feature distribution alignment, resulting in limited model accuracy.

Method used

A domain adaptive method is provided to perform domain adaptation from the synthetic domain to the natural domain through a pre-trained initial model, reducing the need for the number of natural domain samples without determining the feature label of natural domain samples. This method is suitable for different feature extraction modules of different pre-trained models by adversarial discriminant training.

Benefits of technology

Domain adaptation from synthetic domain to natural domain is realized, the demand for the number of natural domain samples is reduced, the limitation of feature labels on model accuracy is avoided, and the performance of the model under the adaptive requirements of complex domains is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599091A_ABST
    Figure CN119599091A_ABST
Patent Text Reader

Abstract

The invention provides a field self-adaption method, a field self-adaption assembly, electronic equipment and a readable medium, and belongs to the technical field of computers. The method may be applied to a pre-trained initial model obtained by training on a first sample derived from a synthetic domain. Obtaining a first feature extracted from a second sample by a first feature extraction module in the initial model, wherein the second sample is derived from a natural domain and a synthetic domain; the source domain of the second sample can be judged according to the first feature, the antagonism loss absolute value of the first feature is determined based on the source domain, and the first feature extraction module is updated through gradient inversion in the reverse process with the purpose of maximizing the antagonism loss absolute value. On the basis, the method can realize the domain self-adaption of feature extraction, reduces the requirements on the number of natural domain samples and feature tags, can flexibly cope with the domain self-adaption requirements of a complex model, and can be flexibly applied in a plug-and-play mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of computer technology, and in particular relates to a domain adaptation method, a domain adaptation component, an electronic device, and a computer-readable medium. Background Art

[0002] In the process of model training, a large amount of sample data is usually required to improve the learning effect of the model. When the number of natural samples in the application field is relatively small, data augmentation can be performed on the basis of natural samples, and the training set can be supplemented with a large number of synthetic samples, which usually have feature labels. On this basis, in order to generalize the trained model from synthetic samples to natural samples, a transfer learning method can be used to first train the model based on a large number of synthetic samples to obtain an initial model, and then fine-tune the initial model using natural samples with feature labels; or, a feature distribution alignment method can be used to align the feature distribution of synthetic samples and natural samples in the model through a feature mapping layer, and minimize the feature distribution difference by minimizing the maximum mean discrepancy (MMD), correlation alignment (CORAL) or reducing the Kullback-Leibler (KL) divergence.

[0003] However, transfer learning in the above methods requires natural samples with feature labels, and natural samples are usually small in number and require additional labeling. The size of the dataset and the quality of the labels limit the accuracy of the trained model to a certain extent. When aligning the feature distribution, it is necessary to match the feature distribution of natural samples and synthetic samples and minimize the feature differences. The sample content needs to be fully considered for feature selection. Summary of the invention

[0004] The purpose of the embodiments of the present disclosure is to provide a domain adaptation method, a domain adaptation component, an electronic device and a computer-readable medium, which can achieve domain adaptation of a pre-trained initial model from a synthetic domain to a natural domain, reduce the demand for the number of natural domain samples, and do not need to determine the feature labels of natural domain samples, thereby avoiding limitations on model accuracy. In addition, by conducting targeted adversarial discriminant training on the feature extraction module based on the pre-trained initial model, it is possible to better cope with the domain adaptation needs of complex models, avoid early feature selection and matching calculations, and can be flexibly applied to different feature extraction modules of different pre-trained models in a plug-and-play manner.

[0005] In order to solve the above technical problems, the present disclosure is implemented as follows:

[0006] In a first aspect, the present disclosure provides a domain adaptation method, which can be applied to an initial model, the initial model is obtained by pre-training based on a first sample, the initial model includes a first feature extraction module, the first sample comes from a synthetic domain, the method may include: obtaining a first feature extracted by the first feature extraction module from a second sample, the second sample comes from a natural domain and a synthetic domain; judging a source domain of the second sample based on the first feature; determining an absolute value of an adversarial loss of the first feature based on the source domain, and updating the first feature extraction module by gradient reversal during back propagation with the goal of maximizing the absolute value of the adversarial loss.

[0007] Optionally, the first feature extraction module is updated by gradient reversal during the back propagation process with the purpose of maximizing the absolute value of the adversarial loss, including: dynamically adjusting the back propagation coefficient with the absolute value of the adversarial loss; adjusting the reverse gradient with the back propagation coefficient; and updating the first feature extraction module based on the reverse gradient with the purpose of maximizing the absolute value of the adversarial loss.

[0008] Optionally, the back propagation coefficient is dynamically adjusted using the absolute value of the adversarial loss, including: when the absolute value of the adversarial loss is greater than or equal to a difficulty threshold, using a first value as the back propagation coefficient, the first value being greater than the difficulty threshold; when the absolute value of the adversarial loss is less than the difficulty threshold, comparing the first value with the absolute value of the adversarial loss to obtain a second value, and determining the back propagation coefficient based on the second value.

[0009] Optionally, determining the back propagation coefficient according to the second numerical value includes: obtaining a gradient overflow threshold; and taking a minimum value between the second numerical value and the gradient overflow threshold as the back propagation coefficient.

[0010] Optionally, the initial model also includes a classification layer, the first sample includes a feature label, and the pre-training step of the initial model includes: in the initial model, a first feature extraction module extracts a second feature from the first sample, and the classification layer determines a predicted label of the first sample based on the second feature; based on the predicted label and the feature label, a prediction loss corresponding to the second feature is determined, and the first feature extraction module and the classification layer are updated with the purpose of minimizing the prediction loss.

[0011] Optionally, the initial model also includes a second feature extraction module, a feature fusion module and a classification layer, the first sample includes a feature label, and the pre-training step of the initial model includes: in the initial model, the first feature extraction module extracts the second feature from the first sample, the second feature extraction module extracts the third feature from the first sample, and the feature fusion module fuses the second feature and the third feature to obtain a fused feature; the classification layer determines the predicted label of the first sample based on the fused feature; the prediction loss corresponding to the second feature is determined based on the predicted label and the feature label, and the first feature extraction module, the second feature extraction module, the feature fusion module and the classification layer are updated with the purpose of minimizing the prediction loss.

[0012] Optionally, before determining the source domain of the second sample according to the first feature, the method further includes: performing convolution processing on the first feature.

[0013] In the second aspect, the present disclosure provides a domain adaptation component, which is applied to an initial model. The initial model is obtained by pre-training based on a first sample, and the first sample comes from a synthetic domain. The initial model includes a first feature extraction module. The component may include: a feature acquisition module, which is used to obtain a first feature extracted by the first feature extraction module from a second sample, and the second sample comes from a synthetic domain and a natural domain; a domain classification module, which is used to determine the source domain of the second sample based on the first feature; a gradient reversal module, which is used to determine the absolute value of the adversarial loss of the first feature based on the source domain, and update the first feature extraction module by gradient reversal during the back propagation process with the purpose of maximizing the absolute value of the adversarial loss.

[0014] Optionally, the gradient reversal module is specifically used to dynamically adjust the back propagation coefficient with the absolute value of the adversarial loss; adjust the reversal gradient with the back propagation coefficient; and update the first feature extraction module based on the reversal gradient with the purpose of maximizing the absolute value of the adversarial loss.

[0015] Optionally, the gradient reversal module is specifically used to use a first value as a back propagation coefficient when the absolute value of the adversarial loss is greater than or equal to a difficulty threshold, and the first value is greater than the difficulty threshold; when the absolute value of the adversarial loss is less than the difficulty threshold, the first value is compared with the absolute value of the adversarial loss to obtain a second value, and the back propagation coefficient is determined according to the second value.

[0016] Optionally, the gradient reversal module is specifically used to obtain a gradient overflow threshold; and take the minimum value between the second value and the gradient overflow threshold as the back propagation coefficient.

[0017] Optionally, the feature acquisition module is further used to perform convolution processing on the first feature.

[0018] In a third aspect, the present disclosure provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the domain adaptation method of the first aspect.

[0019] In a fourth aspect, the present disclosure provides a computer-readable medium storing a program or instruction, which, when executed by a processor, implements the steps of the domain adaptation method of the first aspect.

[0020] In a fifth aspect, the present disclosure provides a chip, comprising a processor and a communication interface, wherein the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the steps of the domain adaptation method of the first aspect.

[0021] In a sixth aspect, the present disclosure provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute steps for implementing the domain adaptation method of the first aspect.

[0022] The present disclosure provides a domain adaptation method, a domain adaptation component, an electronic device and a computer-readable medium. The method can be applied to a pre-trained initial model, which is obtained by training on a first sample from a synthetic domain. The first feature extracted by the first feature extraction module in the initial model from the second sample is obtained, and the second sample is derived from the natural domain and the synthetic domain; then the source domain of the second sample can be determined according to the first feature, and the absolute value of the adversarial loss of the first feature can be determined based on the source domain, and the first feature extraction module is updated by gradient reversal in the reverse process with the purpose of maximizing the absolute value of the adversarial loss. Based on this, the method can realize the domain adaptation of the pre-trained initial model from the synthetic domain to the natural domain, reduce the demand for the number of natural domain samples, and do not need to determine the feature labels of the natural domain samples, avoiding its limitation on the accuracy of the model, and on the basis of the pre-trained initial model, by conducting adversarial discriminant training on the feature extraction module, it can better cope with the domain adaptation needs of complex models, avoid the early feature selection and matching calculations, and can be flexibly applied to different feature extraction modules of different pre-trained models in a plug-and-play manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 One of the step flow charts of the domain adaptation method provided in the embodiment of the present disclosure;

[0024] Figure 2 A structural block diagram of a domain adaptation component provided in an embodiment of the present disclosure;

[0025] Figure 3One of the schematic diagrams of an application framework of a domain adaptation component provided in an embodiment of the present disclosure;

[0026] Figure 4 A second schematic diagram of an application framework of a domain adaptation component provided in an embodiment of the present disclosure;

[0027] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure;

[0028] Figure 6 A hardware schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0030] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0031] Figure 1 This is one of the step flow charts of the domain adaptation method provided in the embodiment of the present disclosure. Figure 1 As shown, the method can be applied to an initial model, the initial model is obtained by pre-training based on a first sample, the initial model includes a first feature extraction module, and the first sample comes from a synthetic domain.

[0032] In the disclosed embodiment, the domain adaptation can be performed on the first feature extraction module of the initial model. The initial model is trained based on the first sample from the synthetic domain. The initial model may include at least one feature extraction module, each used to extract a corresponding feature vector on the first sample. In the initial model, the domain adaptation is performed on the first feature module to improve the generalization performance of the model.

[0033] The sample data in the synthetic domain refers to the sample data obtained by post-generation or processing with reference to the directly collected sample data, and the corresponding natural domain refers to the directly collected sample data. The sample data can be image, text or voice data, etc.

[0034] Taking image data as an example, if the training task of the initial model is to identify image distortion, the image data in the natural domain can be directly extracted from the captured images or videos. At this time, the distortion of the image data is usually caused by factors such as the camera equipment or the external environment, while the image data in the synthetic domain can introduce or generate distortion based on the image data in the natural domain through specific algorithms or processing steps.

[0035] In the embodiments of the present disclosure, the aforementioned image data are only examples, and those skilled in the art may determine sample data based on actual needs, such as forged facial images in the synthetic domain and collected facial images in the natural domain, spliced ​​or generated information text in the synthetic domain and media collected information text in the natural domain, forged customer service voice in the synthetic domain and collected customer service voice in the natural domain, etc. The embodiments of the present disclosure do not impose specific restrictions on this.

[0036] On this basis, there are inter-domain differences in data distribution between the image data in the synthetic domain and the natural domain, and this inter-domain difference has different effects on different types of features. The initial model is pre-trained on the first sample in the synthetic domain so that it can fully learn the feature space distribution of the first sample. On this basis, the domain adaptation method provided by the embodiment of the present disclosure can be used to selectively implement transfer learning from the synthetic domain to the natural domain for the feature selection module, thereby reducing the impact of inter-domain differences on the performance of the initial model and improving the versatility of the initial model. During the domain adaptation process, other network structures or modules in the initial model can have fixed parameters and do not participate in adversarial training. Specifically, the method may include the following steps 101 to 103.

[0037] Step 101: Obtain a first feature extracted by a first feature extraction module from a second sample, where the second sample comes from a natural domain and a synthetic domain.

[0038] In the disclosed embodiment, a second sample may be used to perform domain adaptation of the first feature extraction module, which includes sample data from the natural domain and the synthetic domain. Normally, the sample data from the synthetic domain in the second sample matches the sample data from the natural domain in quantity. The sample data from the synthetic domain in the second sample may be different from the first sample data. It is known that each piece of sample data in the second sample comes from the synthetic domain or the natural domain, and can be distinguished by setting a domain label. When the first feature extraction module extracts the first feature from the second sample, it may be extracted from the sample data from the synthetic domain or from the sample data from the natural domain. Since the initial model is trained on the first sample from the synthetic domain, there are certain differences in the performance of the first feature extraction module on the sample data from the synthetic domain and the natural domain.

[0039] Step 102: Determine the source domain of the second sample according to the first feature.

[0040] Furthermore, analysis can be performed based on the difference in the performance of the first feature between domains to determine the source domain to which the second sample from which the first feature is extracted belongs. The source domain may be a synthetic domain or a natural domain.

[0041] Step 103: determine the absolute value of the adversarial loss of the first feature based on the source domain, and update the first feature extraction module by gradient reversal during the back propagation process with the goal of maximizing the absolute value of the adversarial loss.

[0042] It can be seen that the identification of the source domain is achieved based on the inter-domain differences represented by the first feature, and the purpose of domain adaptation is to make the first feature extracted by the first feature extraction module closer to the domain-invariant features of the synthetic domain and the natural domain, and to perform adversarial training based on this.

[0043] In the disclosed embodiment, the adversarial loss of the first feature can be first determined based on the source domain, and the adversarial loss is used to describe the error of the source domain predicted for the second sample based on the first feature relative to the domain label in the second sample. During the calculation process, since the adversarial loss may take a negative value, the adversarial loss can be processed as its absolute value. During adversarial training, the absolute value of the adversarial loss is used as the goal, and the first feature extraction module is updated by gradient reversal during the back propagation process, so that the first feature extraction module can learn the domain-invariant features of the synthetic domain and the natural domain. When the absolute value of the adversarial loss is the largest, it can be considered that the first feature extracted from the second sample by the first feature extraction module has sufficient domain invariance, thereby confusing the domain classification of the synthetic domain and the natural domain, and realizing transfer learning from the synthetic domain to the natural domain.

[0044] In an optional method embodiment of the present disclosure, in the aforementioned step 103, updating the first feature extraction module by gradient reversal during the back propagation process with the purpose of maximizing the absolute value of the adversarial loss may include the following steps A1 to A3.

[0045] Step A1: Dynamically adjust the back propagation coefficient based on the absolute value of the adversarial loss.

[0046] Step A2: adjust the reverse gradient using the back propagation coefficient.

[0047] Step A3: updating the first feature extraction module based on the reverse gradient with the goal of maximizing the absolute value of the adversarial loss.

[0048] In the disclosed embodiment, gradient reversal is used to guide the first feature extraction module to ignore the domain differences of the extracted features and pay more attention to domain invariance when back-propagating the adversarial loss of domain classification to the first feature extraction module. Among them, the first feature extracted by the first feature extraction module can be directly classified by the domain, and the adjustment process is performed by reversing the gradient when the adversarial loss of domain classification is back-propagated. When the adversarial loss is negative, based on the absolute value of the adversarial loss, the reversed gradient can automatically reverse the gradient direction during the back-propagation process to achieve adversarial training that maximizes the absolute value of the adversarial loss in the first feature extraction module and minimizes the absolute value of the adversarial loss during the domain classification process.

[0049] Among them, the reversal gradient can be obtained by adjusting the back propagation coefficient. In the embodiment disclosed in the present invention, the back propagation coefficient can be dynamically adjusted and determined based on the absolute value of the adversarial loss. Normally, in order to maximize the absolute value of the adversarial loss of the first feature extraction module, the reversal gradient can be adjusted to be larger when the absolute value of the adversarial loss is smaller, that is, the larger the back propagation coefficient, the larger the adjustment gradient. Because, the smaller the absolute value of the adversarial loss, the easier it is for the domain classification to distinguish the source domain of the second sample more accurately, which means that the difference between the extracted first feature domains is large, the domain invariance is low, and the difficulty of domain adaptation is greater. At this time, by improving the reversal gradient to guide the first feature module to pay attention to the sample data, it is possible to deeply explore the sample data with difficult feature alignment, and further improve the robustness of the model domain adaptation.

[0050] In an optional method embodiment of the present disclosure, the aforementioned step A1 may include the following steps B1 to B2.

[0051] Step B1: When the absolute value of the adversarial loss is greater than or equal to the difficulty threshold, the first value is used as the back propagation coefficient, and the first value is greater than the difficulty threshold.

[0052] Step B2: When the absolute value of the adversarial loss is less than the difficulty threshold, a second value is obtained by comparing the first value with the absolute value of the adversarial loss, and a back propagation coefficient is determined according to the second value.

[0053] In the disclosed embodiment, a difficulty threshold may also be set for the second sample. The difficulty threshold is used to determine the difficulty of domain classification of the sample. The difficulty threshold may be set according to the degree of difference in feature distribution between domains, or may be set according to experiments or experience. When the absolute value of the adversarial loss is greater than or equal to the difficulty threshold, it indicates that the confusion degree of the domain classification is high, and the first feature extraction module can effectively extract domain invariant features. At this time, the pre-set first value may be used as the back propagation coefficient. Among them, the first value may be set to be greater than the difficulty threshold.

[0054] Furthermore, when the absolute value of the adversarial loss is less than the difficulty threshold, it means that the difficulty of classification in this field is relatively small, and it is necessary to increase the gradient to guide the first feature extraction module to pay attention to the sample data and train in the direction of increasing the absolute value of the adversarial loss. At this time, the second value can be determined by comparing the first value with the adversarial loss value. Since the first value is greater than the difficulty threshold, the adversarial loss value must be less than the first value when it is less than the difficulty threshold. When the adversarial loss value is less than the first value, the smaller the adversarial loss value, the larger the second value for comparison, so that the back propagation coefficient can be dynamically adjusted to increase, thereby increasing the inversion gradient to guide the focus of the first feature extraction module.

[0055] In an optional method embodiment of the present disclosure, determining the reverse transmission coefficient according to the second data value in the aforementioned step B2 may include the following steps C1 to C2.

[0056] Step C1: Obtain a gradient overflow threshold.

[0057] Step C2: taking the minimum value between the second value and the gradient overflow threshold as the back propagation coefficient.

[0058] In the disclosed embodiment, gradient overflow refers to the situation in which the error gradient accumulates during the update during the training process, causing the network to be unstable and even to explode and overflow. The gradient overflow threshold can be set in advance, and the upper limit of the back propagation coefficient can be controlled to limit the size of the reverse gradient, thereby avoiding too many gradients during the back propagation process. On the basis of obtaining the second value, the gradient overflow threshold can be further obtained and the size of the second value and the gradient overflow threshold can be judged. When the second value is less than the gradient overflow threshold, the second value is used as the back propagation coefficient. When the second value is greater than the gradient overflow threshold, the gradient overflow threshold is used as the back propagation coefficient, so that the back propagation coefficient is taken within a reasonable range.

[0059] It should be noted that the setting of the above-mentioned difficulty threshold, first value, gradient overflow threshold and other parameter values ​​can be set by those skilled in the art based on actual sample distribution, processing conditions and statistical requirements. The numerical relationship thereof can be consistent with the above description, and the embodiments of the present disclosure do not limit the specific values.

[0060] In an optional method embodiment of the present disclosure, the following step D may be included before the aforementioned step 102.

[0061] Step D: perform convolution processing on the first feature.

[0062] In the disclosed embodiment, since the first feature extracted by the first feature extraction module corresponds to the training task, its inter-domain property is relatively low. Therefore, the first feature can be further convolved before domain classification to extract its domain-related feature information based on the first feature, thereby assisting the processing of domain classification. Based on this convolution processing, the antagonism between the domain classification and the first feature extraction module can be further improved, thereby enhancing the robustness of the first feature extraction module after domain adaptation.

[0063] In the disclosed embodiment, the initial model may be an algorithm model obtained by training on the first sample in the synthetic domain by building a network structure based on the training task. The initial model may include a feature extraction module, and the number of feature extraction modules may be one or more than two, and each feature extraction module may be used to extract corresponding features of the input sample data. For example, taking image data as an example, the feature extraction module may extract semantic features, color features, edge features, texture features, etc. representing the image content, and may also extract image features targeted at the training task, such as extracting distortion features when the training task is image distortion detection, and extracting facial key point features when the training task is face detection, etc.

[0064] On this basis, the initial model includes a feature extraction module, and when the influence of the difference in feature distribution between the synthetic domain and the natural domain sample data on the model performance exceeds the error tolerance range, the feature extraction module can be used as the first feature extraction module based on the pre-training and executed as follows Figure 1 The domain adaptation method shown performs alignment so that the first feature extraction module can learn domain-invariant features between synthetic and natural domains.

[0065] Based on the requirements of the training task, the initial model may further include a classification layer based on the first feature extraction module for subsequent domain adaptation, and the first sample also includes a feature label. The pre-training step of the initial model may include the following steps E1 to E2.

[0066] Step E1: In the initial model, a first feature extraction module extracts a second feature from a first sample, and a classification layer determines a predicted label of the first sample based on the second feature.

[0067] In the disclosed embodiment, the first feature extraction module in the initial model can be constructed using a feature extraction network such as a ResNet50 network or a VGG network, and the classification layer can be constructed using a multi-layer perceptron network. During the pre-training process, the first feature extraction module extracts the second feature from the first sample, and the second feature is passed to the classification layer for nonlinear feature mapping to the corresponding prediction label.

[0068] Step E2: determining the prediction loss corresponding to the second feature based on the prediction label and the feature label, and updating the first feature extraction module and the classification layer with the goal of minimizing the prediction loss.

[0069] Furthermore, the first sample carries a known feature label. The prediction loss of the initial model for the first sample based on the second feature can be determined through the predicted label and the feature label, and then the first feature extraction layer and the classification layer are updated with the purpose of minimizing the prediction loss. The pre-training process ends when the initial model converges.

[0070] It should be noted that when the initial model includes multiple feature extraction modules, the initial model may also include a feature fusion module to perform prediction after fusing different features extracted by the multiple feature extraction modules. Each feature extraction module may be independently used as a first feature extraction module for domain adaptation to learn domain-invariant features in the synthetic domain and the natural domain, respectively.

[0071] Alternatively, the initial model may have features corresponding to some feature extraction modules that are similarly distributed between domains, or the differences in distribution between domains are within the error tolerance range, based on the inclusion of multiple feature extraction modules. In this case, the feature modules in the initial model can be used as the second feature extraction modules and do not participate in the subsequent domain adaptation processing. In this case, the initial model may include a second feature extraction module, a feature fusion module, a classification layer, etc. that do not participate in the subsequent domain adaptation based on the first feature extraction module that participates in the domain adaptation. The pre-training step of the initial model may include the following steps F1 to F3.

[0072] Step F1: In the initial model, the first feature extraction module extracts the second feature from the first sample, the second feature extraction module extracts the third feature from the first sample, and the feature fusion module fuses the second feature with the third feature to obtain a fused feature.

[0073] In the disclosed embodiment, the second feature extraction module may also be constructed using a feature extraction network such as a ResNet50 network, a VGG network, and may further include structures such as a convolutional layer and a pooling layer. Based on the type of features extracted, the network structure of the second feature extraction module may be the same as or different from that of the first feature extraction module. At this time, after the first feature extraction module extracts the second feature from the first sample and the second feature extraction module extracts the third feature from the first sample, the second feature and the third feature may be passed to the feature fusion module for fusion processing to obtain a fused feature. The feature fusion module may connect the second feature and the third feature, or may process them through an attention network based on the connection, and may further capture the correlation between the second feature and the third feature through a fully connected layer. The disclosed embodiment does not impose specific restrictions on the implementation of the feature fusion module.

[0074] Step F2: The classification layer determines the predicted label of the first sample based on the fused features.

[0075] In the disclosed embodiment, the fused features are transmitted to the classification layer and then nonlinear feature mapping is performed to the corresponding prediction labels. The classification layer can be constructed by a multi-layer perceptron network.

[0076] Step F3: determine the prediction loss corresponding to the second feature based on the prediction label and the feature label, and update the first feature extraction module, the second feature extraction module, the feature fusion module and the classification layer with the goal of minimizing the prediction loss.

[0077] Furthermore, the first sample carries a known feature label. The prediction loss of the initial model for the first sample based on the fused features can be determined through the predicted label and the feature label, and then the first feature extraction module, the second feature extraction module, the feature fusion module and the classification layer are updated with the purpose of minimizing the prediction loss. The pre-training process ends when the initial model converges.

[0078] The domain adaptation method provided by the present disclosure can be applied to a pre-trained initial model, which is obtained by training on a first sample from a synthetic domain. The first feature extracted from the second sample by the first feature extraction module in the initial model is obtained, and the second sample is derived from the natural domain and the synthetic domain; then the source domain of the second sample can be judged according to the first feature, and the absolute value of the adversarial loss of the first feature can be determined based on the source domain, and the first feature extraction module is updated by gradient reversal in the reverse process with the purpose of maximizing the absolute value of the adversarial loss. Based on this, the method can realize the domain adaptation of the pre-trained initial model from the synthetic domain to the natural domain, reduce the demand for the number of natural domain samples, and do not need to determine the feature labels of the natural domain samples, avoiding its limitation on the accuracy of the model, and by conducting adversarial discriminant training on the feature extraction module on the basis of the pre-trained initial model, it can better cope with the domain adaptation needs of complex models, avoid the early feature selection and matching calculations, and can be flexibly applied to different feature extraction modules of different pre-trained models in a plug-and-play manner.

[0079] Figure 2 A structural block diagram of a domain adaptation component 200 provided in an embodiment of the present disclosure, wherein the component 200 is applied to an initial model, wherein the initial model is obtained by pre-training based on a first sample, wherein the first sample originates from a synthetic domain, and the initial model includes a first feature extraction module, wherein the component 200 may include: a feature acquisition module 201, for acquiring a first feature extracted by the first feature extraction module from a second sample, wherein the second sample originates from a synthetic domain and a natural domain; a domain classification module 202, for determining a source domain of the second sample based on the first feature; and a gradient reversal module 203, for determining an absolute value of an adversarial loss of the first feature based on the source domain, and updating the first feature extraction module by gradient reversal during back propagation with the purpose of maximizing the absolute value of the adversarial loss.

[0080] In an optional embodiment of the present disclosure, the gradient reversal module 203 is specifically used to dynamically adjust the back propagation coefficient with the absolute value of the adversarial loss; adjust the reversal gradient with the back propagation coefficient; and update the first feature extraction module based on the reversal gradient with the purpose of maximizing the absolute value of the adversarial loss.

[0081] In an optional embodiment of the present disclosure, the gradient reversal module 203 is specifically used to use a first value as a back propagation coefficient when the absolute value of the adversarial loss is greater than or equal to the difficulty threshold, and the first value is greater than the difficulty threshold; when the absolute value of the adversarial loss is less than the difficulty threshold, the first value is compared with the absolute value of the adversarial loss to obtain a second value, and the back propagation coefficient is determined according to the second value.

[0082] In an optional embodiment of the present disclosure, the gradient reversal module 203 is specifically configured to obtain a gradient overflow threshold; and take a minimum value between the second value and the gradient overflow threshold as a back propagation coefficient.

[0083] In an optional embodiment of the present disclosure, the feature acquisition module 201 is further configured to perform convolution processing on the first feature.

[0084] The domain adaptation component provided by the present disclosure can be applied to a pre-trained initial model, which is obtained by training on a first sample from a synthetic domain. The first feature extracted from the second sample by the first feature extraction module in the initial model is obtained, and the second sample is derived from the natural domain and the synthetic domain; then the source domain of the second sample can be judged according to the first feature, and the absolute value of the adversarial loss of the first feature can be determined based on the source domain, and the first feature extraction module is updated by gradient reversal in the reverse process with the purpose of maximizing the absolute value of the adversarial loss. Based on this, the method can realize the domain adaptation of the pre-trained initial model from the synthetic domain to the natural domain, reduce the demand for the number of natural domain samples, and do not need to determine the feature labels of the natural domain samples, avoiding its limitation on the accuracy of the model, and by conducting adversarial discriminant training on the feature extraction module on the basis of the pre-trained initial model, it can better cope with the domain adaptation needs of complex models, avoid the early feature selection and matching calculations, and can be flexibly applied to different feature extraction modules of different pre-trained models in a plug-and-play manner.

[0085] In the disclosed embodiments, a blind image quality assessment model (BIQA, Blind Image Quality Assessment) is used for illustrative purposes. This model is used to score image quality in the absence of a reference image, and can be widely used in scenarios where the original image is not available. Generally, image distortion is an important indicator for quality assessment, and the image distortion data set in the natural domain is relatively small, which limits the accuracy of the blind image quality assessment model to a certain extent. On this basis, sample amplification can be performed by manually or automatically introducing or processing the image distortion data of the synthetic domain on ordinary images. However, the image distortion data in the synthetic domain and the natural domain may have certain inter-domain feature differences due to the different ways in which the distortion is caused. The following method can be used: Figure 2 The domain adaptation component shown is plug-and-play and flexible for adversarial training to achieve feature alignment.

[0086] Figure 3 This is one of the schematic diagrams of an application framework of a domain adaptation component provided by an embodiment of the present disclosure. Figure 3As shown, the blind image quality assessment model 310 includes a distortion feature extraction module 311 and a classification layer 312. The distortion feature extraction module 311 is used to extract the distortion features of the distortion information in the image distortion data; the classification layer 312 is used to perform quality regression based on the distortion features, and map the distortion features to the corresponding quality assessment score to determine the distortion type and distortion level of the image distortion data.

[0087] For example, in the pre-training process, the TID2013 dataset can be used as the first sample, which includes 25 reference images and more than 3,000 distorted images, each of which corresponds to 24 distortion types, and each distortion type includes 5 distortion levels. The distortion feature extraction module 311 may include a feature extraction network to extract N layers of multi-scale features {F d0}, and then {F d0} respectively input a convolution layer with a convolution kernel size of 1×1, a step size of 1, and a channel of C1 to obtain multi-scale features {F d1}; Then, an adaptive pooling layer is used to transform the multi-scale features {F d1}Downsample to the minimum feature size to obtain features of the same scale {F d2}; Finally, the same scale features {F d2} to obtain the output distortion characteristics {F d}.

[0088] Based on the output distortion feature {F d}, the classification layer 312 can perform probability prediction on the quality prediction score representing information such as the distortion type and the distortion level, and determine the prediction loss based on the loss function shown in the following formula (1):

[0089]

[0090] Where i represents the i-th synthetic distorted image, b i is the synthetic distorted image a i The actual probability of belonging to a distortion class, f θ (·) is the predicted probability that the synthetic distorted image belongs to a distortion category, and S(·) is the softmax function.

[0091] On this basis, the Adam algorithm is used for end-to-end training with the purpose of minimizing the prediction loss, and the network weights of the distortion feature extraction module 311 and the classification layer 312 are updated until the blind image quality assessment model 310 converges, thus ending the pre-training process.

[0092] The domain adaptation component 320 includes a feature acquisition module 321, a domain classification module 322, and a gradient reversal layer 323, wherein the gradient reversal layer 323 is located between the feature acquisition module 321 and the domain classification module 322. The feature acquisition module 321 is used to acquire the distortion features extracted by the distortion feature extraction module 311, the domain classification module 322 predicts the source domain of the sample data based on the distortion features, and the gradient reversal layer 323 is used to directly transfer the distortion features to the domain classification module 322 during forward propagation, and to perform gradient reversal on the adversarial loss transferred by the domain classification module 322 during back propagation. The domain adaptation component 320 has a plug-and-play feature and can be flexibly connected to the distortion feature extraction module 311 in the blind image quality assessment model 310 to perform domain adaptation on the distortion feature extraction module 311.

[0093] In the process of domain adaptation, the synthetic domain can be With natural domain The second sample is input into the pre-trained blind image quality assessment model 310, and the distortion feature extraction module 311 performs feature extraction. The synthetic domain can select a synthetic distorted image dataset including multiple distortion types, such as the PIPAL dataset; the natural domain can select a natural distortion dataset, such as the KonIQ-10k dataset. The sample data in the natural domain does not require feature labels for distortion types. The distortion feature extraction module 311 extracts the distortion features. The natural features of the synthetic domain can be extracted Distortion characteristics with natural domain

[0094] The feature acquisition module 321 in the domain adaptation component 320 may include a first convolution layer, a ReLU activation function, and a second convolution layer, and the size of the first convolution layer and the second convolution layer is 3×3, the step size is 1, and the channel is C2. The feature acquisition module 321 can obtain the natural features of the synthetic domain output by the distortion feature extraction module 311 Distortion characteristics with natural domain Output after convolution processing.

[0095] Between the feature acquisition module 321 and the domain classification module 322, the gradient reversal layer 323 converts the distorted features of the synthetic domain into Distortion characteristics with natural domain It is passed to the domain classification module 322, and its forward propagation is defined as shown in the following formula (2):

[0096] R # (v)=v (2)

[0097] Among them, v is the input distortion feature, R #is the forward propagation function performed by the gradient reversal layer 323.

[0098] Domain classification module 322 based on distortion features of synthetic domain Distortion characteristics with natural domain The source domain is predicted and the adversarial loss is determined using the loss function shown in the following formula (3):

[0099]

[0100] Among them, D i represents the domain label of the i-th distorted image, when D i When D is equal to 0, the sample data comes from the synthetic domain. i When it is equal to 1, the sample data comes from the natural domain; Represents the predicted value of the position u,v of the distorted feature output by the gradient reversal layer 323 of the i-th distorted image.

[0101] After obtaining the adversarial loss, during the back propagation process, the back propagation coefficient -λ can be used to %d. The reverse gradient is adjusted so that the gradient in the back propagation has the opposite sign to that in the forward propagation to confuse the domain classification module 322. The back propagation is defined as shown in the following formula (4):

[0102]

[0103] Where I is the identity matrix, -λ %d. is the back propagation coefficient.

[0104] The-λ %d. Can be based on adversarial loss Dynamic adjustment is performed, as shown in the following formula (5):

[0105]

[0106] Among them, L d yes The absolute value of ; α is the difficulty threshold, which can be set to 0.1; β is the gradient overflow threshold, which can be set to 30; λ0 is the first data, which can be set to 1.

[0107] On this basis, in the process of back propagation, by dynamically adjusting the back propagation coefficient in the gradient reversal layer 323, and then adaptively and dynamically adjusting the reversal gradient, targeted attention can be paid to sample data that is difficult to mine due to domain invariance, so as to improve the domain adaptation effect. Between the domain classification module 322 and the distortion feature extraction module 311, the SGD optimization algorithm is used to perform end-to-end adversarial training to update the distortion feature extraction module 311 to achieve domain adaptation.

[0108] In the process of reasoning application, the domain adaptation component 320 can be removed, and only the blind image quality assessment model 310 with domain adaptation weights is retained to perform the reasoning task. For the input blind image x, the distortion feature F is generated by the distortion feature extraction module 311, and the quality assessment score of the blind image x is obtained by the classification layer 312.

[0109] Figure 4 The second schematic diagram of an application framework of a domain adaptation component provided in an embodiment of the present disclosure. Figure 4 As shown, the blind image quality assessment model 410 includes a distortion feature extraction module 411, a semantic feature extraction module 412, a feature fusion module 413 and a classification layer 414. The distortion feature extraction module 411 is used to extract the distortion features of the distortion information in the image distortion data; the semantic feature extraction module 412 is used to extract the semantic features of the content information in the image distortion data; the feature fusion module 413 is used to obtain the fusion features after fusing the distortion features with the semantic features; the classification layer 414 is used to perform quality regression based on the fusion features, and map the distortion features to the corresponding quality assessment scores to determine the distortion type and distortion level of the image distortion data.

[0110] Exemplarily, during the pre-training process, the distortion feature extraction module 411 obtains the distortion feature {F d} can refer to the above Figure 3 In order to avoid repetition, the description of the distortion feature extraction module 311 is not repeated here. In an optional embodiment of the present disclosure, the distortion feature extraction module 411 can also be pre-trained using the PIPAL dataset, which includes 200 reference images, 40 distortion types, 23,000 distorted images, and more than 1 million quality ratings.

[0111] The semantic feature extraction module 412 may use the CIFAR-100 dataset as a first sample, which includes 100 semantic content categories, each of which includes 600 image data. Alternatively, the PIPAL dataset may be used. The semantic feature extraction module 412 may include a feature extraction network to extract N layers of multi-scale features {F M0}, and then {F M0} respectively input a convolution layer with a convolution kernel size of 1×1, a step size of 1, and a channel of C1 to obtain multi-scale features {F M1}; Then, an adaptive pooling layer is used to transform the multi-scale features {F M1}Downsample to the minimum feature size to obtain features of the same scale {F M2}; Finally, the same scale features {F M2} to obtain the output semantic features {F M}.

[0112] The feature fusion module 413 receives the transmitted distortion feature {F d}, semantic features {F M}, {F d}、{F M} to connect and obtain the connection characteristics {F Md0}, and then the CBAM (Convolutional Block Attention Module) network is used to enhance the {F Md0} to capture key information and output fusion features {F Md0}.

[0113] The classification layer 414 can be constructed based on a two-layer perceptron network, based on the fusion feature {F Md0} Probabilistically predict the quality prediction score of the information representing the distortion type, distortion level, etc., and determine the prediction loss based on the loss function shown in the following formula (6):

[0114]

[0115] Where i represents the i-th synthetic distorted image, L represents the number of synthetic distorted images, represents the quality prediction score of the i-th synthetic distorted image, Represents the quality score label of the i-th synthetic distorted image.

[0116] On this basis, the Adam algorithm is used for end-to-end training with the purpose of minimizing the prediction loss, and the network weights of the distortion feature extraction module 411, the semantic feature extraction module 412, the feature fusion module 413 and the classification layer 414 are updated until the blind image quality assessment model 410 converges, thus ending the pre-training process.

[0117] The domain adaptation component 420 includes a feature acquisition module 421, a domain classification module 422, and a gradient reversal layer 423. The domain adaptation component and the domain adaptation process may correspond to the aforementioned Figure 3 To avoid repetition, the related description of the domain adaptation component 320 is not repeated here.

[0118] In the process of reasoning application, the domain adaptation component 420 can be removed, and only the blind image quality assessment model 410 with domain adaptation weights is retained to perform the reasoning task. For the input blind image x, the distortion feature F is generated by the distortion feature extraction module 411, and the semantic feature K is generated by the semantic feature extraction module 412. Then, the semantic feature K and the distortion feature F are fused into the fused feature KF by the feature fusion module 413, and the quality assessment score of the blind image x is obtained by the classification layer 414.

[0119] In the disclosed embodiment, the initial model is taken as a blind image quality assessment model as an example, and an application scheme of domain adaptation from synthetic distortion to natural distortion is illustrated. The distortion feature alignment of the distortion feature extraction module from the synthetic domain to the natural domain is flexibly realized through the plug-and-play domain adaptation component, which effectively improves the generalization performance of the blind image quality assessment model, so that it has a high subjective consistency in the quality assessment of natural images. At the same time, the blind image quality assessment model can also extract the semantic features representing the image content information and the distortion features representing the image distortion information respectively through the multi-branch feature extraction module; the accuracy of feature extraction is improved through pre-training, and the influence of multi-dimensional features on the degree of image degradation is fully explored to simulate the perceptual characteristics of the human visual system; and the gradient reversal layer performs adversarial mining through dynamic back propagation coefficients, does not require feature labels, and can better focus on sample data with high confusion difficulty, effectively improving the transfer learning ability of the blind image quality assessment model.

[0120] The above-mentioned blind image quality assessment model is only used as an example. Those skilled in the art may construct a sample data set, a model network structure, etc. according to the actual reasoning task requirements, and the embodiments of the present disclosure do not impose any specific restrictions on this.

[0121] Figure 5 A schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present disclosure is shown in FIG. Figure 5 As shown, the electronic device 500 may include a processor 501, a memory 502, and a program or instruction stored in the memory 502 and executable on the processor 501. When the program or instruction is executed by the processor 501, each process of the above-mentioned signaling intercommunication embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0122] It should be noted that Figure 5 The electronic device 500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0123] Figure 6 A hardware schematic diagram of an electronic device 600 provided in an embodiment of the present disclosure is shown in FIG. Figure 6As shown, the electronic device 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in ROM (Read Only Memory) 602 or the program loaded from the storage part 608 to RAM (Random Access Memory) 603. Various programs and data required for system operation are also stored in RAM 603. CPU 601, ROM 602 and RAM 603 are connected to each other through bus 604. I / O (Input / Output) interface 605 is also connected to bus 604.

[0124] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a CRT (Cathode Ray Tube), an LCD (Liquid Crystal Display), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0125] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU 601), various functions defined in the system of the present application are executed.

[0126] The embodiment of the present disclosure also sends a computer-readable medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned signaling intercommunication embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0127] The processor is the processor in the electronic device in the above embodiment. The computer-readable medium includes computer-readable media such as ROM, RAM, magnetic disk or optical disk.

[0128] The disclosed embodiment further provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-mentioned signaling intercommunication embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0129] It should be understood that the chip mentioned in the embodiments of the present disclosure may also be referred to as a system-level chip, a system chip, a chip system, or a system-on-chip chip, etc.

[0130] The embodiments of the present disclosure provide a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of signaling intercommunication as described above and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0131] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises one..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be noted that the scope of the method and device in the embodiments of the present disclosure is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0132] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, an electronic device, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present disclosure.

[0133] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are within the protection of the present disclosure.

Claims

1. A domain adaptation method, characterized in that: The method is applied to an initial model, the initial model is obtained by pre-training based on a first sample, the initial model includes a first feature extraction module, the first sample comes from a synthetic domain, and the method includes: Acquire a first feature extracted by the first feature extraction module from a second sample, where the second sample comes from a natural domain and the synthetic domain; determining a source domain of the second sample according to the first feature; An absolute value of an adversarial loss of the first feature is determined based on the source domain, and the first feature extraction module is updated by gradient reversal during back propagation with the goal of maximizing the absolute value of the adversarial loss.

2. The method according to claim 1, characterized in that The updating of the first feature extraction module by gradient reversal during the back propagation process with the purpose of maximizing the absolute value of the adversarial loss includes: Dynamically adjust the back propagation coefficient according to the absolute value of the adversarial loss; adjusting the reverse gradient with the back propagation coefficient; With the goal of maximizing the absolute value of the adversarial loss, the first feature extraction module is updated based on the inverted gradient.

3. The method according to claim 2, characterized in that The dynamically adjusting the back propagation coefficient according to the absolute value of the adversarial loss includes: When the absolute value of the adversarial loss is greater than or equal to a difficulty threshold, using a first value as the back propagation coefficient, the first value being greater than the difficulty threshold; When the absolute value of the adversarial loss is less than the difficulty threshold, a second value is obtained by comparing the first value with the absolute value of the adversarial loss, and the back propagation coefficient is determined according to the second value.

4. The method according to claim 3, characterized in that The determining the back propagation coefficient according to the second value comprises: Get the gradient overflow threshold; The minimum value between the second value and the gradient overflow threshold is taken as the back propagation coefficient.

5. The method according to claim 1, characterized in that The initial model further includes a classification layer, the first sample includes a feature label, and the pre-training step of the initial model includes: In the initial model, the first feature extraction module extracts a second feature from the first sample, and the classification layer determines a predicted label of the first sample based on the second feature; The prediction loss corresponding to the second feature is determined based on the prediction label and the feature label, and the first feature extraction module and the classification layer are updated with the purpose of minimizing the prediction loss.

6. The method according to claim 1, characterized in that The initial model further includes a second feature extraction module, a feature fusion module and a classification layer, the first sample includes a feature label, and the pre-training step of the initial model includes: In the initial model, the first feature extraction module extracts a second feature from the first sample, the second feature extraction module extracts a third feature from the first sample, and the feature fusion module fuses the second feature with the third feature to obtain a fused feature; Determining, by the classification layer, a predicted label of the first sample based on the fused features; The prediction loss corresponding to the second feature is determined based on the prediction label and the feature label, and the first feature extraction module, the second feature extraction module, the feature fusion module and the classification layer are updated with the purpose of minimizing the prediction loss.

7. The method according to claim 1, characterized in that Before determining the source domain of the second sample according to the first feature, the method further includes: Perform convolution processing on the first feature.

8. A domain adaptation component, characterized in that: The component is applied to an initial model, the initial model is obtained by pre-training based on a first sample, the first sample is from a synthetic domain, the initial model includes a first feature extraction module, and the component includes: A feature acquisition module, configured to acquire a first feature extracted by the first feature extraction module from a second sample, where the second sample originates from the synthetic domain and the natural domain; a domain classification module, configured to determine a source domain of the second sample according to the first feature; A gradient reversal module is used to determine the absolute value of the adversarial loss of the first feature based on the source domain, and to update the first feature extraction module by gradient reversal during the back propagation process with the purpose of maximizing the absolute value of the adversarial loss.

9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction implements the method according to any one of claims 1 to 7 when executed by the processor.

10. A computer-readable medium, characterized in that The computer-readable medium stores a program or an instruction, and when the program or the instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.