Method, device and storage medium for improving generalization ability of computer vision model

By deploying stylized modules in computer vision models and using memory for supervised training, the problem of overfitting the model on the source domain is solved, and the generalization ability on the target domain is improved.

CN115223222BActive Publication Date: 2025-05-02SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210813812.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2025-05-02
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

Computer vision models overfitting on the source domain leads to insufficient generalization capabilities on the target domain.

Method used

Using the style alternating learning strategy, the style of input features is changed by deploying stylized modules (DBS modules) into the backbone network, and supervised training is used to avoid model overfitting.

Benefits of technology

This improves the generalization ability of computer vision models on the target domain, reduces the training burden, and does not add additional computing during the testing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115223222B_ABST
    Figure CN115223222B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device and storage medium for improving the generalization ability of a computer vision model, wherein the method comprises: obtaining a computer vision task data set, dividing the data set into S source domain data sets and a target domain data set according to the source; constructing a backbone network and initializing the backbone network; constructing S memory banks and initializing the memory banks; constructing a stylization module, deploying the stylization module to the backbone network, and training the backbone network using a style alternation learning strategy; during the test process, closing the stylization module, and using the trained backbone network to test on the target domain data set. The present invention deploys a stylization module in the backbone network, which can change the style of the input feature; by continuously changing the style of the feature stored in the memory bank, the backbone network is prevented from overfitting to the style of the source domain during training, and has better generalization ability, and can be widely used in the field of image processing and recognition technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing and recognition technology, and in particular to a method, device and storage medium for improving the generalization ability of a computer vision model. Background Art

[0002] With the development of society, computer vision applications are becoming more and more widespread, and various computer vision technologies are developing rapidly, bringing tremendous impetus to social development. Nowadays, more and more computer vision technologies are applied to various industries, such as pedestrian re-identification, autonomous driving, unmanned stores, etc. However, in implementation, these applications often face many difficulties: such as the difficulty in obtaining data and the high cost of data annotation. In order to save manpower and time costs, people usually use annotated public data sets to train computer vision models, and then use them directly in actual scenarios. However, this usually leads to performance degradation. The main reason for this is that the distribution of the source domain data set is different from the distribution of the target domain data set. Therefore, it is of great significance to propose a robust algorithm that resists distribution changes.

[0003] At present, the main problem facing generalization in the computer vision domain is how to reduce the overfitting problem of the model in the source domain and improve the generalization ability of the model in the target domain. The main solutions are as follows: enrich the style of the input data to improve the robustness of the model; improve the meta-learning framework to improve the generalization ability, etc. How to further generate richer and more varied styles, reduce the training burden, and design methods to avoid model overfitting still needs to be explored.

[0004] Terminology explanation:

[0005] CNN: Convolutional Neural Networks is a type of feedforward neural network that includes convolution calculations and has a deep structure.

[0006] DBS: Dirichlet Batch Stylization, Dirichlet batch stylization.

[0007] IL: Interleaved Learning, interleaved learning. Summary of the invention

[0008] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the present invention aims to provide a method, device and storage medium for improving the generalization ability of a computer vision model.

[0009] The technical solution adopted by the present invention is:

[0010] A method for improving the generalization ability of a computer vision model comprises the following steps:

[0011] Obtain a computer vision task dataset, divide the dataset into S source domain datasets and one target domain dataset according to the source, and enhance the source domain data;

[0012] Build and initialize the backbone network;

[0013] Construct S memory banks and initialize them;

[0014] Build a stylized module, deploy the stylized module to the backbone network, and train the backbone network using a style alternation learning strategy;

[0015] During the testing process, the stylization module is turned off and the trained backbone network is used to test on the target domain dataset.

[0016] Furthermore, the backbone network is a deep neural network based on CNN.

[0017] Furthermore, the step of constructing S memory banks and initializing the memory banks includes:

[0018] Construct S memory banks according to the number of S source domain data sets;

[0019] For the kth memory bank, the number of features it stores is the number of categories in the kth source domain dataset, and the length of each feature is consistent with the output feature of the backbone network;

[0020] Use the backbone network to extract features from the images of the S source domain datasets and perform L2 normalization on the extracted features;

[0021] For the features of any category in the entire memory bank, the mean value of all image features of this category is used for initialization.

[0022] Furthermore, the stylization module is constructed and deployed into the backbone network, including:

[0023] Build a stylized module and deploy it to any layer of the backbone network;

[0024] The stylization module works as follows:

[0025] Assuming that the number of samples of the current batch of data input to the stylization module is B, calculate any individual feature F i (1≤i≤B), that is, the mean μ of the channel dimension of the input feature i and standard deviation σ i , so the current batch data style is (μ1,σ1), (μ2,σ2)...(μ B ,σ B);

[0026] Using the balance parameter z, the first style obtained by the first method and the second style obtained by the second method are added to obtain a new style;

[0027] Use the new style to replace the original style of the samples in the original batch data and output the replaced results.

[0028] Furthermore, the first preset method is a stylization method of weighted fusion of multiple sample styles, and the working method of the method is as follows:

[0029] Construct a Dirichlet distribution with parameter ε, Dirichlet(ε), and sample a set of weights that sum to 1 from this distribution

[0030] For any sample in the current batch of data, the style of the sample and the styles of any other T samples are weighted and added, with a weight of λ, and the weighted style is used as the first style.

[0031] Furthermore, the second method is a stylized method based on Gaussian distribution sampling composed of batch data statistical parameters, and the working method of the method is as follows:

[0032] According to the mean and standard deviation of the channel dimension of all samples in the current batch data, the mean matrix and covariance matrix are calculated to obtain

[0033] Construct two Gaussian distributions and

[0034] from Sampling to get μ bat ,from Sampling to get σ bat , and (μ bat ,σ bat ) as the second style.

[0035] Furthermore, the adopting of the style alternation learning strategy to train the backbone network includes:

[0036] Each training iteration cycle of style alternation learning includes the first forward pass, the first backward pass, and the second forward pass;

[0037] In the first forward pass, the stylization module is turned off and the training set is input into the backbone network to obtain the output features;

[0038] In the first backpropagation, a preset loss function is used to bring the output features of the backbone network closer to the features of the same category stored in the memory bank, and to push the output features of the backbone network away from the features of different categories stored in the memory bank;

[0039] In the second forward pass, the stylization module is activated and the training set in the first forward pass is input into the backbone network again to obtain the output features, and the new backbone network output feature momentum is used to update the features of the same category in the memory bank.

[0040] Furthermore, the preset loss function is contrastive loss.

[0041] Another technical solution adopted by the present invention is:

[0042] A device for improving the generalization ability of a computer vision model, comprising:

[0043] at least one processor;

[0044] at least one memory for storing at least one program;

[0045] When the at least one program is executed by the at least one processor, the at least one processor implements the above method.

[0046] Another technical solution adopted by the present invention is:

[0047] A computer-readable storage medium stores a program executable by a processor, wherein the program executable by the processor is used to execute the method described above when executed by the processor.

[0048] The beneficial effect of the present invention is that the present invention deploys a stylization module (DBS module) in the backbone network, which can change the style of the input features. By continuously changing the style of the features stored in the memory bank, the backbone network is prevented from overfitting to the style of the source domain during training, so that it has better generalization ability on any target domain. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the embodiments of the present invention or the drawings of related technical solutions in the prior art are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0050] Figure 1 is a flowchart of the steps of a method for improving the generalization ability of a computer vision model in an embodiment of the present invention;

[0051] Figure 2 is a schematic diagram of the process of the Dirichlet MixStyle method in an embodiment of the present invention;

[0052] Figure 3 Schematic diagram of the process of the Batch-Style Sampler method in an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.

[0054] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.

[0055] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.

[0056] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0057] like Figure 1 As shown, this embodiment provides a method for improving the generalization ability of a computer vision model, which includes a style transfer module (DBS module) and a training strategy (interleaved learning). The style of the samples is changed by the style transfer module, and then the memory bank is updated using these samples, thereby avoiding the backbone network from overfitting to the style of the source domain during training, thereby improving the generalization ability. The method specifically includes the following steps:

[0058] S1. Obtain a computer vision task dataset, divide the dataset into S source domain datasets and 1 target domain dataset according to the source, and enhance the source domain data.

