CN115984426A - Method, device, terminal and storage medium for generating hair style demonstration image - Google Patents

Method, device, terminal and storage medium for generating hair style demonstration image Download PDF

Info

Publication number
CN115984426A
CN115984426A CN202310272227.0A CN202310272227A CN115984426A CN 115984426 A CN115984426 A CN 115984426A CN 202310272227 A CN202310272227 A CN 202310272227A CN 115984426 A CN115984426 A CN 115984426A
Authority
CN
China
Prior art keywords
image
face
hair style
transformed
hairstyle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310272227.0A
Other languages
Chinese (zh)
Other versions
CN115984426B (en
Inventor
车宏图
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Meizhong Tianjin Technology Co ltd
Original Assignee
Meizhong Tianjin Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Meizhong Tianjin Technology Co ltd filed Critical Meizhong Tianjin Technology Co ltd
Priority to CN202310272227.0A priority Critical patent/CN115984426B/en
Publication of CN115984426A publication Critical patent/CN115984426A/en
Application granted granted Critical
Publication of CN115984426B publication Critical patent/CN115984426B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method, a device, a terminal and a storage medium for generating a hair style demonstration image, wherein the method comprises the following steps: acquiring a mask image for designing a hairstyle and a face reconstruction model image to be transformed; calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region; inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image; acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature; and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold. The generated hair style demonstration image can be more vivid.

Description

Method, device, terminal and storage medium for generating hair style demonstration image
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method, an apparatus, a terminal, and a storage medium for generating a hair style demonstration image.
Background
The hairstyle design is a comprehensive art, and by utilizing the length, the partition, the angle and the color matching of the hair and combining the preference and the habit of a designer, the good hairstyle design not only can well modify the face shape, but also can make people feel happy. With the progress of the times, people have higher requirements on aesthetic quality, and the current hairstyle design already comprises the steps of changing different hairstyles on various occasions and changing different hairstyles according to clothes, occupation and environment.
With the development of Artificial Intelligence (AI) technology, AI can be applied to hairstyle design. Specifically, a neural network may be trained by using a large number of images including the face of the target person as a training set, and a target image may be obtained by inputting a reference face pose image (i.e., an image including face pose information) and a reference face image including the face of the target person into the trained neural network, where the face pose in the target image is the face pose in the reference face image, and the face texture in the target image is the face texture of the target person. In this manner, a corresponding image of the hair style design may be generated for each customer for reference selection by the customer.
In the process of implementing the invention, the inventor finds the following technical problems: by adopting the mode, the hair style fusion image with better effect can be obtained only after more hair style sample images are required to be fully trained. However, after a new hair style is designed, it is difficult to have a sufficient number of sample images of the hair style in a short time, so that when the hair style is generated, the blending degree of skin and hair is poor, and the generated hair style image cannot achieve the actual simulation effect.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a terminal device and a storage medium for generating a hair style demonstration image, which aim to solve the technical problem of poor quality of a generated hair style design image caused by too few samples in the prior art.
In a first aspect, an embodiment of the present invention provides a method for generating a hair style demonstration image, including:
acquiring a mask image for designing a hairstyle and a face reconstruction model image to be transformed;
calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region;
inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image;
acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature;
and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold.
In a second aspect, an embodiment of the present invention further provides an apparatus for generating a hair style demonstration image, including:
the acquisition module is used for acquiring a mask image for designing a hairstyle and a face reconstruction model image to be transformed;
the calculation module is used for calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region;
the input module is used for inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image;
the judging module is used for acquiring the image of each reference area in the hair style human face fusion image, extracting the convolution high-frequency characteristics of the image of the reference area and judging the reliability of each reference area according to the convolution high-frequency characteristics;
and the module is used for calculating the average value of the credibility of all the reference areas, and when the average value is larger than a preset average value threshold value, taking the hair style face fusion image as a hair style demonstration image.
In a third aspect, an embodiment of the present invention further provides a terminal, including:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a method of generating a hair style presentation image as provided by the embodiments above.
In a fourth aspect, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform the method of generating a hair style demonstration image as provided in the above embodiments.
According to the method, the device, the terminal and the storage medium for generating the hairstyle demonstration image, the model image is reconstructed by acquiring the mask image for designing the hairstyle and the face to be transformed; calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region; inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image; acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature; and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold. The method comprises the steps of fully extracting image characteristics of a human face and a hair style by utilizing a coding-decoding model, determining whether a fused image can show the image characteristics of an overlapping area or not according to convolution high-frequency characteristics of a fusion area after fusion, so that a generated hair style demonstration image can be more vivid, the condition of poor skin and hair fusion degree caused by too few new type sample images is avoided, and the hair style demonstration image close to the actual condition can be provided for a client to be referred.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments thereof, made with reference to the following drawings:
fig. 1 is a flowchart illustrating a method for generating a hair style demonstration image according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for generating a hair style demonstration image according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for generating a hair style demonstration image according to a third embodiment of the present invention;
fig. 4 is a structural diagram of a terminal according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for generating a hair style demonstration image according to an embodiment of the present invention, which is applicable to a case where a desired hair style image is generated by using a hair style image and a human face image, and the method can be executed by an apparatus for generating a hair style demonstration image, and since the operation has a lightweight feature, the method can be integrated in a terminal or a server, and specifically includes the following steps:
and step 110, obtaining a mask image for designing a hairstyle and a face reconstruction model image to be transformed.
In this embodiment, the mask image for hairstyle design can be obtained in two ways: the first type may be a three-dimensional vector model, or a two-dimensional image, which is obtained by a corresponding programming, and if the first type is a three-dimensional vector model, it may be converted into a corresponding two-dimensional image.
For example, the obtaining the mask image for designing the hairstyle may include: calculating an image area of the hair based on the hair recognition neural network model; and setting the image area as a mask image for designing the hairstyle.
The hair recognition neural network model can be a semantic segmentation model and is established on the basis of a classification model, namely a CNN network is used for extracting features for classification. And can also give classification probabilities and relative image position coordinates for different positions of the image based on the segmentation model. The hair can be obtained from the image through classification, and the accurate coordinates of the hair are obtained based on the segmentation model. Further, an image area of the hair is obtained, and the hairstyle image is extracted from the image. Through the mode, the hair grade cutting effect of most scenes can be achieved. And obtaining a mask image for designing the hairstyle.
Correspondingly, the obtaining of the face reconstruction model image to be transformed may further include: setting the gray level of pixels in the mask image as 0, and multiplying the gray level by the original image to obtain a face image; identifying key points of the face image to obtain key points of the face image; and constructing a facial feature vector according to the key points of the facial image, and constructing a transformed facial reconstruction model image according to the facial feature vector. Because the shot image includes both the human face and the hair, the image area of the hair can be determined by the method, the pixel gray value of the area is set to 0, and the area is multiplied by the original image, so that the hair area can be blank, and the extraction of the human face image is realized. Through the set 137-point facial feature point standard, 2 ten thousand plus face key point data are manually marked, and through iterative optimization, after an aligned face picture is input, the coordinates of 137 points can be regressed by the model.
And step 120, calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region.
When the hairstyle and the human face are fused, the situations of poor fusion degree, hard image, large continuous area and the like generally occur in the crossed area of the hairstyle and the human face, and further the generated hairstyle demonstration image is lack of liveness and can not play a reference role. Therefore, in this embodiment, the intersection region between the mask image and the reconstructed model image of the human face to be transformed is first calculated. For example, the intersection operation may be performed according to the pixel region between the two, and the coordinates of the reference region may be obtained. In addition, according to the actual situation, the extension can be performed to four directions, and the extended area can be used as the reference area.
And step 130, inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image.
And fusing the mask image and the face reconstruction model image to be transformed, wherein a part of content can be added into another image. Therefore, the mask image and the face reconstruction model image to be transformed can be used as input contents to be coded, and the mask image and the face reconstruction model image to be transformed are subjected to at least two times of downsampling convolution to extract the features and are converted into corresponding feature sets to be used as codes. Then decoding the code, and restoring the code into an image by at least two methods such as up-sampling convolution, hole convolution, attention mechanism and the like. Illustratively, various decoding and encoding model structures that are commonly used may be employed.
The hair style demonstration image coding-decoding model needs to be trained correspondingly, for example, the same user can be matched with the same data except for different hair styles, and the matching data needs at least 1 ten thousand pairs of input hair style demonstration image coding-decoding models to be trained.
And 140, acquiring an image of each reference area in the hair style human face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the reliability of each reference area according to the convolution high-frequency feature.
The images fused in the above manner may have a lack of detail in the reference region. Therefore, in this embodiment, it is necessary to verify the image of the reference region in the obtained type face fusion image to determine that the hair style face fusion image output by the hair style demonstration image coding-decoding model meets the requirement of the customer reference standard.
For example, a corresponding matrix can be obtained by convolving an image of a reference region in the image, then the matrix is respectively subtracted from features extracted from a mask image of the reference region and features extracted from a model image of a face to be transformed of the reference region, the subtracted result is converted into a frequency band, a high-frequency signal in the frequency band is analyzed, and the reliability in each reference region is analyzed, wherein the reliability can be determined according to the distribution condition of the high-frequency signal in an overlapping region in the actual image, and can be determined by the distribution condition of the high-frequency signal and a second high-frequency signal.
And 150, calculating an average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold.
The high-frequency signal can reflect the detail abundance degree of the hair style image, and simultaneously can reflect the regional distribution condition of the human face. Thus, the confidence level of each reference region can be calculated and its average value calculated, and the threshold value of the average value can be set empirically. When the reliability average value is larger than the preset average value threshold value, the hair style face fusion image obtained through fusion can be determined, rich details are reserved in the fusion area, and the generated hair style face fusion image can meet the reference requirements of customers.
According to the embodiment of the invention, a mask image for designing a hairstyle and a face to be transformed are obtained to reconstruct a model image; calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region; inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image; acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature; and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold. The method comprises the steps of fully extracting image characteristics of a human face and a hair style by utilizing a coding-decoding model, determining whether a fused image can show the image characteristics of an overlapping area or not according to convolution high-frequency characteristics of a fusion area after fusion, so that a generated hair style demonstration image can be more vivid, the condition of poor skin and hair fusion degree caused by too few new type sample images is avoided, and the hair style demonstration image close to the actual condition can be provided for a client to be referred.
In a preferred embodiment of this embodiment, the method may further include the following steps: and when the average value is smaller than a preset average value threshold value, adjusting the weight value of Feature loss in a loss function adopted in training in the hair style demonstration image coding-decoding model. When the hair style demonstration image coding-decoding model is used for training, parameters in the model can be iteratively optimized through a loss function in the autoregressive model, wherein the loss function comprises Feature loss, and the model comprises various loss parameters, such as L1, L2 and the like, and each loss parameter is provided with a corresponding weight. Because more hair style details need to be embodied, in the embodiment, the weight value of Feature loss can be adjusted, illustratively, the corresponding weight value can be down-regulated, and through intervention on the loss function parameter, the training model can enable the high-frequency details not to be used as the key points of noise factors any more, so that the generated hair style image can embody more details, and further, the hair style image is more vivid and close to reality.
In another preferred implementation of this embodiment, the constructing a transformed face reconstruction model image according to the facial feature vector may further be specifically optimized as follows: constructing a basic face shape according to the peripheral outline of the face in the face feature vector; constructing an expression basic face form according to the organ feature points in the facial feature vector; and generating a human face three-dimensional model image according to the input expression weight and the face shape weight. Based on the extracted matched facial feature points, the facial feature points can be divided into facial contour points and organ feature points. The face contour curve is drawn by respectively utilizing the peripheral contour points of the face, and the corresponding organ vector can be constructed by utilizing the vector corresponding to the organ characteristic point. The face reconstruction model image can be established by utilizing the face reconstruction model image and the face reconstruction model image, and a basis is provided for subsequently generating more reference hair style images. Illustratively, the construction may be achieved by: arbitrary face = public face + expression base x expression weight + face base x face weight.
Further, the constructing a transformed human face reconstruction model image according to the facial feature vector may further include the following steps: receiving input expression parameters, face parameters and corresponding camera parameters; generating a face image according to the expression parameters, the face parameters and the face reconstruction model image linear expression; and projecting the face image into a two-dimensional face basic image according to the camera parameters to generate a transformed face reconstruction model image. After obtaining the transformed face reconstruction model image, the face image may be further adjusted by corresponding parameters, for example: adjusting the expression and fine-tuning the face shape. Therefore, by means of the method, the overall prediction of the future hairstyle can be achieved. To better meet the needs of customers. And the face images of different angles can be provided according to the camera parameters input by the user, so that hair style demonstration images of various angles can be provided for customers to refer to. Illustratively, a projection matrix can be calculated according to camera parameters, an image model for adjusting the expression and the face shape is projected onto a 2D plane, a projection graph corresponding to the image model is calculated, and a transformed face reconstruction model image is obtained through rendering.
Example two
Fig. 2 is a flowchart illustrating a method for generating a hair style demonstration image according to a second embodiment of the present invention. In this embodiment, the mask image and the face reconstruction model image to be transformed are input to a hair style demonstration image coding-decoding model, and the optimization is specifically as follows: extracting image characteristics of a plurality of transformed face reconstruction model images with different angles; and inputting the image characteristics as parameters into a coding module in the hair style demonstration image coding-decoding model to obtain the hair style face fusion images at different angles.
Correspondingly, the method for generating a hair style demonstration image provided by the embodiment specifically includes:
and step 210, obtaining a mask image for designing a hairstyle and a face reconstruction model image to be transformed.
Step 220, calculating the cross region in the mask image and the face reconstruction model image to be transformed as a reference region.
And step 230, extracting image characteristics of the transformed face reconstruction model images from a plurality of different angles.
In this embodiment, hair style demonstration images from multiple angles may be provided for customer reference. For example, according to the method provided in the foregoing, the set camera parameters are used to generate transformed face reconstruction model images of multiple angles, the transformed face reconstruction model images of multiple angles may be input into the trained neural network model, and the image features of each angle may be extracted. Illustratively, a network of pre-trained VGGs 19 may be employed to derive the corresponding features.
Step 240, inputting the image features as parameters into an encoding module in the hair style demonstration image encoding-decoding model.
In this embodiment, the extracted image features may be directly input to the decoding module as parameters, without performing encoding again to extract features. By the method, the hair style images of a plurality of angles can be generated quickly, and all calculation work is not required to be accumulated in the coding-decoding model. For example, the corresponding features may be convolved into gamma and beta, which are then applied to the features of the decoded network hidden layer.
The specific implementation is described as follows:
features on different feature sizes were obtained from the VGG19 network (in this experiment, the input graph size was 768 × 768, and features on 6 sizes, 768 × 768, 384, 192 × 192, 96 × 96, 48 × 48, 24 × 24, respectively), and feature fusion was performed on the corresponding network feature layers.
For example, in a feature with a size of 24 × 24, the feature dimension of VGG19 is n × 512 × 24, the feature is first passed through two-dimensional convolution layers to obtain a corresponding gamma feature with a dimension of n × 1024 × 24, then the feature is passed through two other two-dimensional convolution layers to obtain a corresponding beta feature with a dimension of n × 1024 × 24, and at this time, the feature dimension of the decoding network is n × 1024 × 24, and after normalization by norm, the feature dimensions are unchanged, the three feature dimensions are consistent, and the obtained new feature is passed on to subsequent layers of the decoding network by the formula out = out (1 + gamma) + beta, and then feature fusion of 48 is performed, and then feature fusion of 768 is performed, so that the final generated graph is obtained.
I.e. out = out (1 + gamma) + beta
And step 250, inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image.
And step 260, acquiring an image of each reference region in the hair style human face fusion image, performing convolution high-frequency feature extraction on the image of the reference region, and judging the reliability of each reference region according to the convolution high-frequency feature.
And 270, calculating an average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold value.
The present embodiment adds the following steps: and calculating the times of generating the external chain file by using the dragged file, determining the external chain corresponding to the dragged file when the times exceed a time threshold, and using other folders in the corresponding external chain as recommended folders. The situation that the files cannot be recommended when the external link generated files are selected for the first time by dragging the files is avoided, appropriate and accurate folders can be recommended for the user to select, and the efficiency of sharing the terminal files is further improved.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an apparatus for generating a hair style demonstration image according to a third embodiment of the present invention, as shown in fig. 3, the apparatus includes:
the obtaining module 310 is configured to obtain a mask image for designing a hairstyle and a face reconstruction model image to be transformed;
a calculating module 320, configured to calculate a cross region in the mask image and the face reconstruction model image to be transformed, as a reference region;
the input module 330 is configured to input the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model, so as to obtain a hairstyle face fusion image;
the judging module 340 is configured to obtain an image of each reference region in the hair style human face fusion image, perform convolution high-frequency feature extraction on the image of the reference region, and judge the reliability of each reference region according to the convolution high-frequency feature;
and the module 350 is configured to calculate an average value of the reliabilities of all the reference regions, and when the average value is greater than a preset average value threshold, take the hair style face fusion image as a hair style demonstration image.
In the device for generating the hair style demonstration image provided by the embodiment, the model image is reconstructed by acquiring the mask image for designing the hair style and the face to be transformed; calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region; inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image; acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature; and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold. The method comprises the steps of fully extracting image characteristics of a human face and a hair style by utilizing a coding-decoding model, determining whether a fused image can show the image characteristics of an overlapping area or not according to convolution high-frequency characteristics of a fusion area after fusion, so that a generated hair style demonstration image can be more vivid, the condition of poor skin and hair fusion degree caused by too few new type sample images is avoided, and the hair style demonstration image close to the actual condition can be provided for a client to be referred.
On the basis of the above embodiments, the apparatus further includes:
and the adjusting module is used for adjusting the weight value of Feature loss in a loss function adopted by training in the hair style demonstration image coding-decoding model when the average value is smaller than a preset average value threshold.
On the basis of the foregoing embodiments, the obtaining module includes:
an image area calculation unit for calculating an image area of the hair based on the hair recognition neural network model;
and the image setting unit is used for setting the image area as a mask image for designing the hair style.
On the basis of the foregoing embodiments, the obtaining module includes:
the multiplying unit is used for setting the gray level of the pixels in the mask image to be 0 and multiplying the gray level of the pixels by the original image to obtain a face image;
the identification unit is used for identifying key points of the face image to obtain key points of the face image;
and the construction unit is used for constructing a face characteristic vector according to the key points of the face image and constructing a transformed face reconstruction model image according to the face characteristic vector.
On the basis of the above embodiments, the building unit includes:
a basic face shape constructing subunit, configured to construct a basic face shape according to the peripheral contour of the face in the facial feature vector;
the expression basic face construction subunit is used for constructing an expression basic face according to the organ feature points in the facial feature vector;
and the generating subunit is used for generating a three-dimensional facial model image according to the input expression weight and the face weight.
On the basis of the above embodiments, the construction unit further includes:
the receiving subunit is used for receiving the input expression parameters, face parameters and corresponding camera parameters;
the image generation subunit is used for generating a face image according to the expression parameters, the face parameters and the face reconstruction model image linear expression;
and the projection subunit is used for projecting the face image into a two-dimensional face basic image according to the camera parameters to generate a transformed face reconstruction model image.
On the basis of the above embodiments, the input module includes:
the extraction unit is used for extracting image characteristics of the transformed face reconstruction model images from a plurality of different angles;
and the input unit is used for inputting the image characteristics as parameters into a coding module in the hair style demonstration image coding-decoding model so as to obtain the hair style face fusion images at different angles.
The device for generating the hair style demonstration image provided by the embodiment of the invention can execute the method for generating the hair style demonstration image provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of a terminal according to a third embodiment of the present invention. Fig. 4 illustrates a block diagram of an exemplary terminal 12 suitable for use in implementing embodiments of the present invention. The terminal 12 shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 4, the terminal 12 is embodied in the form of a general purpose computing device. The components of the terminal 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Terminal 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by terminal 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache 32. The terminal 12 can further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
The terminal 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the terminal 12, and/or any devices (e.g., network card, modem, etc.) that enable the terminal 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the terminal 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with the other modules of the terminal 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the terminal 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes programs stored in the system memory 28 to perform various functional applications and data processing, such as implementing a method for generating a hair style presentation image provided by an embodiment of the present invention.
EXAMPLE five
The fifth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the method for generating a hair style demonstration image according to any one of the embodiments.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now be apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for generating a hair style demonstration image is characterized by comprising the following steps:
acquiring a mask image for designing a hairstyle and a face reconstruction model image to be transformed;
calculating a cross region in the mask image and the face reconstruction model image to be transformed as a reference region;
inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image;
acquiring an image of each reference area in the hair style face fusion image, performing convolution high-frequency feature extraction on the image of the reference area, and judging the credibility of each reference area according to the convolution high-frequency feature;
and calculating the average value of the credibility of all the reference areas, and taking the hair style face fusion image as a hair style demonstration image when the average value is larger than a preset average value threshold.
2. The method of claim 1, further comprising:
and when the average value is smaller than a preset average value threshold value, adjusting the weight value of Feature loss in a loss function adopted in training in the hair style demonstration image coding-decoding model.
3. The method of claim 1, wherein obtaining the mask image for designing the hairstyle comprises:
calculating an image area of the hair based on the hair recognition neural network model;
and setting the image area as a mask image for designing the hairstyle.
4. The method of claim 3, wherein obtaining the reconstructed model image of the face to be transformed comprises:
setting the gray level of pixels in the mask image as 0, and multiplying the gray level by the original image to obtain a face image;
identifying key points of the face image to obtain key points of the face image;
and constructing a facial feature vector according to the key points of the facial image, and constructing a transformed facial reconstruction model image according to the facial feature vector.
5. The method of claim 4, wherein said constructing a transformed face reconstruction model image from said facial feature vectors comprises:
constructing a basic face shape according to the peripheral outline of the face in the face feature vector;
constructing an expression basic face form according to the organ feature points in the facial feature vector;
and generating a human face three-dimensional model image according to the input expression weight and the face shape weight.
6. The method of claim 5, wherein said constructing a transformed face reconstruction model image from said facial feature vectors further comprises:
receiving input expression parameters, face parameters and corresponding camera parameters;
generating a face image according to the expression parameters, the face parameters and the face reconstruction model image linear expression;
and projecting the face image into a two-dimensional face basic image according to the camera parameters to generate a transformed face reconstruction model image.
7. The method according to claim 6, wherein the inputting the mask image and the face reconstruction model image to be transformed into a hair style demonstration image coding-decoding model comprises:
extracting image characteristics of a plurality of transformed face reconstruction model images with different angles;
and inputting the image characteristics as parameters into a coding module in the hair style demonstration image coding-decoding model to obtain the hair style face fusion images of different angles.
8. An apparatus for generating a hair style demonstration image, comprising:
the acquisition module is used for acquiring a mask image for designing a hairstyle and a face reconstruction model image to be transformed;
the calculation module is used for calculating a crossed region in the mask image and the face reconstruction model image to be transformed as a reference region;
the input module is used for inputting the mask image and the face reconstruction model image to be transformed into a hairstyle demonstration image coding-decoding model to obtain a hairstyle face fusion image;
the judging module is used for acquiring the image of each reference area in the hair style human face fusion image, extracting the convolution high-frequency characteristics of the image of the reference area and judging the reliability of each reference area according to the convolution high-frequency characteristics;
and the module is used for calculating the average value of the credibility of all the reference areas, and when the average value is larger than a preset average value threshold value, taking the hair style face fusion image as a hair style demonstration image.
9. A terminal, characterized in that the terminal comprises:
one or more processors;
a storage device to store one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a method of generating a hair style presentation image as claimed in any one of claims 1-7.
10. A storage medium containing computer executable instructions for performing a method of generating a hair style presentation image according to any one of claims 1 to 7 when executed by a computer processor.
CN202310272227.0A 2023-03-21 2023-03-21 Method, device, terminal and storage medium for generating hairstyle demonstration image Active CN115984426B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310272227.0A CN115984426B (en) 2023-03-21 2023-03-21 Method, device, terminal and storage medium for generating hairstyle demonstration image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310272227.0A CN115984426B (en) 2023-03-21 2023-03-21 Method, device, terminal and storage medium for generating hairstyle demonstration image

Publications (2)

Publication Number Publication Date
CN115984426A true CN115984426A (en) 2023-04-18
CN115984426B CN115984426B (en) 2023-07-04

Family

ID=85965192

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310272227.0A Active CN115984426B (en) 2023-03-21 2023-03-21 Method, device, terminal and storage medium for generating hairstyle demonstration image

Country Status (1)

Country Link
CN (1) CN115984426B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006017233A1 (en) * 2004-07-12 2006-02-16 Lehigh University Image fusion methods and apparatus
CA2845215A1 (en) * 2014-03-07 2015-09-07 The University Of British Columbia System and method for solving inverse imaging problems
KR20170025162A (en) * 2015-08-27 2017-03-08 연세대학교 산학협력단 Method and Apparatus for Transforming Facial Age on Facial Image
WO2019050808A1 (en) * 2017-09-08 2019-03-14 Pinscreen, Inc. Avatar digitization from a single image for real-time rendering
WO2022160701A1 (en) * 2021-01-29 2022-08-04 北京市商汤科技开发有限公司 Special effect generation method and apparatus, device, and storage medium
WO2022257456A1 (en) * 2021-06-10 2022-12-15 平安科技(深圳)有限公司 Hair information recognition method, apparatus and device, and storage medium
CN115601820A (en) * 2022-12-01 2023-01-13 思腾合力(天津)科技有限公司(Cn) Face fake image detection method, device, terminal and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006017233A1 (en) * 2004-07-12 2006-02-16 Lehigh University Image fusion methods and apparatus
CA2845215A1 (en) * 2014-03-07 2015-09-07 The University Of British Columbia System and method for solving inverse imaging problems
KR20170025162A (en) * 2015-08-27 2017-03-08 연세대학교 산학협력단 Method and Apparatus for Transforming Facial Age on Facial Image
WO2019050808A1 (en) * 2017-09-08 2019-03-14 Pinscreen, Inc. Avatar digitization from a single image for real-time rendering
WO2022160701A1 (en) * 2021-01-29 2022-08-04 北京市商汤科技开发有限公司 Special effect generation method and apparatus, device, and storage medium
WO2022257456A1 (en) * 2021-06-10 2022-12-15 平安科技(深圳)有限公司 Hair information recognition method, apparatus and device, and storage medium
CN115601820A (en) * 2022-12-01 2023-01-13 思腾合力(天津)科技有限公司(Cn) Face fake image detection method, device, terminal and storage medium

Also Published As

Publication number Publication date
CN115984426B (en) 2023-07-04

Similar Documents

Publication Publication Date Title
CN109902767B (en) Model training method, image processing device, model training apparatus, image processing apparatus, and computer-readable medium
CN108509915B (en) Method and device for generating face recognition model
KR102616010B1 (en) System and method for photorealistic real-time human animation
CN111050219A (en) Spatio-temporal memory network for locating target objects in video content
CN108961369A (en) The method and apparatus for generating 3D animation
US11282257B2 (en) Pose selection and animation of characters using video data and training techniques
WO2024051445A1 (en) Image generation method and related device
CN112950471A (en) Video super-resolution processing method and device, super-resolution reconstruction model and medium
Natarajan et al. Dynamic GAN for high-quality sign language video generation from skeletal poses using generative adversarial networks
US11650717B2 (en) Using artificial intelligence to iteratively design a user interface through progressive feedback
CN114708374A (en) Virtual image generation method and device, electronic equipment and storage medium
US20230051749A1 (en) Generating synthesized digital images utilizing class-specific machine-learning models
US11361467B2 (en) Pose selection and animation of characters using video data and training techniques
Yurtsever et al. Photorealism in driving simulations: Blending generative adversarial image synthesis with rendering
CN111753736A (en) Human body posture recognition method, device, equipment and medium based on packet convolution
CN115984426B (en) Method, device, terminal and storage medium for generating hairstyle demonstration image
US11915513B2 (en) Apparatus for leveling person image and operating method thereof
CN115311403A (en) Deep learning network training method, virtual image generation method and device
CN107220317B (en) Matching degree evaluation method, device, equipment and storage medium based on artificial intelligence
CN115775300A (en) Reconstruction method of human body model, training method and device of human body reconstruction model
CN114663937A (en) Model training and image processing method, medium, device and computing equipment
CN116030201B (en) Method, device, terminal and storage medium for generating multi-color hairstyle demonstration image
CN113610856A (en) Method and device for training image segmentation model and image segmentation
CN114092608A (en) Expression processing method and device, computer readable storage medium and electronic equipment
KR102437212B1 (en) Deep learning based method and apparatus for the auto generation of character rigging

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant