FACE PERSHING METHOD AND RELATED DEVICE
The face parsing neural network with semantic and boundary perception subnetworks and fusion enhances the accuracy of face parsing by improving the identification of boundary pixels, addressing the low segmentation accuracy in border regions.
Patent Information
- Application Number
- JP2022528685
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-11-18
- Filing Date
- 2020-08-18
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2040-08-18
AI Technical Summary
Existing face parsing techniques struggle to accurately segment pixels in border regions of facial images due to semantic confusion and loss of information during convolution and pooling, leading to low segmentation accuracy.
A face parsing neural network with three branches: semantic perception, boundary perception, and fusion subnetworks, utilizing loss functions to enhance the identification of boundary pixels by combining and weighting boundary features with semantic features.
Improves the accuracy of face parsing by effectively distinguishing boundary pixels between facial regions, resulting in enhanced overall performance.
Smart Images

Figure 0007559063000020 
Figure 0007559063000021 
Figure 0007559063000022
Abstract
Description
[Technical field]
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS This application claims the benefit of priority from Chinese patent application No. 201911125557.7, filed on November 18, 2019, which is incorporated herein by reference in its entirety.
[0002] The present disclosure relates to the field of artificial intelligence, and in particular to a face parsing method and apparatus, a method and apparatus for training a face parsing network, an electronic device, and a non-transitory computer-readable storage medium. [Background technology]
[0003] Face parsing refers to assigning a semantic label to each pixel in a face image to represent the facial region to which it belongs, such as hair, facial skin, eyebrows, eyes, nose, mouth, etc.
[0004] In recent years, with the development of deep learning and the maturity of artificial intelligence technology, face parsing technology has been increasingly adopted in face-related applications, such as face synthesis, face augmented reality technology, etc. Summary of the Invention [Means for solving the problem]
[0005] In a first aspect of the present disclosure, there is provided a face parsing method, comprising the steps of: inputting a face image into a pre-trained face parsing neural network; extracting semantic features from the face image using a semantic perception sub-network of the face parsing neural network, the semantic features representing probabilities that each pixel of the face image belongs to various face regions; extracting boundary features from the face image using a boundary perception sub-network of the face parsing neural network, the boundary features representing probabilities that each pixel of the face image belongs to a boundary between different face regions; and processing the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain a face region to which each pixel of the face image belongs.
[0006] In some embodiments, the face parsing method further comprises training a face parsing neural network using the sample face images annotated with the face region to which each pixel belongs, and the trained face parsing neural network outputs the face region to which each pixel of the face images belongs according to the input face image.
[0007] In some embodiments, the loss functions used in training the face parsing neural network include a loss function of a semantic perception sub-network and a loss function of a boundary perception sub-network, where the loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic features belongs to various face regions and the face region to which each pixel of the semantic features actually belongs, and the loss function of the boundary perception sub-network is determined according to the predicted probability that each pixel of the boundary features belongs to a boundary between different face regions and whether each pixel of the boundary features actually belongs to the boundary or not.
[0008] In some embodiments, the step of processing the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain a face region to which each pixel of the face image belongs comprises: processing the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain fusion features of the face image, where the fusion features represent predicted probabilities that each pixel of the face image belongs to various face regions and predicted probabilities that each pixel of the face image belongs to a boundary; and determining the face region to which each pixel of the face image belongs according to the fusion features.
[0009] In some embodiments, the loss function used in training the face parsing neural network further comprises a loss function of a fusion sub-network, where the loss function of the fusion sub-network is determined according to the predicted probability that each pixel of the fusion feature belongs to various face regions, the face region that each pixel of the fusion feature actually belongs to, and whether each pixel of the fusion feature belongs to the boundary or not.
[0010] In some embodiments, the loss function L of the semantic perception sub-network is s teeth,
number
[0011] N is the total number of pixels in the semantic feature, i is the identifier of the pixel in the semantic feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the face region if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. s ij = 0, and p s ij is the predicted probability that pixel i belongs to face region j.
[0012] Loss function L for boundary perception subnetwork b teeth,
number
[0013] N is the total number of pixels in the boundary feature, i is the identifier of a pixel in the boundary feature, and y b i = 1, and pixel i does not actually belong to the boundary. b i = 0, and p b i is the predicted probability that pixel i belongs to the boundary.
[0014] Loss function L of the fused subnetwork f teeth,
number
[0015] N is the total number of pixels in the fusion feature, i is the identifier of the pixel in the fusion feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the fusion feature if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. s ij = 0, and p s ij is the predicted probability that pixel i belongs to face region j, and w i > 1, and pixel i does not actually belong to the boundary. i =1.
[0016] In some embodiments, the semantic perception sub-network includes a convolutional layer, and extracting semantic features from the facial image using the semantic perception sub-network comprises performing dilated convolution on the facial image using the convolutional layer to obtain the convolutional features.
[0017] In some embodiments, the semantic perception sub-network comprises a pooling layer, and extracting semantic features from the face image using the semantic perception sub-network further comprises performing multi-scale pooling of the convolutional features using the pooling layer to obtain multi-scale pooled features, and concatenating the multi-scale pooled features and the convolutional features.
[0018] In some embodiments, the boundary perception sub-network and the fusion sub-network comprise convolutional layers.
[0019] In a second aspect of the present disclosure, there is provided a method for training a face parsing neural network, the method comprising: pre-training a face parsing neural network using sample face images annotated with a face region to which each pixel belongs; the trained face parsing neural network is configured to output a face region to which each pixel of the face image belongs according to an input face image; the face parsing neural network includes a semantic perception sub-network, a boundary perception sub-network, and a fusion sub-network; the semantic perception sub-network is configured to extract semantic features from the sample face images, the semantic features representing probabilities that each pixel of the sample face image belongs to various face regions; the boundary perception sub-network is configured to extract boundary features from the sample face images, the boundary features representing probabilities that each pixel of the sample face image belongs to a boundary between different face regions; and the fusion sub-network processes the concatenated semantic features and the boundary features to obtain a face region to which each pixel of the sample face image belongs.
[0020] In some embodiments, the loss functions used in training the face parsing neural network include a loss function of a semantic perception sub-network and a loss function of a boundary perception sub-network, where the loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic features belongs to various face regions and the face region to which each pixel of the semantic features actually belongs, and the loss function of the boundary perception sub-network is determined according to the predicted probability that each pixel of the boundary features belongs to a boundary between different face regions and whether each pixel of the boundary features actually belongs to the boundary or not.
[0021] In some embodiments, a fusion sub-network of the face parsing neural network is configured to process the concatenated semantic features and boundary features to obtain fusion features for the sample face image, the fusion features representing predicted probabilities that each pixel of the sample face image belongs to various face regions and that each pixel of the sample face image belongs to a boundary, and the fusion features are configured to determine which face region each pixel of the sample face image belongs to.
[0022] In some embodiments, the loss function used in training the face parsing neural network includes a loss function of a fusion sub-network, which is determined according to the predicted probabilities that each pixel of the fusion feature belongs to various face regions, the face region that each pixel of the fusion feature actually belongs to, and whether each pixel of the fusion feature belongs to the boundary or not.
[0023] In some embodiments, the loss function L of the semantic perception sub-network is s teeth,
number
[0024] N is the total number of pixels in the semantic feature, i is the identifier of the pixel in the semantic feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the face region if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. s ij = 0, and p s ij is the predicted probability that pixel i belongs to face region j.
[0025] In some embodiments, the loss function L of the boundary perception sub-network is b teeth,
number
[0026] N is the total number of pixels in the boundary feature, i is the identifier of a pixel in the boundary feature, and y b i = 1, and pixel i does not actually belong to the boundary. b i = 0, and p b i is the predicted probability that pixel i belongs to the boundary.
[0027] In some embodiments, the loss function L of the fused sub-network is f teeth,
number
[0028] N is the total number of pixels in the fusion feature, i is the identifier of the pixel in the fusion feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the fusion feature if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. s ij = 0, and p s ij is the predicted probability that pixel i belongs to face region j, and w i > 1, and pixel i does not actually belong to the boundary. i =1.
[0029] In a third aspect of the present disclosure, there is provided a face parsing apparatus comprising: an image input module configured to input a facial image into a pre-trained face parsing neural network; a semantic feature extraction module configured to extract semantic features from the facial image using a semantic perception sub-network of the face parsing neural network, where the semantic features represent probabilities of each pixel of the facial image belonging to various facial regions; a boundary feature extraction module configured to extract boundary features from the facial image using a boundary perception sub-network of the face parsing neural network, where the boundary features represent probabilities of each pixel of the facial image belonging to a boundary between different facial regions; and a face parsing module configured to process the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain a facial region to which each pixel of the facial image belongs.
[0030] In some embodiments, the face parsing apparatus further comprises a network training module configured to train a face parsing neural network using the sample face images annotated with a face region to which each pixel belongs, and the trained face parsing neural network outputs a face region to which each pixel of the input face image belongs according to the input face image.
[0031] In some embodiments, the loss function employed by the network training module to train the face parsing neural network includes a loss function of a semantic perception sub-network and a loss function of a boundary perception sub-network, where the loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic features belongs to different face regions and the face region to which each pixel of the semantic features actually belongs, and the loss function of the boundary perception sub-network is determined according to the predicted probability that each pixel of the boundary features belongs to a boundary between different face regions and whether each pixel of the boundary features actually belongs to the boundary or not.
[0032] In some embodiments, the face parsing module is configured to process the concatenated semantic features and the boundary features using a fusion sub-network of the face parsing neural network to obtain a face region to which each pixel of the face image belongs, where the fusion features represent predicted probabilities that each pixel of the face image belongs to various face regions and predicted probabilities that each pixel of the face image belongs to a boundary, and determine the face region to which each pixel of the face image belongs according to the fusion features.
[0033] In some embodiments, the loss function employed by the network training module to train the face parsing neural network further includes a loss function of a fusion sub-network, which is determined according to the predicted probability that each pixel of the fusion feature belongs to various face regions, the face region that each pixel of the fusion feature actually belongs to, and whether each pixel of the fusion feature belongs to the boundary or not.
[0034] In some embodiments, the loss function L of the semantic perception sub-network is s teeth,
number
[0035] N is the total number of pixels in the semantic feature, i is the identifier of the pixel in the semantic feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the face region if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. s ij = 0, and p s ij is the predicted probability that pixel i belongs to face region j.
[0036] In some embodiments, the loss function L of the boundary perception sub-network is b teeth,
number
[0037] N is the total number of pixels in the boundary feature, i is the identifier of a pixel in the boundary feature, and y b i = 1, and pixel i does not actually belong to the boundary. b i = 0, and p b i is the predicted probability that pixel i belongs to the boundary.
[0038] In some embodiments, the loss function L of the fused sub-network is f teeth,
number
[0039] N is the total number of pixels in the fusion feature, i is the identifier of the pixel in the fusion feature, C is the total number of categories of face regions, j is the identifier of the category of face regions, and y is the number of pixels in the fusion feature if pixel i actually belongs to face region j. s ij = 1, and pixel i does not actually belong to face region j. sij = 0, and p s ij is the predicted probability that pixel i belongs to face region j, and w i > 1, and pixel i does not actually belong to the boundary. i =1.
[0040] In some embodiments, the semantic perception sub-network includes a convolutional layer, and the semantic feature extraction module is configured to perform dilated convolution on the face image using the convolutional layer to obtain convolutional features.
[0041] In some embodiments, the semantic perceptual sub-network further comprises a pooling layer, and the semantic feature extraction module is further configured to perform multi-scale pooling of the convolutional features using the pooling layer to obtain multi-scale pooled features, and to concatenate the multi-scale pooled features and the convolutional features.
[0042] In some embodiments, the boundary perception sub-network and the fusion sub-network include convolutional layers.
[0043] In a fourth aspect of the present disclosure, there is provided a training apparatus for a face parsing neural network, the training apparatus being configured to pre-train the face parsing neural network using sample face images annotated with a face region to which each pixel belongs, the trained face parsing neural network being configured to output a face region to which each pixel of the face image belongs according to the input face image, the face parsing neural network including a semantic perception sub-network, a boundary perception sub-network and a fusion sub-network, the semantic perception sub-network being configured to extract semantic features from the sample face images, the semantic features representing probabilities that each pixel of the sample face image belongs to various face regions, the boundary perception sub-network being configured to extract boundary features from the sample face images, the boundary features representing probabilities that each pixel of the sample face image belongs to a boundary between different face regions, the fusion sub-network processing the concatenated semantic features and the boundary features to obtain a face region to which each pixel of the sample face image belongs.
[0044] In a fifth aspect of the present disclosure, an electronic device is provided, the electronic device comprising: a memory; and a processor coupled to the memory, the processor configured to perform a face parsing method or a training method based on instructions stored in the memory.
[0045] In a sixth aspect of the present disclosure, a non-transitory computer readable storage medium having stored thereon computer instructions which, when executed by a processor, perform a face parsing or training method.
[0046] Other features and advantages of the present invention will become apparent from the following detailed description of exemplary embodiments of the present disclosure, when taken in conjunction with the accompanying drawings.
[0047] In order to more clearly describe the embodiments of the present disclosure or the technical solutions of the prior art, the following provides a brief introduction to the drawings that need to be used to describe the embodiments or the prior art. It is clear that the drawings shown below are merely a part of the embodiments of the present disclosure. Those skilled in the art may also obtain other drawings according to such drawings, assuming that no inventive efforts are involved. [Brief description of the drawings]
[0048] [Figure 1] FIG. 1 illustrates a structural diagram of a face parsing neural network according to some embodiments of the present disclosure. [Diagram 2] FIG. 1 illustrates a flowchart of a face parsing method according to some embodiments of the present disclosure. [Diagram 3] FIG. 1 shows visual face parsing results corresponding to three face parsing models. [Figure 4] FIG. 1 illustrates a structural diagram of a face pursing device according to some embodiments of the present disclosure. [Diagram 5] FIG. 1 illustrates a structural diagram of an electronic device according to some embodiments of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0049] The technical solutions of the embodiments of the present disclosure are described below clearly and completely with reference to the drawings of the embodiments. Of course, only some embodiments, not all embodiments of the present disclosure, are described herein. The following description of at least one exemplary embodiment is merely illustrative in nature, and is not intended to be limiting to the present invention, its application or use. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.
[0050] Semantic segmentation is a fundamental task in computer vision. In semantic segmentation, visual input needs to be segmented into different semantically interpretable categories. The inventor believes that face parsing is a pixel-level semantic segmentation task. Although deep learning has a strong feature extraction ability, its ability to segment pixels in boundary regions (areas between different face regions) needs to be improved. There are two reasons: first, boundary pixels are located in the intersection regions of different categories, which have a certain semantic confusion and belong to pixels that are hard to distinguish; second, pooling and convolution with stride larger than 1 may increase the receptive field, but may also reduce the resolution of the feature map, especially the information of the boundary region may be lost. The above two aspects are the main reasons why pixels in the boundary region are hard to distinguish.
[0051] Traditional face parsing techniques mainly improve the performance of face parsing by modifying the basic structure of neural networks or through block processing, both of which operate on the entire feature map and do nothing specifically on the pixels in the boundary area, so they still cannot solve the problem of low segmentation accuracy of the boundary area. For face parsing tasks, the ratio of the boundary area in the entire face area is larger than that of scene analysis and other tasks, and improving the identification accuracy of the boundary area directly leads to improving the accuracy of face parsing. Taking face parsing as an example, the disclosure discusses a method for improving the accuracy of face parsing.
[0052] The technical problem to be solved by this disclosure is how to improve the accuracy of face parsing.
[0053] The present disclosure can improve the ability of neural networks to identify boundary pixels between different facial regions in a facial image, thereby improving the accuracy of face parsing.
[0054] First, some embodiments of a face parsing neural network employed in the present disclosure are introduced with reference to FIG.
[0055] FIG. 1 illustrates a structural diagram of a face parsing neural network according to some embodiments of the present disclosure. As shown in FIG. 1, the face parsing neural network includes three branches: a semantic perception sub-network, a boundary perception sub-network, and a fusion sub-network. The semantic perception sub-network may have a convolutional layer and a pooling layer. The boundary perception sub-network and the fusion sub-network may have a convolutional layer.
[0056] (1) Semantic perception subnetwork The semantic perception sub-network is used for semantic segmentation of the input RGB (red, green, and blue) face image (i.e., each pixel is given a semantic label (eyes, nose, etc.)) to extract semantic features from the face image, and the semantic features represent the probability that each pixel of the face image belongs to various face regions. Mainstream segmentation networks, such as PSPNet (Pyramid Spatial Pooling Network) and Deeplab, can be adopted for the semantic perception sub-network. In this embodiment, the residual network ResNet-101 is preferably adopted as the skeleton segmentation network. The size of the semantic features (feature map) extracted by the semantic perception sub-network is N×C×W×H, where N represents the batch size, C represents the number of semantic label categories, and W and H represent the width and height of the semantic features.
[0057] (2) Boundary perception subnetwork The boundary perception sub-network is used to extract boundary features from face images, where the boundary features represent the probability that each pixel of the face image belongs to the boundary between different face regions. In other words, the boundary perception sub-network can handle the binary classification problem of predicting whether each pixel of the input RGB face image belongs to a boundary region. Taking ResNet (Residual Network)-101 as a skeleton segmentation network as an example, the boundary perception sub-network can extract convolutional features from the last convolutional layer of each of the three intermediate convolutional blocks of the five convolutional blocks of ResNet-101. Then, the three convolutional features are mapped to the same size (e.g., the image size of the convolutional features is changed by a resize operation) and concatenated into a combined convolutional feature. Then, the combined convolutional feature is mapped to a new feature space through a series of convolution operations. The size of the output boundary feature (predicted boundary map) is N×2×W×H, where N, W, and H match the semantic perception sub-network and only the number of channels is different. The number of channels in the boundary feature is 2 (indicating whether the pixel belongs to the boundary or not). Each pixel in the boundary feature corresponds to a 2D vector that represents the probability that the pixel belongs to the foreground (boundary) and background (non-boundary) respectively.
[0058] (3) Fusion Subnetwork The fusion sub-network is used for accurate semantic segmentation of the input RGB face image, i.e., it convolves the concatenated semantic features and the boundary features to obtain the fusion features of the face image. The fusion features represent the predicted probability that each pixel of the face image belongs to various face regions and the predicted probability that each pixel of the face image belongs to the boundary. The size of the feature map of the fusion features is also N×C×W×H, where N represents the batch size, C represents the number of categories, and W and H represent the width and height of the output feature map. The fusion sub-network further determines which face region each pixel of the face image belongs to according to the fusion features, especially by the softmax normalization function.
[0059] (4) Training the Face Parsing Neural Network When training a face parsing neural network, sample face images annotated with the face region that each pixel belongs to are used to train the face parsing neural network. The trained face parsing neural network can output the face region that each pixel of the face image belongs to according to the input face image.
[0060] (5) Loss function of face parsing neural network The loss function L used for the face parsing neural network is the loss function L of the semantic perception subnetwork. s , the loss function L of the boundary perception subnetwork b That is, L = λ1L s +λ2L b where λ1 and λ2 are both greater than zero and are the weights of the loss functions of the two different branches.
[0061] The loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic feature belongs to various face regions and the face region that each pixel of the semantic feature actually belongs to. For example, the loss function L s teeth,
number
[0062] where N is the total number of pixels in the semantic feature, i is the identifier of the pixel in the semantic feature, C is the total number of categories in the face region, and j is the identifier of the category of the face region. If pixel i actually belongs to face region j, then y s ij = 1. If pixel i does not actually belong to face region j, then y s ij = 0. sij is the predicted probability that pixel i belongs to face region j, i.e., the output value of the semantic features extracted by the semantic perception sub-network after softmax.
[0063] The loss function of the boundary perception sub-network is determined according to the predicted probability that each pixel of the boundary feature belongs to the boundary between different face regions and whether each pixel of the boundary feature actually belongs to the boundary. For example, the loss function L b teeth,
number
[0064] where N is the total number of pixels in the boundary feature and i is the identifier of a pixel in the boundary feature. If pixel i actually belongs to the boundary, then y b i If y = 1 and pixel i does not actually belong to the border, then b i = 0. b i is the predicted probability that pixel i belongs to the boundary. The boundary map (ground truth) of the boundary perception sub-network is used to indicate whether each pixel belongs to the boundary region or not. By optimizing the above loss function, the boundary perception sub-network can make the most of the boundary information of the face image to predict the probability that each pixel belongs to the boundary region.
[0065] The loss function L used to train the face parsing neural network is further denoted by the loss function L of the fused sub-network. f That is, L = λL s +λ2L b +λ3L fwhere λ1, λ2, and λ3 are all greater than zero and are the weights of the loss functions of three different branches. Those skilled in the art should understand that λ1, λ2, and λ3 can be adjusted according to actual needs for better performance of some branches of the face parsing neural network. For example, if λ2 is set larger, better boundary perception performance can be achieved in the face parsing neural network.
[0066] The loss function of the fusion sub-network is determined according to the predicted probability that each pixel of the fusion feature belongs to various face regions, the face region that each pixel of the fusion feature actually belongs to, and whether each pixel of the fusion feature belongs to the boundary or not. For example, the loss function L of the fusion sub-network is f teeth,
number
[0067] where N is the total number of pixels in the fusion feature, i is the identifier of the pixel in the fusion feature, C is the total number of categories in the face region, and j is the identifier of the category of the face region. If pixel i actually belongs to face region j, then y s ij = 1 and pixel i does not actually belong to face region j, then y s ij = 0. s ij is the predicted probability that pixel i belongs to face region j. i is the value corresponding to pixel i in the weight map, and indicates the weighting factor for pixel i. b i = 1), then w i >1(w i = 1 + α, where α is a positive value used to increase the weight of the boundary pixels. b i = 0), then w i= 1. Using the boundary map (ground truth) of the boundary perception sub-network, a weight map can be constructed to weight the loss of boundary pixels.
[0068] Those skilled in the art should understand that the function realized by each branch of the face parsing neural network depends on the loss function corresponding to each branch. After training the face parsing neural network with a total loss function consisting of the loss functions corresponding to various branches, each branch of the face parsing neural network can have a corresponding function. In addition, λ1, λ2, λ3, and α in this embodiment can be adjusted and determined according to experimental results.
[0069] This embodiment provides a face parsing neural network. On the one hand, more boundary pixel information is obtained by combining boundary perceptual features and semantic perceptual features, and on the other hand, the loss of boundary pixels is weighted to improve the influence of boundary pixels. Therefore, the face parsing neural network provided by this embodiment is more sensitive to boundary pixels that belong to (between) different face regions of a face image, and can pay more attention to boundary pixels that are hard to distinguish and recognize.
[0070] Several embodiments of the face parsing method of the present disclosure are described below with reference to FIG.
[0071] 2 shows a flowchart of a face parsing method according to some embodiments of the present disclosure. As shown in FIG. 2, the present embodiment includes steps S201 to S204.
[0072] In step S201, a face image is input to a pre-trained face parsing neural network.
[0073] In step S202, semantic features are extracted from the face image using a semantic perception sub-network of the face parsing neural network, where the semantic features represent the probability that each pixel of the face image belongs to various face regions.
[0074] In some embodiments, dilated convolution or expanded convolution is performed on the face image using a convolution layer to obtain convolutional features.
[0075] For example, in order to reduce the loss of resolution information, dilated convolution may be adopted in the fifth convolution block of ResNet-101, so that the resolution of the output feature map is 1 / 16 of the input face image instead of 1 / 32 of the input face image, thereby preserving some detail information of the face image. Those skilled in the art should understand that dilated convolution can be used in other convolution blocks and can be used in multiple convolution blocks.
[0076] In some embodiments, the convolutional features are pooled across multiple scales by using a pooling layer to obtain multi-scale pooled features, which are then concatenated with the convolutional features.
[0077] For example, the multi-scale pooling operation of PSPNet can be adopted to better use the global features of face images. As shown in FIG. 1, the convolutional features output from the last convolutional layer of the fifth convolutional block of ResNet-101 are pooled over four scales, namely 1×1, 2×2, 4×4, and 6×6. Then, these pooled features are concatenated with non-pooled convolutional features for label prediction. Those skilled in the art should understand that these features of different sizes can be mapped to the same size before concatenation (e.g., using a resize operation to change the image size of the pooled features), and then concatenated into a combined pooled feature.
[0078] In step S203, boundary features are extracted from the face image using a boundary perception sub-network of the face parsing neural network, where the boundary features represent the probability that each pixel of the face image belongs to a boundary between different face regions.
[0079] In step S204, the semantic features and boundary features, when they are concatenated, are processed using a fusion sub-network of the face parsing neural network to obtain the face region to which each pixel of the face image belongs.
[0080] This embodiment can improve the ability of the neural network to distinguish boundary pixels between different face regions in a face image, improving the accuracy and overall performance of face parsing.
[0081] The effectiveness of the present disclosure can be more intuitively verified by the following experimental data.
[0082] The contributions of the different branches are compared on the LaPa face parsing dataset. The LaPa dataset contains 22,000 face images, each with 106 landmarks and 11 categorical pixel-level face parsing annotations. The 11 categories include hair, skin, left eyebrow, right eyebrow, left eye, right eye, nose, upper lip, inside of mouth, lower lip, and background. Three models are compared, where Model A represents the results using only the semantic perception sub-network, and Model B represents the performance of adding the boundary perception sub-network and fusion sub-network to Model A but without the loss weights, i.e., L f Well then w i is always set to 1, and model C represents the performance after adding a loss weight to model B, i.e., the introduction of α. The results of the performance comparison of the three models are shown in Table 1. The values in Table 1 are F-measures. F-measure is an index used to measure the accuracy of two classification models in statistics, which simultaneously considers the precision and recall of the classification models and can be regarded as the weighted average of the precision and recall of the models. The maximum value of F-measure is 1 and the minimum value is 0. The formula for calculating F-measure is as follows:
[0083] [Table 1]
[0084] As can be seen from Table 1, the average F-score of Model B is increased by 0.87% compared with Model A, and each subclass has some improvement, which proves that adding the boundary perception sub-network can effectively improve the overall face parsing accuracy. Compared with Model B, the average F-score of Model C is increased by 1.1%, which proves that using the boundary map to weight the loss of pixels in the boundary region is also effective. Model C achieves high recognition accuracy performance in each subclass. It can be seen that both the boundary perception features and using the boundary map to weight the boundary pixel loss are effective methods to improve the performance of face parsing. Figure 3 shows the visual face parsing results corresponding to the three face parsing models. As shown in Figure 3, the first column shows the original input image, and the following four columns are the results of the enlarged part of the dotted box of the image in the first column. The second column shows the face parsing results corresponding to Model A, the third column shows the face parsing results corresponding to Model B, the fourth column shows the face parsing results corresponding to Model C, and the fifth column shows the true value.
[0085] Several embodiments of the face pursing device of the present disclosure are described below with reference to FIG.
[0086] FIG. 4 shows a structural diagram of a face parsing device according to some embodiments of the present disclosure. As shown in FIG. 4, the face parsing device 40 of this embodiment includes: The face parsing neural network includes an image input module 401 configured to input a facial image to the pre-trained face parsing neural network; a semantic feature extraction module 402 configured to extract semantic features from the facial image using a semantic perception sub-network of the face parsing neural network, where the semantic features represent probabilities that each pixel of the facial image belongs to various facial regions; a boundary feature extraction module 403 configured to extract boundary features from the facial image using a boundary perception sub-network of the face parsing neural network, where the boundary features represent probabilities that each pixel of the facial image belongs to a boundary between different facial regions; and a face parsing module 404 configured to process the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain a facial region to which each pixel of the facial image belongs.
[0087] In some embodiments, the face parsing device 40 further comprises a network training module configured to train the face parsing neural network using the sample face images annotated with the face region to which each pixel belongs, and the trained face parsing neural network can output the face region to which each pixel of the face image belongs according to the input face image.
[0088] In some embodiments, the loss function employed by the network training module 400 to train the face parsing neural network includes a loss function of a semantic perception sub-network and a loss function of a boundary perception sub-network. The loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic features belongs to various face regions and the face region to which each pixel of the semantic features actually belongs. The loss function of the boundary perception sub-network is determined according to the predicted probability that each pixel of the boundary features belongs to the boundary between different face regions and whether each pixel of the boundary features actually belongs to the boundary or not.
[0089] In some embodiments, the face parsing module 404 is configured to process the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain a face region to which each pixel of the face image belongs, where the fusion features represent predicted probabilities that each pixel of the face image belongs to various face regions and predicted probabilities that each pixel of the face image belongs to a boundary, and determine the face region to which each pixel of the face image belongs according to the fusion features.
[0090] In some embodiments, the loss function employed by the network training module 400 to train the face parsing neural network further includes a loss function of the fusion sub-network, where the loss function of the fusion sub-network is determined according to the predicted probability that each pixel of the fusion feature belongs to various face regions, the face region that each pixel of the fusion feature actually belongs to, and whether each pixel of the fusion feature belongs to the boundary or not.
[0091] In some embodiments, for example, the loss function L of the semantic perception sub-network s teeth,
number
[0092] where N is the total number of pixels in the semantic feature, i is the identifier of the pixel in the semantic feature, C is the total number of categories in the face region, and j is the identifier of the category of the face region. If pixel i actually belongs to face region j, then y s ij = 1 and pixel i does not actually belong to face region j, then y s ij = 0. s ij is the predicted probability that pixel i belongs to face region j.
[0093] In some embodiments, the loss function L of the boundary perception sub-network is b teeth,
number
[0094] where N is the total number of pixels in the boundary feature and i is the identifier of a pixel in the boundary feature. If pixel i actually belongs to the boundary, then y b i If y = 1 and pixel i does not actually belong to the border, b i = 0. b i is the predicted probability that pixel i belongs to the boundary.
[0095] In some embodiments, the loss function L of the fused sub-network is f teeth,
number
[0096] where N is the total number of pixels in the fusion feature, i is the identifier of the pixel in the fusion feature, C is the total number of categories in the face region, and j is the identifier of the category of the face region. If pixel i actually belongs to face region j, then y s ij= 1 and pixel i does not actually belong to face region j, then y s ij = 0. s ij is the predicted probability that pixel i belongs to face region j. If pixel i actually belongs to the boundary, w i >1 and pixel i does not actually belong to the boundary, then w i =1.
[0097] In some embodiments, the semantic perception sub-network includes a convolutional layer. The semantic feature extraction module 402 is configured to perform dilated convolution on the face image using the convolutional layer to obtain convolutional features.
[0098] In some embodiments, the semantic perceptual sub-network further comprises a pooling layer, and the semantic feature extraction module 402 is further configured to perform multi-scale pooling of the convolutional features using the pooling layer to obtain multi-scale pooled features, and concatenate the multi-scale pooled features and the convolutional features.
[0099] In some embodiments, the boundary perception sub-network and the fusion sub-network have convolutional layers.
[0100] In this embodiment, the neural network improves the ability to distinguish boundary pixels between different face regions in a face image, improving the accuracy and overall performance of face parsing.
[0101] Some other embodiments of the electronic device of the present disclosure will now be described with reference to FIG.
[0102] 5 shows a structural diagram of an electronic device according to some embodiments of the present disclosure. As shown in FIG. 5, the electronic device 50 of the present embodiment includes a memory 510 and a processor 520 coupled to the memory 510. The processor 520 is configured to execute the face parsing method according to any one of the above-mentioned embodiments based on the instructions stored in the memory 510.
[0103] The memory 510 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory stores, for example, an operating system, application programs, a boot loader, and other programs.
[0104] The electronic device 50 further includes an input / output interface 530, a network interface 540, a storage interface 550, etc. These interfaces 530, 540, 550, the memory 510, and the processor 520 may be connected, for example, via a bus 560. The input / output interface 530 provides a connection interface for input / output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 540 provides a connection interface for various network devices. The storage interface 550 provides a connection interface for external storage devices such as an SD card and a USB flash disk.
[0105] The present disclosure further provides a computer readable medium having stored thereon computer instructions which, when executed by a processor, implement the face parsing method of any one of the above-mentioned embodiments.
[0106] The present disclosure will be described with reference to flowcharts and / or block diagrams of methods, apparatuses (systems) and computer program products according to embodiments of the present disclosure. Each process and / or block of the flowcharts and / or block diagrams, and combinations of processes and / or blocks of the flowcharts and / or block diagrams, may be implemented by computer program instructions. The computer program product may be provided to a general-purpose computer processor, a special-purpose computer processor, an embedded processor, or other programmable data processing device to generate a machine, the instructions of which are executed by the computer or other programmable data processing device to generate means for implementing the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams.
[0107] Computer program instructions may also be stored in a computer readable memory device and instruct a computer or other programmable data processing device to operate in a specified manner to manufacture an article of manufacture including instruction means for implementing functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams, the instructions stored in the computer readable memory device.
[0108] These computer program instructions can also be loaded into a computer or other programmable device and execute a series of operational steps on the computer or other programmable device to generate a computer-implemented process such that the instructions executed on the computer or other programmable device realize the functions specified in one or more flows of the flowcharts and / or one or more blocks of the block diagrams.
[0109] The above are merely preferred embodiments of the present disclosure, and are not intended to limit the present disclosure. Any modifications, replacements, improvements, etc. within the spirit and principle of the present disclosure shall fall within the scope of protection of the present disclosure. [Explanation of symbols]
[0110] 400 Network Training Modules 401 Image Input Module 402 Semantic Feature Extraction Module 403 Boundary Feature Extraction Module 404 Face Parsing Module 50 Electronic Devices 510 Memory 520 Processor 530 Input / Output Interface 540 Network Interface 550 Storage Interface
Claims
1. 1. A method for training a face parsing neural network, comprising: pre-training the face parsing neural network using sample face images annotated with the region within the face to which each pixel belongs; The trained face parsing neural network is configured to output a region in a face to which each pixel of the face image belongs according to an input face image; the face parsing neural network includes a semantic perception sub-network, a boundary perception sub-network, and a fusion sub-network; the semantic perception sub-network is configured to extract semantic features from the sample face images, the semantic features representing probabilities that each pixel of the sample face images belongs to various intra-face regions; the boundary perception sub-network is configured to extract boundary features from the sample face image, the boundary features representing a probability that each pixel of the sample face image belongs to a boundary between different intra-facial regions; the fusion sub-network is configured to process the concatenated semantic features and boundary features to obtain a region within a face to which each pixel of the sample face image belongs; the fusion sub-network of the face parsing neural network is configured to process the concatenated semantic features and boundary features to obtain fusion features of the sample face image, the fusion features representing predicted probabilities that each pixel of the sample face image belongs to various intra-face regions and that each pixel of the sample face image belongs to the boundary, the fusion features being configured to determine which intra-face region each pixel of the sample face image belongs to; loss functions used in training the face parsing neural network include a loss function of the semantic perception sub-network, a loss function of the boundary perception sub-network, and a loss function of the fusion sub-network; a loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic feature belongs to various facial regions and the facial region to which each pixel of the semantic feature actually belongs; a loss function of the boundary perception sub-network is determined according to a predicted probability that each pixel of the boundary feature belongs to a boundary between different facial regions and whether each pixel of the boundary feature actually belongs to a boundary; The loss function of the fusion sub-network is determined according to the predicted probability that each pixel of the fusion feature belongs to various regions in the face, the region in the face to which each pixel of the fusion feature actually belongs, and whether each pixel of the fusion feature belongs to the boundary or not, and the loss function of the fusion sub-network is determined by the product of two components: the loss function relating to the predicted probability that each pixel of the fusion feature belongs to various regions in the face and the region in the face to which each pixel of the fusion feature actually belongs, and a weighting factor of each pixel of the fusion feature, and the weighting factor of each pixel of the fusion feature is smaller when each pixel does not actually belong to the boundary compared to when each pixel actually belongs to the boundary. Training methods.
2. The loss function Ls of the semantic perception sub-network is [0010] 2. The method of claim 1, wherein N is a total number of pixels of the semantic feature, i is an identifier of the pixel of the semantic feature, C is a total number of categories of regions in the face, j is an identifier of a category of region in the face, ysij=1 if pixel i actually belongs to region j in the face, ysij=0 if pixel i actually does not belong to region j in the face, and psij is the predicted probability that pixel i belongs to region j in the face.
3. The loss function Lb of the boundary perception sub-network is [0025] 2. The method of claim 1, wherein N is the total number of pixels in the boundary feature, i is an identifier for a pixel in the boundary feature, y=1 if pixel i actually belongs to the boundary, y=0 if pixel i actually does not belong to the boundary, and p is the predicted probability that pixel i belongs to the boundary.
4. The loss function Lf of the fused sub-network is [0030] 2. The method of claim 1, wherein N is a total number of pixels of the fusion feature, i is an identifier of a pixel of the fusion feature, C is a total number of categories of regions in the face, j is an identifier of a category of regions in the face, ysij=1 if pixel i actually belongs to region j in the face, ysij=0 if pixel i actually does not belong to region j in the face, psij is the predicted probability that pixel i belongs to region j in the face, wi>1 if pixel i actually belongs to a boundary, and wi=1 if pixel i does not actually belong to a boundary.
5. obtaining a pre-trained face parsing neural network by training the face parsing neural network using the training method according to any one of claims 1 to 4; inputting a face image into the pre-trained face parsing neural network; extracting semantic features from the face image using a semantic perception sub-network of the face parsing neural network, the semantic features representing the probability that each pixel of the face image belongs to various intra-face regions; extracting boundary features from the face image using a boundary perception sub-network of the face parsing neural network, the boundary features representing the probability that each pixel of the face image belongs to a boundary between different intra-face regions; processing the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain an area within the face to which each pixel of the face image belongs; A face parsing method comprising:
6. the semantic perception sub-network includes a convolutional layer; 6. The face parsing method of claim 5, wherein extracting semantic features from the face image using a semantic perceptual sub-network comprises performing dilated convolution on the face image using the convolutional layer to obtain convolutional features.
7. the semantic perceptual sub-network comprises a pooling layer; 6. The face parsing method of claim 5, wherein extracting semantic features from the face image using a semantic perceptual sub-network further comprises: performing multi-scale pooling of convolutional features using the pooling layer to obtain multi-scale pooled features; and concatenating the multi-scale pooled features and the convolutional features.
8. 6. The face parsing method of claim 5, wherein the boundary perception sub-network and the fusion sub-network comprise convolutional layers.
9. 1. A training apparatus for a face parsing neural network configured to pre-train the face parsing neural network using sample face images annotated with a region within the face to which each pixel belongs, the apparatus comprising: The trained face parsing neural network is configured to output a region in a face to which each pixel of the face image belongs according to an input face image; the face parsing neural network includes a semantic perception sub-network, a boundary perception sub-network, and a fusion sub-network; the semantic perception sub-network is configured to extract semantic features from the sample face images, the semantic features representing probabilities that each pixel of the sample face images belongs to various intra-face regions; the boundary perception sub-network is configured to extract boundary features from the sample face image, the boundary features representing a probability that each pixel of the sample face image belongs to a boundary between different intra-facial regions; the fusion sub-network is configured to process the concatenated semantic features and boundary features to obtain a region within a face to which each pixel of the sample face image belongs; the fusion sub-network of the face parsing neural network is configured to process the concatenated semantic features and boundary features to obtain fusion features of the sample face image, the fusion features representing predicted probabilities that each pixel of the sample face image belongs to various intra-face regions and that each pixel of the sample face image belongs to the boundary, the fusion features being configured to determine which intra-face region each pixel of the sample face image belongs to; loss functions used in training the face parsing neural network include a loss function of the semantic perception sub-network, a loss function of the boundary perception sub-network, and a loss function of the fusion sub-network; a loss function of the semantic perception sub-network is determined according to the predicted probability that each pixel of the semantic feature belongs to various facial regions and the facial region to which each pixel of the semantic feature actually belongs; a loss function of the boundary perception sub-network is determined according to a predicted probability that each pixel of the boundary feature belongs to a boundary between different facial regions and whether each pixel of the boundary feature actually belongs to a boundary; The loss function of the fusion sub-network is determined according to the predicted probability that each pixel of the fusion feature belongs to various regions in the face, the region in the face to which each pixel of the fusion feature actually belongs, and whether each pixel of the fusion feature belongs to the boundary or not, and the loss function of the fusion sub-network is determined by the product of two components: the loss function relating to the predicted probability that each pixel of the fusion feature belongs to various regions in the face and the region in the face to which each pixel of the fusion feature actually belongs, and a weighting factor of each pixel of the fusion feature, and the weighting factor of each pixel of the fusion feature is smaller when each pixel does not actually belong to the boundary compared to when each pixel actually belongs to the boundary. Training equipment.
10. A training device according to claim 9, configured to obtain a pre-trained face parsing neural network; an image input module configured to input a face image to the pre-trained face parsing neural network; a semantic feature extraction module configured to extract semantic features from the face image using a semantic perception sub-network of the face parsing neural network, the semantic features representing probabilities that each pixel of the face image belongs to various intra-face regions; a boundary feature extraction module configured to extract boundary features from the face image using a boundary perception sub-network of the face parsing neural network, the boundary features representing a probability that each pixel of the face image belongs to a boundary between different intra-face regions; a face parsing module configured to process the concatenated semantic features and boundary features using a fusion sub-network of the face parsing neural network to obtain an area within the face to which each pixel of the face image belongs; A face parsing device comprising:
11. 1. An electronic device comprising: Memory, and a processor coupled to the memory, the processor configured to execute the face parsing method of any one of claims 5 to 8 or the training method of any one of claims 1 to 4 based on instructions stored in the memory.
12. A non-transitory computer readable storage medium having stored thereon computer instructions which, when executed by a processor, perform a face parsing method according to any one of claims 5 to 8 or a training method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Face recognition method and device
CN108062543A
Image processing method and device, electronic device, and storage medium
CN109255784A
Face living body detection method and device based on multi-feature fusion
CN110348322A
