Virtual fitting method and device and readable storage medium

Through twin bi-branch neural networks and image generation models, non-aligned data are used to generate virtual fitting images, which solves the problem of existing virtual fitting methods relying on paired data and improves the applicability and accuracy of virtual fitting technology.

CN118587318APending Publication Date: 2024-09-03CHINA UNITED NETWORK COMM GRP CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410622271.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing virtual fitting methods rely on expensive pairwise data, limiting their application in e-commerce.

Method used

By acquiring clothing and character images, twin bi-branch neural networks are used to detect key points and categories, thin plate splines are applied to distort the images, and virtual fitting images are generated by combining image generation models, and non-aligned data is used to improve model accuracy.

Benefits of technology

It realizes the use of non-aligned data to generate virtual fitting images, making the fitting images closer to the real fitting effect, and solves the problem of paired data limiting the application of virtual fitting technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587318A
    Figure CN118587318A
Patent Text Reader

Abstract

The invention provides a virtual fitting method and apparatus, and a readable storage medium. The method comprises the steps of obtaining a clothing image and a figure image; inputting the costume image and the figure image into a trained feature extractor to detect key points and corresponding categories in the costume image and the figure image; acquiring a corresponding relationship between two groups of key points corresponding to the clothing image and the figure image according to the category corresponding to the detected key point, and obtaining coarse-grained matching image information and converted key point information according to the corresponding relationship; and inputting the coarse-grained matching image information and the converted key point information into an image generation model to obtain a virtual fitting image. According to the method, the device and the readable storage medium, the problem that an existing virtual fitting method needs to be based on existing pairwise data, and application of a virtual fitting technology in electronic commerce is easily limited can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a virtual fitting method, device and readable storage medium. Background Art

[0002] With the rapid development of the Internet, the comprehensive deepening of neural network technology is accelerating, further strengthening the demand for data. Especially in the field of image retrieval and feature recognition, a large number of images covering different outfits of the same person, as well as images of different people wearing the same clothing, are needed. In order to meet this demand, the industry's demand for the widespread application of advanced intelligent fitting technology is also increasing. Traditional virtual fitting technology mainly relies on computer graphics, usually simulating the distortion and deformation process of clothing through physical modeling to present the effect of clothing worn on the human body. Compared with the flat effect of clothing, the deformation of clothing worn on the body involves the joint action of multiple factors. With the continuous advancement of neural network technology, virtual fitting has become more intelligent and more robust.

[0003] However, most current virtual fitting methods are still based on existing paired data, i.e., images of clothing flattened and images of models wearing target clothing, which are used to train the network to generate virtual fitting effects. However, paired training datasets are extremely expensive, which limits the application of virtual fitting technology in e-commerce. Therefore, how to effectively use non-aligned data to train a virtual fitting network with generalization ability has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a virtual fitting method, device and readable storage medium in view of the above-mentioned deficiencies in the prior art, so as to solve the problem that the existing virtual fitting method needs to be based on existing paired data, which easily limits the application of virtual fitting technology in e-commerce.

[0005] In a first aspect, the present invention provides a virtual fitting method, the method comprising:

[0006] Acquire clothing images and person images;

[0007] Inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image;

[0008] Obtaining a correspondence between two groups of key points corresponding to the clothing image and the person image according to the categories corresponding to the detected key points, and obtaining coarse-grained matching image information and converted key point information according to the correspondence;

[0009] The coarse-grained matching image information and the converted key point information are input into an image generation model to obtain a virtual fitting image.

[0010] Furthermore, before inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image, the method further includes:

[0011] Different clothing images and images of people in different clothes marked with key points and their corresponding categories are used as data sets to train a feature extractor to obtain a trained feature extractor, wherein each clothing image and image of people in different clothes is marked with up to 33 key points and categories.

[0012] Furthermore, the feature extractor is a twin two-branch neural network, which includes a detection branch and a classification branch. The detection branch is used to output a feature point score map, and the classification branch is used to realize the classification of feature points. The corresponding category dimensions include all key point categories and 1 non-key point category.

[0013] Furthermore, the loss function of the detection branch in the iterative training process uses the mean square error MSE loss, and the loss function of the classification branch in the iterative training process uses the Softmax loss function.

[0014] Furthermore, during the training process of the twin dual-branch neural network, the classification branch attempts to learn the decision radius and decision center of each feature point classification, and after learning the decision center and decision radius, calculates the distance between the feature point category and the decision center. If the feature point category falls outside all decision spaces, it is judged as a non-critical point. Otherwise, the feature point is classified as the critical point category to which the nearest decision center belongs.

[0015] Furthermore, obtaining the coarse-grained matching image information and the converted key point information according to the corresponding relationship specifically includes:

[0016] According to the correspondence, a thin plate spline TPS is applied to distort the clothing image to obtain coarse-grained matching image information and converted key point information;

