Training Methods for Domain-Adversarial Neural Networks

By using the joint probability density ratio weighted loss function in the domain adversarial neural network, the problems of insufficient performance and insufficient category alignment of DANN on the target data set are solved, and better predictive performance and category distinction effects are achieved.

CN113392967BActive Publication Date: 2024-11-08FUJITSU LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010165937.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-11
Publication Date
2024-11-08
Estimated Expiration
2040-03-11

AI Technical Summary

Technical Problem

Existing domain-adversarial neural network methods such as DANN have poor performance on the target dataset and cannot achieve class-level alignment, and only achieve feature space alignment, resulting in mixed sample features of different categories and difficult to distinguish.

Method used

By weighting the loss function with the joint probability density ratio between the target dataset and the source dataset, the tag predictor and feature extractor are trained to enable better prediction performance on the target dataset and achieve category-level Align.

Benefits of technology

It improves the prediction performance of the model on the target dataset, can better distinguish samples from each category, and solves the problem of category confusion caused by feature space alignment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113392967B_ABST
    Figure CN113392967B_ABST
Patent Text Reader

Abstract

A training method for a domain adversarial neural network is disclosed. The domain adversarial neural network includes: a feature extraction unit, which extracts a first feature for labeled source data and a second feature for unlabeled target data; a label prediction unit, which predicts the label of the source data based on the first feature and predicts the label of the target data based on the second feature; and a discrimination unit, which discriminates whether the input data is source data or target data based on the first feature and the second feature. The training method includes: constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data; obtaining a second loss function by weighting the first loss function using the joint probability density ratio between the source data and the target data; and training the label prediction unit and the feature extraction unit using the first loss function and the second loss function.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention generally relates to domain adaptation, and more particularly to a method for training domain adversarial neural networks. Background Art

[0002] The training and application of neural networks usually involve labeled source datasets and unlabeled target datasets. Due to the differences between the source dataset and the target dataset, such as distribution differences, the performance of the neural network model trained with the source dataset is often poor when directly applied to the target dataset. The task of domain adaptation is to obtain a model that performs well on the target dataset through training. In this regard, some techniques have been proposed, such as domain adversarial neural networks (DANNs), which solve the problem by learning domain-invariant features.

[0003] Figure 1 The schematic diagram shows the architecture and training process of DANN. Figure 1 As shown in FIG. 1 , DANN includes a feature extractor 110, a label predictor 120, and a domain discriminator 130. The feature extractor 110 and the label predictor 120 together form a standard forward network structure. Unsupervised domain adaptation is achieved by adding the domain discriminator 130. The domain discriminator 130 is connected to the feature extractor 110 through a gradient reversal layer 140. During the back propagation process, the gradient reversal layer 140 multiplies the gradient by a negative constant (e.g., Figure 1 is "-1" in the source dataset) to achieve gradient reversal, so that the domain discriminator 130 and the feature extractor 110 operate in an adversarial manner. If there is no gradient reversal layer 140, the training is carried out according to the traditional process, that is, the training is carried out in a manner that minimizes the loss of the label predictor 120 (only for the source dataset samples) and the loss of the domain discriminator 130 (for the source dataset samples and the target dataset samples). However, in the presence of the gradient reversal layer 140, the feature extractor 110 and the domain discriminator 130 are trained in an adversarial manner. Specifically, the feature extractor 110 tries to extract some features so that the domain discriminator 130 cannot identify whether the sample is from the source domain or the target domain based on these features; on the other hand, the domain discriminator 130 tries its best to identify whether the sample is from the source domain or the target domain based on the input features. Through such adversarial training, the feature extractor 110 can eventually learn to extract domain-invariant features so that the domain discriminator 130 cannot distinguish which domain the sample comes from. In this process, the gradient reversal layer 140 can ensure the similarity of the distribution of features learned in the source domain and the target domain, so that domain-invariant features can be learned.

[0004] Although DANN can achieve good results in many domain adaptation tasks, it still has some problems. First, in the optimization process of the label predictor 120, only the prediction loss for the source dataset samples is minimized, without considering the prediction loss for the target dataset samples. Second, DANN achieves domain adaptation by aligning the feature space, but cannot achieve alignment at the category level. Summary of the invention

