Virtual fitting method and system based on clothing block guidance and spatial adaptive network
Through the method based on clothing block guidance and spatial adaptive network, the data matching and optimization problems in the training and testing phases of the existing virtual try-on technology are solved, the effective exchange of different categories of clothes and the preservation of texture details are achieved, and the virtual try-on technology is improved. The flexibility and authenticity of fitting.
Patent Information
- Application Number
- CN202111258602.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN114119350B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtual reality technology, and more specifically, to a virtual fitting method and system based on clothing block guidance and space adaptive network. Background Art
[0002] With the rapid development and popularization of the Internet and urban logistics systems, e-commerce has brought great convenience to consumers' lives. Among them, online clothing sales can not only provide consumers with a variety of purchasing options, but also reduce the time cost of shopping. However, online clothing sales also have shortcomings, that is, they cannot provide consumers with an actual try-on experience. Virtual try-on technology uses computers and other devices to collect information about the human body and clothes, and then virtually integrates the human body and clothes, and finally outputs the fusion result, which provides users with a virtual try-on experience and greatly improves consumers' online shopping experience. Therefore, both in academia and industry, virtual try-on has always been a hot research direction.
[0003] Early virtual try-on technology mainly relied on computer graphics. This type of method requires separate modeling of 3D human models and 3D clothing models, and then rendering 3D clothing onto 3D human bodies. Since computer graphics can accurately model the geometry of 3D models, this type of method can usually render relatively reasonable try-on results in various scenarios (different human body shapes, postures, and different clothing categories). However, this type of method also has obvious shortcomings. First, the modeling of 3D human models generally requires the use of some expensive equipment to collect and reconstruct human body information. Secondly, for 3D clothing models, it generally requires careful design by art designers, and consumers can only try on those 3D clothes that have been designed in advance. Therefore, the virtual try-on method based on computer graphics not only needs to rely on expensive hardware equipment, but also cannot be generalized to different clothes, and it is difficult to promote and use in real life.
[0004] In recent years, thanks to the rapid development of generative models, especially data-driven generative adversarial networks, more and more researchers have begun to study virtual try-on technology based on computer vision. Such methods usually operate on human bodies and clothes at the two-dimensional image level. Specifically, given a target human image and a clothing image, such methods first deform the clothes into a shape that can adapt to the human posture and body shape, and then fuse the deformed clothes and the human body to obtain a virtual try-on result. After the accumulation of technology in recent years, the image virtual try-on technology based on computer vision can generate realistic try-on results in most scenarios, but there are still certain limitations. At present, the implementation effect of most methods is to try on a flat clothing image on a given human image. There are two main shortcomings of such methods. First, during the training process of the model of such methods, paired images need to be used as training data, that is, flat clothing images-human images, where the clothes of the person in the human image are the same as those in the flat clothing image. However, the collection of such paired data is relatively difficult, and it is necessary to shoot flat clothing images with a unified standard and shoot images of models wearing corresponding clothes at the same time. Secondly, in the actual application process, this type of method also has relatively stringent requirements for the input data, that is, it is necessary to provide the model with a standard flat clothing image and a human image at the same time, and it is impossible to directly realize the exchange of human clothes based on two human images. Although there are some works that have proposed corresponding solutions for the task of human clothing exchange, these solutions will also have factors that affect large-scale expansion. For example, one type of method uses paired human image pairs (the same person wearing the same clothes, shown in different postures) when training the human clothing exchange model. Similarly, the use of such paired data will also face the problem of difficult collection. There is also a type of method that uses unpaired human image data during training, but in the test phase of the model, it is necessary to optimize the model parameters online for a certain test sample to ensure that the generated fitting results have clear texture details, which will also affect the efficiency of the method in actual use. Summary of the invention
[0005] The present invention provides a virtual try-on method based on clothing block guidance and spatial adaptive network, which realizes a virtual try-on method that does not require matching data in the training phase and does not require online optimization in the testing phase, and realizes the interchange of different categories of clothing on the basis of retaining details such as clothing texture.
[0006] Another object of the present invention is to provide a system for applying the virtual try-on method based on clothing block guidance and spatial adaptive network.
[0007] In order to achieve the above technical effects, the technical solution of the present invention is as follows:
[0008] A virtual fitting method based on clothing block guidance and spatial adaptive network comprises the following steps:
[0009] S1: For an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n ;
[0010] S2: The standardized clothing block P obtained in step S1 n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ;
[0011] S3: The standardized clothing block P obtained in step S1 is n The hidden vector of the conditional StyleGAN2 generation network is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ;
[0012] S4: The deformed clothes G obtained in step S2 are t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I′ t .
[0013] Furthermore, the specific process of step S1 is:
[0014] S11: Use the human pose estimator to obtain the original human image I s The 18 2D pose key points J s ;
[0015] S12: Use the human semantic segmentation parser to obtain the original human image I s The human body semantic segmentation map, the different regions on the segmentation map correspond to different parts of the human body, and according to the original human body image I sAnd its semantic segmentation map, get the clothing image G s ;
[0016] S13: The original human 2D posture key point J obtained in step S11 s The clothing image G obtained in step S12 s Divided into 8 clothing blocks P associated with the human body area s ,The associated human body regions are as follows: left lower arm, left upper arm, right lower arm, right upper arm, upper torso, neck, left hip, right hip;
[0017] S14: All the clothing pieces P of different sizes and directions obtained in step S13 are s , through perspective transformation, they are standardized into standardized clothing blocks P with the same size and orientation n .
[0018] Furthermore, the specific process of step S2 is:
[0019] S21: Use the human pose estimator to obtain the target human image I t The 18 2D pose key points J t ;
[0020] S22: Target 2D posture key point J obtained according to step S21 t , through perspective transformation, all the standardized clothing blocks P obtained in step S14 are transformed n , transformed into the clothing block P under the target shape t ;
[0021] S23: All the deformed clothing blocks P obtained in step S22 are t The deformable clothes G that can adapt to the target human body posture and body shape are spliced together. t .
[0022] Furthermore, the specific process of step S3 is:
[0023] S31: The standardized clothing block P obtained in step S14 is n The channels are spliced and passed through a style encoder network and a feature mapping network in turn to obtain a feature vector that encodes the color and shape information of the clothes. This feature vector serves as the hidden vector of the conditional StyleGAN2 generation network.
[0024] S32: Use the human body semantic segmentation parser to obtain the target human body image I t The human body semantic segmentation map, different areas on the segmentation map correspond to different parts of the human body, and according to the target human image I tIts semantic segmentation map, the target person's head RGB image H t ;
[0025] S33: The target 2D posture key point J obtained in step S21 is t Converted into RGB human skeleton form and compared with the head RGB image H of the target person obtained in step S32 t The channels are spliced and input into an identity encoder to obtain the feature map f that encodes the target human body posture and identity information. id ;
[0026] S34: The feature map f obtained in step S33 is id As the input of the conditional StyleGAN2 generation network, the latent vector obtained in step S31 is used Modify the convolution kernel parameters of each sub-generation module of conditional StyleGAN2;
[0027] S35: After the sub-generation module with a resolution of 128*128 in the conditional StyleGAN2 generation network, the style generation branch is used to generate rough virtual try-on results respectively And predict the target clothing mask M g .
[0028] Furthermore, the specific process of step S4 is:
[0029] S41: Remove deformed clothes G t The outer non-aligned area of the deformed clothes is extracted by converting the target clothes mask M obtained in step S35 into g and the deformed clothing G obtained in step S23 t Multiply pixel by pixel and remove G t Medium target clothing mask M g The area outside the area, and the deformed clothes are input into a clothes encoder to obtain the clothes deformation clothes feature map f′ g ;
[0030] S42: Deformed clothing G obtained in step S23 t , and obtain its corresponding binary mask M t , M t The target clothing mask M obtained in step S35 g Perform AND operation to obtain the mask M of the alignment area align , and then according to M g and M align , get the misaligned area mask M misalign ;
[0031] S43: Deformed clothing feature f′ obtained in step S41g In the internal non-aligned area, a feature filling operation is performed. Specifically, the alignment area mask obtained in step S42 is used to extract f′ g The features of the aligned regions are averaged and then the average features are used to fill f′ g The misaligned area;
[0032] S44: After the sub-generation module with a resolution of 128*128 in the conditional StyleGAN2 generation network, a spatial adaptive residual module is introduced to transform the deformed clothing feature f obtained in step S402 g , after different convolutional layers, the scaling factor γ and the translation factor β in the denormalization layer in the spatial residual module are calculated respectively;
[0033] S45: After the spatial adaptive residual module of the texture generation branch of the conditional StyleGAN2 generation network, a sub-generation module with a resolution of 256*256 is added to generate an accurate virtual try-on result I′ t .
[0034] Furthermore, the step S41 is formally expressed as the following mathematical formula:
[0035] f ′ g =ε g (G t ⊙M g ),
[0036] Among them, ε g represents the clothing encoder;
[0037] The step S42 is formally expressed as the following mathematical formula:
[0038] M align =M g ∩M t ,
[0039] M misalign =M g -M align .
[0040] The step S43 is formally expressed as the following mathematical formula:
[0041]
[0042] in, Indicates calculating the average value of features in spatial dimensions.
[0043] Furthermore, the specific operation of the spatial adaptive residual module introduced in step S44 can be formally expressed as the following mathematical formula:
[0044]
[0045] Among them, γ z,y,x (·) and β z,y,x (·) represent the convolution operations for calculating the scaling factor γ and the translation factor β, respectively. z,y,x Represents the value of a certain position in the feature map input to the residual module, z represents a certain position in the channel dimension of the feature map, y represents a certain position in the height dimension of the feature map, x represents a certain position in the width dimension of the feature map, and μ z Represents the average value of the feature on a channel of the feature map, σ z Represents the variance of the feature on a certain channel in the feature map.
[0046] Furthermore, in the training phase, the generated fitting results (rough virtual fitting results) are calculated. and accurate virtual fitting results I′ t ) and the real image I s The reconstruction loss and perceived loss To constrain the learning of the system model, the specific formula is:
[0047]
[0048] Furthermore, in the training phase, the target clothing mask M is predicted. g and the real target clothing mask M gt of Loss is used to constrain the learning of the system model. The specific formula is:
[0049]
[0050] In the training phase, for the generated fitting results (rough virtual fitting results and accurate virtual fitting results I′ t ), and also use adversarial loss To constrain the learning of the system model, the total loss function in the training phase is formalized as the following mathematical formula:
[0051]
[0052] Among them, λ rec , perc , The values are 40, 40, and 100 respectively.
[0053] A system for applying a virtual fitting method based on clothing block guidance and spatial adaptive network, comprising the following modules:
[0054] Original clothing decomposition and standardization module: used for an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n ;
[0055] Clothes deformation module: used to transform the standardized clothes block P obtained in step S1 n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ;
[0056] Rough fitting result generation module: used to convert the standardized clothing block P obtained in step S1 into n The hidden vector of conditional StyleGAN2 is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ;
[0057] Fine fitting result generation module: used to transform the deformed clothing G obtained in step S2 t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I′ t .
[0058] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0059] Based on the original human body posture, the present invention divides and standardizes the clothes to obtain clothes blocks under standardized representation, and then obtains deformed clothes according to the target human body posture. The target clothes mask is predicted by the style generation branch of the conditional StyleGAN2 generation network, and the rough deformed clothes are corrected by the mask. Finally, accurate virtual try-on results are generated by the texture generation branch of the conditional StyleGAN2 generation network, thereby realizing a virtual try-on method that does not require matching data in the training phase and does not require online optimization in the testing phase, and that realizes the interchange of different categories of clothes on the basis of retaining details such as clothes texture. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flowchart of the steps of a virtual try-on method based on clothing block guidance and spatial adaptive network of the present invention;
[0061] Figure 2 This is a system architecture diagram of a virtual fitting system based on clothing block guidance and space adaptive network of the present invention;
[0062] Figure 3 It is a structural schematic diagram of a virtual try-on system according to a specific embodiment of the present invention;
[0063] Figure 4 An example diagram of the data set collected by the present invention and its data distribution diagram;
[0064] Figure 5 The following are examples of virtual try-on effects in different scenarios on the collected data sets of the present invention;
[0065] Figure 6 A comparison chart of the fitting effects of the present invention and other comparison methods on the UPT dataset;
[0066] Figure 7 A comparison chart of the fitting effects of the present invention and other comparison methods on the DeepFashion dataset;
[0067] Figure 8 A comparison chart of the fitting effects of the present invention and other comparison methods on the MPV dataset;
[0068] Fig. 9 This is a comparison diagram of the effects in the ablation experiment of the present invention;
[0069] Fig.10 A comparison chart of quantitative indicators of the present invention and other methods on the UPT dataset and the DeepFashion dataset;
[0070] Fig.11 A comparison chart of quantitative indicators of the present invention and other methods on the MPV data set;
[0071] Fig.12 This is a comparison of quantitative indicators in the ablation experiment of the present invention. DETAILED DESCRIPTION
[0072] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0073] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0074] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0075] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0076] like Figure 1 As shown, a virtual fitting method based on clothing block guidance and spatial adaptive network includes the following steps:
[0077] Step S1: for an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n .
[0078] Specifically, step S1 further includes:
[0079] Step S100, using a human body posture estimator to obtain an original human body image I s The 18 2D pose key points J s .
[0080] Step S101, using a human body semantic segmentation parser to obtain an original human body image I s The human body semantic segmentation map, the different regions on the segmentation map correspond to different parts of the human body, and according to the original human body image I s And its semantic segmentation map, get the clothing image G s .
[0081] Specifically, step S101 further includes:
[0082] Step S101a, given an original human image I s , using the human body semantic segmentation parser, we obtain a human body semantic segmentation map with 20 categories. Different labels on the segmentation map correspond to different parts of the human body.
[0083] Step S101b, setting the value of the area belonging to the top in the original human body semantic segmentation image to 1, and setting the value of the rest of the area to 0, to obtain a clothing mask.
[0084] Step S101c, combining the original human body image I s and clothing mask to obtain clothing image G s .
[0085] Step S102, based on the original human 2D posture key points J obtained in step S100 s The clothing image G obtained in step S101s Divided into 8 clothing blocks P associated with the human body area s ,The associated human body regions are as follows: left lower arm, left upper arm, right lower arm, right upper arm, upper torso, neck, left hip, and right hip.
[0086] Step S103: all the clothing pieces P of different sizes and directions obtained in step S102 are s , through perspective transformation, they are standardized into standardized clothing blocks P with the same size and orientation n .
[0087] Specifically, step S103 further includes:
[0088] Step S103a, define a standard clothing block template with a resolution of 64*64 For each piece of clothing obtained in step S102 according to The vertices of the quadrilateral and The vertices of the quadrilateral are calculated using OpenCV's native API. Transformed to The desired perspective transformation matrix.
[0089] Step S103b, using the perspective transformation matrix obtained in step S103a, Transform to standard clothing block
[0090] Step S2: The standardized clothing block P obtained in step S1 is n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ;
[0091] Specifically, step S2 further includes:
[0092] Step S200, using a human body posture estimator to obtain a target human body image I t The 18 2D pose key points J t ;
[0093] Step S201, based on the target 2D posture key point J obtained in step S200 t , through perspective transformation, all the standardized clothing blocks P obtained in step S103 are transformed n , transformed into the clothing block P under the target shape t ;
[0094] Specifically, step S201 further includes:
[0095] Step S201a, based on the target 2D posture key point J t , get each target clothing piece P t i The specific location in the target image.
[0096] Step S201b, based on the standard clothing block The quadrilateral vertices and target clothing block The quadrilateral vertex of Transformed to The desired perspective transformation matrix.
[0097] Step S201c, using the perspective transformation matrix obtained in step S201b, Transform to standard clothing block
[0098] Step S202: All the deformed clothing blocks P obtained in step S201 are t The deformable clothes G that can adapt to the target human body posture and body shape are spliced together. t .
[0099] In a specific embodiment of the present invention, in step S1 and step S2, the human pose estimator uses the method proposed in the article "Realtime multiperson 2d pose estimation using part affinity fields", and the human semantic segmentation parser can use the method proposed in the article "Graphonomy: Universal Human Parsing via Graph Transfer Learning". The OpenCV APIs used are cv2.getPerspectiveTransform() and cv2.warpPerspective(), which are not described here.
[0100] Step S3: The standardized clothing block P obtained in step S1 is n The hidden vector of the conditional StyleGAN2 generation network is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ;
[0101] Specifically, step S3 further includes:
[0102] Step S300: The standardized clothing block P obtained in step S103 is n The channels are spliced and passed through a style encoder network and a feature mapping network in turn to obtain a feature vector that encodes the color and shape information of the clothes. This feature vector serves as the hidden vector of the conditional StyleGAN2 generation network.
[0103] In a specific embodiment of the present invention, the clothing encoder includes 1 convolution layer, 6 encoding layers, 1 global average pooling layer and 1 fully connected layer. Among them, the convolution layer is composed of a convolution function with a convolution kernel size of 1*1 and 64 convolution kernels and a linear activation function. The first three encoding layers are composed of a convolution linear layer and a convolution function with a convolution kernel size of 3*3 and a step size of 2 and a linear activation function, wherein the number of convolution kernels is 128, 256, and 512 respectively, and the specific operation of the convolution linear layer is to use a fully connected function to perform linear operations on the features of the feature map in the channel dimension. The structure of the last three encoding layers is similar to that of the first three encoding layers, except that the step size of each convolution function is 1 and the number of convolution kernels is 512.
[0104] In a specific embodiment of the present invention, the feature mapping network consists of two fully connected layers, and the output dimensions are both 512.
[0105] Step S301, using a human body semantic segmentation parser to obtain a target human body image I t The human body semantic segmentation map, different areas on the segmentation map correspond to different parts of the human body, and according to the target human image I t Its semantic segmentation map, the target person's head RGB image H t .
[0106] Specifically, step S301 includes:
[0107] Step S301a, given a target human image I t , using the human body semantic segmentation parser, we obtain a human body semantic segmentation map with 20 categories. Different labels on the segmentation map correspond to different parts of the human body.
[0108] Step S301b, setting the values of the areas belonging to the hair and face in the target human semantic segmentation image to 1, and setting the values of the remaining areas to 0, to obtain a target person's head mask.
[0109] Step S301c, combining the target human image I t and clothing mask, RGB image H of the target person’s headt .
[0110] Step S302: The target 2D posture key point J obtained in step S200 is t Converted into RGB human skeleton RGB image, and compared with the head RGB image H obtained in step S301 t The channels are spliced and input into an identity encoder to obtain the feature map f that encodes the target human body posture and identity information. id ;
[0111] In a specific embodiment of the present invention, the identity encoder is composed of 6 convolutional layers. Each convolutional layer is composed of a convolution function with a convolution kernel size of 3*3 and a step size of 2 and a linear activation function. The number of convolution kernels of different convolutional layers is 64, 128, 256, 256, 256, and 512, respectively.
[0112] Step S303: The feature map f obtained in step S302 is id As the input of the conditional StyleGAN2 generation network, the latent vector obtained in step S300 is used Modify the convolution kernel parameters of each sub-generation module of conditional StyleGAN2.
[0113] Step S304, after the conditional StyleGAN2 generates the sub-generation module with a resolution of 128*128 in the network, the style generation branch is used to generate rough virtual try-on results respectively And predict the target clothing mask M g .
[0114] In a specific embodiment of the present invention, the network structure of the conditional StyleGAN2 generation network and how to use the hidden vector The convolution kernel parameters of each sub-generation module of the modified condition StyleGAN2 use the structure and method mentioned in the article "Training GenerativeAdversarial Networks with Limited Data", which will not be repeated here.
[0115] Step S4: transform the deformed clothing G obtained in step S2 t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I′ t .
[0116] Specifically, step S4 further includes:
[0117] Step S400, removing the deformed clothing Gt The outer non-aligned area of the deformed clothes is extracted by converting the target clothes mask M obtained in step S304 into g and the deformed clothing G obtained in step S202 t Multiply pixel by pixel and remove G t Medium target clothing mask M g The area outside the area, and the deformed clothes are input into a clothes encoder to obtain the clothes deformation clothes feature map f′ g .
[0118] Specifically, step S400 can be formally expressed as the following mathematical formula:
[0119] f′ g =ε g (G t ⊙M g ),
[0120] Among them, ε g Represents a clothing encoder.
[0121] In a specific embodiment of the present invention, the clothing encoder ε g It consists of 1 convolution layer and 2 residual layers. The convolution layer consists of 1 convolution function with a kernel size of 7*7 and 64 convolution kernels and a ReLU activation function. The first residual layer consists of 1 residual block and a ReLU activation function. In the residual block, the convolution kernel size of the convolution function is 4*4, the step size is 1, and the number of convolution kernels is 64. The second residual layer consists of 1 residual block and a ReLU activation function. In the residual block, the convolution kernel size of the convolution function is 4*4, the step size is 2, and the number of convolution kernels is 128.
[0122] Step S401, according to the deformed clothing G obtained in step S202 t , and obtain its corresponding binary mask M t , M t The target clothing mask M obtained in step S304 g Perform AND operation to obtain the mask M of the alignment area align , and then according to M g and M align , get the misaligned area mask M misalign ,
[0123] Specifically, step S401 can be formally expressed as the following mathematical formula:
[0124] M align =M g ∩M t ,
[0125] M misalign=M g -M align ;
[0126] Step S402: Deformed clothing feature f′ obtained in step S400 g In the internal non-aligned area, a feature filling operation is performed. Specifically, the alignment area mask obtained in step S401 is used to extract f′ g The features of the aligned regions are averaged and then the average features are used to fill f g μ misaligned area.
[0127] Specifically, step S402 can be formally expressed as the following mathematical formula:
[0128]
[0129] in, Indicates the average value of the calculated feature in the spatial dimension;
[0130] Step S403, after the conditional StyleGAN2 generates the sub-generation module with a resolution of 128*128 in the network, a spatial adaptive residual module is introduced to transform the deformed clothing feature f obtained in step S402 g , after different convolutional layers, the scaling factor γ and translation factor β in the denormalization layer in the spatial residual module are calculated respectively.
[0131] Specifically, the specific operation of the spatial adaptive residual module introduced in step S403 can be formally expressed as the following mathematical formula:
[0132]
[0133] Among them, γ z,y,x (·) and β z,y,x (·) represent the convolution operations for calculating the scaling factor γ and the translation factor β, respectively. z,y,x Represents the value of a certain position in the feature map input to the residual module (z represents a certain position in the channel dimension of the feature map, y represents a certain position in the height dimension of the feature map, and x represents a certain position in the width dimension of the feature map), μ z Represents the average value of the feature on a channel of the feature map, σ z Represents the variance of the feature on a certain channel in the feature map.
[0134] In a specific embodiment of the present invention, the spatial adaptive residual module includes three residual submodules. Each residual submodule receives two inputs (the output h of the previous conditional StyleGAN2 generation network submodule or the previous residual submodule, and the deformed clothing feature f g), the structure of the residual submodule uses the structure mentioned in the article "Semantic Image Synthesis with Spatially-Adaptive Normalization", which will not be repeated here.
[0135] Step S404, after the conditional StyleGAN2 generates the spatial adaptive residual module of the network texture generation branch, a sub-generation module with a resolution of 256*256 is added to generate an accurate virtual try-on result I′ t .
[0136] In a specific embodiment of the present invention, the sub-generation module of the network structure of the conditional StyleGAN2 generation network uses the structure proposed in the article "Training Generative Adversarial Networks with Limited Data", which will not be repeated here.
[0137] In the training phase of the system model of the present invention, the fitting results (rough virtual fitting results) generated by calculation are and accurate virtual fitting results I′ t ) and the real image I s The reconstruction loss and perceived loss To constrain the learning of the system model. The specific formula is:
[0138]
[0139]
[0140] where φ k (I) represents the feature map obtained by passing the kth layer of the VGG19 network for image I. Specifically, k represents 'conv1_2', 'conv2_2', 'conv3_2', 'conv4_2', and 'conv5_2' of VGG19.
[0141] In the training stage of the system model of the present invention, the target clothing mask M is introduced to predict g and the real target clothing mask M gt of Loss is used to constrain the learning of the system model. The specific formula is:
[0142]
[0143] In the training phase of the system model of the present invention, the generated fitting results (rough virtual fitting results) are and accurate virtual fitting results I′ t ), and also use adversarial loss To constrain the learning of the system model. The total loss function in the training phase is formalized as the following mathematical formula:
[0144]
[0145] where λ rec , perc , The values are 40, 40, and 100 respectively.
[0146] In a specific embodiment of the present invention, The adversarial loss function mentioned in the article "Training Generative Adversarial Networks with Limited Data" is used, which will not be described in detail here.
[0147] like Figure 2-3 As shown, the present invention also provides a virtual fitting method based on clothing block guidance and space adaptive network, including the following different modules:
[0148] Original clothing decomposition and standardization module, for an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n ;
[0149] The clothing deformation module transforms the standardized clothing block P obtained in step S1 n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ;
[0150] The rough fitting result generation module converts the standardized clothing block P obtained in step S1 into n The hidden vector of conditional StyleGAN2 is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ;
[0151] The detailed fitting result generation module generates the deformed clothing G obtained in step S2. t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I′ t .
[0152] Specific experimental process:
[0153] In an embodiment of the present invention, we collected a batch of model images for virtual try-on tasks under unpaired data from the Internet, named UPT dataset. The UPT dataset contains 33,254 half-body front / full-body front model images, in which the models' clothing covers a variety of categories, including long / short T-shirts, shirts, vests, trousers, shorts, skirts, etc. The UPT dataset is further divided into a training set and a test set, containing 27,139 and 6,615 model images, respectively. In the training stage of the method of the present invention, since there is no paired data available, the original human image and the target human image are the same image; in the testing stage, in order to achieve the purpose of changing clothes, the original human image and the target human image are different images. In addition, we selected frontal model images from the existing virtual try-on datasets, namely the DeepFashion dataset and the MPV dataset, as the complement of the UPT dataset to illustrate the performance of the method proposed in the present invention on different datasets. Figure 4 Some samples of the UPT dataset are shown. It can be observed that the model images in the UPT dataset cover different model genders, model postures, and clothing categories. Figure 4 The distribution differences between half-body and full-body data of the UPT dataset, DeepFashion dataset, and MPV dataset are also shown. Figure 5 The test results of the proposed method on the UPT dataset are shown in the figure. The first row shows the effect of upper body virtual try-on, the second row shows the effect of lower body virtual try-on, and the third row shows the effect of full body virtual try-on. Figure 5 It can be seen that the method of the present invention can achieve very realistic trying-on effects in different scenes (upper body, lower body, full body) and different types of clothes.
[0154] In order to illustrate the effectiveness of the present invention, we selected three existing virtual try-on methods for changing clothes with flat images (changing flat clothes on specific people), namely CP-VTON, ACGPN, and PFAFN, and two virtual try-on methods for clothes swapping (achieving clothes swapping between two people), namely ADGAN and Liquid Warping GAN, as comparison methods. Among them, for the three virtual try-on methods for changing clothes with flat images, on the UPT dataset and DeepFashion dataset, since these two datasets do not have corresponding flat clothes images, in the test phase, the clothes are directly obtained from the target human body image based on the semantic segmentation map; on the MPV dataset, since this dataset has flat clothes-model pairing data, in the test phase, the clothes images are directly provided by the flat clothes. In the following chart, we refer to the method proposed in the present invention as PASTA-GAN.
[0155] The virtual try-on effect of the present invention will be described below with reference to the accompanying drawings:
[0156] The following will quantitatively and qualitatively analyze the virtual try-on effect of the present invention. For quantitative indicators, the present invention uses Fr′echet Inception Distance (FID) to measure the similarity between the distribution of generated images and real images. The lower the FID score, the closer the distribution of the generated image is to the distribution of the real image. In addition, we also use a questionnaire survey to allow participating volunteers to fairly evaluate the virtual try-on effects of different methods. The specific implementation method of the questionnaire is that for each test set of each data set (UPT, Deepfahion, MPV), we randomly select 40 test samples, and then use different methods to test these 40 random test samples, and then invite 30 volunteers to participate in the questionnaire survey, allowing volunteers to select more realistic and lifelike try-on results that retain more details from the generated results.
[0157] Fig.10 The quantitative comparison results of different methods on the UPT dataset and the DeepFashion dataset are shown. On these two datasets, compared with three virtual try-on methods for tiled clothing (CP-VTON, ACGPN, PFAFN) and two virtual try-on methods for clothing swapping (ADGAN, Liquid Warping GAN), the proposed method PASTA-GAN can obtain the lowest FID score. At the same time, according to the statistical results of the questionnaire survey, we can find that most volunteers think that the virtual try-on results generated by the proposed method are more realistic.
[0158] Fig.11The quantitative comparison results of different methods on the MPV dataset are shown. It is worth noting that in the test results on this dataset, the compared tiled clothes virtual try-on methods (CP-VTON, ACGPN, PFAFN) are tested with their original settings, that is, changing the tiled clothes to a specified person, while the setting of the proposed method PASTA-GAN is to achieve the exchange of clothes between two people. Fig.11 The data shows that under this setting, which is fairer to the virtual try-on method for tiled image changing, the proposed method PASTA-GAN can obtain the lowest FID score and the best questionnaire score.
[0159] Figure 6 , Figure 7 and Figure 8 The virtual try-on effect comparison of different methods on UPT dataset, DeepFashion dataset and MPV dataset is shown respectively. By observing the comparison chart, it can be found that under different test settings, the method proposed in the present invention has better effects in ensuring the integrity of the try-on results, ensuring the correctness of the clothing layout and retaining the clothing texture.
[0160] In order to verify the effectiveness of the fitting module designed by the present invention, the present invention designed four groups of ablation experiments. Among them, PASTA-GAN★ and PASTA-GAN* do not use the texture generation branch of the conditional StyleGAN2 generation network. PASTA-GAN★ directly uses the complete clothes as the input of the style encoder, while PASTA-GAN* uses the standardized clothes blocks as the input of the style encoder. Both use the texture generation branch of the conditional StyleGAN2 generative network, where The style generation branch of the network is generated using conditional StyleGAN2, that is, the predicted clothing mask is not used to correct the deformed clothing. The spatial adaptive residual module is replaced by a normal residual module.
[0161] Fig.12 The comparison of FID scores between the proposed method and different ablation methods is shown. Fig.12 It can be found that compared with the ablation method, the FID score of the fitting result generated by the method of the present invention is the lowest. This shows that the clothing segmentation and standardization, the correction of deformed clothing using the predicted clothing mask, and the introduction of the spatial adaptive residual module are all helpful to the authenticity of the final virtual fitting effect.
[0162] Fig. 9The comparison of the virtual try-on effects between the proposed method and different ablation methods is shown. By observing the comparison chart, it can be found that without using the texture generation branch of the conditional StyleGAN2 generative network, the PASTA-GAN★ method that does not divide the clothes into blocks cannot guarantee the accuracy of the try-on results generated by the method; while the PASTA-GAN* method that divides the clothes into blocks can guarantee the accuracy of the clothes, but because it does not use the texture generation branch, the texture of the clothes generated by the try-on results cannot be retained. Under the condition of using the texture generation branch of the conditional StyleGAN2 generative network, Since the style generation branch is not used, the misaligned areas outside the deformed clothes cannot be corrected. Therefore, the fitting results will have defects around the clothes outline. Since the spatially adaptive residual module is not used, the generation of misaligned areas inside the deformed clothes is imperfect.
[0163] In summary, the present invention realizes a virtual try-on method in which a method model training does not rely on paired data, can complete the exchange of clothes between any two and retain important information such as the appearance and texture of the clothes.
[0164] 1) In traditional image-based virtual try-on methods (CP-VTON, ACGPN, PFAFN), the training of the method model requires the use of paired data (flat clothing image-model image), which increases the difficulty of data collection and makes it impossible for the method to efficiently use the massive data on the Internet as training data. At the same time, in the testing phase, it is impossible to interchange clothes between any two models, which also limits the use scenarios of the method. The method proposed in the present invention does not need to use paired data in the training phase, so any model image on the Internet can be used as model training data for the method of the present invention. At the same time, in the testing phase, the present invention can also interchange clothes between any two models, which is more flexible.
[0165] 2) In the existing virtual try-on methods for realizing clothing exchange (O-VITON, VOGUE), although the method model training does not require the use of paired data, online optimization is often required in the testing phase to ensure the authenticity of the texture of the virtual try-on results. The method proposed in the present invention can ensure the authenticity of the texture of the results without additional optimization in the testing phase.
[0166] 3) This method can realize the exchange of clothes between any two people, and can also adapt to different categories of clothing. Its try-on can retain the details of the clothes such as shape, color, texture, etc. as much as possible, and the effect is more realistic.
[0167] The same or similar reference numerals correspond to the same or similar components;
[0168] The description of the positional relationship in the accompanying drawings is only for illustrative purposes and should not be construed as a limitation on this patent; obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not limitations on the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made on the basis of the above description. It is not necessary and impossible to list all the implementation methods here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A virtual fitting method based on clothing block guidance and spatial adaptive network, It is characterized in that The following steps are involved: S1: For an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n ; S2: The standardized clothing block P obtained in step S1 n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ; S3: The standardized clothing block P obtained in step S1 is n The hidden vector of the conditional StyleGAN2 generation network is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ; S4: The deformed clothes G obtained in step S2 are t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I t ′ .
2. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 1, It is characterized in that The specific process of step S1 is: S11: Use the human pose estimator to obtain the original human image I s The 18 2D pose key points J s ; S12: Use the human semantic segmentation parser to obtain the original human image I s The human body semantic segmentation map, the different regions on the segmentation map correspond to different parts of the human body, and according to the original human body image I s And its semantic segmentation map, get the clothing image G s ; S13: The original human 2D posture key point J obtained in step S11 s The clothing image G obtained in step S12 s Divided into 8 clothing blocks P associated with the human body area s ,The associated human body regions are as follows: left lower arm, left upper arm, right lower arm, right upper arm, upper torso, neck, left hip, right hip; S14: All the clothing pieces P of different sizes and directions obtained in step S13 are s , through perspective transformation, they are standardized into standardized clothing blocks P with the same size and orientation n .
3. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 2, It is characterized in that The specific process of step S2 is: S21: Use the human pose estimator to obtain the target human image I t The 18 2D pose key points J t ; S22: Target 2D posture key point J obtained according to step S21 t , through perspective transformation, all the standardized clothing blocks P obtained in step S14 are transformed n , transformed into the clothing block P under the target shape t ; S23: All the deformed clothing blocks P obtained in step S22 are t Spliced together to obtain a deformable garment G that can adapt to the target human body posture and body shape t .
4. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 3, It is characterized in that The specific process of step S3 is: S31: The standardized clothing block P obtained in step S14 is n The channels are spliced and passed through a style encoder network and a feature mapping network in turn to obtain a feature vector that encodes the color and shape information of the clothes. This feature vector serves as the hidden vector of the conditional StyleGAN2 generation network. S32: Use the human body semantic segmentation parser to obtain the target human body image I t The human body semantic segmentation map, different areas on the segmentation map correspond to different parts of the human body, and according to the target human image I t And its semantic segmentation map, get the target person's head RGB image H t ; S33: The target 2D posture key point J obtained in step S21 is t Converted into RGB human skeleton form and compared with the head RGB image H of the target person obtained in step S32 t The channels are spliced and input into an identity encoder to obtain the feature map f that encodes the target human body posture and identity information. id ; S34: The feature map f obtained in step S33 is id As the input of the conditional StyleGAN2 generation network, the latent vector obtained in step S31 is used Modify the convolution kernel parameters of each sub-generation module of conditional StyleGAN2; S35: After the sub-generation module with a resolution of 128*128 in the conditional StyleGAN2 generation network, the style generation branch is used to generate rough virtual try-on results respectively And predict the target clothing mask M g .
5. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 4, It is characterized in that The specific process of step S4 is: S41: Remove deformed clothes G t The outer non-aligned area of the deformed clothes is extracted by converting the target clothes mask M obtained in step S35 into g and the deformed clothing G obtained in step S23 t Multiply pixel by pixel and remove G t Medium target clothing mask M g The area outside the area is input into a clothing encoder to obtain the clothing deformation clothing feature map f g ′ ; S42: Deformed clothing G obtained in step S23 t , and obtain its corresponding binary mask M t , M t The target clothing mask M obtained in step S35 g Perform AND operation to obtain the mask M of the alignment area align , and then according to M g and M align , get the misaligned area mask M misalign ; S43: Deformed clothing feature f′ obtained in step S41 g In the internal non-aligned area, a feature filling operation is performed. Specifically, the alignment area mask obtained in step S42 is used to extract f′ g The features of the aligned regions are averaged and then the average features are used to fill f′ g The misaligned area; S44: After the sub-generation module with a resolution of 128*128 in the conditional StyleGAN2 generation network, a spatial adaptive residual module is introduced to transform the deformed clothing feature f obtained in step S402 g , after different convolutional layers, the scaling factor γ and the translation factor β in the denormalization layer in the spatial residual module are calculated respectively; S45: After the spatial adaptive residual module of the texture generation branch of the conditional StyleGAN2 generation network, a sub-generation module with a resolution of 256*256 is added to generate an accurate virtual try-on result I′ t .
6. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 5, It is characterized in that The step S41 is formally expressed as the following mathematical formula: f′ g =e g (G t ⊙M g ), Among them, ε g Represents clothing encoder; The step S42 is formally expressed as the following mathematical formula: M align =M g ∩M t , M misalign =M g -M align; The step S43 is formally expressed as the following mathematical formula: in, Indicates calculating the average value of features in spatial dimensions.
7. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 6, It is characterized in that The specific operation of the spatial adaptive residual module introduced in step S44 can be formally expressed as the following mathematical formula: Among them, γ z,y,x (·) and β z,y,x (·) represent the convolution operations for calculating the scaling factor γ and the translation factor β, respectively. z,y,x Represents the value of a certain position in the feature map input to the residual module, z represents a certain position in the channel dimension of the feature map, y represents a certain position in the height dimension of the feature map, x represents a certain position in the width dimension of the feature map, and μ z Represents the average value of the feature on a channel of the feature map, σ z Represents the variance of the feature on a certain channel in the feature map.
8. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 7, It is characterized in that In the training phase, the generated fitting results are compared with the real image I s The reconstruction loss and perceived loss To constrain the learning of the system model, the fitting results include: rough virtual fitting results and accurate virtual fitting results I′ t , the specific formula is:
9. The virtual fitting method based on clothing block guidance and spatial adaptive network according to claim 8, It is characterized in that In the training phase, the target clothing mask M is predicted. g and the real target clothing mask M gt of Loss is used to constrain the learning of the system model. The specific formula is: In the training phase, the generated fitting results include: rough virtual fitting results and accurate virtual fitting results I′ t , and also use adversarial loss To constrain the learning of the system model, the total loss function in the training phase is formalized as the following mathematical formula: Among them, λ rec , perc , The values are 40, 40, and 100 respectively.
10. A system using the virtual fitting method based on clothing block guidance and spatial adaptive network as claimed in claim 9, It is characterized in that include: Original clothing decomposition and standardization module: used for an original human image I s , based on its 2D pose key point J s , the clothes G in the human body image s Divided into different clothing blocks P s , and standardize all clothing blocks to obtain standardized clothing blocks P n ; Clothes deformation module: used to transform the standardized clothes block P obtained in step S1 n , according to the 2D posture key points J of the target human image t Transform, and then transform all the transformed clothing blocks P t Spliced together, we get a deformable garment G that can adapt to the target human body posture and body shape. t ; Rough fitting result generation module: used to convert the standardized clothing block P obtained in step S1 into n The hidden vector of conditional StyleGAN2 is obtained through the feature extraction network The target person's head RGB image H t and the 2D posture key points J of the target human image t As input to the conditional StyleGAN2 generative network, its style generation branch is then used to generate rough virtual try-on results. And predict the target clothing mask M g ; Fine fitting result generation module: used to transform the deformed clothing G obtained in step S2 t And the target clothing mask M obtained in step S3 g As the input of the spatial adaptive residual module, the texture generation branch of the conditional StyleGAN2 generative network is used to generate accurate virtual try-on results I′ t .
Citation Information
Patent Citations
Virtual try-on method and system capable of reserving details of example clothes
CN111062777A
Video virtual try-on method and device based on mixed optical flow
CN111275518A
Semantic-based multi-posture virtual fitting method
CN113361560A
Virtual trial-fitting system, virtual trial-fitting program, virtual trial-fitting method, and storage medium in which virtual fitting program is stored
US20160300393A1
Accurately generating virtual try-on images utilizing a unified neural network framework
US20210142539A1