[0017] The coarse-grained matching image information is an image obtained by overlaying the distorted clothing image on the person image, and is used to indicate the approximate positions of the occlusion points and the exposed points.

[0018] Furthermore, the image generation model includes a first discriminator, a second discriminator and an image semantic segmentation network;

[0019] The first discriminator is used to guide the image generation model to generate a real image. The loss calculation formula corresponding to the first discriminator in the training stage is:

[0020]

[0021] Where M represents the number of generated images, λ1 is a hyperparameter, and D1(.) represents the operation of the first discriminator D1, which is used to control the weight of the loss;

[0022] The image semantic segmentation network is used to segment the character image, obtain the segmentation map, and generate the invariable part in the character image according to the segmentation map. The loss calculation formula corresponding to the image semantic segmentation network in the training stage is:

[0023]

[0024] In the formula, I p and Respectively represent the original character image and the generated image in the training data in the invariable part S m The pixel value at coordinate p in N ms Represents the immutable part S in the mth image m The sum of the number of pixels in , λ2 is a hyperparameter used to control the weight of the loss;

[0025] The second discriminator is used to guide the image generation model to generate and output images of clothing. The loss calculation formula corresponding to the second discriminator in the training stage is:

[0026]

[0027] In the formula, C represents the clothing image to be tried on, D2(.) represents the operation of the second discriminator D2, and λ3 is a hyperparameter used to control the weight of the loss;

[0028] The overall loss function of the image generation model during the training phase is:

[0029] L=L Real +L station +L same +L seg

[0030] Where, L seg For segmentation loss.

[0031] In a second aspect, the present invention provides a virtual fitting device, the device comprising:

[0032] An image acquisition module, used to acquire clothing images and character images;

[0033] A key point detection module, connected to the image acquisition module, for inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image;

[0034] A coarse-grained matching module, connected to the key point detection module, is used to obtain the correspondence between the two groups of key points corresponding to the clothing image and the character image according to the categories corresponding to the detected key points, and obtain coarse-grained matching image information and converted key point information according to the correspondence;

[0035] The virtual fitting module is connected to the coarse-grained matching module and is used to input the coarse-grained matching image information and the converted key point information into the image generation model to obtain a virtual fitting image.

[0036] In a third aspect, the present invention provides a virtual fitting device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the virtual fitting method described in the first aspect.

[0037] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the virtual fitting method described in the first aspect is implemented.

[0038] The present invention provides a method, device and readable storage medium for virtual fitting. First, clothing images and character images are obtained; and the clothing images and character images are input into a trained feature extractor to detect key points and corresponding categories in the clothing images and character images; then, the correspondence between the two groups of key points corresponding to the clothing images and character images is obtained according to the categories corresponding to the detected key points, and coarse-grained matching image information and converted key point information are obtained according to the correspondence; and the coarse-grained matching image information and converted key point information are input into an image generation model to obtain a virtual fitting image. The present invention can generate virtual fitting images using non-aligned data, can improve the accuracy of the model, and make the fitting images closer to the real fitting effect, solving the problem that the existing virtual fitting methods need to be based on existing paired data, which easily limits the application of virtual fitting technology in e-commerce. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flow chart of a virtual fitting method according to Embodiment 1 of the present invention;

[0040] Figure 2 This is a schematic diagram of key point marking of clothing and character images according to an embodiment of the present invention;

[0041] Figure 3 is a schematic diagram of the structure of a feature extractor according to an embodiment of the present invention;

[0042] Figure 4 Schematic diagram of a flow chart of another virtual fitting method according to Embodiment 1 of the present invention;

[0043] Figure 5 This is a schematic diagram of feature point classification according to an embodiment of the present invention;

[0044] Figure 6 A schematic diagram of the structure of an image generation model according to an embodiment of the present invention;

[0045] Figure 7 This is a schematic diagram of the structure of a virtual fitting device according to Embodiment 2 of the present invention;

[0046] Figure 8 This is a schematic structural diagram of a virtual fitting device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0047] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0048] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.

[0049] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.

[0050] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.

[0051] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.

[0052] It can be understood that the terms "first", "second", etc. in the embodiments of the present invention are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.

[0053] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.

[0054] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.

[0055] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.

[0056] Embodiment 1:

[0057] This embodiment provides a virtual fitting method, such as Figure 1 As shown, the method includes:

[0058] Step S101: Acquire clothing images and character images;

[0059] In this embodiment, the clothing image is a tiled effect image of the clothing to be tried on.

[0060] Step S102: inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image.

[0061] In this embodiment, the sizes of the clothing images and the character images can be first adjusted to a uniform size, such as 512*512, and then the adjusted clothing images and character images can be input into a trained feature extractor to detect key points and corresponding categories in the clothing images and the character images.

[0062] Optionally, before inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image, the method further includes:

[0063] Different clothing images and images of people in different clothes marked with key points and their corresponding categories are used as data sets to train a feature extractor to obtain a trained feature extractor, wherein each clothing image and image of people in different clothes is marked with up to 33 key points and categories.