[0059] In this embodiment, the computer vision task is person re-identification, and the person re-identification datasets are Market1501, DukeMTMC-reID, CUHK03 and MSMT17. DukeMTMC-reID, CUHK03 and MSMT17 are selected as source domains, and Market1501 is selected as the target domain; data enhancement is performed on the input training images, specifically: for an input image, its height and width are scaled to 256 and 128 respectively; it is horizontally flipped with a probability of 50%; it is randomly cropped, and a padding of 10 is used during cropping, and the size after cropping is still 256 in height and 128 in width; the brightness, contrast and saturation are jittered in the range of [0.6,1.4]; finally, the image is normalized, and the normalized mean and variance are [0.485, 0.456, 0.406] and [0.229, 0.224, 0.225] respectively.

[0060] S2. Build the Backbone network and initialize it.

[0061] As an optional implementation, the Backbone network is based on a CNN deep neural network.

[0062] For a training image after data enhancement, the feature f is first obtained through a CNN-based deep neural network.

[0063] The CNN-based deep neural network constructed in this embodiment is a ResNet-50 network, followed by a one-dimensional batch normalization layer of BNNeck, and the initialization method is the parameters of the ResNet-50-based object classification model trained on ImageNet.

[0064] S3. Construct S memory banks and initialize them.

[0065] Wherein, step S3 specifically includes steps S31-S34:

[0066] S31. Construct S memory banks according to the number of source domain data sets. In this example, the number of source domains is 3.

[0067] S32, for the kth Memory bank, the number of features stored is the number of pedestrian categories in the kth source domain dataset, that is, the number of IDs, and the length of each feature is consistent with f, which is 2048. Specifically, the number of IDs in the DukeMTMCM-reID dataset is 1812, so the number of features stored in the first Memory bank corresponding to this domain is 1812.

[0068] S33. Use the Backbone network to extract features from all S source domain dataset images and perform L2 normalization on all features.

[0069] S34. For the features of any ID in all memory banks, the average value of all image features of the ID is used for initialization.

[0070] S4. Build a stylized module and deploy it to the Backbone network.

[0071] Wherein, step S4 specifically includes steps S41-S46:

[0072] S41. Deploy the Dirichlet Batch Stylization (DBS) module to the Backbone network. The CNN-based deep neural network constructed in this example is the ResNet-50 network, and its network structure can be decomposed into 4 blocks, which are respectively recorded as Stage 1-4.

[0073] DBS can be deployed after any stage. Optionally, this example deploys it after Stage 1.

[0074] S42, assuming that the output feature of the batch sample data after Stage 1 is F, the number of samples is B, and after entering the DBS module, first calculate any individual feature F of the current batch data i (1≤i≤B), that is, the mean μ of the channel dimension of the input feature i and standard deviation σ i Specifically, for an individual feature F with shape C×H×W i , where the mean and standard deviation of any channel are calculated as:

[0075]

[0076]

[0077] S43. A new style Dir-MixStyle is generated by using the stylization method (Dirichlet MixStyle) of weighted fusion of multiple sample styles.

[0078] Use Dirichlet MixStyle to generate a new style Dir-MixStyle, such as Figure 2 As shown; randomly select T individual feature styles from the current batch of samples: (μ1,σ1), (μ2,σ2)...(μ T ,σ T );

[0079] Construct a Dirichlet distribution with parameter ε and sample a set of weights from it:

[0080] λ~Dirichlet(ε)

[0081]

[0082] For an individual F i , using λ-weighted fusion F i Style and selected T styles, in particular, remember F i The style is (μ0,σ0):

[0083]

[0084]

[0085] Get the new style Dir-MixStyle=(β dir ,γ dir ).

[0086] S44. A new style Batch-Style is obtained by sampling using a stylization method (Batch-StyleSampler) based on Gaussian distribution sampling composed of statistical parameters of batch data.

[0087] Use Batch-Style Sampler to generate a new style Batch-Style, such as Figure 3 As shown; the mean of the channel dimension of all samples in the current batch of data (μ1,μ2,...,μ B ) and standard deviation (σ1,σ2,...,σ B ), respectively calculate the mean and covariance matrix of the two batch dimensions, and get:

[0088]

[0089]

[0090]

[0091]

[0092] Construct two Gaussian distributions and

[0093] from Sampling to get μ bat ,from Sampling to get σ bat ,(μ bat ,σ bat ) is the new style Batch-Style.

[0094] S45, using the balance parameter z, the new style Dir-MixStyle generated by Dirichlet MixStyle and the new style Batch-Style sampled by Batch-Style Sampler are added to obtain a rich and varied new style (β dbs ,γ dbs ):

[0095] γ dbs = z * γ dir +(1-z)*σ bat

[0096] β dbs = z * β dir +(1-z)*μ bat

[0097] S46. For any sample in the original batch of data, replace its original style with the new style:

[0098]

[0099] And the result DBS(F i ) output.

[0100] S5. Use the style alternating learning strategy (Interleaved Learning, IL) to train the Backbone network.

[0101] Wherein, step S5 specifically includes steps S51-S53:

[0102] S51, Interleaved Learning training strategy includes the first forward pass, the first backward pass and the second forward pass in each iteration cycle; the DBS module is turned off in the first forward pass; a batch of data is sampled from the training pictures of each source domain, and the L2 normalized features are obtained through a CNN-based deep neural network, and the predicted Contrastive loss is calculated with the Memory bank; specifically, assuming that the i-th picture from the source domain s, the L2 normalized feature f is obtained through the Backbone network i s; This feature will calculate the contrastive loss with the sth memory bank:

[0103]

[0104] Where τ is the temperature coefficient, which is set to 0.05 in this example;

[0105] Finally, the average of the loss functions calculated from the three source domains is used as the final loss function:

[0106]

[0107] S52, the first back-transfer passes the gradient obtained by calculating the Contrastive loss back to Backbone, and uses the gradient descent update method to update the network parameters of Backbone; specifically, let the network parameter be θ, and the update formula is:

[0108]

[0109] Where α is the learning rate, which is set to 3.5e-4 in this example.

[0110] S53, activate the DBS module in the second forward pass. In this example, the DBS module is deployed after Stage 1. Assume that the i-th image from the source domain s is obtained through the Backbone network. L2 normalized features This feature will be used to update the feature with the same ID stored in the sth Memory bank.

[0111]

[0112] Where η is the momentum coefficient, which is set to 0.2 in this example.

[0113] S6. In the test, turn off DBS and use the trained Backbone network to test on the target domain data.

[0114] In this embodiment, the test process is characterized in that the DBS module is turned off and only the output of the Backbone network is used; no additional calculation amount is added during the test process.

[0115] In order to verify the effectiveness of the present invention, as shown in Table 1 below, we select one of the Market1501, DukeMTMC-reID, CUHK03 and MSMT17 datasets (referred to as M, D, C3 and MS in the table respectively) as the target domain in turn, and the remaining three datasets as the source domain, and conduct experiments respectively, using the mean Average Precision (mAP) and Rank-1accuracy measurement standards. The mAP calculation method is: calculate the retrieval accuracy for each pedestrian picture included in the query in all gallery images, and the average prediction accuracy of all query pictures is mAP; the Rank-1accuracy calculation method is: in the retrieval ranking list returned by all queries, the first place is the average accuracy of the retrieval target.

[0116] Table 1 Comparative data of the present invention and other methods in the same experiment

[0117]

[0118] In summary, compared with the prior art, this embodiment has the following advantages and beneficial effects:

[0119] (1) The method of this embodiment includes a novel Interleaved learning training strategy, which alleviates the problem that existing common training strategies easily lead to model overfitting; the framework also includes a novel stylization module DBS, which can effectively generate rich and reliable new styles, helping the framework to better improve the generalization ability of the model.

[0120] (2) The features of pedestrians are stored in the memory bank to supervise the training of the Backbone network, which reduces the number of parameters that need to be trained. The convergence speed of the network is greatly improved, the training time is reduced, and the training efficiency is improved. The DBS module does not contain parameters and has high computational efficiency.

[0121] (3) During the test, DBS is not activated and only the output of the Backbone network is used, without adding any additional computational effort; this improves performance without increasing the test time of the model.

[0122] (4) At the same time, the interleaved learning training strategy of this example can be combined with other domain generalization methods and has wide application value.

[0123] This embodiment also provides a device for improving the generalization ability of a computer vision model, including:

[0124] at least one processor;

[0125] at least one memory for storing at least one program;

