A single domain generalization method based on basic model

Through the combination of diffusion model and image language conversion model, style-enhanced images are generated, which solves the problem of insufficient adaptability of single-domain generalization methods in unknown fields and significantly improves the generalization performance and robustness of the model.

CN118379387BActive Publication Date: 2024-10-01ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410822182.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-01
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

Existing single-domain generalization methods have limitations in their adaptability and generalization performance in unknown domains. Especially in the absence of target domain samples, it is difficult to achieve accurate adaptation to unseen domains.

Method used

The target style image is generated through the diffusion model, and the image language conversion model is used for style statistics and transfer. Combined with the adaptive instance normalization method, the style information is integrated with the source image features to generate a style-enhanced image to improve the generalization ability of the model. .

Benefits of technology

The recognition ability and robustness of the model in unknown domains are significantly improved, enabling the model to recognize images of the same category in different domains, and enhancing the adaptability and generalization performance to unknown domains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379387B_ABST
    Figure CN118379387B_ABST
Patent Text Reader

Abstract

The present invention provides a single-domain generalization method based on a basic model, which relates to the field of image processing technology. The method comprises: generating a target style image through a diffusion model; performing style statistics on the target style image according to an image language conversion model to obtain style information; obtaining a source image, processing the source image according to the image language conversion model to obtain output features; performing style transfer on the output features and the style information to obtain a style-enhanced image to achieve domain generalization. This ensures that the adaptability of the recognition model in unknown fields is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a single-domain generalization method based on a basic model. Background Art

[0002] In the field of machine learning and computer vision, Single Domain Generalization (SDG) is a core research direction that focuses on how to enable the model to demonstrate excellent generalization capabilities on unknown and differently distributed target domains after only being exposed to training data from a single source domain. This demand is particularly urgent in practice. Given the high cost and time consumption of collecting and labeling large amounts of cross-domain data, it is particularly important to develop models that can master widely applicable skills in a single training environment.

[0003] The core goal of single-domain generalization is to build a model that has the ability to cross untouched and diverse target domains even if it comes from a single source domain data, and can show strong generalization performance. Although the current research trend generally tends to be domain representation learning and feature enhancement, initial attempts have shown limitations when facing complex scenarios, especially in the absence of target domain samples, to achieve accurate adaptation to unseen domains, which poses a major challenge.

[0004] In some technical solutions, single-domain generalization methods still have a lot of room for improvement in terms of adaptability and generalization performance when facing information in unknown domains. Summary of the invention

[0005] The problem solved by the present invention is how to improve the adaptability of the recognition model in unknown fields.

[0006] To solve the above problems, the present invention provides a single domain generalization method based on a basic model, comprising:

[0007] Generate target style image through diffusion model;

[0008] According to the image-language conversion model, style statistics are performed on the target style image to obtain style information;

[0009] Acquire a source image, process the source image according to the image-to-language conversion model, and obtain output features;

[0010] Style transfer is performed on the output features and the style information to obtain a style-enhanced image to achieve domain generalization.

[0011] Compared with the prior art, the present invention generates a target style image through a diffusion model, processes the source image according to the image language conversion model, and uses the diffusion model and the image language conversion model to associate information of multiple modalities to improve the generalization ability of the recognition model at the input information level; by performing style statistics on the target style image, style transfer the statistical style information and input features together, and training the model recognition on the transferred style-enhanced image, the model can excellently complete the task of single-domain generalization. Since in different domain images, although the images are in different domains and have different styles, they can have the same category, such as vehicle photos on rainy days and vehicle photos on sunny days, through style transfer, images of the same category can be style transferred, which can improve the robustness of the recognition model, and can also improve the generalization ability of the recognition model, so that the recognition model has better adaptability when recognizing images in unknown fields.

[0012] Optionally, generating a target style image by using a diffusion model includes:

[0013] Process the prompt text through a large language model to generate target style text;

[0014] The target style image is generated based on the target style text through the diffusion model.

[0015] Optionally, the single-domain generalization method based on the basic model further includes:

[0016] Performing text enhancement on the prompt text in a specific style through a large language model to obtain enhanced text, wherein the enhanced text includes prompt text in different expression forms;

[0017] At least one prompt text is randomly selected from the enhanced text as an input of the diffusion model.

[0018] Optionally, after the prompt text in the specific style is enhanced by the large language model to obtain the enhanced text, the method further includes:

[0019] During testing, the regions of interest are classified using text prototype embeddings comprising the average of embeddings generated from all prompt texts of the specific style.

[0020] Optionally, performing style statistics on the target style image according to the image-to-language conversion model to obtain style information includes:

[0021] The target style image is processed according to the CLIP model, the target style image is matched with a preset category, and the style information corresponding to the target style image is obtained.

[0022] Optionally, the acquiring a source image, processing the source image according to the image-to-language conversion model, and obtaining output features comprises:

[0023] The source image is processed based on the CLIP model after freezing the lower layer to obtain the output features.

[0024] Optionally, performing style transfer on the output features and the style information to obtain a style-enhanced image to achieve domain generalization includes:

[0025] The style information is fused with the output feature through an adaptive instance normalization method to obtain a continuous style enhanced image.

[0026] Optionally, the single-domain generalization method based on the basic model further includes:

[0027] Building statistical memory for batch normalization layers;

[0028] The features of the input image are aligned with the style in the statistical memory through the statistical memory.

[0029] Optionally, the step of establishing a statistical memory bank of a batch normalization layer includes:

[0030] Classifying the style information, and establishing the statistical memory base according to the categories of the style information;

[0031] The statistical memory is updated along with the updating of the style information.

[0032] Optionally, aligning the features of the input image with the style in the statistical memory library by using the statistical memory library comprises:

[0033] Get the input image;

[0034] Performing style statistics on the input image to obtain input style information;

[0035] Perform KL divergence evaluation on the input style information, and obtain the style information closest to the input style information in the statistical memory library. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 Schematic diagram of the process of a single-domain generalization method based on a basic model according to an embodiment of the present invention;

[0037] Figure 2 Schematic diagram of a detailed process of step S100 of the single-domain generalization method based on a basic model according to an embodiment of the present invention;

[0038] Figure 3 Another schematic diagram of the process of the single-domain generalization method based on the basic model according to an embodiment of the present invention;

[0039] Figure 4 It is another flowchart of the single-domain generalization method based on the basic model according to an embodiment of the present invention;

[0040] Figure 5 is a flowchart of a single-domain generalization method based on a basic model according to an embodiment of the present invention;

[0041] Figure 6 Another flowchart of a single-domain generalization method based on a basic model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be interpreted as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0043] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0044] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". Relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0045] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0046] In an embodiment of the present invention, the foundation models (FMs) include

[0047] like Figure 1 and Figure 5 As shown, an embodiment of the present invention provides a single-domain generalization method based on a basic model, including:

[0048] Vision and Language Models (VLMs) have been widely favored by academia and industry for their extensive knowledge and excellent representation capabilities in the fields of visual cognition and natural language understanding. The Contrastive Language-Image Pre-training (CLIP) model has achieved epoch-making achievements in a series of downstream tasks of multimodal learning by providing stable and deep feature expressions and accurate alignment between images and texts. This includes but is not limited to zero-shot classification, open-vocabulary object detection, and domain adaptation semantic segmentation, all of which show unprecedented superior performance and wide application potential. These characteristics of the CLIP model make it the preferred solution for bridging image and text information, which not only promotes the efficient transfer of cross-modal knowledge, but also promotes the generalization ability of artificial intelligence systems when facing new categories or unseen data, thereby laying a solid foundation for realizing more intelligent, flexible and adaptable artificial intelligence applications.

[0049] Text-to-Image Diffusion Models. This model can effectively reduce the semantic difference between text descriptions and their corresponding visual content by synthesizing highly realistic images from text information, thereby building a bridge between language and visual expression. In this embodiment, the Stable Diffusion XL (SDXL) model is used to generate images with the style characteristics of the target domain. Through this model, the connotation of the text description can be faithfully reflected, and the style information of a specific field can be incorporated to generate images with the style of the target domain.

[0050] Large Language Model (LLM) is applied to visual task processing. Specifically, it covers two main application areas: image description generation and image generation. In image description generation, LLM can automatically generate accurate and expressive description text for the input image; in the field of image generation, it synthesizes the corresponding image content by parsing text instructions. Given the excellent semantic understanding ability and contextual association analysis function of LLM, its application in customer service, technical support and knowledge retrieval systems has shown significant advantages, which can effectively improve the interactive experience and information retrieval efficiency.

[0051] Step S100, generating a target style image through a diffusion model.

[0052] In one embodiment, a text-to-image diffusion model is used to generate diverse images using multiple text descriptions. After the target style image is generated by the text-to-image diffusion model, the bounding box and label information of the objects in the target style image cannot be obtained synchronously, that is, supervised training cannot be performed based on the target style image. Instead, it is necessary to focus on the style information in the target style image and perform single-domain generalization training on the model based on the style information.

[0053] Text-to-image generation refers to the use of a model that can process text input and generate high-fidelity images based on text descriptions. Specifically, the SDXL model is used, which is a potential diffusion model for text-to-image synthesis. Descriptive text prompts are provided to the model to describe scenes that may be found in potential future target domains. In one embodiment, a diverse weather dataset is used as a source image set. In view of the characteristics of the diverse weather dataset, these driving scenes under different weather or time conditions use simple sentences such as "a photo of a street scene taken while driving on a rainy day" to describe specific rainy conditions, and the corresponding image is generated by the SDXL model as a target style image.

[0054] Alternatively, if Figure 2 As shown, generating a target style image through a diffusion model includes:

[0055] Step S110, processing the prompt text through a large language model to generate a target style text.

[0056] Step S120: generating the target style image based on the target style text through the diffusion model.

[0057] To further increase the diversity of these texts, we use the large language model to generate more texts that may cover a wide range of scenarios. For example, to get a rainy day prompt, we provide the following prompt text to the large language model: "I want to use the text-to-image model to generate images. Assume that these images are taken while driving during the day on a rainy day. You need to generate several texts like 'Photos taken while driving in the rain'." This approach can guide the large language model to generate more diverse text descriptions that meet specific scene settings, thereby promoting the generation of richer image samples and improving the model's generalization ability under different styles and conditions.

[0058] In one embodiment, the prompt text is processed by the large language model to generate the target style text. For example, if the prompt text is "please generate one or more texts of 'a photo of a street scene taken while driving on a rainy day'", the target style text of the large language model is "this is a picture of a city street captured while driving in the rain", "an image recording the moment of driving through the street on a rainy day", "a photo taken in the rainy season showing a wet street scene from the driver's perspective". The target style text is used to generate a target style image of similar style through the diffusion model.

[0059] Step S200: performing style statistics on the target style image according to the image-to-language conversion model to obtain style information.

[0060] In one embodiment, after generating target style images with a specific style, corresponding style information is extracted from these target style images to expand the generalization ability of the model facing unknown domains through the style information.

[0061] Optionally, performing style statistics on the target style image according to the image-to-language conversion model to obtain style information includes:

[0062] The target style image is processed according to the CLIP model, the target style image is matched with a preset category, and the style information corresponding to the target style image is obtained.

[0063] In one embodiment, if Figure 6 As shown, the target style image is processed using the CLIP model image encoder with the bottom layer frozen, the target style image is classified, and the style information in the target style image is counted to perform style transfer of the source image features.

[0064] Step S300, obtaining a source image, processing the source image according to the image-to-language conversion model, and obtaining output features.

[0065] In one embodiment, the source image, i.e., the source domain, represents the initial image data set during the model training process. In this embodiment, the CLIP model is used to achieve single-domain generalization in target detection. The framework follows the standard Faster R-CNN structure, but the backbone network of the model is different from the standard Faster R-CNN structure. The image encoder of CLIP is integrated into the backbone network of the Faster R-CNN framework, and the source image is processed to obtain output features. The output features are used to fuse with the image after style transfer to enhance the generalization ability of the model.

[0066] Optionally, the acquiring a source image, processing the source image according to the image-to-language conversion model, and obtaining output features comprises:

[0067] The source image is processed based on the CLIP model after freezing the lower layer to obtain the output features.

[0068] Since the CLIP model has a better ability in extracting robust and universal features, by freezing the lower layers of the backbone network and then performing style transfer on its output features (the lower-layer features of the backbone network of the CLIP model), continuous style enhancement can be achieved during the training process.

[0069] Step S400, performing style transfer on the output features and the style information to obtain a style-enhanced image to achieve domain generalization.

