Clothing image generation method and device based on diffusion model
Patent Information
- Application Number
- CN202510869841.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-26
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2045-06-26
AI Technical Summary
[0003]然而,如文献1公开的《从特征辨识到图像生成:基于AIGC范式的苗族服饰设计》和文献2公开的《OOTDiffusion: Outfitting Fusion based Latent Diffusion forControllable Virtual Try-on,用于可控虚拟试穿的基于舾装融合的潜在扩散技术》等当前的服装实物图像生成技术存在严重依赖成对数据进行训练、生成图难以很好地保留服装的版型和纹理等关键信息,导致生成的图像无法呈现真实的服装细节
[0015]与现有技术相比,本发明具有的有益效果至少包括:
Smart Images

Figure CN120747277B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image generation technology, specifically relating to a method and apparatus for generating images of clothing based on a diffusion model. Background Technology
[0002] With the continuous development of artificial intelligence (AI), generative artificial intelligence (AIGC) technology has been able to automatically generate high-quality digital content such as images and videos. In the field of fashion design, AI technology is also widely used for generating various clothing images.
[0003] However, current clothing image generation technologies, such as "From Feature Recognition to Image Generation: Miao Costume Design Based on AIGC Paradigm" in Reference 1 and "OOTDiffusion: Outfitting Fusion based Latent Diffusion for Controllable Virtual Try-on" in Reference 2, suffer from a heavy reliance on pairwise data for training. The generated images often fail to retain crucial information such as the garment's pattern and texture, resulting in images that cannot accurately depict realistic clothing details. These issues prevent the generated images from fully meeting the needs of different businesses and consumers, limiting the widespread application and further promotion of AIGC technology in clothing image generation tasks. Summary of the Invention
[0004] In view of the above, and in view of the shortcomings of previous methods for generating images of clothing, this invention proposes a method and apparatus for generating images of clothing based on a diffusion model. This method and apparatus can overcome the limitations of data-driven model training, effectively restore the details of clothing texture, and support secondary editing functions, making the generated results closer to the designer's needs.
[0005] To achieve the above-mentioned objectives, an embodiment provides a method for generating clothing image based on a diffusion model, comprising the following steps: S1: After collecting historical clothing images and tagging them by style, fine-tune the LoRA adapter to reflect the style of the clothing images; S2: Extract the soft edge structure features of the design drawing and generate control conditions based on the soft edge structure features; S3: Extract semantic features from the design drawings, and use prompt word engineering technology to combine semantic features with clothing meta-information corresponding to the designer's intent to generate prompt words; S4: Based on prompts and control conditions, and using a diffusion model combined with a LoRA adapter, generate garment images that match the design drafts and the designer's intentions.
[0006] Preferably, in step S2, an edge detection algorithm is used to extract the soft edge structure features of the design drawing. The edge detection algorithm includes the HED algorithm. The extracted soft edge structure features are injected into a pre-trained control network to be transformed into control conditions. The control network includes the flux-controlnet-hed-v3 developed by XLabs-AI.
[0007] Preferably, in step S3, the semantic features of the design drawing are extracted using the llama3 multimodal model to obtain a series of statements describing the garment pattern, color, and pattern features in the design drawing as text expressing the semantic features.
[0008] Preferably, in step S4, the diffusion model includes a dual-stream block, a single-stream block, a final layer, and a decoder; The embedding vector obtained after the first text embedding of the prompt word is combined with the embedding vector at the offset time step and the embedding vector of the control condition used as guidance to form the text vector; The text features obtained after the second text embedding of the prompt words are combined with the image features corresponding to each time step and then input into the two-stream block. In the two-stream block, the text features and image features are fused together with the text vector as a guide and the relative position encoding between the elements in the features. The fused text features and image features are merged and the merged result is input into a single-stream block. In the single-stream block, the text vector is used as a guide, and the relative positions between elements in the features are combined to perform image-text interaction to obtain the fused result. The image data containing only images is extracted from the merged result, and the image data, text vectors and LoRA parameters are passed into the final layer to output the image tensor of the latent space; The image tensor is decoded using a decoder to obtain a pixel-space image of the clothing. At the same time, the image tensor is unpacked and used as the image feature input for the image modality corresponding to the next time step.
[0009] Preferably, the embedding vector obtained after the first text embedding of the prompt word is combined with the embedding vector of the time step and the embedding vector of the control condition to form the text vector, including: The embedding vector of the control conditions is concatenated with the embedding vector of the offset time step in 40% to 80% of the time steps, and then combined with the embedding vector of the first text embedding through an MLPembedder layer for feature transformation and added to obtain the final text vector. MLPembedder is a linear layer with SiLU activation and two hidden layers.
[0010] Preferably, in a two-stream block, text vectors are used as a guide, and the relative position encoding between elements in the features is combined to fuse text features and image features to obtain fused text features and image features, including: Image features and text features are processed through normalization and modulation, QKV generation, multi-head splitting and normalization to obtain their respective Q (query), K (key), and V (value). After being concatenated, they are combined with the position tensor pe, and attention is calculated using attention. The attention result is split into the attention part of the image and the attention part of the text. Residual connection and MLP are used to process the attention parts of the image and the text vector respectively, and the fused image features and text features are returned.
[0011] Preferably, within a single-stream block, text vectors are used as guides, and the relative position encoding between elements in the features is combined to perform image-text interaction on the merging result to obtain the fused merging result, including: Single-stream block combines the attention mechanism and MLP in parallel. It adjusts the input merging result through modulation parameters to obtain the output value. Finally, it uses residual connection to combine the input merging result, the relative positions between elements in the vector, and the text vector and output value to obtain the fused merging result.
[0012] Preferably, the method further includes: S5: selecting areas in the garment image that do not match the expectations, and re-executing the image generation process in step S4 on the selected areas while keeping the unselected areas unchanged, until the desired effect is achieved; Use a mask to select areas in the garment image generated in step S4 that do not match expectations, and then record the smallest square size that can encompass the selected area and its position in the original garment image. After enlarging the square resolution to the input size of the diffusion model, step S4 is executed to regenerate the clothing image for the square region. Then, the regenerated clothing image is scaled down to the original resolution size corresponding to the original square, and then sorted according to position. By performing area coverage, a second-edited image of the clothing is obtained.
[0013] To achieve the above-mentioned objectives, the embodiments also provide a clothing image generation device based on a diffusion model, including a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned clothing image generation method based on a diffusion model.
[0014] To achieve the above-mentioned objectives, the embodiments also provide a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the above-mentioned method for generating clothing images based on a diffusion model.
[0015] Compared with the prior art, the beneficial effects of the present invention include at least the following: This invention generates physical images of clothing by designing feature extraction rules for clothing design drawings, using image feature extraction based on soft lines and semantic feature extraction based on multimodal models, combined with a diffusion model.
[0016] Furthermore, fine-tuning and training based on the features of clothing images on the general large model can effectively improve the consistency of generated images in the specified sample domain, and is applicable to various situations where large sample training sets are lacking, with strong scalability. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart of the method for generating clothing images based on a diffusion model provided in the embodiment; Figure 2 This is a schematic diagram of the workflow of the diffusion model provided in the embodiment; Figure 3 This is a schematic diagram of the workflow of the DoubleStreamBlock module in the diffusion model provided in the embodiment; Figure 4 This is a schematic diagram of the workflow of the SingleStreamBlock module in the diffusion model provided in the embodiment; Figure 5 This is a schematic diagram of the workflow of the LastLayer module in the diffusion model provided in the embodiment. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.
[0020] The inventive concept of this invention is to solve the technical problems of current garment pattern generation, such as reliance on paired data, difficulty in controlling the pattern, and inconsistency of texture. This invention provides a garment pattern generation scheme based on a diffusion model, which can improve the efficiency of garment sampling.
[0021] Example 1 Based on the above inventive concept, this embodiment provides a method for generating clothing image based on a diffusion model, such as... Figure 1 As shown, it includes the following steps: S1: After collecting historical clothing images and tagging them by style, fine-tune the LoRA adapter to reflect the style of the clothing images.
[0022] The historical clothing images used in this implementation method were obtained from the H&M clothing dataset and labeled according to features such as clothing type, style, color, fabric, and pattern, resulting in a dataset containing 20,000 image-text pairs, each including a clothing image and corresponding text description. A LoRA adapter was then trained based on this dataset. The LoRA adapter, without modifying the model parameters, uses a small amount of data to train a specific art style / IP / character to meet customization needs. This can be expressed using the following formula:
[0023] in These are the initial model parameters (Weights). This is the low-rank matrix, which is also the parameter of the LoRA model.
[0024] S2: Extract the soft edge structure features of the design drawing and generate control conditions based on the soft edge structure features; This implementation method uses an edge detection algorithm to extract the soft edge structure features of the design drawing. The soft edge detection algorithm can be based on the HED algorithm, and the soft edge structure features are injected into a pre-trained control network to be transformed into control conditions. The control network uses the flux-controlnet-hed-v3 developed by XLabs-AI.
[0025] S3: Extract semantic features from the design drawings, and use prompt word engineering technology to combine semantic features with clothing meta-information corresponding to the designer's intent to generate prompt words; This implementation method uses the llama3 multimodal model to extract semantic features from the design drawings, resulting in a series of statements describing the garment's pattern, color, and pattern features as text expressing these semantic features. Then, cue word engineering techniques are used to combine the text containing the semantic features of the design drawings with the garment metadata corresponding to the designer's intent, yielding cue words.
[0026] Specifically, the prompt words are as follows: Please combine {semantic features} and {clothing metadata} to generate descriptive prompts in the following format: The description reads: "A bespoke trench coat featuring an asymmetrical, oversized lapel. A sketch-like graphic showcases a curved hem and concealed magnetic closure. It's crafted from a soft beige linen blend with a delicate herringbone texture. Practical details include a detachable belt with brass buckles and an interior cell phone pocket. This trench coat is presented in a minimalist Scandinavian office setting—the model stands by floor-to-ceiling windows, where natural sunlight casts soft shadows, allowing for close-up views of the fabric's weave texture, rendered in ultra-realistic 8K resolution. Details such as the collar stitching and button details are clearly visible, with cinematic lighting effects." The {semantic information} part of the prompt is the statement generated in step S3, and the {clothing meta-information} is the designer's definition of clothing attributes and series, as shown below: M series, wave: second wave; theme: physical exclusive; applicable season: summer; style: short-sleeved T-shirt; color: light blue; fabric: knitted; fit: loose square fit; advantages: This is a T-shirt with a graphic design on the chest, made of comfortable Solona fabric, which has elasticity, shape retention and moisture-wicking and quick-drying functions. It is comfortable and cool to wear in summer and is not easy to deform. The chest is a combination of a fun apple and the brand's M letter. The classic red and blue combination combined with foaming technology makes it more exquisite, fashionable and layered.
[0027] S4: Based on prompts and control conditions, and using a diffusion model combined with a LoRA adapter, generate garment images that match the design drafts and the designer's intentions.
[0028] In this implementation method, the prompt words are derived from the results of step S3, and the control conditions are derived from the results of step S2. When setting hyperparameters, except for the control condition strength which is set to 0.7, the other hyperparameters use their default values. Subsequently, a diffusion model combined with a LoRA adapter is used to generate a clothing image based on the given prompt words and control conditions.
[0029] like Figure 2 As shown, the diffusion model mainly includes DoubleStreamBlock, SingleStreamBlock, LastLayer, and a decoder. The self-attention mechanism in DoubleStreamBlock fuses the latent variables of the image with text information; SingleStreamBlock simply concatenates the latent variables of the image and text and performs unified processing to further enhance the information fusion effect; the LastLayer normalizes and scales / translates the image; finally, the decoder decodes the image to generate a clothing image, ensuring the consistency and stability of image features during the generation process. The detailed process is as follows: At the initial time step, the latent space noise x is acquired, where the shape and size of x are... ), where h and w are the true resolution values, and b is the batch size. The latent space noise x is a low-dimensional random tensor generated by a Gaussian distribution, where b is usually 1, h is usually 1024, and w is usually 1024.
[0030] The tensor size of the latent space noise x is changed from... Remodeling Where h and w are the sizes of the latent space, and the second dimension ( ) represents the number of blocks, the last dimension ( ) represents the flattened blocks of all z_channels (z channels), where c represents the number of channels. Indicates the number of times the flattening is repeated.
[0031] Specifically, for each block, the image index tensor img_ids is first created with a shape of A zero-initialized tensor. In this zero-initialized tensor, the first channel remains 0, and the second channel is filled with 0. The third channel is filled with After filling the channels, the height and width dimensions of the tensor are flattened to one dimension. Finally, the flattened tensor is repeated bs times to obtain a shape of... The tensor.
[0032] We use Google's t5-v1_1-xxl as the T5 embedding model. We use the T5 embedding model to perform a second text embedding on the prompt word. After passing through the linear layer, we obtain the text features (txt) and repeat the process bs times.
[0033] The `clip-vit-large-patch14` model developed by OpenAI was used as the CLIP embedding model. The prompt word was first embedded into text, then linearly processed, and finally, time offset and guide word encoding were added to obtain the text vector `vec`. The formula for calculating the time offset is as follows:
[0034] Where t is the time step that is uniformly divided. The default value is 1. This method estimates a linear value using a linear function generator. It takes two points as input parameters (x1, y1 and x2, y2) to define the slope and intercept of a line. x1 and x2 represent the upper and lower limits of the resolution, and y1 and y2 represent the values corresponding to these limits, resulting in a linear function. , The value is the function value corresponding to the number of image blocks for x.
[0035] The method performs sinusoidal positional encoding on the input time step. First, it calculates the frequencies in different dimensions. Then, it combines the input time step t with the frequencies, calculates the sine and cosine values separately, and concatenates them to form the final embedding vector for the time step. The control conditions obtained in step S2 are applied in 40% to 80% of the time steps. Specifically, the control conditions are encoded to obtain their embedding vectors. These embedding vectors are then concatenated with the time step embedding vectors in 40% to 80% of the time steps, and finally combined with the CLIP-embedded text vector through an MLPembedder layer for feature transformation and addition to obtain the final text vector (vec). The MLPembedder is a linear layer with SiLU activation and two hidden layers. SiLU activation maps the input values to... Within the range.
[0036] Simultaneously, a zero-initialized text index tensor `txt_ids` for the T5 text features (txt) is created, where the final dimension of `txt_ids` is the same as the channel dimension of `img_ids`, ensuring that the dimensions are the same when they are concatenated later. The two vectors `txt_ids` and `img_ids` are concatenated to obtain a vector index `ids` whose dimension is the sum of the number of prompt tokens and the number of patches. Then, rotation-based position encoding is performed. The encoding process involves first rotating each of the three channels of `ids` using RoPE, and then concatenating them along the embedding dimension of RoPE. The final result is a five-dimensional tensor of size (batch, 1, sum of prompt token + patch count, sum of three channel embedding dimensions, 2, 2) as the position encoding `pe`. RoPE rotates the input vector based on the position of elements in the input sequence to represent the relative positional relationships between elements. The calculation method for RoPE is: for an input vector `x` of dimension `d`, for position `m` and dimension... The rotation angle corresponding to the rotation matrix:
[0037] After obtaining the initial RoPE location encoding (pe), text vector (vec), text features (txt), and image features (img), N two-stream blocks are traversed to obtain the computed image features (img) and text features (txt). A two-stream block is a transformer block capable of processing both image and text tokens simultaneously, and then fusing their features through an attention mechanism. Figure 3 As shown, in a two-stream block, the image feature img and text feature txt are obtained by normalization and modulation, QKV generation, multi-head splitting and normalization, respectively, to obtain their respective Q (query), K (key), and V (value). After being concatenated, they are combined with the position tensor pe, and attention is calculated using attention. The attention result is split into the attention part of the image (img attn) and the attention part of the text (txt attn). Residual connections and MLP are used to process the attention parts of the image and text and the text vector (vec) respectively, and the fused image feature img and text feature txt are returned.
[0038] The image features (img) and text features (txt) output from the last two-stream block are then merged (cat). The merged result (imtxt) is processed through N single-stream blocks to obtain the final merged result (imtxt). Figure 4 As shown, the single-stream block combines the attention mechanism and MLP in parallel. It adjusts the input merged result imtxt by modulating the parameters to obtain the output value. Finally, the residual connection is used to combine the input merged result imtxt, pe, and text vector (vec) with the output value, which helps the model capture complex patterns and features in the sequence and obtain the fused merged result (imtxt).
[0039] From the merged result (imtxt), image data consisting only of images (img) is extracted by splitting. This image data, along with text vectors (vec) and LoRA parameters, is then passed to the final layer (LastLayer). Figure 5 The process shown outputs the latent image tensor `latent img`. Then, `latent img` is unpacked into... The tensor of ) is used as the input to the image modality corresponding to the next time step (i.e., create latent), where h and w are the sizes of the latent space, which are 1 / 8 of the actual resolution.
[0040] Finally, the VAE Decoder is used to decode the image tensor (latent image) to obtain the image of the clothing in pixel space.
[0041] S5: Select the areas in the clothing image that do not match the expectations, and re-execute the image generation process in step S4 on the selected areas while keeping the unselected areas unchanged.
[0042] In this embodiment, a mask is used to select areas in the garment image generated in step S4 that do not match the expectations. Then, the minimum side length n of the square that can encompass the selected area and its position in the original garment image are recorded. The resolution of this region is then increased to 1024*1024. This increase is achieved using bicubic interpolation to interpolate missing pixels, utilizing information from the 16 neighboring pixels of the target pixel to calculate its color value. Increasing the resolution provides more space for the image generation model to perform inference. The regenerated square is then restored to its original resolution size, n*n. This step employs downsampling combined with filtering. First, the original image is downsampled by discarding a portion of pixels at a certain ratio, resulting in a pre-reduced image. Then, a low-pass filter is used to remove high-frequency components from the image. Finally, the regenerated rectangular region is overlaid on... The above process yields a second-edited image, and this step can be performed multiple times until the generated result meets expectations.
[0043] Example 2 Based on the same inventive concept, this invention also provides a clothing image generation device based on a diffusion model, including a memory and one or more processors. The memory stores executable code, and when the one or more processors execute the executable code, they implement the above-mentioned clothing image generation method based on a diffusion model, specifically including the following steps: S1: After collecting historical clothing images and tagging them by style, fine-tune the LoRA adapter to reflect the style of the clothing images; S2: Extract the soft edge structure features of the design drawing and generate control conditions based on the soft edge structure features; S3: Extract semantic features from the design drawings, and use prompt word engineering technology to combine semantic features with clothing meta-information corresponding to the designer's intent to generate prompt words; S4: Based on prompts and control conditions, and using a diffusion model combined with a LoRA adapter, generate garment images that match the design drafts and the designer's intentions; S5: Select the areas in the clothing image that do not match the expectations, and re-execute the image generation process in step S4 on the selected areas while keeping the unselected areas unchanged.
[0044] The clothing image generation device based on the diffusion model provided in this embodiment, at the hardware level, includes a processor, memory, and other hardware required for business operations, in addition to the processor and memory. The memory is non-volatile. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to implement the clothing image generation method based on the diffusion model described in S1-S5 above. Of course, besides the software implementation, this invention does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. That is to say, the execution entity of the following processing flow is not limited to individual logic units, but can also be hardware or logic devices.
[0045] Example 3 Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a program thereon. When executed by a processor, the program implements the above-described method for generating clothing images based on a diffusion model, specifically including the following steps: S1: After collecting historical clothing images and tagging them by style, fine-tune the LoRA adapter to reflect the style of the clothing images; S2: Extract the soft edge structure features of the design drawing and generate control conditions based on the soft edge structure features; S3: Extract semantic features from the design drawings, and use prompt word engineering technology to combine semantic features with clothing meta-information corresponding to the designer's intent to generate prompt words; S4: Based on prompts and control conditions, and using a diffusion model combined with a LoRA adapter, generate garment images that match the design drafts and the designer's intentions; S5: Select the areas in the clothing image that do not match the expectations, and re-execute the image generation process in step S4 on the selected areas while keeping the unselected areas unchanged.
[0046] In this embodiment, the computer-readable medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data.
[0047] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for generating clothing image based on a diffusion model, characterized in that, Includes the following steps: S1: After collecting historical clothing images and tagging them by style, fine-tune the LoRA adapter to reflect the style of the clothing images; S2: Extract the soft edge structure features of the design drawing and generate control conditions based on the soft edge structure features. The soft edge structure features of the design drawing are extracted using an edge detection algorithm, including the HED algorithm. The extracted soft edge structure features are injected into a pre-trained control network to be transformed into control conditions. The control network includes the flux-controlnet-hed-v3 developed by XLabs-AI. S3: Extract semantic features from the design drawings and use prompt word engineering technology to generate prompt words by combining semantic features with clothing meta-information corresponding to the designer's intention. Specifically, the llama3 multimodal model is used to extract semantic features from the design drawings, resulting in a series of statements describing the clothing pattern, color, and pattern features in the design drawings as text expressing semantic features. S4: Based on prompts and control conditions, and using a diffusion model combined with a LoRA adapter, generate garment images that match the design drafts and the designer's intentions; The diffusion model includes a two-stream block, a single-stream block, a final layer, and a decoder. The embedding vector obtained after the first text embedding of the prompt word is combined with the embedding vector at the offset time step and the embedding vector of the control condition used as guidance to form the text vector; The text features obtained after the second text embedding of the prompt words are combined with the image features corresponding to each time step and then input into the two-stream block. In the two-stream block, the text features and image features are fused together with the text vector as a guide and the relative position encoding between the elements in the features. The fused text features and image features are merged and the merged result is input into a single-stream block. In the single-stream block, the text vector is used as a guide, and the relative positions between elements in the features are combined to perform image-text interaction to obtain the fused result. The image data containing only images is extracted from the merged result, and the image data, text vectors and LoRA parameters are passed into the final layer to output the image tensor of the latent space; The image tensor is decoded using a decoder to obtain a pixel-space image of the clothing. At the same time, the image tensor is unpacked and used as the image feature input for the image modality corresponding to the next time step.
2. The method for generating clothing images based on a diffusion model according to claim 1, characterized in that, The embedding vector obtained after the first text embedding of the cue words is combined with the embedding vector at the time step and the embedding vector of the control conditions to form the text vector, which includes: The embedding vector of the control conditions is concatenated with the embedding vector of the offset time step in 40% to 80% of the time steps, and then combined with the embedding vector of the first text embedding through an MLPembedder layer for feature transformation and added to obtain the final text vector. MLPembedder is a linear layer with SiLU activation and two hidden layers.
3. The method for generating clothing images based on a diffusion model according to claim 1, characterized in that, In a two-stream block, text vectors are used as a guide, and the relative position encoding between elements in the features is combined to fuse text features and image features, resulting in fused text features and image features, including: Image features and text features are processed through normalization and modulation, QKV generation, multi-head splitting and normalization to obtain their respective Q (query), K (key), and V (value). After being concatenated, they are combined with the position tensor pe, and attention is calculated using attention. The attention result is split into the attention part of the image and the attention part of the text. Residual connection and MLP are used to process the attention parts of the image and the text vector respectively, and the fused image features and text features are returned.
4. The method for generating clothing images based on a diffusion model according to claim 1, characterized in that, In a single-stream block, text vectors are used as guides, and the relative positional encoding between elements in the features is combined to perform image-text interaction on the merged result, resulting in a fused merged result, including: Single-stream block combines the attention mechanism and MLP in parallel. It adjusts the input merging result through modulation parameters to obtain the output value. Finally, it uses residual connection to combine the input merging result, the relative positions between elements in the vector, and the text vector and output value to obtain the fused merging result.
5. The method for generating clothing images based on a diffusion model according to claim 1, characterized in that, The method further includes: S5: Selecting areas in the clothing image that do not match the expectations, and re-executing the image generation process in step S4 on the selected areas while keeping the unselected areas unchanged, until the desired effect of the designer is met; Use a mask to select areas in the garment image generated in step S4 that do not match expectations, and then record the smallest square size that can encompass the selected area and its position in the original garment image. After enlarging the square resolution to the input size of the diffusion model, step S4 is executed to regenerate the clothing image for the square region. Then, the regenerated clothing image is scaled down to the original resolution size corresponding to the original square, and then sorted according to position. By performing area coverage, a second-edited image of the clothing is obtained.
6. A device for generating clothing images based on a diffusion model, comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that, When the one or more processors execute the executable code, they are used to implement the method for generating clothing images based on the diffusion model as described in any one of claims 1-5.
7. A computer-readable storage medium, characterized in that, It stores a program that, when executed by a processor, implements the method for generating clothing images based on a diffusion model as described in any one of claims 1-5.
Citation Information
Patent Citations
Garment secondary design system and method
CN117576246A
Image generation method and device, equipment and storage medium
CN119810257A