[0005] In order to solve these problems, the present invention proposes an improved training method for DANN. In summary, the method according to the present invention uses the joint probability density ratio between the target data set and the source data set to weight the loss function on the source data set, and the weighted loss function can approximate the loss function on the target data set. Therefore, using the weighted loss function in the process of training the label predictor can make the trained predictor have better prediction performance when applied to the target data set.

[0006] According to one aspect of the present invention, a method for training a domain adversarial neural network model is provided. The domain adversarial neural network model includes: a feature extraction unit, which is used to extract a first feature for input labeled source data, and extract a second feature for input unlabeled target data; a label prediction unit, which predicts the label of the source data based on the extracted first feature, and predicts the label of the target data based on the extracted second feature; a discrimination unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature. The method includes: constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data; obtaining a second loss function by weighting the first loss function using the joint probability density ratio between the source data and the target data; and training the label prediction unit and the feature extraction unit using the first loss function and the second loss function.

[0007] According to another aspect of the present invention, a device for training a domain adversarial neural network model is provided. The domain adversarial neural network model includes: a feature extraction unit, which is used to extract a first feature for the input labeled source data, and extract a second feature for the input unlabeled target data; a label prediction unit, which predicts the label of the source data based on the extracted first feature, and predicts the label of the target data based on the extracted second feature; a discrimination unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature. The device includes: a memory storing a program; and one or more processors. The processor performs the following operations by executing the program: constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data; obtaining a second loss function by weighting the first loss function using the joint probability density ratio between the source data and the target data; and training the label prediction unit and the feature extraction unit using the first loss function and the second loss function.

[0008] According to another aspect of the present invention, a storage medium storing a program for training a domain adversarial neural network model is provided. The domain adversarial neural network model includes: a feature extraction unit, which is used to extract a first feature for the input labeled source data, and extract a second feature for the input unlabeled target data; a label prediction unit, which predicts the label of the source data based on the extracted first feature, and predicts the label of the target data based on the extracted second feature; a discrimination unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature. When the program is executed by a computer, the computer executes a method comprising the following steps: constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data; obtaining a second loss function by weighting the first loss function using the joint probability density ratio between the source data and the target data; and training the label prediction unit and the feature extraction unit using the first loss function and the second loss function. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] Figure 1 The architecture and training process of DANN are schematically shown.

[0010] Figure 2 A domain adaptation framework according to an embodiment of the present invention is schematically shown.

[0011] Figure 3 The parameter λ is shown C curve.

[0012] Figure 4 The parameter λ is shown p curve.

[0013] Figure 5 A flowchart of a method for training a domain adversarial neural network according to this embodiment is shown.

[0014] Figure 6 A modular framework of a training device for a domain adversarial neural network according to this embodiment is shown.

[0015] Figure 7 A domain adaptation framework according to another embodiment of the present invention is schematically shown.

[0016] Figure 8 The parameter λ is shown TC curve.

[0017] Fig. 9 An example of semantic segmentation is shown.

[0018] Fig.10 A block diagram showing an exemplary configuration of computer hardware for implementing the present invention is shown. DETAILED DESCRIPTION

[0019] The present invention improves on DANN and proposes a joint density ratio estimation-based domain adaptation (JDA) method. Figure 2 A domain adaptation framework according to an embodiment of the present invention is schematically shown.

[0020] like Figure 2 As shown, the domain adversarial neural network according to the present invention includes a feature extractor G, a label predictor C and a domain discriminator D. In addition, X P represents the labeled source sample, X Q represents the unlabeled target sample, G(X P ) represents the characteristics of the source sample, G(X Q ) represents the characteristics of the target sample, Y P represents the label of the source sample, Y Q Represents the label of the target sample. Since the target sample is unlabeled data, Y Q It is a pseudo label.

[0021] The feature extractor G is used for the labeled source sample X P Extract feature G(X P ), and for the unlabeled target sample X Q Extract feature G(X Q). The label predictor C is based on the extracted features G(X P ) to predict the source sample X P Label Y P , and based on the extracted features G(X Q ) to predict the target sample X Q Label Y Q The domain discriminator D is based on the extracted features G(X P ) and feature G(X Q ) to determine whether the input sample is a source sample or a target sample.

[0022] In the training of the label predictor C, the label prediction loss function is used And the weighted label prediction loss function The following mathematical formulas (1) and (2) respectively show these two loss functions:

[0023]

[0024]

[0025] Where E represents the mathematical expectation, P represents the distribution of the source data, l represents the cross entropy loss function, and C represents the classifier, i.e., the label predictor. r(x,y) represents the joint probability density ratio between the target dataset and the source dataset, and can be expressed as the following mathematical formula (3):

[0026]

[0027] Among them, p(x, y) represents the joint probability density function of the source domain, and q(x, y) represents the joint probability density function of the target domain.

[0028] In the weighted label prediction loss function In , the prediction loss of each source sample is weighted by the joint probability density ratio r(x, y), so the loss function can be approximated to the loss function on the target dataset. Therefore, the loss function is used in the training of the label predictor C It can improve the performance of the model on the target dataset.

[0029] In the present invention, the joint probability density ratio r(x, y) can be calculated based on the output of the domain discriminator D. Therefore, the domain discriminator D is not only used to distinguish the source sample and the target sample, but also used to estimate the joint probability density ratio. This will be described in detail below.

[0030] First, the discriminant loss function of the domain discriminator D is expressed by mathematical formula (4):

[0031]

[0032] Among them, P represents the distribution of source data, and Q represents the distribution of target data.

[0033] Loss Function With D as the independent variable, we need to calculate the loss function The optimal solution D when it is the minimum value * (G(x), y).

[0034] According to mathematical formula (4), we can get:

[0035]

[0036] Substitute D * (G(x), y), further get:

[0037] D * (G(x),y)=argmax D(G(x),y) p(x,y)log(D(G(x),y))+q(x,y)log(1-D(G(x),y))--(6)

[0038] Since the function f(d) = p log(d) + q log(1-d) reaches its maximum value on the interval (0, 1), the variable Therefore, according to mathematical formula (6), we can get:

[0039] where D(G(x), y)∈(0, 1)--(7)

[0040] Then, combined with the definition of mathematical formula (3), the joint probability density ratio r(x, y) can be expressed as the following mathematical formula (8):

[0041]

[0042] According to mathematical formula (8), we can use the loss function of the domain discriminator D Output D at minimum * (G(x), y) is used to calculate the joint probability density ratio r(x, y).

[0043] Since the output of the domain discriminator D is used to estimate the joint probability density ratio, the domain discriminator D must not only input the features G(X P )、G(X Q ), and the labels Y of the source and target samples must be entered P , Y QSince the label of the target sample is unknown, the present invention uses the label prediction result of the target sample by the label predictor C as the pseudo label Y Q Input into the domain discriminator D.

[0044] In the present invention, the estimated joint probability density ratio is used to weight the prediction loss for the source data set, and then the weighted loss function is Minimize, thereby achieving category-level alignment, rather than just feature space alignment. In contrast, only achieving feature space alignment will cause the following problem: although the features of samples in the source domain and the target domain are brought closer in the feature space, the features of samples of different categories may be mixed together, so that samples of each category cannot be well distinguished. The present invention can solve this problem because it can achieve category-level alignment.

[0045] In the present invention, the weighted sum of the loss function is used to train Figure 2 For example, as shown in mathematical formula (9), based on the loss function described above The model is trained by taking the weighted sum of

[0046]

[0047] In mathematical formula (9), the weight λ C Used to control the loss function in the process of optimizing the label predictor C and feature extractor G At the beginning of training, due to the inaccurate estimation of the joint probability density ratio, it is preferred to set λ C The value of is set relatively small, so that the model is optimized mainly based on the prediction loss for the source sample. As the training progresses, the estimate of the joint probability density ratio becomes more accurate, so λ can be gradually increased. C The value of λ makes it possible to optimize the model based on the prediction loss of the target sample. For example, during training, λ C It can gradually increase from the initial value "0" to "1". It can be expressed by the following mathematical formula (10): C .

[0048] λ C =α·min((2p) n , 1)--(10)

[0049] Where p represents the training progress, which increases linearly from 0 to 1, and α and n represent hyperparameters. α and n can be set based on experience, for example, both are set to 10. Figure 3 The weight λ is shown C where α is set to 1 and n is set to 10.

[0050] On the other hand, Figure 2 As shown, during the back-propagation process, the gradient reversal layer 240 multiplies the gradient from the domain discriminator D by a negative constant “-λ p " to achieve gradient reversal, which is similar to the gradient reversal layer in DANN. In the training process according to the present invention, with the parameter λ C Similarly, gradually increasing the parameter λ p The value of λ, for example, gradually increases from the initial value "0" to "1". λ can be expressed by the following mathematical formula (11): p .

[0051]

[0052] Where p represents the training progress, which increases linearly from 0 to 1, and γ represents a hyperparameter, which can be set to, for example, 10 according to experience. Figure 4 The parameter λ is shown p It should be noted that due to λ p It is only used to optimize the feature extractor G, so it does not appear in equation (9).

[0053] Figure 5 A flowchart of a method for training a domain adversarial neural network according to this embodiment is shown. Figure 6 FIG. 4 shows a modular block diagram of a training device for a domain adversarial neural network according to this embodiment. Figure 5 and Figure 6 In step S510, according to formula (1), a loss function is constructed based on the output of the label predictor C. Loss Function is the prediction loss associated with the source dataset. It can be given by Figure 6 The first loss function generating unit 610 in performs this step.

[0054] In step S520, according to equation (8), the joint probability density ratio r(x, y) between the source dataset and the target dataset is determined based on the output of the domain discriminator D. Figure 6 The joint probability density ratio determination unit 640 in performs this step.

[0055] In step S530, the loss function is adjusted by using the joint probability density ratio r(x, y). Weighted to obtain the loss function As shown in mathematical formula (2). Loss function It can approximate the prediction loss related to the target dataset. Figure 6 The second loss function generating unit 620 in performs this step.

[0056] In step S540, according to equation (4), a loss function is constructed based on the output of the domain discriminator D. Can be Figure 6 The third loss function generating unit 630 in performs this step.

[0057] In step S550, according to equation (9), based on the loss function Loss Function And the loss function The domain adversarial neural network model is trained by a weighted combination of . In particular, as the training progresses, the loss function can be gradually increased. The weight λ C . Can be Figure 6 The training unit 650 in performs this step. Figure 7 To describe a domain adaptation framework according to another embodiment of the present invention. In this embodiment, the JDA described above is combined with self-ensembling (JDA-SE). Figure 7 As shown, the field adversarial neural network model according to the present invention includes a feature extractor G and a label predictor C as a student network, and a teacher-feature extractor G and a teacher-label predictor C as a teacher network. The teacher network has the same network structure as the corresponding student network. The difference is that the network parameters of the teacher network are not trainable. In addition, the network parameters of the teacher-feature extractor G are the exponential moving average of the parameters of the feature extractor G, and the network parameters of the teacher-label predictor C are the exponential moving average of the parameters of the label predictor C.

[0058] This embodiment and Figure 2 The difference of the illustrated embodiment is that a target consistency loss function is introduced As shown in the following mathematical formula (12), it is used to ensure the consistency of the prediction results between the teacher network and the student network.

[0059]

[0060] In this embodiment, based on the loss function The model is trained by taking the weighted sum of , as shown in mathematical formula (13).

[0061]

[0062] With λ C Similarly, λ in equation (13) TC Used to control the loss function in the process of optimizing the label predictor C and feature extractor G As training progresses, you can gradually increase λTC The value of λ, for example, gradually increases from the initial value "0" to "1". λ can be expressed by the following mathematical formula (14): TC .

[0063] λ TC =α·p n +β--(14)

[0064] Wherein, p represents the training progress, which increases linearly from 0 to 1. Parameters α, n, and β can be preset based on experience, for example, α is set to 100, n is set to 10, and β is set to 0. Figure 8 The parameter λ is shown TC curve.

[0065] Table 1 below shows the performance comparison between the JDA and JDA-SE schemes according to the present invention and existing schemes (such as PFAN, ADDA, DANN, etc.). The comparison is based on the MNIST<—>USPS dataset (a well-known handwritten character dataset). The values ​​in Table 1 represent the classification accuracy, and the higher the accuracy, the better the performance of the scheme.

[0066] In particular, Vanilla (source only) in Table 1 represents a scheme that uses only the labeled data of the source dataset, but not the data of the target dataset for training. This is the simplest scheme and serves as a benchmark for comparison. In addition, the MDA scheme is a variant of JDA, in which the joint probability density ratio is replaced by the marginal probability density ratio. The performance of the MDA scheme is listed in Table 1 for comparison.

[0067] [Table 1]

[0068] plan MNIST—>USPS USPS—>MNIST Vanilla(Source only) 75.2±1.6 57.1±1.7 Self-integration (2018) 88.3±0.8 - DANN (JMLR 2016) 88.6±2.1 87.3±5.7 ADDA (CVPR 2016) 89.4±0.2 90.1±0.8 PFAN (CVPR 2019) 95.0±1.3 - MDA 93.9±1.4 94.5±0.6 JDA 94.1±0.9 94.8±0.8 JDA-SE 95.2±0.8 95.3±0.5

[0069] It can be seen from Table 1 that the JDA and JDA-SE methods according to the present invention have better performance. In addition, compared with the shift compensation network (Shift Compensation Network, not shown in Table 1) using the marginal probability density ratio, the method according to the present invention has the advantage that it does not need to rely on the establishment of any type of shift (such as covariate shift, label shift, etc.), while the shift compensation network needs to rely on the establishment of covariate shift.

[0070] The domain adaptation method according to the present invention can be applied to a wide range of fields, and representative application scenarios are given below by way of example only.

[0071] [Application scenario 1] semantic segmentation

[0072] Semantic segmentation refers to marking the parts of an image that represent different objects with different colors. Fig. 9 An example of semantic segmentation is shown. Fig. 9 The two leftmost images in the figure are original images, the two images in the second column from the left are the ground truth of the segmentation results of the two original images, and the images in other columns are the segmentation results using different semantic segmentation methods.

[0073] In the application scenario of semantic segmentation, real-world images are rarely labeled because the cost of manual annotation of real-world images is very high. In this case, an alternative method is to use images of scenes in a simulation environment (such as 3D games) for training. Since it is easy to program automatically to annotate objects in a simulation environment, it is easy to obtain labeled data. In this way, the model is trained using labeled data generated in the simulation environment, and then the trained model is used to process images of the real environment. However, since the simulation environment cannot be completely consistent with the real environment, the performance of the model trained using the data of the simulation environment will be greatly reduced when processing images of the real environment.

[0074] In this case, using the domain adaptation method according to the present invention, training can be performed based on labeled simulation environment data and unlabeled real environment data, thereby improving the performance of the model in processing real environment images.

[0075] [Application scenario 2] Handwritten character recognition

[0076] Handwritten characters usually include handwritten numbers, words (such as Chinese and Japanese), etc. In the recognition of handwritten characters, commonly used labeled character sets include MNIST, USPS, SVHN, etc., and these labeled character data are usually used to train models. However, when the trained model is applied to the recognition of actual (unlabeled) handwritten characters, its accuracy may decrease.

[0077] In this case, using the domain adaptation method according to the present invention, training can be performed based on labeled source data and unlabeled target data, thereby improving the performance of the model in processing target data.

[0078] [Application scenario 3] Classification and prediction of time series data

[0079] The prediction of time series data includes, for example, air pollution index prediction, ICU patient length of stay (LOS) prediction, stock market prediction, etc. The following will take the time series data of PM 2.5 index as an example for description.