[0070] In one embodiment, since the output features are obtained by processing the source image through the CLIP model, by performing style transfer on the output features and style information, continuous style-enhanced images that share the same content but have different styles are obtained, and by performing recognition training on the style-enhanced images, the generalization ability of the recognition model for unknown domains can be increased. Specifically, sharing the same content but having different styles includes: images taken in clear weather and images taken at night, rainy days or foggy days may have differences in lighting, contrast, etc., which can be attributed to the style of the image.

[0071] Optionally, performing style transfer on the output features and the style information to obtain a style-enhanced image to achieve domain generalization includes:

[0072] The style information is fused with the output feature through an adaptive instance normalization method to obtain a continuous style enhanced image.

[0073] In one embodiment, the style information and output features are fused by an adaptive instance normalization method to obtain a continuous style enhanced image. The adaptive instance normalization method (AdaIN) is a technique for achieving style transfer while maintaining image content. It is an effective method for applying style enhancement during training to improve the robustness of the detector. Since the backbone network is integrated by the CLIP model encoder with the lower layer network frozen, and the adaptive instance normalization method is applied to the first layer of the CLIP model network, the problem of reduced style enhancement effect is avoided, and the model's adaptability to images of different styles is improved.

[0074] In AdaIN, the style is calculated by the channel-level mean of the features and standard deviation Indicates that the source features of the source image The process of style transfer in an arbitrary style can be described as:

[0075] ,

[0076] in, Indicates the target style, Indicates that the source feature is transformed into Convert to target style , represents the standard deviation of the target style, represents the standard deviation of the source feature, represents the mean of the target style, Represents the mean of the source feature. Function and Represent the mean and standard deviation of each channel in the input feature map respectively. Multiplication and addition operations are performed on the element and basis.

[0077] Alternatively, if Figure 3 and Figure 6 As shown, the single-domain generalization method based on the basic model also includes:

[0078] Step S101 , performing text enhancement on a prompt text in a specific style through a large language model to obtain enhanced text, wherein the enhanced text includes prompt texts in different expression forms.

[0079] Step S102: randomly selecting at least one prompt text from the enhanced text as an input of the diffusion model.

[0080] In order to better match the stylized image, the category prompt text is re-described through the text self-instruction classification head of the large language model, that is, the prompt text of a specific style is enhanced. Since there may be multiple prompt texts of a specific style, their expressions are different but the semantics are similar, the prompt text is enhanced through the powerful generalization ability of the large language model. The enhanced text has an accurate and generalized expression, and the target refined prompt text can be obtained. During model training, the prompt text is randomly selected from the enhanced text as the input of the diffusion model to calculate the classification loss to increase the training effect of the model.

[0081] Specifically, a series of prompt texts of a specific category are first obtained through a template, which is represented by sentences. The category represents the target category to be classified in the region of interest. The prompt text is input into the large language model for further processing, and different text content is added to each prompt text to generate diverse descriptions. These diverse text embeddings will be randomly selected during the training process to calculate the classification loss.

[0082] To get diverse classification embeddings, the approach is as follows: Assume that these text prompts are captions of different images belonging to the same category, and give the language model the following instruction: "I have some captions for images, and you need to rewrite the captions for these images, each of which should be set to a specific weather condition - assume that these photos were taken on a rainy day. Please use different expressions to describe the same weather condition." For other scenes, just replace "rainy day" with other weather descriptions. Alternatively, these weather descriptions can also be automatically generated by the large language model.

[0083] Optionally, after the prompt text in the specific style is enhanced by the large language model to obtain the enhanced text, the method further includes:

[0084] During testing, the regions of interest are classified using text prototype embeddings comprising the average of embeddings generated from all prompt texts of the specific style.

[0085] Specifically, the text embedding of a specific category is obtained by calculating the average of the embeddings generated by all prompts in the template of this category. This type of embedding is taken as the text prototype embedding of this category, which provides constant classification guidance during the optimization process. It can be expressed as:

[0086] ,

[0087] in, represents the text prototype embedding of category c, N represents the number of categories of text templates, represents the CLIP text encoder, Represents the i-th template of category c. The final text prototype embedding is obtained by averaging the embeddings of all templates in this category, which is used to integrate multiple description methods, making the embedding more comprehensive and robust, and better able to capture the core features of the category.

[0088] For K categories and one background category, the overall text prototype embedding is expressed as , where R represents a real number and K represents the number of categories. Represents the dimension of the embedding vector output by the CLIP model. For the background, use "background" to obtain its text embedding vector. At the same time, the region of interest is projected into the embedding space through the attention layer (attn), and the obtained feature representation is The text-based classification loss is expressed as:

[0089] ,

[0090] in, represents the cross entropy loss function, Represents the text prototype embedding of the k-th category.

[0091] Total loss It is expressed as:

[0092] ,

[0093] in, Represents the classification loss of RPN. It is used to measure the difference between the output of attn and CLIP model text encoder. Represents the regression loss of RPN, which is used to measure the difference between the candidate region bounding box predicted by RPN and the true bounding box. represents the text-based classification loss of the CLIP model, represents the regression loss.

[0094] RPN (Region Proposal Network): is a component in the Faster R-CNN model. Its main task is to generate a series of potential target candidate boxes (Region Proposals) on the entire image, which may contain objects of interest. RPN evaluates the possibility of generating region proposals at each location at different scales and ratios by sliding windows, thereby providing a preliminary set of candidate regions for subsequent steps.

[0095] ATTTN (Attention Mechanism) uses an attention mechanism to weight feature maps, emphasizing the parts that are most useful for identifying categories. This ATTTN can be an attention weight based on the feature map to guide the model on which parts of the image to focus on.

[0096] Region of Interest (ROI), in the object detection and recognition task, the algorithm first locates multiple ROIs in the image, and then classifies each ROI to determine the category it belongs to. In one embodiment, during the test phase, only text prototype embeddings are used to classify the categories of the regions of interest (ROIs), which means that during the test, for each ROI, the model generates a vector representation, and then compares this vector with the text prototype embeddings of known categories to find the closest text prototype, thereby determining the category of the ROI, so that the model can use semantic information to classify objects in the image when the domain changes.

[0097] Alternatively, if Figure 4 and Figure 6 As shown, the single-domain generalization method based on the basic model also includes:

[0098] Step S510, establishing a statistical memory library of the batch normalization layer.

[0099] Step S520: aligning the features of the input image with the style in the statistical memory library through the statistical memory library.

[0100] Batch Normalization (BN) is a commonly used regularization and training acceleration technology in deep learning. Its main purpose is to solve the gradient vanishing and gradient exploding problems in deep neural networks, accelerate the training process, and improve the generalization ability of the model. The BN layer is usually inserted after the fully connected layer or convolutional layer and before the activation function.

[0101] In one embodiment, the output features after the backbone network processing are transferred using an adaptive instance normalization method, and the statistical characteristics of the target style image are used for adjustment. Based on these style information, a statistical memory is established during the optimization process of the recognition model, and the statistical memory retains the statistical data of the batch normalization layer in a specific style through an exponential moving average method. Since images in the real world are complex and changeable, it is not reasonable to directly use the statistical information of the domain where the source image is located to normalize the test features.

[0102] Optionally, the step of establishing a statistical memory bank of a batch normalization layer includes:

[0103] The style information is classified, and the statistical memory library is established according to the category of the style information.

[0104] The statistical memory is updated along with the updating of the style information.

[0105] In one embodiment, a statistical memory library is established based on the categories of existing style information, wherein the categories and quantity of style information in the statistical memory library are updated according to the update of the style information, aiming to more accurately align the features of the input image with the style in the statistical information library.

[0106] Alternatively, if Figure 6 As shown, the step of aligning the features of the input image with the style in the statistical memory library through the statistical memory library includes:

[0107] Get the input image.

[0108] Perform style statistics on the input image to obtain input style information.

[0109] Perform KL divergence evaluation on the input style information, and obtain the style information closest to the input style information in the statistical memory library.

[0110] In one embodiment, the difference between the source domain where the original image used for training is located and the target domain where the input image is located is one of the important factors that cause the cross-domain evaluation performance to degrade.

[0111] Specifically, the input data of the batch normalization layer is represented as , where z represents the input, R represents a real number, B represents a mini-batch, C represents the number of channels of the input data, H represents the height of the input data, and W represents the width of the input data. The mean of z and variance It is expressed as:

[0112] ,

[0113] ,

[0114] Among them, B represents the mini-batch, C represents the number of channels of the input data, H represents the height of the input data, W represents the width of the input data, and b, c, h, and w represent the specific values ​​of the mini-batch, number of channels, height, and width, respectively.