[0064] In this embodiment, firstly, a dataset of images of people wearing different clothes and a dataset of images of tiling effects of different clothes are collected, and then the original clothes and characters are marked. Each image is marked with up to 33 key points and their categories. The key point marking schematic diagram of clothes and characters can be shown as follows: Figure 2 As shown, 1-6: neck; 7,33: shoulder; 8,15,25,32: outer upper arm; 9,14,26,31: elbow; 10,13,27,30 lower arm; 11,12,28,29: wrist; 16,24: armpit; 17,18,22,23: waist; 19,20,21: bottom edge of clothes. The labeled dataset is then used to train the feature extractor to detect key points and their corresponding categories in different clothing images and images of people wearing different clothes.

[0065] Optionally, the feature extractor is a twin two-branch neural network, which includes a detection branch and a classification branch. The detection branch is used to output a feature point score map, and the classification branch is used to realize the classification of feature points. The corresponding category dimensions include all key point categories and 1 non-key point category.

[0066] In this embodiment, if Figure 3 As shown in the figure, the feature extractor is a twin dual-branch neural network. The feature extraction process of clothing and characters shares the network weights. The dual branches include a detection branch and a classification branch, which output feature point score maps S∈R of the original size respectively. H*W*1 And feature classification T∈R H*W*34 , where the category dimension includes 33 marked key point categories and 1 category for non-key point, for a total of 34 categories.

[0067] Optionally, the loss function of the detection branch in the iterative training process uses MSE (Mean Squared Error) loss, and the loss function of the classification branch in the iterative training process uses Softmax loss function.

[0068] In this embodiment, the labeled image data is used to guide the twin dual-branch neural network to learn feature points, wherein the loss function of the detection branch uses the MSE (mean square error) loss, and the classification branch uses the softmax Loss loss function, and the loss formula is as follows:

[0069] MSE Loss:

[0070]

[0071] Among them, H and W represent the height and width of the input image respectively, G represents the marked feature point data, and P represents the feature point output by the detection branch.

[0072] Softmax Loss:

[0073]

[0074] Among them, τh,w Indicates the classification label of the feature point at the position (h, w) of the original image. In the actual calculation process, in order to improve the generalization ability of the model, the surrounding area of ​​the marked feature point position is considered to be of the same category with a radius of 5 pixels. i,h,w Indicates the classification prediction result of feature points, which comes from the classification branch of 1*34.

[0075] Optionally, during the training process of the twin dual-branch neural network, the classification branch attempts to learn the decision radius and decision center of each feature point classification, and after learning the decision center and decision radius, calculates the distance between the feature point category and the decision center. If the feature point category falls outside all decision spaces, it is judged as a non-critical point; otherwise, the feature point is classified as the critical point category to which the nearest decision center belongs.

[0076] In this embodiment, after multiple iterations, the classification branch will try to learn a decision radius r for feature point classification. k and decision-making centre k First, the decision-making center c k According to the predicted classification t of the true category k, we get the mean:

[0077]

[0078] Among them, N k represents the number of feature points belonging to category k, t n Indicates the category prediction corresponding to the nth feature point.

[0079] Secondly, the classification of each feature point should not be too tight, otherwise some feature points cannot be accurately identified. However, if it is too sparse, the pixels of non-critical data will be introduced into the critical data category. The loss function of decision radius learning is as follows:

[0080]

[0081] Among them, t k and c k represents the classification output and decision boundary belonging to category k, r k represents the decision radius, N k Represents the number of all feature points belonging to category k.

[0082] Finally, after learning the decision center and decision radius, calculate the distance between the feature point category and the decision center (that is, calculate the distance between the feature point classification prediction vector and the decision center). If the category falls outside all decision spaces, it is judged as a non-critical point, otherwise it is classified into the category described by the nearest decision center:

[0083]

[0084] Step S103: obtaining a correspondence between two groups of key points corresponding to the clothing image and the person image according to the categories corresponding to the detected key points, and obtaining coarse-grained matching image information and converted key point information according to the correspondence;

[0085] In this embodiment, the correspondence between the two groups of key points can be obtained according to the categories to which the two groups of key points belong, that is, key points of the same category are respectively matched, so that coarse-grained matching image information and converted key point information can be obtained.

[0086] It should be noted that after matching the key points of clothes and people, they can be divided into three categories: key points that exist on both the person and the clothes, occluded points that only exist on the clothes, and exposed points that only exist on the person. The three are placed on the same feature map and Gaussian blurred and spliced ​​onto the coarsely matched fitting image to obtain coarse-grained matching image information.

[0087] Optionally, obtaining the coarse-grained matching image information and the converted key point information according to the corresponding relationship specifically includes:

[0088] According to the correspondence, TPS (Thin Plate Spline) is applied to distort the clothing image to obtain coarse-grained matching image information and converted key point information;