[0080] Each data in the time series data set of PM 2.5 index records the PM 2.5 index, temperature, air pressure, wind speed, wind direction, accumulated rainfall, accumulated snowfall and other information of a certain area within a certain time range (such as within 1 hour). Assume that the range of PM 2.5 index in the area needs to be predicted three days later. To this end, a prediction model is constructed, and data of a specified length is selected to construct a sample. For example, a specific 24 hours of data in the data set is selected as a sample, and each data includes features of 8 dimensions, so that the sample includes 24*8 dimensional features. Then, a label is assigned to the sample according to the range of PM 2.5 index three days later in the data set. In this way, a training sample set can be constructed, so as to train the prediction model using the training sample set. After the training is completed, the trained model can be applied to the actual prediction, for example, the range of PM 2.5 index three days later is predicted based on the data 24 hours before the current moment (unlabeled data).

[0081] In this scenario, by using the domain adaptation method according to the present invention, the model can be trained based on labeled data and unlabeled data, thereby improving the prediction accuracy of the model.

[0082] [Application scenario 4] Classification and prediction of tabular data

[0083] Tabular data may include financial data, such as online lending data. In this example, in order to predict whether a borrower has the possibility of overdue repayment, a prediction model may be constructed and the model may be trained using the method according to the present invention.

[0084] [Application Scenario 5] Image Recognition

[0085] Image recognition or image classification is an area where deep (convolutional) neural networks are good at. Similar to the semantic segmentation scenario, in this application scenario, there is also the problem of high cost of labeling real-world image datasets. Therefore, the domain adaptation method according to the present invention can be used to select a labeled dataset (such as ImageNet) as a source dataset, and train based on the source dataset and an unlabeled target dataset to obtain a model with performance that meets the requirements.

[0086] The methods described in the above embodiments may be implemented by software, hardware, or a combination of software and hardware. The programs included in the software may be stored in advance in a storage medium provided inside or outside the device. As an example, during execution, these programs are written to a random access memory (RAM) and executed by a processor (e.g., CPU), thereby implementing the various methods and processes described herein.

[0087] Fig.10An exemplary configuration block diagram of computer hardware for executing the method of the present invention according to a program is shown, and the computer hardware is an example of an apparatus for training a domain adversarial neural network model according to the present invention.

[0088] like Fig.10 As shown, in a computer 1000 , a central processing unit (CPU) 1001 , a read only memory (ROM) 1002 , and a random access memory (RAM) 1003 are connected to one another via a bus 1004 .

[0089] The input / output interface 1005 is further connected to the bus 1004. The input / output interface 1005 is connected with the following components: an input unit 1006 formed with a keyboard, a mouse, a microphone, etc.; an output unit 1007 formed with a display, a speaker, etc.; a storage unit 1008 formed with a hard disk, a nonvolatile memory, etc.; a communication unit 1009 formed with a network interface card (such as a local area network (LAN) card, a modem, etc.); and a drive 1010 that drives a removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory.

[0090] In the computer having the above-described structure, the CPU 1001 loads the program stored in the storage unit 1008 into the RAM 1003 via the input / output interface 1005 and the bus 1004 and executes the program so as to perform the method described above.

[0091] The program to be executed by the computer (CPU 1001) may be recorded on a removable medium 1011 as a package medium, which is formed of, for example, a magnetic disk (including a floppy disk), an optical disk (including a compact disk-read only memory (CD-ROM)), a digital versatile disk (DVD), etc.), a magneto-optical disk, or a semiconductor memory. In addition, the program to be executed by the computer (CPU 1001) may also be provided via a wired or wireless transmission medium such as a local area network, the Internet, or digital satellite broadcasting.

[0092] When the removable medium 1011 is mounted in the drive 1010, the program can be installed in the storage unit 1008 via the input / output interface 1005. In addition, the program can be received by the communication unit 1009 via a wired or wireless transmission medium and installed in the storage unit 1008. Alternatively, the program can be pre-installed in the ROM 1002 or the storage unit 1008.

[0093] The program executed by the computer may be a program that performs processing according to the sequence described in this specification, or may be a program that performs processing in parallel or performs processing when necessary such as when called.

[0094] The units or devices described herein are only in a logical sense and do not strictly correspond to physical devices or entities. For example, the functions of each unit described herein may be implemented by multiple physical entities, or the functions of multiple units described herein may be implemented by a single physical entity. In addition, the features, components, elements, steps, etc. described in one embodiment are not limited to the embodiment, but may also be applied to other embodiments, such as replacing specific features, components, elements, steps, etc. in other embodiments, or combining them.

[0095] The scope of the present invention is not limited to the specific embodiments described herein. It should be understood by those skilled in the art that, depending on design requirements and other factors, various modifications or changes may be made to the embodiments herein without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

[0096] Note:

[0097] 1. A method for training a domain adversarial neural network model, the domain adversarial neural network model comprising:

[0098] A feature extraction unit, configured to extract a first feature from input labeled source data and a second feature from input unlabeled target data;

[0099] a label prediction unit, which predicts a label of the source data based on the extracted first feature, and predicts a label of the target data based on the extracted second feature;

[0100] a discriminating unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature;

[0101] The method comprises:

[0102] constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data;

[0103] Obtaining a second loss function by weighting the first loss function using a joint probability density ratio between the source data and the target data;

[0104] The first loss function and the second loss function are used to train the label prediction unit and the feature extraction unit.

[0105] 2. The method according to 1, wherein the domain adversarial neural network model is used to perform image recognition, and the source data and the target data are image data, or

[0106] The domain adversarial neural network model is used to process financial data, and the source data and the target data are table type data, or

[0107] The domain adversarial neural network model is used to process environmental meteorological data or medical data, and the source data and the target data are time series data.

[0108] 3. The method according to 1, wherein the second loss function is capable of approximating a prediction loss associated with the target data.

[0109] 4. The method according to 1 also includes: determining the joint probability density ratio based on the output of the discriminant unit.

[0110] 5. The method according to 4, wherein the joint probability density ratio r is calculated by the following equation:

[0111]

[0112] Wherein, D represents the output of the discrimination unit.

[0113] 6. The method according to 4, wherein the discrimination unit is further provided with a label of the source data and a label of the target data predicted by the label prediction unit.

[0114] 7. The method according to item 1, further comprising:

[0115] The third loss function is constructed based on the output of the discriminant unit.

[0116] Training the domain adversarial neural network model based on a weighted combination of the first loss function, the second loss function, and the third loss function; and

[0117] As the training proceeds, the weight used to weight the second loss function is gradually increased.

[0118] 8. The method according to 1, wherein the discrimination unit is connected to the feature extraction unit via a gradient reversal unit, and the discrimination unit and the feature extraction unit operate in a mutually antagonistic manner.

[0119] 9. The method according to 1, wherein the domain adversarial neural network further comprises another feature extraction unit and another label prediction unit, wherein the parameters of the another feature extraction unit are the exponential moving average of the parameters of the feature extraction unit, and the parameters of the another label prediction unit are the exponential moving average of the parameters of the label prediction unit,

[0120] The method further includes constructing a fourth loss function based on outputs of the feature extraction unit, the another feature extraction unit, the label prediction unit, and the another label prediction unit.

[0121] 10. The method according to 9, further comprising:

[0122] The domain adversarial neural network model is trained based on a weighted combination of the first loss function, the second loss function, the third loss function and the fourth loss function; and as the training progresses, the weight used to weight the fourth loss function is gradually increased.

[0123] 11. A device for training a domain adversarial neural network model, the domain adversarial neural network model comprising:

[0124] A feature extraction unit, configured to extract a first feature from input labeled source data and a second feature from input unlabeled target data;

[0125] a label prediction unit, which predicts a label of the source data based on the extracted first feature, and predicts a label of the target data based on the extracted second feature;

[0126] a discriminating unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature;

[0127] The device comprises:

[0128] a memory storing a program; and

[0129] One or more processors, wherein the processors execute the program to perform the following operations:

[0130] constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data;

[0131] Obtaining a second loss function by weighting the first loss function using a joint probability density ratio between the source data and the target data;

[0132] The first loss function and the second loss function are used to train the label prediction unit and the feature extraction unit.

