WO2023040813A1 - 人脸图像处理方法、装置、设备及介质 - Google Patents

人脸图像处理方法、装置、设备及介质 Download PDF

Info

Publication number
WO2023040813A1
WO2023040813A1 PCT/CN2022/118356 CN2022118356W WO2023040813A1 WO 2023040813 A1 WO2023040813 A1 WO 2023040813A1 CN 2022118356 W CN2022118356 W CN 2022118356W WO 2023040813 A1 WO2023040813 A1 WO 2023040813A1
Authority
WO
WIPO (PCT)
Prior art keywords
feature
makeup
mean
variance
matrix
Prior art date
Application number
PCT/CN2022/118356
Other languages
English (en)
French (fr)
Inventor
孙敬娜
陈培滨
吕月明
Original Assignee
北京字跳网络技术有限公司
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 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023040813A1 publication Critical patent/WO2023040813A1/zh

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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular to a face image processing method, device, equipment and medium.
  • the makeup transfer of face images is more common, for example, the makeup is transferred between face images of different makeup styles, or the makeup of face images with makeup is transferred to face images without makeup first class.
  • the makeup image area in the makeup face image is segmented, for example, the eye shadow image area, the blush image area, etc. in the makeup face image are segmented, and further, the segmented makeup The image area is aligned to the original face image of the makeup to be transferred based on grid alignment, so as to realize the transfer of makeup in the original face image.
  • the segmented makeup image area is limited by the face posture and face shape in the makeup face image, which leads to the loss of makeup information in the original face image after being fused into the original face image.
  • the fusion effect is not natural enough.
  • the present disclosure provides a face image processing method, device, equipment and medium, which realize the refined transfer of makeup between images, and based on each face position The corresponding makeup migration is carried out, which improves the robustness of makeup migration.
  • An embodiment of the present disclosure provides a face image processing method, the method comprising: acquiring a first feature map and a second feature map of the current layer, and generating multiple images corresponding to multiple face parts according to the first feature map.
  • original makeup feature areas generate a plurality of reference makeup feature areas corresponding to the plurality of facial parts according to the second feature map; perform makeup migration on each of the original makeup feature areas and corresponding reference makeup feature areas Computing to obtain a plurality of candidate makeup feature regions; splicing the plurality of candidate makeup feature regions to generate a target feature map, and judging whether the target feature map satisfies a preset decoding condition; if the preset decoding condition is met , then decode the target feature map to obtain the target face image.
  • An embodiment of the present disclosure also provides a face image processing device, the device includes: a first generation module, configured to obtain a first feature map and a second feature map of the current layer, and generate and A plurality of original makeup feature regions corresponding to a plurality of facial parts; a second generation module, configured to generate a plurality of reference makeup characteristic regions corresponding to the plurality of facial parts according to the second feature map; an acquisition module, using Performing makeup migration calculation on each of the original makeup feature regions and corresponding reference makeup feature regions to obtain multiple candidate makeup feature regions; a splicing module for splicing the multiple candidate makeup feature regions to generate a target feature map A judging module, used to judge whether the target feature map meets a preset decoding condition; a decoding module, used to decode the target feature map to obtain a target face image when the preset decoding condition is met .
  • An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; and the processor, for reading the instruction from the memory.
  • the instructions can be executed, and the instructions are executed to implement the face image processing method provided by the embodiment of the present disclosure.
  • the embodiment of the present disclosure also provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute the face image processing method provided by the embodiment of the present disclosure.
  • the face image processing scheme obtains the first feature map and the second feature map of the current layer, and generates multiple original makeup feature regions corresponding to multiple face parts according to the first feature map, and further, Each original makeup feature area and the corresponding reference makeup feature area perform makeup migration calculations to obtain multiple candidate makeup feature areas, splicing multiple candidate makeup feature areas to generate a target feature map, and judging whether the target feature map meets the preset requirements.
  • Decoding condition when the preset decoding condition is satisfied, the target feature map is decoded to obtain the target face image. In this way, the refined transfer of makeup between images is realized, and the corresponding makeup transfer is performed based on each facial part, which improves the robustness of makeup transfer.
  • FIG. 1 is a schematic flow diagram of a face image processing method provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of a face image processing logic provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic flow diagram of another face image processing method provided by an embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a face image processing scene provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic flow diagram of another face image processing method provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic diagram of another face image processing scenario provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic flow diagram of another face image processing method provided by an embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of an initial mean feature map generation scenario provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of an initial variance feature map generation scenario provided by an embodiment of the present disclosure.
  • FIG. 10 is a schematic diagram of a first mean feature matrix generation scenario provided by an embodiment of the present disclosure.
  • FIG. 11 is a schematic structural diagram of a face image processing device provided by an embodiment of the present disclosure.
  • Fig. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • the present disclosure proposes a makeup information migration network based on convolutional networks.
  • makeup information can be progressively learned from multiple layers, and different levels of makeup information It is adaptively fused with the original face image, and based on the convolutional network, the migration of makeup information based on the image feature dimension is realized, which improves the natural sense of makeup migration.
  • Fig. 1 is a schematic flow chart of a face image processing method provided by an embodiment of the present disclosure, the method can be executed by a face image processing device, wherein the device can be implemented by software and/or hardware, and generally can be integrated in electronic equipment . As shown in Figure 1, the method includes:
  • Step 101 acquire the first feature map and the second feature map of the current layer, and generate multiple original makeup feature regions corresponding to multiple facial parts according to the first feature map.
  • the migration of makeup information between two images is performed layer by layer, wherein the makeup migration between each layer can be progressive.
  • the calculation of makeup migration between layers can be regarded as the calculation of a multi-layer pyramid, and the results of multi-layer makeup migration are transmitted in the form of a pyramid, thus taking into account multiple granularities between two images
  • the fusion of makeup information can greatly improve the natural sense of the fusion of makeup information. Even if the face images between the two images have a large difference in posture, it can be compensated through layer-by-layer fusion calculations. Thus, Improved the robustness of makeup transfer.
  • the original image and the reference image corresponding to the makeup migration request are obtained, and an instruction for performing multi-layer makeup migration calculation on the original image and the reference image is generated, so as to perform multi-layer makeup according to the instruction
  • the calculation of migration when calculating the makeup migration of the current layer, obtain the first feature map and the second feature map of the current layer, where the first feature map can understand the original image to be fused with makeup information, for example, it can be a plain image Etc.
  • the first feature map can be obtained by performing convolution calculation and extraction of the convolutional layer of the network based on the original image, etc. If the current layer is not the initial layer, then the corresponding first feature map is related to the calculation result of makeup migration of the upper layer, which will be described in subsequent embodiments and will not be repeated here.
  • the second feature map can be understood as a reference image for which makeup information is to be extracted, such as a heavy makeup image, etc. If the current layer is the initial layer, the second feature map can be the convolution calculation and extraction of the convolutional layer based on the reference image Got it and so on. If the current layer is not the initial layer, the corresponding second feature map is related to the second feature map obtained by the convolution calculation of the upper layer. This point will be described in subsequent embodiments and will not be repeated here.
  • the makeup migration calculation can be performed based on the facial parts, wherein the facial parts can be Including left eye part, right eye part, mouth part, nose part, cheek part, etc.
  • a plurality of original makeup feature regions corresponding to a plurality of facial parts are generated according to the first feature map, wherein each original makeup feature region corresponds to a human facial part, for example, the original makeup feature
  • the area includes the makeup feature area of the eyes, etc.
  • the original makeup feature area in this embodiment corresponds to the makeup feature of the face.
  • the corresponding makeup feature includes color features, shape characteristics, regional characteristics, etc.
  • the purpose is to migrate the makeup information in the second feature map to the original image corresponding to the first feature map. Therefore, in order to avoid the reference image from affecting the shape of the face in the original image, it is ensured that only the makeup information is transferred to For the original image, for example, only the color of the lips in the reference image is transferred to the lips of the original image without changing the shape of the lips in the original image, and the corresponding original makeup feature area in the first feature map can also include the corresponding face Bit shape features, etc.
  • Step 102 generating a plurality of reference makeup feature regions corresponding to a plurality of facial parts according to the second feature map.
  • a plurality of reference makeup feature regions corresponding to a plurality of human facial parts are generated according to the second feature map, wherein each reference makeup characteristic region corresponds to a human facial part .
  • the reference makeup feature area includes the makeup feature area of the eyes, etc.
  • the reference makeup feature area in this embodiment corresponds to the makeup feature of the face.
  • the corresponding makeup feature Including color features, shape features, area features, etc.
  • Step 103 perform makeup migration calculation on each original makeup feature area and the corresponding reference makeup feature area to obtain multiple candidate makeup feature areas.
  • each candidate makeup feature area can be understood as: the reference image is migrated The image features of the corresponding face parts in the original face after the makeup information corresponding to the face parts in the original face.
  • Step 104 combining multiple candidate makeup feature regions to generate a target feature map, and judging whether the target feature map satisfies a preset decoding condition.
  • each candidate makeup feature region only corresponds to one face part. Therefore, in order to obtain the complete face feature map after the transferred makeup, multiple candidate makeup feature regions need to be spliced to generate the target feature map. , wherein, the method of splicing feature maps can be realized with reference to the prior art, and will not be repeated here.
  • the degree of refinement of the makeup migration of the reference makeup feature area calculated under each current layer is different.
  • the layer of that is, the lowest layer of makeup migration, the rougher the corresponding refinement degree. Therefore, in this embodiment, in order to gradually increase the degree of refinement of makeup transfer, it is necessary to judge whether the target feature map satisfies a preset decoding condition, so as to determine whether the refinement degree of makeup transfer of the current layer meets the requirements.
  • the total number of layers calculated according to the experimental data is calibrated in advance, for example, 3 layers are pre-calibrated and calculated, etc., and the order of each layer is determined starting from 1, and it is judged whether the current layer is in the preset order Layers, for example, layer 3 etc. in pre-defined order. In this embodiment, if it is a layer with a preset order, it is determined that the target feature map satisfies a preset decoding condition.
  • the first makeup feature corresponding to the target feature map under each layer is extracted
  • the second makeup feature corresponding to the second feature map is extracted
  • the preset loss function is used to calculate the first makeup feature and the second makeup feature
  • Step 105 if the preset decoding condition is met, then decode the target feature map to obtain the target face image.
  • the decoding process and the like can be performed according to the decoding layer of the relevant processing network.
  • the method further includes:
  • Step 301 if the preset decoding condition is not met, update the first feature map of the current layer according to the target feature map as the first feature map to be processed in the next layer.
  • the preset decoding condition if the preset decoding condition is not satisfied, it indicates that the effect of the makeup migration of the current layer is not ideal, and only then the calculation of the makeup migration of the next layer needs to be started.
  • the makeup migration calculation result of the current layer is used as the input of the makeup migration calculation of the next layer, that is, the first layer of the current layer is updated according to the target feature map.
  • a feature map, as the first feature map to be processed in the next layer, and then, the first feature map to be processed can be convolved with the convolutional layer of the finer layer in the network to obtain the next layer. Multiple original makeup feature areas.
  • Step 302 splicing multiple reference makeup feature regions of the current layer, and updating the second feature map according to the spliced makeup feature map, as the second feature map to be processed in the next layer.
  • the convolution calculation result of the second feature map of the current layer can also be transmitted, multiple reference makeup feature regions of the current layer are spliced, and the second feature map is updated according to the spliced makeup feature map, as the second feature map to be processed in the next layer.
  • the second feature map to be processed can be convolved with a more refined convolutional layer in the convolutional network to obtain multiple reference makeup feature regions of the next layer.
  • this embodiment is divided into two branches, one of which can be a generative confrontation network, and the input of this branch is the original image corresponding to the first feature map (the image of a plain face in the figure) , the output is the face image after makeup migration, and the other branch is the makeup extraction network, and the input is the reference image corresponding to the second feature map (the picture is a makeup face image with makeup), where the two branches are in each layer
  • the network structure for calculating the corresponding makeup feature area is the same. For example, for the makeup migration calculation of the first layer, the extraction network layer structure of the first feature map and the second feature map are the same.
  • the target feature map of the makeup migration calculation under the first layer is first calculated according to the original image and the reference image, and the target feature map is used as the input of the second layer based on the target feature map.
  • a feature map, based on the second feature map generated by the reference makeup feature area obtained by another branch, as the second feature map input to the second layer, based on the first feature map and the second feature map to further perform the second layer Plastic surgery migration calculation the target feature map calculated based on the second layer is used as the first feature map input by the third layer, and the second feature map generated based on the reference makeup feature area obtained by another branch is used as the input of the third layer
  • the face-lifting migration calculation of the third layer is further performed, and the calculated target feature map is decoded by the decoding layer of the first branch to obtain the corresponding target Face image, the target face image is the original face image that has been transferred the makeup information in the reference image.
  • the face image processing method of the embodiment of the present disclosure obtains the first feature map and the second feature map of the current layer, generates multiple original makeup feature regions corresponding to multiple facial parts according to the first feature map, and then , perform makeup migration calculation on each original makeup feature area and the corresponding reference makeup feature area to obtain multiple candidate makeup feature areas, splicing multiple candidate makeup feature areas to generate a target feature map, and judging whether the target feature map satisfies the predetermined When the preset decoding condition is met, the target feature map is decoded to obtain the target face image. In this way, the refined transfer of makeup between images is realized, and the corresponding makeup transfer is performed based on each facial part, which improves the robustness of makeup transfer.
  • multi-channel image features are extracted based on multiple channels with different levels of refinement, and makeup information is extracted to enhance the degree of makeup information migration, especially for dense Makeup images have a better transfer effect.
  • makeup migration calculation is performed on each original makeup feature area and the corresponding reference makeup feature area to obtain multiple candidate makeup feature areas, including:
  • Step 501 calculate each reference makeup feature area according to a first preset algorithm to obtain a first variance feature matrix and a first mean feature matrix.
  • each reference makeup feature region is extracted based on the two dimensions of variance and mean. That is, calculate each reference makeup feature region according to the first preset algorithm to obtain the first variance feature matrix and the first mean feature matrix.
  • Step 502 Calculate each original makeup feature region according to the first preset algorithm to obtain a second variance feature matrix and a second mean feature matrix.
  • each original makeup feature region is extracted based on the variance and mean dimensions. That is, calculate each original makeup feature region according to the first preset algorithm to obtain the second variance feature matrix and the second mean feature matrix.
  • Step 503 Calculate the second variance feature matrix, the second mean feature matrix, and each original makeup feature area according to a second preset algorithm to obtain a normalized original makeup feature area.
  • the second variance feature matrix, the second mean feature matrix, and each original makeup feature area are calculated according to the second preset algorithm to obtain a normalized original makeup feature area, that is, in this embodiment Firstly, normalize the original makeup feature area to remove features that affect the makeup transfer effect in the original makeup feature area, such as noise features in the original makeup feature area, or original makeup features, etc.
  • the second reference value can be obtained according to the second variance feature matrix and each original makeup feature area, and then the normalized original makeup can be obtained based on the second reference value and the second mean feature matrix characteristic area.
  • the second variance feature matrix in order to avoid the second mean feature from removing some unique makeup features on the face, such as removing moles on the face that affect face recognition, etc., the second variance feature matrix can be calculated and The product value of the preset coefficient is used as the second reference value, and the preset coefficient is less than 1 to weaken the removal degree of the face features in the original image, and then calculate the product value of each original makeup feature area and the second variance feature matrix
  • the feature difference is to calculate the feature ratio of the difference makeup feature area and the second mean feature matrix to obtain the normalized original makeup feature area.
  • the feature difference between each original makeup feature area and the second variance feature matrix is calculated to obtain the difference makeup feature area as the second reference value, and the difference makeup feature area and the second mean feature are calculated The feature ratio of the matrix to obtain the normalized original makeup feature area.
  • the calculation process of the normalized original makeup feature area can be shown in the following formula (1), wherein, in the formula (1), is the normalized original makeup feature area, is the original makeup feature area, is the second variance feature matrix, which is the second mean value feature matrix, i is the i-th calculation layer, and R corresponds to the corresponding face position.
  • formula (1) is the normalized original makeup feature area
  • the original makeup feature area is the second variance feature matrix, which is the second mean value feature matrix
  • i is the i-th calculation layer
  • R corresponds to the corresponding face position.
  • Step 504 Calculate the first variance feature matrix, the first mean feature matrix, and the corresponding normalized original makeup feature areas according to a third preset algorithm, so as to obtain multiple candidate makeup feature areas.
  • the first variance feature matrix, the first mean feature matrix, and the corresponding normalized original makeup feature areas are calculated according to the third preset algorithm to obtain multiple candidate makeup feature areas, that is, in the normalized Makeup transfer is performed on the basis of Yihua's original image, which further improves the effect of makeup transfer.
  • the third reference value can be obtained according to the first variance feature matrix and the normalized original makeup feature area
  • the candidate makeup feature area can be obtained according to the third reference value and the first mean feature matrix feature
  • the feature product of the first variance feature matrix and the normalized original makeup feature area can be calculated, Taking the product makeup feature area as the third reference value, calculate the reference product value of the first mean feature matrix feature and the preset coefficient, where the preset coefficient is greater than 1, and is also used to enhance the makeup information in the corresponding reference makeup feature area, Calculate the sum of the feature product and the above-mentioned reference product value to obtain the candidate makeup feature area corresponding to the facial part.
  • the feature product of the first variance feature matrix and the normalized original makeup feature area can be calculated to obtain the product makeup feature area as the third reference value of the point, and then calculate the makeup feature The sum of the area and the first mean feature matrix feature to obtain the candidate makeup feature area.
  • the calculation logic of the candidate makeup feature region can be shown in the following formula (2), wherein, in the formula (2), is the first variance characteristic matrix, is the first mean characteristic matrix, is the candidate makeup feature area corresponding to the face part.
  • Second variance characteristic matrix and the second mean eigenmatrix Obtain the normalized original makeup feature area, secondly, calculate the feature product of the first variance feature matrix and the normalized original makeup feature area to obtain the product makeup feature area, and finally, calculate the makeup feature area and the first mean feature The sum of the matrix features to obtain the candidate makeup feature area
  • the transition of makeup based on the makeup region features of the facial parts and the variance and mean channels is realized, and the effect of makeup transition is improved.
  • the above-mentioned first preset algorithm can also be an algorithm for extracting corresponding feature matrices based on multiple channels.
  • each reference makeup feature area is calculated according to the first preset algorithm to obtain the first variance feature matrix and the first mean feature matrix, including:
  • Step 701 Carry out grid division for each reference makeup feature area according to a plurality of different preset window sizes, and generate an initial variance feature map and an initial mean feature of each preset window size according to the divided reference makeup feature area picture.
  • a plurality of window sizes are preset, and the sizes of the plurality of preset window sizes are different, for example, it may be 1*1, 2*2, 3*3..., in this embodiment, in order to ensure that The feature matrix under each window size is obtained, and the maximum size of the preset window size is the same as the size of the reference makeup feature area.
  • each reference makeup feature region can be divided into grids according to a plurality of different preset window sizes, so as to generate a grid feature map corresponding to each preset window size, wherein each grid The number of grids included in the feature map corresponds to the preset window size. For example, when the preset window size is 1*1, the number of grids included in the grid feature map is 1. When the preset window size is 2*2, Then the number of grids included in the grid feature map is 4 and so on.
  • an initial variance feature map and an initial mean feature map of each preset window size are generated according to the divided reference makeup feature area.
  • a preset number of sample feature points is randomly determined in each grid in the divided reference makeup feature area, wherein the preset number can be calibrated according to experimental data, and then all calculations The feature mean of the feature values of the sample feature points, and generate the initial mean feature map of each preset window size according to all the feature mean values of all grids.
  • a preset number of sample feature points is randomly determined in each grid in the divided reference makeup feature area, wherein the preset number can be calibrated according to experimental data, and then all sample feature points are calculated
  • the feature mean of all eigenvalues in each grid in the grid feature map is calculated, and an initial mean feature map of each preset window size is generated according to all feature means of all grids, so that, Split each reference makeup feature area into multiple feature channels, for example, when the preset window size includes 3, then split each reference makeup feature area into 3 channels to calculate the initial mean feature under 3 channels , where the larger the number of feature mean values corresponding to each channel, the finer the granularity of splitting the corresponding reference makeup feature area, and the makeup information in the corresponding reference makeup feature area can be extracted from more details .
  • the preset window size includes 2*2
  • the reference makeup feature area is divided into 4 grids, and the mean value of all feature values in each grid is calculated to Get 4 mean values, generate the corresponding initial mean feature map according to the 4 mean values a1, a2, a3 and a4
  • the preset window size includes 1*1, divide the reference makeup feature area into 1 grid , calculate the mean value of all feature values in each grid to get 1 mean value, and generate the corresponding initial mean value feature map according to 1 mean value a5.
  • the feature variance values of all eigenvalues in each grid in the grid feature map are calculated, and an initial variance feature map of each preset window size is generated according to all feature variance values of all grids, so that , split each reference makeup feature region into multiple feature channels.
  • each reference makeup feature area is split into 3 channels to calculate the initial variance feature map under the 3 channels, where the number of feature means corresponding to each channel is larger, It means that the finer the granularity of splitting the corresponding reference makeup feature area is, the makeup information in the corresponding reference makeup feature area can be extracted from more details.
  • the reference makeup feature area is divided into 4 grids, and the variance of all feature values in each grid is calculated as Get 4 variance values, and generate the corresponding initial mean variance feature map according to the 4 variance values b1, b2, b3, and b4.
  • the preset window size includes 1*1, perform grid division on the reference makeup feature area For one grid, calculate the variance of all the eigenvalues in each grid to obtain one variance value, and generate the corresponding initial mean variance feature map according to one variance value b5.
  • Step 702 Scale and scale all initial mean feature maps and all initial variance feature maps according to the size of the corresponding original makeup feature area, so as to obtain multiple target mean feature maps and multiple target variance feature maps.
  • all initial mean feature maps and all initial variance feature maps are scaled according to the size of the corresponding original makeup feature area to obtain multiple target mean feature maps and a plurality of target variance feature maps, wherein the size of each target mean feature map and target variance feature map is the same as the size of the corresponding original makeup feature area, wherein the size scaling process includes adjacent interpolation processing and the like.
  • Step 703 Calculate the multiple target mean feature maps and multiple target variance feature maps according to the corresponding original makeup feature regions to generate a first mean feature matrix and a first variance feature matrix.
  • the target mean feature matrix embodies the characteristics of the eigenvalues of the reference makeup area on the mean value
  • the target variance feature matrix embodies the characteristics of the eigenvalues of the reference makeup area on the variance
  • the feature area is calculated for multiple target mean feature maps to generate the first mean feature matrix, which reflects the migration matrix of the reference makeup area and the original makeup area in the mean dimension, based on the corresponding original makeup feature area for multiple
  • the target variance feature map is calculated to generate a first variance feature matrix, and the first variance feature matrix reflects the migration matrix of the reference makeup area and the original makeup area in the variance dimension.
  • multiple target mean feature maps and multiple target variance feature maps are calculated according to the corresponding original makeup feature regions to generate the first mean feature matrix and the first variance feature matrix in a different way:
  • the input of the deep learning model is the original makeup feature area and a plurality of target mean feature maps, and the output is the first mean feature matrix
  • the deep learning The input of the model is the original makeup feature area and multiple target variance feature maps, and the output is the first variance feature matrix, so that the deep learning model based on this training can obtain the corresponding first mean feature matrix and first variance feature matrix .
  • the degree of action of the target feature map under each branch is adaptively selected through the network, each reference makeup feature area and the corresponding original makeup feature area are spliced, and the spliced makeup feature area is calculated , such as performing convolution calculations on both sides according to the Gate network to generate multiple weight features corresponding to each target mean feature map and each target variance feature map, multiple weight features and target mean feature maps and target variance feature maps The corresponding number of channels is the same.
  • the calculation method of the weight feature can refer to the following formula (3), wherein, in the formula (3), is the weight feature, and k is the number of preset window sizes.
  • all target mean feature maps and corresponding weight features are calculated according to the fourth preset algorithm to obtain the first mean feature matrix.
  • the target mean feature maps and corresponding weight features are obtained according to A plurality of first reference values, and further, a first mean characteristic matrix is obtained according to the plurality of first reference values.
  • calculate the product value of each weight feature and the corresponding target mean feature map calculate the product of the product value and the preset value, and take the value of the first preset digit as the first reference value for the product result, and then, based on multiple The sum of the first reference values or the mean of the sum of multiple first reference values is used as the first mean feature matrix.
  • each target mean feature map and the corresponding weight feature is calculated, and the sum of multiple product values is calculated to obtain the first mean feature matrix.
  • the sum of multiple weight features is 1.
  • the calculation formula of the first mean feature matrix may be shown in the following formula (4), wherein, in the formula (4), is the first mean feature matrix corresponding to the face part R.
  • all target variance feature maps and corresponding weight features are calculated according to a fourth preset algorithm to obtain a first variance feature matrix.
  • all target variance feature maps and corresponding weight features are calculated according to the fourth preset algorithm to obtain the first variance feature matrix, wherein the calculation method of the first variance feature matrix refers to the above-mentioned first mean value
  • the calculation method of the characteristic matrix will not be repeated here.
  • the calculation method of the first mean feature matrix and the first variance feature matrix more clearly, the following will be explained in conjunction with a specific scenario example, wherein, in this scenario, the preset window size includes k , the network for calculating the corresponding weight feature is a Gate network, and the object of calculation is the first mean feature matrix.
  • the calculation method of the first variance feature matrix in this embodiment is similar to the calculation method of the first mean feature matrix. Here No longer.
  • all initial mean feature maps and all initial variance feature maps are scaled to obtain multiple target mean feature maps and multiple target variance feature maps arrive
  • the size of each target variance map is C*h s *w s .
  • each reference makeup feature region is spliced with the corresponding original makeup feature region, and the spliced makeup feature region is calculated to generate a weight feature corresponding to each target mean feature map arrive Furthermore, calculate the product value of each target mean feature map and the corresponding weight feature, and calculate the sum of multiple product values to obtain the first mean feature matrix
  • the above-mentioned first preset algorithm can also be other algorithms, for example, according to the area size of each reference makeup feature area, query the preset corresponding relationship to determine the target window size, and the target window
  • the size is divided into multiple grids, based on the feature mean of all feature values in each grid, the initial mean feature map of each preset window size is generated according to the feature mean of all grids, and according to the corresponding original makeup feature area Size
  • a target mean feature map with the same size as the original makeup feature region is obtained.
  • a corresponding first mean feature matrix is determined based on the target mean feature map.
  • the first variance feature matrix and the like can also be calculated in the same manner.
  • the window size that matches the size of each reference makeup feature area is directly selected for calculation and acquisition of the mean feature map, which balances the calculation pressure and calculation accuracy.
  • the face image processing method of the embodiment of the present disclosure when performing the makeup migration calculation under each layer, extracts multi-channel image features based on channels with different levels of fineness to extract makeup information, so as to enhance the migration degree of makeup information , to enhance the effect of makeup migration.
  • the embodiments of the present disclosure further propose a face image processing device.
  • FIG. 11 is a schematic structural diagram of a face image processing device provided by an embodiment of the present disclosure.
  • the device can be implemented by software and/or hardware, and can generally be integrated into electronic equipment.
  • the device includes: a first generation module 1110, a second generation module 1120, an acquisition module 1130, a splicing module 1140, a judging module 1150 and a decoding module 1160, wherein,
  • the first generating module 1110 is configured to acquire the first feature map and the second feature map of the current layer, and generate a plurality of original makeup feature regions corresponding to a plurality of facial parts according to the first feature map;
  • the second generation module 1120 is configured to generate a plurality of reference makeup feature regions corresponding to the plurality of facial parts according to the second feature map;
  • An acquisition module 1130 configured to perform makeup migration calculations on each of the original makeup feature areas and corresponding reference makeup feature areas, so as to acquire multiple candidate makeup feature areas;
  • a splicing module 1140 configured to splice the plurality of candidate makeup feature regions to generate a target feature map
  • a judging module 1150 configured to judge whether the target feature map satisfies a preset decoding condition
  • the decoding module 1160 is configured to decode the target feature map to obtain a target human face image when the preset decoding condition is satisfied.
  • the face image processing device provided in the embodiments of the present disclosure can execute the face image processing method provided in any embodiment of the present disclosure, and has corresponding functional modules and beneficial effects for executing the method.
  • the present disclosure also proposes a computer program product, including computer programs/instructions, which implement the face image processing method in the above embodiments when the computer program/instructions are executed by a processor
  • Fig. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • FIG. 12 shows a schematic structural diagram of an electronic device 1200 suitable for implementing an embodiment of the present disclosure.
  • the electronic device 1200 in the embodiment of the present disclosure may include, but is not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle-mounted terminals ( Mobile terminals such as car navigation terminals) and stationary terminals such as digital TVs, desktop computers and the like.
  • the electronic device shown in FIG. 12 is only an example, and should not limit the functions and application scope of the embodiments of the present disclosure.
  • an electronic device 1200 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 1201, which may be randomly accessed according to a program stored in a read-only memory (ROM) 1202 or loaded from a storage device 1208. Various appropriate actions and processes are executed by programs in the memory (RAM) 1203 . In the RAM 1203, various programs and data necessary for the operation of the electronic device 1200 are also stored.
  • the processing device 1201, ROM 1202, and RAM 1203 are connected to each other through a bus 1204.
  • An input/output (I/O) interface 1205 is also connected to the bus 1204 .
  • the following devices can be connected to the I/O interface 1205: input devices 1206 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibration an output device 1207 such as a computer; a storage device 1208 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1209.
  • the communication means 1209 may allow the electronic device 1200 to perform wireless or wired communication with other devices to exchange data. While FIG. 12 shows electronic device 1200 having various means, it is to be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product, which includes a computer program carried on a non-transitory computer readable medium, where the computer program includes program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from a network via communication means 1209, or from storage means 1208, or from ROM 1202.
  • the processing device 1201 When the computer program is executed by the processing device 1201, the above-mentioned functions defined in the face image processing method of the embodiment of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted by any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium
  • HTTP HyperText Transfer Protocol
  • the communication eg, communication network
  • Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network of.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device, or may exist independently without being incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the first feature map and the second feature map of the current layer, according to the first feature map Generate multiple original makeup feature regions corresponding to multiple facial parts, obtain the first feature map and second feature map of the current layer, and generate multiple original makeup features corresponding to multiple facial parts according to the first feature map area, and then, perform makeup migration calculation on each original makeup feature area and the corresponding reference makeup feature area to obtain multiple candidate makeup feature areas, stitch multiple candidate makeup feature areas to generate a target feature map, and judge the target feature map Whether the preset decoding condition is satisfied, and when the preset decoding condition is satisfied, the target feature map is decoded to obtain the target face image. In this way, the refined transfer of makeup between images is realized, and the corresponding makeup transfer is performed based on each facial part, which improves the robustness of makeup transfer.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" 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.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as AT&T, MCI, Sprint, EarthLink, MSN, GTE, etc.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • 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 they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.
  • FPGAs Field Programmable Gate Arrays
  • ASICs Application Specific Integrated Circuits
  • ASSPs Application Specific Standard Products
  • SOCs System on Chips
  • CPLD Complex Programmable Logical device
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM compact disk read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the present disclosure provides a face image processing method, including: obtaining the first feature map and the second feature map of the current layer, and generating the Multiple original makeup feature areas corresponding to facial parts;
  • the target feature map is decoded to obtain a target human face image.
  • the face image processing method before acquiring the first feature map and the second feature map of the current layer, it includes:
  • An instruction for performing multi-layer makeup migration calculation on the original image and the reference image is generated.
  • the acquiring the first feature of the current layer graph and a second feature map including:
  • the face image processing method after the judging whether the target feature map satisfies the preset decoding condition, it further includes:
  • the makeup migration calculation is performed on each of the original makeup feature regions and the corresponding reference makeup feature regions to obtain a plurality of candidate Makeup feature areas, including:
  • the calculation is performed on each of the reference makeup feature regions according to the first preset algorithm to obtain the first variance feature matrix and The first mean characteristic matrix, including:
  • Each of the reference makeup feature regions is divided into grids according to a plurality of different preset window sizes, and an initial variance feature map and an initial mean value of each of the preset window sizes are generated according to the divided reference makeup feature regions.
  • each of the reference makeup feature regions is meshed according to a plurality of different preset window sizes, and according to The divided reference makeup feature area generates an initial variance feature map and an initial mean feature map of each preset window size, including:
  • the multiple target mean feature maps and the multiple target variances are respectively analyzed according to the corresponding original makeup feature area
  • the feature map calculation to generate the first mean feature matrix and the first variance feature matrix includes:
  • All the target variance feature maps and corresponding weight features are calculated according to the fourth preset algorithm to obtain the first variance feature matrix.
  • the calculation of all the target mean feature maps and corresponding weight features according to the fourth preset algorithm to obtain the The first mean characteristic matrix including:
  • the obtaining multiple first reference values according to the target mean feature map and corresponding weight features includes:
  • the second variance feature matrix, the second mean feature matrix and each of the The calculation of the original makeup feature area to obtain the normalized original makeup feature area includes: obtaining a second reference value according to the second variance feature matrix and each of the original makeup feature areas;
  • the obtaining a second reference value according to the second variance feature matrix and each of the original makeup feature regions includes:
  • the obtaining a second reference value according to the second variance feature matrix and each of the original makeup feature regions includes:
  • the calculation of the first variance feature matrix, the first mean feature matrix, and the corresponding normalized original makeup feature areas according to a third preset algorithm to obtain the plurality of candidate makeup feature areas includes :
  • the third reference value is obtained according to the first variance feature matrix and the normalized original makeup feature area , comprising: calculating the feature product of the first variance feature matrix and the normalized original makeup feature area to obtain the product makeup feature area;
  • obtaining the candidate makeup feature area includes: calculating The sum of the makeup feature area and the feature of the first mean feature matrix to obtain the candidate makeup feature area.
  • the judging whether the target feature map satisfies a preset decoding condition includes:
  • the present disclosure provides a face image processing device, including:
  • the first generation module is used to obtain the first feature map and the second feature map of the current layer, and generate a plurality of original makeup feature regions corresponding to a plurality of facial parts according to the first feature map;
  • a second generating module configured to generate a plurality of reference makeup feature regions corresponding to the plurality of facial parts according to the second feature map;
  • An acquisition module configured to perform makeup migration calculations on each of the original makeup feature regions and corresponding reference makeup feature regions, so as to obtain multiple candidate makeup feature regions;
  • a splicing module used to splice the multiple candidate makeup feature regions to generate a target feature map
  • a judging module configured to judge whether the target feature map satisfies a preset decoding condition
  • the decoding module is configured to decode the target feature map to obtain a target human face image when the preset decoding condition is satisfied.
  • the face image processing device provided in the present disclosure further includes:
  • An image acquisition module configured to acquire an original image and a reference image corresponding to the makeup migration request in response to the makeup migration request
  • An instruction generating module configured to generate an instruction for performing multi-layer makeup migration calculation on the original image and the reference image.
  • the face image processing device provided in the present disclosure further includes: when the current layer is the initial layer in the multi-layer makeup migration calculation, the first generating module , specifically for:
  • the face image processing device provided in the present disclosure further includes: an update module, configured to:
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • Each of the reference makeup feature regions is divided into grids according to a plurality of different preset window sizes, and an initial variance feature map and an initial mean value of each of the preset window sizes are generated according to the divided reference makeup feature regions.
  • the acquisition module is specifically used for:
  • the acquisition module is specifically configured to: stitch each of the reference makeup feature regions and the corresponding original makeup feature regions, And calculating the spliced makeup feature region to generate a plurality of weight features corresponding to each of the target mean feature maps and each of the target variance feature maps;
  • All the target variance feature maps and corresponding weight features are calculated according to the fourth preset algorithm to obtain the first variance feature matrix.
  • the acquisition module is specifically configured to: acquire a plurality of first reference values according to the target mean feature map and corresponding weight features ;
  • the acquisition module is specifically configured to: calculate the product value of each target mean feature map and the corresponding weight feature; calculate The sum of the multiple product values is used to obtain the first mean feature matrix.
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • the acquisition module is specifically used for:
  • the judgment module is specifically used for:
  • the present disclosure provides an electronic device, including:
  • the processor is configured to read the executable instructions from the memory, and execute the instructions to implement any one of the face image processing methods provided in the present disclosure.
  • the present disclosure provides a computer-readable storage medium, the storage medium stores a computer program, and the computer program is used to execute any one of the human programs described in the present disclosure. face image processing methods.

