A method for generating symmetric lace images based on a generative adversarial network
Patent Information
- Application Number
- CN202311553856.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-21
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-11-21
AI Technical Summary
Existing technologies cannot effectively generate high-resolution, highly complex lace images, and the symmetry of lace images is poor in image generation tasks.
A generative adversarial network model with dual discriminators is adopted, including a generator, an image discriminator, and a symmetry discriminator. By adjusting the loss function and the symmetry structure of the noisy input, the generator's ability to generate symmetrical lace images is enhanced.
The generated lace images not only maintain high resolution and texture details, but also possess good symmetry, enhancing the artistic effect of the image generation.
Smart Images

Figure CN117392258B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of lace design technology, specifically relating to a method for generating symmetrical lace images based on generative adversarial networks. Background Technology
[0002] As a type of artificially designed texture image, lace texture needs to possess a series of aesthetic characteristics indispensable in artistic design creation, such as periodicity, symmetry, and white space. This requires human designers to spend a lot of time and effort, so it is necessary to apply generative models to generate lace images. Lace images have the characteristics of high definition and high complexity of texture, while also having strict requirements for periodicity and symmetry. In image generation tasks, compared with models such as DCGAN, CycleGAN, and ProGAN, although images generated by StyleGAN2 perform well in terms of resolution, texture detail, and periodicity, they still perform poorly in terms of symmetry in lace images. Summary of the Invention
[0003] In view of the defects and shortcomings of existing technologies, this invention provides a method for generating symmetrical lace images based on generative adversarial networks.
[0004] The specific technical solution adopted by this invention to solve its technical problem is as follows:
[0005] A method for generating symmetrical lace images based on generative adversarial networks includes the following steps:
[0006] Step S1: Create a dataset: Select symmetrical patterns from lace images, offset by half the period of the lace image, and perform preprocessing;
[0007] Step S2: Construct a lace image generation model: Use a generative adversarial network model with dual discriminators, including a generator, an image discriminator, and a symmetry discriminator;
[0008] Step S3: Train the model constructed in step S2 with the lace image dataset. After multiple rounds of training, enhance the model's ability to generate lace.
[0009] Step S4: After training is complete, use the model to specify the number of seeds to generate symmetrical lace images.
[0010] Furthermore, the process of building the dataset in step S1 includes the following steps:
[0011] Step S11: Collect lace images that are symmetrically offset to the left and right with a length equal to half the period of the lace image;
[0012] Step S12: Image filtering: Remove images with poor quality, those that do not meet the symmetry requirements, and those with too few similar image periods;
[0013] Step S13: Perform data augmentation on the image, with three augmentation types: horizontal flip, vertical flip, and 180-degree rotation;
[0014] Step S14: Convert the image to the specified size and format.
[0015] Furthermore, in step S2, the generative adversarial network model employs a progressive generation structure for both the generator and discriminator networks. The model's input is a 512×1 random vector, which is decoupled through eight fully connected layers to obtain a vector space W. The vectors in W serve as one of the inputs during the synthesis network's operation. The other two inputs are a 4×512 constant and noise, respectively. The image discriminator and the symmetric discriminator have the same architecture. The generator generates an image, which is then fed into the two discriminators. The discriminators distinguish between real and fake images and optimize the parameters of the generator and the discriminator.
[0016] Furthermore, the loss function of the generator in the generative adversarial network model includes a mean squared error (MSE) loss term to enhance the generator's ability to generate symmetrical images.
[0017] Furthermore, the noise input to the generative adversarial network model has a symmetric structure.
[0018] Furthermore, the loss function of the generative adversarial network model is as follows:
[0019]
[0020] Softplus(x) = log(1 + e) x (2)
[0021] Avg(L left +L right )=[D s (Left)+D s (Right)] / 2] (3)
[0022] Where Softplus(·) is the activation function, Avg(·) represents the average loss of the left and right parts of the image as determined by the symmetric discriminator; G represents the generator, D... s and D i These represent a symmetric discriminator and an image discriminator, respectively.
[0023] Furthermore, the parameter settings in step S3, the lace image training process, are as follows: gamma = 5.5, cfg = paper256, kimg = 3000.
[0024] Compared to existing technologies, this invention and its preferred embodiment propose an improved model based on StyleGAN2, SStyleGAN (Symmetry StyleGAN), for generating cross-symmetrical lace images. Regarding the discriminator, to enhance the model's focus on image symmetry, this method adds a symmetry discriminator; that is, SStyleGAN employs a dual discriminator structure. Regarding the generator, to improve the similarity of the feature maps on the left and right sides of the lace image, this method adds a mean squared error loss term based on the StyleGAN2 loss function. Regarding noise input, to control the symmetry of the lace image in details such as lace edges, the noise sampling function of the StyleGAN2 model is modified to a symmetrical structure, making the noise input itself symmetrical. Attached Figure Description
[0025] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0026] Figure 1 This is a schematic diagram of the SStyleGAN model in an embodiment of the present invention. Detailed Implementation
[0027] To make the features and advantages of this patent more apparent and understandable, specific embodiments are provided below for detailed explanation:
[0028] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0029] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0030] This invention provides a method for generating symmetrical lace images based on generative adversarial networks, comprising the following steps:
[0031] Step S1: Create a dataset: Select a symmetrical arrangement from the lace images, offsetting the left and right edges by half the period of the lace image. Next, perform image preprocessing. Resize the images to 256×256 pixels.
[0032] Step S2: Construct a lace image generation model. This model includes a generator, an image discriminator, and a symmetry discriminator.
[0033] Step S3: Train the model constructed in step S2 with the lace image dataset. After multiple rounds of training, enhance the model's ability to generate lace.
[0034] Step S4: After training is complete, use the model to specify the number of seeds to generate symmetrical lace images.
[0035] As a preferred embodiment, the process of establishing the dataset in step S1 specifically includes the following steps:
[0036] Step S11: Collect lace images that are symmetrically offset to the left and right, with a length equal to half the period of the lace image.
[0037] Step S12: Image filtering. Remove images with poor quality, those that do not meet the symmetry requirements, or those with too few similar image periods.
[0038] Step S13: Perform data augmentation on the image. The augmentation types are horizontal flip, vertical flip, and 180-degree rotation.
[0039] Step S14: Convert the image to a 256×256 pixel size, ".png" format image.
[0040] As a preferred embodiment, the generative adversarial network model of the dual discriminator in step S2 has the following characteristics:
[0041] (1) The architecture of the traditional generative adversarial network model was adjusted: a symmetry discriminator was added to the traditional model, and a mean squared loss term and noise symmetry were added to the loss function. After the adjustment, the model pays more attention to the symmetry of lace and can generate symmetrical lace images. The loss function of the model is as follows: where Softplus(·) is the activation function, and Avg(·) represents the average loss of the left and right parts of the image judged by the symmetry discriminator. G represents the generator, D s and D i These represent a symmetric discriminator and an image discriminator, respectively.
[0042]
[0043] Softjplus(x) = log(1 + e) x (2)
[0044] Avg(L left +L right )=[D s (Left)+D s (Right)] / 2] (3)
[0045] (2) The structure of the model is as follows Figure 1As shown, both the generator and discriminator networks of the model employ a progressive generation structure. The model's input is a 512×1 random vector, which is decoupled through eight fully connected layers to obtain a vector space W. The vectors in W serve as one of the inputs to the synthesis network. The other two inputs are a 4×512 constant and noise. The two discriminators have identical architectures: the generator generates an image, which is then fed into the two discriminators. The discriminators distinguish between real and fake images and optimize the parameters of both the generator and the discriminators.
[0046] (3) Add a mean squared error (MSE) loss term to the generator's loss function to enhance the generator's ability to generate symmetrical images:
[0047]
[0048] (4) The noise input of the model is changed to a symmetrical structure. The noise of the symmetrical structure will have a subtle effect on the texture, color and other features of the lace image.
[0049] The lace image training strategy in step S3 has the following characteristics:
[0050] (1) The training parameters of SStyleGAN were set as follows based on practical experience: gamma = 5.5, cfg = paper256, kimg = 3000. This setting resulted in better generation of lace images.
[0051] The model prediction process in step S4 includes the following steps:
[0052] (1) Load the model parameters trained in step S3 respectively.
[0053] (2) Input the number of seeds. Obtain the generated symmetrical lace image.
[0054] In addition to the commonly used FID (Fréchet Inception Distance) metric for evaluating the experimental results in this embodiment of the invention, we also used the SSIM (Structural Similarity) metric to detect the cross-symmetry of the generated images. Experimental results show that, compared to the lace images generated by the StyleGAN2 model, the lace images generated by the model proposed in this method not only inherit the advantages of the former but also possess symmetry characteristics.
[0055] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0056] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0057] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0058] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0059] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
[0060] This patent is not limited to the above-described preferred embodiment. Anyone can derive other methods for generating symmetrical lace images based on generative adversarial networks under the guidance of this patent. All equivalent changes and modifications made within the scope of this patent application shall fall within the scope of this patent.
Claims
1. A method for generating symmetrical lace images based on generative adversarial networks, characterized by the following steps: Step S1: Create a dataset: Select symmetrical patterns from lace images, offset by half the period of the lace image, and perform preprocessing; Step S2: Construct a lace image generation model: Use a generative adversarial network model with dual discriminators, including a generator, an image discriminator, and a symmetry discriminator; Step S3: Train the model constructed in step S2 with the lace image dataset. After multiple rounds of training, enhance the model's ability to generate lace. Step S4: After training is complete, use the model to specify the number of seeds to generate symmetrical lace images; The loss function of the generator in the generative adversarial network model includes a mean squared error (MSE) loss term, which is used to enhance the generator's ability to generate symmetrical images. The noise input to the generative adversarial network model has a symmetric structure; The loss function of the generative adversarial network model is as follows: (1) (2) (3) Among them, Softplus ( ) activation function, Avg( ) represents the average loss of the left and right parts of the image as determined by the symmetric discriminator; G represents the generator. and These represent a symmetric discriminator and an image discriminator, respectively.
2. The method for generating symmetrical lace images based on generative adversarial networks according to claim 1, characterized in that: The process of creating the dataset in step S1 includes the following steps: Step S11: Collect lace images that are symmetrically offset to the left and right with a length equal to half the period of the lace image; Step S12: Image filtering: Remove images with poor quality, those that do not meet the symmetry requirements, and those with too few similar image periods; Step S13: Perform data augmentation on the image, with three augmentation types: horizontal flip, vertical flip, and 180-degree rotation; Step S14: Convert the image to the specified size and format.
3. The method for generating symmetrical lace images based on generative adversarial networks according to claim 1, characterized in that: In step S2, the generative adversarial network model used employs a progressive generation structure for both the generator and discriminator networks. The model's input is a 512×1 random vector, which is decoupled through 8 fully connected layers to obtain a vector space W. The vectors in W serve as one of the inputs during the synthesis network's operation. The other two inputs are a 4×512 constant and noise, respectively. The image discriminator and the symmetric discriminator have the same architecture. The generator generates an image, which is then fed into the two discriminators. The discriminators distinguish between real and fake images and optimize the parameters of the generator and discriminators.
4. The method for generating symmetrical lace images based on generative adversarial networks according to claim 1, characterized in that: The parameters for training the lace image in step S3 are set as follows: gamma=5.5, cfg=paper256, kimg=3000.
