WO2021003964A1 - Method and apparatus for face shape recognition, electronic device and storage medium - Google Patents

Method and apparatus for face shape recognition, electronic device and storage medium Download PDF

Info

Publication number
WO2021003964A1
WO2021003964A1 PCT/CN2019/121344 CN2019121344W WO2021003964A1 WO 2021003964 A1 WO2021003964 A1 WO 2021003964A1 CN 2019121344 W CN2019121344 W CN 2019121344W WO 2021003964 A1 WO2021003964 A1 WO 2021003964A1
Authority
WO
WIPO (PCT)
Prior art keywords
face
image
reconstruction
feature
features
Prior art date
Application number
PCT/CN2019/121344
Other languages
French (fr)
Chinese (zh)
Inventor
王杉杉
黄轩
胡文泽
王孝宇
Original Assignee
深圳云天励飞技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳云天励飞技术有限公司 filed Critical 深圳云天励飞技术有限公司
Publication of WO2021003964A1 publication Critical patent/WO2021003964A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification

Definitions

  • the present invention relates to the technical field of face recognition, in particular to a face recognition method, device, electronic equipment and storage medium.
  • the field of face recognition technology has also proposed some methods for detecting a person's face shape by recognizing the face in an image.
  • the existing face recognition method can only obtain a better recognition result in the case of a frontal face. Due to the complexity of the real environment, often the captured images are not the face.
  • the three-dimensional reconstruction of the face can solve the problem of turning the side face to the front face, the three-dimensional reconstruction requires a depth camera or shooting multiple face images under multiple viewing angles to complete, the reconstruction process is complicated, and the reliability of face recognition is low.
  • the first aspect of the present invention provides a face recognition method, the method includes:
  • the pre-set face shape classifier is used to recognize the joint feature, and the face shape recognition result is obtained.
  • the extracting and extracting the 3D reconstruction parameters and image features from the face image using a pre-trained 3D reconstruction parameter extraction model includes:
  • the 3D reconstruction parameters include: face reconstruction shape parameters and face reconstruction deformation parameters, and the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
  • the frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
  • the extracting contour features in the 3D human face includes:
  • the constructing a joint feature based on the contour feature and the image feature includes:
  • the method before acquiring the face image to be recognized, the method further includes:
  • the recognition of the joint feature by using a preset face classifier to obtain a face recognition result includes:
  • the face recognition result is output as the face recognition result of the face image to be recognized.
  • a second aspect of the present invention provides a face recognition device, the device includes:
  • the acquisition module is used to acquire the face image to be recognized
  • the detection module is configured to use a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image;
  • a reconstruction module for reconstructing a 3D face based on the 3D reconstruction parameters
  • the recognition module is used to recognize the joint feature by using a preset face classifier to obtain a face recognition result.
  • a third aspect of the present invention provides an electronic device, the electronic device includes a processor, and the processor is configured to implement the face recognition method when executing a computer program stored in a memory.
  • a fourth aspect of the present invention provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to realize the face recognition method.
  • the face recognition method, device, electronic device and storage medium of the present invention use a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image to be recognized, After reconstructing a 3D face based on the 3D reconstruction parameters, extracting contour features in the 3D face, and finally constructing a joint feature based on the contour feature and the image feature, and using a preset face classifier to recognize The combined features can obtain the face recognition result.
  • the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape.
  • the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
  • FIG. 1 is a schematic diagram of the flow of face recognition according to a preferred embodiment of the present invention.
  • Fig. 2 is a schematic diagram of a network structure provided by an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of the process of reconstructing a frontal and expressionless 3D human face according to a preferred embodiment of the present invention.
  • Fig. 4 is a structural diagram of a face recognition device provided by a preferred embodiment of the present invention.
  • Fig. 5 is a schematic diagram of an electronic device provided by a preferred embodiment of the present invention.
  • FIG. 1 is a schematic diagram of a face recognition process according to an embodiment of the present invention.
  • the face recognition method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
  • a face image of the user needs to be acquired first, and the face shape of the user is detected by recognizing the face image.
  • the human face facial image is an image that only includes the human face facial area, and does not include body parts.
  • the calculation of useless data for example, pixels corresponding to body parts
  • the face image It removes the interference of pixels corresponding to body parts, which helps to improve the accuracy of facial recognition.
  • the acquired image may include body parts.
  • the acquired image needs to be processed to ensure that it is input to the pre-trained
  • the image in the 3D reconstruction parameter extraction model is a face image that only includes the face area.
  • the method further includes :
  • the user image may be an image including only the face region of a person, or may be a half-length image or a full body image including other parts.
  • a face detection algorithm such as a face detection algorithm based on Haar-Like features, or an adaboost face detection algorithm, is used to detect the user image. And crop the detected face area from the user image as the face image.
  • the 3D reconstruction parameter extraction model may be trained in advance based on the deep neural network.
  • the deep neural network is a deep separable convolutional neural network, for example, MobileNetV1, MobileNetV2, etc.
  • the deep separable convolutional neural network is composed of deep separable convolutions. Except for the first input layer, it is fully convolutional. All layers are followed by a batchnorm (batch normalization: speed up the deep network by reducing internal covariate conversion) Training) and ReLU nonlinear activation function, the last fully connected layer without nonlinear activation function is directly sent to the softmax layer for classification.
  • the face shape of the human face includes: square, triangle, ellipse, heart, circle, long and inverted triangle, etc.
  • the 3D reconstruction parameters include: face reconstruction shape parameters, face reconstruction deformation parameters, and face position parameters.
  • the face position parameters include: face rotation matrix and face displacement.
  • the face displacement refers to the face translation coefficient.
  • the extraction of 3D reconstruction parameters and image features from the face image using a pre-trained 3D reconstruction parameter extraction model includes:
  • the penultimate layer of any network model will calculate the feature map of the input penultimate layer and output the image features to the last layer for classification or detection.
  • the face image is input to the input layer of the pre-trained 3D reconstruction parameter extraction model, and the second-to-last layer of image feature values (located in the last The layer above the layer can be a pooling layer)
  • the penultimate layer further calculates the input image features and outputs the image features with stronger characterization capabilities to the last layer (fully connected layer) to the input image features Perform extraction to obtain 3D reconstruction parameters. Therefore, the image features output by the penultimate layer of the 3D reconstruction parameter extraction model and the 3D reconstruction parameters output by the last layer can be obtained.
  • a 3D human face can be reconstructed based on the 3D reconstruction parameters.
  • a 3D Morphable model (3D Morphable model, 3DMM)
  • a 3D Blend Shape model (3D Blend Shape model, 3DBM)
  • 3D Face model 3D Blend Shape model
  • the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
  • the frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
  • the reference vector includes the first feature vector of the 3D deformation model and the second feature vector of the 3D shape fusion model.
  • Some open source 3DMMs will be released with an average face and a set of parameters used to represent the shape changes of the face under different conditions.
  • 3DBM will be released with a set of expressions used to represent the face under different conditions. Changing parameters.
  • the parameter representing the shape change of the human face under different conditions is defined as the first feature vector
  • the parameter representing the expression change of the human face under different situations is defined as the second feature vector.
  • a 3D face can be reconstructed based on the face reconstruction shape parameters, face reconstruction deformation parameters, face rotation matrix and face displacement, average face, first feature vector, and second feature vector through the following formula:
  • Face 3d represents the reconstructed 3D face
  • R represents the face rotation matrix, which is set as the identity matrix
  • s i represents the first feature vector
  • 3DMM_params represents the face reconstruction shape parameter
  • b i represents the second feature vector
  • BlendShape_params represents the face reconstruction deformation parameter, set to 0
  • T represents the face displacement, set to 0
  • m represents The number of face reconstruction shape parameters
  • n is the number of face reconstruction deformation parameters.
  • the face rotation matrix R is set to the unit matrix, and the face displacement T is set to 0, the reconstructed 3D face can be rotated into a frontal face, and the deformation parameters of the face can be reconstructed at the same time
  • Setting BlendShape params to 0 can eliminate the expression contained in the reconstructed 3D face, so the redirected 3D face Face 3d is a frontal and expressionless face.
  • Figure 3 shows the reconstruction process of a frontal and expressionless 3D face, where the picture on the left is a 3D face reconstructed based on the 3D reconstruction parameters, a face that is not frontal and contains an expression; the middle picture is Set the face rotation matrix R to the unit matrix and the face displacement T to 0 to obtain the frontal 3D face; the picture on the right is the expressionless face obtained after the face reconstruction deformation parameter BlendShape params is set to 0 3D human face.
  • Rotating the 3D face reconstructed based on the 3D reconstruction parameters into a frontal face solves the problem of rotating the side face to the frontal face.
  • the frontal face can improve the recognition accuracy of the face shape; and then eliminate the frontal face.
  • the expression solves the problem of facial expressions.
  • the expressionless frontal face can further improve the accuracy of facial recognition, and the result of facial recognition is highly reliable.
  • the face shape is reflected by the contour of the face, so it is necessary to extract the features of the cheek part of the 3D face.
  • the features of the cheek part are called contour features.
  • the extracting contour features in the 3D human face includes:
  • a frontal and expressionless 3D face is redirected through 3DMM and 3D BlendShape model, which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index.
  • 3DMM and 3D BlendShape model which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index.
  • First determine the key data points that need to be extracted, and then determine the target index corresponding to the key data point, and then extract the target geometric features corresponding to the target index from more than 50,000 data points, and extract the The target geometric features are used as contour features.
  • 128 key data points need to be extracted, these 128 key points are located in the cheek part of the human face, and the geometric features corresponding to the extracted 128 key data points are used as contour features of the 3D human face.
  • the joint feature refers to a feature vector obtained by connecting the contour feature and the image feature.
  • the constructing a joint feature based on the contour feature and the image feature includes:
  • the coordinates of the tip of the nose are extracted from the redirected 3D face without expression as the center point, and the point on the contour of the face is made difference from the center point.
  • Value that is, the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature to obtain the face contour point centered at 0 point.
  • the contour feature represents the geometric distribution information of the human face
  • the image feature represents the texture information of the human face. Therefore, the constructed joint feature contains the geometric distribution information and texture information of the human face, and the information is more abundant.
  • S16 Recognizing the joint feature by using a preset face classifier to obtain a face recognition result.
  • a face classifier can be preset. As shown in Figure 2, the face classifier includes two fully connected layers (FC1 layer and FC2 layer) and an activation layer (Activate Layer). The last layer It is the loss function layer (Softmax Loss).
  • the feature and the image feature are connected as a joint feature and input to the face classifier to obtain the face recognition result.
  • the recognition of the joint feature by using a preset face classifier to obtain a face recognition result includes:
  • the face recognition result is output as the face recognition result of the face image to be recognized.
  • the risk loss value of the face classifier when the risk loss value of the face classifier is minimized by the gradient backhaul algorithm, it indicates that the face classifier has stabilized, and the parameters of the face classifier have reached the optimal value. Value, the obtained face recognition result is the face recognition result of the face image to be recognized.
  • the face recognition method of the present invention uses a pre-trained 3D reconstruction parameter extraction model to extract the face image to be recognized, obtain 3D reconstruction parameters and image features, and reconstruct based on the 3D reconstruction parameters
  • the contour features in the 3D face are extracted, and finally a joint feature is constructed based on the contour feature and the image feature, and the joint feature is recognized by using a preset face classifier to obtain Face recognition result.
  • the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape.
  • the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
  • the constructed 3D face is frontal and expressionless.
  • the face can further improve the reliability of the recognition result of the face shape.
  • FIG. 4 is a diagram of functional modules in a preferred embodiment of the face recognition device of the present invention.
  • the face recognition device 40 runs in an electronic device.
  • the face recognition device 40 may include multiple functional modules composed of program code segments.
  • the program code of each program segment in the face recognition device 40 can be stored in the memory of the electronic device and executed by at least one processor to execute (see Figure 1 for details) the face shape Recognition function.
  • the face recognition device 40 can be divided into multiple functional modules according to the functions it performs.
  • the functional modules may include: an acquisition module 401, an acquisition module 402, a detection module 403, a training module 404, a reconstruction module 405, an extraction module 406, a construction module 407, and an identification module 408.
  • the module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory. In this embodiment, the function of each module will be described in detail in subsequent embodiments.
  • the obtaining module 401 is used to obtain a face image to be recognized.
  • a face image of the user needs to be acquired first, and the face shape of the user is detected by recognizing the face image.
  • the human face image is an image that only includes the human face and facial area, and does not include body parts.
  • the calculation of useless data for example, pixels corresponding to body parts
  • the face image It removes the interference of pixels corresponding to body parts, which helps to improve the accuracy of facial recognition.
  • the acquired image may include body parts.
  • the acquired image needs to be processed to ensure that it is input to the pre-trained
  • the image in the 3D reconstruction parameter extraction model is a face image that only includes the face area.
  • the device 40 in order to ensure that the image input to the pre-trained 3D reconstruction parameter extraction model is a face image, before acquiring the face image to be recognized, the device 40 also Including: a collection module 402 for:
  • the user image may be an image including only the face region of a person, or may be a half-length image or a full body image including other parts.
  • a face detection algorithm such as a face detection algorithm based on Haar-Like features, or an adaboost face detection algorithm, is used to detect the user image. And crop the detected face area from the user image as the face image.
  • the detection module 403 is configured to use a pre-trained 3D reconstruction parameter extraction model to extract 3D reconstruction parameters and image features in the face image.
  • the training module 404 is used to train the 3D reconstruction parameter extraction model based on the deep neural network in advance.
  • the deep neural network is a deep separable convolutional neural network, for example, MobileNetV1, MobileNetV2, etc.
  • the deep separable convolutional neural network is composed of deep separable convolutions. Except for the first input layer, it is fully convolutional. All layers are followed by a batchnorm (batch normalization: speed up the deep network by reducing internal covariate conversion) Training) and ReLU nonlinear activation function, the last fully connected layer without nonlinear activation function is directly sent to the softmax layer for classification.
  • the face shape of the human face includes: square, triangle, ellipse, heart, circle, long and inverted triangle, etc.
  • the 3D reconstruction parameters include: face reconstruction shape parameters, face reconstruction deformation parameters, and face position parameters.
  • the face position parameters include: face rotation matrix and face displacement.
  • the face displacement refers to the face translation coefficient.
  • the detection module 403 using a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image includes:
  • the penultimate layer of any network model will calculate the feature map of the input penultimate layer and output the image features to the last layer for classification or detection.
  • the face image is input to the input layer of the pre-trained 3D reconstruction parameter extraction model, and the second-to-last layer of image feature values (located in the last The layer above the layer can be a pooling layer)
  • the penultimate layer further calculates the input image features and outputs the image features with stronger characterization capabilities to the last layer (fully connected layer) to the input image features Perform extraction to obtain 3D reconstruction parameters. Therefore, the image features output by the penultimate layer of the 3D reconstruction parameter extraction model and the 3D reconstruction parameters output by the last layer can be obtained.
  • the reconstruction module 405 is configured to reconstruct a 3D face based on the 3D reconstruction parameters.
  • a 3D human face can be reconstructed based on the 3D reconstruction parameters.
  • a 3D Morphable model (3D Morphable model, 3DMM)
  • a 3D Blend Shape model (3D Blend Shape model, 3DBM)
  • 3D Face model 3D Blend Shape model
  • the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
  • the frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
  • the reference vector includes the first feature vector of the 3D deformation model and the second feature vector of the 3D shape fusion model.
  • Some open source 3DMMs will be released with an average face and a set of parameters used to represent the shape changes of the face under different conditions.
  • 3DBM will be released with a set of expressions used to represent the face under different conditions. Changing parameters.
  • the parameter representing the shape change of the human face under different conditions is defined as the first feature vector
  • the parameter representing the expression change of the human face under different situations is defined as the second feature vector.
  • the 3D face can be obtained by calculating the face reconstruction shape parameter, the face reconstruction deformation parameter, the face rotation matrix, the face displacement, the average face, the first feature vector, and the second feature vector through the following formula:
  • Face 3d represents the reconstructed 3D face
  • R represents the face rotation matrix, which is set as the identity matrix
  • s i represents the first feature vector
  • 3DMM_params represents the face reconstruction shape parameter
  • b i represents the second feature vector
  • BlendShape_params represents the face reconstruction deformation parameter, set to 0
  • T represents the face displacement, set to 0
  • m represents the The number of face reconstruction shape parameters
  • n is the number of face reconstruction deformation parameters.
  • the face rotation matrix R is set to the unit matrix, and the face displacement T is set to 0, the reconstructed 3D face can be rotated into a frontal face, and the deformation parameters of the face can be reconstructed at the same time
  • Setting BlendShape params to 0 can eliminate the expression contained in the reconstructed 3D face, so the redirected 3D face Face 3d is a frontal and expressionless face.
  • Figure 3 shows the reconstruction process of a frontal and expressionless 3D face, where the picture on the left is a 3D face reconstructed based on the 3D reconstruction parameters, a face that is not frontal and contains an expression; the middle picture is Set the face rotation matrix R to the unit matrix and the face displacement T to 0 to obtain the frontal 3D face; the picture on the right is the expressionless face obtained after the face reconstruction deformation parameter BlendShape params is set to 0 3D human face.
  • Rotating the 3D face reconstructed based on the 3D reconstruction parameters into a frontal face solves the problem of rotating the side face to the frontal face.
  • the frontal face can improve the recognition accuracy of the face shape; and then eliminate the frontal face.
  • the expression solves the problem of facial expressions.
  • the expressionless frontal face can further improve the accuracy of facial recognition, and the result of facial recognition is highly reliable.
  • the extraction module 406 is configured to extract contour features in the 3D face.
  • the face shape is reflected by the contour of the face, so it is necessary to extract the features of the cheek part of the 3D face.
  • the features of the cheek part are called contour features.
  • the extraction module 406 extracting contour features in the 3D face includes:
  • a frontal and expressionless 3D face is redirected through 3DMM and 3D BlendShape model, which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index.
  • 3DMM and 3D BlendShape model which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index.
  • First determine the key data points that need to be extracted, and then determine the target index corresponding to the key data point, and then extract the target geometric features corresponding to the target index from more than 50,000 data points, and extract the The target geometric features are used as contour features.
  • 128 key data points need to be extracted, these 128 key points are located in the cheek part of the human face, and the geometric features corresponding to the extracted 128 key data points are used as contour features of the 3D human face.
  • the construction module 407 is configured to construct a joint feature based on the contour feature and the image feature.
  • the joint feature refers to a feature vector obtained by connecting the contour feature and the image feature.
  • the construction module 407 constructing a joint feature based on the contour feature and the image feature includes:
  • the coordinates of the tip of the nose are extracted from the redirected 3D face without expression as the center point, and the point on the contour of the face is made difference from the center point.
  • Value that is, to make the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature to obtain a face contour point centered at 0 point and compress all contour features after the difference calculation into a one-dimensional feature vector.
  • the contour feature represents the geometric distribution information of the human face
  • the image feature represents the texture information of the human face. Therefore, the constructed joint feature contains the geometric distribution information and texture information of the human face, and the information is more abundant.
  • the recognition module 408 is configured to recognize the joint feature using a preset face classifier to obtain a face recognition result.
  • a face classifier can be preset. As shown in Figure 2, the face classifier includes two fully connected layers (FC1 layer and FC2 layer) and an activation layer (Activate Layer). The last layer It is the loss function layer (Softmax Loss).
  • the feature and the image feature are connected as a joint feature and input to the face classifier to obtain the face recognition result.
  • the recognition module 408 uses a preset face classifier to recognize the joint feature, and obtaining a face recognition result includes:
  • the face recognition result is output as the face recognition result of the face image to be recognized.
  • the risk loss value of the face classifier when the risk loss value of the face classifier is minimized by the gradient backhaul algorithm, it indicates that the face classifier has stabilized, and the parameters of the face classifier have reached the optimal value. Value, the obtained face recognition result is the face recognition result of the face image to be recognized.
  • the face recognition device of the present invention uses a pre-trained 3D reconstruction parameter extraction model to extract a face image to be recognized, obtains 3D reconstruction parameters and image features, and reconstructs based on the 3D reconstruction parameters
  • the contour features in the 3D face are extracted, and finally a joint feature is constructed based on the contour feature and the image feature, and the joint feature is recognized by using a preset face classifier to obtain Face recognition result.
  • the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape.
  • the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
  • the constructed 3D face is frontal and expressionless.
  • the face can further improve the reliability of the recognition result of the face shape.
  • the electronic device 5 includes a memory 51, at least one processor 52, at least one communication bus 53, and a display screen 54.
  • FIG. 5 does not constitute a limitation of the embodiment of the present invention. It may be a bus-type structure or a star structure.
  • the electronic device 5 may also include a graph Show more or less other hardware or software, or different component arrangements.
  • the electronic device 5 includes a device capable of automatically performing numerical calculation and/or information processing according to pre-set or stored instructions.
  • the hardware of the electronic device 5 includes but is not limited to: a microprocessor, a dedicated (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), and a digital processor (Digital Signal Processor, DSP) And embedded devices, etc.
  • the electronic device 5 may also include user equipment.
  • the user equipment includes, but is not limited to, any electronic product that can interact with the user through a keyboard, a mouse, a remote control, a touch panel, or a voice control device, for example, Personal computers, tablet computers, smart phones, digital cameras, etc.
  • the electronic device 5 is only an example. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference. .
  • the memory 51 is used to store program codes and various data, such as the face recognition device 40 installed in the electronic device 5, and realizes high-speed and automatic operation during the operation of the electronic device 5. Complete the program or data access.
  • the memory 51 includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), and erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically-Erasable Programmable Read-Only Memory, EEPROM ), CD-ROM (Compact Disc Read-Only Memory) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • PROM Programmable Read-Only Memory
  • EPROM Erasable Programmable Read-Only Memory
  • OTPROM One-time Programmable Read-Only Memory
  • EEPROM Electrically-Er
  • the at least one processor 52 may be composed, for example, may be composed of a single package, or may be composed of multiple packages with the same function or different functions, including one or more central processors. (Central Processing unit, CPU), a combination of microprocessors, digital processing chips, graphics processors, and various control chips.
  • the at least one processor 52 is the control core (Control Unit) of the electronic device 5, which uses various interfaces and lines to connect the various components of the entire electronic device 5, and runs or executes the program stored in the memory 51 or Modules, and call the data stored in the memory 51 to perform various functions of the electronic device 5 and process data, for example, perform facial recognition functions.
  • Control Unit Control Unit
  • the at least one communication bus 53 is configured to implement connection and communication between the memory 51, the at least one processor 52, the display screen 54, and so on.
  • the display screen 54 can be used to display information input by the viewer or information provided to the viewer and various graphical viewer interfaces of the electronic device 5. These graphical viewer interfaces can be composed of graphics, text, Icons, videos, and any combination of them.
  • the display screen 54 may include a display panel.
  • the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
  • the display screen 54 may also include a touch panel. If the display screen 54 includes a touch panel, the display screen 54 may be implemented as a touch screen to receive input signals from the viewer.
  • the touch panel includes one or more touch sensors to sense touch, sliding, and gestures on the touch panel. The above-mentioned touch sensor may not only sense the boundary of the touch or sliding action, but also detect the duration and pressure related to the above-mentioned touch or sliding operation.
  • the display panel and the touch panel can be used as two independent components to realize input and input functions, but in some embodiments, the display panel and the touch panel can be integrated to realize the input and output functions .
  • the electronic device 5 may also include a power source (such as a battery) for supplying power to various components.
  • the power source may be logically connected to the at least one processor 52 through a power management system, so as to be implemented through a power management system. Manage functions such as charging, discharging, and power management.
  • the power supply may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power supply status indicators and other arbitrary components.
  • the electronic device 5 may also include various sensors, Bluetooth modules, communication modules, and so on. The present invention will not be repeated here.
  • the above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium.
  • the above-mentioned software function module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a client, or a network device, etc.) or a processor to execute the method described in each embodiment of the present invention part.
  • the at least one processor 52 can execute the operating system of the electronic device 5 and various installed applications (such as the face recognition device 50), and program code Wait.
  • Program codes are stored in the memory 51, and the at least one processor 52 can call the program codes stored in the memory 51 to perform related functions.
  • the various modules described in FIG. 5 are program codes stored in the memory 51 and executed by the at least one processor 52, so as to realize the functions of the various modules.
  • the memory 51 stores a plurality of instructions, and the plurality of instructions are executed by the at least one processor 52 to realize the function of randomly generating a neural network model.

Abstract

A method and apparatus for face shape recognition, an electronic device and a storage medium, the method comprising: acquiring a facial image to be recognized (S11); using a well pre-trained 3D reconstruction parameter extraction model to extract 3D reconstruction parameters and image features in the facial image (S12); reconstructing a 3D face according to the 3D reconstruction parameters (S13); extracting contour features in the 3D face (S14); constructing a joint feature according to the contour features and the image features (S15); and using a preconfigured face shape classifier to recognize the joint feature and obtain a face shape recognition result (S16). The 3D reconstruction of a face may be completed using only one facial image, and the face shape recognition result is highly reliable.

Description

人脸脸型识别方法、装置、电子设备及存储介质Face recognition method, device, electronic equipment and storage medium
本申请要求于2019年7月5日提交中国专利局,申请号为201910606389.7、发明名称为“人脸脸型识别方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed with the Chinese Patent Office on July 5, 2019, the application number is 201910606389.7, and the invention title is "face recognition method, device, electronic equipment, and storage medium". The entire content of the application is approved The reference is incorporated in this application.
技术领域Technical field
本发明涉及人脸识别技术领域,具体涉及一种人脸脸型识别方法、装置、电子设备及存储介质。The present invention relates to the technical field of face recognition, in particular to a face recognition method, device, electronic equipment and storage medium.
背景技术Background technique
近年来,随着人们物质生活水平的日益提高,人们在个人形象设计方面的需求迅速增长。而为用户提供个人形象设计通常需要先确定用户的脸型,继而根据用户的脸型选择合适的发型、妆容、眼镜、服饰、配饰等等。In recent years, with the increasing improvement of people's material living standards, people's demand for personal image design has grown rapidly. To provide a user with a personal image design usually requires first determining the user's face shape, and then selecting the appropriate hairstyle, makeup, glasses, clothing, accessories, etc. according to the user's face shape.
基于该需求,人脸识别技术领域目前也提出了一些通过识别图像中的人脸来检测出一个人的脸型的方法。然而,现有的人脸脸型识别方法只有在正面人脸的情况下才能获得较佳的识别结果。由于现实环境的复杂性,往往拍摄得到的图像都不是正脸。虽然将人脸进行三维重建可以解决侧脸旋转到正脸的问题,但是三维重建需要深度摄像机或者在多视角下拍摄多张人脸图像才能完成,重建过程复杂,脸型识别可靠性低。Based on this demand, the field of face recognition technology has also proposed some methods for detecting a person's face shape by recognizing the face in an image. However, the existing face recognition method can only obtain a better recognition result in the case of a frontal face. Due to the complexity of the real environment, often the captured images are not the face. Although the three-dimensional reconstruction of the face can solve the problem of turning the side face to the front face, the three-dimensional reconstruction requires a depth camera or shooting multiple face images under multiple viewing angles to complete, the reconstruction process is complicated, and the reliability of face recognition is low.
因此,如何仅通过一张人脸脸部图像识别出人脸脸型成为当前亟待解决的技术问题。Therefore, how to recognize the facial shape of a human face only through a facial image has become a technical problem to be solved urgently.
发明内容Summary of the invention
鉴于以上内容,有必要提出一种人脸脸型识别、方法、装置、电子设备及存储介质,能够仅通过一张人脸脸部图像完成人脸的3D重建,人脸脸型识别 结果可靠性高。In view of the above content, it is necessary to propose a face recognition, method, device, electronic device and storage medium, which can complete the 3D reconstruction of the face with only one face image, and the result of face recognition is highly reliable.
本发明的第一方面提供一种人脸脸型识别方法,所述方法包括:The first aspect of the present invention provides a face recognition method, the method includes:
获取待识别的人脸脸部图像;Acquiring a face image of a person to be recognized;
采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征;Using a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image;
基于所述3D重建参数重建出3D人脸;Reconstructing a 3D face based on the 3D reconstruction parameters;
提取所述3D人脸中的轮廓特征;Extracting contour features in the 3D face;
基于所述轮廓特征和所述图像特征构建出联合特征;Constructing a joint feature based on the contour feature and the image feature;
采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果。The pre-set face shape classifier is used to recognize the joint feature, and the face shape recognition result is obtained.
在一个可选的实施例中,所述采用预先训练好的3D重建参数提取模型提取提取所述人脸脸部图像中的3D重建参数及图像特征包括:In an optional embodiment, the extracting and extracting the 3D reconstruction parameters and image features from the face image using a pre-trained 3D reconstruction parameter extraction model includes:
输入所述人脸脸部图像至所述预先训练好的3D重建参数提取模型中;Input the face image into the pre-trained 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的最后一层输出的3D重建参数;Acquiring the 3D reconstruction parameters output by the last layer of the 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的倒数第二层输出的图像特征。Obtain the image features output by the penultimate layer of the 3D reconstruction parameter extraction model.
在一个可选的实施例中,所述3D重建参数包括:人脸重建形状参数和人脸重建形变参数,所述基于所述3D重建参数重建出3D人脸包括:In an optional embodiment, the 3D reconstruction parameters include: face reconstruction shape parameters and face reconstruction deformation parameters, and the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
获取基准向量和平均脸;Obtain the reference vector and the average face;
根据所述人脸重建形状参数、所述基准向量和所述平均脸构建正面人脸;Constructing a frontal face according to the face reconstruction shape parameter, the reference vector and the average face;
根据所述人脸重建形变参数将所述正面人脸调整为无表情的3D人脸。The frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
在一个可选的实施例中,所述提取所述3D人脸中的轮廓特征包括:In an optional embodiment, the extracting contour features in the 3D human face includes:
获取所述3D人脸中的几何特征及每个几何特征对应的第一索引;Acquiring geometric features in the 3D face and a first index corresponding to each geometric feature;
从所述第一索引中筛选出与人脸轮廓相关的多个第二索引;Filtering out a plurality of second indexes related to face contours from the first index;
提取与所述多个第二索引对应的几何特征作为所述3D人脸的轮廓特征。Extracting geometric features corresponding to the plurality of second indexes as contour features of the 3D face.
在一个可选的实施例中,所述基于所述轮廓特征和所述图像特征构建出联合特征包括:In an optional embodiment, the constructing a joint feature based on the contour feature and the image feature includes:
计算所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值之间的差值;Calculating the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature;
对经过差值计算之后的轮廓特征与所述图像特征进行连接,形成一维向量;Connecting the contour feature after the difference calculation and the image feature to form a one-dimensional vector;
将所述一维向量作为所述联合特征。Use the one-dimensional vector as the joint feature.
在一个可选的实施例中,在获取待识别的人脸脸部图像之前,所述方法还包括:In an optional embodiment, before acquiring the face image to be recognized, the method further includes:
采集用户图像;Collect user images;
检测所述用户图像中的人脸脸部区域;Detecting the face area in the user image;
裁剪出所述人脸脸部区域得到人脸脸部图像。Cut out the facial area of the human face to obtain a facial image of the human face.
在一个可选的实施例中,所述采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果包括:In an optional embodiment, the recognition of the joint feature by using a preset face classifier to obtain a face recognition result includes:
采用所述预先设置的人脸脸型分类器识别所述联合特征;Using the preset face classifier to recognize the joint feature;
通过梯度回传算法计算风险损失值;Calculate the risk loss value through the gradient backhaul algorithm;
当所述风险损失值达到最小时,输出人脸脸型识别结果作为所述待识别的人脸脸部图像的人脸脸型识别结果。When the risk loss value reaches the minimum, the face recognition result is output as the face recognition result of the face image to be recognized.
本发明的第二方面提供一种人脸脸型识别装置,所述装置包括:A second aspect of the present invention provides a face recognition device, the device includes:
获取模块,用于获取待识别的人脸脸部图像;The acquisition module is used to acquire the face image to be recognized;
检测模块,用于采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征;The detection module is configured to use a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image;
重建模块,用于基于所述3D重建参数重建出3D人脸;A reconstruction module for reconstructing a 3D face based on the 3D reconstruction parameters;
提取模块,用于提取所述3D人脸中的轮廓特征;An extraction module for extracting contour features in the 3D face;
构建模块,用于基于所述轮廓特征和所述图像特征构建出联合特征;A construction module for constructing a joint feature based on the contour feature and the image feature;
识别模块,用于采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果。The recognition module is used to recognize the joint feature by using a preset face classifier to obtain a face recognition result.
本发明的第三方面提供一种电子设备,所述电子设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现所述的人脸脸型识别方法。A third aspect of the present invention provides an electronic device, the electronic device includes a processor, and the processor is configured to implement the face recognition method when executing a computer program stored in a memory.
本发明的第四方面提供一种计算机可读存储介质,所述计算机可读存储介 质上存储有计算机程序,所述计算机程序被处理器执行时实现所述的人脸脸型识别方法。A fourth aspect of the present invention provides a computer-readable storage medium on which a computer program is stored, and the computer program is executed by a processor to realize the face recognition method.
综上,本发明所述的人脸脸型识别方法、装置、电子设备及存储介质,采用预先训练好的3D重建参数提取模型提取待识别的人脸脸部图像中的3D重建参数及图像特征,并基于所述3D重建参数重建出3D人脸后提取所述3D人脸中的轮廓特征,最后基于所述轮廓特征和所述图像特征构建出联合特征,采用预先设置的人脸脸型分类器识别所述联合特征,即可得到人脸脸型识别结果。重建3D人脸时,仅需一张人脸脸部图像,无需多视角下的多张人脸脸部图像,因而,重建3D人脸的过程简单,计算量少,识别人脸脸型的速度更快;同时,将表示人脸几何分布信息的轮廓特征和表示纹理信息的图像特征连接在一起构建出联合特征,信息更为丰富,因而基于联合特征识别出人脸脸型的结果可靠性更高。In summary, the face recognition method, device, electronic device and storage medium of the present invention use a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image to be recognized, After reconstructing a 3D face based on the 3D reconstruction parameters, extracting contour features in the 3D face, and finally constructing a joint feature based on the contour feature and the image feature, and using a preset face classifier to recognize The combined features can obtain the face recognition result. When reconstructing a 3D face, only one face image is required, and there is no need for multiple face images under multiple viewing angles. Therefore, the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape. Fast; at the same time, the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
附图说明Description of the drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only It is an embodiment of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without creative work.
图1是本发明较佳实施例提供的人脸脸型识别的流程示意图。FIG. 1 is a schematic diagram of the flow of face recognition according to a preferred embodiment of the present invention.
图2是本发明实施例提供的网络结构的示意图。Fig. 2 is a schematic diagram of a network structure provided by an embodiment of the present invention.
图3是本发明较佳实施例提供的重建正面且无表情的3D人脸的过程示意图。FIG. 3 is a schematic diagram of the process of reconstructing a frontal and expressionless 3D human face according to a preferred embodiment of the present invention.
图4是本发明较佳实施例提供的人脸脸型识别装置的结构图。Fig. 4 is a structural diagram of a face recognition device provided by a preferred embodiment of the present invention.
图5是本发明较佳实施例提供的电子设备的示意图。Fig. 5 is a schematic diagram of an electronic device provided by a preferred embodiment of the present invention.
如下具体实施方式将结合上述附图进一步说明本发明。The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings.
具体实施方式Detailed ways
实施例一Example one
请同时参阅图1-图3所示,其中,图1为本发明实施例提供的人脸脸型识别的流程示意图。Please refer to FIG. 1 to FIG. 3 at the same time. FIG. 1 is a schematic diagram of a face recognition process according to an embodiment of the present invention.
所述人脸脸型识别方法具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些步骤可以省略。The face recognition method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
S11,获取待识别的人脸脸部图像。S11: Acquire a face image to be recognized.
本实施例中,若要识别某个用户的脸型,则需先获取这个用户的一张人脸脸部图像,通过识别所述人脸脸部图像来检测出这个用户的人脸脸型。In this embodiment, if the face shape of a certain user is to be recognized, a face image of the user needs to be acquired first, and the face shape of the user is detected by recognizing the face image.
其中,所述人脸脸部图像为仅包括了人脸脸部区域的图像,而不包括身体部位。通过获取仅包括人脸脸部区域的人脸脸部图像,能够减少对无用数据(例如,身体部位对应的像素)的计算,有助于提高人脸脸型的识别速度;且人脸脸部图像中去除了身体部位对应的像素的干扰,有助于提高人脸脸型的识别精度。Wherein, the human face facial image is an image that only includes the human face facial area, and does not include body parts. By acquiring a face image that only includes the face area, the calculation of useless data (for example, pixels corresponding to body parts) can be reduced, which helps to improve the recognition speed of the face shape; and the face image It removes the interference of pixels corresponding to body parts, which helps to improve the accuracy of facial recognition.
实际生活中,用户可能并不积极配合,或者需要隐蔽的采集用户的图像,则获取到的图像中可能会包括身体部位在内,此时需要对获取的图像进行处理,确保输入至预先训练好的3D重建参数提取模型中的图像为仅包括人脸脸部区域在内的人脸脸部图像。In real life, the user may not actively cooperate, or need to covertly collect the user's image, the acquired image may include body parts. At this time, the acquired image needs to be processed to ensure that it is input to the pre-trained The image in the 3D reconstruction parameter extraction model is a face image that only includes the face area.
因此,在一个可选的实施例中,为了确保输入至预先训练好的3D重建参数提取模型中的图像为人脸脸部图像,在获取待识别的人脸脸部图像之前,所述方法还包括:Therefore, in an optional embodiment, in order to ensure that the image input to the pre-trained 3D reconstruction parameter extraction model is a face image, before acquiring the face image to be recognized, the method further includes :
采集用户图像;Collect user images;
检测所述用户图像中的人脸脸部区域;Detecting the face area in the user image;
裁剪出所述人脸脸部区域得到人脸脸部图像。Cut out the facial area of the human face to obtain a facial image of the human face.
其中,所述用户图像可以是仅包括了人脸脸部区域的图像,也可以是包括了其他部位在内的半身图像或全身图像。Wherein, the user image may be an image including only the face region of a person, or may be a half-length image or a full body image including other parts.
无论所述用户图像为人脸脸部图像,还是半身图像或全身图像,均先采用人脸检测算法,例如基于Haar-Like特征的人脸检测算法,或者adaboost人脸检测算法,检测所述用户图像中的人脸脸部区域,并将检测到的人脸脸部区域从所述用户图像中裁剪出来,作为人脸脸部图像。Regardless of whether the user image is a face image, a half-length image or a full-body image, a face detection algorithm, such as a face detection algorithm based on Haar-Like features, or an adaboost face detection algorithm, is used to detect the user image. And crop the detected face area from the user image as the face image.
S12,采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征。S12, using a pre-trained 3D reconstruction parameter extraction model to extract 3D reconstruction parameters and image features in the face image.
本实施例中,可以预先基于深度神经网络训练3D重建参数提取模型。优选地,所述深度神经网络为深度可分离卷积神经网络,例如,MobileNetV1,MobileNetV2等。深度可分离卷积神经网络由深度可分离卷积所构成,除了第一层输入层之外为全卷积,所有的层都跟着一个batchnorm(批量标准化:通过减少内部协变量转换来加速深度网络训练)以及ReLU非线性激活函数,最后一层全连接层没有非线性激活函数直接送入softmax层进行分类。In this embodiment, the 3D reconstruction parameter extraction model may be trained in advance based on the deep neural network. Preferably, the deep neural network is a deep separable convolutional neural network, for example, MobileNetV1, MobileNetV2, etc. The deep separable convolutional neural network is composed of deep separable convolutions. Except for the first input layer, it is fully convolutional. All layers are followed by a batchnorm (batch normalization: speed up the deep network by reducing internal covariate conversion) Training) and ReLU nonlinear activation function, the last fully connected layer without nonlinear activation function is directly sent to the softmax layer for classification.
在训练3D重建参数提取模型之前,需要从开源的人脸数据库(例如,The 300 Videos in the Wild(300-VW))获取多个不同人脸脸型的多张人脸脸部图像及每张脸部图像的3D重建参数,然后将人脸脸部图像和3D重建参数作为数据集,并基于所述数据集训练3D重建参数提取模型。所述人脸脸型包括:方形,三角形,椭圆形,心形,圆形,长形及倒三角形等。所述3D重建参数包括:人脸重建形状参数、人脸重建形变参数、人脸位置参数。其中,所述人脸位置参数包括:人脸旋转矩阵以及人脸位移。所述人脸位移是指人脸平移系数。Before training the 3D reconstruction parameter extraction model, it is necessary to obtain multiple face images and each face from an open source face database (for example, The 300 Videos in the Wild (300-VW)). 3D reconstruction parameters of the image, then the face image and the 3D reconstruction parameters are used as a data set, and the 3D reconstruction parameter extraction model is trained based on the data set. The face shape of the human face includes: square, triangle, ellipse, heart, circle, long and inverted triangle, etc. The 3D reconstruction parameters include: face reconstruction shape parameters, face reconstruction deformation parameters, and face position parameters. Wherein, the face position parameters include: face rotation matrix and face displacement. The face displacement refers to the face translation coefficient.
由于是基于人脸脸部图像和3D重建参数训练深度神经网络得到的3D重建参数提取模型,因而,将一张人脸脸部图像输入至3D重建参数提取模型中,3D重建参数提取模型即可对所输入的人脸脸部图像进行检测,从而输出所述人脸脸部图像对应的3D重建参数。由于本发明的核心思想不在于训练3D重建参数提取模型,故而,本发明对训练过程不做具体阐述。Since it is based on the 3D reconstruction parameter extraction model obtained by training the deep neural network based on the face image and 3D reconstruction parameters, input a face image into the 3D reconstruction parameter extraction model, and the 3D reconstruction parameter extraction model is sufficient The input face image is detected, and the 3D reconstruction parameter corresponding to the face image is output. Since the core idea of the present invention is not to train the 3D reconstruction parameter extraction model, the present invention does not specifically elaborate on the training process.
在一个可选的实施例中,所述采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征包括:In an optional embodiment, the extraction of 3D reconstruction parameters and image features from the face image using a pre-trained 3D reconstruction parameter extraction model includes:
输入所述人脸脸部图像至所述预先训练好的3D重建参数提取模型中;Input the face image into the pre-trained 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的最后一层输出的3D重建参数;Acquiring the 3D reconstruction parameters output by the last layer of the 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的倒数第二层输出的图像特征。Obtain the image features output by the penultimate layer of the 3D reconstruction parameter extraction model.
通常而言,任何一个网络模型的倒数第二层都会对输入倒数第二层的特征图进行计算并输出图像特征至最后一层进行分类或检测。在本实施例中,如图2所示,将人脸人脸图像输入至预先训练的3D重建参数提取模型的输入层,经过中间多层的运算输入图像特征值倒数第二层(位于最后一层之上的一层,可以是池化层),倒数第二层对输入的图像特征进一步计算输出表征能力更强的图像特征至最后一层(全连接层)全连接层对输入的图像特征进行提取得到3D重建参数。因而,可以获取所述3D重建参数提取模型的倒数第二层输出的图像特征和最后一层输出的3D重建参数。Generally speaking, the penultimate layer of any network model will calculate the feature map of the input penultimate layer and output the image features to the last layer for classification or detection. In this embodiment, as shown in Figure 2, the face image is input to the input layer of the pre-trained 3D reconstruction parameter extraction model, and the second-to-last layer of image feature values (located in the last The layer above the layer can be a pooling layer), the penultimate layer further calculates the input image features and outputs the image features with stronger characterization capabilities to the last layer (fully connected layer) to the input image features Perform extraction to obtain 3D reconstruction parameters. Therefore, the image features output by the penultimate layer of the 3D reconstruction parameter extraction model and the 3D reconstruction parameters output by the last layer can be obtained.
S13,基于所述3D重建参数重建出3D人脸。S13, reconstructing a 3D human face based on the 3D reconstruction parameters.
在得到3D重建参数之后,即可基于所述3D重建参数重建出一个3D人脸。本实施例中,可以采3D形变模型(3D Morphable model,3DMM)和3D形状融合模型(3D BlendShape model,3DBM)重建3D人脸。After the 3D reconstruction parameters are obtained, a 3D human face can be reconstructed based on the 3D reconstruction parameters. In this embodiment, a 3D Morphable model (3D Morphable model, 3DMM) and a 3D Blend Shape model (3D Blend Shape model, 3DBM) can be used to reconstruct a 3D face.
在一个可选的实施例中,由于基于所述3D重建参数重建出的3D人脸包含有表情信息,而表情信息会影响到人脸脸型的识别结果,因而为了进一步的重建出正面且无表情的人脸,所述基于所述3D重建参数重建出3D人脸包括:In an optional embodiment, since the 3D face reconstructed based on the 3D reconstruction parameters contains expression information, and the expression information will affect the recognition result of the face shape, in order to further reconstruct the face and expressionless For the face of, the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
获取基准向量和平均脸;Obtain the reference vector and the average face;
根据所述人脸重建形状参数、所述基准向量和所述平均脸构建正面人脸;Constructing a frontal face according to the face reconstruction shape parameter, the reference vector and the average face;
根据所述人脸重建形变参数将所述正面人脸调整为无表情的3D人脸。The frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
其中,所述基准向量包括3D形变模型的第一特征向量及3D形状融合模型的第二特征向量。一些开源的3DMM在发布时会附带一张平均脸和一组用来表示人脸在不同情况下的形状变化的参数,3DBM在发布时会附带一组用来表示人脸在不同情况下的表情变化的参数。将表示人脸在不同情况下的形状变化的参数定义为所述第一特征向量,将表示人脸在不同情况下的表情变化的参数定 义为所述第二特征向量。Wherein, the reference vector includes the first feature vector of the 3D deformation model and the second feature vector of the 3D shape fusion model. Some open source 3DMMs will be released with an average face and a set of parameters used to represent the shape changes of the face under different conditions. 3DBM will be released with a set of expressions used to represent the face under different conditions. Changing parameters. The parameter representing the shape change of the human face under different conditions is defined as the first feature vector, and the parameter representing the expression change of the human face under different situations is defined as the second feature vector.
具体的,可以通过如下公式基于所述人脸重建形状参数、人脸重建形变参数、人脸旋转矩阵及人脸位移、平均脸、第一特征向量及第二特征向量重建出3D人脸:Specifically, a 3D face can be reconstructed based on the face reconstruction shape parameters, face reconstruction deformation parameters, face rotation matrix and face displacement, average face, first feature vector, and second feature vector through the following formula:
Figure PCTCN2019121344-appb-000001
Figure PCTCN2019121344-appb-000001
其中,Face 3d表示重建出的3D人脸;R表示所述人脸旋转矩阵,置为单位矩阵;
Figure PCTCN2019121344-appb-000002
表示所述平均脸;s i表示所述第一特征向量;
Wherein, Face 3d represents the reconstructed 3D face; R represents the face rotation matrix, which is set as the identity matrix;
Figure PCTCN2019121344-appb-000002
Represents the average face; s i represents the first feature vector;
3DMM_params表示所述人脸重建形状参数;b i表示所述第二特征向量,BlendShape_params表示所述人脸重建形变参数,置为0;T表示所述人脸位移,置为0;m表示为所述人脸重建形状参数的个数,n表示为所述人脸重建形变参数的个数。 3DMM_params represents the face reconstruction shape parameter; b i represents the second feature vector, BlendShape_params represents the face reconstruction deformation parameter, set to 0; T represents the face displacement, set to 0; m represents The number of face reconstruction shape parameters, and n is the number of face reconstruction deformation parameters.
在重建的过程中,将所述人脸旋转矩阵R设置为单位矩阵,人脸位移T设置为0,可以将重建出的3D人脸旋转为正面人脸,同时将所述人脸重建形变参数BlendShape params设置为0,可以消除重建出的3D人脸中包含的表情,如此重定向后的3D人脸Face 3d便为正面且无表情的脸。 In the reconstruction process, the face rotation matrix R is set to the unit matrix, and the face displacement T is set to 0, the reconstructed 3D face can be rotated into a frontal face, and the deformation parameters of the face can be reconstructed at the same time Setting BlendShape params to 0 can eliminate the expression contained in the reconstructed 3D face, so the redirected 3D face Face 3d is a frontal and expressionless face.
图3示出了正面且无表情的3D人脸的重建过程,其中,左边的图为基于所述3D重建参数重建出的3D人脸,非正面且包含了表情的人脸;中间的图为将所述人脸旋转矩阵R设置为单位矩阵和人脸位移T设置为0之后得到的正面3D人脸;右边的图为将所述人脸重建形变参数BlendShape params置为0之后得到的无表情的3D人脸。Figure 3 shows the reconstruction process of a frontal and expressionless 3D face, where the picture on the left is a 3D face reconstructed based on the 3D reconstruction parameters, a face that is not frontal and contains an expression; the middle picture is Set the face rotation matrix R to the unit matrix and the face displacement T to 0 to obtain the frontal 3D face; the picture on the right is the expressionless face obtained after the face reconstruction deformation parameter BlendShape params is set to 0 3D human face.
将基于所述3D重建参数重建出的3D人脸旋转为正面人脸,解决了侧脸旋转到正面脸的问题,正面的人脸能够提高人脸脸型的识别准确率;再消除正面脸中的表情,解决了人脸表情的问题,无表情的正面人脸能够进一步的提高人脸脸型的识别准确率,人脸脸型识别结果可信度高。Rotating the 3D face reconstructed based on the 3D reconstruction parameters into a frontal face solves the problem of rotating the side face to the frontal face. The frontal face can improve the recognition accuracy of the face shape; and then eliminate the frontal face. The expression solves the problem of facial expressions. The expressionless frontal face can further improve the accuracy of facial recognition, and the result of facial recognition is highly reliable.
S14,提取所述3D人脸中的轮廓特征。S14: Extract contour features in the 3D face.
脸型是通过面部的轮廓体现出来的,因而需要提取3D人脸上脸颊部分的特征,脸颊部分的特征称之为轮廓特征。The face shape is reflected by the contour of the face, so it is necessary to extract the features of the cheek part of the 3D face. The features of the cheek part are called contour features.
在一个可选的实施例中,所述提取所述3D人脸中的轮廓特征包括:In an optional embodiment, the extracting contour features in the 3D human face includes:
获取所述3D人脸中的几何特征及每个几何特征对应的第一索引;Acquiring geometric features in the 3D face and a first index corresponding to each geometric feature;
从所述第一索引中筛选出与人脸轮廓相关的多个第二索引;Filtering out a plurality of second indexes related to face contours from the first index;
提取与所述多个第二索引对应的几何特征作为所述3D人脸的轮廓特征。Extracting geometric features corresponding to the plurality of second indexes as contour features of the 3D face.
本实施例中,通过3DMM和3D BlendShape model重定向出正面且无表情的3D人脸,包含了5万多个数据点,每个数据点包含x,y,z坐标,且每个数据点上都标识有一个索引。首先,确定需要提取的关键数据点,再确定出与所述关键数据点对应的目标索引,然后从5万多个数据点中提取出与所述目标索引对应的目标几何特征,将所提取出的目标几何特征作为轮廓特征。示例性的,需要提取128个关键数据点,这128个关键点位于人脸脸颊部分,提取出的128个关键数据点对应的几何特征作为所述3D人脸的轮廓特征。In this embodiment, a frontal and expressionless 3D face is redirected through 3DMM and 3D BlendShape model, which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index. First, determine the key data points that need to be extracted, and then determine the target index corresponding to the key data point, and then extract the target geometric features corresponding to the target index from more than 50,000 data points, and extract the The target geometric features are used as contour features. Exemplarily, 128 key data points need to be extracted, these 128 key points are located in the cheek part of the human face, and the geometric features corresponding to the extracted 128 key data points are used as contour features of the 3D human face.
S15,基于所述轮廓特征和所述图像特征构建出联合特征。S15, constructing a joint feature based on the contour feature and the image feature.
其中,所述联合特征是指连接所述轮廓特征和所述图像特征得到的特征向量。Wherein, the joint feature refers to a feature vector obtained by connecting the contour feature and the image feature.
在一个可选的实施例中,为了使人脸脸颊坐标对称分布,所述基于所述轮廓特征和所述图像特征构建出联合特征包括:In an optional embodiment, in order to symmetrically distribute the cheek coordinates of a person, the constructing a joint feature based on the contour feature and the image feature includes:
计算所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值之间的差值;Calculating the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature;
对经过差值计算之后的轮廓特征与所述图像特征进行连接,形成一维向量;Connecting the contour feature after the difference calculation and the image feature to form a one-dimensional vector;
将所述一维向量作为所述联合特征。Use the one-dimensional vector as the joint feature.
本实施例中,根据鼻尖(即,鼻子正中心点)对应的索引,从重定向出正面且无表情的3D人脸中提取出鼻尖坐标作为中心点,将脸型轮廓上的点与中心点做差值,即将所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值做差值,得到以0点为中心的脸型轮廓点将所有进行了差值计算之后的轮廓特征并压缩成一维特征向量,数据大小为128x3=364。若图像特征大小为1024,则基于所 述轮廓特征和所述图像特征构建出的联合特征为1维1388列的特征向量。In this embodiment, according to the index corresponding to the tip of the nose (that is, the center point of the nose), the coordinates of the tip of the nose are extracted from the redirected 3D face without expression as the center point, and the point on the contour of the face is made difference from the center point. Value, that is, the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature to obtain the face contour point centered at 0 point. All contour features after the difference calculation are compressed into a one-dimensional feature vector, The data size is 128x3=364. If the image feature size is 1024, the joint feature constructed based on the contour feature and the image feature is a one-dimensional feature vector of 1388 columns.
所述轮廓特征表示人脸的几何分布信息,所述图像特征表示人脸的纹理信息,因而构建出的联合特征包含了人脸的几何分布信息和纹理信息,信息更为丰富。The contour feature represents the geometric distribution information of the human face, and the image feature represents the texture information of the human face. Therefore, the constructed joint feature contains the geometric distribution information and texture information of the human face, and the information is more abundant.
S16,采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果。S16: Recognizing the joint feature by using a preset face classifier to obtain a face recognition result.
本实施例中,可以预先设置人脸脸型分类器,如图2所示,人脸脸型分类器包括两层全连接层(FC1层和FC2层)和一个激活层(Activate Layer),最后一层为损失函数层(Softmax Loss)。In this embodiment, a face classifier can be preset. As shown in Figure 2, the face classifier includes two fully connected layers (FC1 layer and FC2 layer) and an activation layer (Activate Layer). The last layer It is the loss function layer (Softmax Loss).
通过3D重建参数提取模型提取所述待识别的人脸脸部图像中的3D重建参数和图像特征,基于3D重建参数重建出3D人脸,再提取出3D人脸中的轮廓特征,最后将轮廓特征和图像特征连接为联合特征并输入至人脸脸型分类器,即可得到人脸脸型识别结果。Extract the 3D reconstruction parameters and image features in the face image to be recognized through the 3D reconstruction parameter extraction model, reconstruct the 3D face based on the 3D reconstruction parameters, and then extract the contour features in the 3D face, and finally the contour The feature and the image feature are connected as a joint feature and input to the face classifier to obtain the face recognition result.
在一个可选的实施例中,所述采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果包括:In an optional embodiment, the recognition of the joint feature by using a preset face classifier to obtain a face recognition result includes:
采用所述预先设置的人脸脸型分类器识别所述联合特征;Using the preset face classifier to recognize the joint feature;
通过梯度回传算法计算风险损失值;Calculate the risk loss value through the gradient backhaul algorithm;
当所述风险损失值达到最小时,输出人脸脸型识别结果作为所述待识别的人脸脸部图像的人脸脸型识别结果。When the risk loss value reaches the minimum, the face recognition result is output as the face recognition result of the face image to be recognized.
本实施例中,通过梯度回传算法使得所述人脸脸型分类器的风险损失值最小时,表明人脸脸型分类器已经趋于了稳定,此时人脸脸型分类器的参数达到了最优值,得到的人脸脸型识别结果为所述待识别的人脸脸部图像的人脸脸型识别结果。In this embodiment, when the risk loss value of the face classifier is minimized by the gradient backhaul algorithm, it indicates that the face classifier has stabilized, and the parameters of the face classifier have reached the optimal value. Value, the obtained face recognition result is the face recognition result of the face image to be recognized.
关于梯度回传算法为现有技术,本发明在此不再阐述。Regarding the gradient backhaul algorithm as the prior art, the present invention will not elaborate here.
需要说明的是,在识别的过程中,只需要更新人脸脸型分类器中的两层全连接层(FC1层和FC2层)的权重,3D重建参数提取模型为已经训练好的模 型,故3D重建参数提取模型中的权重不做任何更新。It should be noted that during the recognition process, only the weights of the two fully connected layers (FC1 and FC2) in the face classifier need to be updated. The 3D reconstruction parameter extraction model is the trained model, so 3D The weights in the reconstruction parameter extraction model are not updated.
综上,本发明所述的人脸脸型识别方法,采用预先训练好的3D重建参数提取模型提取待识别的人脸脸部图像,得到3D重建参数及图像特征,并基于所述3D重建参数重建出3D人脸后提取所述3D人脸中的轮廓特征,最后基于所述轮廓特征和所述图像特征构建出联合特征,采用预先设置的人脸脸型分类器识别所述联合特征,即可得到人脸脸型识别结果。重建3D人脸时,仅需一张人脸脸部图像,无需多视角下的多张人脸脸部图像,因而,重建3D人脸的过程简单,计算量少,识别人脸脸型的速度更快;同时,将表示人脸几何分布信息的轮廓特征和表示纹理信息的图像特征连接在一起构建出联合特征,信息更为丰富,因而基于联合特征识别出人脸脸型的结果可靠性更高。In summary, the face recognition method of the present invention uses a pre-trained 3D reconstruction parameter extraction model to extract the face image to be recognized, obtain 3D reconstruction parameters and image features, and reconstruct based on the 3D reconstruction parameters After the 3D face is extracted, the contour features in the 3D face are extracted, and finally a joint feature is constructed based on the contour feature and the image feature, and the joint feature is recognized by using a preset face classifier to obtain Face recognition result. When reconstructing a 3D face, only one face image is required, and there is no need for multiple face images under multiple viewing angles. Therefore, the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape. Fast; at the same time, the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
此外,本发明通过将得到的3D重建参数中人脸重建形变参数设置为0,人脸旋转矩阵R设置为单位矩阵,人脸位移T设置为0,构建出的3D人脸为正面且无表情的人脸,能够进一步提高人脸脸型的识别结果的可靠性。In addition, in the present invention, by setting the face reconstruction deformation parameter in the obtained 3D reconstruction parameters to 0, the face rotation matrix R to the identity matrix, and the face displacement T to 0, the constructed 3D face is frontal and expressionless. The face can further improve the reliability of the recognition result of the face shape.
上述图1-3详细介绍了本发明的人脸脸型识别方法,下面结合图4和图5,分别对实现所述人脸脸型识别方法的软件系统的功能模块以及实现所述人脸脸型识别方法的硬件系统架构进行介绍。The above-mentioned Figures 1-3 describe the face recognition method of the present invention in detail. In conjunction with Figures 4 and 5, the functional modules of the software system that implements the face recognition method and the face recognition method are respectively described The hardware system architecture is introduced.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the described embodiments are for illustrative purposes only, and are not limited by this structure in the scope of the patent application.
实施例二Example two
参阅图4所示,是本发明人脸脸型识别装置的较佳实施例中的功能模块图。Refer to FIG. 4, which is a diagram of functional modules in a preferred embodiment of the face recognition device of the present invention.
在一些实施例中,所述人脸脸型识别装置40运行于电子设备中。所述人脸脸型识别装置40可以包括多个由程序代码段所组成的功能模块。所述人脸脸型识别装置40中的各个程序段的程序代码可以存储于所述电子设备的存储器中,并由至少一个处理器所执行,以执行(详见图1描述)所述人脸脸型识别功能。In some embodiments, the face recognition device 40 runs in an electronic device. The face recognition device 40 may include multiple functional modules composed of program code segments. The program code of each program segment in the face recognition device 40 can be stored in the memory of the electronic device and executed by at least one processor to execute (see Figure 1 for details) the face shape Recognition function.
本实施例中,所述人脸脸型识别装置40根据其所执行的功能,可以被划分 为多个功能模块。所述功能模块可以包括:获取模块401、采集模块402、检测模块403、训练模块404、重建模块405、提取模块406、构建模块407及识别模块408。本发明所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机程序段,其存储在所述存储器中。在本实施例中,关于各模块的功能将在后续的实施例中详述。In this embodiment, the face recognition device 40 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an acquisition module 401, an acquisition module 402, a detection module 403, a training module 404, a reconstruction module 405, an extraction module 406, a construction module 407, and an identification module 408. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in the memory. In this embodiment, the function of each module will be described in detail in subsequent embodiments.
获取模块401,用于获取待识别的人脸脸部图像。The obtaining module 401 is used to obtain a face image to be recognized.
本实施例中,若要识别某个用户的脸型,则需先获取这个用户的一张人脸脸部图像,通过识别所述人脸脸部图像来检测出这个用户的人脸脸型。In this embodiment, if the face shape of a certain user is to be recognized, a face image of the user needs to be acquired first, and the face shape of the user is detected by recognizing the face image.
其中,所述人脸脸部图像为仅包括了人脸脸部区域的图像,而不包括身体部位。通过获取仅包括人脸脸部区域的人脸脸部图像,能够减少对无用数据(例如,身体部位对应的像素)的计算,有助于提高人脸脸型的识别速度;且人脸脸部图像中去除了身体部位对应的像素的干扰,有助于提高人脸脸型的识别精度。Wherein, the human face image is an image that only includes the human face and facial area, and does not include body parts. By acquiring a face image that only includes the face area, the calculation of useless data (for example, pixels corresponding to body parts) can be reduced, which helps to improve the recognition speed of the face shape; and the face image It removes the interference of pixels corresponding to body parts, which helps to improve the accuracy of facial recognition.
实际生活中,用户可能并不积极配合,或者需要隐蔽的采集用户的图像,则获取到的图像中可能会包括身体部位在内,此时需要对获取的图像进行处理,确保输入至预先训练好的3D重建参数提取模型中的图像为仅包括人脸脸部区域在内的人脸脸部图像。In real life, the user may not actively cooperate, or need to covertly collect the user's image, the acquired image may include body parts. At this time, the acquired image needs to be processed to ensure that it is input to the pre-trained The image in the 3D reconstruction parameter extraction model is a face image that only includes the face area.
因此,在一个可选的实施例中,为了确保输入至预先训练好的3D重建参数提取模型中的图像为人脸脸部图像,在获取待识别的人脸脸部图像之前,所述装置40还包括:采集模块402,用于:Therefore, in an optional embodiment, in order to ensure that the image input to the pre-trained 3D reconstruction parameter extraction model is a face image, before acquiring the face image to be recognized, the device 40 also Including: a collection module 402 for:
采集用户图像;Collect user images;
检测所述用户图像中的人脸脸部区域;Detecting the face area in the user image;
裁剪出所述人脸脸部区域得到人脸脸部图像。Cut out the facial area of the human face to obtain a facial image of the human face.
其中,所述用户图像可以是仅包括了人脸脸部区域的图像,也可以是包括了其他部位在内的半身图像或全身图像。Wherein, the user image may be an image including only the face region of a person, or may be a half-length image or a full body image including other parts.
无论所述用户图像为人脸脸部图像,还是半身图像或全身图像,均先采用 人脸检测算法,例如基于Haar-Like特征的人脸检测算法,或者adaboost人脸检测算法,检测所述用户图像中的人脸脸部区域,并将检测到的人脸脸部区域从所述用户图像中裁剪出来,作为人脸脸部图像。Regardless of whether the user image is a face image, a half-length image or a full-body image, a face detection algorithm, such as a face detection algorithm based on Haar-Like features, or an adaboost face detection algorithm, is used to detect the user image. And crop the detected face area from the user image as the face image.
检测模块403,用于采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征。The detection module 403 is configured to use a pre-trained 3D reconstruction parameter extraction model to extract 3D reconstruction parameters and image features in the face image.
训练模块404,用于预先基于深度神经网络训练3D重建参数提取模型。优选地,所述深度神经网络为深度可分离卷积神经网络,例如,MobileNetV1,MobileNetV2等。深度可分离卷积神经网络由深度可分离卷积所构成,除了第一层输入层之外为全卷积,所有的层都跟着一个batchnorm(批量标准化:通过减少内部协变量转换来加速深度网络训练)以及ReLU非线性激活函数,最后一层全连接层没有非线性激活函数直接送入softmax层进行分类。The training module 404 is used to train the 3D reconstruction parameter extraction model based on the deep neural network in advance. Preferably, the deep neural network is a deep separable convolutional neural network, for example, MobileNetV1, MobileNetV2, etc. The deep separable convolutional neural network is composed of deep separable convolutions. Except for the first input layer, it is fully convolutional. All layers are followed by a batchnorm (batch normalization: speed up the deep network by reducing internal covariate conversion) Training) and ReLU nonlinear activation function, the last fully connected layer without nonlinear activation function is directly sent to the softmax layer for classification.
在训练3D重建参数提取模型之前,需要从开源的人脸数据库(例如,The 300 Videos in the Wild(300-VW))获取多个不同人脸脸型的多张人脸脸部图像及每张脸部图像的3D重建参数,然后将人脸脸部图像和3D重建参数作为数据集,并基于所述数据集训练3D重建参数提取模型。所述人脸脸型包括:方形,三角形,椭圆形,心形,圆形,长形及倒三角形等。所述3D重建参数包括:人脸重建形状参数、人脸重建形变参数、人脸位置参数。其中,所述人脸位置参数包括:人脸旋转矩阵以及人脸位移。所述人脸位移是指人脸平移系数。Before training the 3D reconstruction parameter extraction model, it is necessary to obtain multiple face images and each face from an open source face database (for example, The 300 Videos in the Wild (300-VW)). 3D reconstruction parameters of the image, then the face image and the 3D reconstruction parameters are used as a data set, and the 3D reconstruction parameter extraction model is trained based on the data set. The face shape of the human face includes: square, triangle, ellipse, heart, circle, long and inverted triangle, etc. The 3D reconstruction parameters include: face reconstruction shape parameters, face reconstruction deformation parameters, and face position parameters. Wherein, the face position parameters include: face rotation matrix and face displacement. The face displacement refers to the face translation coefficient.
由于是基于人脸脸部图像和3D重建参数训练深度神经网络得到的3D重建参数提取模型,因而,将一张人脸脸部图像输入至3D重建参数提取模型中,3D重建参数提取模型即可对所输入的人脸脸部图像进行检测,从而输出所述人脸脸部图像对应的3D重建参数。由于本发明的核心思想不在于训练3D重建参数提取模型,故而,本发明对训练过程不做具体阐述。Since it is based on the 3D reconstruction parameter extraction model obtained by training the deep neural network based on the face image and 3D reconstruction parameters, input a face image into the 3D reconstruction parameter extraction model, and the 3D reconstruction parameter extraction model is sufficient The input face image is detected, and the 3D reconstruction parameter corresponding to the face image is output. Since the core idea of the present invention is not to train the 3D reconstruction parameter extraction model, the present invention does not specifically elaborate on the training process.
在一个可选的实施例中,所述检测模块403采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征包括:In an optional embodiment, the detection module 403 using a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image includes:
输入所述人脸脸部图像至所述预先训练好的3D重建参数提取模型中;Input the face image into the pre-trained 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的最后一层输出的3D重建参数;Acquiring the 3D reconstruction parameters output by the last layer of the 3D reconstruction parameter extraction model;
获取所述3D重建参数提取模型的倒数第二层输出的图像特征。Obtain the image features output by the penultimate layer of the 3D reconstruction parameter extraction model.
通常而言,任何一个网络模型的倒数第二层都会对输入倒数第二层的特征图进行计算并输出图像特征至最后一层进行分类或检测。在本实施例中,如图2所示,将人脸人脸图像输入至预先训练的3D重建参数提取模型的输入层,经过中间多层的运算输入图像特征值倒数第二层(位于最后一层之上的一层,可以是池化层),倒数第二层对输入的图像特征进一步计算输出表征能力更强的图像特征至最后一层(全连接层)全连接层对输入的图像特征进行提取得到3D重建参数。因而,可以获取所述3D重建参数提取模型的倒数第二层输出的图像特征和最后一层输出的3D重建参数。Generally speaking, the penultimate layer of any network model will calculate the feature map of the input penultimate layer and output the image features to the last layer for classification or detection. In this embodiment, as shown in Figure 2, the face image is input to the input layer of the pre-trained 3D reconstruction parameter extraction model, and the second-to-last layer of image feature values (located in the last The layer above the layer can be a pooling layer), the penultimate layer further calculates the input image features and outputs the image features with stronger characterization capabilities to the last layer (fully connected layer) to the input image features Perform extraction to obtain 3D reconstruction parameters. Therefore, the image features output by the penultimate layer of the 3D reconstruction parameter extraction model and the 3D reconstruction parameters output by the last layer can be obtained.
重建模块405,用于基于所述3D重建参数重建出3D人脸。The reconstruction module 405 is configured to reconstruct a 3D face based on the 3D reconstruction parameters.
在得到3D重建参数之后,即可基于所述3D重建参数重建出一个3D人脸。本实施例中,可以采3D形变模型(3D Morphable model,3DMM)和3D形状融合模型(3D BlendShape model,3DBM)重建3D人脸。After the 3D reconstruction parameters are obtained, a 3D human face can be reconstructed based on the 3D reconstruction parameters. In this embodiment, a 3D Morphable model (3D Morphable model, 3DMM) and a 3D Blend Shape model (3D Blend Shape model, 3DBM) can be used to reconstruct a 3D face.
在一个可选的实施例中,由于基于所述3D重建参数重建出的3D人脸包含有表情信息,而表情信息会影响到人脸脸型的识别结果,因而为了进一步的重建出正面且无表情的人脸,所述基于所述3D重建参数重建出3D人脸包括:In an optional embodiment, since the 3D face reconstructed based on the 3D reconstruction parameters contains expression information, and the expression information will affect the recognition result of the face shape, in order to further reconstruct the face and expressionless For the face of, the reconstruction of the 3D face based on the 3D reconstruction parameters includes:
获取基准向量和平均脸;Obtain the reference vector and the average face;
根据所述人脸重建形状参数、所述基准向量和所述平均脸构建正面人脸;Constructing a frontal face according to the face reconstruction shape parameter, the reference vector and the average face;
根据所述人脸重建形变参数将所述正面人脸调整为无表情的3D人脸。The frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
其中,所述基准向量包括3D形变模型的第一特征向量及3D形状融合模型的第二特征向量。一些开源的3DMM在发布时会附带一张平均脸和一组用来表示人脸在不同情况下的形状变化的参数,3DBM在发布时会附带一组用来表示人脸在不同情况下的表情变化的参数。将表示人脸在不同情况下的形状变化的参数定义为所述第一特征向量,将表示人脸在不同情况下的表情变化的参数定义为所述第二特征向量。Wherein, the reference vector includes the first feature vector of the 3D deformation model and the second feature vector of the 3D shape fusion model. Some open source 3DMMs will be released with an average face and a set of parameters used to represent the shape changes of the face under different conditions. 3DBM will be released with a set of expressions used to represent the face under different conditions. Changing parameters. The parameter representing the shape change of the human face under different conditions is defined as the first feature vector, and the parameter representing the expression change of the human face under different situations is defined as the second feature vector.
具体的,可以通过如下公式计算所述人脸重建形状参数、人脸重建形变参数、人脸旋转矩阵、人脸位移、平均脸、第一特征向量及第二特征向量得到3D人脸:Specifically, the 3D face can be obtained by calculating the face reconstruction shape parameter, the face reconstruction deformation parameter, the face rotation matrix, the face displacement, the average face, the first feature vector, and the second feature vector through the following formula:
Figure PCTCN2019121344-appb-000003
Figure PCTCN2019121344-appb-000003
其中,Face 3d表示重建出的3D人脸;R表示所述人脸旋转矩阵,置为单位矩阵;
Figure PCTCN2019121344-appb-000004
表示所述平均脸;s i表示所述第一特征向量;
Wherein, Face 3d represents the reconstructed 3D face; R represents the face rotation matrix, which is set as the identity matrix;
Figure PCTCN2019121344-appb-000004
Represents the average face; s i represents the first feature vector;
3DMM_params表示所述人脸重建形状参数;b i表示所述第二特征向量,BlendShape_params表示所述人脸重建形变参数,置为0;T表示所述人脸位移,置为0;m表示为所述人脸重建形状参数的个数,n表示为所述人脸重建形变参数的个数。 3DMM_params represents the face reconstruction shape parameter; b i represents the second feature vector, BlendShape_params represents the face reconstruction deformation parameter, set to 0; T represents the face displacement, set to 0; m represents the The number of face reconstruction shape parameters, and n is the number of face reconstruction deformation parameters.
在重建的过程中,将所述人脸旋转矩阵R设置为单位矩阵,人脸位移T设置为0,可以将重建出的3D人脸旋转为正面人脸,同时将所述人脸重建形变参数BlendShape params设置为0,可以消除重建出的3D人脸中包含的表情,如此重定向后的3D人脸Face 3d便为正面且无表情的脸。 In the reconstruction process, the face rotation matrix R is set to the unit matrix, and the face displacement T is set to 0, the reconstructed 3D face can be rotated into a frontal face, and the deformation parameters of the face can be reconstructed at the same time Setting BlendShape params to 0 can eliminate the expression contained in the reconstructed 3D face, so the redirected 3D face Face 3d is a frontal and expressionless face.
图3示出了正面且无表情的3D人脸的重建过程,其中,左边的图为基于所述3D重建参数重建出的3D人脸,非正面且包含了表情的人脸;中间的图为将所述人脸旋转矩阵R设置为单位矩阵和人脸位移T设置为0之后得到的正面3D人脸;右边的图为将所述人脸重建形变参数BlendShape params置为0之后得到的无表情的3D人脸。Figure 3 shows the reconstruction process of a frontal and expressionless 3D face, where the picture on the left is a 3D face reconstructed based on the 3D reconstruction parameters, a face that is not frontal and contains an expression; the middle picture is Set the face rotation matrix R to the unit matrix and the face displacement T to 0 to obtain the frontal 3D face; the picture on the right is the expressionless face obtained after the face reconstruction deformation parameter BlendShape params is set to 0 3D human face.
将基于所述3D重建参数重建出的3D人脸旋转为正面人脸,解决了侧脸旋转到正面脸的问题,正面的人脸能够提高人脸脸型的识别准确率;再消除正面脸中的表情,解决了人脸表情的问题,无表情的正面人脸能够进一步的提高人脸脸型的识别准确率,人脸脸型识别结果可信度高。Rotating the 3D face reconstructed based on the 3D reconstruction parameters into a frontal face solves the problem of rotating the side face to the frontal face. The frontal face can improve the recognition accuracy of the face shape; and then eliminate the frontal face. The expression solves the problem of facial expressions. The expressionless frontal face can further improve the accuracy of facial recognition, and the result of facial recognition is highly reliable.
提取模块406,用于提取所述3D人脸中的轮廓特征。The extraction module 406 is configured to extract contour features in the 3D face.
脸型是通过面部的轮廓体现出来的,因而需要提取3D人脸上脸颊部分的 特征,脸颊部分的特征称之为轮廓特征。The face shape is reflected by the contour of the face, so it is necessary to extract the features of the cheek part of the 3D face. The features of the cheek part are called contour features.
在一个可选的实施例中,所述提取模块406提取所述3D人脸中的轮廓特征包括:In an optional embodiment, the extraction module 406 extracting contour features in the 3D face includes:
获取所述3D人脸中的几何特征及每个几何特征对应的第一索引;Acquiring geometric features in the 3D face and a first index corresponding to each geometric feature;
从所述第一索引中筛选出与人脸轮廓相关的多个第二索引;Filtering out a plurality of second indexes related to face contours from the first index;
提取与所述多个第二索引对应的几何特征作为所述3D人脸的轮廓特征。Extracting geometric features corresponding to the plurality of second indexes as contour features of the 3D face.
本实施例中,通过3DMM和3D BlendShape model重定向出正面且无表情的3D人脸,包含了5万多个数据点,每个数据点包含x,y,z坐标,且每个数据点上都标识有一个索引。首先,确定需要提取的关键数据点,再确定出与所述关键数据点对应的目标索引,然后从5万多个数据点中提取出与所述目标索引对应的目标几何特征,将所提取出的目标几何特征作为轮廓特征。示例性的,需要提取128个关键数据点,这128个关键点位于人脸脸颊部分,提取出的128个关键数据点对应的几何特征作为所述3D人脸的轮廓特征。In this embodiment, a frontal and expressionless 3D face is redirected through 3DMM and 3D BlendShape model, which contains more than 50,000 data points, and each data point contains x, y, z coordinates, and each data point is Both have an index. First, determine the key data points that need to be extracted, and then determine the target index corresponding to the key data point, and then extract the target geometric features corresponding to the target index from more than 50,000 data points, and extract the The target geometric features are used as contour features. Exemplarily, 128 key data points need to be extracted, these 128 key points are located in the cheek part of the human face, and the geometric features corresponding to the extracted 128 key data points are used as contour features of the 3D human face.
构建模块407,用于基于所述轮廓特征和所述图像特征构建出联合特征。The construction module 407 is configured to construct a joint feature based on the contour feature and the image feature.
其中,所述联合特征是指连接所述轮廓特征和所述图像特征得到的特征向量。Wherein, the joint feature refers to a feature vector obtained by connecting the contour feature and the image feature.
在一个可选的实施例中,为了使人脸脸颊坐标对称分布,所述构建模块407基于所述轮廓特征和所述图像特征构建出联合特征包括:In an optional embodiment, in order to symmetrically distribute the cheek coordinates of a person, the construction module 407 constructing a joint feature based on the contour feature and the image feature includes:
计算所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值之间的差值;Calculating the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature;
对经过差值计算之后的轮廓特征与所述图像特征进行连接,形成一维向量;Connecting the contour feature after the difference calculation and the image feature to form a one-dimensional vector;
将所述一维向量作为所述联合特征。Use the one-dimensional vector as the joint feature.
本实施例中,根据鼻尖(即,鼻子正中心点)对应的索引,从重定向出正面且无表情的3D人脸中提取出鼻尖坐标作为中心点,将脸型轮廓上的点与中心点做差值,即将所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值做差值,得到以0点为中心的脸型轮廓点并将所有进行了差值计算之后的轮廓特征压缩成一维特征向量,数据大小为128x3=364。若图像特征大小为1024,则基于所 述轮廓特征和所述图像特征构建出的联合特征为1维1388列的特征向量。In this embodiment, according to the index corresponding to the tip of the nose (that is, the center point of the nose), the coordinates of the tip of the nose are extracted from the redirected 3D face without expression as the center point, and the point on the contour of the face is made difference from the center point. Value, that is, to make the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature to obtain a face contour point centered at 0 point and compress all contour features after the difference calculation into a one-dimensional feature vector, The data size is 128x3=364. If the image feature size is 1024, the joint feature constructed based on the contour feature and the image feature is a one-dimensional feature vector of 1388 columns.
所述轮廓特征表示人脸的几何分布信息,所述图像特征表示人脸的纹理信息,因而构建出的联合特征包含了人脸的几何分布信息和纹理信息,信息更为丰富。The contour feature represents the geometric distribution information of the human face, and the image feature represents the texture information of the human face. Therefore, the constructed joint feature contains the geometric distribution information and texture information of the human face, and the information is more abundant.
识别模块408,用于采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果。The recognition module 408 is configured to recognize the joint feature using a preset face classifier to obtain a face recognition result.
本实施例中,可以预先设置人脸脸型分类器,如图2所示,人脸脸型分类器包括两层全连接层(FC1层和FC2层)和一个激活层(Activate Layer),最后一层为损失函数层(Softmax Loss)。In this embodiment, a face classifier can be preset. As shown in Figure 2, the face classifier includes two fully connected layers (FC1 layer and FC2 layer) and an activation layer (Activate Layer). The last layer It is the loss function layer (Softmax Loss).
通过3D重建参数提取模型提取所述待识别的人脸脸部图像中的3D重建参数和图像特征,基于3D重建参数重建出3D人脸,再提取出3D人脸中的轮廓特征,最后将轮廓特征和图像特征连接为联合特征并输入至人脸脸型分类器,即可得到人脸脸型识别结果。Extract the 3D reconstruction parameters and image features in the face image to be recognized through the 3D reconstruction parameter extraction model, reconstruct the 3D face based on the 3D reconstruction parameters, and then extract the contour features in the 3D face, and finally the contour The feature and the image feature are connected as a joint feature and input to the face classifier to obtain the face recognition result.
在一个可选的实施例中,所述识别模块408采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果包括:In an optional embodiment, the recognition module 408 uses a preset face classifier to recognize the joint feature, and obtaining a face recognition result includes:
采用所述预先设置的人脸脸型分类器识别所述联合特征;Using the preset face classifier to recognize the joint feature;
通过梯度回传算法计算风险损失值;Calculate the risk loss value through the gradient backhaul algorithm;
当所述风险损失值达到最小时,输出人脸脸型识别结果作为所述待识别的人脸脸部图像的人脸脸型识别结果。When the risk loss value reaches the minimum, the face recognition result is output as the face recognition result of the face image to be recognized.
本实施例中,通过梯度回传算法使得所述人脸脸型分类器的风险损失值最小时,表明人脸脸型分类器已经趋于了稳定,此时人脸脸型分类器的参数达到了最优值,得到的人脸脸型识别结果为所述待识别的人脸脸部图像的人脸脸型识别结果。In this embodiment, when the risk loss value of the face classifier is minimized by the gradient backhaul algorithm, it indicates that the face classifier has stabilized, and the parameters of the face classifier have reached the optimal value. Value, the obtained face recognition result is the face recognition result of the face image to be recognized.
关于梯度回传算法为现有技术,本发明在此不再阐述。Regarding the gradient backhaul algorithm as the prior art, the present invention will not elaborate here.
需要说明的是,在识别的过程中,只需要更新人脸脸型分类器中的两层全连接层(FC1层和FC2层)的权重,3D重建参数提取模型为已经训练好的模 型,故3D重建参数提取模型中的权重不做任何更新。It should be noted that during the recognition process, only the weights of the two fully connected layers (FC1 and FC2) in the face classifier need to be updated. The 3D reconstruction parameter extraction model is the trained model, so 3D The weights in the reconstruction parameter extraction model are not updated.
综上,本发明所述的人脸脸型识别装置,采用预先训练好的3D重建参数提取模型提取待识别的人脸脸部图像,得到3D重建参数及图像特征,并基于所述3D重建参数重建出3D人脸后提取所述3D人脸中的轮廓特征,最后基于所述轮廓特征和所述图像特征构建出联合特征,采用预先设置的人脸脸型分类器识别所述联合特征,即可得到人脸脸型识别结果。重建3D人脸时,仅需一张人脸脸部图像,无需多视角下的多张人脸脸部图像,因而,重建3D人脸的过程简单,计算量少,识别人脸脸型的速度更快;同时,将表示人脸几何分布信息的轮廓特征和表示纹理信息的图像特征连接在一起构建出联合特征,信息更为丰富,因而基于联合特征识别出人脸脸型的结果可靠性更高。In summary, the face recognition device of the present invention uses a pre-trained 3D reconstruction parameter extraction model to extract a face image to be recognized, obtains 3D reconstruction parameters and image features, and reconstructs based on the 3D reconstruction parameters After the 3D face is extracted, the contour features in the 3D face are extracted, and finally a joint feature is constructed based on the contour feature and the image feature, and the joint feature is recognized by using a preset face classifier to obtain Face recognition result. When reconstructing a 3D face, only one face image is required, and there is no need for multiple face images under multiple viewing angles. Therefore, the process of reconstructing a 3D face is simple, with less calculation and faster recognition of the face shape. Fast; at the same time, the contour feature representing the geometric distribution information of the face and the image feature representing the texture information are connected together to construct a joint feature. The information is richer, so the result of identifying the face shape based on the joint feature is more reliable.
此外,本发明通过将得到的3D重建参数中人脸重建形变参数设置为0,人脸旋转矩阵R设置为单位矩阵,人脸位移T设置为0,构建出的3D人脸为正面且无表情的人脸,能够进一步提高人脸脸型的识别结果的可靠性。In addition, in the present invention, by setting the face reconstruction deformation parameter in the obtained 3D reconstruction parameters to 0, the face rotation matrix R to the identity matrix, and the face displacement T to 0, the constructed 3D face is frontal and expressionless. The face can further improve the reliability of the recognition result of the face shape.
实施例三Example three
参阅图5所示,在本发明较佳实施例中,所述电子设备5包括存储器51、至少一个处理器52、至少一条通信总线53、显示屏幕54。Referring to FIG. 5, in a preferred embodiment of the present invention, the electronic device 5 includes a memory 51, at least one processor 52, at least one communication bus 53, and a display screen 54.
本领域技术人员应该了解,图5示出的电子设备的结构并不构成本发明实施例的限定,既可以是总线型结构,也可以是星形结构,所述电子设备5还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置。Those skilled in the art should understand that the structure of the electronic device shown in FIG. 5 does not constitute a limitation of the embodiment of the present invention. It may be a bus-type structure or a star structure. The electronic device 5 may also include a graph Show more or less other hardware or software, or different component arrangements.
在一些实施例中,所述电子设备5包括一种能够按照事先设定或存储的指令,自动进行数值计算和/或者信息处理的设备。所述电子设备5的硬件包括但不限于:微处理器、专用(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)及嵌入式设备等。所述电子设备5还可包括用户设备,所述用户设备包括但不限于任何一种可与用户通过键盘、鼠标、遥控器、触摸 板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、数码相机等。In some embodiments, the electronic device 5 includes a device capable of automatically performing numerical calculation and/or information processing according to pre-set or stored instructions. The hardware of the electronic device 5 includes but is not limited to: a microprocessor, a dedicated (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), and a digital processor (Digital Signal Processor, DSP) And embedded devices, etc. The electronic device 5 may also include user equipment. The user equipment includes, but is not limited to, any electronic product that can interact with the user through a keyboard, a mouse, a remote control, a touch panel, or a voice control device, for example, Personal computers, tablet computers, smart phones, digital cameras, etc.
需要说明的是,所述电子设备5仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。It should be noted that the electronic device 5 is only an example. If other existing or future electronic products can be adapted to the present invention, they should also be included in the protection scope of the present invention and included here by reference. .
在一些实施例中,所述存储器51用于存储程序代码和各种数据,例如安装在所述电子设备5中的人脸脸型识别装置40,并在电子设备5的运行过程中实现高速、自动地完成程序或数据的存取。所述存储器51包括只读存储器(Read-Only Memory,ROM)、随机存储器(Random Access Memory,RAM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子擦除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其他介质。In some embodiments, the memory 51 is used to store program codes and various data, such as the face recognition device 40 installed in the electronic device 5, and realizes high-speed and automatic operation during the operation of the electronic device 5. Complete the program or data access. The memory 51 includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), and erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), One-time Programmable Read-Only Memory (OTPROM), Electronically-Erasable Programmable Read-Only Memory, EEPROM ), CD-ROM (Compact Disc Read-Only Memory) or other optical disk storage, magnetic disk storage, tape storage, or any other computer-readable medium that can be used to carry or store data.
在一些实施例中,所述至少一个处理器52可以由组成,例如可以由单个封装的所组成,也可以是由多个相同功能或不同功能封装的所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述至少一个处理器52是所述电子设备5的控制核心(Control Unit),利用各种接口和线路连接整个电子设备5的各个部件,通过运行或执行存储在所述存储器51内的程序或者模块,以及调用存储在所述存储器51内的数据,以执行电子设备5的各种功能和处理数据,例如执行人脸脸型识别的功能。In some embodiments, the at least one processor 52 may be composed, for example, may be composed of a single package, or may be composed of multiple packages with the same function or different functions, including one or more central processors. (Central Processing unit, CPU), a combination of microprocessors, digital processing chips, graphics processors, and various control chips. The at least one processor 52 is the control core (Control Unit) of the electronic device 5, which uses various interfaces and lines to connect the various components of the entire electronic device 5, and runs or executes the program stored in the memory 51 or Modules, and call the data stored in the memory 51 to perform various functions of the electronic device 5 and process data, for example, perform facial recognition functions.
在一些实施例中,所述至少一条通信总线53被设置为实现所述存储器51、所述至少一个处理器52、所述显示屏幕54等之间的连接通信。In some embodiments, the at least one communication bus 53 is configured to implement connection and communication between the memory 51, the at least one processor 52, the display screen 54, and so on.
在一些实施例中,所述显示屏幕54可用于显示由观看者输入的信息或提供给观看者的信息以及电子设备5的各种图形观看者接口,这些图形观看者接口可以由图形、文本、图标、视频和其任意组合来构成。所述显示屏幕54可包括显示面板,可选的,可以采用液晶显示屏幕(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板。In some embodiments, the display screen 54 can be used to display information input by the viewer or information provided to the viewer and various graphical viewer interfaces of the electronic device 5. These graphical viewer interfaces can be composed of graphics, text, Icons, videos, and any combination of them. The display screen 54 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.
所述显示屏幕54还可以包括触摸面板。如果所述显示屏幕54包括触摸面板,所述显示屏幕54可以被实现为触摸屏,以接收来自观看者的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。上述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与上述触摸或滑动操作相关的持续时间和压力。所述显示面板与所述触摸面板可以作为两个独立的部件来实现输入和输入功能,但是在某些实施例中,可以将所述显示面板与所述触摸面板进行集成而实现输入和输出功能。The display screen 54 may also include a touch panel. If the display screen 54 includes a touch panel, the display screen 54 may be implemented as a touch screen to receive input signals from the viewer. The touch panel includes one or more touch sensors to sense touch, sliding, and gestures on the touch panel. The above-mentioned touch sensor may not only sense the boundary of the touch or sliding action, but also detect the duration and pressure related to the above-mentioned touch or sliding operation. The display panel and the touch panel can be used as two independent components to realize input and input functions, but in some embodiments, the display panel and the touch panel can be integrated to realize the input and output functions .
尽管未示出,所述电子设备5还可以包括给各个部件供电的电源(比如电池),优选的,电源可以通过电源管理系统与所述至少一个处理器52逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备5还可以包括多种传感器、蓝牙模块、通讯模块等。本发明在此不再赘述。Although not shown, the electronic device 5 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 52 through a power management system, so as to be implemented through a power management system. Manage functions such as charging, discharging, and power management. The power supply may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power supply status indicators and other arbitrary components. The electronic device 5 may also include various sensors, Bluetooth modules, communication modules, and so on. The present invention will not be repeated here.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the described embodiments are for illustrative purposes only, and are not limited by this structure in the scope of the patent application.
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,客户端,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分。The above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium. The above-mentioned software function module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a client, or a network device, etc.) or a processor to execute the method described in each embodiment of the present invention part.
在进一步的实施例中,结合图1,所述至少一个处理器52可执行所述电子 设备5的操作系统以及安装的各类应用程序(如所述的人脸脸型识别装置50)、程序代码等。In a further embodiment, with reference to FIG. 1, the at least one processor 52 can execute the operating system of the electronic device 5 and various installed applications (such as the face recognition device 50), and program code Wait.
所述存储器51中存储有程序代码,且所述至少一个处理器52可调用所述存储器51中存储的程序代码以执行相关的功能。例如,图5中所述的各个模块是存储在所述存储器51中的程序代码,并由所述至少一个处理器52所执行,从而实现所述各个模块的功能。Program codes are stored in the memory 51, and the at least one processor 52 can call the program codes stored in the memory 51 to perform related functions. For example, the various modules described in FIG. 5 are program codes stored in the memory 51 and executed by the at least one processor 52, so as to realize the functions of the various modules.
在本发明的一个实施例中,所述存储器51存储多个指令,所述多个指令被所述至少一个处理器52所执行以实现随机生成神经网络模型的功能。In an embodiment of the present invention, the memory 51 stores a plurality of instructions, and the plurality of instructions are executed by the at least one processor 52 to realize the function of randomly generating a neural network model.
具体地,所述至少一个处理器52对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the at least one processor 52 on the foregoing instructions, reference may be made to the description of the relevant steps in the embodiment corresponding to FIG.
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed system, device, and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

Claims (10)

  1. 一种人脸脸型识别方法,其特征在于,所述方法包括:A face recognition method, characterized in that the method includes:
    获取待识别的人脸脸部图像;Acquiring a face image of a person to be recognized;
    采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征;Using a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image;
    基于所述3D重建参数重建出3D人脸;Reconstructing a 3D face based on the 3D reconstruction parameters;
    提取所述3D人脸中的轮廓特征;Extracting contour features in the 3D face;
    基于所述轮廓特征和所述图像特征构建出联合特征;Constructing a joint feature based on the contour feature and the image feature;
    采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果。The pre-set face shape classifier is used to recognize the joint feature, and the face shape recognition result is obtained.
  2. 如权利要求1所述的人脸脸型识别方法,其特征在于,所述采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征包括:5. The face recognition method according to claim 1, wherein said extracting 3D reconstruction parameters and image features from said face image using a pre-trained 3D reconstruction parameter extraction model comprises:
    将所述人脸脸部图像输至所述预先训练好的3D重建参数提取模型中;Inputting the human face image to the pre-trained 3D reconstruction parameter extraction model;
    获取所述3D重建参数提取模型的最后一层输出的3D重建参数;Acquiring the 3D reconstruction parameters output by the last layer of the 3D reconstruction parameter extraction model;
    获取所述3D重建参数提取模型的倒数第二层输出的图像特征。Obtain the image features output by the penultimate layer of the 3D reconstruction parameter extraction model.
  3. 如权利要求1所述的人脸脸型识别方法,其特征在于,所述3D重建参数包括:人脸重建形状参数和人脸重建形变参数,所述基于所述3D重建参数重建出3D人脸包括:The face recognition method of claim 1, wherein the 3D reconstruction parameters comprise: face reconstruction shape parameters and face reconstruction deformation parameters, and the reconstruction of the 3D face based on the 3D reconstruction parameters includes :
    获取基准向量和平均脸;Obtain the reference vector and the average face;
    根据所述人脸重建形状参数、所述基准向量和所述平均脸构建正面人脸;Constructing a frontal face according to the face reconstruction shape parameter, the reference vector and the average face;
    根据所述人脸重建形变参数将所述正面人脸调整为无表情的3D人脸。The frontal face is adjusted to an expressionless 3D face according to the face reconstruction deformation parameter.
  4. 如权利要求1所述的人脸脸型识别方法,其特征在于,所述提取所述3D人脸中的轮廓特征包括:The face recognition method of claim 1, wherein said extracting contour features in said 3D face comprises:
    获取所述3D人脸中的几何特征及每个几何特征对应的第一索引;Acquiring geometric features in the 3D face and a first index corresponding to each geometric feature;
    从所述第一索引中筛选出与人脸轮廓相关的多个第二索引;Filtering out a plurality of second indexes related to face contours from the first index;
    提取与所述多个第二索引对应的几何特征作为所述3D人脸的轮廓特征。Extracting geometric features corresponding to the plurality of second indexes as contour features of the 3D face.
  5. 如权利要求4所述的人脸脸型识别方法,其特征在于,所述基于所述轮廓特征和所述图像特征构建出联合特征包括:5. The face recognition method of claim 4, wherein said constructing a joint feature based on said contour feature and said image feature comprises:
    计算所述轮廓特征对应的坐标值与鼻尖特征对应的坐标值之间的差值;Calculating the difference between the coordinate value corresponding to the contour feature and the coordinate value corresponding to the nose tip feature;
    对经过差值计算之后的轮廓特征与所述图像特征进行连接,形成一维向量;Connecting the contour feature after the difference calculation and the image feature to form a one-dimensional vector;
    将所述一维向量作为所述联合特征。Use the one-dimensional vector as the joint feature.
  6. 如权利要求1至5中任意一项所述的人脸脸型识别方法,其特征在于,在获取待识别的人脸脸部图像之前,所述方法还包括:The face recognition method according to any one of claims 1 to 5, wherein before acquiring the face image to be recognized, the method further comprises:
    采集用户图像;Collect user images;
    检测所述用户图像中的人脸脸部区域;Detecting the face area in the user image;
    裁剪出所述人脸脸部区域得到人脸脸部图像。Cut out the facial area of the human face to obtain a facial image of the human face.
  7. 如权利要求1至5中任意一项所述的人脸脸型识别方法,其特征在于,所述采用预先设置的人脸脸型分类器识别所述联合特征,得到人脸脸型识别结果包括:5. The face recognition method according to any one of claims 1 to 5, wherein said adopting a preset face and face classifier to recognize said joint feature to obtain a face recognition result comprises:
    采用所述预先设置的人脸脸型分类器识别所述联合特征;Using the preset face classifier to recognize the joint feature;
    通过梯度回传算法计算风险损失值;Calculate the risk loss value through the gradient backhaul algorithm;
    当所述风险损失值达到最小时,输出人脸脸型识别结果作为所述待识别的人脸脸部图像的人脸脸型识别结果。When the risk loss value reaches the minimum, the face recognition result is output as the face recognition result of the face image to be recognized.
  8. 一种人脸脸型识别装置,其特征在于,所述装置包括:A face recognition device, characterized in that the device comprises:
    获取模块,用于获取待识别的人脸脸部图像;The acquisition module is used to acquire the face image to be recognized;
    检测模块,用于采用预先训练好的3D重建参数提取模型提取所述人脸脸部图像中的3D重建参数及图像特征;The detection module is configured to use a pre-trained 3D reconstruction parameter extraction model to extract the 3D reconstruction parameters and image features in the face image;
    重建模块,用于基于所述3D重建参数重建出3D人脸;A reconstruction module for reconstructing a 3D face based on the 3D reconstruction parameters;
    提取模块,用于提取所述3D人脸中的轮廓特征;An extraction module for extracting contour features in the 3D face;
    构建模块,用于基于所述轮廓特征和所述图像特征构建出联合特征;A construction module for constructing a joint feature based on the contour feature and the image feature;
    识别模块,用于采用预先设置的人脸脸型分类器识别所述联合特征,得到 人脸脸型识别结果。The recognition module is used to recognize the joint feature by using a preset face classifier to obtain a face recognition result.
  9. 一种电子设备,其特征在于,所述电子设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如权利要求1至7中任意一项所述人脸脸型识别方法。An electronic device, wherein the electronic device comprises a processor, and the processor is configured to implement the face recognition method according to any one of claims 1 to 7 when executing a computer program stored in a memory.
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任意一项所述人脸脸型识别方法。A computer-readable storage medium having a computer program stored on the computer-readable storage medium, wherein when the computer program is executed by a processor, the face shape according to any one of claims 1 to 7 is realized recognition methods.
PCT/CN2019/121344 2019-07-05 2019-11-27 Method and apparatus for face shape recognition, electronic device and storage medium WO2021003964A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910606389.7A CN110414370B (en) 2019-07-05 2019-07-05 Face shape recognition method and device, electronic equipment and storage medium
CN201910606389.7 2019-07-05

Publications (1)

Publication Number Publication Date
WO2021003964A1 true WO2021003964A1 (en) 2021-01-14

Family

ID=68360639

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/121344 WO2021003964A1 (en) 2019-07-05 2019-11-27 Method and apparatus for face shape recognition, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN110414370B (en)
WO (1) WO2021003964A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818772A (en) * 2021-01-19 2021-05-18 网易(杭州)网络有限公司 Facial parameter identification method and device, electronic equipment and storage medium
CN113343927A (en) * 2021-07-03 2021-09-03 郑州铁路职业技术学院 Intelligent face recognition method and system suitable for facial paralysis patient

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110414370B (en) * 2019-07-05 2021-09-14 深圳云天励飞技术有限公司 Face shape recognition method and device, electronic equipment and storage medium
CN110956691B (en) * 2019-11-21 2023-06-06 Oppo广东移动通信有限公司 Three-dimensional face reconstruction method, device, equipment and storage medium
CN112016480A (en) * 2020-08-31 2020-12-01 中移(杭州)信息技术有限公司 Face feature representation method, system, electronic device and storage medium
CN112348945B (en) * 2020-11-02 2024-01-02 上海联影医疗科技股份有限公司 Positioning image generation method, device, equipment and medium
CN112529999A (en) * 2020-11-03 2021-03-19 百果园技术(新加坡)有限公司 Parameter estimation model training method, device, equipment and storage medium
CN113469091B (en) * 2021-07-09 2022-03-25 北京的卢深视科技有限公司 Face recognition method, training method, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295496A (en) * 2015-06-24 2017-01-04 三星电子株式会社 Recognition algorithms and equipment
CN106652025A (en) * 2016-12-20 2017-05-10 五邑大学 Three-dimensional face modeling method and three-dimensional face modeling printing device based on video streaming and face multi-attribute matching
CN107680158A (en) * 2017-11-01 2018-02-09 长沙学院 A kind of three-dimensional facial reconstruction method based on convolutional neural networks model
CN107832751A (en) * 2017-12-15 2018-03-23 北京奇虎科技有限公司 Mask method, device and the computing device of human face characteristic point
CN110414370A (en) * 2019-07-05 2019-11-05 深圳云天励飞技术有限公司 The recognition methods of face shape of face, device, electronic equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8861800B2 (en) * 2010-07-19 2014-10-14 Carnegie Mellon University Rapid 3D face reconstruction from a 2D image and methods using such rapid 3D face reconstruction
CN104268932A (en) * 2014-09-12 2015-01-07 上海明穆电子科技有限公司 3D facial form automatic changing method and system
CN106203263A (en) * 2016-06-27 2016-12-07 辽宁工程技术大学 A kind of shape of face sorting technique based on local feature
CN106909875B (en) * 2016-09-12 2020-04-10 湖南拓视觉信息技术有限公司 Face type classification method and system
CN107705248A (en) * 2017-10-31 2018-02-16 广东欧珀移动通信有限公司 Image processing method, device, electronic equipment and computer-readable recording medium
CN109948400A (en) * 2017-12-20 2019-06-28 宁波盈芯信息科技有限公司 It is a kind of to be able to carry out the smart phone and its recognition methods that face characteristic 3D is identified
CN109145865A (en) * 2018-09-07 2019-01-04 北京相貌空间科技有限公司 Face standard level calculating method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295496A (en) * 2015-06-24 2017-01-04 三星电子株式会社 Recognition algorithms and equipment
CN106652025A (en) * 2016-12-20 2017-05-10 五邑大学 Three-dimensional face modeling method and three-dimensional face modeling printing device based on video streaming and face multi-attribute matching
CN107680158A (en) * 2017-11-01 2018-02-09 长沙学院 A kind of three-dimensional facial reconstruction method based on convolutional neural networks model
CN107832751A (en) * 2017-12-15 2018-03-23 北京奇虎科技有限公司 Mask method, device and the computing device of human face characteristic point
CN110414370A (en) * 2019-07-05 2019-11-05 深圳云天励飞技术有限公司 The recognition methods of face shape of face, device, electronic equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112818772A (en) * 2021-01-19 2021-05-18 网易(杭州)网络有限公司 Facial parameter identification method and device, electronic equipment and storage medium
CN113343927A (en) * 2021-07-03 2021-09-03 郑州铁路职业技术学院 Intelligent face recognition method and system suitable for facial paralysis patient
CN113343927B (en) * 2021-07-03 2023-06-23 郑州铁路职业技术学院 Intelligent face recognition method and system suitable for facial paralysis patient

Also Published As

Publication number Publication date
CN110414370A (en) 2019-11-05
CN110414370B (en) 2021-09-14

Similar Documents

Publication Publication Date Title
WO2021003964A1 (en) Method and apparatus for face shape recognition, electronic device and storage medium
JP7075085B2 (en) Systems and methods for whole body measurement extraction
US10832039B2 (en) Facial expression detection method, device and system, facial expression driving method, device and system, and storage medium
WO2019128508A1 (en) Method and apparatus for processing image, storage medium, and electronic device
CN109829448B (en) Face recognition method, face recognition device and storage medium
CN111327828B (en) Photographing method and device, electronic equipment and storage medium
KR101612605B1 (en) Method for extracting face feature and apparatus for perforimg the method
US20110153341A1 (en) Methods and systems for use of augmented reality to improve patient registration in medical practices
US9965494B2 (en) Sharing photos
US20210319585A1 (en) Method and system for gaze estimation
SE528068C2 (en) Three dimensional object recognizing method for e.g. aircraft, involves detecting image features in obtained two dimensional representation, and comparing recovered three dimensional shape with reference representation of object
Vretos et al. 3D facial expression recognition using Zernike moments on depth images
US9122912B1 (en) Sharing photos in a social network system
CN110472582B (en) 3D face recognition method and device based on eye recognition and terminal
CN102713975B (en) Image clearing system, image method for sorting and computer program
CN112364827A (en) Face recognition method and device, computer equipment and storage medium
KR102172192B1 (en) Facial Wrinkle Recognition Method, System, and Stroke Detection Method through Facial Wrinkle Recognition
EP4044907A1 (en) Automatic pressure ulcer measurement
US9621505B1 (en) Providing images with notifications
US20140111431A1 (en) Optimizing photos
CN112183155B (en) Method and device for establishing action posture library, generating action posture and identifying action posture
CN114255494A (en) Image processing method, device, equipment and storage medium
CN111797656A (en) Face key point detection method and device, storage medium and electronic equipment
CN113537993B (en) Data detection method and device based on face payment
Hussain et al. Face-to-camera distance estimation using machine learning

Legal Events

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

Ref document number: 19936718

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19936718

Country of ref document: EP

Kind code of ref document: A1