[0089] The coarse-grained matching image information is an image obtained by overlaying the distorted clothing image on the person image, and is used to indicate the approximate positions of the occlusion points and the exposed points.

[0090] In this embodiment, the TPS technology is used to distort the image to obtain a coarse-grained image matching result (the distorted image is a tiling effect image of the clothing distorted according to the correspondence relationship). The coarse-grained matching image information is an image obtained by overlaying the distorted clothing image onto the character image. The converted key point information includes normal key points, occluded points and exposed points.

[0091] Step S104: inputting the coarse-grained matching image information and the converted key point information into an image generation model to obtain a virtual fitting image.

[0092] In this embodiment, the approximate positions of the occluded points and the exposed points can be accurately obtained according to the distortion results, and the converted key point information and the coarse matching image are input into the image generation model together to obtain an accurate virtual fitting image.

[0093] In this embodiment, the image generation model is obtained in advance through training. During the training process, the image generation model starts from a fixed constant z and gradually generates high-quality target domain images through multi-layer convolution under the guidance of the generation conditions. The coarse-grained matching information and the feature point distribution image (i.e., the converted key point information) are input into the conditional generation network, and two results α are output. i and β i The conditional injection of coarse-grained matching information adopts the Spatial Adaptive Normalization (SPADE) method. The specific implementation process is in and They are the i-th layer feature input f i The variance and mean in the channel direction, α i and β i Identify the guiding conditions for the generation of the i-th layer. Finally, with the help of prior knowledge, guide the network to generate more natural and realistic images, so that the generated image and the original image are the same clothes and the same person, but closer to the real try-on effect.

[0094] Optionally, the image generation model includes a first discriminator, a second discriminator and an image semantic segmentation network;

[0095] The first discriminator is used to guide the image generation model to generate a real image. The loss calculation formula corresponding to the first discriminator in the training stage is:

[0096]

[0097] Where M represents the number of generated images, λ1 is a hyperparameter, and D1(.) represents the operation of the first discriminator D1, which is used to control the weight of the loss;

[0098] The image semantic segmentation network is used to segment the character image, obtain the segmentation map, and generate the invariable part in the character image according to the segmentation map. The loss calculation formula corresponding to the image semantic segmentation network in the training stage is:

[0099]

[0100] In the formula, I p and Respectively represent the original character image and the generated image in the training data in the invariable part S m The pixel value at coordinate p in N ms Represents the immutable part S in the mth image m The sum of the number of pixels in , λ2 is a hyperparameter used to control the weight of the loss;

[0101] The second discriminator is used to guide the image generation model to generate and output images of clothing. The loss calculation formula corresponding to the second discriminator in the training stage is:

[0102]

[0103] In the formula, C represents the clothing image to be tried on, D2(.) represents the operation of the second discriminator D2, and λ3 is a hyperparameter used to control the weight of the loss;

[0104] The overall loss function of the image generation model during the training phase is:

[0105] L=L Real +L station +L same +L seg

[0106] Where, L seg For segmentation loss.

[0107] In this embodiment, the image generation model includes a first discriminator D1, a second discriminator D2 and an image semantic segmentation network, and the discriminators are used to determine whether the generated image is a real image and whether the clothes worn by the generated model are the same clothes as the distorted image. The human posture segmentation model is used to assist in the segmentation of the image, so that the positions corresponding to the exposed points are represented as real human skin, and the positions corresponding to the occluded points are the original character image information, and are used to divide the immutable parts in the image such as the face, neck and other positions.

[0108] In this embodiment, for occlusion points and exposed points, their vicinity should be displayed as body parts of the person rather than clothing, that is, in the segmentation map, the area near the exposed point should be segmented as the body, and the loss calculation formula is:

[0109]

[0110] in, represents the segmentation map of the mth image, O m Indicates exposed surrounding area, N mz express The sum of the parts greater than 0 in , represents the segmentation label of the body, Represents the value of the segmented image at position p, and λ4 is a hyperparameter used to control the weight of the loss.

[0111] And the pixels near the occluded point should be similar to the original person image, and the same loss design as the unchanged part is:

[0112]

[0113] Among them, Q m represents the area around the mask point, N mq Indicates the cover point, I p and Respectively represent the pixel value at coordinate p in the original character image and the generated image, and the sum of the number of surrounding pixels. seg1 and L seg2 Together they form the segmentation loss L seg .

[0114] The overall loss of the image generation model is designed as:

[0115] L=L Real +L station +L same +L seg

[0116] It should be noted that the training of the image generation model is divided into three stages. The first stage uses L Real and L station The loss constrains the generative network to generate realistic images of people wearing clothes; the second stage uses L Real , L station and L same , so that the generated image produces the corresponding fitting effect; in the third stage, L Real , L station , L same and L seg , improving the robustness of generated images to occlusion and exposure.

[0117] In a specific embodiment, Figure 4 As shown, the virtual fitting method may include the following steps:

[0118] S1. Collect datasets of images of different costumes and people wearing different clothes;

