A method, device and storage medium for constructing a face recognition training set
By generating a three-dimensional makeup face model and collecting images from multiple angles, the problem of insufficient data richness in the construction of the face recognition training set is solved, and the training set production efficiency and model generalization ability are improved.
Patent Information
- Application Number
- CN202111409866.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-11-24
AI Technical Summary
In the prior art, it is difficult for the construction method of face recognition training set to obtain rich face data without increasing too much human workload, resulting in insufficient generalization capabilities of the model and affecting user experience.
By obtaining the two-dimensional image of the front of the face, generating makeup maps and constructing a three-dimensional face model of the makeup, using the three-dimensional face model to collect two-dimensional images under multiple angles and environment changes, and generating a face recognition training set.
It improves the production efficiency of the training set, reduces the production difficulty, provides ideas and references for the automated construction of face recognition training sets, and enhances the generalization ability of the model.
Smart Images

Figure CN114049673B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of constructing face recognition data sets, and in particular relates to a face recognition training set construction method, device and storage medium. Background Art
[0002] Data plays an important role in deep learning research. However, data itself is arbitrary and random, lacks unified standards, and large-scale data that meets the requirements of deep learning research is difficult to obtain. The field of face recognition is a typical example.
[0003] Traditional methods for constructing facial recognition datasets often rely on collecting a single frontal image of a face under normal lighting, excluding the effects of facial expressions, lighting, and shadow variations. This results in limited generalization capabilities for the models trained based on this image. However, people's states, expressions, and appearances vary greatly in real life, which can cause the model's recognition capabilities to collapse instantly. Collecting multiple facial images to construct a training set requires significant manpower and resources, significantly reducing system service quality and severely impacting user experience.
[0004] Since the quality of the training set affects the capabilities of the model, how to obtain richer facial data without increasing too much manual workload is one of the key issues in constructing face recognition training sets. Summary of the Invention
[0005] In view of the above problems, the present invention provides a method, device and storage medium for constructing a face recognition training set to overcome the above problems or at least partially solve the above problems.
[0006] To solve the above technical problems, the present invention provides a method for constructing a face recognition training set, the method comprising the steps of:
[0007] Obtain a frontal two-dimensional image of the face;
[0008] generating a makeup map based on the frontal two-dimensional image of the face;
[0009] generating a three-dimensional face model with makeup based on the two-dimensional front face image and the makeup map;
[0010] A face recognition training set is constructed based on the three-dimensional face model.
[0011] Preferably, generating a makeup map based on the frontal two-dimensional face image comprises the steps of:
[0012] Labeling the frontal two-dimensional face image;
[0013] Performing feature point detection on the frontal two-dimensional image of the face;
[0014] A makeup map is generated according to the frontal two-dimensional image of the human face.
[0015] Preferably, generating a makeup three-dimensional face model based on the front two-dimensional face image and the makeup map comprises the steps of:
[0016] Constructing a basic three-dimensional face model based on the frontal two-dimensional face image;
[0017] The makeup map is attached to the basic three-dimensional face model to obtain a makeup three-dimensional face model.
[0018] Preferably, the constructing of a face recognition training set based on the three-dimensional face model comprises the steps of:
[0019] Setting a fixed point light source at a preset position of the three-dimensional face model;
[0020] Setting cameras at preset angles around the three-dimensional face model;
[0021] Using the fixed point light source to illuminate the three-dimensional human face model;
[0022] Using the camera to capture a two-dimensional image of the three-dimensional face model;
[0023] All the two-dimensional images are aggregated to obtain a face recognition training set.
[0024] Preferably, the step of labeling the frontal two-dimensional face image comprises the following steps:
[0025] Marking the frontal two-dimensional face image with a name tag;
[0026] The frontal two-dimensional face image is labeled with a gender label.
[0027] Preferably, the feature point detection on the frontal two-dimensional face image comprises the steps of:
[0028] Get face detector and facial feature detector;
[0029] Initializing the face detector and the facial feature detector;
[0030] Processing the frontal two-dimensional face image to obtain a frontal two-dimensional grayscale image of the face;
[0031] Using the face detector to detect the face position in the frontal two-dimensional grayscale image of the face;
[0032] The facial feature detector is used to extract feature points in the facial position.
[0033] Preferably, generating a makeup map based on the frontal two-dimensional face image comprises the steps of:
[0034] Obtain the gender tag in the tag tag;
[0035] Creating a basic makeup template based on the gender label mark;
[0036] Acquire feature points of the frontal two-dimensional image of the human face;
[0037] Adjusting the basic makeup template according to the feature points to obtain an adjusted basic makeup template;
[0038] The layer fuses the front two-dimensional face image with the adjusted basic makeup template to obtain a makeup map.
[0039] The present application also provides a face recognition training set construction device, characterized in that the device comprises:
[0040] A two-dimensional face front image acquisition module is used to acquire a two-dimensional face front image;
[0041] A makeup map generating module, configured to generate a makeup map based on the frontal two-dimensional face image;
[0042] A makeup three-dimensional face model generation module, configured to generate a makeup three-dimensional face model based on the front two-dimensional face image and the makeup map;
[0043] The face recognition training set construction module is used to construct a face recognition training set based on the three-dimensional face model.
[0044] The present application also provides an electronic device, comprising:
[0045] at least one processor; and,
[0046] a memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the aforementioned face recognition training set construction methods.
[0048] The present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute any of the aforementioned face recognition training set construction methods.
[0049] One or more technical solutions in the embodiments of the present invention have at least the following technical effects or advantages: The present application provides a method, device and storage medium for constructing a face recognition training set, which uses facial information from multiple angles constructed by a three-dimensional face model, can render environmental changes and change texture maps to generate a face recognition training set, which can effectively improve the production efficiency of the training set, reduce the production difficulty, and provide ideas and references for the automated construction of face recognition training sets. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0051] Figure 1 1 is a flow chart of a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0052] Figure 2 1 is a schematic structural diagram of a face recognition training set construction device provided by an embodiment of the present invention;
[0053] Figure 3 is a structural diagram of an electronic device provided by an embodiment of the present invention;
[0054] Figure 4 is a schematic structural diagram of a non-transitory computer-readable storage medium provided by an embodiment of the present invention;
[0055] FIG5( a ) is a schematic diagram of a two-dimensional frontal face image in a method for constructing a face recognition training set according to an embodiment of the present invention;
[0056] FIG5( b ) is a schematic diagram of face detection in a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0057] Figure 6 is a schematic diagram of a makeup map in a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0058] FIG7( a ) is a schematic diagram of a basic three-dimensional face model in a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0059] FIG7( b ) is a schematic diagram of a makeup three-dimensional face model in a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0060] Figure 8(a) to Figure 8(e) is a schematic diagram of a two-dimensional image in a method for constructing a face recognition training set provided by an embodiment of the present invention;
[0061] Figure 9 This is a schematic diagram of light source positions and camera shooting positions in a method for constructing a face recognition training set provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0062] The present invention will be described in detail below in conjunction with specific embodiments and examples, and the advantages and various effects of the present invention will be more clearly presented. It should be understood by those skilled in the art that these specific embodiments and examples are for illustrating the present invention, rather than for limiting the present invention.
[0063] Throughout this specification, unless otherwise specified, the terms used herein should be understood as having the same meaning as commonly used in the art. Therefore, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. In the event of any conflict, the present specification shall take precedence.
[0064] Unless otherwise specified, various raw materials, reagents, instruments and equipment used in the present invention can be purchased from the market or prepared by existing methods.
[0065] like Figure 1 In an embodiment of the present application, the present invention provides a method for constructing a face recognition training set, the method comprising the steps of:
[0066] S1: Obtain a frontal 2D image of the face;
[0067] In an embodiment of the present application, an image acquisition device is used to obtain a two-dimensional image of the front of a human face.
[0068] S2: generating a makeup map based on the frontal two-dimensional image of the face;
[0069] In an embodiment of the present application, generating a makeup map based on the frontal two-dimensional image of the face includes the following steps:
[0070] Labeling the frontal two-dimensional face image;
[0071] Performing feature point detection on the frontal two-dimensional image of the face;
[0072] A makeup map is generated according to the frontal two-dimensional image of the human face.
[0073] In the embodiment of the present application, when generating a makeup map based on the frontal two-dimensional face image, the frontal two-dimensional face image is first labeled.
[0074] Note that the labels used can be selected as needed, and it is only necessary to distinguish the frontal two-dimensional images of each face. Feature point detection is then performed on the frontal two-dimensional images of the face, and a makeup map is generated based on the frontal two-dimensional images of the face.
[0075] In an embodiment of the present application, labeling the frontal two-dimensional face image includes the steps of:
[0076] Marking the frontal two-dimensional face image with a name tag;
[0077] The frontal two-dimensional face image is labeled with a gender label.
[0078] In the embodiment of the present application, in order to ensure the accuracy and usability of the training set constructed subsequently, it is necessary to initially obtain a clear, unobstructed two-dimensional frontal face image of a person, and use the person's "name" and "gender" as labels to mark the two-dimensional frontal face image with a name label and a gender label, such as F-Mary, M-Bob, etc., so as to distinguish each two-dimensional frontal face image.
[0079] In an embodiment of the present application, the feature point detection on the frontal two-dimensional face image includes the steps of:
[0080] Get face detector and facial feature detector;
[0081] Initializing the face detector and the facial feature detector;
[0082] Processing the frontal two-dimensional face image to obtain a frontal two-dimensional grayscale image of the face;
[0083] Using the face detector to detect the face position in the frontal two-dimensional grayscale image of the face;
[0084] The facial feature detector is used to extract feature points in the facial position.
[0085] In an embodiment of the present application, when performing feature point detection on a two-dimensional image of the front face, since the two-dimensional image of the front face selected in the early stage is a clear frontal photo of the face, the detection difficulty is relatively low, and the traditional method of facial feature point detection provided by opencv and dlib can be selected to perform classic 68-point detection on the two-dimensional image of the front face. Specifically, first load and initialize the face detector and face feature detector provided by dlib, then use opencv to read the two-dimensional image of the front face and process it into a grayscale image (two-dimensional grayscale image of the front face), then use the face detector to detect the face position in the two-dimensional grayscale image of the front face, and use the face feature detector to extract the feature points in the face position.
[0086] In an embodiment of the present application, generating a makeup map based on the frontal two-dimensional image of the face includes the following steps:
[0087] Obtain the gender tag in the tag tag;
[0088] Creating a basic makeup template based on the gender label mark;
[0089] Acquire feature points of the frontal two-dimensional image of the human face;
[0090] Adjusting the basic makeup template according to the feature points to obtain an adjusted basic makeup template;
[0091] The layer fuses the front two-dimensional face image with the adjusted basic makeup template to obtain a makeup map.
[0092] In an embodiment of the present application, when a makeup map is generated based on the two-dimensional image of the front face, a basic makeup template is first created based on the gender label mark, that is, a lipstick and eyeshadow basic makeup template is created for women, and a beard basic makeup template is created for men. Then, the feature points of the two-dimensional image of the front face are obtained, and the basic makeup template is adjusted according to the feature points to obtain an adjusted basic makeup template. Finally, the two-dimensional image of the front face and the adjusted basic makeup template are layered to obtain a makeup map.
[0093] S3: generating a makeup three-dimensional face model according to the front two-dimensional face image and the makeup map;
[0094] In an embodiment of the present application, generating a makeup three-dimensional face model based on the frontal two-dimensional face image and the makeup map includes the following steps:
[0095] Constructing a basic three-dimensional face model based on the frontal two-dimensional face image;
[0096] The makeup map is attached to the basic three-dimensional face model to obtain a makeup three-dimensional face model.
[0097] In an embodiment of the present application, when generating a makeup three-dimensional face model based on the two-dimensional frontal face image and the makeup map, a basic three-dimensional face model is first constructed based on the two-dimensional frontal face image, and then the makeup map is attached to the basic three-dimensional face model to obtain the makeup three-dimensional face model.
[0098] S4: Constructing a face recognition training set based on the three-dimensional face model.
[0099] In an embodiment of the present application, constructing a face recognition training set based on the three-dimensional face model includes the following steps:
[0100] Setting a fixed point light source at a preset position of the three-dimensional face model;
[0101] Setting cameras at preset angles around the three-dimensional face model;
[0102] Using the fixed point light source to illuminate the three-dimensional human face model;
[0103] Using the camera to capture a two-dimensional image of the three-dimensional face model;
[0104] All the two-dimensional images are aggregated to obtain a face recognition training set.
[0105] In an embodiment of the present application, when constructing a face recognition training set based on the three-dimensional face model, a fixed-point light source is first set at a preset position of the three-dimensional face model, such as setting a fixed-point light source at a certain position directly in front of the three-dimensional face model, and a camera is set at a preset angle around the three-dimensional face model, such as setting a camera at the same distance directly in front, directly behind, directly to the left and directly to the right of the three-dimensional face model, and then the fixed-point light source is used to illuminate the three-dimensional face model to form a light and shadow effect, and then the camera is used to capture a two-dimensional image of the three-dimensional face model. At this time, two-dimensional images at four angles can be obtained, and all the two-dimensional images are summarized to obtain a face recognition training set.
[0106] The method provided in this application is described below with reference to specific embodiments.
[0107] In an embodiment of the present application, a face recognition training set construction method provided by the present application is introduced by taking a frontal photo of a woman provided by faceapp as an example.
[0108] First, remove the background of the image to obtain a 2D frontal face image as shown in Figure 5(a), and add a label to it as "F-Mary". After graying the 2D frontal face image, a 2D grayscale image of the frontal face is obtained. This 2D grayscale image of the frontal face is input into the face detector for face detection. The local face area as shown in Figure 5(b) can be framed and then input into the face feature detector to obtain a returned shape object. This object contains 68 facial feature points, of which the i-th feature point is labeled f i (1≤i≤68), use the circle() function of OpenCV to draw the position of the feature points on the image, and obtain the feature point detection result in Figure 5(b).
[0109] Execute the makeup algorithm for Figure 5(b). Based on the feature point detection results extracted in the previous step, the basic makeup template is transformed so that the makeup is aligned with the face. The transformation algorithm used here is the IDW transformation algorithm, which calculates the inverse distance weighted influence of the control point on the surrounding pixels based on a given control point pair, and realizes the displacement of each pixel in the image. Here, the original feature point of the basic makeup template is taken as the input control point of the IDW transformation, denoted as p i (1≤i≤68), feature points f obtained by face image detection i (1≤i≤68) is the output feature point, that is, to find a function Make
[0110]
[0111] According to the principle that "the closer to the control point, the greater the impact and the greater the weight, and vice versa", the function is designed. for
[0112]
[0113]
[0114]
[0115] f i (p) = f i +T(pp i ), (7)
[0116] Among them, d in formula (6) is the Euclidean distance calculation, and T in formula (7) can be simply taken as 1. After transformation alignment, the basic makeup template and the face image are layer-fused to obtain Figure 6 The makeup image after the beauty treatment.
[0117] While executing the makeup algorithm, the shape reconstruction part of the 3DMM algorithm can be used based on the 68 detected facial feature points, that is, the following formula (1) can be used to calculate the three-dimensional face model:
[0118]
[0119] Among them, S′ represents the average shape and average texture of the face, S i They represent the eigenvectors of the covariance matrix obtained from the 3D face model library and arranged in descending order of eigenvalues. These can be obtained through prior information, so the solution of the model is only through the parameter α i Solve to complete the calculation.
[0120] Here we use the powerful computational representation capability of the convolutional neural network CNN to transform the parameter solution into the α iThe regression task uses the data in the BFM standard face model library to train the network, and uses the absolute value loss function to minimize S and the standard reference value S s The gap between them is as follows:
[0121] L=∑|S s -S|, (8)
[0122] This results in a basic 3D face model as shown in Figure 7(a). By designing UV mapping based on the principle of feature point alignment, attaching the texture to the basic 3D face model, and adding a fixed light source to provide lighting effects, we can obtain a makeup 3D face model as shown in Figure 7(B).
[0123] Then, a batch data processing plug-in was written with the help of the Unreal Engine game engine. Under the condition that a fixed light source was added to the makeup 3D face model to form a light and shadow effect, the camera was set at five angles to take pictures to obtain two-dimensional images to construct a training set. The light source position and camera shooting position are shown in Figure 9 Finally, a “name” tag has at least 5 2D images corresponding to it, such as Figure 8(a)-8(e) .
[0124] like Figure 2 In an embodiment of the present application, the present application further provides a device for constructing a face recognition training set, the device comprising:
[0125] A two-dimensional face front image acquisition module 10 is used to acquire a two-dimensional face front image;
[0126] A makeup map generating module 20 is configured to generate a makeup map based on the frontal two-dimensional face image;
[0127] A makeup 3D face model generating module 30 is configured to generate a makeup 3D face model based on the frontal 2D face image and the makeup map;
[0128] The face recognition training set construction module 40 is used to construct a face recognition training set according to the three-dimensional face model.
[0129] The face recognition training set construction device provided in this application can execute the face recognition training set construction method provided in the above steps.
[0130] Reference below Figure 3, which shows a schematic structural diagram of an electronic device 100 suitable for implementing an embodiment of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 3 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0131] like Figure 3 As shown, the electronic device 100 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 102 or a program loaded from a storage device 108 into a random access memory (RAM) 103. Various programs and data required for the operation of the electronic device 100 are also stored in the RAM 103. The processing device 101, the ROM 102, and the RAM 103 are connected to each other via a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.
[0132] Typically, the following devices may be connected to the I / O interface 105: an input device 106 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 107 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 108 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 109. The communication device 109 may allow the electronic device 100 to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows the electronic device 100 with various devices, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0133] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 109, or installed from the storage device 108, or installed from the ROM 102. When the computer program is executed by the processing device 101, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0134] Reference below Figure 4, which shows a structural schematic diagram of a computer-readable storage medium suitable for implementing the embodiments of the present disclosure, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it can implement the face recognition training set construction method as described in any of the above.
[0135] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0136] The computer-readable medium may be included in the electronic device, or may exist separately and then be incorporated into the electronic device.
[0137] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains at least two Internet Protocol addresses; sends a node evaluation request including the at least two Internet Protocol addresses to a node evaluation device, wherein the node evaluation device selects an Internet Protocol address from the at least two Internet Protocol addresses and returns it; receives the Internet Protocol address returned by the node evaluation device; wherein the obtained Internet Protocol address indicates an edge node in a content distribution network.
[0138] Alternatively, the computer-readable medium carries one or more programs, which, when executed by the electronic device, causes the electronic device to: receive a node evaluation request including at least two Internet Protocol addresses; select an Internet Protocol address from the at least two Internet Protocol addresses; and return the selected Internet Protocol address; wherein the received Internet Protocol address indicates an edge node in a content distribution network.
[0139] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0141] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0142] The present application provides a method, device, and storage medium for constructing a face recognition training set. These methods utilize facial information from multiple angles constructed using a three-dimensional face model, renderable environmental changes, and texture map changes to generate a face recognition training set. This method can effectively improve the efficiency of training set production, reduce production difficulty, and provide ideas and references for the automated construction of face recognition training sets.
[0143] It should be understood that the above-described specific embodiments of the present invention are merely illustrative or illustrative of the principles of the present invention and do not constitute limitations of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included within the scope of protection of the present invention. In addition, the appended claims are intended to cover all variations and modifications that fall within the scope and metes and bounds of the appended claims, or equivalents thereof.
Claims
1. A method for constructing a face recognition training set, characterized in that: The method comprises the steps of: Obtain a frontal two-dimensional image of the face; generating a makeup map based on the frontal two-dimensional image of the face; generating a three-dimensional face model with makeup based on the two-dimensional front face image and the makeup map; Constructing a face recognition training set based on the three-dimensional face model; Generating a makeup map based on the frontal two-dimensional face image comprises the following steps: Labeling the frontal two-dimensional face image; Detect 68 feature points on the frontal 2D face image, with the i-th feature point marked as f i , 1≤i≤68; generating a makeup map based on the frontal two-dimensional image of the face; The step of constructing a face recognition training set based on the three-dimensional face model comprises the following steps: Setting a fixed point light source at a preset position of the three-dimensional face model; Setting cameras at preset angles around the three-dimensional face model; Using the fixed point light source to illuminate the three-dimensional human face model; Using the camera to capture a two-dimensional image of the three-dimensional face model; Summarizing all the two-dimensional images to obtain a face recognition training set; Generating a makeup map according to the frontal two-dimensional face image includes: The original feature points of the basic makeup template are taken as the input control points of the IDW transformation, denoted as p i , 1≤i≤68, Feature points f obtained by face image detection i To output feature points, set the function for f i (p)=f i +T(p-p i ), Among them, d is the Euclidean distance calculation, and T is 1; While executing the makeup algorithm, the shape reconstruction part of the 3DMM algorithm can be used based on the 68 detected facial feature points to calculate a 3D face model: Among them, S' represents the average shape and average texture of the face, S i They respectively represent the eigenvectors of the covariance matrix obtained from the three-dimensional face model library and arranged in descending order of eigenvalues.
2. The method for constructing a face recognition training set according to claim 1, wherein: Generating a makeup three-dimensional face model based on the front two-dimensional face image and the makeup map comprises the following steps: Constructing a basic three-dimensional face model based on the frontal two-dimensional face image; The makeup map is attached to the basic three-dimensional face model to obtain a makeup three-dimensional face model.
3. The method for constructing a face recognition training set according to claim 1, wherein: The labeling of the frontal two-dimensional face image comprises the steps of: Marking the frontal two-dimensional face image with a name tag; The frontal two-dimensional face image is labeled with a gender label.
4. The method for constructing a face recognition training set according to claim 1, wherein: Performing feature point detection on the frontal two-dimensional face image includes the following steps: Get face detector and facial feature detector; Initializing the face detector and the facial feature detector; Processing the frontal two-dimensional face image to obtain a frontal two-dimensional grayscale image of the face; Using the face detector to detect the face position in the frontal two-dimensional grayscale image of the face; The facial feature detector is used to extract feature points in the facial position.
5. A device for constructing a face recognition training set according to any one of claims 1 to 4, characterized in that: The device comprises: A two-dimensional face front image acquisition module is used to acquire a two-dimensional face front image; A makeup map generating module, configured to generate a makeup map based on the frontal two-dimensional face image; A makeup three-dimensional face model generation module, configured to generate a makeup three-dimensional face model based on the front two-dimensional face image and the makeup map; The face recognition training set construction module is used to construct a face recognition training set based on the three-dimensional face model.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the face recognition training set construction method described in any of claims 1-4.
7. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the face recognition training set construction method described in any one of claims 1 to 4.
Citation Information
Patent Citations
Structured light camera based three-dimensional face recognizing method
CN108537191A
Image processing method and device, electronic equipment and storage medium
CN110992493A