Domain generalization image recognition method based on multi-view mining invariant information

Through multi-view mining of invariant information and the entropy concept of information theory, the problem of insufficient generalization ability of image classification models under domain migration is solved, and the accuracy of target domain image classification and the richness of semantic information are improved, especially in complex backgrounds. "Difficult sample" processing capabilities.

CN118657981APending Publication Date: 2024-09-17ANHUI UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410681090.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

The existing technology has insufficient generalization ability of image classification models in domain migration scenarios. Especially when there are significant differences in data distribution between different domains, it is difficult to effectively extract shared representations, resulting in low target domain image classification accuracy and poor accuracy for complex backgrounds. The "difficult samples" are not handled well.

Method used

A domain generalization image recognition method based on multi-view mining of invariant information is adopted. By constructing multi-view adversarial mining modules, causal classifiers and non-causal classifiers, combined with frequency domain and spatial domain views, semantic information is extracted, and through the entropy concept of information theory Set weights for samples to enhance the model's ability to resolve images in the target domain.

Benefits of technology

It improves the accuracy of image classification in the target domain, enhances the richness and accuracy of semantic information, effectively handles difficult samples with complex backgrounds, and improves the generalization ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118657981A
    Figure CN118657981A
Patent Text Reader

Abstract

The invention discloses a field generalization image recognition method based on multi-view mining invariant information. The method comprises the steps of 1, defining a field generalization image data set with c categories; 2, constructing a field generalization network model based on multi-view mining invariant information; 3, training the constructed network model by using a multi-view adversarial mining strategy and a difficult sample weighting strategy; and 4, constructing a two-stage loss function optimization model weight parameter to obtain an optimal target domain image classification model. According to the method, rich discriminative information is mined by exploring different views of image features, and then the sample weight is adaptively calculated to increase the attention to a difficult sample, so that accurate recognition of target domain image categories can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer transfer learning domain generalized image classification, and specifically is a domain generalized image recognition method based on multi-view mining invariant information. Background Art

[0002] In recent years, deep learning has been widely used in computer vision, natural language processing and other fields, especially deep convolutional neural networks (CNNs) have achieved excellent performance in the field of computer vision. However, traditional models designed based on deep neural networks often rely on a large amount of labeled data for training. When faced with unknown data distribution and data distribution migration, the models often show instability and unreliability. For example, images in the painting domain contain rich color information and texture information, while images in the sketch domain have simple colors, lack color information, and the sketch style is relatively abstract. Due to the domain migration phenomenon between the two domains, the model trained on the painting domain performs poorly on the unknown sketch domain, so it is crucial to solve the problem of decreased model generalization ability caused by domain migration. In recent years, domain adaptation (DA) has been widely used to solve the domain migration problem. This method requires the use of a large amount of unlabeled data in the unknown domain for training. However, in reality, many unknown domain data are invisible, so the domain adaptation method also becomes limited. Therefore, domain generalization (DG) has become the mainstream method to solve the domain migration problem, and its purpose is to migrate the labeled source domain information to the unknown target domain.

[0003] In the domain generalization task, the labeled image information of the source domain is used for model training, and all image information of the target domain is invisible and does not participate in model training and parameter updating. The label distribution of the source domain and the target domain is consistent, but there are certain differences in style distribution. Previous methods usually design data augmentation or construct self-supervised auxiliary tasks to learn shared representations between domains, so as to make good predictions on the target domain.

[0004] However, since shared representations between domains are usually hidden in complex domain-specific information, it is challenging to extract shared information from images or features. This is because previous methods often only extract semantic information from a single perspective, ignoring the complexity of extracting domain-invariant information, resulting in insufficient semantic learning of the model, and thus unable to distinguish the category of the target domain image. In addition, due to the different complexity of the content between image samples in the dataset, the difficulty of decoupling samples into domain-shared representations and domain-specific representations is also different. For example: a dog running on a noisy street and a dog sketch, both belong to different domain distributions. The former has a complex background and is more difficult to decouple, while the latter has a simple background and is less difficult to decouple. However, most of the current domain generalization methods do not properly handle these "difficult samples" that are difficult to decouple. Summary of the invention