[0119] S2. Using image information and feature labeling data, train the network to detect key points and their corresponding categories in clothing and character images.

[0120] S3, obtaining the category label T according to the two groups of steps S2 to obtain the correspondence between the two groups of key points P (i.e., feature matching), and obtaining the transformation relationship of the image according to the correspondence, thereby achieving a coarse-grained matching result of the image;

[0121] S4. Based on the coarse-grained fitting effect, the coarse-grained matching image information and the converted key point information are used as generation conditions and input into the image generation model to generate high-quality virtual fitting images.

[0122] Optionally, step S1 specifically includes:

[0123] S11. Collect a dataset of images of people wearing different clothes.

[0124] S12, collecting tiling effect image data of different clothing;

[0125] S13, marking the original clothing and character images, marking up to 33 key points and their categories for each image, and the category set is denoted as L;

[0126] Among them, the key point information of the mark can be Figure 2 As shown, 1-6: neck; 7,33: shoulder; 8,15,25,32: outer upper arm; 9,14,26,31: elbow; 10,13,27,30: lower arm; 11,12,28,29: wrist; 16,24: armpit; 17,18,22,23: waist; 19,20,21: bottom edge of clothes.

[0127] Optionally, step S2 specifically includes:

[0128] S21, resize the original image to 512*512 as input of the feature extractor;

[0129] S22, sending the clothing image and the person image to the feature extractor to obtain two sets of feature point sets P C and P I and category label T C and T I The two groups refer to any image of a person wearing clothes and a tiled image of the clothes to be tried on.

[0130] S23. Combining the idea of ​​clustering, the output results of the same type of labels are clustered into the same feature space to improve the accuracy of classification, and non-feature points are clustered into another distribution space to reduce the possibility of non-key points being detected. The schematic diagram of feature point classification is as follows: Figure 5 As shown, c1, c2, etc. represent cluster centers, and arrows represent belonging.

[0131] It should be noted that both feature points and category labels are supervised and trained by ground truth. In order to improve the accuracy of detection and capture the commonality between the two modalities, after generating the category label, the key points are clustered according to the true category and the decision boundary is minimized as much as possible. The learned 34 cluster centers and decision boundaries are stored, and during the inference process, more accurate categories are obtained based on the centers, boundaries and category labels.

[0132] Optionally, step S3 specifically includes:

[0133] S31. According to the feature point category and cluster space obtained in step S2, the feature points are matched. According to the matching result, the TPS (Thin Plate Spline) technology is used to distort the image to obtain a coarse-grained image matching result (the distorted image is obtained by distorting the tiling effect image of the clothing according to the corresponding relationship, and the coarse-grained matching result is an image obtained by overlaying the distorted image on the person).

[0134] S32. According to the distortion result, the approximate positions of the occluded points and the exposed points can be accurately obtained, and the converted key point information and the rough matching image are input into the image generation model together to obtain an accurate virtual fitting image.

[0135] Optionally, step S3 specifically includes:

[0136] S41. The image generation model starts from a fixed constant z and gradually generates high-quality target domain images through multiple layers of convolution under the guidance of generation conditions.

[0137] S42, coarse-grained matching information and feature point distribution image are input into the conditional generation network, and two results α are output i and β i Used to guide the generation of results.

[0138] S43, the conditional injection of coarse-grained matching information adopts the spatial adaptive denormalization (SPADE) method. The specific implementation process in and They are the i-th layer feature input f i The variance and mean in the channel direction, α i and β i Identifies the guiding conditions for the generation of the i-th layer.

[0139] S44. With the help of prior knowledge, the network is guided to generate more natural and realistic images, so that the generated image and the original image are the same clothes and the same person, but closer to the real try-on effect.

[0140] Optionally, in step S21, the feature extractor is a twin dual-branch neural network, the feature extraction process of clothing and character shares the network weight, the dual branches include a detection branch and a classification branch, and outputs the feature point score map S∈R of the original size respectively. H*W*1 And feature classification T∈R H*W*34 , where the category dimension includes the categories of the 33 marked key points and the categories used to represent non-key points.

[0141] Optionally, in step S23, the labeled image data is used to guide the network to learn feature points, the loss function of the detection part uses MSE (mean square error) loss, and the classification branch uses a softmax Loss loss function, and the loss formula is as follows:

[0142] MSE Loss:

[0143]

[0144] Among them, H and W represent the height and width of the input image respectively, G represents the marked feature point data, and P represents the feature point output by the detection branch.

[0145] Softmax Loss:

[0146]

[0147] Among them, τ h,w Indicates the classification label of the feature point at the position (h, w) of the original image. In the actual calculation process, in order to improve the generalization ability of the model, the surrounding area of ​​the marked feature point position is considered to be of the same category with a radius of 5 pixels. i,h,w Indicates the classification prediction result of feature points, which comes from the classification branch of 1*34.

[0148] Optionally, in step S23, after multiple iterations, the classification branch attempts to learn a decision radius r for feature point classification. k and decision-making centre k First, the decision-making center c k According to the predicted classification t of the true category k, we get the mean:

[0149]

[0150] Among them, N k represents the number of feature points belonging to category k, t n Indicates the category prediction corresponding to the nth feature point.

[0151] Secondly, the classification of each feature point should not be too tight, otherwise some feature points cannot be accurately identified. However, if it is too sparse, the pixels of non-critical data will be introduced into the critical data category. The loss function of decision radius learning is as follows:

[0152]

[0153] Among them, t k and c k represents the classification output and decision boundary belonging to category k, r k represents the decision radius, N kRepresents the number of all feature points belonging to category k.

[0154] Optionally, in step S31, after learning the decision center and decision radius, the distance between the feature point category and the decision center is calculated (i.e., the distance between the feature point classification prediction vector and the decision center is calculated). If the category falls outside all decision spaces, it is determined to be a non-critical point, otherwise it is classified into the category described by the nearest decision center:

[0155]

[0156] Optionally, in step S32, after matching the key points of the clothes and the person, they can be divided into three categories: key points that exist on both the person and the clothes, occluded points that exist only on the clothes, and exposed points that exist only on the person. The three are placed on the same feature map and Gaussian blurred and spliced ​​to the roughly matched fitting image, and input into the image generation network.

[0157] Optionally, in step S44, multiple discriminators are needed to generate a real fitting image. The image generation model includes two discriminators D1 and D2 and an image semantic segmentation network H. The structure of the image generation model is as follows: Figure 6 As shown, the discriminator is used to determine whether the generated image is a real image and whether the clothes worn by the generated model are the same as those in the distorted image. The human posture segmentation model is used to assist in image segmentation, so that the positions corresponding to the exposed points are represented as real human skin, and the positions corresponding to the occluded points are the original person image information, and is used to divide the immutable parts in the image such as the face, neck, etc.

[0158] First, the generated image should be infinitely close to or equal to the real fitting image. The pre-trained discriminator D1 is used to guide the network to generate real images. The loss is designed as follows:

[0159]

[0160] Among them, M represents the number of generated images, λ1 is a hyperparameter, and D1(.) represents the operation of the discriminator D1, which is used to control the weight of the loss.

[0161] Secondly, the invariant part of the generated image is similar to the original image. The image semantic segmentation network is used to segment the original person image I and obtain the segmentation map S. According to the segmentation map, the invariant part S of the image can be selected m , then the loss of the unchanged part of the generated image is calculated as:

[0162]

[0163] Among them, I p and Respectively represent the original character image and the generated image in the invariable part S m The pixel value at coordinate p in N. ms Represents the immutable part S in the mth image m λ2 is a hyperparameter used to control the weight of the loss, and M represents the number of generated images.

[0164] Then, the generated image should be the same piece of clothing as the clothing image. The pre-trained discriminator D2 is used to guide the generated network to output an image wearing clothing. The loss is designed as follows:

[0165]

[0166] Among them, C represents the clothing image that needs to be tried on, λ3 is a hyperparameter used to control the weight of the loss, and D2(.) represents the operation of the discriminator D2.

[0167] Finally, for occluded points and exposed points, their nearby positions should be displayed as body parts rather than clothing. That is, in the segmentation map, the area near the exposed point should be segmented as the body, and the loss is calculated as follows:

[0168]

[0169] in, represents the segmentation map of the mth image, O m Indicates exposed surrounding area, N mz express The sum of the parts greater than 0 in , represents the segmentation label of the body, Represents the value of the segmented image at position p, and λ4 is a hyperparameter used to control the weight of the loss.

[0170] And the pixels near the occluded point should be similar to the original person image, and the same loss design as the unchanged part is:

[0171]

[0172] Among them, Q m represents the area around the mask point, N mq Indicates the cover point, I p and Respectively represent the pixel value at coordinate p in the original character image and the generated image, and the sum of the number of surrounding pixels. seg1 and L seg2 Together they form the segmentation loss L seg .

[0173] The overall loss of the image generation model is designed as:

[0174] L=LReal +L station +L same +L seg

[0175] Optionally, in step S44, the training of the image generation model is divided into three stages. The first stage uses L Real and L station The loss constrains the generative network to generate realistic images of people wearing clothes; the second stage uses L Real , L station and L same , so that the generated image produces the corresponding fitting effect; in the third stage, L Real , L station , L same and L seg , improving the robustness of generated images to occlusion and exposure.

[0176] It should be noted that in the actual fitting stage, the two images of clothing image and person image are first input into the feature extractor to extract key points and corresponding categories, and then the correspondence between the two groups of key points corresponding to the clothing image and the person image is obtained according to the category of the key points, and then the coarse-grained matching image information is obtained according to this correspondence, and then the coarse-grained matching image information and the processed key point information (including normal points, occluded points and exposed points) are input into the image generation model to obtain a virtual fitting image.

