CN114565512A - Eyebrow shape deforming method and device, electronic equipment and readable storage medium - Google Patents

Eyebrow shape deforming method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114565512A
CN114565512A CN202210202616.1A CN202210202616A CN114565512A CN 114565512 A CN114565512 A CN 114565512A CN 202210202616 A CN202210202616 A CN 202210202616A CN 114565512 A CN114565512 A CN 114565512A
Authority
CN
China
Prior art keywords
eyebrow
vector
type
obtaining
image
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.)
Pending
Application number
CN202210202616.1A
Other languages
Chinese (zh)
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.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya 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 Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202210202616.1A priority Critical patent/CN114565512A/en
Publication of CN114565512A publication Critical patent/CN114565512A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The application provides an eyebrow shape deforming method and device, electronic equipment and a readable storage medium, and relates to the technical field of image processing. The method comprises the following steps: obtaining a first coding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong; determining a second eyebrow shape type; obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set, wherein the corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow shape types, and the transformation vector is used for changing one eyebrow shape type into another eyebrow shape type; superposing the target transformation vector and the first coding vector to obtain a second coding vector; a resulting image is generated from the second encoded vector. As such, eyebrow deformation can be achieved by changing the encoding vector.

Description

Eyebrow shape deforming method and device, electronic equipment and readable storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to an eyebrow shaping method, an eyebrow shaping device, an electronic apparatus, and a readable storage medium.
Background
When a face image is beautified or a cartoon-style image corresponding to the face image is generated, it is a very common requirement to adjust the shape of the current eyebrow in the face image to another shape. Therefore, how to deform the shape of the eyebrow is a technical problem that needs to be solved urgently by those skilled in the art.
Disclosure of Invention
The embodiment of the application provides an eyebrow shaping method, an eyebrow shaping device, an electronic device and a readable storage medium, which can realize eyebrow shaping by changing a coding vector.
The embodiment of the application can be realized as follows:
in a first aspect, an embodiment of the present application provides an eyebrow shaping method, where the method includes:
obtaining a first coding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong;
determining a second eyebrow shape type;
obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set, wherein the corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow shape types, and the transformation vector is used for changing one eyebrow shape type into another eyebrow shape type;
superposing the target transformation vector and the first coding vector to obtain a second coding vector;
and generating a result image according to the second coding vector.
In a second aspect, an embodiment of the present application provides an eyebrow shaping apparatus, including:
the device comprises a preprocessing module, a first encoding module and a second encoding module, wherein the preprocessing module is used for obtaining a first encoding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong;
the target type determining module is used for determining a second eyebrow shape type;
the information obtaining module is used for obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set, wherein the corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow shape types, and the transformation vector is used for changing one eyebrow shape type into another eyebrow shape type;
the processing module is used for superposing the target transformation vector and the first coding vector to obtain a second coding vector;
and the image generating module is used for generating a result image according to the second coding vector.
In a third aspect, the present application provides an electronic device, comprising a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor can execute the machine executable instructions to implement the eyebrow shaping method according to the foregoing embodiments.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the eyebrow shaping method according to the foregoing embodiments.
According to the eyebrow shape deforming method, the eyebrow shape deforming device, the electronic equipment and the readable storage medium, under the condition that a first eyebrow shape type and an expected second eyebrow shape type of eyebrows in an image to be processed are determined, transformation vectors in corresponding relations are converted according to the first eyebrow shape type, the second eyebrow shape type and the eyebrow shape type, and a target transformation vector is obtained; then, overlapping the target transformation vector with a first coding vector of the image to be processed to obtain a second coding vector; and finally generating a result image corresponding to the second coding vector. Thus, the coding vector with the changed eyebrow shape is obtained by changing the coding vector, and a result image with the changed eyebrow shape can be obtained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a block diagram of an electronic device according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart illustrating an eyebrow shaping method according to an embodiment of the present disclosure;
FIG. 3 is a second flowchart illustrating an eyebrow shaping method according to an embodiment of the present application;
FIG. 4 is a schematic of StyleGAN;
FIG. 5 is a flowchart illustrating one of the sub-steps included in step S104 in FIG. 3;
FIG. 6 is a schematic diagram of a support vector machine;
FIG. 7 is a second schematic flowchart of the sub-steps included in step S104 in FIG. 3;
fig. 8 is a third schematic flowchart of an eyebrow shaping method according to an embodiment of the present application;
FIG. 9 is a schematic block diagram of an eyebrow shaping apparatus according to an embodiment of the present application;
FIG. 10 is a second schematic block diagram of an eyebrow shaping apparatus according to an embodiment of the present application;
fig. 11 is a third schematic block diagram of an eyebrow shaping apparatus according to an embodiment of the present application.
Icon: 100-an electronic device; 110-a memory; 120-a processor; 130-a communication unit; 200-brow deforming means; 201-a relationship establishing module; 202-a model obtaining module; 210-a pre-processing module; 220-target type determination module; 230-an information obtaining module; 240-a processing module; 250-image generation module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It is noted that relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments and features of the embodiments described below can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a block diagram of an electronic device 100 according to an embodiment of the present disclosure. The electronic device 100 may be, but is not limited to, a smart phone, a computer, a server, etc. The electronic device 100 may include a memory 110, a processor 120, and a communication unit 130. The elements of the memory 110, the processor 120 and the communication unit 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 110 is used to store programs or data. The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 is used to read/write data or programs stored in the memory 110 and perform corresponding functions. For example, the memory 110 stores the eyebrow shaping device 200, and the eyebrow shaping device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware (firmware). The processor 120 executes various functional applications and data processing, i.e., implementing the eyebrow shaping method in the embodiment of the present application, by running software programs and modules stored in the memory 110, such as the eyebrow shaping apparatus 200 in the embodiment of the present application.
The communication unit 130 is used for establishing a communication connection between the electronic apparatus 100 and another communication terminal via a network, and for transceiving data via the network.
It should be understood that the structure shown in fig. 1 is only a schematic structural diagram of the electronic device 100, and the electronic device 100 may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 2, fig. 2 is a schematic flow chart of an eyebrow shaping method according to an embodiment of the present disclosure. The method may be applied to the electronic device 100 described above. The detailed procedure of the eyebrow shaping method is described in detail below. In this embodiment, the eyebrow shaping method may include steps S110 to S150.
Step S110, obtain a first coding vector of an image to be processed and a first eyebrow style to which eyebrows in the image to be processed belong.
In this embodiment, the image to be processed is an image that needs to be changed at least in an eyebrow shape, and the image to be processed may be an image selected by a user or an image designated by other devices, and may be specifically set in combination with actual requirements. The first encoding vector is a vector representation of the image to be processed. The first eyebrow type of the eyebrow in the image to be processed can be obtained by performing eyebrow shape recognition on the image to be processed. For example, by identifying and determining that the eyebrow shape in the image to be processed is a character eyebrow, it can be determined that the first eyebrow shape type is a character eyebrow.
Step S120, determining a second eyebrow style.
The second brow type is the brow type to which a change is desired. For example, if the eyebrow shape is expected to change from a straight eyebrow to a willow-leaf eyebrow, the willow-leaf eyebrow is the second eyebrow shape. The second brow shape type may be manually selected by the user, for example, images including various brow shape types are displayed to the user, and the user may select one brow shape type as the second brow shape type according to the requirement. The second eyebrow shape type may also be determined in other ways, for example, which eyebrow shape is suitable for analysis in combination with a face image, and then the suitable eyebrow shape is used as the second eyebrow shape type. It is understood that the above-mentioned determination manner of the second brow shape type is only an example, and the second brow shape type may be determined by other methods.
Step S130, obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set.
The corresponding relationship set may be obtained by the electronic device 100 in advance, or obtained by other devices in advance, and may be determined specifically by combining actual requirements. The set of correspondence relationships includes at least one correspondence relationship. One corresponding relation comprises two eyebrow types and a transformation vector corresponding to the two eyebrow types, wherein the transformation vector is used for changing one of the two eyebrow types towards the other of the two eyebrow types, and the changed eyebrow is close to the other eyebrow type, namely, the transformation vector is used for changing the one eyebrow type into the other eyebrow type.
It will be appreciated that the two brow types may vary from one another, and thus the two brow types may correspond to two variation vectors. Optionally, one of the corresponding relationships may include a change vector, that is, one of the corresponding relationships includes a change vector from the brow shape a to the brow shape B, and the other of the corresponding relationships includes a change vector from the brow shape B to the brow shape a.
For example, there are two eyebrow types corresponding to the two correspondence relationships: the transformation vector a in one corresponding relation is used for changing the eyebrow in one line towards the willow eyebrow in the other corresponding relation, and the transformation vector b in the other corresponding relation is used for changing the willow eyebrow in one line.
Optionally, the type of the eyebrow before the change (i.e. the base eyebrow type) and the type of the eyebrow after the change in the correspondence relationship may be determined based on a first preset rule, so as to facilitate subsequent search for the required change vector. For example, characters are used for explaining which eyebrow type is the eyebrow type before change, and which eyebrow type is the eyebrow type after change; or the first eyebrow shape type in the default corresponding relation is the eyebrow shape type before change, and the second eyebrow shape type is the eyebrow shape type after change.
Optionally, one corresponding relationship may also include two variation vectors, and the two variation vectors may be determined based on a second preset rule, where the two variation vectors are respectively used to change which eyebrow shape type into which eyebrow shape type, so as to facilitate subsequent search for a required variation vector. For example, the default first change vector is used to change the first brow shape type in the corresponding relationship to the second brow shape type in the corresponding relationship, and the default second change vector is used to change the second brow shape type in the corresponding relationship to the first brow shape type in the corresponding relationship.
And under the condition that the first eyebrow form type to which the current eyebrow belongs and the second eyebrow form type expected to be changed are determined, combining the conditions to obtain the target transformation vector from the corresponding relation. Wherein the target transform vector is used to transform the first brow shape type to the second brow shape type.
How to obtain the target transform vector is exemplified below.
For example, each corresponding relationship in the corresponding relationship set includes a variation vector, a first eyebrow shape type in the default corresponding relationship is an eyebrow shape type before variation, and a second eyebrow shape type in the default corresponding relationship is an eyebrow shape type after variation. The plurality of corresponding relations included in the corresponding relation set are: the top → the top of the willow corresponds to the variation vector a (i.e. the variation vector a is used to convert the top into the top of the willow, and so on); willow leaf eyebrow → Chinese eyebrow corresponds to variation vector b; the header → the corresponding variation vector c of the natural header; the eyebrows in powder indigo → the eyebrows in a Chinese character correspond to the variation vector d; willow leaf eyebrow → natural eyebrow corresponds to the variation vector e; meadow eyebrow → willow leaf eyebrow corresponding variation vector f … …
If the first eyebrow form type to which the current eyebrow belongs is a character eyebrow and the second eyebrow form type expected to be changed is a natural eyebrow, then the corresponding relation corresponding to the search condition can be found from the corresponding relation included in the corresponding relation set according to the search condition that the character eyebrow is expected to be changed into the natural eyebrow: the header → the header of powder corresponds to the transformation vector c, and the transformation vector c for transforming the header of powder into the header of powder in the corresponding relationship is taken as the target transformation vector.
Step S140, superimposing the target transformation vector with the first encoding vector to obtain a second encoding vector.
In the case where the target transform vector is determined, the target transform vector may be added to the first code vector using a parallelogram rule or a triangle rule, and the resulting calculation result may be used as the second code vector.
And S150, generating a result image according to the second coding vector.
According to the embodiment of the application, the coding vector with the changed eyebrow shape is obtained by changing the coding vector, and then the result image with the changed eyebrow shape can be obtained.
Referring to fig. 3, fig. 3 is a second schematic flow chart of an eyebrow shaping method according to an embodiment of the present application. In this embodiment, before step S110, the method may further include step S101 to step S104.
Step S101, a data set is obtained.
The data set comprises a plurality of pieces of sample data, and each piece of sample data comprises a coding vector of a sample image and the sample image.
As a possible implementation manner, the encoding vectors of the sample image may be acquired first, and then the encoding vectors are input into the image generation model, so as to obtain the sample image corresponding to each encoding vector. For example, the image generation model includes StyleGAN shown in fig. 4, and Latent z shown in fig. 4 represents an encoding vector. As such, the dataset can be obtained using StyleGAN. Wherein the parameters in the image generation model are preset.
Step S102, obtaining the eyebrow shape type of each sample image.
The eyebrow types of the eyebrows in the sample image can be obtained through manual labeling or an eyebrow identification algorithm. The eyebrow type corresponding to the data set may include: the eyebrow type that corresponds of data set is the eyebrow type that eyebrow in the sample image in the data set belongs to.
Step S103, dividing the data set into a plurality of sub data sets according to the eyebrow type of each sample image.
Wherein each subdata set corresponds to an eyebrow type.
And step S104, obtaining the corresponding relation set according to the plurality of sub data sets and the respective corresponding eyebrow types.
And obtaining a conversion relation between the eyebrow types through analysis according to the plurality of sub data sets and the corresponding eyebrow types, thereby obtaining the corresponding relation set.
Optionally, in this embodiment, two eyebrow types included in at least one corresponding relationship of the corresponding relationship set belong to the eyebrow type corresponding to the data set. For example, the eyebrow type corresponding to the data set may include: the eyebrows include one eyebrow, willow leaf eyebrow and natural eyebrow, and the corresponding relation includes two eyebrow types selected from the above three eyebrow types. Referring to fig. 5, fig. 5 is a flowchart illustrating one of the sub-steps included in step S104 in fig. 3. In this embodiment, step S104 may include sub-steps S1041 to S1043.
Substep S1041, determining at least one data group from the plurality of sub data sets.
Wherein, each data group comprises two subdata sets corresponding to different eyebrow types. Optionally, at least one data group may be determined by combining the plurality of sub data sets in pairs. For example, if the plurality of sub data sets are sub data sets 1, 2, and 3, the sub data sets 1 and 2 may be used as a data group, the sub data sets 1 and 3 may be used as a data group, and the sub data sets 2 and 3 may be used as a data group. Thus, the coding vectors between two different categories are convenient to obtain, and the subsequent conversion between two different eyebrow types is convenient.
In the substep S1042, for each data group, a partition vector corresponding to the data group is obtained according to the coding vectors in the two subdata sets of the data group.
Wherein the segmentation vectors are used for segmenting the coding vectors in the data group according to the eyebrow type. For example, a data set includes: the sub data set 1 corresponding to the willow leaf header and the sub data set 2 corresponding to the first header are divided into two types according to the willow leaf header and the first header by the partition vector corresponding to the data group.
Optionally, as a possible implementation manner, a maximum segmentation Vector between two different eyebrow categories may be obtained as the segmentation Vector by a Support Vector Machine (SVM) based on the encoding vectors in the two sub data sets in the data group. The support vector machine is a generalized linear classifier (generalized linear classifier) for binary classification of data in a supervised learning (supervised learning) manner, and a decision boundary of the support vector machine is a maximum-margin hyperplane (maximum-margin hyperplane) for solving a learning sample.
As shown in fig. 6, a partition vector for partitioning the code vector corresponding to the willow leaf header and the code vector corresponding to the header may be obtained by a support vector machine according to the code vector in the subdata set 1 corresponding to the willow leaf header and the code vector in the subdata set 2 corresponding to the header.
Other ways of obtaining the segmentation vectors corresponding to the data sets may also be used. For example, a model may be designed based on the encoding vector to learn the mapping relationship between different types, thereby obtaining the segmentation vector.
In the sub-step S1043, for each data group, according to the segmentation vector corresponding to the data group and the data group, a first transformation vector corresponding to the data group is obtained, and a first corresponding relationship between the first transformation vector and two eyebrow shapes corresponding to the data group is stored.
Under the condition of obtaining the segmentation vectors, the segmentation vectors of a data group and the coding vectors corresponding to two eyebrow types in the data group can be combined, transformation vectors which can be used for converting the eyebrow types are obtained through analysis, and the transformation vectors are used as first transformation vectors corresponding to the data group. Then, the first corresponding relation between the first transformation vector and the two eyebrow types corresponding to the data set is stored as the corresponding relation in the corresponding relation set.
The first transformation vector corresponding to the data set is used for converting one eyebrow type in the data set into another eyebrow type in the data set. The two first transformation vectors corresponding to the two eyebrow types of the data set are opposite in direction, and can be the same or different in size, and the size can be set by combining with actual conditions. For example, the eyebrow types corresponding to a data set are a straight eyebrow and a willow-leaf eyebrow, the first transformation vector a1 is used for converting the straight eyebrow into the willow-leaf eyebrow, the first transformation vector a2 is used for converting the willow-leaf eyebrow into the straight eyebrow, and the first transformation vector a1 and the first transformation vector a2 are opposite in direction and may be the same or different in size.
Alternatively, as a possible implementation, in the case of obtaining a divided vector of one data group, a vertical vector perpendicular to the divided vector may be calculated. The size of the vertical vector may be 1, that is, a unit vector, or may be a vector of another size. Then, the first transformation vector capable of realizing type conversion is obtained according to the vertical vector and the data set. For example, by adjusting the size of the vertical vector, a new encoding vector obtained by superimposing the adjusted vertical vector on the encoding vector in one sub-data set of the data set is close to the encoding vector in the other sub-data set of the data set.
Optionally, in this embodiment, two eyebrow types in at least one corresponding relationship of the corresponding relationship set include a new eyebrow type different from the eyebrow type corresponding to the data set. Referring to fig. 7, fig. 7 is a second flowchart illustrating the sub-steps included in step S104 in fig. 3. In this embodiment, after the sub-step S1043, the step S104 may further include a sub-step S1044.
And a substep S1044 of obtaining at least one second corresponding relationship according to each obtained first transformation vector and the sub data sets corresponding to the two corresponding eyebrow types.
And the two eyebrow types of the second corresponding relation comprise at least one new eyebrow type, and the new eyebrow type is different from the eyebrow type corresponding to the data set.
Optionally, as a possible implementation manner, one of the eyebrow types in the second correspondence relationship belongs to the eyebrow type corresponding to the data set, and the other eyebrow type is a new eyebrow type.
Optionally, for each first transformation vector, calculating a product corresponding to the product of the first transformation vector and a coefficient value; then, obtaining a new coding vector after the product is superposed on the coding vector of the basic eyebrow shape type (i.e. the eyebrow shape type before adjustment) corresponding to the first transformation vector; under the condition that the eyebrow shape effect corresponding to the newly added coding vector is better and the eyebrow shape types corresponding to the data set have different appearances, the product corresponding to the product of the first transformation vector and a coefficient value can be used as a second transformation vector, an eyebrow shape type corresponding to the newly added coding vector is newly added as a new eyebrow shape type, and then the second transformation vector, the basic eyebrow shape type and the new eyebrow shape type are used as a second corresponding relation. Then, the coefficient values can be continuously adjusted to obtain more new eyebrow types. Wherein the coefficient value can be 0-1, 1-infinity.
And obtaining a second transformation vector for type conversion between the new eyebrow shape type and other eyebrow shapes in the data set except for the basic eyebrow shape type corresponding to the new eyebrow shape type by the way of obtaining the segmentation vector and the first transformation vector for each new eyebrow shape type, and storing the corresponding second corresponding relation.
Optionally, as another possible implementation manner, both eyebrow types in one second correspondence are new eyebrow types.
Optionally, a second corresponding relationship corresponding to the two new eyebrow shapes can be obtained by obtaining the segmentation vector and the first transformation vector according to the new added coding vectors corresponding to the various new types obtained in the above manner. That is, according to the second correspondence, conversion between new eyebrow types can be realized.
In this way, more categories can be calculated than the existing known eyebrow shapes, namely, eyebrow shape templates can be added, and the workload is low.
Referring to fig. 8, fig. 8 is a third schematic flow chart of an eyebrow shaping method according to an embodiment of the present application. To ensure the subsequent eyebrow shaping effect based on the coding vector, in this embodiment, the method may further include step S104.
And step S104, obtaining a coding model obtained based on the data set.
Wherein the coding model may be trained by the electronic device 100 or other devices according to the data set. Optionally, when the corresponding relationship set includes a new eyebrow shape type, the new coding vector and image corresponding to the new eyebrow shape type may also be used as data used in training the coding model.
The input of the coding model is a real picture, and the output is a coding vector; the coding vector generates an image consistent with the real picture through the image generation model, namely, the coding model can generate a coding vector displayed in the image generation model by the real picture, and then the control change can be carried out on the real picture according to the coding vector.
And under the condition that eyebrow deformation is required, the to-be-processed image can be coded by utilizing the coding model to obtain the first coding vector. Then, a first eyebrow shape type to which the eyebrows in the image to be processed currently belong and a second eyebrow shape type to which the eyebrows are expected to be changed can be obtained, and then a target transformation vector for changing the first eyebrow shape type to the second eyebrow shape type is obtained from the corresponding relation set. Then, the target transform vector is superimposed with the first encoding vector, and the obtained modified vector is used as a second encoding vector. And finally, inputting the second coding vector into the image generation model to obtain a result image.
Optionally, as a possible implementation manner, the image to be processed and the sample image are both face images. Therefore, the eyebrow shape can be changed by directly controlling the face image, and the deformation speed is high.
In order to perform the corresponding steps in the above embodiments and various possible manners, an implementation manner of the eyebrow shaping apparatus 200 is given below, and optionally, the eyebrow shaping apparatus 200 may adopt the device structure of the electronic device 100 shown in fig. 1. Further, referring to fig. 9, fig. 9 is a block diagram of an eyebrow shaping apparatus 200 according to an embodiment of the present disclosure. It should be noted that the basic principle and the technical effects of the eyebrow shaping device 200 provided in this embodiment are the same as those of the above embodiment, and for the sake of brief description, no part of this embodiment is mentioned, and reference may be made to the corresponding contents in the above embodiment. The eyebrow shaping apparatus 200 may include: a preprocessing module 210, an object type determining module 220, an information obtaining module 230, a processing module 240, and an image generating module 250.
The preprocessing module 210 is configured to obtain a first coding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong.
The target type determining module 220 is configured to determine a second eyebrow type;
the information obtaining module 230 is configured to obtain a target transformation vector according to the first brow shape type, the second brow shape type, and a preset corresponding relationship set. The corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow types, and the transformation vector is used for changing one eyebrow type into another eyebrow type.
The processing module 240 is configured to superimpose the target transform vector and the first coding vector to obtain a second coding vector.
The image generating module 250 is configured to generate a result image according to the second encoding vector.
Referring to fig. 10, fig. 10 is a second block diagram of an eyebrow shaping apparatus 200 according to an embodiment of the present application. Optionally, in this embodiment, the eyebrow shaping apparatus 200 may further include a relationship establishing module 201. The relationship establishing module 201 is configured to generate and store the corresponding relationship set.
The relationship establishing module 201 is specifically configured to: obtaining a data set, wherein the data set comprises a plurality of pieces of sample data, and each piece of sample data comprises a coding vector of a sample image and the sample image; obtaining the eyebrow shape type of each sample image; dividing the data set into a plurality of sub data sets according to the eyebrow type of each sample image, wherein each sub data set corresponds to one eyebrow type; and obtaining the corresponding relation set according to the plurality of sub data sets and the respective corresponding eyebrow types.
Referring to fig. 11, fig. 11 is a third block diagram of an eyebrow shaping apparatus 200 according to a third embodiment of the present disclosure. Optionally, in this embodiment, the eyebrow shaping apparatus 200 further includes a model obtaining module 202.
The model obtaining module 202 is configured to obtain a coding model obtained based on the data set. Wherein the coding model is trained from the data set.
Alternatively, the modules may be stored in the form of software or Firmware (Firmware) in the memory 110 shown in fig. 1 or in an Operating System (OS) of the display device 100, and may be executed by the processor 120 in fig. 1. Meanwhile, data, codes of programs, and the like required to execute the above-described modules may be stored in the memory 110.
The embodiment of the application also provides a readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the eyebrow shaping method.
To sum up, the embodiments of the present application provide an eyebrow shape deforming method, apparatus, electronic device, and readable storage medium, where in a case where a first eyebrow shape type and an expected second eyebrow shape type of an eyebrow in an image to be processed are determined, a target transformation vector is obtained according to a transformation vector in a corresponding relationship corresponding to the first eyebrow shape type, the second eyebrow shape type, and the eyebrow shape type transformation; then, overlapping the target transformation vector with a first coding vector of the image to be processed to obtain a second coding vector; and finally generating a result image corresponding to the second coding vector. Thus, the coding vector with the changed eyebrow shape is obtained by changing the coding vector, and a result image with the changed eyebrow shape can be obtained.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The foregoing is illustrative of only alternative embodiments of the present application and is not intended to limit the present application, which may be modified or varied by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A method of eyebrow shaping, comprising:
obtaining a first coding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong;
determining a second eyebrow shape type;
obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set, wherein the corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow shape types, and the transformation vector is used for changing one eyebrow shape type into another eyebrow shape type;
superposing the target transformation vector and the first coding vector to obtain a second coding vector;
and generating a result image according to the second coding vector.
2. The method of claim 1, further comprising:
obtaining a data set, wherein the data set comprises a plurality of pieces of sample data, and each piece of sample data comprises a coding vector of a sample image and the sample image;
obtaining the eyebrow shape type of each sample image;
dividing the data set into a plurality of sub data sets according to the eyebrow type of each sample image, wherein each sub data set corresponds to one eyebrow type;
and obtaining the corresponding relation set according to the plurality of sub data sets and the respective corresponding eyebrow types.
3. The method of claim 2, wherein two eyebrow types included in at least one correspondence belong to an eyebrow type corresponding to the data set, and wherein obtaining the set of correspondence according to the plurality of sub data sets and the respective corresponding eyebrow types comprises:
determining at least one data group according to the plurality of sub data sets, wherein each data group comprises two sub data sets corresponding to different eyebrow types;
aiming at each data group, obtaining a partition vector corresponding to the data group according to the coding vectors in the two subdata sets of the data group, wherein the partition vector is used for partitioning the coding vectors in the data group according to the eyebrow type;
and aiming at each data group, obtaining a first transformation vector corresponding to the data group according to the segmentation vector corresponding to the data group and the data group, and storing a first corresponding relation between the first transformation vector and two eyebrow types corresponding to the data group.
4. The method of claim 3, wherein obtaining the first transformation vector corresponding to the data set according to the segmentation vector corresponding to the data set and the data set comprises:
calculating a vertical vector perpendicular to the divided vector;
and obtaining the first transformation vector according to the vertical vector and the data set.
5. The method of claim 3, wherein obtaining the partition vector corresponding to the data group according to the coding vectors in the two subdata sets of the data group comprises:
and obtaining the segmentation vectors through a support vector machine based on the coding vectors in the two subdata sets in the data group.
6. The method of claim 3, wherein obtaining the corresponding set of relationships from the plurality of sub data sets and respective corresponding brow types further comprises:
and obtaining at least one second corresponding relation according to the obtained first transformation vectors and the sub data sets corresponding to the two corresponding eyebrow types, wherein the two eyebrow types of the second corresponding relation comprise at least one new eyebrow type, and the new eyebrow type is different from the eyebrow type corresponding to the data set.
7. The method according to any one of claims 2-6, further comprising:
obtaining a coding model obtained based on the data set, wherein the coding model is obtained by training according to the data set;
the obtaining a first encoding vector of an image to be processed comprises:
and coding the image to be processed by using the coding model to obtain the first coding vector.
8. The method of claim 7, wherein generating a resulting image from the second encoded vector comprises:
and inputting the second coding vector into an image generation model to obtain the result image, wherein the data set is obtained based on the image generation model.
9. The method of claim 8, wherein the image generation model comprises StyleGAN, and the image to be processed and the sample image are human face images.
10. An eyebrow shaping device, comprising:
the device comprises a preprocessing module, a first encoding module and a second encoding module, wherein the preprocessing module is used for obtaining a first encoding vector of an image to be processed and a first eyebrow type to which eyebrows in the image to be processed belong;
the target type determining module is used for determining a second eyebrow shape type;
the information obtaining module is used for obtaining a target transformation vector according to the first eyebrow shape type, the second eyebrow shape type and a preset corresponding relation set, wherein the corresponding relation set comprises at least one corresponding relation, the corresponding relation comprises a transformation vector and two eyebrow shape types, and the transformation vector is used for changing one eyebrow shape type into another eyebrow shape type;
the processing module is used for superposing the target transformation vector and the first coding vector to obtain a second coding vector;
and the image generation module is used for generating a result image according to the second coding vector.
11. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor to implement the brow deformation method of any one of claims 1-9.
12. A readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the eyebrow shaping method according to any one of claims 1 to 9.
CN202210202616.1A 2022-03-03 2022-03-03 Eyebrow shape deforming method and device, electronic equipment and readable storage medium Pending CN114565512A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210202616.1A CN114565512A (en) 2022-03-03 2022-03-03 Eyebrow shape deforming method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210202616.1A CN114565512A (en) 2022-03-03 2022-03-03 Eyebrow shape deforming method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114565512A true CN114565512A (en) 2022-05-31

Family

ID=81717017

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210202616.1A Pending CN114565512A (en) 2022-03-03 2022-03-03 Eyebrow shape deforming method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114565512A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110111247A (en) * 2019-05-15 2019-08-09 浙江商汤科技开发有限公司 Facial metamorphosis processing method, device and equipment
CN110889381A (en) * 2019-11-29 2020-03-17 广州华多网络科技有限公司 Face changing method and device, electronic equipment and storage medium
WO2020056901A1 (en) * 2018-09-20 2020-03-26 北京字节跳动网络技术有限公司 Method and device for processing image
KR20200080577A (en) * 2018-12-27 2020-07-07 한국과학기술연구원 Device for providing application to edit image and method for transforming face in image performed by the same device
CN113689325A (en) * 2021-07-12 2021-11-23 深圳数联天下智能科技有限公司 Method for digitizing beautiful eyebrows, electronic device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020056901A1 (en) * 2018-09-20 2020-03-26 北京字节跳动网络技术有限公司 Method and device for processing image
KR20200080577A (en) * 2018-12-27 2020-07-07 한국과학기술연구원 Device for providing application to edit image and method for transforming face in image performed by the same device
CN110111247A (en) * 2019-05-15 2019-08-09 浙江商汤科技开发有限公司 Facial metamorphosis processing method, device and equipment
CN110889381A (en) * 2019-11-29 2020-03-17 广州华多网络科技有限公司 Face changing method and device, electronic equipment and storage medium
WO2021103698A1 (en) * 2019-11-29 2021-06-03 广州华多网络科技有限公司 Face swapping method, device, electronic apparatus, and storage medium
CN113689325A (en) * 2021-07-12 2021-11-23 深圳数联天下智能科技有限公司 Method for digitizing beautiful eyebrows, electronic device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘祥楼;杨龙;孙悦;: "基于语义新型眼部特征的混合参数模型构建", 光学仪器, no. 06, 15 December 2014 (2014-12-15) *

Similar Documents

Publication Publication Date Title
US11967151B2 (en) Video classification method and apparatus, model training method and apparatus, device, and storage medium
CN109816589B (en) Method and apparatus for generating cartoon style conversion model
US20230237841A1 (en) Occlusion Detection
US10742990B2 (en) Data compression system
CN113205040A (en) Face image processing method and device and electronic equipment
WO2023035531A1 (en) Super-resolution reconstruction method for text image and related device thereof
CN113379627A (en) Training method of image enhancement model and method for enhancing image
JP7337203B2 (en) Character generation model training method, character generation method, apparatus and equipment
CN113591566A (en) Training method and device of image recognition model, electronic equipment and storage medium
JP2023039892A (en) Training method for character generation model, character generating method, device, apparatus, and medium
CN111741329B (en) Video processing method, device, equipment and storage medium
CN111340101A (en) Stability evaluation method and device, electronic equipment and computer readable storage medium
CN105580050A (en) Providing control points in images
CN115147261A (en) Image processing method, device, storage medium, equipment and product
CN115222845A (en) Method and device for generating style font picture, electronic equipment and medium
CN114581918A (en) Text recognition model training method and device
CN112669244A (en) Face image enhancement method and device, computer equipment and readable storage medium
CN114565512A (en) Eyebrow shape deforming method and device, electronic equipment and readable storage medium
CN116485944A (en) Image processing method and device, computer readable storage medium and electronic equipment
CN115546554A (en) Sensitive image identification method, device, equipment and computer readable storage medium
CN114926658A (en) Picture feature extraction method and device, computer equipment and readable storage medium
CN112966150A (en) Video content extraction method and device, computer equipment and storage medium
CN113822117A (en) Data processing method, data processing equipment and computer readable storage medium
CN114650421A (en) Video processing method and device, electronic equipment and storage medium
CN113393545A (en) Image animation processing method and device, intelligent device and storage medium

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