Feature augmentation field generalization image recognition method based on feature decoupling
Through the feature augmentation method based on feature decoupling, domain-invariant causal information is learned and difficult features are constructed, which solves the problems of ignoring false correlation information in features and uncertainty of feature augmentation in the existing technology, and improves the generalization of the model. Ability and difficulty sample recognition ability.
Patent Information
- Application Number
- CN202410897088.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-05
- Publication Date
- 2024-10-08
AI Technical Summary
The existing technology ignores potential non-causal information in features that is falsely associated with labels in deep learning models, resulting in model performance degradation on test data, and uncertainty in the feature augmentation method, which affects the generalization ability of the model.
Using a feature augmentation method based on feature decoupling, by constructing a domain invariant feature extractor, a domain style feature extractor, a domain discriminator and a mask network, it learns domain invariant causal information and constructs difficult features for style transfer and difficult causal perturbation. Features to improve the model’s ability to identify unknown target domains.
It effectively eliminates domain style information and false correlation non-causal information in features, improves the model's generalization ability in unknown target domains and the identification ability of difficult samples, and alleviates the problem of performance degradation caused by data distribution shifts.
Smart Images

Figure CN118747820A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of image recognition, and in particular is a feature-enlarged domain generalized image recognition method based on feature decoupling. Background Art
[0002] In reality, when deep learning models are applied, the distribution of test data is often different from the distribution of training data of the training model, resulting in a significant performance drop in the test data of the model trained on the training data. Deep learning domain generalization (DG) has become one of the research hotspots in recent years, aiming to train statistical models using multiple labeled source domain data to improve the model's generalization ability to unknown domain data.
[0003] However, current feature decoupling domain generalization methods mostly consider extracting domain-invariant features, ignoring the potential non-causal information in the features that is falsely associated with the labels, which will cause the model to learn these false correlation information, thereby affecting the generalization ability of the model. The current feature augmentation domain generalization method has a certain degree of uncertainty due to its random perturbation, and its impact on model training is also unknown. Summary of the invention
[0004] In order to address the shortcomings of the above-mentioned prior art, the present invention proposes a feature augmentation domain generalization image recognition method based on feature decoupling, in order to learn domain-invariant causal information, thereby alleviating the performance degradation problem caused by data distribution offset and achieving accurate recognition of unknown target domain image categories.
[0005] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme:
[0006] The feature-enhanced domain generalized image recognition method based on feature decoupling of the present invention is characterized in that it is performed according to the following steps:
[0007] Step 1: Obtain n sample label pairs from k source domains respectively to form a sample label pair set Among them, x i represents the i-th image sample; y i Represents x i The category label of y i ∈{1,2,...,c}, c represents the total number of categories, d i Represents x i The label of the source domain, and d i ∈{1,2,...,k}; k represents the total number of source domains; n represents the number of sample label pairs in each source domain;
[0008] Step 2: Establish a feature decoupling network, including: domain invariant feature extractor F I , domain style feature extractor FS , domain discriminator C d , mask network M, first task classifier C1 and second task classifier C2;
[0009] Step 2.1: Construct a domain-invariant feature extractor F I , domain style feature extractor F S , domain discriminator C d The domain-invariant feature decoupling network composed of i Processing is performed to obtain the i-th domain style feature f i,S and the i-th domain invariant feature f i,I , thereby constructing the domain style feature extractor F S and domain discriminator C d The loss function And build domain invariant feature extractor F I The loss function
[0010] Step 2.2: Construct a causal feature decoupling network consisting of a mask network M and two task classifiers C1 and C2, and use it to classify f i,I Processing is performed to construct the loss function of the mask network M
[0011] Step 3: Use the feature decoupling network to augment the features;
[0012] Step 3.1: Pass the domain-invariant feature extractor F I The causal correlation features processed by the mask network M and the domain style feature extractor F S The processed domain style features are fused to form the style transfer difficulty features, thereby constructing the domain invariant feature extractor F I Contrastive learning loss function
[0013] Step 3.2: Pass the domain-invariant feature extractor F I The causal correlation features processed by the mask network M and the domain invariant feature extractor F I The false correlation features processed by the mask network M are fused to form the causal perturbation difficulty features, thereby constructing the domain invariant feature extractor F I Contrastive learning loss function Used to update the domain invariant feature extractor F I Network parameters;
[0014] Step 4: According to the process of step 1 to step 3, the feature decoupling network is trained using the gradient descent algorithm to obtain the trained domain invariant feature extractor F` IAnd the first task classifier C`1 is used to realize the recognition of images from unknown fields.
[0015] The feature of the feature-enlarged domain generalized image recognition method based on feature decoupling described in the present invention is also characterized in that step 2.1 is performed as follows:
[0016] Step 2.1.1, x i The input domain invariant feature is decoupled into the network and then passes through the domain style feature extractor F S After processing, we get the i-th domain style feature f i,S , and then pass through the domain discriminator C d After processing, the classification probability of the i-th domain style feature is obtained;
[0017] Step 2.1.2: Use formula (1) to construct the domain style feature extractor F S and domain discriminator C d The loss function Used to update the domain style feature extractor F S and domain discriminator C d Network parameters;
[0018]
[0019] In formula (1), l represents the cross entropy loss;
[0020] Step 2.1.3: x i Input domain invariant feature extractor F I Processed in, we get the i-th domain invariant feature f i,I , and then input the trained domain discriminator C d , and obtain the classification probability of the i-th domain invariant feature;
[0021] Step 2.1.4: Use formula (2) to construct a domain-invariant feature extractor F I The loss function Used to update the domain invariant feature extractor F I Network parameters;
[0022]
[0023] The step 2.2 is carried out as follows:
[0024] Step 2.2.1: Use formula (3) to get the i-th causal feature mask M i,sup and the ith false correlation feature mask M i,inf ;
[0025] M i,sup =M(f i,I ), Mi,inf =1-M(f i,I ) (3)
[0026] Step 2.2.2: Use formula (4) to get the ith causal correlation feature f i,sup and the ith false correlation feature f i,inf ;
[0027] f i,sup =M i,sup *f i,I , f i,inf =M i,inf *f i,I (4)
[0028] Step 2.2.3: Use formula (5) to construct the classification loss of the first task classifier C1 and the classification loss of the second task classifier C2 Used to update the domain invariant feature extractor F I And the network parameters of the two task classifiers C1 and C2
[0029]
[0030] Step 2.2.4: Use formula (6) to construct the loss function of the mask network M Used to update the network parameters of the mask network M;
[0031]
[0032] The step 3.1 is carried out as follows:
[0033] Step 3.1.1, select an image sample from each source domain in turn, k image samples constitute a set of image sample sequences, thus obtaining n sets of image sample sequences X v represents the vth group of image sample sequences, and x v,t Represents the vth group of image sample sequence X v The image sample of the t-th source domain in ;
[0034] Step 3.1.2: Calculate X using formula (7) v The image sample x of the tth source domain in v,t The information entropy IE(f v,t,S );
[0035] IE(f v,t,S )=-P(C d (f v,t,S ))log(P(C d (f v,t,S ))) (7)
[0036] In formula (7), P represents the Softmax function; f v,t,S Represents x v,t After the domain style feature extractor F S The domain style features obtained after processing;
[0037] Step 3.1.3: In the vth group of image sample sequence X v In the example, x is the image sample x in the tth source domain. v,t Get the sample x with the lowest domain style feature information entropy except for itself v,p As the sample to be fused; use formula (8) to calculate the image sample x of the tth source domain v,t The sample index p to be fused is used to determine x v,t The sample to be fused x v,p ;
[0038] p = argmin({IE(f v,t`,S )|t`=1,2,...,k,t`≠t}) (8)
[0039] In formula (8), argmin represents the function for finding the minimum index in a set, f v,t`,S Represents the image sample x of the t`th source domain v,t` After the domain style feature extractor F S The domain style features obtained after processing;
[0040] Step 3.1.4: Use formula (9) to get the image sample x of the tth source domain v,t The style transfer difficulty feature f v,t,DR :
[0041] f v,t,DR =FC([f v,t,sup ,f v,p,S ]) (9)
[0042] In formula (9), FC represents the fully connected layer, [,] represents the concat operation; f v,t,sup Represents x v,t After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f v,p,S Represents x v,p After the domain style feature extractor F S The domain style features obtained after processing;
[0043] Step 3.1.5: Use formula (10) to construct a domain-invariant feature extractor F I Contrastive learning loss function Used to update the domain invariant feature extractor F INetwork parameters;
[0044]
[0045] In formula (10), l cl represents the supervised contrastive learning loss; f v,t,I Represents x v,t Input domain invariant feature extractor F I The domain invariant features obtained by processing in .
[0046] The step 3.2 is performed as follows:
[0047] Step 3.2.1: Take n image samples of each source domain as a group, so as to obtain k groups of image sample sets X` w represents the wth set of image samples, and Among them, x` w,r Represents the w-th group of image sample set X` w The rth image sample in ;
[0048] Step 3.2.2: Calculate X' using formula (11) w The rth image sample x` w,r The information entropy IE(f w,r,inf );
[0049] IE(f w,r,inf )=-P(C2(f w,r,inf ))log(P(C2(f w,r,inf ))) (11)
[0050] In formula (11), f w,r,inf Represents x w,r After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0051] Step 3.2.3, in the wth group of image sample sequence X` w In the formula (12), the rth image sample x` w,r Get the category z with the highest classification probability excluding its own label category;
[0052] z=argmax({p j |j=1,2,...,c,j≠y w,r}) (12)
[0053] In formula (12), argmax represents the index function for finding the maximum value in a set. Represents the rth image sample x` w,rThe probability of classifying causally related features, y w,r Represents x` w,r The category label of w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, p j represents f w,r,sup The probability of belonging to category j;
[0054] Step 3.2.4, in the w-th group of image sample sequence X` w In the example, x is the rth image sample x` w,r Obtain the image sample that belongs to category z and has the lowest false correlation feature information entropy as the sample to be fused; use formula (13) to calculate the rth image sample x` w,r The sample index q to be fused is used to determine x` w,r The sample to be fused x` w,q ;
[0055] q=argmin({IE(f w,r`,inf )|r`=1,2,...,n,y w,r` =z}) (13)
[0056] In formula (13), y w,r` Represents x` w,r` The category label, f w,r`,inf Represents x w,r` After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0057] Step 3.2.5: Use formula (14) to perform feature fusion and obtain X` w The false correlation difficulty feature f w,r,CR :
[0058] f w,r,CR =FC([f w,r,sup ,f w,q,inf ]) (14)
[0059] In formula (14), f w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f w,q,inf Represents x` w,q After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0060] Step 3.2.6: Use formula (15) to construct the domain invariant feature extractor FI Contrastive learning loss function Used to update the domain invariant feature extractor F I Network parameters;
[0061]
[0062] In formula (15), f w,r,I Represents x w,r Input domain invariant feature extractor F I The domain invariant features obtained by processing in .
[0063] An electronic device of the present invention includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the feature augmentation field generalized image recognition method, and the processor is configured to execute the program stored in the memory.
[0064] The present invention provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and the computer program executes the steps of the feature augmentation domain generalization image recognition method when the computer program is executed by a processor.
[0065] Compared with the prior art, the present invention has the following beneficial effects:
[0066] 1. By proposing a feature decoupling network, the present invention can eliminate potential domain style information and false correlation non-causal information in the features, so that the model can better learn domain-invariant and causally related information from the source domain, thereby improving the generalization ability of the model in unknown target domains.
[0067] 2. The present invention constructs style transfer difficulty features and causal perturbation difficulty features through feature augmentation, so that the model pays more attention to those difficult samples that are difficult to distinguish, thereby improving the model's ability to recognize difficult samples in unknown target domains. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 is a training flow chart of the method of the present invention;
[0069] Figure 2 This is the overall model diagram of the present invention. DETAILED DESCRIPTION
[0070] In this embodiment, a feature augmentation domain generalization image recognition method based on feature decoupling is provided. The feature decoupling framework is used to decouple the potential domain style information and false correlation non-causal information in the features to improve the generalization ability of the model. The difficult features are constructed through feature augmentation to improve the recognition ability of the model for difficult samples, thereby further improving the generalization ability of the model. Specifically, Figure 1 As shown, the method is performed in the following steps:
[0071] Step 1: Obtain n sample label pairs from k source domains respectively to form a sample label pair set Among them, x i represents the i-th image sample; y i Represents x i The category label of y i ∈{1,2,...,c}, c represents the total number of categories, d i Represents x i The label of the source domain, and d i ∈{1,2,...,k}; k represents the total number of source domains; n represents the number of sample label pairs in each source domain; in this example, the training images are normalized and then randomly cropped to a pixel size of 224×224, and the test images are center cropped and the image pixel size is adjusted to 224×224.
[0072] Step 2: Figure 2 As shown, a feature decoupling network is established, including: domain invariant feature extractor F I , domain style feature extractor F S , domain discriminator C d , mask network M, first task classifier C1 and second task classifier C2; among them, the domain invariant feature extractor and domain style feature extractor adopt ResNet-50 network structure, the domain discriminator and the first and second task classifiers adopt a fully connected layer, and the mask network adopts a three-layer Conv-BN-ReLU structure.
[0073] Step 2.1: Construct a domain-invariant feature extractor F I , domain style feature extractor F S , domain discriminator C d Domain-invariant feature decoupling network; Domain style change is the biggest problem of DG tasks. As the sample style changes, the distribution of sample data will also change. Therefore, through the domain-invariant feature decoupling network, the model can learn only semantic information, which can alleviate the degradation of model performance caused by style change.
[0074] Step 2.1.1, x i The input domain invariant feature is decoupled into the network and then passes through the domain style feature extractor F S After processing, we get the i-th domain style feature f i,S , and then pass through the domain discriminator C d After processing, the classification probability of the i-th domain style feature is obtained;
[0075] Step 2.1.2: Use formula (1) to construct the domain style feature extractor F S and domain discriminator C d The loss function
[0076]
[0077] In formula (1), l represents the cross entropy loss;
[0078] Step 2.1.3, calculate formula (1), update domain style feature extractor F S and domain discriminator C d Network parameters;
[0079] Step 2.1.4, x i Input domain invariant feature extractor F I Processed in, we get the i-th domain invariant feature f i,I , and then input the trained domain discriminator C d , and obtain the classification probability of the i-th domain invariant feature;
[0080] Step 2.1.5: Use formula (2) to construct a domain-invariant feature extractor F I The loss function
[0081]
[0082] Step 2.1.6: In order to achieve the purpose of obtaining domain-invariant features, the domain-invariant feature extractor F I The extracted features should not be distinguished by the domain classifier, and the classification probability should be average. Calculation formula (2) Update domain invariant feature extractor F I Network parameters;
[0083] Step 2.2: Construct a causal feature decoupling network consisting of a mask network M and two task classifiers C1 and C2. Due to the limitations of the data set and the lack of sample diversity, the model will inevitably learn some falsely correlated non-causal information when learning the statistical relationship between samples and labels. Therefore, the causal feature decoupling network is used to decouple the potential falsely correlated non-causal information in the domain-invariant features.
[0084] Step 2.2.1: Use formula (3) to get the i-th causal feature mask M i,sup and the ith false correlation feature mask M i,inf ;
[0085] M i,sup =M(f i,I ), M i,inf =1-M(f i,I ) (3)
[0086] Step 2.2.2: Use formula (4) to get the ith causal correlation feature fi,sup and the ith false correlation feature f i,inf ;
[0087] f i,sup =M i,sup *f i,I , f i,inf =M i,inf *f i,I (4)
[0088] Step 2.2.3: Use formula (5) to construct the classification loss of the first task classifier C1 and the classification loss of the second task classifier C2
[0089]
[0090] Step 2.2.5, calculate formula (5), update the domain invariant feature extractor F I and the network parameters of the two task classifiers C1 and C2;
[0091] Step 2.2.6: Use formula (6) to construct the loss function of the mask network M
[0092]
[0093] Step 2.2.7: In order to achieve the purpose of decoupling causal information and false correlation information for domain-invariant features, the mask network M should reduce the classification loss of causal-related features as much as possible while making false correlation features unable to be correctly classified by the classifier. Calculate formula (6) and update the network parameters of the mask network M;
[0094] Step 3: Use the feature decoupling network to augment the features. Based on the feature decoupling network, construct difficult features from two perspectives: cross-domain style changes and non-causal information of cross-class false correlations, to improve the robustness of the model for difficult samples.
[0095] Step 3.1, merging causal correlation features with domain style features to form style transfer difficulty features;
[0096] Step 3.1.1, select an image sample from each source domain in turn, k image samples constitute a set of image sample sequences, thus obtaining n sets of image sample sequences X v represents the vth group of image sample sequences, and x v,t Represents the vth group of image sample sequence X v The image sample of the t-th source domain in ;
[0097] Step 3.1.2: Calculate X using formula (7)v The image sample x of the tth source domain in v,t The information entropy IE(f v,t,S ); In order to select the most obvious style feature from the style features of other domains as the sample to be fused for each feature to be augmented, information entropy is used as the standard to measure style information. The lower the information entropy, the clearer the style information.
[0098] IE(f v,t,S )=-P(C d (f v,t,S ))log(P(C d (f v,t,S ))) (7)
[0099] In formula (7), P represents the Softmax function; f v,t,S Represents x v,t After the domain style feature extractor F S The domain style features obtained after processing;
[0100] Step 3.1.3: In the vth group of image sample sequence X v In the example, x is the image sample x in the tth source domain. v,t Get the sample x with the lowest domain style feature information entropy except for itself v,p As the sample to be fused; use formula (8) to calculate the image sample x of the tth source domain v,t The sample index p to be fused is used to determine x v,t The sample to be fused x v,p ;
[0101] p = argmin({IE(f v,t`,S )|t`=1,2,...,k,t`≠t}) (8)
[0102] In formula (8), argmin represents the function for finding the minimum index in a set, f v,t`,S Represents the image sample x of the t`th source domain v,t` After the domain style feature extractor F S The domain style features obtained after processing;
[0103] Step 3.1.4: Use formula (9) to get the image sample x of the tth source domain v,t The style transfer difficulty feature f v,t,DR :
[0104] f v,t,DR =FC([f v,t,sup ,f v,p,S ]) (9)
[0105] In formula (9), FC represents the fully connected layer, [,] represents the concat operation; f v,t,sup Represents x v,t After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f v,p,S Represents x v,p After the domain style feature extractor F S The domain style features obtained after processing;
[0106] Step 3.1.5: Use formula (10) to construct a domain-invariant feature extractor F I Contrastive learning loss function The semantic information of the difficult-to-style-transfer feature is consistent with the domain-invariant feature, and the domain-invariant feature more or less retains its original domain style information. Therefore, we conduct comparative learning on the domain-invariant feature and the difficult-to-style-transfer feature, bring the positive samples closer in the feature space, and enable the model to eliminate the potential domain style information in the domain-invariant feature, thereby improving the model's generalization ability for difficult samples.
[0107]
[0108] In formula (10), l cl represents the supervised contrastive learning loss; f v,t,I Represents x v,t Input domain invariant feature extractor F I The domain invariant features obtained by processing in
[0109] Step 3.2, merging the causal correlation features with the false correlation features to form the causal disturbance difficulty features;
[0110] Step 3.2.1: Take n image samples of each source domain as a group, so as to obtain k groups of image sample sets X` w represents the wth set of image samples, and Among them, x` w,r Represents the w-th group of image sample set X` w The rth image sample in ;
[0111] Step 3.2.2: Calculate X' using formula (11) w The rth image sample x` w,r The information entropy IE(f w,r,inf ); In order to select the strongest false correlation feature for each feature to be augmented as the sample to be fused, information entropy is used as the standard to measure false correlation. The lower the information entropy, the stronger the false correlation.
[0112] IE(f w,r,inf)=-P(C2(f w,r,inf ))log(P(C2(f w,r,inf ))) (11)
[0113] In formula (11), f w,r,inf Represents x w,r After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0114] Step 3.2.3, in the wth group of image sample sequence X` w In the formula (12), the rth image sample x` w,r Get the category z with the highest classification probability excluding its own label category;
[0115] z=argmax({p j |j=1,2,...,c,j≠y w,r}) (12)
[0116] In formula (12), argmax represents the index function for finding the maximum value in a set. Represents the rth image sample x` w,r The probability of classifying causally related features, y w,r Represents x` w,r The category label of w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, p j represents f w,r,sup The probability of belonging to category j;
[0117] Step 3.2.4, in the w-th group of image sample sequence X` w In the example, x is the rth image sample x` w,r Obtain the image sample that belongs to category z and has the lowest false correlation feature information entropy as the sample to be fused; use formula (13) to calculate the rth image sample x` w,r The sample index q to be fused is used to determine x` w,r The sample to be fused x` w,q ; When the semantic information of a sample is similar to the semantics of another class, the virtual association non-causal information of the other class will also be virtually associated with the current sample.
[0118] q=argmin({IE(f w,r`,inf )|r`=1,2,...,n,y w,r` =z}) (13)
[0119] In formula (13), y w,r`Represents x` w,r` The category label, f w,r`,inf Represents x w,r` After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0120] Step 3.2.5: Use formula (14) to perform feature fusion and obtain X` w The false correlation difficulty feature f w,r,CR :
[0121] f w,r,CR =FC([f w,r,sup ,f w,q,inf ]) (14)
[0122] In formula (14), f w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f w,q,inf Represents x` w,q After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M;
[0123] Step 3.2.6: Use formula (15) to construct the domain invariant feature extractor F I Contrastive learning loss function By comparative learning of domain-invariant features and false correlation difficulty features, the distance between positive samples in the feature space is shortened, and the model eliminates potential false correlation non-causal information in the domain-invariant features, thereby improving the model's generalization ability for difficult samples.
[0124]
[0125] In formula (12), f w,r,I Represents x w,r Input domain invariant feature extractor F I The domain invariant features obtained by processing in
[0126] Step 3.3: Calculate equations (10) and (15) to update the domain invariant feature extractor F I Network parameters;
[0127] Step 4: According to the process of step 1 to step 3, the feature decoupling network is trained using the gradient descent algorithm to obtain the trained domain invariant feature extractor F` I And the first task classifier C`1 is used to realize the recognition of images from unknown fields.
[0128] In this embodiment, an electronic device includes a memory and a processor, wherein the memory is used to store a program that supports the processor to execute the above method, and the processor is configured to execute the program stored in the memory.
[0129] In this embodiment, a computer-readable storage medium stores a computer program on the computer-readable storage medium, and the computer program executes the steps of the above method when executed by a processor.
Claims
1. A feature-enhanced domain generalized image recognition method based on feature decoupling, characterized in that: The steps are as follows: Step 1: Obtain n sample label pairs from k source domains respectively to form a sample label pair set Among them, x i represents the i-th image sample; y i Represents x i The category label of y i ∈{1,2,...,c}, c represents the total number of categories, d i Represents x i The label of the source domain, and d i ∈{1,2,...,k}; k represents the total number of source domains; n represents the number of sample label pairs in each source domain; Step 2: Establish a feature decoupling network, including: domain invariant feature extractor F I , domain style feature extractor F S , domain discriminator C d , mask network M, first task classifier C1 and second task classifier C2; Step 2.1: Construct a domain-invariant feature extractor F I , domain style feature extractor F S , domain discriminator C d The domain-invariant feature decoupling network composed of i Processing is performed to obtain the i-th domain style feature f i,S and the i-th domain invariant feature f i,I , thereby constructing the domain style feature extractor F S and domain discriminator C d The loss function And build domain invariant feature extractor F I The loss function Step 2.2: Construct a causal feature decoupling network consisting of a mask network M and two task classifiers C1 and C2, and use it to classify f i,I Processing is performed to construct the loss function of the mask network M Step 3: Use the feature decoupling network to augment the features; Step 3.1: Pass the domain-invariant feature extractor F I The causal correlation features processed by the mask network M and the domain style feature extractor F S The processed domain style features are fused to form the style transfer difficulty features, thereby constructing the domain invariant feature extractor F I Contrastive learning loss function Step 3.2: Pass the domain invariant feature extractor F I The causal correlation features processed by the mask network M and the domain invariant feature extractor F I The false correlation features processed by the mask network M are fused to form the causal perturbation difficulty features, thereby constructing the domain invariant feature extractor F I Contrastive learning loss function Used to update the domain invariant feature extractor F I Network parameters; Step 4: According to the process of step 1 to step 3, the feature decoupling network is trained using the gradient descent algorithm to obtain the trained domain invariant feature extractor F` I And the first task classifier C`1 is used to realize the recognition of images from unknown fields.
2. The feature-enlarged domain generalized image recognition method based on feature decoupling according to claim 1, characterized in that: The step 2.1 is carried out as follows: Step 2.1.1, x i The input domain invariant feature is decoupled into the network and then passes through the domain style feature extractor F S After processing, we get the i-th domain style feature f i,S , and then pass through the domain discriminator C d After processing, the classification probability of the i-th domain style feature is obtained; Step 2.1.2: Use formula (1) to construct the domain style feature extractor F S and domain discriminator C d The loss function Used to update the domain style feature extractor F S and domain discriminator C d Network parameters; In formula (1), l represents the cross entropy loss; Step 2.1.3: x i Input domain invariant feature extractor F I Processed in, we get the i-th domain invariant feature f i,I , and then input the trained domain discriminator C d , and obtain the classification probability of the i-th domain invariant feature; Step 2.1.4: Use formula (2) to construct a domain-invariant feature extractor F I The loss function Used to update the domain invariant feature extractor F I Network parameters; 3. The feature-enlarged domain generalized image recognition method based on feature decoupling according to claim 2, characterized in that: The step 2.2 is carried out as follows: Step 2.2.1: Use formula (3) to get the i-th causal feature mask M i,sup and the ith false correlation feature mask M i,inf ; M i,sup =M(f i,I ),M i,inf =1-M(f i,I ) (3) Step 2.2.2: Use formula (4) to get the ith causal correlation feature f i,sup and the ith false correlation feature f i,inf ; f i,sup =M i,sup *f i,I ,f i,inf =M i,inf *f i,I (4) Step 2.2.3: Use formula (5) to construct the classification loss of the first task classifier C1 and the classification loss of the second task classifier C2 Used to update the domain invariant feature extractor F I And the network parameters of the two task classifiers C1 and C2 Step 2.2.4: Use formula (6) to construct the loss function of the mask network M Used to update the network parameters of the mask network M; 4. The feature-enlarged domain generalized image recognition method based on feature decoupling according to claim 3, characterized in that: The step 3.1 is carried out as follows: Step 3.1.1, select an image sample from each source domain in turn, k image samples constitute a set of image sample sequences, thus obtaining n sets of image sample sequences X v represents the vth group of image sample sequences, and x v,t Represents the vth group of image sample sequence X v The image sample of the t-th source domain in ; Step 3.1.2: Calculate X using formula (7) v The image sample x of the tth source domain in v,t The information entropy IE(f v,t,S ); IE(f v,t,S )=-P(C d (f v,t,S ))log(P(C d (f v,t,S ))) (7) In formula (7), P represents the Softmax function; f v,t,S Represents x v,t After the domain style feature extractor F S The domain style features obtained after processing; Step 3.1.3: In the vth group of image sample sequence X v In the example, x is the image sample x in the tth source domain. v,t Get the sample x with the lowest domain style feature information entropy except for itself v,p As the sample to be fused; use formula (8) to calculate the image sample x of the tth source domain v,t The sample index p to be fused is used to determine x v,t The sample to be fused x v,p ; p=argmin({IE(f v,t`,S )|t`=1,2,...,k,t`≠t}) (8) In formula (8), argmin represents the function for finding the minimum index in a set, f v,t`,S Represents the image sample x of the t`th source domain v,t` After the domain style feature extractor F S The domain style features obtained after processing; Step 3.1.4: Use formula (9) to get the image sample x of the tth source domain v,t The style transfer difficulty feature f v,t,DR : f v,t,DR =FC([f v,t,sup ,f v,p,S ]) (9) In formula (9), FC represents the fully connected layer, [,] represents the concat operation; f v,t,sup Represents x v,t After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f v,p,S Represents x v,p After the domain style feature extractor F S The domain style features obtained after processing; Step 3.1.5: Use formula (10) to construct a domain-invariant feature extractor F I Contrastive learning loss function Used to update the domain invariant feature extractor F I Network parameters; In formula (10), l cl represents the supervised contrastive learning loss; f v,t,I Represents x v,t Input domain invariant feature extractor F I The domain invariant features obtained by processing in .
5. The feature-enlarged domain generalized image recognition method based on feature decoupling according to claim 4, characterized in that: The step 3.2 is carried out as follows: Step 3.2.1: Take n image samples of each source domain as a group, so as to obtain k groups of image sample sets X` w represents the wth set of image samples, and Among them, x` w,r Represents the w-th group of image sample set X` w The rth image sample in ; Step 3.2.2: Calculate X' using formula (11) w The rth image sample x` w,r The information entropy IE(f w,r,inf ); IE(f w,r,inf )=-P(C2(f w,r,inf ))log(P(C2(f w,r,inf ))) (11) In formula (11), f w,r,inf Represents x w,r After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M; Step 3.2.3, in the wth group of image sample sequence X` w In the formula (12), the rth image sample x` w,r Get the category z with the highest classification probability excluding its own label category; z=argmax({p j |j=1,2,...,c,j≠y w,r }) (12) In formula (12), argmax represents the index function for finding the maximum value in a set. Represents the rth image sample x` w,r The probability of classifying causally related features, y w,r Represents x` w,r The category label of w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, p j represents f w,r,sup The probability of belonging to category j; Step 3.2.4, in the w-th group of image sample sequence X` w In the example, x is the rth image sample x` w,r Obtain the image sample that belongs to category z and has the lowest false correlation feature information entropy as the sample to be fused; use formula (13) to calculate the rth image sample x` w,r The sample index q to be fused is used to determine x` w,r The sample to be fused x` w,q ; q=argmin({IE(f w,r`,inf )|r`=1,2,...,n,y w,r` =z}) (13) In formula (13), y w,r` Represents x` w,r` The category label, f w,r`,inf Represents x w,r` After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M; Step 3.2.5: Use formula (14) to perform feature fusion and obtain X` w The false correlation difficulty feature f w,r,CR : f w,r,CR =FC([f w,r,sup ,f w,q,inf ]) (14) In formula (14), f w,r,sup Represents x` w,r After domain-invariant feature extractor F I The causal correlation features obtained after processing with the mask network M, f w,q,inf Represents x` w,q After domain-invariant feature extractor F I The false correlation features obtained after processing with the mask network M; Step 3.2.6: Use formula (15) to construct the domain invariant feature extractor F I Contrastive learning loss function Used to update the domain invariant feature extractor F I Network parameters; In formula (15), f w,r,I Represents x w,r Input domain invariant feature extractor F I The domain invariant features obtained by processing in .
6. An electronic device, comprising a memory and a processor, characterized in that: The memory is used to store a program that supports the processor to execute the feature augmentation domain generalized image recognition method described in any one of claims 1-5, and the processor is configured to execute the program stored in the memory.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the feature augmentation domain generalization image recognition method described in any one of claims 1 to 5 are executed.