[0177] The virtual fitting method provided by the embodiment of the present invention first obtains clothing images and character images; and inputs the clothing images and character images into a trained feature extractor to detect key points and corresponding categories in the clothing images and character images; then obtains the correspondence between the two groups of key points corresponding to the clothing images and character images according to the categories corresponding to the detected key points, and obtains coarse-grained matching image information and converted key point information according to the correspondence; and then inputs the coarse-grained matching image information and converted key point information into an image generation model to obtain a virtual fitting image. The present invention can generate virtual fitting images using non-aligned data, can improve the accuracy of the model, and make the fitting images closer to the real fitting effect, solving the problem that the existing virtual fitting methods need to be based on existing paired data, which easily limits the application of virtual fitting technology in e-commerce.

[0178] Embodiment 2:

[0179] like Figure 7 As shown, this embodiment provides a virtual fitting device, which is used to execute the above virtual fitting method, including:

[0180] An image acquisition module 11 is used to acquire clothing images and character images;

[0181] A key point detection module 12, connected to the image acquisition module 11, for inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image;

[0182] A coarse-grained matching module 13 is connected to the key point detection module 12, and is used to obtain the correspondence between the two groups of key points corresponding to the clothing image and the character image according to the categories corresponding to the detected key points, and obtain coarse-grained matching image information and converted key point information according to the correspondence;

[0183] The virtual fitting module 14 is connected to the coarse-grained matching module 13 and is used to input the coarse-grained matching image information and the converted key point information into the image generation model to obtain a virtual fitting image.

[0184] Optionally, the device further comprises:

[0185] The feature extractor training module is used to train the feature extractor using different clothing images and images of people in different clothing marked with key points and their corresponding categories as data sets to obtain a trained feature extractor, wherein each clothing image and image of people in different clothing is marked with up to 33 key points and categories.

[0186] Optionally, the feature extractor is a twin two-branch neural network, which includes a detection branch and a classification branch. The detection branch is used to output a feature point score map, and the classification branch is used to realize the classification of feature points. The corresponding category dimensions include all key point categories and 1 non-key point category.

[0187] Optionally, the loss function of the detection branch in the iterative training process uses mean square error MSE loss, and the loss function of the classification branch in the iterative training process uses Softmax loss function.

[0188] Optionally, during the training process of the twin dual-branch neural network, the classification branch attempts to learn the decision radius and decision center of each feature point classification, and after learning the decision center and decision radius, calculates the distance between the feature point category and the decision center. If the feature point category falls outside all decision spaces, it is judged as a non-critical point; otherwise, the feature point is classified as the critical point category to which the nearest decision center belongs.

[0189] Optionally, the coarse-grained matching module 13 includes:

[0190] A unit, for applying a thin plate spline TPS to distort the clothing image according to the corresponding relationship to obtain coarse-grained matching image information and converted key point information;

[0191] The coarse-grained matching image information is an image obtained by overlaying the distorted clothing image on the person image, and is used to indicate the approximate positions of the occlusion points and the exposed points.

[0192] Optionally, the image generation model includes a first discriminator, a second discriminator and an image semantic segmentation network;

[0193] The first discriminator is used to guide the image generation model to generate a real image. The loss calculation formula corresponding to the first discriminator in the training stage is:

[0194]

[0195] Where M represents the number of generated images, λ1 is a hyperparameter, and D1(.) represents the operation of the first discriminator D1, which is used to control the weight of the loss;

[0196] The image semantic segmentation network is used to segment the character image, obtain the segmentation map, and generate the invariable part in the character image according to the segmentation map. The loss calculation formula corresponding to the image semantic segmentation network in the training stage is:

[0197]

[0198] In the formula, I p and Respectively represent the original character image and the generated image in the training data in the invariable part S m The pixel value at coordinate p in N ms Represents the immutable part S in the mth image m The sum of the number of pixels in , λ2 is a hyperparameter used to control the weight of the loss;

[0199] The second discriminator is used to guide the image generation model to generate and output images of clothing. The loss calculation formula corresponding to the second discriminator in the training stage is:

[0200]

[0201] In the formula, C represents the clothing image to be tried on, D2(.) represents the operation of the second discriminator D2, and λ3 is a hyperparameter used to control the weight of the loss;

[0202] The overall loss function of the image generation model during the training phase is:

[0203] L=L Real +L station +L same +L seg

[0204] Where, L segFor segmentation loss.

[0205] Embodiment 3:

[0206] refer to Figure 8 This embodiment provides a virtual fitting device, including a memory 21 and a processor 22. The memory 21 stores a computer program, and the processor 22 is configured to run the computer program to execute the virtual fitting method in Example 1.

[0207] The memory 21 is connected to the processor 22. The memory 21 may be a flash memory, a read-only memory or other memory. The processor 22 may be a central processing unit or a single-chip microcomputer.

[0208] Embodiment 4:

[0209] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the virtual fitting method in the above-mentioned embodiment 1 is implemented.

[0210] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.

[0211] In summary, the virtual fitting method, device and readable storage medium provided by the embodiments of the present invention first obtain clothing images and character images; and input the clothing images and character images into a trained feature extractor to detect the key points and corresponding categories in the clothing images and character images; then obtain the correspondence between the two groups of key points corresponding to the clothing images and character images according to the categories corresponding to the detected key points, and obtain coarse-grained matching image information and converted key point information according to the correspondence; and then input the coarse-grained matching image information and converted key point information into an image generation model to obtain a virtual fitting image. The present invention can generate virtual fitting images using non-aligned data, can improve the accuracy of the model, and make the fitting images closer to the real fitting effect, solving the problem that the existing virtual fitting methods need to be based on existing paired data, which easily limits the application of virtual fitting technology in e-commerce.

[0212] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A virtual fitting method, characterized in that: The method comprises: Acquire clothing images and person images; Inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image; Obtaining a correspondence between two groups of key points corresponding to the clothing image and the person image according to the categories corresponding to the detected key points, and obtaining coarse-grained matching image information and converted key point information according to the correspondence; The coarse-grained matching image information and the converted key point information are input into an image generation model to obtain a virtual fitting image.

2. The method according to claim 1, characterized in that Before inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image, the method further includes: Different clothing images and images of people in different clothes marked with key points and their corresponding categories are used as data sets to train a feature extractor to obtain a trained feature extractor, wherein each clothing image and image of people in different clothes is marked with up to 33 key points and categories.

3. The method according to claim 2, characterized in that The feature extractor is a twin two-branch neural network, which includes a detection branch and a classification branch. The detection branch is used to output a feature point score map, and the classification branch is used to realize the classification of feature points. The corresponding category dimensions include all key point categories and 1 non-key point category.

4. The method according to claim 3, characterized in that The loss function of the detection branch in the iterative training process uses the mean square error MSE loss, and the loss function of the classification branch in the iterative training process uses the Softmax loss function.

5. The method according to claim 3, characterized in that: During the training process of the twin dual-branch neural network, the classification branch attempts to learn the decision radius and decision center of each feature point classification, and after learning the decision center and decision radius, calculates the distance between the feature point category and the decision center. If the feature point category falls outside all decision spaces, it is judged as a non-critical point. Otherwise, the feature point is classified as the critical point category to which the nearest decision center belongs.

6. The method according to claim 1, characterized in that The obtaining of the coarse-grained matching image information and the converted key point information according to the corresponding relationship specifically includes: According to the correspondence, a thin plate spline TPS is applied to distort the clothing image to obtain coarse-grained matching image information and converted key point information; The coarse-grained matching image information is an image obtained by overlaying the distorted clothing image on the person image, and is used to indicate the approximate positions of the occlusion points and the exposed points.

7. The method according to claim 6, characterized in that The image generation model includes a first discriminator, a second discriminator and an image semantic segmentation network; The first discriminator is used to guide the image generation model to generate a real image. The loss calculation formula corresponding to the first discriminator in the training stage is: Where M represents the number of generated images, λ1 is a hyperparameter, and D1(.) represents the operation of the first discriminator D1, which is used to control the weight of the loss; The image semantic segmentation network is used to segment the character image, obtain the segmentation map, and generate the invariable part in the character image according to the segmentation map. The loss calculation formula corresponding to the image semantic segmentation network in the training stage is: In the formula, I p and Respectively represent the original character image and the generated image in the training data in the invariable part S m The pixel value at coordinate p in N ms Represents the immutable part S in the mth image m The sum of the number of pixels in , λ2 is a hyperparameter used to control the weight of the loss; The second discriminator is used to guide the image generation model to generate and output images of clothing. The loss calculation formula corresponding to the second discriminator in the training stage is: In the formula, C represents the clothing image to be tried on, D2(.) represents the operation of the second discriminator D2, and λ3 is a hyperparameter used to control the weight of the loss; The overall loss function of the image generation model during the training phase is: L=L Real +L station +L same +L seg Where, L seg For segmentation loss.

8. A virtual fitting device, characterized in that: The device comprises: An image acquisition module, used to acquire clothing images and character images; A key point detection module, connected to the image acquisition module, for inputting the clothing image and the person image into a trained feature extractor to detect key points and corresponding categories in the clothing image and the person image; A coarse-grained matching module, connected to the key point detection module, is used to obtain the correspondence between the two groups of key points corresponding to the clothing image and the character image according to the categories corresponding to the detected key points, and obtain coarse-grained matching image information and converted key point information according to the correspondence; The virtual fitting module is connected to the coarse-grained matching module and is used to input the coarse-grained matching image information and the converted key point information into the image generation model to obtain a virtual fitting image.

9. A virtual fitting device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the virtual fitting method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the virtual fitting method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Clothing image processing method, computer equipment and storage medium

    CN119445133A