Landscapes

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

Abstract

本公开实施例涉及一种人脸图像处理方法、装置、设备及介质,其中该方法包括:获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;根据第二特征图生成与多个人脸部位对应的多个参考妆容特征区域;对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;拼接多个候选妆容特征区域以生成目标特征图,并判断目标特征图是否满足预设的解码条件;若满足预设的解码条件,则对目标特征图解码处理以获取目标人脸图像。由此,实现了图像之间妆容的精细化迁移,且基于每个人脸部位进行对应的妆容迁移,提高了妆容迁移的鲁棒性。

Description

人脸图像处理方法、装置、设备及介质
本申请要求于2021年9月16日提交的申请号为202111088139.2、申请名称为“人脸图像处理方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及图像处理技术领域,尤其涉及一种人脸图像处理方法、装置、设备及介质。
背景技术
随着图像处理技术的普及,人脸图像的化妆迁移较为常见,比如,将不同化妆风格的人脸图像之间的妆容进行迁移,或者,将化妆的人脸图像的妆容迁移到素颜人脸图像上等。
相关技术中,基于简单的图像分割技术,分割出妆容人脸图像中的妆容图像区域,比如,分割妆容人脸图像中的眼影图像区域、腮红图像区域等,进一步的,将分割出的妆容图像区域基于网格对齐的方式对齐到待迁移妆容的原始人脸图像中,从而实现在原始人脸图像中对妆容的迁移。
然而,上述提到的妆容迁移方式中,分割出的妆容图像区域受到妆容人脸图像中人脸姿态以及脸型等的限制,导致融合到原始人脸图像中后,原始人脸图像中妆容信息的融合效果不够自然。
发明内容
为了解决上述技术问题或者至少部分地解决上述技术问题,本公开提供了一种人脸图像处理方法、装置、设备及介质,实现了图像之间妆容的精细化迁移,且基于每个人脸部位进行对应的妆容迁移,提高了妆容迁移的鲁棒性。
本公开实施例提供了一种人脸图像处理方法,所述方法包括:获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;拼接所述多个候选妆容特征区域以生成目标特征图,并判断所述目标特征图是否满足预设的解码条件;若满足所述预设的解码条件,则对所述目标特征图解码处理以获取目标人脸图像。
本公开实施例还提供了一种人脸图像处理装置,所述装置包括:第一生成模块,用于获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;第二生成模块,用于根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;获取模块,用于对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;拼接模块,用于拼接所述多个候选妆容特征区域以生成目标特征图;判断模块,用于判断所述目标特征图是否满足预设的解码条件;解码模块,用于在满足所述预设的解码条件时,对所述目标特征图解码处理以获取目标人脸图像。
本公开实施例还提供了一种电子设备,所述电子设备包括:处理器;用于存储所述处理器可执行指令的存储器;所述处理器,用于从所述存储器中读取所述可执行指令,并执 行所述指令以实现如本公开实施例提供的人脸图像处理方法。
本公开实施例还提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开实施例提供的人脸图像处理方法。
本公开实施例提供的技术方案与现有技术相比具有如下优点:
本公开实施例提供的人脸图像处理方案,获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域,进而,对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,拼接多个候选妆容特征区域以生成目标特征图,并判断目标特征图是否满足预设的解码条件,在满足预设的解码条件时,对目标特征图解码处理以获取目标人脸图像。由此,实现了图像之间妆容的精细化迁移,且基于每个人脸部位进行对应的妆容迁移,提高了妆容迁移的鲁棒性。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为本公开实施例提供的一种人脸图像处理方法的流程示意图;
图2为本公开实施例提供的一种人脸图像处理逻辑示意图;
图3为本公开实施例提供的另一种人脸图像处理方法的流程示意图;
图4为本公开实施例提供的一种人脸图像处理场景示意图;
图5为本公开实施例提供的另一种人脸图像处理方法的流程示意图;
图6为本公开实施例提供的另一种人脸图像处理场景示意图;
图7为本公开实施例提供的另一种人脸图像处理方法的流程示意图;
图8为本公开实施例提供的一种初始均值特征图生成场景示意图;
图9为本公开实施例提供的一种初始方差特征图生成场景示意图;
图10为本公开实施例所提供的一种第一均值特征矩阵生成场景示意图;
图11为本公开实施例提供的一种人脸图像处理装置的结构示意图;
图12为本公开实施例提供的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例” 表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
为了解决上述问题,本公开提出了一种基于卷积网络的妆容信息的迁移网络,在该妆容信息的迁移网络中,可以从多个层次层层递进学习妆容信息,对不同层次的妆容信息与原始人脸图像进行自适应性的融合,且基于卷积网络实现基于图像特征维度的妆容信息的迁移,提升了妆容迁移的自然感。
下面结合具体的实施例对本实施例中的人脸图像的处理方法进行介绍。
图1为本公开实施例提供的一种人脸图像处理方法的流程示意图,该方法可以由人脸图像处理装置执行,其中该装置可以采用软件和/或硬件实现,一般可集成在电子设备中。如图1所示,该方法包括:
步骤101,获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域。
需要说明的是,本实施例中,逐层进行两张图像之间的妆容信息的迁移,其中,每一层之间的妆容迁移可以层层递进。
从而,如图2所示,层与层之间的妆容迁移计算以看作多层金字塔的计算,多层妆容迁移结果以金字塔的形式传递,从而,兼顾了两张图像之间的多个粒度进行妆容信息的融合,可以大大提高妆容信息的融合自然感,即使两张图像之间的人脸图像具有较大的姿态上的差异,也能够通过层层递进的融合计算进行补偿,从而,提高了妆容迁移的鲁棒性。
下面对每层的妆容迁移计算进行说明。
在本实施例中,响应于妆容迁移请求,获取与妆容迁移请求对应的原始图像和参考图像,生成对原始图像和参考图像执行多层妆容迁移计算的指令,以便于根据该指令进行多层妆容迁移的计算,在当前层的妆容迁移计算时,获取当前层的第一特征图和第二特征图,其中,第一特征图可以理解待被融合妆容信息的原始图像,比如,可以为素颜图像等,若当前层为初始层,则第一特征图可以为根据原始图像进行有关网络的卷积层的卷积计算提取得到的等。若是当前层不是初始层,则对应的第一特征图与上层的妆容迁移的计算结果有关,这一点将会在后续实施例进行说明,在此不再赘述。
另外,第二特征图可以理解为待提取妆容信息的参考图像,比如是浓妆图像等,若当前层为初始层,则第二特征图可以为根据参考图像进行卷积层的卷积计算提取得到的等。若是当前层不是初始层,则对应的第二特征图与上层的卷积计算得到的第二特征图有关,这一点将会在后续实施例进行说明,在此不再赘述。
在本实施例中,为了补偿第一特征图对应的原始图像和第二特征图对应的参考图像之 间的姿态差异,可以基于人脸部位分别进行妆容迁移计算,其中,人脸部位可以包括左眼部位、右眼部位、嘴巴部位、鼻子部位、脸颊部位等。
因此,在本实施例中,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域,其中,每个原始妆容特征区域和一个人脸部位对应,比如,原始妆容特征区域包括眼睛部位的妆容特征区域等,本实施例中的原始妆容特征区域对应于有关人脸部位的妆容特征,比如,当妆容对应于腮红时,则对应的妆容特征包括颜色特征、形状特征、区域特征等。
在实际执行过程中,目的是第二特征图中的妆容信息迁移到第一特征图对应的原始图像中,因此,为了避免参考图像影响原始图像中人脸的形状,保证仅仅妆容信息被迁移到原始图像,比如,仅仅将参考图像中嘴唇的颜色迁移到原始图像的嘴唇上,而不改变原始图像中嘴唇的形状,该第一特征图中对应的原始妆容特征区域还可以包括对应人脸部位的形状特征等。
步骤102,根据第二特征图生成与多个人脸部位对应的多个参考妆容特征区域。
在本实施例中,为了提高妆容迁移的自然感,根据第二特征图生成与多个人脸部位对应的多个参考妆容特征区域,其中,每个参考妆容特征区域和一个人脸部位对应。比如,参考妆容特征区域包括眼睛部位的妆容特征区域等,本实施例中的参考妆容特征区域对应于有关人脸部位的妆容特征,比如,当妆容对应于腮红时,则对应的妆容特征包括颜色特征、形状特征、区域特征等。
步骤103,对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域。
在本实施例中,对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以生成多个候选妆容特征区域,其中,每个候选妆容特征区域可以理解为:迁移了参考图像中对应人脸部位的妆容信息后原始人脸中对应人脸部位的图像特征。
步骤104,拼接多个候选妆容特征区域以生成目标特征图,并判断目标特征图是否满足预设的解码条件。
正如以上提到的,每个候选妆容特征区域仅仅对应于一个人脸部位,因此,为了获取迁移妆容后的完整的人脸特征图,还需要拼接多个候选妆容特征区域以生成目标特征图,其中,拼接特征图的方法可以参照现有技术实现,在此不作赘述。
由于每层计算的原始妆容特征区域和参考妆容特征区域的卷积核的数量等的不同,导致每个当前层下计算得到的参考妆容特征区域的妆容迁移的精细化程度不同,越是靠前的层,即越是最低层的妆容迁移,对应的精细化程度越粗糙。因此,在本实施例中,为了逐步提高妆容迁移的精细化程度,需要判断目标特征图是否满足预设的解码条件,以确定当前层的妆容迁移的精细化程度是否达到要求。
需要说明的是,在不同的应用场景中,判断目标特征图是否满足预设的解码条件的方式不同,示例说明如下:
在本公开的一个实施例中,预先根据实验数据标定计算的总层数,比如,预先标定计算3个层等,从1开始对每层的次序进行确定,判断当前层是否为预设次序的层,例如, 预先标定次序为的第3层等。在本实施例中,若是为预设次序的层,则确定目标特征图满足预设的解码条件。
在本公开的另一个实施例中,提取每层下的目标特征图对应的第一妆容特征,提取第二特征图对应的第二妆容特征,预设损失函数计算第一妆容特征和第二妆容特征之间的损失值,当损失值小于预设损失阈值时,证明当前层对妆容迁移的效果较好,基本将第二特征图对应的参考图像中的在妆容信息迁移到了第一特征图对应的原始图像中,从而,确定当前层下的目标特征图满足预设的解码条件。
步骤105,若满足预设的解码条件,则对目标特征图解码处理以获取目标人脸图像。
在本实施例中,若满足预设的解码条件,则表明此时妆容迁移的效果较为理想,因此,基于目标特征图获取对应的人脸图像,其中,由于目标特征图是特征维度的信息,因此,需要对目标特征图解码处理以获取目标人脸图像,在实施例中,可以根据有关处理网络的解码层进行解码处理等。
在本公开的一个实施例中,如图3所示,在上述步骤104之后,该方法还包括:
步骤301,若不满足预设的解码条件,则根据目标特征图更新当前层的第一特征图,以作为下一层待处理的第一特征图。
在本实施例中,若是不满足预设的解码条件,则表明当前层的妆容迁移的效果不理想,仅此需要启动下一层的妆容迁移计算。
在本实施例中,为了提高下一层的妆容迁移计算的精细度和效率,将当前层的妆容迁移计算结果作为下一层的妆容迁移计算的输入,即根据目标特征图更新当前层的第一特征图,以作为下一层待处理的第一特征图,进而,可以对该待处理的第一特征图进行网络中更精细一层的卷积层进行卷积计算,得到下一层的多个原始妆容特征区域。
步骤302,拼接当前层的多个参考妆容特征区域,并根据拼接后的妆容特征图更新第二特征图,以作为下一层待处理的第二特征图。
同样的,在本实施例中,还可以传递当前层的第二特征图的卷积计算结果,拼接当前层的多个参考妆容特征区域,并根据拼接后的妆容特征图更新第二特征图,以作为下一层待处理的第二特征图。
进而,可以对该待处理的第二特征图进行卷积网络中更精细一层的卷积层进行卷积计算,得到下一层的多个参考妆容特征区域。
总体而言,如图4所示,本实施例中分成两个分支,其中一个分支可以为生成对抗网络,该分支的输入为第一特征图对应的原始图像(图中为素颜人脸图像),输出为妆容迁移后的人脸图像,另一个分支为妆容提取网络,输入为第二特征图对应的参考图像(图中为带妆容的化妆人脸图像),其中,两个分支在每层计算对应的妆容特征区域的网络结构是相同的,比如,对于第一层的妆容迁移计算而言,第一特征图和第二特征图的提取网络层结构相同。
在本实施例中,当预设的层次序为3时,首先根据原始图像和参考图像计算第一个层下妆容迁移计算的目标特征图,基于该目标特征图作为第二个层输入的第一特征图,基于另一个分支得到的参考妆容特征区域生成的第二特征图,作为第二个层输入的第二特征图, 基于第一特征图和第二特征图进一步进行第二个层的整容迁移计算,基于第二个层计算得到的目标特征图作为第三个层输入的第一特征图,基于另一个分支得到的参考妆容特征区域生成的第二特征图,作为第三个层输入的第二特征图,基于第一特征图和第二特征图进一步进行第三个层的整容迁移计算,将计算得到的目标特征图通过第一个分支的解码层进行解码,以获取对应的目标人脸图像,目标人脸图像为被转移了参考图像中的妆容信息的原始人脸图像。
从而,在多个层的妆容计算时,可以对不同粒度的妆容进行迁移,即使对于浓妆和人脸姿态不一致的妆容信息也可以实现效果较好的迁移。
综上,本公开实施例的人脸图像处理方法,获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域,进而,对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,拼接多个候选妆容特征区域以生成目标特征图,并判断目标特征图是否满足预设的解码条件,在满足预设的解码条件时,对目标特征图解码处理以获取目标人脸图像。由此,实现了图像之间妆容的精细化迁移,且基于每个人脸部位进行对应的妆容迁移,提高了妆容迁移的鲁棒性。
基于上述实施例,在进行每层下的妆容迁移计算时,基于多个不同精细程度的通道提取多通道的图像特征,进行妆容信息的提取等,以增强妆容信息的迁移程度,特别是对浓妆图像具有较好的迁移效果。
下面对本公开实施例的对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算过程进行解释说明。
在本公开的一个实施例中,如图5所示,对每个原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,包括:
步骤501,根据第一预设算法对每个参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵。
在本实施例中,基于方差和均值两个维度提取每个参考妆容特征区域的特征性能。即根据第一预设算法对每个参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵。
步骤502,根据第一预设算法对每个原始妆容特征区域计算,以获取第二方差特征矩阵和第二均值特征矩阵。
同样的,在本实施例中,基于方差和均值维度提取每个原始妆容特征区域的特征性能。即根据第一预设算法对每个原始妆容特征区域计算,以获取第二方差特征矩阵和第二均值特征矩阵。
步骤503,根据第二预设算法对第二方差特征矩阵、第二均值特征矩阵和每个原始妆容特征区域计算,以获取归一化的原始妆容特征区域。
在本实施例中,根据第二预设算法对第二方差特征矩阵、第二均值特征矩阵和每个原始妆容特征区域计算,以获取归一化的原始妆容特征区域,即在本实施例中,首先对原始 妆容特征区进行归一化的处理,去除原始妆容特征区域中影响妆容迁移效果的特征,比如,原始妆容特征区域中的噪点特征,或者是原始妆容特征等。
在本公开的实施例中,可以根据第二方差特征矩阵和每个原始妆容特征区域,获取第二参考值,进而,基于第二参考值和第二均值特征矩阵,获取归一化的原始妆容特征区域。
比如,在一些可能的实施例中,为了避免第二均值特征将一些人脸上特有的妆容特点去除,比如将人脸上的痣去除影响人脸辨识度等,可以计算第二方差特征矩阵与预设系数的乘积值作为第二参考值,预设系数小于1以用来弱化对原始图像中人脸特点的去除程度,进而,计算每个原始妆容特征区域和第二方差特征矩阵的乘积值特征差值,计算差值妆容特征区域和第二均值特征矩阵的特征比值,以获取归一化的原始妆容特征区域。
在一些可能的实施例中,计算每个原始妆容特征区域和第二方差特征矩阵的特征差值,以获取差值妆容特征区域作为第二参考值,计算差值妆容特征区域和第二均值特征矩阵的特征比值,以获取归一化的原始妆容特征区域。
在本实施例中,归一化的原始妆容特征区域的计算过程可以如下面公式(1)所示,其中,在公式(1)中,
Figure PCTCN2022118356-appb-000001
为归一化的原始妆容特征区域,
Figure PCTCN2022118356-appb-000002
为原始妆容特征区域,
Figure PCTCN2022118356-appb-000003
为第二方差特征矩阵,其
Figure PCTCN2022118356-appb-000004
为第二均值特征矩阵,i为第i个计算层,R对应于对应的人脸部位,需要说明的是,本实施例中,不同公式中相同的字符表示相同的参数,在不同的公式中,对相同字母的参数不重复定义。
Figure PCTCN2022118356-appb-000005
步骤504,根据第三预设算法对第一方差特征矩阵、第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取多个候选妆容特征区域。
在本实施例中,根据第三预设算法对第一方差特征矩阵、第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取多个候选妆容特征区域,即在归一化的原始图像的基础上进行妆容迁移,进一步提升了妆容迁移的效果。
在本公开的实施例中,可以根据第一方差特征矩阵和归一化的原始妆容特征区域,获取第三参考值,根据第三参考值和第一均值特征矩阵特征,获取候选妆容特征区域。
比如,在本公开的一个实施例中,为了避免参考图像中的妆容信息为淡妆,导致妆容信息提取不完全,可以计算第一方差特征矩阵和归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域作为第三参考值,计算第一均值特征矩阵特征和预设系数的参考乘积值,这里预设系数大于1,也用来增强对应的参考妆容特征区域中的妆容信息,计算特征乘积和上述参考乘积值之和,以获取对应人脸部位的候选妆容特征区域。
比如,在本公开的一个实施例中,可以计算第一方差特征矩阵和归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域作为点第三参考值,进而,计算妆容特征区域和第一均值特征矩阵特征之和,以获取候选妆容特征区域。
在本实施例中,候选妆容特征区域的计算逻辑可以如下面的公式(2)所示,其中,在公式(2)中,
Figure PCTCN2022118356-appb-000006
为第一方差特征矩阵,
Figure PCTCN2022118356-appb-000007
为第一均值特征矩阵,
Figure PCTCN2022118356-appb-000008
为对应人脸部 位的候选妆容特征区域。
Figure PCTCN2022118356-appb-000009
为了使得本领域的技术人员更加了解上述迁移计算的算法,下面结合具体的实施例对整个迁移算法的逻辑进行说明,如图6所示,在解释说明妆容迁移计算时,以人脸部位为左眼部位为例。
参照图6,首先,根据第一特征图和第二特征图提取左眼对应的参考妆容特征区域
Figure PCTCN2022118356-appb-000010
和原始妆容特征区域
Figure PCTCN2022118356-appb-000011
后,根据第一预设算法对每个参考妆容特征区域计算,以获取第一方差特征矩阵
Figure PCTCN2022118356-appb-000012
和第一均值特征矩阵
Figure PCTCN2022118356-appb-000013
并且,根据第一预设算法对每个原始妆容特征区域计算,以获取第二方差特征矩阵
Figure PCTCN2022118356-appb-000014
和第二均值特征矩阵
Figure PCTCN2022118356-appb-000015
首先,基于第二方差特征矩阵
Figure PCTCN2022118356-appb-000016
和第二均值特征矩阵
Figure PCTCN2022118356-appb-000017
获取归一化的原始妆容特征区域,其次,计算第一方差特征矩阵和归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域,最后,计算妆容特征区域和第一均值特征矩阵特征之和,以获取候选妆容特征区域
Figure PCTCN2022118356-appb-000018
从而,在本实施例中,实现了基于人脸部位的妆容区域特征,基于方差和均值通道的妆容的迁移,提高而妆容迁移的效果。
在本实施例中,为了保证方差特征矩阵和均值特征矩阵能够反应各个精细化粒度的妆容信息,上述第一预设算法还可以为基于多通道来提取对应的特征矩阵的算法。
其中,由于第一方差特征矩阵和第一均值特征矩阵,和对应的第二方差特征矩阵和第二均值特征矩阵都是基于第一预设算法获取的,因此,在本实施例中,以第一均值特征矩阵和对应的第二方差特征矩阵的计算过程为例进行说明,说明如下:
在本实施例中,如图7所示,根据第一预设算法对每个参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵,包括:
步骤701,根据多个不同的预设窗口尺寸分别对每个参考妆容特征区域进行网格划分,并根据划分后的参考妆容特征区域生成每个预设窗口尺寸的初始方差特征图和初始均值特征图。
在本实施例中,预先设置多个窗口尺寸,多个预设窗口尺寸的尺寸不同,比如,可以为1*1,2*2,3*3……,在本实施例中,为了保证能够获取到每个窗口尺寸下的特征矩阵,预设窗口尺寸的最大尺寸与参考妆容特征区域的尺寸相同。
在本实施例中,可以根据多个不同的预设窗口尺寸对每个参考妆容特征区域进行网格划分,以生成与每个预设窗口尺寸对应的网格特征图,其中,每个网格特征图包含的网格数量与预设窗口尺寸对应,比如,当预设窗口尺寸为1*1,则网格特征图包含的网格数量为1个,当预设窗口尺寸为2*2,则网格特征图包含的网格数量为4个等。
进一步的,根据划分后的参考妆容特征区域生成每个预设窗口尺寸的初始方差特征图和初始均值特征图。
在一些可能的实施例中,在划分后的参考妆容特征区域中的每个网格中随机确定预设个数的样本特征点,其中,预设个数可以根据实验数据标定,进而,计算所有样本特征点的特征值的特征均值,根据所有网格的所有特征均值生成每个预设窗口尺寸的初始均值特征图。
在本实施例中,在划分后的参考妆容特征区域中的每个网格中随机确定预设个数的样本特征点,其中,预设个数可以根据实验数据标定,进而,计算所有样本特征点的特征值的特征方差值,根据所有网格的所有特征方差生成每个预设窗口尺寸的初始方差特征图。
在另一些可能的实施例中,计算网格特征图中每个网格中所有特征值的特征均值,根据所有网格的所有特征均值生成每个预设窗口尺寸的初始均值特征图,从而,将每个参考妆容特征区域拆分为多个特征通道,比如,当预设窗口尺寸包括3个时,则将每个参考妆容特征区域拆分为3个通道计算3个通道下的初始均值特征图,其中,每个通道对应的特征均值数量越多,则意味着将对应的参考妆容特征区域拆分的粒度越细,将能从更多的细节提取对应的参考妆容特征区域中的妆容信息。
举例而言,如图8所示,当预设窗口尺寸包括2*2时,则对参考妆容特征区域进行网格划分为4个网格,计算每个网格中的所有特征值的均值以得到4个均值,根据4个均值a1,a2,a3和a4生成对应的初始均值特征图,当预设窗口尺寸包括1*1时,则对参考妆容特征区域进行网格划分为1个网格,计算每个网格中的所有特征值的均值以得到1个均值,根据1个均值a5生成对应的初始均值特征图。
在本实施例中,计算网格特征图中每个网格中所有特征值的特征方差值,根据所有网格的所有特征方差值生成每个预设窗口尺寸的初始方差特征图,从而,将每个参考妆容特征区域拆分为多个特征通道。
比如,当预设窗口尺寸包括3个时,则将每个参考妆容特征区域拆分为3个通道计算3个通道下的初始方差特征图,其中,每个通道对应的特征均值数量越多,则意味着将对应的参考妆容特征区域拆分的粒度越细,将能从更多的细节提取对应的参考妆容特征区域中的妆容信息。
举例而言,如图9所示,当预设窗口尺寸包括2*2时,则对参考妆容特征区域进行网格划分为4个网格,计算每个网格中的所有特征值的方差以得到4个方差值,根据4个方差值b1,b2,b3和b4生成对应的初始均值方差特征图,当预设窗口尺寸包括1*1时,则对参考妆容特征区域进行网格划分为1个网格,计算每个网格中的所有特征值的方差以得到1个方差值,根据1个方差值b5生成对应的初始均值方差特征图。
步骤702,根据对应的原始妆容特征区域的尺寸分别对所有初始均值特征图和所有初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图。
在本实施例中,为了便于后续特征图之间的计算,根据对应的原始妆容特征区域的尺寸分别对所有初始均值特征图和所有初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图,其中,每个目标均值特征图和目标方差特征图的尺寸,与 对应的原始妆容特征区域的尺寸相同,其中,尺寸缩放处理包括紧邻插值处理等。
步骤703,根据对应的原始妆容特征区域分别对多个目标均值特征图和多个目标方差特征图计算,以生成第一均值特征矩阵和第一方差特征矩阵。
在本实施例中,由于目标均值特征矩阵体现了参考妆容区域的特征值在均值上的特点,目标方差特征矩阵体现了参考妆容区域的特征值在方差上的特点,因此,基于对应的原始妆容特征区域对多个目标均值特征图计算以生成第一均值特征矩阵,该第一均值特征矩阵反映了参考妆容区域和原始妆容区域在均值维度的迁移矩阵,基于对应的原始妆容特征区域对多个目标方差特征图计算以生成第一方差特征矩阵,该第一方差特征矩阵反映了参考妆容区域和原始妆容区域在方差维度的迁移矩阵。
需要说明的是,在不同的应用场景中,根据对应的原始妆容特征区域分别对多个目标均值特征图和多个目标方差特征图计算,以生成第一均值特征矩阵和第一方差特征矩阵的方式不同:
在一些可能的实施例中,预先根据大量样本数据训练深度学习模型时,该深度学习模型的输入为原始妆容特征区域和多个目标均值特征图,则输出为第一均值特征矩阵,该深度学习模型的输入为原始妆容特征区域和多个目标方差特征图,则输出为第一方差特征矩阵,从而基于该训练的深度学习模型可以获取对应的第一均值特征矩阵和第一方差特征矩阵。
在另一些可能的实施例中,通过网络自适应的选择每个分支下的目标特征图作用程度,拼接每个参考妆容特征区域和对应的原始妆容特征区域,并对拼接后的妆容特征区域计算,比如根据Gate网络等进行两侧卷积计算,以生成与每个目标均值特征图和每个目标方差特征图对应的多个权重特征,多个权重特征与目标均值特征图和目标方差特征图对应的通道数相同。
其中,在一些可能的实施例中,权重特征的计算方式可以参照下面的公式(3),其中,在公式(3)中,
Figure PCTCN2022118356-appb-000019
为权重特征,k为预设窗口尺寸的数量。
Figure PCTCN2022118356-appb-000020
在本实施例中,根据第四预设算法对所有目标均值特征图和对应的权重特征计算,以获取第一均值特征矩阵,在本实施例中,根据目标均值特征图和对应的权重特征获取多个第一参考值,进而,根据多个第一参考值获取第一均值特征矩阵。
比如,计算每个权重特征和对应的目标均值特征图的乘积值,计算该乘积值与预设值的乘积,对乘积结果取前预设位数的值作为第一参考值,进而,基于多个第一参考值之和或者多个第一参考值之和的均值来作为第一均值特征矩阵。
比如,计算每个目标均值特征图和对应的权重特征的乘积值,计算多个乘积值之和以获取第一均值特征矩阵。多个权重特征的相加和为1。
在本实施例中,第一均值特征矩阵的计算公式可以为下面公式(4)所示,其中,在公式(4)中,
Figure PCTCN2022118356-appb-000021
为人脸部位R对应的第一均值特征矩阵。
Figure PCTCN2022118356-appb-000022
进一步的,根据第四预设算法对所有目标方差特征图和对应的权重特征计算,以获取第一方差特征矩阵。
在本实施例中,根据第四预设算法对所有目标方差特征图和对应的权重特征计算,以获取第一方差特征矩阵,其中,第一方差特征矩阵的计算方式参照上述第一均值特征矩阵的计算方式,在此不再赘述。
为了使得本领域的技术人员对第一均值特征矩阵和第一方差特征矩阵的计算方式更加清楚的了解,下面结合具体的场景示例说明,其中,在该场景下,预设窗口尺寸包括k个,计算对应的权重特征的网络为Gate网络,计算的对象为第一均值特征矩阵,另外,本实施例中第一方差特征矩阵的计算方式与第一均值特征矩阵的计算方式类似,在此不再赘述。
参照图10,在本实施例中,首先获取R人脸部位对应的参考妆容特征区域
Figure PCTCN2022118356-appb-000023
以及对应人脸部位的原始妆容特征区域
Figure PCTCN2022118356-appb-000024
其中,
Figure PCTCN2022118356-appb-000025
的尺寸为C*h s*w s
根据多个不同的预设窗口尺寸对每个参考妆容特征区域进行网格划分,以生成与每个预设窗口尺寸对应的网格特征图,计算网格特征图中每个网格中所有特征值的特征均值,根据所有网格的所有特征均值生成每个预设窗口尺寸的初始均值特征图
Figure PCTCN2022118356-appb-000026
Figure PCTCN2022118356-appb-000027
进一步的,根据对应的原始妆容特征区域的尺寸分别对所有初始均值特征图和所有初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图
Figure PCTCN2022118356-appb-000028
Figure PCTCN2022118356-appb-000029
其中,每个目标方差图的尺寸均为C*h s*w s
在本实施例中,拼接每个参考妆容特征区域和对应的原始妆容特征区域,并对拼接后的妆容特征区域计算以生成与每个目标均值特征图对应的权重特征
Figure PCTCN2022118356-appb-000030
Figure PCTCN2022118356-appb-000031
进而,计算每个目标均值特征图和对应的权重特征的乘积值,计算多个乘积值之和以获取第一均值特征矩阵
Figure PCTCN2022118356-appb-000032
当然,在其他可能的实施例中,上述第一预设算法也可以为其他算法,比如,根据每个参考妆容特征区域的区域大小,查询预设的对应关系以确定目标窗口尺寸,将目标窗口尺寸划分为多个网格,基于每个网格中所有特征值的特征均值,根据所有网格的所有特征均值生成每个预设窗口尺寸的初始均值特征图,根据对应的原始妆容特征区域的尺寸对初始均值特征图进行尺寸缩放处理后,获取和原始妆容特征区域的尺寸相同的目标均值特征图。
进一步的,基于目标均值特征图确定对应的第一均值特征矩阵。也可以采用同样的方式计算第一方差特征矩阵等。在本实施例中,直接选择与每个参考妆容特征区域的尺寸匹配的窗口尺寸进行有关均值特征图的计算获取,平衡了计算压力和计算精确度。
综上,本公开实施例的人脸图像处理方法,在进行每层下的妆容迁移计算时,基于不同精细程度的通道提取多通道的图像特征进行妆容信息的提取,以增强妆容信息的迁移程度,提升了妆容迁移的效果。
为了实现上述实施例,本公开实施例还提出了一种人脸图像处理装置。
图11为本公开实施例提供的一种人脸图像处理装置的结构示意图,该装置可由软件和/或硬件实现,一般可集成在电子设备中。如图11所示,该装置包括:第一生成模块1110、第二生成模块1120、获取模块1130、拼接模块1140、判断模块1150和解码模块1160,其中,
第一生成模块1110,用于获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;
第二生成模块1120,用于根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;
获取模块1130,用于对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;
拼接模块1140,用于拼接所述多个候选妆容特征区域以生成目标特征图;
判断模块1150,用于判断所述目标特征图是否满足预设的解码条件;
解码模块1160,用于在满足所述预设的解码条件时,对所述目标特征图解码处理以获取目标人脸图像。
本公开实施例所提供的人脸图像处理装置可执行本公开任意实施例所提供的人脸图像处理方法,具备执行方法相应的功能模块和有益效果。
为了实现上述实施例,本公开还提出一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现上述实施例中的人脸图像处理方法
图12为本公开实施例提供的一种电子设备的结构示意图。
下面具体参考图12,其示出了适于用来实现本公开实施例中的电子设备1200的结构示意图。本公开实施例中的电子设备1200可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图12示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图12所示,电子设备1200可以包括处理装置(例如中央处理器、图形处理器等)1201,其可以根据存储在只读存储器(ROM)1202中的程序或者从存储装置1208加载到随机访问存储器(RAM)1203中的程序而执行各种适当的动作和处理。在RAM 1203中,还存储有电子设备1200操作所需的各种程序和数据。处理装置1201、ROM 1202以及RAM1203通过总线1204彼此相连。输入/输出(I/O)接口1205也连接至总线1204。
通常,以下装置可以连接至I/O接口1205:包括例如触摸屏、触摸板、键盘、鼠标、 摄像头、麦克风、加速度计、陀螺仪等的输入装置1206;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置1207;包括例如磁带、硬盘等的存储装置1208;以及通信装置1209。通信装置1209可以允许电子设备1200与其他设备进行无线或有线通信以交换数据。虽然图12示出了具有各种装置的电子设备1200,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置1209从网络上被下载和安装,或者从存储装置1208被安装,或者从ROM 1202被安装。在该计算机程序被处理装置1201执行时,执行本公开实施例的人脸图像处理方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(“LAN”),广域网(“WAN”),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域,获取当前层的第一特征图和第二特征图,根据第一特征图生成与多个人脸部位对应的多个原始妆容特征区域,进而,对每个原始妆 容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,拼接多个候选妆容特征区域以生成目标特征图,并判断目标特征图是否满足预设的解码条件,在满足预设的解码条件时,对目标特征图解码处理以获取目标人脸图像。由此,实现了图像之间妆容的精细化迁移,且基于每个人脸部位进行对应的妆容迁移,提高了妆容迁移的鲁棒性。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、片上系统(SOC)、复杂可编程逻辑设备(CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的一个或多个实施例,本公开提供了一种人脸图像处理方法,包括:获取 当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;
根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;
对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;
拼接所述多个候选妆容特征区域以生成目标特征图,并判断所述目标特征图是否满足预设的解码条件;
若满足所述预设的解码条件,则对所述目标特征图解码处理以获取目标人脸图像。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,在所述获取当前层的第一特征图和第二特征图之前,包括:
响应于妆容迁移请求,获取与所述妆容迁移请求对应的原始图像和参考图像;
生成对所述原始图像和所述参考图像执行多层妆容迁移计算的指令。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,当所述当前层为所述多层妆容迁移计算中的初始层时,所述获取当前层的第一特征图和第二特征图,包括:
提取所述原始图像的图像特征获取所述第一特征图;
提取所述参考图像的图像特征获取所述第二特征图。根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,在所述判断所述目标特征图是否满足预设的解码条件之后,还包括:
若不满足所述预设的解码条件,则根据所述目标特征图更新所述当前层的第一特征图,以作为下一层待处理的第一特征图;
拼接所述当前层的所述多个参考妆容特征区域,并根据拼接后的妆容特征图更新所述第二特征图,以作为下一层待处理的第二特征图。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,包括:
根据第一预设算法对每个所述参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵;
根据所述第一预设算法对每个所述原始妆容特征区域计算,以获取第二方差特征矩阵和第二均值特征矩阵;
根据第二预设算法对所述第二方差特征矩阵、所述第二均值特征矩阵和每个所述原始妆容特征区域计算,以获取归一化的原始妆容特征区域;
根据第三预设算法对所述第一方差特征矩阵、所述第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取所述多个候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据第一预设算法对每个所述参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵,包括:
根据多个不同的预设窗口尺寸分别对每个所述参考妆容特征区域进行网格划分,并根据划分后的参考妆容特征区域生成每个所述预设窗口尺寸的初始方差特征图和初始均值特征图;
根据对应的原始妆容特征区域的尺寸分别对所有所述初始均值特征图和所有所述初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图;
根据所述对应的原始妆容特征区域分别对所述多个目标均值特征图和所述多个目标方差特征图计算,以生成所述第一均值特征矩阵和所述第一方差特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据多个不同的预设窗口尺寸分别对每个所述参考妆容特征区域进行网格划分,并根据划分后的参考妆容特征区域生成每个所述预设窗口尺寸的初始方差特征图和初始均值特征图,包括:
根据多个不同的预设窗口尺寸对每个所述参考妆容特征区域进行网格划分,以生成与每个所述预设窗口尺寸对应的网格特征图;
计算所述网格特征图中每个网格中所有特征值的特征均值,根据所有网格的所有所述特征均值生成每个所述预设窗口尺寸的初始均值特征图;
计算所述网格特征图中每个网格中所有特征值的特征方差值,根据所有网格的所有所述特征方差值生成每个所述预设窗口尺寸的初始方差特征图。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据所述对应的原始妆容特征区域分别对所述多个目标均值特征图和所述多个目标方差特征图计算,以生成所述第一均值特征矩阵和所述第一方差特征矩阵,包括:
拼接所述每个所述参考妆容特征区域和对应的原始妆容特征区域,并对拼接后的妆容特征区域计算以生成与每个所述目标均值特征图和每个所述目标方差特征图对应的多个权重特征;
根据第四预设算法对所有所述目标均值特征图和对应的权重特征计算,以获取所述第一均值特征矩阵;
根据所述第四预设算法对所有所述目标方差特征图和对应的权重特征计算,以获取所述第一方差特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据第四预设算法对所有所述目标均值特征图和对应的权重特征的计算,以获取所述第一均值特征矩阵,包括:
根据所述目标均值特征图和对应的权重特征获取多个第一参考值;
根据所述多个第一参考值获取所述第一均值特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据所述目标均值特征图和对应的权重特征获取多个第一参考值,包括:
计算每个所述目标均值特征图和对应的权重特征的乘积值;
所述根据所述多个第一参考值获取所述第一均值特征矩阵,包括:
计算多个所述乘积值之和以获取所述第一均值特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据第二 预设算法对所述第二方差特征矩阵、所述第二均值特征矩阵和每个所述原始妆容特征区域计算,以获取归一化的原始妆容特征区域,包括:根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值;
根据所述第二参考值和所述第二均值特征矩阵,获取所述归一化的原始妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值,包括:
计算每个所述原始妆容特征区域和所述第二方差特征矩阵的特征差值,以获取差值妆容特征区域;
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值,包括:
计算所述差值妆容特征区域和所述第二均值特征矩阵的特征比值,以获取所述归一化的原始妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,
所述根据第三预设算法对所述第一方差特征矩阵、所述第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取所述多个候选妆容特征区域,包括:
根据所述第一方差特征矩阵和所述归一化的原始妆容特征区域,获取第三参考值;
根据所述第三参考值和所述第一均值特征矩阵特征,获取所述候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述根据所述第一方差特征矩阵和所述归一化的原始妆容特征区域,获取第三参考值,包括:计算所述第一方差特征矩阵和所述归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域;
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,根据所述第三参考值和所述第一均值特征矩阵特征,获取所述候选妆容特征区域,包括:计算所述妆容特征区域和所述第一均值特征矩阵特征之和,以获取所述候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理方法中,所述判断所述目标特征图是否满足预设的解码条件,包括:
判断所述当前层的次序是否为预设次序,其中,
若为所述预设次序,则确定所述目标特征图满足预设的解码条件。
根据本公开的一个或多个实施例,本公开提供了一种人脸图像处理装置,包括:
第一生成模块,用于获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;
第二生成模块,用于根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;
获取模块,用于对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;
拼接模块,用于拼接所述多个候选妆容特征区域以生成目标特征图;
判断模块,用于判断所述目标特征图是否满足预设的解码条件;
解码模块,用于在满足所述预设的解码条件时,对所述目标特征图解码处理以获取目标人脸图像。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,还包括:
图像获取模块,用于响应于妆容迁移请求,获取与所述妆容迁移请求对应的原始图像和参考图像;
指令生成模块,用于生成对所述原始图像和所述参考图像执行多层妆容迁移计算的指令。根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,还包括:当所述当前层为所述多层妆容迁移计算中的初始层时,所述第一生成模块,具体用于:
提取所述原始图像的图像特征获取所述第一特征图;
提取所述参考图像的图像特征获取所述第二特征图。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,还包括:更新模块,用于:
在不满足所述预设的解码条件时,根据所述目标特征图更新所述当前层的第一特征图,以作为下一层待处理的第一特征图,
拼接所述当前层的所述多个参考妆容特征区域,并根据拼接后的妆容特征图更新所述第二特征图,以作为下一层待处理的第二特征图。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
根据第一预设算法对每个所述参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵;
根据所述第一预设算法对每个所述原始妆容特征区域计算,以获取第二方差特征矩阵和第二均值特征矩阵;
根据第二预设算法对所述第二方差特征矩阵、所述第二均值特征矩阵和每个所述原始妆容特征区域计算,以获取归一化的原始妆容特征区域;
根据第三预设算法对所述第一方差特征矩阵、所述第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取所述多个候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
根据多个不同的预设窗口尺寸分别对每个所述参考妆容特征区域进行网格划分,并根据划分后的参考妆容特征区域生成每个所述预设窗口尺寸的初始方差特征图和初始均值特征图;
根据对应的原始妆容特征区域的尺寸分别对所有所述初始均值特征图和所有所述初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图;
根据所述对应的原始妆容特征区域分别对所述多个目标均值特征图和所述多个目标方差特征图计算,以生成所述第一均值特征矩阵和所述第一方差特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
根据多个不同的预设窗口尺寸对每个所述参考妆容特征区域进行网格划分,以生成与每个所述预设窗口尺寸对应的网格特征图;
计算所述网格特征图中每个网格中所有特征值的特征均值,根据所有网格的所有所述特征均值生成每个所述预设窗口尺寸的初始均值特征图;
计算所述网格特征图中每个网格中所有特征值的特征方差值,根据所有网格的所有所述特征方差值生成每个所述预设窗口尺寸的初始方差特征图;
根据对应的原始妆容特征区域的尺寸分别对所有所述初始均值特征图和所有所述初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:拼接所述每个所述参考妆容特征区域和对应的原始妆容特征区域,并对拼接后的妆容特征区域计算以生成与每个所述目标均值特征图和每个所述目标方差特征图对应的多个权重特征;
根据第四预设算法对所有所述目标均值特征图和对应的权重特征计算,以获取所述第一均值特征矩阵;
根据所述第四预设算法对所有所述目标方差特征图和对应的权重特征计算,以获取所述第一方差特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:根据所述目标均值特征图和对应的权重特征获取多个第一参考值;
根据所述多个第一参考值获取所述第一均值特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:计算每个所述目标均值特征图和对应的权重特征的乘积值;计算多个所述乘积值之和以获取所述第一均值特征矩阵。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值;
根据所述第二参考值和所述第二均值特征矩阵,获取所述归一化的原始妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
计算每个所述原始妆容特征区域和所述第二方差特征矩阵的特征差值,以获取差值妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
计算所述差值妆容特征区域和所述第二均值特征矩阵的特征比值,以获取所述归一化的原始妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
根据所述第一方差特征矩阵和所述归一化的原始妆容特征区域,获取第三参考值;
根据所述第三参考值和所述第一均值特征矩阵特征,获取所述候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
计算所述第一方差特征矩阵和所述归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述获取模块,具体用于:
计算所述妆容特征区域和所述第一均值特征矩阵特征之和,以获取所述候选妆容特征区域。
根据本公开的一个或多个实施例,本公开提供的人脸图像处理装置中,所述判断模块,具体用于:
判断所述当前层的次序是否为预设次序,其中,
若为所述预设次序,则确定所述目标特征图满足预设的解码条件。
根据本公开的一个或多个实施例,本公开提供了一种电子设备,包括:
处理器;
用于存储所述处理器可执行指令的存储器;
所述处理器,用于从所述存储器中读取所述可执行指令,并执行所述指令以实现如本公开提供的任一所述的人脸图像处理方法。
根据本公开的一个或多个实施例,本公开提供了一种计算机可读存储介质,所述存储介质存储有计算机程序,所述计算机程序用于执行如本公开提供的任一所述的人脸图像处理方法。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。

Claims (21)

  1. 一种人脸图像处理方法,其特征在于,包括以下步骤:
    获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;
    根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;
    对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;
    拼接所述多个候选妆容特征区域以生成目标特征图,并判断所述目标特征图是否满足预设的解码条件;
    若满足所述预设的解码条件,则对所述目标特征图解码处理以获取目标人脸图像。
  2. 如权利要求1所述的方法,其特征在于,在所述获取当前层的第一特征图和第二特征图之前,包括:
    响应于妆容迁移请求,获取与所述妆容迁移请求对应的原始图像和参考图像;
    生成对所述原始图像和所述参考图像执行多层妆容迁移计算的指令。
  3. 如权利要求2所述的方法,其特征在于,当所述当前层为所述多层妆容迁移计算中的初始层时,所述获取当前层的第一特征图和第二特征图,包括:
    提取所述原始图像的图像特征获取所述第一特征图;
    提取所述参考图像的图像特征获取所述第二特征图。
  4. 如权利要求1所述的方法,其特征在于,在所述判断所述目标特征图是否满足预设的解码条件之后,还包括:
    若不满足所述预设的解码条件,则根据所述目标特征图更新所述当前层的第一特征图,以作为下一层待处理的第一特征图;
    拼接所述当前层的所述多个参考妆容特征区域,并根据拼接后的妆容特征图更新所述第二特征图,以作为下一层待处理的第二特征图。
  5. 如权利要求1所述的方法,其特征在于,所述对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域,包括:
    根据第一预设算法对每个所述参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵;
    根据所述第一预设算法对每个所述原始妆容特征区域计算,以获取第二方差特征矩阵和第二均值特征矩阵;
    根据第二预设算法对所述第二方差特征矩阵、所述第二均值特征矩阵和每个所述原始妆容特征区域计算,以获取归一化的原始妆容特征区域;
    根据第三预设算法对所述第一方差特征矩阵、所述第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取所述多个候选妆容特征区域。
  6. 如权利要求5所述的方法,其特征在于,所述根据第一预设算法对每个所述参考妆容特征区域计算,以获取第一方差特征矩阵和第一均值特征矩阵,包括:
    根据多个不同的预设窗口尺寸分别对每个所述参考妆容特征区域进行网格划分,并根 据划分后的参考妆容特征区域生成每个所述预设窗口尺寸的初始方差特征图和初始均值特征图;
    根据对应的原始妆容特征区域的尺寸分别对所有所述初始均值特征图和所有所述初始方差特征图尺寸缩放处理,以获取多个目标均值特征图和多个目标方差特征图;
    根据所述对应的原始妆容特征区域分别对所述多个目标均值特征图和所述多个目标方差特征图计算,以生成所述第一均值特征矩阵和所述第一方差特征矩阵。
  7. 如权利要求6所述的方法,其特征在于,所述根据多个不同的预设窗口尺寸分别对每个所述参考妆容特征区域进行网格划分,并根据划分后的参考妆容特征区域生成每个所述预设窗口尺寸的初始方差特征图和初始均值特征图,包括:
    根据多个不同的预设窗口尺寸对每个所述参考妆容特征区域进行网格划分,以生成与每个所述预设窗口尺寸对应的网格特征图;
    计算所述网格特征图中每个网格中所有特征值的特征均值,根据所有网格的所有所述特征均值生成每个所述预设窗口尺寸的初始均值特征图;
    计算所述网格特征图中每个网格中所有特征值的特征方差值,根据所有网格的所有所述特征方差值生成每个所述预设窗口尺寸的初始方差特征图。
  8. 如权利要求6或7所述的方法,其特征在于,所述根据所述对应的原始妆容特征区域分别对所述多个目标均值特征图和所述多个目标方差特征图计算,以生成所述第一均值特征矩阵和所述第一方差特征矩阵,包括:
    拼接所述每个所述参考妆容特征区域和对应的原始妆容特征区域,并对拼接后的妆容特征区域计算以生成与每个所述目标均值特征图和每个所述目标方差特征图对应的多个权重特征;
    根据第四预设算法对所有所述目标均值特征图和对应的权重特征计算,以获取所述第一均值特征矩阵;
    根据所述第四预设算法对所有所述目标方差特征图和对应的权重特征计算,以获取所述第一方差特征矩阵。
  9. 如权利要求8所述的方法,其特征在于,所述根据第四预设算法对所有所述目标均值特征图和对应的权重特征的计算,以获取所述第一均值特征矩阵,包括:
    根据所述目标均值特征图和对应的权重特征获取多个第一参考值;
    根据所述多个第一参考值获取所述第一均值特征矩阵。
  10. 如权利要求9所述的方法,其特征在于,所述根据所述目标均值特征图和对应的权重特征获取多个第一参考值,包括:
    计算每个所述目标均值特征图和对应的权重特征的乘积值;
    所述根据所述多个第一参考值获取所述第一均值特征矩阵,包括:
    计算多个所述乘积值之和以获取所述第一均值特征矩阵。
  11. 如权利要求5所述的方法,其特征在于,所述根据第二预设算法对所述第二方差特征矩阵、所述第二均值特征矩阵和每个所述原始妆容特征区域计算,以获取归一化的原始妆容特征区域,包括:
    根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值;
    根据所述第二参考值和所述第二均值特征矩阵,获取所述归一化的原始妆容特征区域。
  12. 如权利要求11所述的方法,其特征在于,所述根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值,包括:
    计算每个所述原始妆容特征区域和所述第二方差特征矩阵的特征差值,以获取差值妆容特征区域。
  13. 如权利要求12所述的方法,其特征在于,所述根据所述第二方差特征矩阵和每个所述原始妆容特征区域,获取第二参考值,包括:
    计算所述差值妆容特征区域和所述第二均值特征矩阵的特征比值,以获取所述归一化的原始妆容特征区域。
  14. 如权利要求5所述的方法,其特征在于,所述根据第三预设算法对所述第一方差特征矩阵、所述第一均值特征矩阵和对应的归一化的原始妆容特征区域计算,以获取所述多个候选妆容特征区域,包括:
    根据所述第一方差特征矩阵和所述归一化的原始妆容特征区域,获取第三参考值;
    根据所述第三参考值和所述第一均值特征矩阵特征,获取所述候选妆容特征区域。
  15. 如权利要求14所述的方法,其特征在于,所述根据所述第一方差特征矩阵和所述归一化的原始妆容特征区域,获取第三参考值,包括:
    计算所述第一方差特征矩阵和所述归一化的原始妆容特征区域的特征乘积,以获取乘积妆容特征区域。
  16. 如权利要求15所述的方法,其特征在于,所述根据所述第三参考值和所述第一均值特征矩阵特征,获取所述候选妆容特征区域,包括:
    计算所述妆容特征区域和所述第一均值特征矩阵特征之和,以获取所述候选妆容特征区域。
  17. 如权利要求1-9任一所述的方法,其特征在于,所述判断所述目标特征图是否满足预设的解码条件,包括:
    判断所述当前层的次序是否为预设次序,其中,
    若为所述预设次序,则确定所述目标特征图满足预设的解码条件。
  18. 一种人脸图像处理装置,其特征在于,包括:
    第一生成模块,用于获取当前层的第一特征图和第二特征图,根据所述第一特征图生成与多个人脸部位对应的多个原始妆容特征区域;
    第二生成模块,用于根据所述第二特征图生成与所述多个人脸部位对应的多个参考妆容特征区域;
    获取模块,用于对每个所述原始妆容特征区域和对应的参考妆容特征区域进行妆容迁移计算,以获取多个候选妆容特征区域;
    拼接模块,用于拼接所述多个候选妆容特征区域以生成目标特征图;
    判断模块,用于判断所述目标特征图是否满足预设的解码条件;
    解码模块,用于在满足所述预设的解码条件时,对所述目标特征图解码处理以获取目 标人脸图像。
  19. 一种电子设备,其特征在于,所述电子设备包括:
    处理器;
    用于存储所述处理器可执行指令的存储器;
    所述处理器,用于从所述存储中读取所述可执行指令,并执行所述可执行指令以实现如上述权利要求1-17中任一所述的人脸图像处理方法。
  20. 一种计算机可读存储介质,其特征在于,所述存储介质存储有计算机程序,所述计算机程序用于执行上述权利要求1-17中任一所述的人脸图像处理方法。
  21. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序/指令,所述计算机程序/指令被处理器执行如权利要求1-17任一所述的人脸图像处理方法。
PCT/CN2022/118356 2021-09-16 2022-09-13 人脸图像处理方法、装置、设备及介质 WO2023040813A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111088139.2A CN115829827A (zh) 2021-09-16 2021-09-16 人脸图像处理方法、装置、设备及介质
CN202111088139.2 2021-09-16

Publications (1)

Publication Number Publication Date
WO2023040813A1 true WO2023040813A1 (zh) 2023-03-23

Family

ID=85515122

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/118356 WO2023040813A1 (zh) 2021-09-16 2022-09-13 人脸图像处理方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN115829827A (zh)
WO (1) WO2023040813A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117912120A (zh) * 2024-03-19 2024-04-19 中国科学技术大学 人脸隐私保护方法、系统、设备及存储介质
CN117912120B (zh) * 2024-03-19 2024-06-07 中国科学技术大学 人脸隐私保护方法、系统、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9799096B1 (en) * 2014-07-08 2017-10-24 Carnegie Mellon University System and method for processing video to provide facial de-identification
US20190014884A1 (en) * 2017-07-13 2019-01-17 Shiseido Americas Corporation Systems and Methods for Virtual Facial Makeup Removal and Simulation, Fast Facial Detection and Landmark Tracking, Reduction in Input Video Lag and Shaking, and a Method for Recommending Makeup
CN111950432A (zh) * 2020-08-07 2020-11-17 武汉理工大学 一种基于区域风格一致性的妆容风格迁移方法及系统
CN113298704A (zh) * 2021-07-27 2021-08-24 成都索贝数码科技股份有限公司 一种广播电视新闻下利用图迁移的肤色分割及美化方法
CN113362422A (zh) * 2021-06-08 2021-09-07 武汉理工大学 一种阴影鲁棒的基于解耦表示的妆容迁移系统及方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9799096B1 (en) * 2014-07-08 2017-10-24 Carnegie Mellon University System and method for processing video to provide facial de-identification
US20190014884A1 (en) * 2017-07-13 2019-01-17 Shiseido Americas Corporation Systems and Methods for Virtual Facial Makeup Removal and Simulation, Fast Facial Detection and Landmark Tracking, Reduction in Input Video Lag and Shaking, and a Method for Recommending Makeup
CN111950432A (zh) * 2020-08-07 2020-11-17 武汉理工大学 一种基于区域风格一致性的妆容风格迁移方法及系统
CN113362422A (zh) * 2021-06-08 2021-09-07 武汉理工大学 一种阴影鲁棒的基于解耦表示的妆容迁移系统及方法
CN113298704A (zh) * 2021-07-27 2021-08-24 成都索贝数码科技股份有限公司 一种广播电视新闻下利用图迁移的肤色分割及美化方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117912120A (zh) * 2024-03-19 2024-04-19 中国科学技术大学 人脸隐私保护方法、系统、设备及存储介质
CN117912120B (zh) * 2024-03-19 2024-06-07 中国科学技术大学 人脸隐私保护方法、系统、设备及存储介质

Also Published As

Publication number Publication date
CN115829827A (zh) 2023-03-21

Similar Documents

Publication Publication Date Title
WO2020155907A1 (zh) 用于生成漫画风格转换模型的方法和装置
WO2021098362A1 (zh) 视频分类模型构建、视频分类的方法、装置、设备及介质
WO2022012179A1 (zh) 生成特征提取网络的方法、装置、设备和计算机可读介质
CN112668588B (zh) 车位信息生成方法、装置、设备和计算机可读介质
CN113505848B (zh) 模型训练方法和装置
WO2023035531A1 (zh) 文本图像超分辨率重建方法及其相关设备
CN112270200B (zh) 一种文本信息的翻译方法、装置、电子设备和存储介质
CN113689372B (zh) 图像处理方法、设备、存储介质及程序产品
CN111414879A (zh) 人脸遮挡程度识别方法、装置、电子设备及可读存储介质
WO2023232056A1 (zh) 图像处理方法、装置、存储介质及电子设备
WO2023179310A1 (zh) 图像修复方法、装置、设备、介质及产品
CN112418249A (zh) 掩膜图像生成方法、装置、电子设备和计算机可读介质
CN116258657A (zh) 模型训练方法、图像处理方法、装置、介质及电子设备
CN110211017B (zh) 图像处理方法、装置及电子设备
WO2022012178A1 (zh) 用于生成目标函数的方法、装置、电子设备和计算机可读介质
CN113902636A (zh) 图像去模糊方法及装置、计算机可读介质和电子设备
WO2021057463A1 (zh) 图像风格化处理方法、装置、电子设备及可读介质
CN113409307A (zh) 基于异质噪声特性的图像去噪方法、设备及介质
WO2023116744A1 (zh) 图像处理方法、装置、设备及介质
WO2023040813A1 (zh) 人脸图像处理方法、装置、设备及介质
CN114758130B (zh) 图像处理及模型训练方法、装置、设备和存储介质
CN111784726A (zh) 人像抠图方法和装置
CN113905177B (zh) 视频生成方法、装置、设备及存储介质
CN114040129A (zh) 视频生成方法、装置、设备及存储介质
CN114049417B (zh) 虚拟角色图像的生成方法、装置、可读介质及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22869182

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18692767

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE