Fabric pattern color migration method based on fashion color
Through the fabric pattern color migration model based on CycleGAN, combined with K-means clustering and improved loss function, the problems of poor color migration effect and insufficient detail retention in the textile and clothing industry are solved, and efficient and accurate color migration is achieved, suitable for textiles and clothing industry. The clothing industry responds to demand quickly.
Patent Information
- Application Number
- CN202411604140.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When processing complex pattern patterns, the existing fully automatic color migration technology has poor color migration effect, insufficient details, high calculation costs, and difficult to flexibly adapt to small-scale or rapidly changing data environments, which limits its in-textile and garment industry. application.
Using a fabric pattern color migration model based on CycleGAN architecture, combining the K-means clustering algorithm and improved loss function, including adversarial loss, cyclic consistency loss, identity maintenance loss, border loss and color perception loss, through asymmetric training strategy and Salt and pepper noise enhances the robustness of the model and automatically generates pattern patterns that closely match the trends.
It significantly improves the accuracy and detail retention of color migration, reduces design time and resource waste, and provides an efficient and intelligent color migration solution that can quickly respond to changes in market color trends.
Smart Images

Figure CN119130784A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer vision and image processing, and in particular relates to a color migration method for a fabric pattern based on popular colors. Background Art
[0002] With the rapid development of the textile and apparel industry, color, as a core element in design, is becoming more and more important; consumers' increasing demand for fashion and personalization has prompted designers to respond quickly to market changes and provide design solutions that meet fashion trends. The traditional textile and apparel design process is highly dependent on the designer's personal experience and color theory, which increases the complexity of the design and limits the space for design innovation. In this context, research on how to incorporate popular color trends into existing designs through automated methods has become a hot topic in the industry; color migration technology provides an effective way to solve this problem.
[0003] The core of color transfer technology is to transfer the color features of one image to another image, so as to update the color style while maintaining the original design structure. Through this technology, textile and clothing patterns can be quickly updated to cater to market trends and reduce design time and cost. At present, color transfer technology has been gradually applied to many fields, such as clothing design, home decoration, etc., and its application prospects are broad. However, traditional color transfer methods rely on a large amount of user input and specific target images, which makes the operation complicated, and the color transfer effect is limited by the user's color knowledge and the quality of input prompts.
[0004] With the rapid development of deep learning technology, fully automatic color migration technology has gradually emerged and attracted widespread attention. Using deep neural networks, researchers have successfully achieved automatic color migration without user intervention, greatly improving processing efficiency while reducing dependence on user experience. Compared with user-guided color migration methods, fully automatic color migration can perform color conversion more efficiently and flexibly by deeply learning the color distribution characteristics in large-scale data sets, which is particularly suitable for large-scale application scenarios. However, existing fully automatic color migration methods still face challenges such as poor color migration effects and insufficient detail retention when processing complex patterns.
[0005] In recent years, color transfer technology based on deep learning has made significant progress and has become a research hotspot in this field. However, these technologies still have some limitations and are difficult to fully meet the diverse needs of color transfer in practical applications. For example, although CAMS (Color-Aware Multi-Style Transfer) can retain more color information in multi-style transfer, the generated image stylization effect is more natural and reduces color distortion, its computational cost is high, especially when processing high-resolution images, the training and inference time is long. In addition, CAMS relies on a large amount of pre-training data, which makes it difficult for the model to flexibly adapt to small-scale or rapidly changing data environments and is not suitable for real-time application scenarios; although it has advantages in flexibility and robustness of style transfer, for tasks that require low latency and efficient computing in application scenarios, the high computational complexity of CAMS limits its scope of use.
[0006] On the other hand, AdaIN (Adaptive Instance Normalization) achieves fast style transfer between content images and style images by adaptively adjusting features. It has extremely high computational efficiency and is suitable for real-time style transfer applications. However, when processing images with complex textures and rich details, AdaIN tends to oversimplify style transfer, resulting in loss of image details. At the same time, AdaIN has certain limitations in maintaining the integrity of image structure, especially when the content image has a complex structure, the effect of style transfer may not be ideal. In addition, although AdaIN's style transfer method has wide applicability, its adaptability has certain problems when dealing with scenes that require fine-tuning and retaining specific image features. Therefore, the existing technology still has room for improvement in color fidelity, detail processing, and computational efficiency.
[0007] To overcome these problems, CycleGAN (Cycle Generative Adversarial Network) is widely used in unsupervised image-to-image conversion tasks. Through its cycle consistency loss, the input and output images can be mapped to each other, solving the limitation of unpaired datasets. However, the traditional CycleGAN still has room for improvement in color fidelity and detail processing; therefore, in view of the unique needs of the textile and apparel industry, a color migration method that can better adapt to popular color trends and finely preserve design details is urgently needed. Summary of the invention
[0008] In view of the above, the present invention provides a fabric pattern color migration method based on popular colors. The method deeply integrates popular color trends and color theories, can automatically generate a color palette, and cleverly apply it to the design of textile and clothing patterns, aiming to improve design efficiency and the excellent effect of color migration.
[0009] A method for color migration of a fabric pattern based on popular colors comprises the following steps: (1) Obtain a popular color dataset and a non-popular color fabric pattern dataset, construct a color palette based on the popular color dataset, and use the color palette to adjust the color of the non-popular color fabric pattern dataset to obtain a popular color fabric pattern dataset; (2) Construct a fabric pattern color migration model based on the CycleGAN architecture, which includes two discriminators D1~D2 and two generators G1~G2, and is divided into two branches: The first branch consists of G1~G2 and D1. In this branch, G1 is used to convert the input non-fashionable color fabric pattern real_A into a popular color fabric pattern fake_B, G2 is used to restore the popular color fabric pattern fake_B to the non-fashionable color fabric pattern idt_A, and D1 is used to distinguish the authenticity of real_A and fake_B. The second branch consists of G1~G2 and D2. In this branch, G2 is used to convert the input popular color fabric pattern real_B to generate the non-popular color fabric pattern fake_A, G1 is used to restore the non-popular color fabric pattern fake_A to the popular color fabric pattern idt_B, and D2 is used to distinguish the authenticity of real_B and fake_A. (3) The first branch of the model is trained using a dataset of non-fashionable color fabric patterns, and the second branch of the model is trained using a dataset of popular color fabric patterns; (4) After the model training is completed, the non-fashionable color fabric pattern that needs to be color migrated is input into the model generator G1 to generate the corresponding fashion color fabric pattern.
[0010] Furthermore, the popular color data set obtained in the step (1) contains a plurality of popular colors (RGB values). First, three groups of color palettes H1-H3 are constructed according to the popular color data set in combination with color theory. Each color palette contains K popular colors, K is a natural number greater than 1, the K popular colors in the color palette H1 are similar colors to each other, the K popular colors in the color palette H2 are contrasting colors to each other, and the K popular colors in the color palette H3 are complementary colors to each other. Then, the fabric patterns in the non-popular color fabric pattern data set are preprocessed to select some fabric patterns with simple structures. For any selected fabric pattern, the pixels of the fabric pattern are clustered by the K-means clustering algorithm to obtain K clusters. The K popular colors in the color palettes H1-H3 are used as the colors of the K clusters, respectively, to generate three popular color fabric patterns. In this way, the popular color fabric pattern data set is generated by traversal.
[0011] Furthermore, the step (3) adopts an asymmetric training strategy during the model training process to fine-tune the training frequencies of the discriminator and the generator, that is, the generator is trained once in each training cycle, while the discriminator is trained three times. This can promote effective confrontation and adaptation between the two, effectively prevent overfitting, and ensure the stability of model training.
[0012] Furthermore, in step (3), salt and pepper noise is introduced into the non-fashionable color fabric patterns real_A and fake_A and the fashion color fabric patterns real_B and fake_B during the model training process. The salt and pepper noise is added to these fabric patterns before the patterns are passed to the discriminator to simulate the noise conditions that the fabric patterns may encounter during the collection and transmission process, thereby enhancing the robustness of the model and preventing overfitting.
[0013] Furthermore, in step (3), the two branches adopt the following loss function during the training process:
[0014] in: L total is the loss function, L adv is the generator adversarial loss, L cyc is the cycle consistency loss, L id For identity preservation loss, L color is the color perception loss, L border is the border loss, l 1~ l 5 is the weight coefficient.
[0015] Furthermore, the generator adversarial loss L adv The expression is as follows:
[0016] in: E [ ] represents the expected function, x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y Indicates that the fabric pattern generated by G1 or G2 corresponds to fake_B or fake_A. D ( x ) indicates that D1 or D2 is x The judgment result of D ( y ) indicates that D1 or D2 is y The discrimination result of .
[0017] Furthermore, the cycle consistency loss L cyc The expression is as follows:
[0018] in: x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. G ( y )express y The restored fabric pattern input to G2 or G1 corresponds to idt_A or idt_B, where || ||1 represents the L1 norm.
[0019] Furthermore, the identity preservation loss L id The expression is as follows:
[0020] in: y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, G ( y )express y The restored fabric pattern input to G2 or G1 corresponds to idt_A or idt_B, where || ||1 represents the L1 norm.
[0021] Furthermore, the color perception loss L color The expression is as follows: ; ;
[0022] in: L histogram and L MSE are histogram loss and mean square error loss respectively, l H and l M They are L histogram and L MSE The corresponding weight coefficient is,H x and H y They are x and y The brightness channel histogram of x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. I x ( i )and I y ( i ) are respectively x and y The i pixel values, N is the total number of pixels of the fabric pattern, || ||1 represents the L1 norm, and || ||2 represents the L2 norm.
[0023] Furthermore, the border loss L border The expression is as follows:
[0024] in: E x and E y They are x and y The edge strength, x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A, and ||||1 represents the L1 norm.
[0025] In the process of learning the model, the present invention ensures that the generated pattern retains the original structure and achieves accurate color migration through the joint effects of adversarial loss, cycle consistency loss and identity preservation loss. At the same time, the addition of border loss function and color perception loss function ensures the accurate retention of pattern edge details and the consistency and harmony of colors.
[0026] The fabric pattern color migration method based on popular colors in the present invention cleverly combines the K-means clustering algorithm and the improved CycleGAN model, which can automatically generate flower patterns that closely follow popular trends. It not only improves the accuracy of color migration, but also ensures the integrity of pattern details and color consistency through the dual protection of border loss and color perception loss, and the color migration effect is significantly improved.
[0027] The color migration method of the present invention can be quickly applied to textile and clothing pattern design without relying on additional target images, only by providing the current popular color information. This innovation not only simplifies the design process and reduces manual intervention, but also allows designers to devote themselves to creative design. At the same time, comparative experimental results show that the method of the present invention is significantly superior to existing methods in terms of color migration quality, injecting new vitality into the widespread application of color migration technology in the textile and clothing industry.
[0028] Therefore, the present invention has the following beneficial technical effects: 1. The present invention cleverly combines popular color trends with fabric pattern characteristics to generate a color palette that is more in line with market demand, greatly enhancing the diversity and innovation of the design.
[0029] 2. The improved CycleGAN model of the present invention significantly improves the robustness and generation effect of the model by introducing salt and pepper noise and asymmetric training strategy, ensuring that the generated pattern achieves an excellent level in edge detail preservation and color consistency.
[0030] 3. By adding border loss and color perception loss, the model of the present invention can accurately retain the edge texture and color characteristics of the pattern, thereby greatly improving the quality and accuracy of color migration.
[0031] 4. The present invention provides an efficient and intelligent color migration solution for the textile and garment industry, which can quickly respond to changes in market color trends, significantly shorten the design cycle, and effectively reduce the waste of design resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 The figure is a schematic flow chart of the method for color migration of fabric patterns based on popular colors of the present invention.
[0033] Figure 2 It is a structural schematic diagram of the fabric pattern color migration model based on the CycleGAN architecture of the present invention. DETAILED DESCRIPTION
[0034] In order to describe the present invention more specifically, the technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0035] like Figure 1 As shown, the fabric pattern color migration method based on popular colors of the present invention comprises the following steps: (1) Generation of color palette.
[0036] The present invention generates a similar color palette, a contrasting color palette and a complementary color palette according to three key factors: provided popular colors, predefined color theories and characteristics of textile and clothing patterns. The specific steps are as follows: First, the RGB values of the popular colors in the dataset are input into the model, and these colors will serve as the basis for the generation of the color palette. In order to make color adjustments more intuitive and simplify color comparisons, the model will first convert the popular colors from the RGB color space to the HLS color space. This conversion is specifically implemented by converting the red, green, and blue color values in the RGB color space (which range from 0 to 1) to three values in the HLS color space: hue H ,brightness L and Saturation S , the specific calculation formula is as follows:
[0037]
[0038]
[0039] in: R , G , B is the normalized RGB value (i.e. each value is divided by 255), V yes R , G , B The maximum value in m yes R , G , B The minimum value in C It is the difference between the maximum and minimum values.
[0040] After completing the conversion of the color space, the present invention will search in the popular color set whether there are other new popular colors that conform to the color theory with the current popular colors. If such a color exists, it will be added to the color palette; if a color palette containing five colors cannot be obtained after this operation, the present invention will generate the remaining colors according to the color theory and the characteristics of the textile and clothing patterns to supplement the color palette. During the generation process, the present invention will adjust the brightness and saturation according to the requirements of different color palettes to make the color palette more harmonious. Finally, the present invention will calculate the hue difference of the colors in the color palette on the color wheel in pairs to determine whether it conforms to the color theory. The specific calculation formula is as follows:
[0041] Where: h 1, h 2 represents the hue value of color 1 and color 2 in the HLS space. Here, multiplication by 360 is to convert H The value is converted from the interval of 0~1 to the interval of 0~360 degrees, making the angle representation of hue difference more intuitive; hue_diff represents the hue difference between two colors on the color wheel.
[0042] (2) Creation of a popular color pattern dataset.
[0043] The color palette generated in step (1) and the various types of textile and clothing patterns obtained after screening, which have fewer structural details and can better retain color characteristics, are used as preliminary data preparation.
[0044] The present invention performs K-means clustering processing on all pixel values of the original pattern, and calculates the distance between the pixel value and the cluster center by using the Euclidean distance. The specific calculation formula is as follows:
[0045] in: p is a data point, c is the cluster center, n is the dimension of the data point.
[0046] By continuously updating the cluster center, the specific calculation formula is as follows:
[0047] in: C j It is j The points in the clusters, c j It is j The center of a cluster.
[0048] Finally, after sorting the cluster centers by their proportions, they are replaced one by one with the colors of the color palette generated in step (1) to ensure that the popular colors in the popular color palette can occupy a larger proportion in the generated popular color pattern dataset.
[0049] (3) Improve the CycleGAN color transfer algorithm.
[0050] 3.1 Network Architecture CycleGAN is a deep learning model that can achieve image style transfer without paired training samples. Compared with the traditional generative adversarial network (GAN), the innovation of CycleGAN is that it introduces cycle consistency loss, which enables the model to maintain content consistency while transferring image style, and achieve high-quality image conversion even without paired data. Although CycleGAN can complete end-to-end color transfer network training on unpaired datasets, due to the limitations of the original generator network structure, the number of parameters and computational complexity of network training are relatively large, and the effect after color transfer is often unsatisfactory.
[0051] The present invention proposes a new color migration network, whose structure is as follows Figure 2 As shown in Figure 2, this network is similar to CycleGAN and consists of two generator networks G with the same structure. A→B and G B→A And two discriminator networks D A and D B Composition. Among them, G A→B is responsible for learning the mapping from non-fashionable color textile clothing patterns to popular color textile clothing patterns, while G B→A Responsible for learning the mapping from popular color textile clothing patterns to non-fashionable color textile clothing patterns, D A Used to distinguish whether the input pattern is a real non-fashion color pattern or a pattern generated by G B→A The synthesized pattern, while D B Used to distinguish whether the input pattern is a real popular color textile clothing pattern or a G A→B Synthetic pattern.
[0052] Different from CycleGAN, considering that flower patterns have more texture details than other types of patterns, in order to better perform color migration, the present invention injects salt and pepper noise during the training process and adjusts the training frequency of the discriminator and generator; in the design of the loss function, in addition to considering adversarial loss, identity preservation loss, and cycle consistency loss, it also adds border loss and color perception loss. In this way, the network can not only retain the outer border texture information of the input pattern, but also learn the color information of popular colors.
[0053] 3.2 Salt and pepper noise adding method In order to enhance the robustness of the model to noise, the present invention introduces salt and pepper noise to the real pattern and the generated fake pattern before passing them to the discriminator. Salt and pepper noise is a common form of pattern degradation, which consists of randomly distributed dark spots (pepper) and bright spots (salt), and can simulate the noise conditions that may be encountered during pattern acquisition and transmission. The specific calculation formula is as follows:
[0054] In the above formula, 0 and 255 represent the black and white noise values respectively; M salt , M pepper , M original It is generated according to the initial given probability of occurrence of salt and pepper noise and is consistent with the pattern I Matrices of the same size are called salt noise mask, pepper noise mask and original pattern mask respectively, where I represents the original pattern, and I noisy This indicates the generated pattern with noise.
[0055] By adding salt and pepper noise to the original pattern and the pattern generated by the generator, not only the robustness of the model is enhanced, but also the overfitting phenomenon is prevented to a certain extent.
[0056] 3.3 Training frequency adjustment Since the addition of noise will increase the difficulty of training the generator, in order to further improve the quality of generated images, the present invention adjusts the training frequency of the two based on an important viewpoint in GAN training theory, that is, the powerful recognition ability of the discriminator can drive the generator to generate more realistic images.
[0057] The traditional method is to keep the generator and the discriminator trained the same number of times, that is, each is updated once in each epoch. However, this balance strategy is not suitable for training patterns with noise. Therefore, the present invention adopts an asymmetric training strategy, that is, the generator is trained once in one epoch, and the discriminator is trained three times. The specific calculation formula is as follows:
[0058] in: G u Represents the number of updates of the generator, D u represents the number of updates of the discriminator, R Represents the training frequency ratio. By increasing the training frequency of the discriminator, it can learn the ability to distinguish between real and fake images faster. This enhanced recognition ability in turn provides a stronger adversarial signal for the generator, motivating the generator to produce higher quality images.
[0059] In addition, this strategy may also help alleviate the instability problem in GAN training, because more frequent updates of the discriminator can provide a more stable gradient flow to the generator, thus contributing to the stable training of the model.
[0060] 3.4 Loss Function The overall loss of the improved CycleGAN is as follows:
[0061] in: L adv is the generator adversarial loss, which is used to train the generator to generate flower patterns close to the real domain, making it difficult for the discriminator to distinguish between real and fake flower patterns; L cyc is the cycle consistency loss, which ensures that the flower pattern from the source domain to the target domain and then back to the source domain is consistent with the original flower pattern; L id It is the identity preservation loss, which is used to keep some parts of the pattern (such as the background) unchanged during the transformation; L color It is a newly added color perception loss, which is used to enhance the color similarity between the restored flower pattern and the target flower pattern; L border It is the border loss, which is used to preserve the outer border texture information of the input flower pattern; l 1, l 2, l 3. l 4. l 5 is the corresponding weight coefficient.
[0062] With generator G A→B and the discriminator D B For example, the real non-fashionable color pattern x Input to G A→B In, G A→B Will generate a popular color pattern G ( x ). B Will try to distinguish the real pattern as much as possible y and generate patterns G ( x ), the specific calculation formula is as follows:
[0063]
[0064] Where: X Represents the non-popular color pattern domain; Y Represents the domain of popular colors, patterns and patterns; x For X Randomly sampled flower patterns; y From Y A randomly sampled pattern in ; E y~Y [ ]andE x~X [ ] denote operations under mathematical expectation.
[0065] Due to the lack of paired training data sets, using only adversarial loss may result in a mapping space that is too large and it is difficult to obtain the desired conversion effect. Therefore, the present invention introduces a cycle consistency loss to constrain the mapping space. Specifically, the cycle consistency loss is expected to be B→A G A→B The resulting popular color patterns G ( x )Restore to input non-fashion color pattern x , the cycle consistency loss can be expressed as:
[0066]
[0067] Where: x is a pattern in the source domain, y is the pattern in the target domain, and || ||1 represents the L1 norm.
[0068] Since the flower pattern has many texture details in addition to color, it is necessary to ensure that the texture structure characteristics of the pattern are preserved during the color migration process. To this end, the present invention introduces an identity preservation loss to constrain the mapping space. The identity preservation loss can be expressed as:
[0069]
[0070] However, due to the characteristics of flower patterns, the edges also have many texture structural features. But in the architecture of the generator, as upsampling proceeds, the spatial resolution of the feature map gradually increases, while the number of feature channels gradually decreases. This may lead to the loss of detail information, especially in the edge area. A generator that is not suitable for processing pattern edges may cause some edge pixels to be blurred or uneven. Therefore, the present invention adds a border loss to retain the outer border texture information of the input pattern. Specifically, after converting the input pattern into a grayscale pattern, the Sobel operator is used to calculate the grayscale information. x and y The specific calculation formula for the gradient in the direction is as follows:
[0071]
[0072] in: conv 2 d ( ) represents a two-dimensional convolution operation, followed by the calculation of the edge strength, i.e., the magnitude of the gradient. The specific calculation formula is as follows:
[0073] Finally, the L1 norm is used to measure the difference in edge strength between the real pattern and the generated pattern. The specific calculation formula is as follows:
[0074] in: E real and E generated Represent the edge strength of the real pattern and the generated pattern respectively.
[0075] The core element of color migration is color. In the process of generating patterns, more attention should be paid to the change of color. To this end, the present invention introduces a color perception loss function to ensure that the generated popular color pattern is closer to the given popular color dataset. Specifically, the color perception loss function consists of a color histogram loss and a mean square error color loss. A→B Generated popular color pattern G ( x ) is compared with the histogram and mean square error of the popular color dataset, which can make the popular color pattern generated by the model more consistent with the popular color dataset. The color perception loss can be expressed as:
[0076]
[0077]
[0078] in: H real and H generated The real patterns x and the brightness channel histogram of the generated pattern, I real and I generated are the pixel values of the real flower pattern and the generated flower pattern, N is the total number of pixels, l H and l M is the weight coefficient used to balance the two loss terms.
[0079] Through border loss and color perception loss, the present invention can effectively retain the edge information and color information of the original flower pattern.
[0080] In the experiment, we conducted color migration experiments for different types of patterns (such as plaid, stripes, and geometric patterns). The experimental results show that by introducing color perception loss and border loss, the proposed model can effectively maintain the structure of the original pattern while achieving accurate color migration. We strictly monitored the experimental results using indicators such as SSIM and PSNR, and verified the significant effectiveness of the improved CycleGAN model in color migration. The detailed data of the experimental results are shown in Table 1: Table 1
[0081] In the above table, except for the last row which is the fabric pattern color transfer model of the present invention, the other models are all advanced model structures in the current image processing field and color transfer field. The experimental data clearly show that the fabric pattern color transfer model of the present invention has achieved significant improvements in both SSIM and PSNR indicators, and has significant advantages over other models. This comparative experimental result fully proves the effectiveness and advancement of the color transfer method of the present invention.
[0082] The above description of the embodiments is to facilitate the understanding and application of the present invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to the above embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments. Improvements and modifications made by those skilled in the art to the present invention based on the disclosure of the present invention should be within the protection scope of the present invention.
Claims
1. A method for color migration of a fabric pattern based on popular colors, comprising the following steps: (1) Obtain a popular color dataset and a non-popular color fabric pattern dataset, construct a color palette based on the popular color dataset, and use the color palette to adjust the color of the non-popular color fabric pattern dataset to obtain a popular color fabric pattern dataset; (2) Construct a fabric pattern color migration model based on the CycleGAN architecture, which includes two discriminators D1~D2 and two generators G1~G2, and is divided into two branches: The first branch consists of G1~G2 and D1. In this branch, G1 is used to convert the input non-fashionable color fabric pattern real_A into a popular color fabric pattern fake_B, G2 is used to restore the popular color fabric pattern fake_B to the non-fashionable color fabric pattern idt_A, and D1 is used to distinguish the authenticity of real_A and fake_B. The second branch consists of G1~G2 and D2. In this branch, G2 is used to convert the input popular color fabric pattern real_B to generate the non-popular color fabric pattern fake_A, G1 is used to restore the non-popular color fabric pattern fake_A to the popular color fabric pattern idt_B, and D2 is used to distinguish the authenticity of real_B and fake_A. (3) The first branch of the model is trained using a dataset of non-fashionable color fabric patterns, and the second branch of the model is trained using a dataset of popular color fabric patterns; (4) After the model training is completed, the non-fashionable color fabric pattern that needs to be color migrated is input into the model generator G1 to generate the corresponding fashion color fabric pattern.
2. The method for color migration of a fabric pattern according to claim 1, Features: The popular color data set obtained in the step (1) contains a plurality of popular colors. Firstly, three groups of color palettes H1-H3 are constructed according to the popular color data set in combination with color theory. Each color palette contains K popular colors, K is a natural number greater than 1, the K popular colors in the color palette H1 are similar colors to each other, the K popular colors in the color palette H2 are contrasting colors to each other, and the K popular colors in the color palette H3 are complementary colors to each other. Then, the fabric patterns in the non-popular color fabric pattern data set are preprocessed to select some fabric patterns with simple structures. For any selected fabric pattern, the pixels of the fabric pattern are clustered by a K-means clustering algorithm to obtain K clusters. The K popular colors in the color palettes H1-H3 are used as the colors of the K clusters, respectively, so as to generate three popular color fabric patterns. In this way, the popular color fabric pattern data set is generated by traversal.
3. The method for fabric pattern color migration according to claim 1, Features: The step (3) adopts an asymmetric training strategy during the model training process to fine-tune the training frequencies of the discriminator and the generator, that is, the generator is trained once and the discriminator is trained three times in each training cycle.
4. The method for fabric pattern color migration according to claim 1, Features: In the step (3), during the model training process, salt and pepper noise is introduced into the non-fashionable color fabric patterns real_A and fake_A and the popular color fabric patterns real_B and fake_B. The salt and pepper noise is added to these fabric patterns before the patterns are passed to the discriminator to simulate the noise conditions that the fabric patterns may encounter during the collection and transmission process.
5. The method for fabric pattern color migration according to claim 1, Features: In step (3), the two branches use the following loss function during the training process: ; in: L total is the loss function, L adv is the generator adversarial loss, L cyc is the cycle consistency loss, L id For identity preservation loss, L color is the color perception loss, L border is the border loss, λ 1 ~ λ 5 is the weight coefficient.
6. The method for fabric pattern color migration according to claim 5, Features: The generator adversarial loss L adv The expression is as follows: ; in: E [ ] represents the expected function, x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y Indicates that the fabric pattern generated by G1 or G2 corresponds to fake_B or fake_A. D ( x ) indicates that D1 or D2 is x The judgment result of D ( y ) indicates that D1 or D2 is y The discrimination result of .
7. The method for fabric pattern color migration according to claim 5, Features: The cycle consistency loss L cyc The expression is as follows: ; in: x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. G ( y )express y The restored fabric pattern input to G2 or G1 corresponds to idt_A or idt_B, || || 1 represents the L1 norm.
8. The method for fabric pattern color migration according to claim 5, Features: The identity preservation loss L id The expression is as follows: ; in: y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, G ( y )express y The restored fabric pattern input to G2 or G1 corresponds to idt_A or idt_B, || || 1 represents the L1 norm.
9. The method for fabric pattern color migration according to claim 5, Features: The color perception loss L color The expression is as follows: ; ; ; in: L histogram and L MSE are histogram loss and mean square error loss respectively, λ H and λ M They are L histogram and L MSE The corresponding weight coefficient is, H x and H y They are x and y The brightness channel histogram of x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A. I x ( i )and I y ( i ) are respectively x and y The i pixel values, N is the total number of pixels of the fabric pattern, || || 1 represents the L1 norm, || || 2 represents the L2 norm.
10. The method for fabric pattern color migration according to claim 5, Features: The border loss L border The expression is as follows: ; in: E x and E y They are x and y The edge strength, x Indicates that the fabric pattern input into the first branch or the second branch corresponds to real_A or real_B, y express x The fabric pattern generated by inputting into G1 or G2 corresponds to fake_B or fake_A, || || 1 represents the L1 norm.
Citation Information
Patent Citations
Refined embroidery texture migration method based on sample domain
CN110097609A
Real image style migration method based on structural consistency statistical mapping framework
CN115705616A
Infrared image colorization method fusing Res-ASPP-Unet network
CN117576233A
Method and system for generating color variants for fashion apparels
US20230410390A1
Method for augmenting image on the basis of generative adversarial cascaded network
WO2022105308A1
Cited By
Method for generating scarf pattern based on generative adversarial network and stable diffusion model
CN119540229A