[0126] When the at least one program is executed by the at least one processor, the at least one processor implements Figure 1 The method shown.

[0127] A device for improving the generalization ability of a computer vision model in this embodiment can execute a method for improving the generalization ability of a computer vision model provided by an embodiment of the method of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.

[0128] The present application also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes Figure 1 The method shown.

[0129] This embodiment also provides a storage medium storing instructions or programs that can execute a framework for improving the generalization ability of computer vision models provided by the method embodiment of the present invention. When the instructions or programs are run, any combination of implementation steps of the method embodiment can be executed, and the corresponding functions and beneficial effects of the method can be obtained.

[0130] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.

[0131] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0132] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0133] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0134] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0135] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0136] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0137] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0138] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A method for improving the generalization ability of a computer vision model, characterized in that: The following steps are involved: Obtain an image dataset for a computer vision task, and divide the image dataset into S source domain datasets and one target domain dataset according to the source; Build and initialize the backbone network; Construct S memory banks and initialize them; Build a stylized module, deploy the stylized module to the backbone network, and train the backbone network using a style alternation learning strategy; During the test, the stylization module is turned off and the trained backbone network is used for testing on the target domain dataset; The step of constructing a stylized module and deploying the stylized module to a backbone network includes: Build a stylized module and deploy it to any layer of the backbone network; The stylization module works as follows: Assuming that the number of samples of the current batch of data input to the stylization module is B, calculate any individual feature F i (1≤i≤B), that is, the mean μ of the channel dimension of the input feature i and standard deviation σ i , so the current batch data style is (μ1,σ1), (μ2,σ2)...(μ B ,σ B ); Using the balance parameter z, the first style obtained by the first method and the second style obtained by the second method are added to obtain a new style; Use the new style to replace the original style of the samples in the original batch data, and output the replaced results; The first method is a stylization method of weighted fusion of multiple sample styles, which works as follows: Construct a Dirichlet distribution with parameter ε, Dirichlet(ε), and sample a set of weights that sum to 1 from this distribution For any sample in the current batch of data, add the style of the sample and the styles of any other T samples, with a weight of λ, and use the weighted style as the first style; The second method is a stylized method based on Gaussian distribution sampling composed of batch data statistical parameters, which works as follows: According to the mean and standard deviation of the channel dimension of all samples in the current batch data, the mean matrix and covariance matrix are calculated to obtain Construct two Gaussian distributions and from Sampling to get μ bat ,from Sampling to get σ bat , and (μ bat ,σ bat ) as the second style; The backbone network is trained using a style alternation learning strategy, including: Each training iteration cycle of style alternation learning includes the first forward pass, the first backward pass, and the second forward pass; In the first forward pass, the stylization module is turned off and the training set is input into the backbone network to obtain the output features; In the first backpropagation, a preset loss function is used to bring the output features of the backbone network closer to the features of the same category stored in the memory bank, and to push the output features of the backbone network away from the features of different categories stored in the memory bank; In the second forward pass, the stylization module is activated and the training set in the first forward pass is input into the backbone network again to obtain the output features, and the new backbone network output feature momentum is used to update the features of the same category in the memory bank.

2. A method for improving the generalization ability of a computer vision model according to claim 1, characterized in that: The backbone network is a deep neural network based on CNN.

3. A method for improving the generalization ability of a computer vision model according to claim 1, characterized in that: The step of constructing S memory banks and initializing the memory banks includes: Construct S memory banks according to the number of S source domain data sets; For the kth memory bank, the number of features it stores is the number of categories in the kth source domain dataset, and the length of each feature is consistent with the output feature of the backbone network; Use the backbone network to extract features from the images of the S source domain datasets and perform L2 normalization on the extracted features; For the features of any category in the entire memory bank, the mean value of all image features of this category is used for initialization.

4. A method for improving the generalization ability of a computer vision model according to claim 1, characterized in that: The preset loss function is Contrastive loss.

5. A device for improving the generalization ability of a computer vision model, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 4.

6. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to perform the method according to any one of claims 1 to 4 when executed by the processor.

Citation Information

Patent Citations

  • Calligraphy relief modeling method

    CN106920281A

  • Defect detection method of transformer based on Poisson fusion sample expansion

    CN112396577A