Face Image Detection Model Training Method, Face Image Detection Method and Device
By extracting and recombining the brightness and grayscale features of face images, a model that can more accurately detect the yin and yang faces of face images is trained, solving the problems of large amount of data and poor generalization of the model in traditional methods.
Patent Information
- Application Number
- CN202210351554.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-02
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-04-02
AI Technical Summary
Traditional face image detection methods require a large amount of training data and manual screening, resulting in too large data solution space, which cannot ensure that the model learns the correct features, and is not very generalized.
By obtaining the face area data set, the face key points are extracted and divided into multiple sub-regions, the brightness and grayscale features are selected for extraction and recombination, and the recombinant features are formed for training the face image detection model.
Diversified features are obtained from a small amount of data, and a model that can more accurately and comprehensively detect the Yin and Yang faces of human faces is trained, solving the problems of large amount of data, large solution space and poor generalization of the model.
Smart Images

Figure CN114648800B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of image processing technology. More specifically, the present disclosure relates to a method for training a face image detection model, a face image detection method, and an apparatus therefor. Background Art
[0002] Currently, face image detection is applied in an increasingly wide range of fields. Face images can be presented in the form of pictures, photos, etc. Considering whether there is a problem of yin-yang face in the image, it is necessary to be cautious when applying these face images, and it is necessary to detect the face image before application to determine whether there is a yin-yang face.
[0003] In traditional face image detection methods, in order to detect whether there is a yin-yang face in a face image, a large amount of training data is required to train a face detection neural network, and the workload of manually screening yin-yang faces and normal faces is also extremely large. Moreover, due to the small amount of yin-yang face data, the solution space is likely to be too large, and it is impossible to ensure that the model learns the correct features. Summary of the Invention
[0004] To at least partially solve the technical problems mentioned in the background art, the solution of the present disclosure provides a method for training a face image detection model, a face image detection method, and an apparatus therefor.
[0005] According to a first aspect of the present disclosure, there is provided a method for training a face image detection model, wherein the method includes: obtaining a face region data set; for the face region pictures in the face region data set, extracting face key points, evenly dividing them into a plurality of first sub-regions, and dividing them into a plurality of second sub-regions according to facial features; for the face key points, the first sub-regions, and the second sub-regions, selecting one or both of a brightness feature and a gray-scale feature for extraction; according to the face key points, reorganizing the extracted brightness feature and gray-scale feature to form a reorganized feature; and training the face image detection model using the reorganized feature.
[0006] Optionally, the extracting face key points, evenly dividing them into a plurality of first sub-regions, and dividing them into a plurality of second sub-regions according to facial features for the face region pictures in the face region data set includes: extracting the face key points in the face region pictures according to a face key point detection algorithm; evenly dividing the face region pictures into a plurality of first sub-regions in a grid matrix manner; and dividing the face region pictures into a plurality of second sub-regions according to a facial feature segmentation algorithm.
[0007] Optionally, the extraction of one or both of the luminance feature and the grayscale feature for the face key points, the first sub-regions, and the second sub-regions includes: extracting a first luminance feature and a first grayscale feature for the face key points; extracting a second luminance feature for the plurality of first sub-regions; and extracting a second grayscale feature for the plurality of second sub-regions.
[0008] Optionally, the recombination of the extracted luminance feature and grayscale feature according to the face key points to form a recombined feature includes: determining the second luminance feature of each face key point in the corresponding first sub-region as the key point luminance feature, and determining the second grayscale feature of each face key point in the corresponding second sub-region as the key point grayscale feature; combining the first luminance feature of each key point with the key point luminance feature to form a luminance combined feature, and combining the first grayscale feature of each face key point with the key point grayscale feature to form a grayscale combined feature; and combining the luminance combined feature and the grayscale combined feature to form a recombined feature.
[0009] Optionally, the first luminance feature includes a luminance value obtained in the HSV mode, the first grayscale feature includes a grayscale value obtained in the RGB mode, the second luminance feature includes a luminance mean and a luminance variance obtained in the HSV mode, and the second grayscale feature includes a grayscale mean and a grayscale variance obtained in the RGB mode.
[0010] According to a second aspect of the present disclosure, there is provided a face image detection method, wherein the method includes: obtaining a face image to be detected; obtaining face region data according to the face image to be detected; and obtaining a face image detection result of the face image to be detected based on the face region data through a face image detection model, where the face image detection model is trained by the above face image detection model training method.
[0011] According to a third aspect of the present disclosure, there is provided a face image detection model training apparatus, wherein the apparatus includes: a first obtaining module for obtaining a face region data set; a partitioning module for extracting face key points, evenly dividing them into a plurality of first sub-regions, and dividing them into a plurality of second sub-regions according to facial features for the face region pictures in the face region data set; a feature extraction module for extracting one or both of a luminance feature and a grayscale feature for the face key points, the first sub-regions, and the second sub-regions; a feature recombination module for recombining the extracted luminance feature and grayscale feature according to the face key points to form a recombined feature; and a training module for training the face image detection model using the recombined feature.
[0012] Optionally, the partitioning module is configured to extract face key points from the face region images in the face region dataset, evenly divide them into multiple first sub-regions, and divide them into multiple second sub-regions according to facial features in the following manner: extract the face key points in the face region images according to a face key point detection algorithm; evenly divide the face region images into multiple first sub-regions in the form of a grid matrix; divide the face region images into multiple second sub-regions according to a facial feature segmentation algorithm.
[0013] Optionally, the feature extraction module is configured to select one or both of a brightness feature and a grayscale feature to extract for the face key points, the first sub-regions, and the second sub-regions in the following manner: extract a first brightness feature and a first grayscale feature for the face key points; extract a second brightness feature for the multiple first sub-regions; extract a second grayscale feature for the multiple second sub-regions.
[0014] Optionally, the feature recombination module is configured to recombine the extracted brightness feature and grayscale feature according to the face key points to form a recombined feature in the following manner: determine the second brightness feature of each face key point in the corresponding first sub-region as the key point brightness feature, and determine the second grayscale feature of each face key point in the corresponding second sub-region as the key point grayscale feature; combine the first brightness feature of each key point with the key point brightness feature to form a brightness combined feature, and combine the first grayscale feature of each key point with the key point grayscale feature to form a grayscale combined feature; combine the brightness combined feature and the grayscale combined feature to form a recombined feature.
[0015] Optionally, the first brightness feature includes a brightness value obtained in the HSV mode, the first grayscale feature includes a grayscale value obtained in the RGB mode, the second brightness feature includes a brightness mean and a brightness variance obtained in the HSV mode, and the second grayscale feature includes a grayscale mean and a grayscale variance obtained in the RGB mode.
[0016] According to a fourth aspect of the present disclosure, the present disclosure provides a face image detection device, where the device includes: a second acquisition module configured to acquire a face image to be detected; a third acquisition module configured to acquire face region data according to the face image to be detected; a detection module configured to obtain a face image detection result of the face image to be detected based on the face region data through a face image detection model, where the face image detection model is trained by the above-mentioned face image detection model training device.
[0017] According to a fifth aspect of the present disclosure, the present disclosure provides an electronic device, wherein the electronic device includes a memory and a processor, a computer program is stored in the memory, and when the processor executes the computer program, the method of the first aspect of the present disclosure above is implemented or the method of the second aspect of the present disclosure above is implemented.
[0018] According to a sixth aspect of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed, the method of the first aspect of the present disclosure above is implemented or the method of the second aspect of the present disclosure above is implemented.
[0019] Through the face image detection model training method of the present disclosure, diverse brightness features and gray-scale features can be obtained from a small amount of data, and by recombining these features to train the face image detection model, a face image detection model capable of more accurately and comprehensively detecting yin-yang faces in face images can be trained, thereby solving the problems of large data volume, large solution space, and weak model generalization in traditional image classification methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features, and advantages of the exemplary embodiments of the present disclosure will become readily understood. In the drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:
[0021] Figure 1 is a flowchart showing a face image detection model training method according to an embodiment of the present disclosure;
[0022] Figure 2 is an architecture diagram showing a face image detection model according to an embodiment of the present disclosure;
[0023] Figure 3 is a flowchart showing a face image detection method according to an embodiment of the present disclosure;
[0024] Figure 4 is a schematic block diagram showing a face image detection model training device according to an embodiment of the present disclosure;
[0025] Figure 5 is a schematic block diagram showing a face image detection device according to an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] Next, the technical solutions in the embodiments of the present disclosure will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present disclosure.
[0027] The following will describe the specific implementation manners of the present disclosure in detail with reference to the accompanying drawings.
[0028] The present disclosure provides a method for training a face image detection model. Refer to Figure 1 , Figure 1 which is a flowchart showing a method for training a face image detection model according to an embodiment of the present disclosure. As shown in Figure 1 , the method for training the face image detection model includes the following steps S101 - S105. Step S101: Obtain a face region data set. Step S102: For the face region pictures in the face region data set, extract face key points, evenly divide them into multiple first sub-regions, and divide them into multiple second sub-regions according to facial features. Step S103: For the face key points, the first sub-regions, and the second sub-regions, select one or both of the brightness feature and the gray-scale feature for extraction. Step S104: According to the face key points, recombine the extracted brightness feature and gray-scale feature to form a recombined feature. Step S105: Use the recombined feature to train the face image detection model.
[0029] Through the method for training a face image detection model of the present disclosure, diverse brightness features and gray-scale features can be obtained from a small amount of data, and by recombining these features to train the face image detection model, a face image detection model that can perform more accurate and comprehensive yin-yang face detection on face images can be trained, thereby solving the problems of large data volume, large solution space, and weak model generalization ability of traditional image classification methods.
[0030] In step S101, a face region data set can be obtained.
[0031] According to an embodiment of the present disclosure, the face image detection model is a classification model for detecting yin-yang faces of face images. Before using this model to detect yin-yang faces of faces, this model needs to be trained. In order to train the face image detection model, first, a face region data set needs to be obtained. This face region data set only includes a small number of pictures, for example, about 300 positive and negative samples.
[0032] In one embodiment, the obtaining of the face region dataset may include: obtaining a preset portrait dataset; and obtaining the face region dataset through a face detection algorithm according to the preset portrait dataset. Among them, the preset portrait dataset may include a self-built dataset, and the scale of the self-built dataset may be, for example, about 300 positive and negative samples. Of course, it may also include any other applicable datasets. In addition, the portraits in the preset portrait dataset may include photos, pictures, etc. containing face images. After obtaining the preset portrait dataset, the face region can be extracted from each portrait through a face detection algorithm to form a face region dataset.
[0033] Specifically, the obtaining of the face region dataset through a face detection algorithm according to the preset portrait dataset includes: detecting the face bounding boxes of each portrait in the preset portrait dataset through the face detection algorithm; and intercepting all the face bounding boxes as the face region dataset. Among them, the face detection algorithm may include general object detection algorithms, such as the YOLO series algorithms, CenterNet, etc., or specialized face detection algorithms, such as MTCNN, CenterFace, PCN, etc., which are not limited herein. By using a face detection algorithm to detect the preset portrait dataset, the face bounding boxes of each portrait in the dataset can be obtained, and then all the face bounding boxes can be directly intercepted as the face region dataset.
[0034] In another embodiment, a pre-prepared face region dataset can be directly called. The face region dataset can be obtained in advance through the method of the above-described embodiment or through any other applicable method.
[0035] In step S102, for the face region pictures in the face region dataset, face key points can be extracted, evenly divided into multiple first sub-regions, and divided into multiple second sub-regions according to the facial features.
[0036] According to an embodiment of the present disclosure, after obtaining the face region dataset, region division can be performed on each face region picture in the face region dataset. In particular, three methods can be adopted, namely, extracting face key points, evenly dividing into multiple regions, and dividing into multiple regions according to the facial features.
[0037] Specifically, the extracting of the face key points, evenly dividing into multiple first sub-regions, and dividing into multiple second sub-regions according to the facial features for the face region pictures in the face region dataset may include: extracting the face key points in the face region picture according to a face key point detection algorithm; evenly dividing the face region picture into multiple first sub-regions in the form of a grid matrix; and dividing the face region picture into multiple second sub-regions according to a facial feature segmentation algorithm.
[0038] In this embodiment, known algorithms for facial keypoint detection, such as BlazeFace, PFLD, Dlib, etc., can be used to extract facial keypoints in each facial region picture, such as 468 facial keypoints. And the facial region pictures can be evenly divided into n×n regions in the form of a grid matrix by known methods, such as 10×10 regions. In addition, known facial feature segmentation algorithms, such as image segmentation / semantic segmentation algorithms like maskrcnn, deeplabv3, BiSeNet, Unet, etc., can be used to divide the facial region pictures into multiple regions based on facial features, such as 7 regions including the forehead, left face, right face, left eye, right eye, nose, and mouth.
[0039] In step S103, for the facial keypoints, the first sub-region, and the second sub-region, one or both of the brightness feature and the grayscale feature can be selected for extraction.
[0040] According to an embodiment of the present disclosure, after dividing the facial region pictures into regions, the brightness feature and / or the grayscale feature of the facial keypoints and regions obtained by different methods can be extracted.
[0041] In one embodiment, the selection of one or both of the brightness feature and the grayscale feature for the facial keypoints, the first sub-region, and the second sub-region can include: extracting a first brightness feature and a first grayscale feature for the facial keypoints; extracting a second brightness feature for the multiple first sub-regions; and extracting a second grayscale feature for the multiple second sub-regions.
[0042] In this embodiment, a first brightness feature and a first grayscale feature are extracted for the facial keypoints, a second brightness feature is extracted for the evenly divided regions, and a second grayscale feature is extracted for the regions divided according to facial features.
[0043] Specifically, the first brightness feature includes the brightness value obtained in the HSV mode, the first grayscale feature includes the grayscale value obtained in the RGB mode, the second brightness feature includes the brightness mean and brightness variance obtained in the HSV mode, and the second grayscale feature includes the grayscale mean and grayscale variance obtained in the RGB mode.
[0044] For facial keypoints, since one facial keypoint corresponds to one pixel in the facial region picture, the grayscale value of the corresponding pixel can be directly calculated for the facial keypoints in the RGB mode through the formula G = 0.299×R + 0.587×G + 0.114×B. By converting the RGB mode to the HSV mode, the brightness value of the pixel corresponding to the facial keypoint can be directly obtained in the HSV mode.
[0045] For example, when 468 face key points are extracted from each face region picture, the dimension of the features of all the face key points of each face region picture is 468×2, and 468 pairs of brightness values and gray values are concatenated together to form the features of all the key points of a face region picture.
[0046] For the evenly divided regions, the RGB mode can be converted to the HSV mode, and the brightness values of all the pixel points in each region can be directly obtained in the HSV mode, and the brightness mean and brightness variance of each region can be calculated according to the brightness value and the number of pixels in each region.
[0047] For example, when each face region picture is evenly divided into 100 regions of 10×10, the dimension of the features of all the regions of each face region picture is 100×2, and 100 pairs of brightness mean and brightness variance are concatenated together to form the brightness features of all the regions of a face region picture.
[0048] For the regions divided according to the facial features, in the RGB mode, the gray values of all the pixel points in each region can be directly calculated, and the gray mean and gray variance of each region can be calculated according to the gray value and the number of pixels in each region.
[0049] For example, when each face region picture is divided into 7 regions according to the facial features, the dimension of the features of all the regions of each face region picture is 7×2, and 7 pairs of gray mean and gray variance are concatenated together to form the gray features of all the regions of a face region picture.
[0050] In another embodiment, the selecting one or two of the brightness feature and the gray feature for extraction for the face key points, the first sub-regions, and the second sub-regions may include: extracting a first brightness feature and a first gray feature for the face key points; extracting a second gray feature for the multiple first sub-regions; and extracting a second brightness feature for the multiple second sub-regions.
[0051] In this embodiment, by swapping the features extracted from the first sub-regions and the second sub-regions, the specific feature extraction method for this embodiment can refer to the description of the previous embodiment and will not be elaborated here.
[0052] In step S104, the extracted brightness feature and gray feature may be reorganized according to the face key points to form a reorganized feature.
[0053] According to an embodiment of the present disclosure, after the brightness feature and the gray feature of the face region picture are extracted, the brightness feature and the gray feature are reorganized based on the face key points.
[0054] Specifically, the reorganization of the extracted brightness feature and grayscale feature according to the facial key points to form a reorganization feature may include: determining the second brightness feature of each facial key point in the corresponding first sub-region as the key point brightness feature, and determining the second grayscale feature of each facial key point in the corresponding second sub-region as the key point grayscale feature; combining the first brightness feature of each key point with the key point brightness feature to form a brightness combination feature, and combining the first grayscale feature of each key point with the key point grayscale feature to form a grayscale combination feature; combining the brightness combination feature and the grayscale combination feature to form a reorganization feature.
[0055] According to this embodiment, since the facial key points are included in the regions evenly divided and the regions divided according to the facial features, in order to reorganize the brightness feature and region feature obtained based on different region divisions according to the facial key points, first traverse all facial key points in sequence, find the corresponding region of each key point in the region evenly divided, and use the brightness feature of the corresponding region as the key point brightness feature. Similarly, traverse all facial key points in sequence, find the corresponding region of each key point in the region divided according to the facial features, and use the grayscale feature of the corresponding region as the key point grayscale feature. Then combine the first brightness feature of each key point with the key point brightness feature, and combine the first grayscale feature of each key point with the key point grayscale feature. Finally, combine the brightness combination features and grayscale combination features of all key points to form a reorganization feature.
[0056] For example, for each facial region picture, 468 facial key points are extracted. For the facial key points, brightness values and grayscale values can be extracted, and a total of 468 pairs of brightness values and grayscale values are extracted; for each facial region picture, it is evenly divided into 100 grid regions of 10×10. For each grid region, a brightness mean and a brightness variance can be extracted, and a total of 100 pairs of brightness means and brightness variances are extracted; for each facial region picture, it is divided into 7 facial feature regions according to the facial features. For each facial feature region, a grayscale mean and a grayscale variance can be extracted, and a total of 7 pairs of grayscale means and grayscale variances are extracted.
[0057] Traverse 468 facial key points in 100 grid regions, determine the grid region where each facial key point is located, and use the brightness mean and brightness variance extracted from each grid region as the brightness mean and brightness variance of the facial key point located in the grid region. Therefore, each facial key point can obtain a brightness mean and a brightness variance. Combining the brightness value of each facial key point with the corresponding brightness mean and brightness variance obtained, a 468×3-dimensional brightness combination feature composed of 468 brightness values, 468 brightness means, and 468 brightness variances can be obtained.
[0058] Traverse 468 facial key points in 7 facial feature regions, determine the facial feature region where each facial key point is located, and use the grayscale mean and grayscale variance extracted from each facial feature region as the grayscale mean and grayscale variance of the facial key point located in that facial feature region. Therefore, each facial key point can obtain a grayscale mean and a grayscale variance. Combine the grayscale value of each facial key point with the corresponding obtained grayscale mean and grayscale variance to obtain a 468×3-dimensional grayscale combination feature composed of 468 grayscale values, 468 grayscale means, and 468 grayscale variances.
[0059] Finally, stack the above brightness combination feature and grayscale combination feature together to form a 468×6-dimensional recombined feature. In this way, a 468×6-dimensional recombined feature can be obtained for each facial region picture in the facial region dataset.
[0060] In step S105, the facial image detection model can be trained using the recombined feature.
[0061] According to an embodiment of the present disclosure, the facial image detection model can be any applicable classification network model that can perform binary classification. The output of this facial image detection model is a classification score corresponding to whether the facial image is a yin-yang face, that is, whether it is a yin-yang face or not.
[0062] For the convenience of understanding the facial image detection model, reference can be made to Figure 2 , Figure 2 which is an architecture diagram showing the facial image detection model according to an embodiment of the present disclosure. As Figure 2 shown, taking the example of obtaining a set of 468×6-dimensional recombined features for each facial region picture in the facial region dataset, since this set of 468×6-dimensional recombined features is stacked from a set of 468×3-dimensional brightness combination features and a set of 468×3-dimensional grayscale combination features, convolutional calculations need to be performed separately. Use a set of one-dimensional convolution + BatchNorm + LeakyReLU to perform convolution on a set of 468×3-dimensional brightness combination features, and use another set of one-dimensional convolution + BatchNorm + LeakyReLU to perform convolution on a set of 468×3-dimensional grayscale combination features to generate two sets of 256×128 feature maps. At this time, regard the two sets of feature maps together as a 256×256 feature map and input it into a set of one-dimensional convolution + BatchNorm + LeakyReLU for feature fusion, then generate a 1024-dimensional feature vector through one-dimensional average pooling, and finally output the classification result through dropout and a fully connected layer.
[0063] Specifically, for example, the Adam optimizer can be used to train the face image detection model. For example, the initial learning rate can be set to 0.001, and the loss function can be, for example, cross-entropy, and the training is continued until the loss is stable. Of course, any other applicable optimizer can also be used, the initial learning rate can also be set manually, and the loss function can also be any applicable loss function.
[0064] According to the technical solution of the present disclosure, different methods can be adopted to refine the partitioning of the face region picture, extract different brightness features and gray-scale features for different partitioning methods, and then combine different brightness features and combine different gray-scale features based on the most refined key points, so as to recombine the brightness features and gray-scale features to form recombined features. In this way, different brightness features and different gray-scale features based on face key points can be obtained, making the features more refined and diverse. Thus, rich training features can be obtained by only processing a small number of pictures in this way. Training the detection model with such training features can solve the problems of large data volume, large solution space, and weak model generalization ability in traditional image classification methods.
[0065] The present disclosure also provides a face image detection method. Refer to Figure 3 , Figure 3 is a flowchart showing a face image detection method according to an embodiment of the present disclosure. As shown in Figure 3 , the face image detection method includes the following steps S201 - S203. Step S201: Obtain a face image to be detected. Step S202: Obtain face region data according to the face image to be detected. Step S203: Based on the face region data, obtain a face image detection result of the face image to be detected through a face image detection model, where the face image detection model is trained by the above face image detection model training method.
[0066] Through the face image detection method of the present disclosure, more comprehensive and accurate yin-yang face detection can be performed on a face image through the face image detection model.
[0067] In step S201, a face image to be detected can be obtained.
[0068] According to an embodiment of the present disclosure, in order to detect the blurriness of a face image, a face image to be detected should first be obtained. The face image to be detected can be a pre-prepared image or an image currently captured by means of a photographic or video camera device.
[0069] In step S202, face region data can be obtained according to the face image to be detected.
[0070] According to the embodiments of the present disclosure, after obtaining the face image to be detected, the face region data can be obtained by using the face detection algorithm as in the embodiment of the face image detection model training method described above. Of course, the face region data can also be obtained by any other applicable method.
[0071] In step S203, a face image detection result of the face image to be detected may be obtained based on the face region data through a face image detection model.
[0072] According to an embodiment of the present disclosure, after obtaining the face region data, the face region data can be combined with Figure 1 As in the embodiment of the face image detection model training method, a recombined feature is obtained, and the recombined feature is input into the face image detection model to obtain a face image detection result. Specifically, the detection result includes a binary classification result, representing whether the face image is a yin-yang face, for example, it can be set to 1 for a yin-yang face image and 0 for a non-yin-yang face image.
[0073] In addition, regarding the face image detection model, the above face image detection model training method has been combined with Figure 2 The description has been given and will not be repeated here.
[0074] The present disclosure also provides a face image detection model training device. The device is used to perform the above combination Figure 1 The steps in an embodiment of a facial image detection model training method are described.
[0075] Reference Figure 4 , Figure 4 FIG. 1 is a schematic block diagram showing a face image detection model training device 100 according to an embodiment of the present disclosure. Figure 4 As shown, the face image detection model training device 100 includes a first acquisition module 101, a partitioning module 102, a feature extraction module 103, a feature reorganization module 104 and a training module 105. The first acquisition module 101 is used to obtain a face area data set. The partitioning module 102 is used to extract face key points, divide the face area image in the face area data set into a plurality of first sub-areas on average, and divide the face area into a plurality of second sub-areas according to the facial features. The feature extraction module 103 is used to select one or two of brightness features and grayscale features for extraction from the face key points, the first sub-areas and the second sub-areas. The feature reorganization module 104 is used to reorganize the extracted brightness features and grayscale features according to the face key points to form reorganized features. The training module 105 is used to train the face image detection model using the reorganized features.
[0076] According to an embodiment of the present disclosure, the partitioning module 102 is configured to extract face key points from the face region pictures in the face region dataset, evenly divide them into multiple first sub-regions, and divide them into multiple second sub-regions according to facial features in the following manner: extract the face key points in the face region picture according to a face key point detection algorithm; evenly divide the face region picture into multiple first sub-regions in the form of a grid matrix; divide the face region picture into multiple second sub-regions according to a facial feature segmentation algorithm.
[0077] According to an embodiment of the present disclosure, the feature extraction module 103 is configured to select one or both of a brightness feature and a gray-scale feature for extraction from the face key points, the first sub-regions, and the second sub-regions in the following manner: extract a first brightness feature and a first gray-scale feature from the face key points; extract a second brightness feature from the multiple first sub-regions; extract a second gray-scale feature from the multiple second sub-regions.
[0078] According to an embodiment of the present disclosure, the feature recombination module 104 is configured to recombine the extracted brightness feature and gray-scale feature according to the face key points to form a recombined feature in the following manner: determine the second brightness feature of each face key point in the corresponding first sub-region as the key point brightness feature, and determine the second gray-scale feature of each face key point in the corresponding second sub-region as the key point gray-scale feature; combine the first brightness feature of each key point with the key point brightness feature to form a brightness combined feature, and combine the first gray-scale feature of each key point with the key point gray-scale feature to form a gray-scale combined feature; combine the brightness combined feature and the gray-scale combined feature to form a recombined feature.
[0079] According to an embodiment of the present disclosure, the first brightness feature includes a brightness value obtained in the HSV mode, the first gray-scale feature includes a gray-scale value obtained in the RGB mode, the second brightness feature includes a brightness mean value and a brightness variance obtained in the HSV mode, and the second gray-scale feature includes a gray-scale mean value and a gray-scale variance obtained in the RGB mode.
[0080] The present disclosure also provides a face image detection device. The device is configured to execute the steps in the method embodiment of face image detection described above in combination with Figure 3 The steps in an embodiment of a face image detection method described above.
[0081] Referring to Figure 5 , Figure 5 FIG. is a schematic block diagram showing a face image detection device 200 according to an embodiment of the present disclosure. As Figure 5As shown, the face image detection device 200 includes a second acquisition module 201, a third acquisition module 202, and a detection module 203. The second acquisition module 201 is used to acquire a face image to be detected. The third acquisition module 302 is used to acquire face region data according to the face image to be detected. The detection module 303 is used to obtain a face image detection result of the face image to be detected based on the face region data through a face image detection model, where the face image detection model is trained by the above-mentioned face image detection model training device 100.
[0082] It can be understood that, regarding the face image detection device in the above-described embodiments with reference to Figure 5 The specific manner in which each module performs operations has been described in detail in the embodiments of the face image detection method described in conjunction with Figure 3 and will not be elaborated here.
[0083] The present disclosure also provides an electronic device. Among them, the electronic device includes a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, it implements the face image detection model training method described in conjunction with Figure 1 or implements the face image detection method described in conjunction with Figure 3 respectively.
[0084] It can be understood that the steps implemented when the processor executes the computer program are basically the same as the implementation manners of the respective steps in the above methods. The specific manners have been described in detail in the embodiments of the face image detection model training method and the face image detection method, and will not be elaborated here.
[0085] In another aspect, the present disclosure provides a computer-readable storage medium. Among them, the storage medium stores a computer program. When the computer program is executed, it implements the face image detection model training method described in conjunction with Figure 1 or implements the face image detection method described in conjunction with Figure 3 respectively.
[0086] It can be understood that the steps implemented when the processor executes the computer program are basically the same as the implementation manners of the respective steps in the above methods. The specific manners have been described in detail in the embodiments of the face image detection model training method and the face image detection method, and will not be elaborated here.
[0087] The above has introduced the embodiments of the present disclosure in detail. Specific examples are used herein to elaborate on the principles and implementation manners of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure; at the same time, for those of ordinary skill in the art, according to the idea of the present disclosure, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation on the present disclosure.
[0088] It should be understood that the terms "first", "second", etc. in the claims, specification and drawings of the present disclosure are used to distinguish different objects, rather than to describe a specific order. The terms "comprising" and "including" used in the specification and claims of the present disclosure indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.
[0089] It should also be understood that the terms used in this specification of the present disclosure are only for the purpose of describing specific embodiments and are not intended to limit the present disclosure. As used in the specification and claims of the present disclosure, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include the plural forms. It should also be further understood that the term "and / or" used in the specification and claims of the present disclosure refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0090] The above has introduced the embodiments of the present disclosure in detail. Specific examples are used herein to elaborate on the principles and implementation manners of the present disclosure. The description of the above embodiments is only used to help understand the method and its core idea of the present disclosure. At the same time, the changes or deformations made by those skilled in the art based on the idea of the present disclosure in the specific implementation manners and application scopes of the present disclosure all fall within the scope of protection of the present disclosure. In summary, the content of this specification should not be construed as a limitation on the present disclosure.
Claims
1. A method for training a face image detection model, wherein, the method includes: obtaining a face region dataset; for the face region pictures in the face region dataset, extracting face key points, evenly dividing them into multiple first sub-regions, and dividing them into multiple second sub-regions according to facial features; for the face key points, the first sub-regions, and the second sub-regions, selecting one or both of the brightness feature and the grayscale feature for extraction; recombining the extracted brightness feature and grayscale feature according to the face key points to form a recombined feature; training the face image detection model with the recombined feature; the step of selecting one or both of the brightness feature and the grayscale feature for extraction for the face key points, the first sub-regions, and the second sub-regions includes: extracting a first brightness feature and a first grayscale feature for the face key points; extracting a second brightness feature for the multiple first sub-regions; extracting a second grayscale feature for the multiple second sub-regions. the step of recombining the extracted brightness feature and grayscale feature according to the face key points to form a recombined feature includes: determining the second brightness feature of each face key point in the corresponding first sub-region as the key point brightness feature, and determining the second grayscale feature of each face key point in the corresponding second sub-region as the key point grayscale feature; combining the first brightness feature of each key point with the key point brightness feature to form a brightness combined feature, and combining the first grayscale feature of each face key point with the key point grayscale feature to form a grayscale combined feature; combining the brightness combined feature and the grayscale combined feature to form a recombined feature.
2. The method for training a face image detection model according to claim 1, wherein, the step of extracting face key points, evenly dividing them into multiple first sub-regions, and dividing them into multiple second sub-regions according to facial features for the face region pictures in the face region dataset includes: extracting the face key points in the face region picture according to a face key point detection algorithm; evenly dividing the face region picture into multiple first sub-regions in a grid matrix manner; dividing the face region picture into multiple second sub-regions according to a facial feature segmentation algorithm.
3. The method for training a face image detection model according to claim 1, wherein, the first brightness feature includes a brightness value obtained in the HSV mode, the first grayscale feature includes a grayscale value obtained in the RGB mode, the second brightness feature includes a brightness mean and a brightness variance obtained in the HSV mode, and the second grayscale feature includes a grayscale mean and a grayscale variance obtained in the RGB mode.
4. A face image detection method, wherein, the method includes: obtaining a face image to be detected; obtaining face region data according to the face image to be detected; Based on the face region data, obtain the face image detection result of the face image to be detected through a face image detection model, where the face image detection model is trained by the face image detection model training method according to any one of claims 1 to 3.
5. A face image detection model training device, wherein, the device includes: A first acquisition module, which is used to acquire a face region data set; A partitioning module, which is used to extract face key points for the face region pictures in the face region data set, evenly divide them into multiple first sub-regions, and divide them into multiple second sub-regions according to the facial features; A feature extraction module, which is used to select one or both of the brightness feature and the grayscale feature for extraction for the face key points, the first sub-regions, and the second sub-regions; A feature recombination module, which is used to recombine the extracted brightness feature and grayscale feature according to the face key points to form a recombined feature; A training module, which is used to train the face image detection model by using the recombined feature; The feature extraction module is used to select one or both of the brightness feature and the grayscale feature for extraction for the face key points, the first sub-regions, and the second sub-regions in the following manner: extract a first brightness feature and a first grayscale feature for the face key points; extract a second brightness feature for the multiple first sub-regions; extract a second grayscale feature for the multiple second sub-regions. The feature recombination module is used to recombine the extracted brightness feature and grayscale feature according to the face key points to form a recombined feature in the following manner: determine the second brightness feature of each face key point in the corresponding first sub-region as the key point brightness feature, and determine the second grayscale feature of each face key point in the corresponding second sub-region as the key point grayscale feature; combine the first brightness feature of each key point with the key point brightness feature to form a brightness combined feature, and combine the first grayscale feature of each key point with the key point grayscale feature to form a grayscale combined feature; combine the brightness combined feature and the grayscale combined feature to form a recombined feature.
6. A face image detection device, wherein, the device includes: A second acquisition module, which is used to acquire a face image to be detected; A third acquisition module, which is used to acquire face region data according to the face image to be detected; A detection module, which is used to obtain the face image detection result of the face image to be detected based on the face region data through a face image detection model, where the face image detection model is trained by the face image detection model training device according to claim 5.
7. An electronic device, wherein, the electronic device includes a memory and a processor, a computer program is stored in the memory, and when the processor executes the computer program, it implements the face image detection model training method according to any one of claims 1 to 3, or implements the face image detection method according to claim 4.
8. A computer-readable storage medium, wherein, the storage medium stores a computer program, and when the computer program is executed, it implements the method for training a face image detection model according to any one of claims 1 to 3, or implements the face image detection method according to claim 4.
Citation Information
Patent Citations
Image processing method, device, apparatus, and storage medium
CN109255763A
Living body detection method and device
CN112084917A