[0115] Specifically, assuming that the feature map follows a multivariate Gaussian distribution, the KL divergence between the features and the distribution in the statistical memory is first evaluated before normalization by the BN layer. This evaluation can determine the domain that is closest to the input features. Next, the input features are fused with this domain through linear combination to achieve the best alignment with the target style domain to minimize the difference between the source and target domains and prevent the performance degradation of cross-domain evaluation. The calibrated statistics can be expressed as:

[0116] ,

[0117] ,

[0118] ,

[0119] in, represents the calibrated mean, represents the calibrated variance, and represents the closest mean and variance in the statistical memory, represents the input features, represents the hyperparameter, and represents the mean and variance of the input features, represents the result of batch normalization of the input features by the calibrated mean and variance, and represents the learnable parameters of the BN layer, Represents a very small positive value, used to ensure By using the statistical memory and calculating the domain in the statistical memory that is aligned with the target style domain, the recognition model can adjust the distribution of input features through an adaptive distribution alignment and calibration mechanism when facing test data with diverse styles to better match the target style, thereby improving the recognition performance of the model.

[0120] Another embodiment of the present invention provides an electronic device, including a memory and a processor; the memory is used to store a computer program; the processor is used to implement the single-domain generalization method based on the basic model as described above when executing the computer program.

[0121] Yet another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the single-domain generalization method based on the basic model as described above is implemented.

[0122] An electronic device that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0123] The electronic device includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for the operation of the device can also be stored. The computing unit, ROM, and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.

[0124] A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on the respective computers and having a client-server relationship to each other.

[0125] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. In the present application, the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, which may be located in one place or distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present invention. In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0126] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.

Claims

1. A single-domain generalization method based on a basic model, characterized in that: include: Performing text enhancement on the prompt text in a specific style through a large language model to obtain enhanced text, wherein the enhanced text includes prompt text in different expression forms; Randomly selecting at least one prompt text from the enhanced text as an input of the diffusion model; During the test, the regions of interest are classified using text prototype embeddings, wherein the text prototype embeddings are obtained by averaging embeddings generated from all prompt texts of the specific style; Generate a target style image through the diffusion model; According to the image-language conversion model, style statistics are performed on the target style image to obtain style information; Acquire a source image, process the source image according to the image-to-language conversion model, and obtain output features; Style transfer is performed on the output features and the style information to obtain a style-enhanced image to achieve domain generalization.

2. The single-domain generalization method based on the basic model according to claim 1 is characterized in that: Generating a target style image by using a diffusion model includes: Process the prompt text through a large language model to generate target style text; The target style image is generated based on the target style text through the diffusion model.

3. The single-domain generalization method based on the basic model according to claim 1 or 2, characterized in that: The performing style statistics on the target style image according to the image-language conversion model to obtain style information includes: The target style image is processed according to the CLIP model, the target style image is matched with a preset category, and the style information corresponding to the target style image is obtained.

4. The single-domain generalization method based on the basic model according to claim 1 or 2, characterized in that: The acquiring of the source image, processing the source image according to the image-to-language conversion model, and obtaining output features comprises: The source image is processed based on the CLIP model after freezing the lower layer to obtain the output features.

5. The single-domain generalization method based on the basic model according to claim 1 or 2, characterized in that: The performing style transfer on the output features and the style information to obtain a style-enhanced image to achieve domain generalization includes: The style information is fused with the output feature through an adaptive instance normalization method to obtain a continuous style enhanced image.

6. The single-domain generalization method based on the basic model according to claim 1 or 2, characterized in that: The single-domain generalization method based on the basic model also includes: Building statistical memory for batch normalization layers; The statistical memory library is used to align the features of the input image with the style in the statistical memory library.

7. The single-domain generalization method based on the basic model according to claim 6 is characterized in that: The statistical memory bank for establishing a batch normalization layer includes: Classifying the style information, and establishing the statistical memory base according to the categories of the style information; The statistical memory is updated along with the updating of the style information.

8. The single-domain generalization method based on the basic model according to claim 6, characterized in that: The step of aligning the features of the input image with the style in the statistical memory library by using the statistical memory library comprises: Get the input image; Performing style statistics on the input image to obtain input style information; Perform KL divergence evaluation on the input style information, and obtain the style information closest to the input style information in the statistical memory library.