[0005] The present invention aims to address the deficiencies of the above-mentioned prior art and proposes a domain generalized image recognition method based on multi-view mining of invariant information, in order to extract rich and accurate semantic information through different views of image features, while mining complex and entangled "difficult samples", thereby improving the accuracy of target domain image classification.

[0006] In order to achieve the above-mentioned purpose, the present invention adopts the following technical scheme:

[0007] The invention provides a method for domain generalization image recognition based on multi-view mining of invariant information, which comprises the following steps:

[0008] Step 1: Define the domain generalization image dataset as D = {D s , D t}, where D s represents an image dataset containing multiple source domains, D t Represents the target domain image dataset with unknown data distribution; let x s D s Any labeled source domain image in s Represents x s The category label of y s ∈{1, 2, ..., c}; c represents the total number of categories; let x t D t Any target domain image in , and the source domain image and the target domain image belong to the same label space;

[0009] Step 2: Construct a domain generalization network based on multi-view mining of invariant information, including: feature extraction network E, multi-view adversarial mining module, and causal classifier C for identifying invariant information 1 , a non-causal classifier C for identifying false information 2 , a module for weighting difficult samples;

[0010] The multi-view adversarial mining module includes: a frequency domain branch, a spatial domain branch and a fusion branch;

[0011] The frequency domain branch includes: a frequency domain view adversarial mask network M F ;

[0012] The spatial branch includes: a spatial view adversarial mask network M S ;

[0013] The convolutional layers and fully connected layers in the multi-view mining invariant information network model are initialized with Xavier initialization.

[0014] Step 3: Training strategy based on multi-view mining invariant information network model, including: multi-view complementary adversarial mining semantic invariant information strategy and difficult sample mining strategy;

[0015] Step 3.1: Multi-view complementary adversarial mining semantic invariant information strategy Based on the complementarity between views, a new feature view is designed to mine the source domain image x s and source domain features f s The semantically invariant information in the fusion causal information f sup and fused non-causal information into f inf ;

[0016] Step 3.2: Difficult sample mining strategy uses the causal classifier C 1 For causal information f sup Make a new prediction and get a new probability distribution Thus, the new cross entropy loss function of the causal classifier C1 is calculated using formula (16):

[0017]

[0018] In formula (16), represents weight;

[0019] Step 4: Model training:

[0020] Step 4.1: Use formula (17) to construct the feature extractor E and causal classifier C 1 and non-causal classification C 2 The overall loss function

[0021]

[0022] In formula (17), Denotes the causal classifier C 1 The cross entropy loss function of Denotes the non-causal classifier C 2 The cross entropy loss function of

[0023] Step 4.2: Use formula (18) to construct the frequency domain view adversarial mask network and Spatial View Adversarial Mask Network The overall loss function

[0024]

[0025] In formula (18), represents the regularization loss between different views;

[0026] Step 4.3: Use equation (19) to construct the first update strategy:

[0027]

[0028] In formula (19), ← represents assignment, θ e is the parameter of the feature extraction network E, θ c1 is the causal classifier C 1 The parameter θ c2 is a non-causal classifier C 2 Parameters;

[0029] The second update strategy is constructed using formula (20):

[0030]

[0031] In formula (19) and formula (20), η represents the learning rate; Mask network for the frequency domain view Parameters, Masking the network for the spatial view Parameters;

[0032] Step 4.4: Based on the domain generalization image dataset D = {D s , D t}, when the domain generalization network is trained each time using the stochastic gradient descent method, the feature extraction network E and the causal classifier C are first trained. 1 and the non-causal classifier C 2 Train and update its parameters using formula (19). Then, fix E and C 1 and C 2 Parameters of the frequency domain mask network and spatial mask network Train and update its parameters using formula (20); until the loss function and Until convergence or the maximum number of iterations is reached, the optimal domain generalization model based on multi-view mining invariant information is obtained, which is used to t The target domain images in .

[0033] The field generalization image recognition method described in the present invention is also characterized in that the feature extraction network E in step 2 adopts a ResNet-50 structure, which is composed of an input convolution layer, a maximum pooling layer, M downsampling convolution layers, Q residual convolution blocks, and an average pooling layer in sequence; and each convolution layer is connected to a batch normalization layer and a ReLU activation function;

