A paper-cutting generation system and method based on generative adversarial neural network
The paper-cut generation system based on generative adversarial neural network solves the time-consuming and labor-intensive problem of computer-generated paper-cut design drawings in the existing technology, achieves fast, efficient, and personalized paper-cut design drawing generation, and improves work efficiency.
Patent Information
- Application Number
- CN202111506694.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-12-10
AI Technical Summary
The existing technology is time-consuming and laborious when generating paper-cut design drawings through computers, and cannot be generated in batches, which is not conducive to the promotion of personalized paper-cutting.
A paper-cut generation system based on generative adversarial neural networks is adopted. By collecting and preprocessing image samples, the generative adversarial neural network architecture is designed, and a deep learning server is used to train the model to generate high-quality paper-cut design drawings, reducing or eliminating manual processing steps.
It realizes the rapid and batch generation of high-quality and high-resolution paper-cut design drawings, improves work efficiency and meets personalized needs.
Smart Images

Figure CN114170340B
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of art design and artificial intelligence, and in particular to a paper-cutting generation system and method based on a generative adversarial neural network. Background Art
[0002] Paper cutting is an art that uses paper as the processing object and scissors (or carving knives) as the tool for creation. It is one of the first batch of national intangible cultural heritage. In a survey of school students, it was shown that students have a strong sense of recognition of the status of paper cutting, but for those who have no manual foundation, it is very difficult to design paper cutting. In recent years, with the development of artificial intelligence technology, it has become possible to use computers to generate paper cutting design drawings.
[0003] At present, in the process of generating paper-cutting design drawings through computers, most of them are processed by design software such as Photoshop. This method is time-consuming and labor-intensive, and cannot be generated in batches, which is not conducive to the promotion of personalized paper-cutting. Therefore, it is urgent to study a method that can generate corresponding paper-cutting design drawings after directly inputting the image to be processed without or reducing manual processing.
[0004] Goodfellow et al. proposed a generative adversarial network (GAN) framework, which has powerful adversarial learning performance. The network is mainly divided into two parts: the generator and the discriminator. The two become more powerful through adversarial learning, and finally an optimized generator can be obtained, which can synthesize very realistic images. This network framework provides a good idea for the automatic generation of paper-cut portraits.
[0005] Therefore, based on the powerful learning performance of the conditional adversarial generative network, the present invention proposes a paper-cutting generation system and method based on a generative adversarial neural network. Summary of the invention
[0006] The purpose of the present invention is to solve the defects in the prior art and to propose a paper-cutting generation system and method based on a generative adversarial neural network.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] According to one aspect of the present invention, a paper-cutting generation method based on a generative adversarial neural network is provided.
[0009] A paper-cut generation method based on a generative adversarial neural network comprises the following steps:
[0010] S1. Collect sample images;
[0011] S2, preprocessing the collected images and saving them as original image sample set A;
[0012] S3, performing paper-cut processing on the collected images and saving them as paper-cut image sample set B;
[0013] S4. Design the architecture of generative adversarial neural network;
[0014] S5, sending the original image sample set A and the paper-cut image sample set B frame by frame to the deep learning server to train the generative adversarial neural network model;
[0015] S6, re-collecting unprocessed color photos and importing them into the trained generative adversarial neural network model to obtain the model output image to detect the effectiveness of the algorithm;
[0016] S7. If the output image does not meet the requirements, increase the number of training times and continue to train the network model; if the output image meets the requirements, save the training model for the next step of packaging;
[0017] S8. Encapsulate the model and generate personalized portable applications.
[0018] Further, in step S2, preprocessing the image includes the following steps:
[0019] S21, calling remove.bg API to remove the image background, and obtaining a vector map of only the image to be processed;
[0020] S22, synthesize the vector image of the image to be processed with the white background as an input color image.
[0021] Furthermore, in step S3, the paper-cutting processing of the image includes the following steps:
[0022] S31, open the color image obtained in step S22 in Photoshop;
[0023] S32, set the foreground to red and the background to white;
[0024] S33. Click Filter - Filter Library - Photocopy in order. The default settings are Detail 20 and Darkness 30. You can adjust them according to the situation.
[0025] S34. Use the brush tool to connect the disconnected parts;
[0026] S35. Use the pen tool to circle the excess area and fill it with white;
[0027] S36: Generate label paper-cut.
[0028] According to another aspect of the present invention, a paper-cutting generation system based on a generative adversarial neural network is provided.
[0029] A paper-cut generation system based on a generative adversarial neural network includes a generator network unit and a discriminator network unit.
[0030] Furthermore, the generator network unit adopts a U-Nets architecture of 8 convolutional layers plus 8 deconvolutional layers, and its specific network structure is as follows:
[0031] The 8 convolutional layers are constructed using a structure of convolution-batch normalization-LReLU activation; the first 7 deconvolutional layers are constructed using a structure of deconvolution-batch normalization-ReLU activation, and the last layer of deconvolution does not perform batch normalization but directly uses Tanh activation;
[0032] The convolution kernel sizes of the convolution layer and the deconvolution layer are both set to 3×3, and the sliding step sizes are both set to 2.
[0033] Furthermore, the discriminator network unit is composed of 5 convolutional layers, and the specific structure is as follows:
[0034] For the first convolutional layer, the convolution-LReLU activation structure is used; the middle three convolutional layers use the convolution-batch normalization-LReLU activation structure. Adding batch normalization can effectively prevent the gradient from disappearing and speed up the network convergence; the last layer uses Sigmoid activation after the convolution operation;
[0035] In order to reduce the computational complexity and speed up the operation, the last convolutional layer of the discriminator is configured to output a 32×32 grid, thereby dividing the original input image into 32×32 blocks for discrimination;
[0036] The convolution kernel size of each layer of the discriminator network unit is 3×3, the sliding step size of the first 4 layers is 2, and the sliding step size of the last layer is set to 1.
[0037] Further, in step S5, the training of the generative adversarial neural network model is specifically as follows:
[0038] Before training begins, a color true image and a corresponding paper-cut image are obtained through steps S2 and S3;
[0039] In order to increase the diversity of training samples and avoid overfitting in training, the images obtained in steps S2 and S3 are synchronously randomly offset and rotated;
[0040] In order to speed up the training and real-time generation of paper-cut images, the images are cropped to reduce the training samples to a set size;
[0041] Furthermore, during training, the hyperparameters and training conditions for the constructed generative adversarial neural network are set as follows:
[0042] Set the initial learning rate to 0.0002 and the batch size to one pair;
[0043] Set the weight λ of L1 loss to 100;
[0044] The optimization method used for training is the gradient descent method. The AdamOptimizer optimizer in the TensorFlow library is used to optimize the network model parameters and save the optimized generator network unit model.
[0045] Compared with the prior art, the present invention has the following beneficial effects:
[0046] The user can use the method of the present invention to obtain a paper-cut model of any real image, and after one training, the user can utilize the scalability of the neural network model to generate any paper-cut design drawing of an image similar to the training set.
[0047] By utilizing the high efficiency of the neural network model, users can realize batch generation of paper-cutting design drawings, which can improve work efficiency.
[0048] The invention can generate high-quality and high-resolution paper-cut design drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.
[0050] Figure 1 It is a logic diagram of the paper-cutting generation system based on generative adversarial neural network of the present invention. DETAILED DESCRIPTION
[0051] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0052] According to an embodiment of the present invention, a paper-cutting generation method based on a generative adversarial neural network is provided.
[0053] Reference Figure 1 , a paper-cut generation method based on generative adversarial neural network, comprising the following steps:
[0054] S1. Collect sample images;
[0055] S2, preprocessing the collected images and saving them as original image sample set A;
[0056] S3, performing paper-cut processing on the collected images and saving them as paper-cut image sample set B;
[0057] S4. Design the architecture of generative adversarial neural network;
[0058] S5, sending the original image sample set A and the paper-cut image sample set B frame by frame to the deep learning server to train the generative adversarial neural network model;
[0059] S6, re-collecting unprocessed color photos and importing them into the trained generative adversarial neural network model to obtain the model output image to detect the effectiveness of the algorithm;
[0060] S7. If the output image does not meet the requirements, increase the number of training times and continue to train the network model; if the output image meets the requirements, save the training model for the next step of packaging;
[0061] S8, encapsulate the model and generate personalized portable applications;
[0062] In a specific embodiment of the present application, in step S2, preprocessing the image includes the following steps:
[0063] S21, calling remove.bg API to remove the image background, and obtaining a vector map of only the image to be processed;
[0064] S22, synthesize the vector image of the image to be processed with the white background as an input color image.
[0065] In a specific embodiment of the present application, in step S3, the paper-cutting processing of the image includes the following steps:
[0066] S31, open the color image obtained in step S22 in Photoshop;
[0067] S32, set the foreground to red and the background to white;
[0068] S33. Click Filter - Filter Library - Photocopy in order. The default settings are Detail 20 and Darkness 30. You can adjust them according to the situation.
[0069] S34. Use the brush tool to connect the disconnected parts;
[0070] S35. Use the pen tool to circle the excess area and fill it with white;
[0071] S36: Generate label paper-cut.
[0072] According to an embodiment of the present invention, a paper-cutting generation system based on a generative adversarial neural network is also provided.
[0073] Reference Figure 1, a paper-cut generation system based on a generative adversarial neural network, suitable for the paper-cut generation method based on a generative adversarial neural network, including a generator network unit and a discriminator network unit.
[0074] It should be noted that the purpose of the generator network unit is to obtain the mapping relationship between the input paper-cut image and the corresponding real color image, so as to generate the paper-cut image corresponding to the real color image;
[0075] The input of the discriminator network unit is the paper-cut image obtained by processing in step S1 or the paper-cut image generated by the generator, which is used to discriminate whether the image comes from training data or synthetic data;
[0076] The generator network unit and the discriminator network unit form an adversarial relationship, so that the generator network unit's ability to translate the input real color image into paper-cut is getting stronger and stronger;
[0077] in:
[0078] Furthermore, the generator network unit adopts a U-Nets architecture of 8 convolutional layers plus 8 deconvolutional layers; its specific network structure is as follows:
[0079] The 8 convolutional layers are constructed using a structure of convolution-batch normalization-LReLU activation; the first 7 deconvolutional layers are constructed using a structure of deconvolution-batch normalization-ReLU activation, and the last layer of deconvolution does not perform batch normalization but directly uses Tanh activation;
[0080] The convolution kernel sizes of the convolution layer and the deconvolution layer are both set to 3×3, and the sliding step sizes are both set to 2;
[0081] Furthermore, the discriminator network unit is composed of 5 convolutional layers, and the specific structure is as follows:
[0082] For the first convolutional layer, the convolution-LReLU activation structure is used; the middle three convolutional layers use the convolution-batch normalization-LReLU activation structure. Adding batch normalization can effectively prevent the gradient from disappearing and speed up the network convergence; the last layer uses Sigmoid activation after the convolution operation;
[0083] In order to reduce the computational complexity and speed up the operation, the last convolutional layer of the discriminator is configured to output a 32×32 grid, thereby dividing the original input image into 32×32 blocks for discrimination;
[0084] The convolution kernel size of each layer of the discriminator network unit is 3×3, the sliding step size of the first 4 layers is 2, and the sliding step size of the last layer is set to 1.
[0085] Specifically, based on the generator generation results and the real results, the loss is calculated and the loss of the adversarial network is defined as follows:
[0086]
[0087] in: represents the paper-cut image obtained by processing in step S1, represents the input control condition, i.e., the original color real image, A mapping representing a generator, represents the generated paper-cut image, represents the mapping of the discriminator, represents the discrimination result of the discriminator on the paper-cut image pair obtained by step S1, represents the discriminant result of the generated paper-cut image pair. Both discriminant results are the authenticity probabilities of the image pairs. and Then they represent the means of the two discrimination results respectively;
[0088] In order to make the paper-cut images generated by the generator more realistic in details, an additional L1 loss is defined in the network as follows:
[0089]
[0090] in express norm;
[0091] The total loss function of the entire network is obtained as:
[0092]
[0093] in Represents the weight of L1 loss;
[0094] The final optimization goal of the network is expressed as:
[0095]
[0096] in Indicates After optimizing the network parameters, That is the optimized generator network unit model obtained after network training.
[0097] In a specific embodiment of the present application, in step S5, the training of the generative adversarial neural network model is as follows:
[0098] Before training begins, a color true image and a corresponding paper-cut image are obtained through steps S2 and S3;
[0099] In order to increase the diversity of training samples and avoid overfitting in training, the images obtained in steps S2 and S3 are synchronously randomly offset and rotated;
[0100] In order to speed up the training and real-time generation of paper-cut images, the images are cropped so that the training samples are reduced to a set size.
[0101] Specifically, during training, the hyperparameters and training conditions for the constructed generative adversarial neural network are set as follows:
[0102] Set the initial learning rate to 0.0002 and the batch size to one pair;
[0103] Set the weight λ of L1 loss to 100;
[0104] The optimization method used for training is the gradient descent method. The AdamOptimizer optimizer in the TensorFlow library is used to optimize the network model parameters and save the optimized generator network unit model.
[0105] The above description is only a preferred specific implementation of the present invention, but the protection scope of the present invention is not limited thereto.
Claims
1. A paper-cutting generation method based on generative adversarial neural network, characterized in that: The following steps are included: S1. Collect sample images; S2, preprocessing the collected images and saving them as original image sample set A; In step S2, preprocessing the image includes the following steps: S21, call remove.bgAPI to remove the image background and obtain a vector map containing only the image to be processed; S22, synthesizing the vector image of the image to be processed with the white background as an input color image; S3, performing paper-cut processing on the collected images and saving them as paper-cut image sample set B; In step S3, the paper-cutting process of the image includes the following steps: S31, open the color image obtained in step S22 in Photoshop; S32, set the foreground to red and the background to white; S33. Click Filter - Filter Library - Photocopy in order. The default settings are Detail 20 and Darkness 30. You can adjust them according to the situation. S34. Use the brush tool to connect the disconnected parts; S35. Use the pen tool to circle the excess area and fill it with white; S36, generating label paper-cut; S4. Design the architecture of generative adversarial neural network; S5, sending the original image sample set A and the paper-cut image sample set B frame by frame to the deep learning server to train the generative adversarial neural network model; In step S5, the training of the generative adversarial neural network model is as follows: Before training begins, a color true image and a corresponding paper-cut image are obtained through steps S2 and S3; In order to increase the diversity of training samples and avoid overfitting in training, the images obtained in steps S2 and S3 are synchronously randomly offset and rotated; In order to speed up the training and real-time generation of paper-cut images, the images are cropped to reduce the training samples to a set size; S6, re-collecting unprocessed color photos and importing them into the trained generative adversarial neural network model to obtain the model output image to detect the effectiveness of the algorithm; S7. If the output image does not meet the requirements, increase the number of training times and continue to train the network model; if the output image meets the requirements, save the training model for the next step of packaging; S8. Encapsulate the model and generate personalized portable applications.
2. The paper-cutting generation method based on generative adversarial neural network according to claim 1 is characterized in that: During training, the hyperparameters and training conditions for the constructed generative adversarial neural network are set as follows: Set the initial learning rate to 0.0002 and the batch size to one pair; Set the weight λ of L1 loss to 100; The optimization method used for training is the gradient descent method. The AdamOptimizer optimizer in the TensorFlow library is used to optimize the network model parameters and save the optimized generator network unit model.
3. A paper-cut generation system based on a generative adversarial neural network, used in the paper-cut generation method based on a generative adversarial neural network according to claim 1 or 2, characterized in that: It includes generator network units and discriminator network units.
4. The paper-cutting generation system based on generative adversarial neural network according to claim 3 is characterized in that: The generator network unit adopts a U-Nets architecture with 8 convolutional layers and 8 deconvolutional layers. Its specific network structure is as follows: The 8 convolutional layers are constructed using a structure of convolution-batch normalization-LReLU activation; the first 7 deconvolutional layers are constructed using a structure of deconvolution-batch normalization-ReLU activation, and the last layer of deconvolution does not perform batch normalization but directly uses Tanh activation; The convolution kernel sizes of the convolution layer and the deconvolution layer are both set to 3×3, and the sliding step sizes are both set to 2.
5. The paper-cutting generation system based on generative adversarial neural network according to claim 4 is characterized in that: The discriminator network unit consists of 5 convolutional layers, and the specific structure is as follows: For the first convolutional layer, the convolution-LReLU activation structure is used; the middle three convolutional layers use the convolution-batch normalization-LReLU activation structure. Adding batch normalization can effectively prevent the gradient from disappearing and speed up the network convergence; the last layer uses Sigmoid activation after the convolution operation; In order to reduce the computational complexity and speed up the operation, the last convolutional layer of the discriminator is configured to output a 32×32 grid, thereby dividing the original input image into 32×32 blocks for discrimination; The convolution kernel size of each layer of the discriminator network unit is 3×3, the sliding step size of the first 4 layers is 2, and the sliding step size of the last layer is set to 1.
Citation Information
Patent Citations
Generative adversarial neural network based on intensive network and distorted image restoration method
CN112330572A
Image processing method, apparatus, and storage medium
US20210027517A1
