Method for generating clear image with periodicity
By introducing a stitching and focusing mechanism and a super-resolution process into the image generation model, the problem that existing technologies cannot generate strictly periodic and high-resolution patterns is solved, achieving efficient generation of high-quality patterns and reducing the time and cost of printing and dyeing design.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- PEKING UNIV
- Filing Date
- 2025-11-18
- Publication Date
- 2026-06-18
AI Technical Summary
Existing image generation methods cannot directly generate strictly periodic patterns and cannot effectively improve image resolution, resulting in high time costs and decreased image quality in printing and dyeing design.
Employing a stitching and focusing mechanism and a super-resolution process, periodic patterns are generated by modifying the attention mechanism of the diffusion model. Super-resolution technology is used to improve image resolution and detail, including stitching and attention focusing in the feature space, and image editing techniques are combined to repair the image.
It enables efficient generation of high-quality periodic patterns, reduces the time cost of printing and dyeing design, and improves the usability of image generation models.
Smart Images

Figure CN2025135800_18062026_PF_FP_ABST
Abstract
Description
A method for generating clear images with periodicity Technical Field
[0001] This invention belongs to the field of image generation and relates to a method for generating clear images with periodicity. Background Technology
[0002] In the printing and dyeing industry, pattern design requires a high degree of periodicity and high definition to ensure seamless splicing effects on large areas of fabric. However, existing pattern design typically relies on manual hand-drawing or digital drawing tools, which consumes a lot of time and human resources and makes it difficult to make flexible and diverse modifications to the image content according to the user's needs.
[0003] In recent years, generative models, especially text-to-pattern diffusion models (such as Midjourney and StableDiffusion), have made significant progress in image generation technology. Image generation models have also been widely used due to their diverse generated content and efficient generation process.
[0004] However, existing image generation methods cannot directly generate periodic patterns through text constraints. Furthermore, limited by computational resources, the models cannot directly generate high-resolution patterns, requiring the reliance on existing super-resolution techniques to improve the clarity of the generated patterns. However, this method amplifies artifacts and distortions during the generation process in printing and dyeing applications, leading to a decrease in quality.
[0005] Therefore, there is an urgent need for a generation framework that can generate strictly periodic data and automatically optimize image resolution, in order to improve generation quality and reduce the time cost of printing and dyeing design. Summary of the Invention
[0006] To address the aforementioned problems, this invention proposes a method for generating clear, periodic images. This method comprises two core components: a stitching and focusing mechanism and a super-resolution process. Strictly periodic patterns are generated through stitching and attention focusing in the feature space during image generation. Then, a super-resolution process, which integrates image editing and super-resolution techniques, is used to repair the image and improve its resolution.
[0007] This invention provides a method for generating clear images with periodicity, the steps of which include:
[0008] Modify the attention mechanism of the diffusion model to be used to a focused attention mechanism and input text prompts;
[0009] Generate the central region of the image in the feature space of the diffusion model, and restrict attention to the central region;
[0010] The central region is sampled and repeatedly copied and stitched around it until the set number of steps are reached to obtain the initial pattern;
[0011] Upsampling techniques are used to improve image resolution;
[0012] Image editing techniques are used to repair and add details to an image, guided by text prompts, to generate a clear image that meets the target resolution requirements.
[0013] Furthermore, the modification method is to trim the corresponding dimensions of the K and V vectors from the attention process, retaining only the central region to smooth the splicing of the edge regions.
[0014] Furthermore, during the sampling process, an extended feature vector is generated at each time step using a replacement function and then concatenated with the original feature vector.
[0015] Furthermore, the initial pattern is magnified to the target resolution using a pre-trained diffusion model upsampling technique and segmented into sub-images with overlapping regions, the resolution of which is within the processing capability of the diffusion model.
[0016] Furthermore, consistency constraints are added to the corresponding parts of the original region and the expanded region of the segmented subgraph.
[0017] Furthermore, the feature is that after repairing the image and adding details, all sub-images are re-stitched, and consistency constraints are applied to the overlapping parts of adjacent regions.
[0018] Furthermore, the process of increasing image resolution and repairing and adding details is repeated multiple times until the set image resolution is achieved.
[0019] The beneficial effects of this invention are:
[0020] Compared with existing technologies, this invention provides a plug-and-play framework for generating periodic patterns without training. It also provides a matching image processing workflow that simultaneously completes image restoration, generates details, and improves resolution. This improves the usability of image generation models in the field of printing and dyeing pattern design, enabling the generation of high-quality stylized patterns and significantly reducing production costs. Attached Figure Description
[0021] Figure 1 is a flowchart illustrating an embodiment of the present invention;
[0022] Figure 2 is a schematic diagram of the splicing and focusing mechanism in the embodiment of the present invention;
[0023] Figure 3 is a schematic diagram of the super-resolution module in an embodiment of the present invention. Detailed Implementation
[0024] This invention provides a method for generating clear images with periodicity, and the flowchart is shown in Figure 1.
[0025] Step 1: Periodic Pattern Generation. This step receives text prompts from the user and uses a diffusion model to generate a low-resolution initial pattern. In this embodiment, the central region is 512. 2 640 pixels after expansion 2 Pixels. To ensure the periodicity of the generated pattern, the diffusion model is extended using the following stitching-focusing mechanism.
[0026] Feature space concatenation: In this embodiment, the StableDiffusion1.5 model is used as the basic generative model. First, random Gaussian distribution features x are sampled in the feature space. T ~N(0,1), whose resolution corresponds to the ratio of the size of the initial pattern image to the feature space scaling factor. Define the replacement function S(x t )=x t ′, i.e., x t,e1 ′=x t,e1 x t,c1′ ′=x t,c1 And so on, as shown in Figure 2, the feature vector x at each time step t in the above generative model sampling process. t The process involves stitching together corresponding portions of the central region and copying them to the outer regions to achieve strict consistency. Sampling and stitching are repeated throughout the sampling process until all 50 sampling steps are completed.
[0027] Focused Attention Mechanism: The standard self-attention mechanism of the diffusion model is modified by limiting the attention range to the effective central region of the image to ensure smooth edge stitching. Specifically, the corresponding dimensions of the K and v vectors are cropped during the self-attention process, retaining only the central region (the original region before the feature space expansion). A focused attention mechanism, FocAttention, is defined, and its calculation formula is as follows: Here, K′ and V′ are the cropped K and V vectors, their dimensions corresponding to the portion of the central region in the expanded image. Throughout the sampling process, the self-attention mechanism is replaced with the above mechanism until the prescribed number of sampling steps are completed. This mechanism requires no additional training and improves the naturalness of pattern generation through lightweight modifications.
[0028] Step 2: Super-resolution and Detail Reconstruction. To meet the printing and dyeing industry's requirements for pattern resolution, a super-resolution workflow is applied to perform super-resolution and detail restoration on the low-resolution periodic patterns generated in the previous steps. The super-resolution module consists of two stages: a super-resolution stage and an image editing stage, which alternately enhance the clarity of the pattern and repair distortion, as shown in Figure 3. In this example, the original area is 4096. 2 5120 pixels after expansion 2 Pixel.
[0029] In the super-resolution stage, upsampling techniques are used to enlarge the initial pattern to the target resolution. In this example, a pre-trained diffusion model-based upsampling technique is used to segment the enlarged high-resolution image into sub-images with overlapping regions, ensuring that the resolution of the sub-images is within the processing capability of the diffusion model, thus facilitating subsequent detail restoration. Simultaneously, consistency constraints are added to corresponding parts of the original and expanded regions of the segmented sub-images, ensuring that the feature vectors of corresponding parts remain consistent, guaranteeing the smoothness and periodicity of the re-stitching.
[0030] In the image editing stage, image editing methods are used to reconstruct details of the super-resolution sub-images under the guidance of text prompts. This method first adds noise of intensity 0.3 to the original image, and then uses a diffusion model to progressively sample and denoise the image during the denoising process, generating structures and details that meet the target resolution requirements. Finally, all sub-images are re-stitched, and consistency constraints are applied to overlapping areas of adjacent regions (ensuring that the feature vectors of corresponding parts remain consistent) to ensure seamless connection and guarantee the overall consistency of the pattern.
[0031] The above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Those skilled in the art can modify or make equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention. The scope of protection of the present invention should be determined by the claims.
Claims
1. A method for generating clear images with periodicity: Modify the attention mechanism of the diffusion model to be used to a focused attention mechanism and input text prompts; Generate the central region of the image in the feature space of the diffusion model, and restrict attention to the central region; The central region is sampled and repeatedly copied and stitched around it until the set number of steps are reached to obtain the initial pattern; Upsampling techniques are used to improve image resolution; Image editing techniques are used to repair and add details to an image, guided by text prompts, to generate a clear image that meets the target resolution requirements.
2. The method according to claim 1, characterized in that, The modification method is as follows: trim the corresponding dimensions of the K and V vectors during the attention process, retaining only the central region to smooth the splicing of the edge regions.
3. The method according to claim 1, characterized in that, During the sampling process, an extended feature vector is generated at each time step using a replacement function and then concatenated with the original feature vector.
4. The method according to claim 1, characterized in that, The initial pattern is magnified to the target resolution using a pre-trained diffusion model upsampling technique and segmented into sub-images with overlapping regions, the resolution of which is within the processing capability of the diffusion model.
5. The method according to claim 4, characterized in that, Add consistency constraints to the corresponding parts of the original region and the expanded region of the segmented subgraph.
6. The method according to claim 4 or 5, characterized in that, After repairing the image and adding details, all sub-images are re-stitched, and consistency constraints are applied to overlapping areas of adjacent regions.
7. The method according to claim 1, characterized in that, Repeatedly increase the image resolution and repair and add details until the set image resolution is achieved.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, the computer program being executed by the processor to implement the steps of the method of claims 1-7.
9. A storage medium storing a computer program, wherein the computer program, when executed, implements the steps of the method described in claims 1-7.