[0034] The spatial view adversarial mask network MS and frequency domain view against the mask network M F It consists of H layers of fully connected neural networks, each of which is followed by a batch normalization layer, a ReLU activation function, and a Dropout regularization layer.

[0035] The causal classifier C that identifies the invariant information 1 and a non-causal classifier C for identifying false information 2 It consists of a fully connected network and a batch normalization layer;

[0036] The step 3.1 includes the following process:

[0037] Step 3.1.1: The source domain image x s Input into the feature extraction network E for processing, and obtain the source domain feature f accordingly s , where f s The spatial information of is composed of w*h eigenvalues, wherein any eigenvalue is recorded as z(x, y), x and y are respectively the position coordinates of each eigenvalue in the spatial information; w and h are respectively the width and height of the spatial information matrix;

[0038] Step 3.1.2: The frequency domain branch is used for the source domain feature f s Perform frequency domain mask recognition to obtain causal information and non-causal information

[0039] Step 3.1.3: The spatial branch uses global average pooling AvgPool() to pool the source domain features f s After processing, the obtained pooled spatial features are input into the spatial view adversarial mask network M S Mask processing is performed in to obtain the mask of the spatial view

[0040] Using equations (8) and (9), we can obtain the causal information in the spatial domain: and non-causal information

[0041]

[0042]

[0043] Step 3.1.4: The fusion branch converts the causal information in the frequency domain and causal information in the spatial domain After fusion, the fused causal information is obtained Among them, γ is the fusion coefficient;

[0044] The fusion branch converts the non-causal information in the frequency domain and non-causal information in the spatial domain After fusion, the fused non-causal information is obtained as

[0045] Step 3.1.5: Fusion causal information f sup The causal information f is input into the causal classifier C1 for processing and the causal information f is obtained. sup The output category probability prediction distribution p(y s |C 1 (f sup )); thus, the causal classifier C is calculated using formula (10) 1 The cross entropy loss function

[0046]

[0047] Step 3.1.6: Fusion of non-causal information f inf Input the non-causal classifier C 2 is processed and the non-causal information f is obtained inf The output category probability prediction distribution p(y s |C 2 (f inf )); thereby using formula (11) to calculate the non-causal classifier C 2 The cross entropy loss function

[0048]

[0049] Use formula (12) to calculate the regularization loss between different views

[0050]

[0051] In formula (12), T represents transposition;

[0052] The step 3.1.2 includes the following process:

[0053] Using formula (1), the source domain feature f s Perform Fourier transform on the spatial information to obtain the frequency domain view

[0054]

[0055] In formula (1), (u, v) represents the spatial position of each frequency in the frequency domain view, represents the real part of each frequency, and is obtained from equation (2): represents the imaginary part of each frequency and is obtained by equation (3); i represents the imaginary unit;

[0056]

[0057]

[0058] Based on the information of each frequency, the amplitude α(u, v) and phase ρ(u, v) of each frequency are calculated using equations (4) and (5):

[0059]

[0060]

[0061] The frequency domain view adversarial mask network M F After combining the amplitude α and phase ρ of all frequencies, the causal mask of the frequency domain view is calculated

[0062] Using equations (6) and (7), we can obtain the causal information identified by frequency domain mask: and non-causal information

[0063]

[0064]

[0065] In equations (6) and (7), IFFT represents inverse Fourier transform, represents element-by-element matrix multiplication, A frequency domain view showing the spatial locations of all frequencies.

[0066] The weights in step 3.2 It is obtained by the following process;

[0067] Use formula (13) to calculate the causal classifier C 1 For causal information f sup The predicted entropy

[0068]

[0069] Use formula (14) to calculate the non-causal classifier C2 for the non-causal information f inf The predicted entropy

[0070]

[0071] Use formula (15) to calculate the source domain image x s Weight

[0072]

[0073] In formula (15), represents the entropy difference between the causal classifier C1 and the non-causal classifier C2; and

[0074] The 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 domain generalization image recognition method, and the processor is configured to execute the program stored in the memory.

[0075] 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 domain generalization image recognition method when executed by a processor.

[0076] Compared with the prior art, the present invention has the following beneficial effects:

[0077] 1. In order to solve the problem of lack of semantic information and inaccuracy caused by complex information entanglement, the present invention introduces Fourier transform in the convolutional network, establishes a frequency domain view different from the traditional spatial domain features, and uses the global characteristics of the frequency domain view to supplement the locality of the traditional convolutional features, thereby enhancing the richness of the extracted semantic information. In addition, by training the adversarial recognition of causal information on different views, the interference of some false causal information related to labels is reduced, and the accuracy of semantic information is improved.

[0078] 2. The present invention introduces information theory to mine difficult samples in the data set. By using the concept of entropy in information theory to adaptively calculate the complexity of sample disentanglement, weights are set for the samples, so that the model can pay more attention to difficult samples that are difficult to disentangle, thereby improving the model's ability to resolve target domain images. BRIEF DESCRIPTION OF THE DRAWINGS

[0079] Figure 1 is a flow chart of the method of the present invention;

[0080] Figure 2 This is a structural diagram of the domain generalization network based on multi-view mining of invariant information in the present invention. DETAILED DESCRIPTION

[0081] In this embodiment, Figure 1 As shown in FIG, a domain generalization image recognition method based on multi-view mining of invariant information is performed in the following steps:

[0082] Step 1: Define the domain generalization image dataset as D = {D s , Dt}, where D s represents an image dataset containing multiple source domains, D t Represents the target domain image dataset with unknown data distribution; let x s D s Any labeled source domain image in s Represents x s The category label of y s ∈{1, 2, ..., c}; c represents the total number of categories; let x t D t Any target domain image in the source domain, and the label space to which the source domain image and the target domain image belong is the same; in this embodiment, all images in the source domain training set are horizontally inverted and color jittered, and the images are randomly cropped to a pixel size of 224×224 after normalization, and the pixel size of the test set images of the target domain is 224×224 after center cropping.

[0083] In this example, the method is evaluated on five public datasets, namely PACS, Office-Home, VLCS, TerraIncognita, and DomainNet;

[0084] PACS is a commonly used benchmark dataset. The dataset contains 9,991 images, covering images in four domains: “photo domain”, “cartoon domain”, “sketch domain”, and “painting domain”. Each domain contains seven common categories, and the styles of the domains vary greatly.

[0085] The Office-Home dataset consists of 15,500 target recognition images, all of which are distributed in four fields: art, clipart, products, and the real world, with a total of 65 main categories. This dataset constitutes four domain generalization tasks;

[0086] VLCS consists of 10,729 data distributed in four different domains, covering a total of 5 categories of data. The style differences between different domains of this dataset are small, and a total of four domain generalization tasks are constituted;

[0087] TerraIncognita is a dataset of wildlife images. The dataset has four domains, each of which is an image of wild animals taken by cameras at different locations. The differences between domains are small, but the image backgrounds are complex.

[0088] DomainNet is one of the largest datasets in the DG field, containing a total of 345 categories and approximately 600,000 images distributed in six domains.

[0089] Step 2: If Figure 2 As shown in Figure 1, a domain generalization network based on multi-view mining of invariant information is constructed, including: feature extraction network E, multi-view adversarial mining module, causal classifier C for identifying invariant information, and non-causal classifier C for identifying false information. 2 , a module for weighting difficult samples;

[0090] Among them, the multi-view adversarial mining module includes: frequency domain branch, spatial domain branch and fusion branch;

[0091] The frequency domain branch includes: frequency domain view adversarial mask network M F ;

[0092] The spatial branch includes: spatial view adversarial mask network M S ;

[0093] The feature extraction network E is based on the ResNet-50 structure, which consists of an input convolution layer, a maximum pooling layer, M downsampling convolution layers, Q residual convolution blocks, and an average pooling layer in sequence; and each convolution layer is connected to a batch normalization layer and a ReLU activation function; the output feature dimension of the feature extraction network E is 512, and the image is input into the feature extraction network E to output the features used for training.

[0094] Spatial View Adversarial Mask Network M S and frequency domain view against the mask network M F It consists of H layers of fully connected neural networks, each of which is followed by a batch normalization layer, a ReLU activation function, and a Dropout regularization layer; the output dimension of the last fully connected layer is determined by the feature dimension of the input mask network.

[0095] A causal classifier C] for identifying invariant information and a non-causal classifier C for identifying false information 2 It consists of a fully connected network and a batch normalization layer. In order to adapt to all classification tasks, the output dimension of the fully connected layer is specific to the total number of categories in each dataset.

[0096] Step 3: If Figure 2 As shown, the training strategies based on the multi-view mining invariant information network model include: multi-view complementary adversarial mining semantic invariant information strategy and difficult sample weighting strategy;

[0097] Step 3.1: Multi-view complementary adversarial mining semantic invariant information strategy;

[0098] Step 3.1.1: Source domain image x s Input into the feature extraction network E for processing, and obtain the source domain feature f accordingly s , the characteristic shape is: c×w×h; where fs The spatial information of is composed of w*h eigenvalues, where any eigenvalue is recorded as z(x, y), x and y are the position coordinates of each eigenvalue in the spatial information; w and h represent the width and height of the spatial information matrix respectively;

[0099] Step 3.1.2: Frequency domain branch to source domain feature f s Perform frequency domain mask recognition to obtain causal information and non-causal information The frequency domain mask is used to identify causal information that has a real correlation with the label, wherein the non-causal information mask is obtained by binary inversion of the mask that identifies the causal information.

[0100] Using formula (1), the source domain feature f s Perform Fourier transform on the spatial information to obtain the frequency domain view

[0101]

[0102] In formula (1), (u, v) represents the spatial position of each frequency in the frequency domain view, represents the real part of each frequency, and is obtained from equation (2): represents the imaginary part of each frequency and is obtained by equation (3); i represents the imaginary unit;

[0103]

[0104]

[0105] Based on the information of each frequency, the amplitude α(u, v) and phase ρ(u, v) of each frequency are calculated using equations (4) and (5):

[0106]

[0107]

[0108] After Fourier transform, each frequency in the frequency domain is associated with all the values ​​of the original features, so the frequency domain has the characteristics of a global perspective, which complements the locality of traditional convolutional features, and can be used as a new view to mine invariant semantic information.

[0109] Frequency Domain View Adversarial Mask Network M F After combining the amplitude α and phase ρ of all frequencies, the causal mask of the frequency domain view is calculated

[0110] According to Fourier transform theory, each frequency is a plane wave, and plane waves are composed of sine waves and cosine waves. Controlling the amplitude and phase of each plane wave is equivalent to controlling the sine wave and cosine wave of each plane wave, which means that the eigenvalues ​​in the original space corresponding to each frequency can be modified.

[0111] Using equations (6) and (7), we can obtain the causal information identified by frequency domain mask: and non-causal information

[0112]

[0113]

[0114] In equations (6) and (7), IFFT represents inverse Fourier transform, represents element-by-element matrix multiplication, A frequency domain view showing the spatial locations of all frequencies.

[0115] Step 3.1.3: The spatial branch uses global average pooling AvgPool() to pool the source domain features f s The processing is equivalent to compressing the features of spatial information, and the obtained pooled spatial features are then input into the spatial view adversarial mask network M S Mask processing is performed in to obtain the mask of the spatial view

[0116] Using equations (8) and (9), we can obtain the causal information in the spatial domain: and non-causal information

[0117]

[0118]

[0119] Step 3.1.4: Fusion branch combines the causal information in the frequency domain and causal information in the spatial domain After fusion, the fused causal information is obtained Among them, γ is the fusion coefficient;

[0120] The fusion branch combines the non-causal information in the frequency domain and non-causal information in the spatial domain After fusion, the fused non-causal information is obtained as

[0121] The fusion of causal information and non-causal information from different views is to mine richer semantic information from different views and then merge them. The value of the fusion coefficient γ is 0.5. When the value of γ is close to 0 or 1, the influence of one of the multiple views will be reduced, thus affecting the richness of the semantic information.

[0122] By designing new feature views, the complementarity between multiple views is used to mine semantically invariant information; the complementarity here is reflected in the complementarity of channels and space, as well as the complementarity of the locality of traditional convolutional features and the globality of frequency domain features.

[0123] Step 3.1.5: Fusion causal information f sup Input causal classifier C 1 and obtain the causal information f sup The output category probability prediction distribution p(y s |C 1 (f sup )); thus, the cross entropy loss function of the causal classifier C1 is calculated using formula (10)

[0124]

[0125] Step 3.1.6: Fusion of non-causal information f inf Input non-causal classifier C 2 is processed and non-causal information f is obtained inf The output category probability prediction distribution p(y s |C 2 (f inf )); thus, the non-causal classifier C is calculated using formula (11) 2 The cross entropy loss function

[0126]

[0127] The backbone network trains the ability to extract semantic information and the classifier's ability to discriminate samples by minimizing the above two losses, so that it also has good semantic perception and discrimination capabilities in the target domain.

[0128] The main function of the mask network is to identify causal information, and to form an adversarial relationship with the backbone network by minimizing the loss difference between the above two classification losses. Specifically, the backbone network minimizes the non-causal loss, and the mask network maximizes the non-causal loss, thus forming an adversarial relationship.

[0129] Use formula (12) to calculate the regularization loss between different views

[0130]

[0131] In formula (12), T represents transposition; the regularization loss calculates the orthogonal value between the semantic information mined from different views. By minimizing this loss, the semantic information mined from different views can be enriched.

[0132] Step 3.2: Difficult sample mining strategy;

[0133] Although the above multi-view complementary mining invariant semantic information module can effectively extract rich and accurate discriminative information, the model does not have the ability to distinguish the difficulty of samples, which leads to the model treating all samples equally, resulting in insufficient learning of some difficult samples with complex entanglements of causal and non-causal information;

[0134] The strategy of the present invention is based on the perspective of information theory. Entropy is an important indicator to measure the degree of sample chaos. Due to the different entanglement complexity of sample causal information and non-causal information, the classifier C 1 and C 2 A false causal relationship with the label may be established, thus affecting the difference in entropy between the two classifiers; therefore, this strategy calculates the predicted entropy of the two classifiers and then weights the samples.

[0135] Use formula (13) to calculate the causal classifier C 1 For causal information f sup The predicted entropy

[0136]

[0137] Using formula (14) to calculate the non-causal classifier C 2 For non-causal information f inf The predicted entropy

[0138]

[0139] Use formula (15) to calculate the source domain image x s Weight Here the weight of the sample is calculated by using the inverse proportional function:

[0140]

[0141] In formula (15), Represents the causal classifier C 1 and the non-causal classifier C 2 The entropy difference between

[0142] For difficult samples, due to the difficulty of disentanglement, the classifier C 1 and classifier C 2 The difference in prediction entropy between them is small, so it is necessary to give these samples a larger weight; the weight of the above samples is added to the causal information f obtained by multi-view mining. sup superior.

[0143] Causal Classifier C 1 For causal information f sup Make a new prediction and get a new probability distribution Thus, the causal classifier C is calculated using formula (16): 1 The new cross entropy loss function

[0144]

[0145] Step 4: Model training:

[0146] Step 4.1: Use formula (17) to construct feature extractor E and causal classifier C 1 and the non-causal classifier C 2 The overall loss function

[0147]

[0148] Step 4.2: Use equation (18) to construct the frequency domain view adversarial mask network and Spatial View Adversarial Mask Network The overall loss function

[0149]

[0150] The model parameters are divided into two parts: first, feature extractor E and classifier C 1 , C 2 Parameters of, second, frequency domain view against mask network and Spatial View Adversarial Mask Network The parameters of the two parts use different loss functions and are updated in stages, thus forming an adversarial relationship.

[0151] Step 4.3: Use equation (19) to construct the first update strategy:

[0152]

[0153] In formula (19), ← represents assignment, θ e is the parameter of the feature extraction network E, θ c1 is the causal classifier C 1 The parameter θc2 is a non-causal classifier C 2 Parameters.

[0154] The second update strategy is constructed using formula (20):

[0155]

[0156] In formula (19) and formula (20), η represents the learning rate. The initial value of η is set to 0.01 and decays to 0.1 times the original value at 80% of the total number of iterations. Masking the network for the frequency domain view Parameters, Masking the network for the spatial view Parameters.

[0157] Step 4.4: Based on the domain generalization image dataset D = {D s , D t}, when using stochastic gradient descent to train the domain generalization network each time, first train the feature extraction network E and the causal classifier C 1 and the non-causal classifier C 2 Train and update its parameters using formula (19). Then, fix E and C 1 and C 2 Parameters of the frequency domain mask network and spatial mask network Train and update its parameters using formula (20); until the loss function and Until convergence or the maximum number of iterations is reached, the optimal domain generalization model based on multi-view mining invariant information is obtained, which is used to t The target domain images in .

[0158] 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.

[0159] 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 domain generalization image recognition method based on multi-view mining of invariant information, characterized in that: The following steps are involved: Step 1: Define the domain generalization image dataset as D = {D s , D t }, where D s represents an image dataset containing multiple source domains, D t Represents the target domain image dataset with unknown data distribution; let x s D s Any labeled source domain image in s Represents x s The category label of y s ∈{1, 2, ..., c}; c represents the total number of categories; let x t D t Any target domain image in , and the source domain image and the target domain image belong to the same label space; Step 2: Construct a domain generalization network based on multi-view mining of invariant information, including: feature extraction network E, multi-view adversarial mining module, causal classifier C1 for identifying invariant information, non-causal classifier C2 for identifying false information, and a module for weighting difficult samples; The multi-view adversarial mining module includes: a frequency domain branch, a spatial domain branch and a fusion branch; The frequency domain branch includes: a frequency domain view adversarial mask network M F ; The spatial branch includes: a spatial view adversarial mask network M S ; The convolutional layers and fully connected layers in the multi-view mining invariant information network model are initialized with Xavier initialization. Step 3: Training strategy based on multi-view mining invariant information network model, including: multi-view complementary adversarial mining semantic invariant information strategy and difficult sample mining strategy; Step 3.1: Multi-view complementary adversarial mining semantic invariant information strategy Based on the complementarity between views, a new feature view is designed to mine the source domain image x s and source domain features f s The semantically invariant information in the fusion causal information f sup and fused non-causal information into f inf ; Step 3.2: The difficult sample mining strategy uses the causal classifier C1 to classify the causal information f sup Make a new prediction and get a new probability distribution Thus, the new cross entropy loss function of the causal classifier C1 is calculated using formula (16): In formula (16), represents weight; Step 4: Model training: Step 4.1: Use formula (17) to construct the overall loss function of the feature extractor E, the causal classifier C1 and the non-causal classifier C2 In formula (17), represents the cross entropy loss function of the causal classifier C1; represents the cross entropy loss function of the non-causal classifier C2; Step 4.2: Use formula (18) to construct the frequency domain view adversarial mask network and Spatial View Adversarial Mask Network The overall loss function In formula (18), represents the regularization loss between different views; Step 4.3: Use equation (19) to construct the first update strategy: In formula (19), ← represents assignment, θ e is the parameter of the feature extraction network E, θ c1 is the parameter of causal classifier C1, θ c2 are the parameters of the non-causal classifier C2; The second update strategy is constructed using formula (20): In formula (19) and formula (20), η represents the learning rate; Mask network for the frequency domain view Parameters, Masking the network for the spatial view Parameters; Step 4.4: Based on the domain generalization image dataset D = {D s , D t }, when the domain generalization network is trained each time using the stochastic gradient descent method, the feature extraction network E and the causal classifier C1 and the non-causal classifier C2 are first trained, and their parameters are updated using formula (19). Then, the parameters of E, C1 and C2 are fixed, and the frequency domain mask network is trained. and spatial mask network Train and update its parameters using formula (20); until the loss function and Until convergence or the maximum number of iterations is reached, the optimal domain generalization model based on multi-view mining invariant information is obtained, which is used to classify the target domain images in Dt.

2. The domain generalization image recognition method according to claim 1, characterized in that: The feature extraction network E in step 2 is based on the ResNet-50 structure, which is composed of an input convolution layer, a maximum pooling layer, M downsampling convolution layers, Q residual convolution blocks, and an average pooling layer in sequence; and each convolution layer is connected to a batch normalization layer and a ReLU activation function; The spatial view adversarial mask network M S and frequency domain view against the mask network M F It consists of H layers of fully connected neural networks, each of which is followed by a batch normalization layer, a ReLU activation function, and a Dropout regularization layer. The causal classifier C1 for identifying invariant information and the non-causal classifier C2 for identifying false information are composed of a fully connected network layer and a batch normalization layer.

3. The domain generalization image recognition method according to claim 1, characterized in that: The step 3.1 includes the following process: Step 3.1.1: The source domain image x s Input into the feature extraction network E for processing, and obtain the source domain feature f accordingly s , where f s The spatial information of is composed of w*h eigenvalues, wherein any eigenvalue is recorded as z(x, y), x and y are respectively the position coordinates of each eigenvalue in the spatial information; w and h are respectively the width and height of the spatial information matrix; Step 3.1.2: The frequency domain branch is used for the source domain feature f s Perform frequency domain mask recognition to obtain causal information and non-causal information Step 3.1.3: The spatial branch uses global average pooling AvgPool() to pool the source domain features f s After processing, the obtained pooled spatial features are input into the spatial view adversarial mask network M S Mask processing is performed in to obtain the mask of the spatial view Using equations (8) and (9), we can obtain the causal information in the spatial domain: and non-causal information Step 3.1.4: The fusion branch converts the causal information in the frequency domain and causal information in the spatial domain After fusion, the fused causal information is obtained Among them, γ is the fusion coefficient; The fusion branch converts the non-causal information in the frequency domain and non-causal information in the spatial domain After fusion, the fused non-causal information is obtained as Step 3.1.5: Fusion causal information f sup The causal information f is input into the causal classifier C1 for processing and the causal information f is obtained. sup The output category probability prediction distribution p(y s |C1(f sup )); thus, the cross entropy loss function of the causal classifier C1 is calculated using formula (10): Step 3.1.6: Fusion of non-causal information f inf The non-causal information f is input into the non-causal classifier C2 for processing, and the non-causal information f is obtained. inf The output category probability prediction distribution p(y s |C2(f inf )); thus, the cross entropy loss function of the non-causal classifier C2 is calculated using formula (11): Use formula (12) to calculate the regularization loss between different views In formula (12), T represents transposition.

4. The domain generalization image recognition method according to claim 3, characterized in that: The step 3.1.2 includes the following process: Using formula (1), the source domain feature f s Perform Fourier transform on the spatial information to obtain the frequency domain view In formula (1), (u, v) represents the spatial position of each frequency in the frequency domain view, represents the real part of each frequency, and is obtained from equation (2): represents the imaginary part of each frequency and is obtained by equation (3); i represents the imaginary unit; Based on the information of each frequency, the amplitude α(u, v) and phase ρ(u, v) of each frequency are calculated using equations (4) and (5): The frequency domain view adversarial mask network M F After combining the amplitude α and phase p of all frequencies, the causal mask of the frequency domain view is calculated Using equations (6) and (7), we can obtain the causal information identified by frequency domain mask: and non-causal information In equations (6) and (7), IFFT represents inverse Fourier transform, represents element-by-element matrix multiplication, A frequency domain view showing the spatial locations of all frequencies.

5. The domain generalization image recognition method according to claim 2, characterized in that: The weights in step 3.2 It is obtained by the following process; Using formula (13), we can calculate the causal classifier C1 for the causal information f sup The predicted entropy Use formula (14) to calculate the non-causal classifier C2 for the non-causal information f inf The predicted entropy Use formula (15) to calculate the source domain image x s Weight In formula (15), represents the entropy difference between the causal classifier C1 and the non-causal classifier C2; and 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 domain generalization image recognition method described in any one of claims 1 to 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 domain generalization image recognition method according to any one of claims 1 to 5 are executed.

Citation Information

Cited By

  • Model training method and device for image classification

    CN122289901A