Method, system and equipment for constructing portrait matting data set based on diffusion model
By constructing a portrait data set based on portrait models based on the diffusion model, using prompts constructing strategies and collaborative generating diffusion models, combined with mating icing icon optimization, data screening and data enhancement modules, solving large -scale and high -precision portrait cutouts in existing technologies have been solved. The problem of the dataset construction has realized the construction of high -efficiency and automated portrait matting data sets, and enhanced the generalization of the model.
Patent Information
- Application Number
- CN202411423901.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-12
AI Technical Summary
The existing technology is difficult to build large-scale high-precision portrait cutout datasets, which limits the performance improvement of deep neural networks in portrait cutout tasks.
Adopting a portrait data set for portrait data setting data setting data setting data, through designing prompts constructing strategies and a variety of collaborative generating diffusion models, combined with mating icon injection optimization, data screening and data enhancement modules, to automate a large -scale high -precision portrait portrait and cut out Figure data set.
Effectively alleviated the problem of insufficient scale of real portrait cutting data sets, improved the efficiency of the establishment of portrait data collection data, and improved the generalization of models on portrait matting tasks.
Smart Images

Figure CN119379825A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of constructing a portrait cutout dataset, and in particular to a method, system and device for constructing a portrait cutout dataset based on a diffusion model. Background Art
[0002] Portrait cutout is a basic task in the field of computer vision. The task is defined as given a portrait image containing a background, the transparency mask of the portrait needs to be predicted. The transparency value range of each pixel position is between 0 and 1. 0 means that the pixel position is completely transparent and completely determined by the background color. 1 means that the pixel position is completely opaque and completely determined by the foreground color. Between 0 and 1 means that the pixel position is determined by the background color and the foreground color in a certain proportion. The patent application with publication number CN 118411285A discloses a video portrait cutout method, device, storage medium and equipment. The first frame image of the target video is cutout using SAM (Segment Anything Model) and a cutout method optimized by manual interaction. Then, two segmentation models (DeAOT and XMem) are used for fusion cutout to obtain the cutout results of each frame image in the target video. The portrait cutout method provided by the application is based on a model and a manual interaction optimization method. It has high requirements for annotation precision, high cost of manual annotation, and is difficult to expand on a large scale. Therefore, the scale of open source portrait cutout datasets is relatively small at this stage. As the learning ability of deep neural networks continues to improve, the importance of dataset size for improving model performance becomes increasingly apparent, and small-scale datasets can no longer meet the needs of network learning.
[0003] The invention application with publication number CN 118675009 A discloses a method and device for constructing an image dataset for data diversity enhancement. By enhancing the diversity of data in the data generation stage and supplemented by efficient annotation modules, screening modules and enhancement modules, the potential of the generation model is further explored, so that the generated image dataset can be expanded on a large scale while maintaining the ability to improve model performance to meet the needs of network learning.
[0004] With the continuous development of diffusion models, the realism and controllability of images generated by diffusion models are also increasing. For example, reference 1 (Wu W, Zhao Y, Shou MZ, et al. Diffumask: Synthesizing images with pixel-level annotations for semantic segmentation using diffusion models [C], Proceedings of the IEEE / CVF International Conference on Computer Vision, 2023, 1206-1217) explored the cross-attention map of the diffusion model, used an adaptive threshold strategy to extract the semantic information contained therein, and used the diffusion model to simultaneously generate images and corresponding semantic segmentation annotations, thereby improving the performance of downstream semantic segmentation tasks. Reference 2 (Zhao H, Sheng D, Bao J, et al. X-Paste: revisiting scalable copy-paste for instance segmentation using CLIP and stable diffusion [C], International Conference on Machine Learning. PMLR, 2023, 42098-42109) uses a mixture of web crawling data and generated data, and uses a variety of pre-trained segmentation models to annotate the mixed data set, combined with the copy and paste strategy, to improve the performance of downstream instance segmentation tasks.
[0005] Although existing methods propose to use diffusion models to generate large-scale image datasets and instance segmentation-based image vision tasks solve the data diversity problem, they are unable to perform high-precision image vision task processing, which limits the construction of large-scale and high-precision image vision datasets. Summary of the invention
[0006] The purpose of the present invention is to provide a method, system and device for constructing a portrait cutout dataset based on a diffusion model. By designing a prompt construction strategy and utilizing multiple portrait cutouts to collaboratively generate a diffusion model, and supplemented by cutout annotation optimization, data screening and data enhancement modules, a large-scale and high-precision portrait cutout dataset can be automatically constructed, which can effectively alleviate the problem of insufficient scale of real portrait cutout datasets and improve the efficiency of portrait cutout dataset construction.
[0007] To achieve the above-mentioned purpose of the invention, an embodiment provides a method for constructing a portrait cutout dataset based on a diffusion model, comprising the following steps:
[0008] Step 1: construct a prompt construction module based on prompt templates and attribute lists, randomly intercept the pre-defined prompt templates, and randomly fill the intercepted prompt templates with the pre-defined attribute lists to obtain a prompt set;
[0009] Step 2: Construct a collaborative generation module for portrait cutouts. Based on the prompt set and the portrait data, the collaborative generation module generates portrait cutout data including portrait images and cutout annotations. The portrait cutout data is subjected to text segmentation, expansion, and corrosion operations to obtain optimized portrait data.
[0010] Step 3: Construct a data screening module, in which the image-text similarity between the optimized portrait data and the abnormal screening prompt set is calculated, and portrait data below a set threshold is screened to obtain screened portrait data;
[0011] Step 4: Build a data enhancement module and input the filtered portrait data into the random data enhancer. The random data enhancer will randomly select a pre-defined data enhancement method to obtain enhanced portrait data.
[0012] In one embodiment, the prompt template T in step 1 is in the form of:
[0013] T=Concate(Attr 1 ,Conc 1 , Attr 2 ,Conc 2 , ..., Attr n-1 ,Conc n-1 , Attr n )
[0014] Among them, Concate(·) represents the string concatenation operation;
[0015] The random interception operation receives a predefined prompt template T as input. Each attribute Attr and the corresponding connector Conc in T are deleted from the prompt template T with a certain probability value p. The remaining attributes and connectors are concatenated to obtain the intercepted prompt template T. drop ;
[0016] The attribute list Ls contains n predefined attribute value lists L, each list contains no more than k attribute values att; the attribute list random filling operation receives the intercepted prompt template T drop With the attribute list Ls as input, for the attribute Attr in the predefined prompt template i , select the corresponding attribute value list L from the attribute list Ls i , and randomly select L iSelect an attribute value att j , concatenate it with the corresponding connector, and traverse T drop After all the attributes in are combined, a prompt is obtained; repeat the above operation to obtain a prompt set Ts containing t prompts.
[0017] In one embodiment, the collaborative generation module described in step 2 includes a diffusion model layer for collaborative generation of portrait cutouts based on text-generated images, a diffusion model layer for collaborative generation of portrait cutouts based on image-generated images, and a cutout annotation optimization layer based on text-guided segmentation and dilation corrosion, specifically including the following steps:
[0018] (1) Input the prompt word set Ts into the portrait cutout collaborative generation diffusion model layer based on the Wensheng graph to obtain a portrait image I te And cutout mark A te The first original portrait data D 1 ;
[0019] (2) Input the portrait data Ps in the open source dataset into the portrait cutout collaborative generation diffusion model layer based on the raw image to obtain a portrait image I im And cutout mark A im The second original portrait data D 2 ;
[0020] (3) The first original portrait data D 1 and the second original portrait data D 2 Input to the text-guided segmentation and dilation-erosion-based cutout annotation optimization layer, and convert the original portrait data D 1 and D 2 Original portrait image I i The segmentation hint B is input into the text-guided segmentation model to obtain the segmentation mask M i ; Then the segmentation mask M i Perform dilation operation to obtain dilation mask MD i , the original portrait data D 1 and D 2 Cutout mark A i Middle Mask MD i The pixel position corresponding to the background area (pixel value is 0) is set to 0, and the cutout annotation AD after background optimization is obtained i ; Then the segmentation mask M i Perform an etching operation to obtain an etching mask ME i , mark the cutout with background optimization as AD i Middle Mask ME i The pixel position corresponding to the foreground area (pixel value is 1) is set to 1, and the foreground optimized cutout annotation AE is obtained i, the original portrait data D 1 and D 2 Portraits in I i And optimized cutout annotation AE i As the final data pair, the optimized portrait data D is obtained. rfn .
[0021] In one embodiment, the abnormal screening prompt set H described in step 3 is composed of h prompts describing abnormal situations, and is used to screen abnormal portrait data.
[0022] In one embodiment, the image-text similarity calculation in step 3 is performed by rfn and the abnormal screening prompt set H are input into the image encoder and text encoder respectively, and the encoding embeddings of the two are obtained, which are e i With e t , and then calculate the image-text similarity S(e i , e t ), the calculation formula is as follows:
[0023]
[0024] Keep the portrait data with lower image-text similarity as the filtered portrait data D flt For use in subsequent steps.
[0025] In one embodiment, the random data enhancer in step 4 is composed of a plurality of predefined enhancement modes. The random data enhancer receives the filtered portrait data D flt As input, randomly select 0 to r data enhancement methods to obtain the enhanced portrait data D aug .
[0026] In order to clearly demonstrate the method for constructing a portrait cutout dataset, an embodiment of the present invention further provides a system for constructing a portrait cutout dataset based on a diffusion model. The system uses the method for constructing a portrait cutout dataset in the process of constructing the portrait cutout dataset.
[0027] A portrait cutout dataset construction system based on a diffusion model, the system comprising: a prompt construction module, a collaborative generation module, a data screening module and a data enhancement module;
[0028] The prompt construction module is used to obtain a prompt set for data generation, by randomly intercepting a predefined prompt template and randomly filling the intercepted prompt template with a predefined attribute list to obtain a prompt set;
[0029] The collaborative generation module is used to construct a collaborative generation module for portrait cutouts, including a portrait cutout collaborative generation diffusion model layer based on a text image, a portrait cutout collaborative generation diffusion model layer based on a picture image, and a cutout annotation optimization layer based on text-guided segmentation and dilation and corrosion; based on a prompt set and portrait data, the collaborative generation module generates portrait cutout data including a portrait image and cutout annotations, and performs text segmentation, dilation and corrosion operations on the portrait cutout data to obtain optimized portrait data;
[0030] The data screening module is used to construct a data screening module based on image-text similarity to screen portrait data, in which image-text similarity is calculated between the optimized portrait data and the abnormal screening prompt set, and portrait data below a set threshold is screened as screened portrait data;
[0031] The data enhancement module is used to construct a data enhancement module for portrait cutouts. The filtered portrait data is input into a random data enhancer. The random data enhancer randomly selects a predefined data enhancement method to obtain enhanced portrait data as a portrait cutout data set for model training.
[0032] To achieve the above-mentioned purpose of the invention, an embodiment of the present invention also provides a device for constructing a portrait cutout dataset based on a diffusion model, including a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to implement the method for constructing a portrait cutout dataset based on a diffusion model when executing the computer program.
[0033] Compared with the prior art, the present invention has the following beneficial effects:
[0034] Compared with the existing dataset construction methods, the method for constructing a portrait cutout dataset based on a diffusion model provided by the present invention is oriented to portrait cutout data and is suitable for solving the feasibility problem of generating portrait cutout data. The method is based on a prompt construction strategy and a variety of collaboratively generated diffusion models, and is supplemented by a cutout annotation optimization layer and a data screening module to improve the efficiency of constructing a portrait cutout dataset, and is used to automatically construct a large-scale dataset and filter abnormal portrait cutout data. Based on the data enhancement module, the diversity of portrait cutout data is enriched, and it is closer to the real scene, thereby improving the generalization of the model in the portrait cutout task, effectively alleviating the problem of insufficient scale of the real portrait cutout dataset, and improving the efficiency of constructing the portrait cutout dataset.
[0035] The present invention also provides a diffusion model-based portrait cutout dataset construction system and device for constructing a large-scale, high-precision portrait cutout dataset. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0037] Figure 1 A flowchart of a method for constructing a portrait cutout dataset based on a diffusion model provided by an embodiment of the present invention;
[0038] Figure 2 A schematic diagram of the structure of a prompt word construction module based on a prompt word template and an attribute list provided in an embodiment of the present invention;
[0039] Figure 3 A schematic diagram of the structure of a collaborative generation module for portrait cutout provided by an embodiment of the present invention;
[0040] Figure 4 A structural schematic diagram of a cutout annotation optimization layer based on text-guided segmentation and dilation corrosion provided by an embodiment of the present invention;
[0041] Figure 5 A schematic diagram of the structure of a data screening module based on image-text similarity provided by an embodiment of the present invention;
[0042] Figure 6 A schematic diagram of the structure of a data enhancement module for portrait cutout provided by an embodiment of the present invention;
[0043] Figure 7 A schematic diagram of the structure of a system for constructing a portrait cutout dataset based on a diffusion model provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] To make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation methods described herein are only used to explain the present invention and do not limit the scope of protection of the present invention.
[0045] In order to realize the automated construction of a large-scale, high-precision portrait cutout dataset and effectively alleviate the problem of insufficient scale of real portrait cutout datasets, an embodiment provides a method for constructing a portrait cutout dataset based on a diffusion model. The method is oriented to portrait cutout data and is suitable for solving the feasibility problem of portrait cutout data generation.
[0046] like Figure 1 As shown, the embodiment provides a method for constructing a portrait cutout dataset based on a diffusion model, comprising the following steps:
[0047] S1. Construct a prompt construction module based on prompt templates and attribute lists, randomly intercept predefined prompt templates, and randomly fill the intercepted prompt templates with predefined attribute lists to obtain a prompt set.
[0048] like Figure 2 As shown, in the embodiment, the prompt template T is formed by splicing predefined n attributes Attr and n-1 connectors Conc at intervals. The form of the prompt template T is as follows:
[0049] T=Concate(Attr 1 ,Conc 1 , Attr 2 ,Conc 2 , ..., Attr n-1 ,Conc n-1 , Attr n )
[0050] Wherein, Concate(·) represents a string concatenation operation. In this embodiment, n=18.
[0051] The random interception operation receives the prompt template T as input, and for each attribute Attr and the corresponding connector Conc in the prompt template T, deletes it from the prompt template T with a certain probability p, and only intercepts the remaining attributes and connectors to obtain the prompt template T drop In this embodiment, p=0.3.
[0052] The attribute list Ls includes n predefined attribute value lists L, each list includes no more than k attribute values att. In this embodiment, k=22.
[0053] The attribute list random filling operation receives the intercepted prompt template T drop With the attribute list Ls as input, for the attribute Attr in the predefined prompt template i , select the corresponding attribute value list L from the attribute list Ls i , and randomly select L i Select an attribute value att j , concatenate it with the corresponding connector, and traverse T drop After all the attributes in are combined, a prompt is obtained; the above operation is repeated to obtain a prompt set Ts containing t prompts. In this embodiment, t=1000000.
[0054] S2. Construct a collaborative generation module for portrait cutouts. Based on the prompt set and the portrait data, the collaborative generation module generates portrait cutout data including portrait images and cutout annotations, and performs text segmentation, dilation and corrosion operations on the portrait cutout data to obtain optimized portrait data. The collaborative generation module includes a diffusion model layer for collaborative generation of portrait cutouts based on text images, a diffusion model layer for collaborative generation of portrait cutouts based on image images, and a cutout annotation optimization layer based on text-guided segmentation and dilation and corrosion, specifically including the following steps:
[0055] (1) Input the prompt set Ts into the portrait cutout collaborative generation diffusion model layer based on the Wensheng graph to obtain the portrait image I te And cutout mark A te The first original portrait data D 1 ;
[0056] like Figure 3 As shown, in this embodiment, the portrait cutout collaborative generation diffusion model based on the Wensheng map adopts LayerDiffusion, receives the prompt set Ts as input, and collaboratively generates the portrait image I te And cutout mark A te , Portrait Picture I te And cutout mark A te As the first original portrait data D 1 , which can be expressed as the following formula:
[0057] D 1 =I te ,At e =T2I(Ts) (1)
[0058] Among them, T2I(·) represents the generation process of the collaborative generation diffusion model of portrait cutout based on Wensheng map.
[0059] (2) Input the portrait data Ps in the open source dataset into the portrait cutout collaborative generation diffusion model layer based on the raw image to obtain the portrait image I im And cutout mark A im The second original portrait data D 2 ;
[0060] like Figure 3 As shown, in this embodiment, a diffusion model based on the portrait cutout of the Wensheng map is collaboratively generated, and LayerDiffusion is used to receive the portrait data Ps in the open source dataset as input. The portrait data in the open source dataset uses the training set of the P3M-10K dataset to collaboratively generate the portrait image I im And cutout mark A im , Portrait Picture I im And cutout mark A imAs the second original portrait data D 2 , which can be expressed as the following formula:
[0061] D 2 =I im , A im =I2I(Ps) (2)
[0062] Among them, I2I(·) represents the generation process of the collaborative generation diffusion model of portrait cutout based on the image-generated image.
[0063] (3) The first original portrait data D 1 and the second original portrait data D 2 Input to the optimization layer of cutout annotation based on text-guided segmentation and dilation corrosion, and use the segmentation model to analyze the portrait image I te and I im Predict the segmentation mask M i Then dilate and combine the cutout annotation to segment the mask M i The optimized portrait data D is obtained by corrosion rfn .
[0064] like Figure 4 As shown, in the embodiment, the first original portrait data D 1 and the second original portrait data D 2 Input to the cutout annotation optimization layer based on text-guided segmentation and dilation corrosion; first, the original portrait data D 1 and D 2 Original portrait image I i The predefined segmentation hint B is input into the text-guided segmentation model GroundingSAM to obtain the segmentation mask M i ; Then the segmentation mask M i Perform dilation operation to obtain dilation mask MD i , the original portrait data D 1 and D 2 Cutout mark A i Middle Mask MD i The pixel position corresponding to the background area (pixel value is 0) is set to 0, and the cutout annotation AD after background optimization is obtained i ; Then the segmentation mask M i Perform an etching operation to obtain an etching mask ME i , mark the cutout image with optimized background as AD i Middle Mask ME i The pixel position corresponding to the foreground area (pixel value is 1) is set to 1, and the foreground optimized cutout annotation AE is obtained i , the original portrait data D 1 and D 2 Portraits in Ii And optimized cutout annotation AE i As the final data pair, the optimized portrait data D is obtained. rfn .
[0065] S3. Construct a data screening module, in which the image-text similarity between the optimized portrait data and the abnormal screening prompt set is calculated, and the portrait data below the set threshold is screened to obtain the screened portrait data.
[0066] like Figure 5 As shown, in this embodiment, the predefined abnormal screening prompt word set H is composed of h prompt words describing abnormal situations. In this embodiment, h=5; the optimized portrait data D rfn and the predefined abnormal screening prompt set H are input into the CLIP image encoder and CLIP text encoder respectively, and the encoding embeddings of the two are obtained, which are e i With e t , and then calculate the image-text similarity S(e i , e t ), the calculation formula is as follows:
[0067]
[0068] A high image-text similarity indicates that the generated portrait data is more related to the abnormal situation and is considered to be low-quality portrait data. Since low-quality portrait data will affect the learning efficiency of the model, the optimized portrait data D rfn The low-quality portrait data will be screened out in this step, and the high-quality portrait data will be retained as the screened portrait data D flt For use in subsequent steps.
[0069] S4. Build a data enhancement module and input the filtered portrait data into the random data enhancer. The random data enhancer will randomly select a pre-defined data enhancement method to obtain enhanced portrait data.
[0070] like Figure 6 As shown, the random data enhancer is composed of a variety of predefined enhancement methods. The random data enhancer receives the filtered portrait data D flt As input, randomly select 0 to r data enhancement methods to be applied to the portrait data. In this embodiment, r=4, which are Gaussian noise enhancement, grayscale enhancement, gamma correction enhancement and similar color background enhancement respectively. The enhanced portrait data D is obtained through the random data enhancer. aug , construct a portrait cutout dataset for model training.
[0071] In order to clearly demonstrate the method for constructing a portrait cutout dataset, an embodiment of the present invention further provides a system for constructing a portrait cutout dataset based on a diffusion model. The system uses the method for constructing a portrait cutout dataset in the process of constructing the portrait cutout dataset.
[0072] like Figure 7 As shown, the portrait cutout dataset construction system in the embodiment includes: a prompt construction module, a collaborative generation module, a data screening module and a data enhancement module;
[0073] The prompt construction module is used to obtain a prompt set for data generation, by randomly intercepting a predefined prompt template and randomly filling the intercepted prompt template with a predefined attribute list to obtain a prompt set;
[0074] The collaborative generation module is used to construct a collaborative generation module for portrait cutouts, including a diffusion model layer for collaborative generation of portrait cutouts based on text-generated images, a diffusion model layer for collaborative generation of portrait cutouts based on image-generated images, and a cutout annotation optimization layer based on text-guided segmentation and dilation and erosion; based on the prompt set and portrait data, the collaborative generation module generates portrait cutout data containing portrait images and cutout annotations, and performs text segmentation, dilation and erosion operations on the portrait cutout data to obtain optimized portrait data;
[0075] The data screening module is used to construct a data screening module based on image-text similarity to screen portrait data. In the screening module, the image-text similarity between the optimized portrait data and the abnormal screening prompt set is calculated, and the portrait data below the set threshold is screened as the screened portrait data;
[0076] The data enhancement module is used to build a data enhancement module for portrait cutouts. The filtered portrait data is input into the random data enhancer. The random data enhancer will randomly select a predefined data enhancement method to obtain the enhanced portrait data as the portrait cutout data set for model training.
[0077] Based on the above inventive concept, an embodiment further provides a device for constructing a portrait cutout dataset based on a diffusion model, comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to implement the above-mentioned method for constructing a portrait cutout dataset based on a diffusion model when executing the computer program.
[0078] The specific implementation methods described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for constructing a portrait cutout dataset based on a diffusion model, characterized in that: The following steps are involved: Step 1: construct a prompt construction module based on prompt templates and attribute lists, randomly intercept the pre-defined prompt templates, and randomly fill the intercepted prompt templates with the pre-defined attribute lists to obtain a prompt set; Step 2: Construct a collaborative generation module for portrait cutouts. Based on the prompt set and the portrait data, the collaborative generation module generates portrait cutout data including portrait images and cutout annotations. The portrait cutout data is subjected to text segmentation, expansion, and corrosion operations to obtain optimized portrait data. Step 3: Construct a data screening module, in which the image-text similarity between the optimized portrait data and the abnormal screening prompt set is calculated, and portrait data below a set threshold is screened to obtain screened portrait data; Step 4: Build a data enhancement module and input the filtered portrait data into the random data enhancer. The random data enhancer will randomly select a pre-defined data enhancement method to obtain enhanced portrait data.
2. The method for constructing a portrait cutout dataset based on a diffusion model according to claim 1, characterized in that: The prompt template T described in step 1 is as follows: T = Concate(Attr1, Conc1, Attr2, Conc2,..., Attr n-1 , Conc n-1 , Attr n ) where, Concate(·) represents string concatenation operation; The random interception operation receives a predefined prompt template T as input. Each attribute Attr and the corresponding connector Conc in T are deleted from the prompt template T with a certain probability value p. The remaining attributes and connectors are concatenated to obtain the intercepted prompt template T. drop ; The attribute list Ls contains n predefined attribute value lists L, each list contains no more than k attribute values att; the attribute list random filling operation receives the intercepted prompt template T drop With the attribute list Ls as input, for the attribute Attr in the predefined prompt template i , select the corresponding attribute value list L from the attribute list Ls i , and randomly select L i Select an attribute value att j , concatenate it with the corresponding connector, and traverse T drop After all the attributes in are combined, a prompt is obtained; repeat the above operation to obtain a prompt set Ts containing t prompts.
3. The method for constructing a portrait cutout dataset based on a diffusion model according to claim 1, characterized in that: The collaborative generation module described in step 2 includes a diffusion model layer for collaborative generation of portrait cutouts based on text-generated images, a diffusion model layer for collaborative generation of portrait cutouts based on image-generated images, and a cutout annotation optimization layer based on text-guided segmentation and dilation corrosion, specifically including the following steps: (1) Input the prompt word set Ts into the portrait cutout collaborative generation diffusion model layer based on the Wensheng graph to obtain a portrait image I te And cutout mark A te The first original portrait data D1; (2) Input the portrait data Ps in the open source dataset into the portrait cutout collaborative generation diffusion model layer based on the raw image to obtain a portrait image I im And cutout mark A im The second original portrait data D2; (3) The first original portrait data D1 and the second original portrait data D2 are input into the cutout annotation optimization layer based on text-guided segmentation and dilation corrosion, and the original portrait images I in the original portrait data D1 and D2 are converted into i The segmentation hint B is input into the text-guided segmentation model to obtain the segmentation mask M i ; Then the segmentation mask M i Perform dilation operation to obtain dilation mask MD i , mark the cutouts in the original portrait data D1 and D2 with A i Middle Mask MD i The pixel position corresponding to the background area (pixel value is 0) is set to 0, and the cutout annotation AD after background optimization is obtained i ; Then the segmentation mask M i Perform an etching operation to obtain an etching mask ME i , mark the cutout image with optimized background as AD i Middle Mask ME i The pixel position corresponding to the foreground area (pixel value is 1) is set to 1, and the foreground optimized cutout annotation AE is obtained i , the portrait image I in the original portrait data D1 and D2 i And optimized cutout annotation AE i As the final data pair, the optimized portrait data D is obtained. rfn .
4. The method for constructing a portrait cutout dataset based on a diffusion model according to claim 1, characterized in that: The abnormal screening prompt word set H described in step 3 is composed of h prompt words describing abnormal situations and is used to screen abnormal portrait data.
5. The method for constructing a portrait cutout dataset based on a diffusion model according to claim 1, characterized in that: The image-text similarity calculation described in step 3 is performed by taking the optimized portrait data D rfn and the abnormal screening prompt set H are input into the image encoder and text encoder respectively, and the encoding embeddings of the two are obtained, which are e i With e t , and then calculate the image-text similarity S(e i , e t ), the calculation formula is as follows: Keep the portrait data with lower image-text similarity as the filtered portrait data D flt For use in subsequent steps.
6. The method for constructing a portrait cutout dataset based on a diffusion model according to claim 1, characterized in that: The random data enhancer described in step 4 is composed of a plurality of predefined enhancement modes. The random data enhancer receives the filtered portrait data D flt As input, randomly select 0 to r data enhancement methods to obtain the enhanced portrait data D aug .
7. A portrait cutout dataset system based on a diffusion model, characterized in that: Using the method for constructing a portrait cutout dataset according to any one of claims 1 to 6, the system comprises: a prompt construction module, a collaborative generation module, a data screening module and a data enhancement module; The prompt construction module is used to obtain a prompt set for data generation, by randomly intercepting a predefined prompt template and randomly filling the intercepted prompt template with a predefined attribute list to obtain a prompt set; The collaborative generation module is used to construct a collaborative generation module for portrait cutouts, including a portrait cutout collaborative generation diffusion model layer based on a text image, a portrait cutout collaborative generation diffusion model layer based on a picture image, and a cutout annotation optimization layer based on text-guided segmentation and dilation and corrosion; based on a prompt set and portrait data, the collaborative generation module generates portrait cutout data including a portrait image and cutout annotations, and performs text segmentation, dilation and corrosion operations on the portrait cutout data to obtain optimized portrait data; The data screening module is used to construct a data screening module based on image-text similarity to screen portrait data, in which image-text similarity is calculated between the optimized portrait data and the abnormal screening prompt set, and portrait data below a set threshold is screened as screened portrait data; The data enhancement module is used to construct a data enhancement module for portrait cutouts. The filtered portrait data is input into a random data enhancer. The random data enhancer randomly selects a predefined data enhancement method to obtain enhanced portrait data as a portrait cutout data set for model training.
8. A device for constructing a portrait cutout dataset based on a diffusion model, comprising a memory and a processor, wherein the memory is used to store a computer program, characterized in that: The processor is used to implement the method for constructing a portrait cutout dataset based on a diffusion model as described in any one of claims 1 to 6 when executing the computer program.
Citation Information
Patent Citations
Video portrait matting method and device, storage medium and equipment
CN118411285A
Image data set construction method and device for data diversity enhancement
CN118675009A
Human image matting enhancement method and device based on dense annotation synthetic data
CN117576511A
Image layering generation system, method and device based on stable diffusion model
CN118115624A