[0133] 12. A device for training a domain adversarial neural network model, the domain adversarial neural network model comprising:

[0134] A feature extraction unit, configured to extract a first feature from input labeled source data and a second feature from input unlabeled target data;

[0135] a label prediction unit, which predicts a label of the source data based on the extracted first feature, and predicts a label of the target data based on the extracted second feature;

[0136] a discriminating unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature;

[0137] The device comprises:

[0138] A first loss function generating unit, which constructs a first loss function based on an output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data;

[0139] a second loss function generating unit, which generates a second loss function by weighting the first loss function using a joint probability density ratio between the source data and the target data;

[0140] A training unit, which uses the first loss function and the second loss function to train the label prediction unit and the feature extraction unit.

[0141] 13. A storage medium storing a program for training a domain adversarial neural network model, the domain adversarial neural network model comprising:

[0142] A feature extraction unit, configured to extract a first feature from input labeled source data and a second feature from input unlabeled target data;

[0143] a label prediction unit, which predicts a label of the source data based on the extracted first feature, and predicts a label of the target data based on the extracted second feature;

[0144] a discriminating unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature;

[0145] When the program is executed by a computer, the computer executes a method comprising the following steps:

[0146] constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data;

[0147] Obtaining a second loss function by weighting the first loss function using a joint probability density ratio between the source data and the target data;

[0148] The first loss function and the second loss function are used to train the label prediction unit and the feature extraction unit.

Claims

1. A method for training a domain adversarial neural network model, the domain adversarial neural network model comprising: A feature extraction unit, configured to extract a first feature from input labeled source data and a second feature from input unlabeled target data; a label prediction unit, which predicts a label of the source data based on the extracted first feature, and predicts a label of the target data based on the extracted second feature; a discriminating unit, which discriminates whether the input data is source data or target data based on the extracted first feature and second feature; The method comprises: constructing a first loss function based on the output of the label prediction unit, wherein the first loss function is a prediction loss related to the source data; Obtaining a second loss function by weighting the first loss function using a joint probability density ratio between the source data and the target data; The first loss function and the second loss function are used to train the label prediction unit and the feature extraction unit. wherein the domain adversarial neural network model is used to perform image recognition, and the source data and the target data are image data, or, Wherein, the domain adversarial neural network model is used to process financial data, and the source data and the target data are table type data, or, The domain adversarial neural network model is used to process environmental meteorological data or medical data, and the source data and the target data are time series data.

2. The method according to claim 1, wherein: The second loss function can approximate a prediction loss associated with the target data.

3. The method according to claim 1, further comprising: The joint probability density ratio is determined based on an output of the discriminant unit.

4. The method according to claim 3, wherein: The joint probability density ratio r is calculated by the following equation: Wherein, D represents the output of the discrimination unit.

5. The method according to claim 3, wherein: The discrimination unit is also provided with the label of the source data and the label of the target data predicted by the label prediction unit.

6. The method according to claim 1, further comprising: Constructing a third loss function based on the output of the discriminant unit; training the domain adversarial neural network model based on a weighted combination of the first loss function, the second loss function, and the third loss function; and, As the training proceeds, the weight used to weight the second loss function is gradually increased.

7. The method according to claim 1, wherein: The discrimination unit is connected to the feature extraction unit via a gradient reversal unit, and the discrimination unit and the feature extraction unit operate in a mutually antagonistic manner.

8. The method according to claim 6, wherein: The domain adversarial neural network model further includes another feature extraction unit and another label prediction unit, wherein a parameter of the another feature extraction unit is an exponential moving average of the parameters of the feature extraction unit, and a parameter of the another label prediction unit is an exponential moving average of the parameters of the label prediction unit, The method further includes constructing a fourth loss function based on outputs of the feature extraction unit, the another feature extraction unit, the label prediction unit, and the another label prediction unit.

9. The method according to claim 8, further comprising: training the domain adversarial neural network model based on a weighted combination of the first loss function, the second loss function, the third loss function, and the fourth loss function; and, As training proceeds, the weight used to weight the fourth loss function is gradually increased.