WO2020037680A1 - Light-based three-dimensional face optimization method and apparatus, and electronic device - Google Patents

Light-based three-dimensional face optimization method and apparatus, and electronic device Download PDF

Info

Publication number
WO2020037680A1
WO2020037680A1 PCT/CN2018/102333 CN2018102333W WO2020037680A1 WO 2020037680 A1 WO2020037680 A1 WO 2020037680A1 CN 2018102333 W CN2018102333 W CN 2018102333W WO 2020037680 A1 WO2020037680 A1 WO 2020037680A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
face
training
dimensional
model
Prior art date
Application number
PCT/CN2018/102333
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 太平洋未来科技(深圳)有限公司
Priority to PCT/CN2018/102333 priority Critical patent/WO2020037680A1/en
Priority to CN201811031365.5A priority patent/CN109271911B/en
Publication of WO2020037680A1 publication Critical patent/WO2020037680A1/en

Links

Images

Classifications

    • 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/161Detection; Localisation; Normalisation
    • G06V40/166Detection; Localisation; Normalisation using acquisition arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/90Dynamic range modification of images or parts thereof
    • 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
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30196Human being; Person
    • G06T2207/30201Face

Definitions

  • the invention relates to the technical field of image processing, and in particular, to a method, a device, and an electronic device for optimizing a three-dimensional human face based on light.
  • Three-dimensional face reconstruction has been widely used in medical, education, and entertainment fields.
  • the inventor found that in the process of 3D face reconstruction, multiple pictures and multiple angles are used to form a 3D model.
  • the reconstruction process is cumbersome and complicated, and it takes a long time.
  • the key points of the face in the face image need to be located to generate the position information of the key points of the face, and in the case of poor lighting conditions (such as backlighting, sidelighting, etc.) , The image information of the face is not clear, resulting in a large error in the finally generated 3D face.
  • mobile devices such as mobile phones are increasingly using 3D face reconstruction technology, and a large number of two-bit pictures required for 3D face reconstruction are often obtained through mobile phone cameras.
  • Mobile phones are prone to shake during shooting, which will affect the image The acquisition quality indirectly affects the subsequent 3D face reconstruction effect.
  • the ray-based three-dimensional human face optimization method, device, and electronic device provided by the embodiments of the present invention are used to solve at least the foregoing problems in related technologies.
  • One aspect of the embodiments of the present invention provides a light-based three-dimensional face optimization method, including:
  • the three-dimensional average face model is processed according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
  • the step of determining whether the face image in the obtained target picture is unevenly illuminated includes:
  • the step of performing light adjustment on the face image to obtain an optimized face image includes:
  • the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
  • Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
  • using the machine learning method to train the initial image generation model based on the training samples to obtain the image generation model includes:
  • the initial image generation model is determined as the image generation model.
  • the convolutional neural network model is trained by the following steps:
  • the cross-entropy loss function is used to optimize the parameters of the convolutional neural network until the second 3D face model parameter information and the loss function of the 3D portrait scan data converge to a preset threshold.
  • the target picture is obtained through an image acquisition device, which includes a lens, an autofocus voice coil motor, a mechanical image stabilizer, and an image sensor, and the lens is fixed on the autofocus voice coil motor,
  • the lens is used to acquire an image (picture)
  • the image sensor transmits the image acquired by the lens to the recognition module
  • the autofocus voice coil motor is mounted on the mechanical image stabilizer
  • the processing module According to the feedback of the lens shake detected by the gyroscope in the lens, the action of the mechanical image stabilizer is driven to realize the lens shake compensation.
  • the mechanical image stabilizer includes a movable plate, a base plate, and a compensation mechanism.
  • Each of the movable plate and the base plate is provided with a through hole through which the lens passes, and the auto-focusing voice coil motor is installed at
  • the movable plate is mounted on the substrate, and the size of the substrate is larger than the movable plate.
  • the compensation mechanism drives the movable plate and the movable plate under the driving of the processing module.
  • the lens moves to achieve lens shake compensation;
  • the compensation mechanism includes a first compensation component, a second compensation component, a third compensation component, and a fourth compensation component installed around the substrate, wherein the first compensation component and The third compensation component is disposed opposite to each other, the second compensation component is disposed opposite to the fourth compensation component, and a line between the first compensation component and the third compensation component is connected to the first compensation component and the first compensation component.
  • the lines between the three compensation components are perpendicular to each other; the first compensation component, the second compensation component, the third compensation component, and the fourth compensation component all include a driving member, a rotating shaft, and a one-way bearing.
  • the driving member is controlled by the processing module, and the driving member is drivingly connected to the rotating shaft to drive the rotating shaft to rotate;
  • the rotating shaft is connected to the inner ring of the one-way bearing to Driving the inner ring of the one-way bearing to rotate;
  • the rotating ring gear is sleeved on the one-way bearing and connected to the outer ring of the one-way bearing, and an outer surface of the rotating ring gear is provided with a ring in its circumferential direction External teeth
  • the bottom surface of the movable plate is provided with a plurality of rows of strip grooves arranged at even intervals, the strip grooves are engaged with the external teeth, and the external teeth can slide along the length direction of the strip grooves ;
  • the rotatable direction of the one-way bearing of the first compensation component is opposite to the rotatable direction of the one-way bearing of the third compensation component, and the rotatable direction of the one-way bearing of the second compensation component is different from that The rotatable direction of the one-way
  • the driving member is a micro motor, the micro motor is electrically connected to the processing module, and a rotary output end of the micro motor is connected to the rotating shaft; or the driving member includes a memory alloy wire and a crank A connecting rod, one end of the memory alloy wire is fixed on the fixing plate and connected with the processing module through a circuit, and the other end of the memory alloy wire is connected with the rotating shaft through the crank connecting rod to drive The rotation shaft rotates.
  • the image acquisition device is disposed on a mobile phone, and the mobile phone includes a stand.
  • the bracket includes a mobile phone mount and a retractable support rod;
  • the mobile phone mount includes a retractable connection plate and a folding plate group installed at opposite ends of the connection plate, and one end of the support rod passes through the middle of the connection plate
  • the damping hinge is connected;
  • the folding plate group includes a first plate body, a second plate body, and a third plate body, wherein one of two opposite ends of the first plate body is hinged with the connecting plate, so The other end of the two opposite ends of the first plate is hinged to one of the two opposite ends of the second plate; the other end of the opposite ends of the second plate is two opposite to the third plate.
  • One end of the ends is hinged; the second plate body is provided with an opening for inserting a corner of the mobile phone; when the mobile phone mounting seat is used to install the mobile phone, the first plate body, the second plate body, and the third plate body
  • the folded state is a right triangle
  • the second plate is a hypotenuse of a right triangle
  • the first plate and the third plate are right angles of a right triangle
  • one side of the third plate is Affixed side by side with one side of the connecting plate, the first The other end of the plate opposite ends with one end of opposite ends of said first plate offset.
  • one side of the third plate body is provided with a first connection portion, and a side surface of the connection plate that is in contact with the third plate body is provided with a first fit that is matched with the first connection portion.
  • a second connection portion is provided on one end of the opposite ends of the first plate body, and a second connection is provided on the other end of the opposite ends of the third plate body to cooperate with the second connection portion.
  • the other end of the support rod is detachably connected with a base.
  • Another aspect of the embodiments of the present invention provides a light-based three-dimensional face optimization device, including:
  • a judging module configured to judge whether the face image in the obtained target picture has uneven illumination
  • An optimization module if the face image has uneven illumination, performing light adjustment on the face image to obtain an optimized face image
  • An acquisition module configured to process the optimized face image based on a pre-trained convolutional neural network model to obtain first first three-dimensional face model parameter information
  • a processing module is configured to process a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
  • judgment module is specifically configured to:
  • the optimization module further includes a first training module, the first training module is configured to:
  • the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
  • Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
  • first training module is further configured to:
  • the initial image generation model is determined as the image generation model.
  • the device further includes a second training module, the second training module is configured to build a convolutional neural network model composed of two layers of hourglass-type convolutional neural networks; and acquire and use to train the convolutional neural network A data set of the model, where the data set includes several two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures; pre-processing the two-dimensional face pictures to obtain facial feature point information; and The facial feature point information is input to the convolutional neural network model to obtain the second three-dimensional face model parameter information; the cross-entropy loss function is used to optimize the parameters of the convolutional neural network until the second three-dimensional human.
  • the face model parameter information and the loss function of the three-dimensional portrait scan data converge to a preset threshold.
  • Another aspect of the embodiments of the present invention provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein,
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute any one of the foregoing light-based Three-dimensional face optimization method.
  • the light-based three-dimensional face optimization method, device, and electronic device provided by the embodiments of the present invention are applicable to face images taken in situations where the lighting environment is poor (such as backlighting, sidelighting, etc.) Optimize to get a clear face; at the same time, only a single picture can be used to generate a three-dimensional face image.
  • a convolutional neural network model can automatically generate more accurate and realistic face expressions and poses without the need for hardware support Reduce costs in many ways.
  • FIG. 1 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention.
  • FIG. 4 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention.
  • FIG. 5 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a hardware structure of an electronic device that executes a method for optimizing a three-dimensional human face according to a method embodiment of the present invention
  • FIG. 7 is a structural diagram of an image acquisition device according to an embodiment of the present invention.
  • FIG. 8 is a structural diagram of an optical image stabilizer provided by an embodiment of the present invention.
  • FIG. 9 is an enlarged view of part A of FIG. 8; FIG.
  • FIG. 10 is a schematic bottom view of a movable plate of a micro memory alloy optical image stabilizer provided by an embodiment of the present invention.
  • FIG. 11 is a structural diagram of a stent provided by an embodiment of the present invention.
  • FIG. 12 is a schematic state diagram of a stent according to an embodiment of the present invention.
  • FIG. 13 is a schematic view of another state of a stent according to an embodiment of the present invention.
  • FIG. 14 is a structural state diagram when the mounting base and the mobile phone are connected according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention.
  • a light-based three-dimensional face optimization method provided by an embodiment of the present invention includes:
  • S101 Obtain a target picture, and determine whether a face image in the target picture is in a non-uniform light condition.
  • the target picture may be a picture taken in real time, or an image stored in a local picture of the terminal.
  • the target picture is taken in backlight or side light conditions, the face in the target picture is in non-uniform light lines, which makes the facial features of the portrait unclear, resulting in errors in the generated three-dimensional face image. Therefore, in this step, after obtaining the target picture, it is first necessary to determine whether the face image in the target picture is in a non-uniform light condition.
  • the grayscale histogram of the picture can clearly represent the light and dark distribution of the image, and its distribution has nothing to do with the content of the image.
  • the distribution of grayscale histograms of backlit or sidelight scenes and non-backlit or sidelight scenes is completely different.
  • the grayscale histogram distribution of backlight or sidelight scenes is high in pixel distribution on extremely bright and dark grayscale levels, while pixels in non-backlight or sidelight scenes are mainly concentrated in the middle grayscale level. Therefore, the gray level histogram of backlight or side light has a large variance in gray level distribution, while the gray level histogram of non-backlit or side light scene has a small gray level distribution variance.
  • the critical variance of the gray level distribution can be obtained from multiple pictures (including backlight, sidelight, non-backlight, non-sidelight). If the critical variance is greater than this, it is determined as the backlight or sidelight picture, that is, the target picture It is in non-uniform light conditions; if it is less than the critical variance, it is determined as a non-backlit and side-light picture, that is, the target picture is in uniform light conditions.
  • step S102 is performed.
  • the optimized face image may be a face image presented under a uniform light source condition, and clear facial features can be obtained under this condition.
  • the image generation model can be used to perform light adjustment on a face image captured under a non-positive uniform light source condition to generate a face image under a front uniform light source condition.
  • the image generation model may be a model obtained by using a machine learning method in advance to train a model (for example, an existing convolutional neural network model, etc.) for image processing based on training samples.
  • the above convolutional neural network may include a convolutional layer, a pooling layer, a depooling layer, and a deconvolution layer.
  • the last deconvolution layer of the convolutional neural network may output an optimized face image, and the output optimized face image It can be expressed by a matrix of RGB three channels, and the size of the output optimized face image can be the same as the face image in the target picture.
  • the image generation model can be trained by the following steps:
  • S1021 Obtain training samples and an initial image generation model (the prior art, which is not described herein), the training samples include multiple first images generated under a non-positive uniform light source condition, and generated under a front uniform light source condition. A second image corresponding to the first image.
  • an initial image generation model and initial parameters in the model may be determined, and an output of the initial image generation model may be evaluated and corrected by setting a discriminant network.
  • the first image in the training sample is input into the initial image generation model to obtain an optimized first image output by the initial image generation model; second, the optimized first image and the corresponding first optimized image are The second image is used as the input of the discriminative network.
  • the discriminative network is trained, the parameters of the discriminated network after training are determined and fixed, and the subsequent output results will be evaluated and corrected by using this parameter. Again, the first image will be used as the initial image.
  • the initial image generation model is determined as the image generation model.
  • the value of the loss function may be used to characterize the degree of difference between the optimized first image and the second image output by the image generation model.
  • the aforementioned loss function may use an Euclidean distance function, a hinge function, or the like.
  • S103 Process the optimized face image based on a pre-trained convolutional neural network model to obtain first first three-dimensional face model parameter information.
  • the first three-dimensional face parameter information includes face shape information and facial expression information.
  • the face image obtained in step S102 is input to a pre-trained convolutional neural network model, and the first three-dimensional face model parameter is output. information.
  • training the convolutional neural network model can include the following steps:
  • S1032 Obtain a data set for training the convolutional neural network model, where the data set includes a plurality of two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures.
  • the data set can be acquired first, and then the convolutional neural network model can be constructed.
  • the volume and neural network model can also be constructed first. There are no restrictions here.
  • the method for obtaining the input sample data set in this step includes downloading pictures directly from the Internet as the input sample data set, and artificially taking pictures as the input sample data set.
  • the artificially taken pictures may include pictures of people of different races. , Pictures of people with different light and shadow effects.
  • the 3D portrait scan data mainly includes the pose information of the face (such as the tilt angle, deflection angle, and rotation angle of the face, the shape parameters of the face feature points, and the expression parameters of the face feature points.
  • S1033 Preprocess the two-dimensional face picture to obtain face feature point information.
  • the facial feature point information includes, but is not limited to, coordinate parameter values of the facial feature points in the picture and texture parameters (that is, texture parameters of the RGB features).
  • texture parameters that is, texture parameters of the RGB features.
  • the related art includes many recognition methods for recognizing a face image. For example, the range of a face image can be recognized according to the edge information and / or color information of the image. In this embodiment, a pre-defined key point is identified based on detection. The key points obtained determine facial feature point information. For example, the eyebrows, eyes, nose, face, and mouth in the face image are each composed of several key points, that is, the eyebrows, eyes, and nose in the face image can be determined by the coordinate positions of the key points. , Face and mouth position and texture.
  • a facial feature point recognition algorithm may be used to obtain facial feature point information.
  • the training of the facial feature point recognition algorithm may include the following steps: first, a certain number of training sets are obtained, and the training set is a picture carrying human facial feature point information; second, the training set is used to form an initial regression function r0 and an initial Training set; again, using the initial training set and initial regression function r0 to iterate to form the next training set and regression function rn; each iteration of the regression function uses a gradient boosting algorithm to learn, so that when the nth training set and the training set are When the facial feature point information meets the convergence conditions, the corresponding regression function rn is the facial feature point recognition algorithm after training.
  • an algorithm is used to perform face detection on the picture to obtain the position of the face in the picture, and a range rectangle is used to identify the range of the face, for example (left, top, right, bottom).
  • the first preset number of feature points and the coordinates (x i , y i ) of each face feature point are obtained through the regression function in the trained feature point recognition algorithm for the input portrait photo recognition, where i represents the first
  • the first preset number of i feature points may be 68, including key points of eyebrows, eyes, nose, mouth, and face.
  • a texture parameter (R i , G i , B i ) representing a second preset number of pixels around the feature point is formed according to its coordinates (x i , y i ) and a Gaussian algorithm.
  • the second preset number may be 6, 8 or the like, which is not limited in the present invention.
  • S1034 Enter the feature point information of the face into the convolutional neural network model to obtain the second three-dimensional face model parameter information.
  • the algorithm of the convolutional nerve inputs face feature point information each time.
  • the face feature point information can reflect the current face shape information.
  • the output of the algorithm is the second three-dimensional face model parameter p.
  • the algorithm uses a convolutional neural network to fit the mapping function from input to output.
  • the network structure includes 4 convolutional layers, 3 pooling layers, and 2 fully connected layers. By concatenating multiple convolutional neural networks until convergence on the training set, it is updated according to the currently predicted face shape and used as the input of the next level of convolutional neural network.
  • the first two convolutional layers of the network extract facial features through weight-sharing methods, and the last two convolutional layers extract facial features through local perception, further returning a feature vector in a 256-dimensional space and outputting a feature in a 234-dimensional space.
  • Vector the second three-dimensional face model parameter p.
  • face pose parameters [f, pitch, yaw, roll, t 2dx , t 2dy ], shape parameters ⁇ id , and expression parameters ⁇ exp .
  • f is a scale factor
  • pitch is a tilt angle
  • yaw is a deflection angle
  • roll is a rotation angle
  • t 2dx and t 2dy are offset terms.
  • S1035 Optimize parameters of the convolutional neural network by using a cross-entropy loss function until the second three-dimensional face model parameter information and the loss function of the three-dimensional portrait scan data converge to a preset threshold.
  • the loss function is a reflection of the degree of fit of the model data. When the result of the fit is worse, the value of the loss function will be larger.
  • the parameter p k will be obtained after an initial parameter change, and a neural network Net K is trained according to the above three-dimensional portrait scan data.
  • the prediction parameter p is continuously updated p k .
  • the network is expressed mathematically as follows:
  • S104 Process the three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
  • Faces have many similarities. Normal faces have one nose, two eyes, one mouth, and two ears. The order from top to bottom and left to right is unchanged, so you can first build a three-dimensional average face model. Because the similarity of faces is large, it is always possible to change from one normal face to another normal face, and the average face model can be changed by calculating the amount of change, so this is also the basis of 3D face reconstruction.
  • the three-dimensional average face model is processed according to the face shape information and the facial expression information to obtain an initial three-dimensional face model.
  • S is the initial three-dimensional face model
  • S 0 is the average face model
  • a id is the base vector of the shape
  • ⁇ id is the shape parameter
  • a exp is the base vector of the expression
  • ⁇ exp is the expression parameter.
  • a exp and A exp are obtained in advance using existing algorithms respectively.
  • the initial three-dimensional face image is adjusted according to the face posture information to obtain a three-dimensional face image corresponding to the face.
  • the initial three-dimensional face model projects the face model onto the image plane through a weak perspective projection to obtain a three-dimensional face image corresponding to the face, and the formula is expressed as follows:
  • V (p) F * Pr * R (S 0 + A id ⁇ id + A exp ⁇ exp ) + t 2d
  • V (p) is the reconstructed three-dimensional face image corresponding to the face
  • f is a scale factor
  • Pr is a right-angle projection matrix
  • R is a rotation matrix.
  • the tilt angle (pitch), deflection angle (yaw), The rotation angle (roll) is obtained based on the pose information of the human face in the two-dimensional image identified by the feature points.
  • the light-based three-dimensional face optimization method provided by the embodiment of the present invention optimizes a face image taken in a poor lighting environment (such as backlighting, sidelighting, etc.) to obtain a clear human face; Only a single picture can be used to generate a three-dimensional face image.
  • Convolutional neural network models can automatically generate more accurate and realistic face expressions and poses, without the support of hardware, and reduce costs in many ways.
  • FIG. 4 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention. As shown in FIG. 4, the device specifically includes a judgment module 100, an optimization module 200, an acquisition module 300, and a processing module 400. among them,
  • a judging module 100 is configured to obtain a target picture and determine whether a face image in the target picture is in a non-uniform light condition; an optimization module 200 is configured to, if the face image is in a non-uniform light condition, convert the human face The image is input to a pre-trained image generation model to obtain an optimized face image after light adjustment of the face image; an acquisition module 300 is configured to perform the optimized face image based on a pre-trained convolutional neural network model Processing to obtain first three-dimensional face model parameter information; a processing module 400 for processing a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image .
  • the light-based three-dimensional face optimization device provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1, and its implementation principles, methods, and functional uses are similar to the embodiment shown in FIG. 1, and here No longer.
  • FIG. 5 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention. As shown in FIG. 5, the device specifically includes: a first training module 500, a second training module 600, a determination module 100, an optimization module 200, an acquisition module 300, and a processing module 400. among them,
  • a judging module 100 is configured to obtain a target picture and determine whether a face image in the target picture is in a non-uniform light condition; an optimization module 200 is configured to, if the face image is in a non-uniform light condition, convert the human face The image is input to a pre-trained image generation model to obtain an optimized face image after light adjustment of the face image; an acquisition module 300 is configured to perform the optimized face image based on a pre-trained convolutional neural network model Processing to obtain first three-dimensional face model parameter information; a processing module 400 for processing a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image .
  • the first training module 500 is configured to obtain a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and the first image generated under the front uniform light source condition and the first image generation model. A second image corresponding to one image; using a machine learning method, training the initial image generation model based on the training samples to obtain the image generation model.
  • the second training module 600 is configured to build a convolutional neural network model composed of a two-layer hourglass-type convolutional neural network; and acquire a data set for training the convolutional neural network model, where the data set includes a plurality of two-dimensional people 3D portrait scan data corresponding to the face picture and the 2D face picture; pre-processing the 2D face picture to obtain face feature point information; and inputting the face feature point information to the convolutional nerve
  • the network model obtains the second three-dimensional face model parameter information; using the cross-entropy loss function to optimize the parameters of the convolutional neural network until the second three-dimensional face model parameter information and the loss function of the three-dimensional portrait scan data Converge to a preset threshold.
  • the judgment module 100 is configured to process the target picture to obtain a grayscale histogram of the target picture; calculate a grayscale distribution variance of the target picture according to the grayscale histogram; The gray level distribution variance is compared with the gray level distribution critical variance. When the gray level distribution variance is greater than or equal to the gray level distribution critical variance, it is determined that the face image in the target picture is non-uniform. Lighting conditions.
  • the first training module 500 is further configured to input the first image into the initial image generation model to obtain an output optimized first image; and to input the optimized first image and the second image As the input of the discrimination network, train the discrimination network to determine the parameters of the discrimination network after training; use the first image as an input to the initial image generation model, and train the initial image generation model ; Inputting the optimized first image and the second image output by the initial image generation model after training to the discrimination network after training, and determining a loss function value of the discrimination network after training; When the value of the loss function converges, the initial image generation model is determined as the image generation model.
  • the light-based three-dimensional face optimization device provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 to FIG. 3, and its implementation principles, methods, and functional uses are as shown in FIG. 1-3. The examples are similar and will not be repeated here.
  • the above-mentioned light-based three-dimensional face optimization device may be used as one of the software or hardware functional units, independently set in the above-mentioned electronic device, or may be implemented as one of the functional modules integrated in the processor to execute the present invention.
  • a method for optimizing a three-dimensional human face based on light according to an embodiment.
  • FIG. 6 is a schematic diagram of a hardware structure of an electronic device that performs a light-based three-dimensional face optimization method according to an embodiment of the method of the present invention.
  • the electronic device includes:
  • One or more processors 610 and a memory 620 are taken as an example in FIG. 6.
  • the device for performing the light-based three-dimensional face optimization method may further include: an input device 630 and an output device 630.
  • the processor 610, the memory 620, the input device 630, and the output device 640 may be connected through a bus or other methods. In FIG. 6, the connection through the bus is taken as an example.
  • the memory 620 is a non-volatile computer-readable storage medium, and can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the light-based three-dimensional person in the embodiment of the present invention.
  • the processor 610 executes various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 620, that is, implementing the light-based three-dimensional face optimization method.
  • the memory 620 may include a storage program area and a storage data area, where the storage program area may store an operating system and an application program required for at least one function; the storage data area may store a light-based three-dimensional face optimization provided according to an embodiment of the present invention Data created using the device, etc.
  • the memory 620 may include a high-speed random access memory 620, and may further include a non-volatile memory 620, such as at least one magnetic disk memory 620, a flash memory device, or other non-volatile solid-state memory 620.
  • the memory 620 may optionally include a memory 620 remotely disposed with respect to the processor 66, and these remote memories 620 may be connected to the light-based three-dimensional face optimization device through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
  • the input device 630 may receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of a light-based three-dimensional face optimization device.
  • the input device 630 may include a device such as a pressing module.
  • the one or more modules are stored in the memory 620, and when executed by the one or more processors 610, execute the light-based three-dimensional face optimization method.
  • the electronic devices in the embodiments of the present invention exist in various forms, including but not limited to:
  • Mobile communication equipment This type of equipment is characterized by mobile communication functions, and its main goal is to provide voice and data communication.
  • Such terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.
  • Ultra-mobile personal computer equipment This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access.
  • Such terminals include: PDA, MID and UMPC devices, such as iPad.
  • Portable entertainment equipment This type of equipment can display and play multimedia content.
  • Such devices include: audio and video players (such as iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
  • an image acquisition device for acquiring an image is provided on the electronic device, and a software or hardware image stabilizer is often provided on the image acquisition device to ensure the quality of the acquired image.
  • Most of the existing image stabilizers are powered by coils that generate Loren magnetic force in the magnetic field to drive the lens.
  • the lens needs to be driven in at least two directions, which means that multiple coils need to be arranged, which will give the whole.
  • the miniaturization of the structure brings certain challenges, and it is easy to be affected by external magnetic fields, which will affect the anti-shake effect. Therefore, the Chinese patent published as CN106131435A provides a miniature optical anti-shake camera module, which realizes memory alloy wires through temperature changes.
  • the control chip of the micro memory alloy optical anti-shake actuator can control the change of the driving signal to change the temperature of the memory alloy wire. Control the elongation and shortening of the memory alloy wire, and calculate the position and moving distance of the actuator based on the resistance of the memory alloy wire. When the micro memory alloy optical image stabilization actuator moves to the specified position, the resistance of the memory alloy wire at this time is fed back. By comparing the deviation of this resistance value and the target value, the movement on the micro memory alloy optical image stabilization actuator can be corrected. deviation.
  • the above technical solution can compensate the lens for the shake in the first direction, but when the subsequent shake in the second direction occurs, it is too late due to the memory alloy wire. Deformation in an instant, so it is easy to cause untimely compensation, and it is impossible to accurately realize lens shake compensation for multiple shakes and continuous shakes in different directions. Therefore, it is necessary to improve its structure in order to obtain better image quality and facilitate subsequent 3D Image generation.
  • this embodiment improves the anti-shake device and designs it as a mechanical anti-shake device 3000.
  • the specific structure is as follows:
  • the mechanical image stabilizer 3000 of this embodiment includes a movable plate 3100, a base plate 3200, and a compensation mechanism 3300.
  • Each of the movable plate 3100 and the base plate 3200 is provided with a through hole through which the lens 1000 passes.
  • An autofocus voice coil motor 2000 is mounted on the movable plate 3100, and the movable plate 3100 is mounted on the base plate 3200.
  • the size of the base plate 3200 is larger than the movable plate 3100, and the movable plate 3100 passes above it.
  • the auto-focusing voice coil motor limits its up and down movement, and the compensation mechanism 3300 drives the movable plate 3100 and the lens 1000 on the movable plate 3100 to move under the driving of the processing module to achieve shake compensation of the lens 1000.
  • the compensation mechanism 3300 in this embodiment includes a first compensation component 3310, a second compensation component 3320, a third compensation component 3330, and a fourth compensation component 3340 installed around the substrate 3200.
  • a compensation component 3310 and the third compensation component 3330 are disposed opposite to each other, the second compensation component 3320 is disposed opposite to the fourth compensation component 3340, and a connection line between the first compensation component 3310 and the third compensation component 3330
  • the connection lines between the first compensation component 3310 and the third compensation component 3330 are perpendicular to each other, that is, a compensation component, a second compensation component 3320, and a third compensation component 3330 are respectively arranged in the front, rear, left, and right directions of the movable plate 3100.
  • the first compensation component 3310 can make the movable plate 3100 move forward
  • the third compensation component 3330 can make the movable plate 3100 move backward
  • the second compensation component 3320 can make the movable plate 3100 move left
  • the fourth compensation component 3340 can make The movable plate 3100 moves to the left
  • the first compensation component 3310 can cooperate with the second compensation component 3320 or the fourth compensation component 3340 to realize the operation of the movable plate 3100 in an inclined direction.
  • the third component 3330 may be compensated 1000 compensation and the second compensation component 3320 or the fourth compensation component 3340 cooperate to achieve movement of the movable plate 3100 to the tilt direction, the lens implemented in the respective direction of jitter.
  • the first compensation component 3310, the second compensation component 3320, the third compensation component 3330, and the fourth compensation component 3340 in this embodiment each include a driving member 3301, a rotating shaft 3302, a one-way bearing 3303, and a rotating ring gear 3304.
  • the driving member 3301 is controlled by the processing module, and the driving member 3301 is drivingly connected to the rotating shaft 3302 to drive the rotating shaft 3302 to rotate.
  • the rotating shaft 3302 is connected to the inner ring of the one-way bearing 3303 to drive the inner ring of the one-way bearing 3303 to rotate.
  • the rotating ring gear 3304 is sleeved on the one-way bearing 3303 and is connected to the one-way bearing 3303.
  • the outer ring of the one-way bearing 3303 is fixedly connected.
  • the outer surface of the rotating ring gear 3304 is provided with a ring of external teeth along its circumferential direction.
  • the shaped groove 3110 is meshed with the external teeth, and the external teeth can slide along the length direction of the strip groove 3110; wherein the rotatable direction of the one-way bearing 3303 of the first compensation component 3310 and the external teeth.
  • the rotation direction of the one-way bearing 3303 of the third compensation component 3330 is opposite, and the rotation direction of the one-way bearing 3303 of the second compensation component 3320 is opposite to the rotation direction of the one-way bearing 3303 of the fourth compensation component 3340.
  • One-way bearing 3303 is a bearing that can rotate freely in one direction and lock in the other direction.
  • the driving member 3301 of the first compensation component 3310 causes the rotating shaft 3302 to drive
  • the inner ring of the one-way bearing 3303 rotates.
  • the one-way bearing 3303 is locked. Therefore, the inner ring of the one-way bearing 3303 can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate.
  • the engagement of the groove 3110 drives the movable plate 3100 to move in a direction that can compensate for shake.
  • the third compensation component 3330 can be used to drive the movable plate 3100 to rotate.
  • the one-way bearing 3303 of the first compensation component 3310 is in a rotatable state, so the ring gear on the first compensation component 3310 follows the movable plate 3100, and will not affect the activity Reset of board 3100.
  • the mounting holes are provided with the mounting holes.
  • the one-way bearing 3303 and the rotating ring gear 3304 can reduce the overall thickness of the entire mechanical vibration stabilizer 3000 by concealing parts of the one-way bearing 3303 and the rotating ring gear 3304 in the mounting holes.
  • a part of the entire compensation assembly may be directly placed in the mounting hole.
  • the driving member 3301 in this embodiment may be a micro motor, the micro motor is electrically connected to the processing module, a rotation output end of the micro motor is connected to the rotating shaft 3302, and the micro motor is controlled To the processing module.
  • the driving member 3301 is composed of a memory alloy wire and a crank connecting rod. One end of the memory alloy wire is fixed on the fixing plate and is connected to the processing module through a circuit. The other end of the memory alloy wire passes The crank link is connected to the rotating shaft 3302 to drive the rotating shaft 3302 to rotate.
  • the processing module calculates the elongation of the memory alloy wire according to the feedback from the gyroscope, and drives the corresponding circuit to the shape memory alloy.
  • the temperature of the wire is increased, and the shape memory alloy wire is stretched to drive the crank link mechanism.
  • the crank of the crank link mechanism drives the rotation shaft 3302 to rotate the inner ring of the one-way bearing 3303.
  • the inner The ring drives the outer ring to rotate, and the rotating ring gear 3304 drives the movable plate 3100 through the strip groove 3110.
  • the following describes the working process of the mechanical image stabilizer 3000 of this embodiment in detail in combination with the above structure.
  • the movable plate 3100 needs to be compensated for forward motion, and then Left motion compensation once.
  • the gyroscope feeds the detected lens 1000 shake direction and distance in advance to the processing module.
  • the processing module calculates the required movement distance of the movable plate 3100, and then drives the first compensation component 3310.
  • the driving member 3301 causes the rotating shaft 3302 to drive the inner ring of the one-way bearing 3303.
  • the one-way bearing 3303 is locked, so the inner ring can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate, and the rotating ring gear 3304 passes
  • the strip groove 3110 drives the movable plate 3100 to move forward, and then the third compensation component 3330 drives the movable plate 3100 to reset.
  • the gyroscope feeds back the detected lens 1000 shake direction and distance to the processing module in advance, and the processing module calculates the motion distance required for the motion board 3100 to drive the second compensation component 3320.
  • the driving member 3301 causes the rotating shaft 3302 to drive the inner ring of the one-way bearing 3303.
  • the one-way bearing 3303 is locked, so the inner ring can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate, and the rotating ring gear 3304 passes
  • the strip groove 3110 drives the movable plate 3100 to move forward, and because the external teeth of the ring gear 3304 can slide along the length direction of the strip groove 310, when the movable plate 3100 moves to the left, the movable plate 3100 and the first compensation
  • the sliding fitting between the component 3310 and the third compensation component 3330 does not affect the leftward movement of the movable plate 3100.
  • the fourth compensation component 3340 is used to drive the movable plate 3100 to reset.
  • the above is just two simple jitters.
  • the basic working process is the same as the principle described above.
  • the detection feedback of the shape memory alloy resistance and the detection feedback of the gyroscope are existing technologies, and are not described here too.
  • the mechanical compensator provided by this embodiment not only is not affected by external magnetic fields and has a good anti-shake effect, but also can accurately compensate the lens 1000 in the case of multiple shakes, and the compensation is timely and accurate. Greatly improved the quality of the acquired images, and simplified the difficulty of subsequent 3D image processing.
  • the electronic device includes a mobile phone with the image acquisition device.
  • the mobile phone includes a stand.
  • the purpose of the mobile phone stand is due to the uncertainty of the image acquisition environment, so the phone needs to be supported and fixed with a stand in order to obtain more stable image quality.
  • the bracket 6000 in this embodiment includes a mobile phone mounting base 6100 and a retractable supporting rod 6200.
  • the supporting rod 6200 and the middle portion of the mobile phone mounting base 6100 pass through a damping hinge.
  • the bracket 6000 may form a selfie stick structure
  • the bracket 6000 may form a mobile phone bracket 6000 structure.
  • the applicant found that the combination of the mobile phone mounting base 6100 and the support pole 6200 takes up a lot of space. Even if the support pole 6200 is retractable, the mobile phone mounting base 6100 cannot undergo structural changes and the volume will not be further reduced. Putting it in a pocket or a small bag causes the inconvenience of carrying the bracket 6000. Therefore, in this embodiment, a second step improvement is performed on the bracket 6000, so that the overall accommodation of the bracket 6000 is further improved.
  • the mobile phone mounting base 6100 of this embodiment includes a retractable connection plate 6110 and a folding plate group 6120 installed at opposite ends of the connection plate 6110.
  • the support rod 6200 and the connection plate 6110 The middle part is connected by a damping hinge;
  • the folding plate group 6120 includes a first plate body 6121, a second plate body 6122, and a third plate body 6123, wherein one of the two opposite ends of the first plate body 6121 is connected to the first plate body 6121.
  • the connecting plate 6110 is hinged, the other end of the opposite ends of the first plate body 6121 is hinged to one of the opposite ends of the second plate body 6122, and the opposite ends of the second plate body 6122 are The other end is hinged to one of opposite ends of the third plate body 6123; the second plate body 6122 is provided with an opening 6130 for inserting a corner of the mobile phone.
  • the first plate body 6121, the second plate body 6122 and the third plate body 6123 are folded into a right triangle state, and the second plate body 6122 is a hypotenuse of a right-angled triangle, and the first plate body 6121 and the third plate 6123 are right-angled sides of a right triangle, wherein one side of the third plate body 6123 and one of the connection plate 6110 The sides are attached side by side, and the other end of the opposite ends of the third plate body 6123 and one of the opposite ends of the first plate body 6121 abut against each other.
  • This structure can make the three folding plates in a self-locking state, and When the two corners of the lower part of the mobile phone are inserted into the two openings 6130 on both sides, the lower sides of the mobile phone 5000 are located in two right-angled triangles.
  • the mobile phone 5000 can be completed through the joint work of the mobile phone, the connecting plate 6110, and the folding plate group 6120.
  • the triangle state cannot be opened under external force.
  • the triangle state of 6120 pieces of folding plate group can only be released after the mobile phone is pulled out from the opening 6130.
  • the connecting plate 6110 When the mobile phone mounting base 6100 is not in working state, the connecting plate 6110 is reduced to a minimum length, and the folding plate group 6120 and the connecting plate 6110 are folded to each other.
  • the user can fold the mobile phone mounting base 6100 to a minimum volume, and due to the support
  • the scalability of the lever 6200 allows the entire bracket 6000 to be accommodated in the smallest volume, which improves the collection of the bracket 6000. Users can even put the bracket 6000 directly into their pockets or small handbags, which is very convenient.
  • a first connection portion is also provided on one side of the third plate body 6123, and a side surface where the connection plate 6110 is in contact with the third plate body 6123 is provided with the first connection portion.
  • a first mating portion that mates with a connecting portion.
  • the first connecting portion of this embodiment is a convex strip or protrusion (not shown in the figure), and the first matching portion is a card slot (not shown in the figure) opened on the connecting plate 6110.
  • This structure not only improves the stability when the 6120 pieces of the folding plate group are in a triangle state, but also facilitates the connection between the 6120 pieces of the folding plate group and the connecting plate 6110 when the mobile phone mounting base 6100 needs to be folded to a minimum state.
  • a second connection portion is also provided at one end of the opposite ends of the first plate body 6121, and the other end of the opposite ends of the third plate body 6123 is provided with the second connection portion.
  • the second connecting portion is a second matching portion that is matched with the second fitting portion, and the second connecting portion and the second fitting portion are engaged and connected.
  • the second connecting portion may be a protrusion (not shown in the figure), and the second mating portion is an opening 6130 or a card slot (not shown in the figure) that cooperates with the protrusion.
  • a base (not shown in the figure) can be detachably connected to the other end of the support rod 6200.
  • the support rod 6200 can be stretched to A certain length and place the bracket 6000 on a plane through the base, and then place the mobile phone in the mobile phone mounting base 6100 to complete the fixing of the mobile phone; and the detachable connection of the support bar 6200 and the base can make the two can be carried separately, further The accommodating of the bracket 6000 and the convenience of carrying are improved.
  • the device embodiments described above are only schematic, and the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, which may be located in One place, or can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment. Those of ordinary skill in the art can understand and implement without creative labor.
  • An embodiment of the present invention provides a non-transitory computer-readable storage storage medium, where the computer storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device is caused
  • the three-dimensional face optimization method based on light in any of the method embodiments described above is performed.
  • An embodiment of the present invention provides a computer program product, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions When executed by an electronic device, the electronic device is caused to execute the light-based three-dimensional face optimization method in any of the foregoing method embodiments.
  • each embodiment can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware.
  • the above-mentioned technical solution in essence or a part that contributes to the existing technology may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, the computer-readable record A medium includes any mechanism for storing or transmitting information in a form readable by a computer (eg, a computer).
  • machine-readable media include read-only memory (ROM), random-access memory (RAM), magnetic disk storage media, optical storage media, flash storage media, electrical, optical, acoustic, or other forms of propagation signals (e.g., carrier waves , Infrared signals, digital signals, etc.), the computer software product includes a number of instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments Methods.

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

A light-based three-dimensional face optimization method and apparatus, and an electronic device. The method comprises: acquiring a target picture, and determining whether a facial image in the target picture is in a non-uniform light condition (S101); if the facial image is in a non-uniform light condition, inputting the facial image to a pre-trained image generation model to obtain an optimized facial image after light adjustment is performed on the facial image (S102); processing the optimized facial image based on a pre-trained convolutional neural network model to obtain first three-dimensional face model parameter information (S103); and processing a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional facial image corresponding to the facial image (S104). By means of the method, a facial image photographed under a poor lighting environment is optimized, so as to obtain a clear face; moreover, only a single picture is needed to generate a three-dimensional face, thus reducing the costs.

Description

基于光线的三维人脸优化方法、装置及电子设备Light-based 3D human face optimization method, device and electronic equipment 技术领域Technical field
本发明涉及图象处理技术领域,尤其涉及一种基于光线的三维人脸优化方法、装置及电子设备。The invention relates to the technical field of image processing, and in particular, to a method, a device, and an electronic device for optimizing a three-dimensional human face based on light.
背景技术Background technique
三维人脸重建在医疗、教育、娱乐等领域目前已经得到了非常广泛的应用。发明人在实现本发明的过程中发现,在三维人脸重建的过程中,利用多张图片多个角度来拼合成三维模型,但由于需要大量的图片,所以重建过程繁琐复杂,需要花费较长的时间;此外,在重建过程需要对人脸图像中的人脸关键点进行定位,以生成人脸关键点的位置信息,而在光照环境较差的情况下(例如逆光、侧光等情况),人脸的图像信息不清晰,导致最后生成的三维人脸误差较大。此外,手机等移动装置越来越多的开始使用三维人脸重建技术,而三维人脸重建所需的大量二位图片往往通过手机摄像头获取,手机在拍摄中易产生抖动,会影响到图像的获取质量,从而间接影响到后续的三维人脸重建效果。Three-dimensional face reconstruction has been widely used in medical, education, and entertainment fields. In the process of implementing the present invention, the inventor found that in the process of 3D face reconstruction, multiple pictures and multiple angles are used to form a 3D model. However, since a large number of pictures are required, the reconstruction process is cumbersome and complicated, and it takes a long time. In addition, during the reconstruction process, the key points of the face in the face image need to be located to generate the position information of the key points of the face, and in the case of poor lighting conditions (such as backlighting, sidelighting, etc.) , The image information of the face is not clear, resulting in a large error in the finally generated 3D face. In addition, mobile devices such as mobile phones are increasingly using 3D face reconstruction technology, and a large number of two-bit pictures required for 3D face reconstruction are often obtained through mobile phone cameras. Mobile phones are prone to shake during shooting, which will affect the image The acquisition quality indirectly affects the subsequent 3D face reconstruction effect.
发明内容Summary of the Invention
本发明实施例提供的基于光线的三维人脸优化方法、装置及电子设备,用以至少解决相关技术中的上述问题。The ray-based three-dimensional human face optimization method, device, and electronic device provided by the embodiments of the present invention are used to solve at least the foregoing problems in related technologies.
本发明实施例一方面提供了一种基于光线的三维人脸优化方法,包括:One aspect of the embodiments of the present invention provides a light-based three-dimensional face optimization method, including:
判断获取的目标图片中的人脸图像是否光照不均匀;Determine whether the face image in the obtained target picture is unevenly lit;
若所述人脸图像存在光照不均匀现象,则对所述人脸图像进行光线调整,以获得优化人脸图像;If the face image has uneven illumination, performing light adjustment on the face image to obtain an optimized face image;
基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;Processing the optimized face image based on a pre-trained convolutional neural network model to obtain the first three-dimensional face model parameter information;
根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。The three-dimensional average face model is processed according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
进一步地,所述判断获取的目标图片中的人脸图像是否光照不均匀的步骤包括:Further, the step of determining whether the face image in the obtained target picture is unevenly illuminated includes:
获得所述目标图片的灰度直方图;Obtaining a grayscale histogram of the target picture;
根据所述灰度直方图计算所述目标图片的灰度级分布方差;Calculating the gray level distribution variance of the target picture according to the gray level histogram;
将所述灰度级分布方差与灰度级分布临界方差进行比较,当所述灰度级分布方差 大于或等于所述灰度级分布临界方差时,确定所述目标图片中的人脸图像存在光照不均匀。Comparing the gray level distribution variance with a gray level distribution critical variance, and when the gray level distribution variance is greater than or equal to the gray level distribution critical variance, determining that a face image exists in the target picture The light is uneven.
进一步地,所述对所述人脸图像进行光线调整,以获得优化人脸图像的步骤包括:Further, the step of performing light adjustment on the face image to obtain an optimized face image includes:
获取训练样本和初始图像生成模型,所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像;Obtaining a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到图像生成模型;Using a machine learning method to train the initial image generation model based on the training samples to obtain an image generation model;
利用所述图像生成模型对所述人脸图像进行光线调整,以获得优化人脸图像。Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
进一步地,所述利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到所述图像生成模型,包括:Further, using the machine learning method to train the initial image generation model based on the training samples to obtain the image generation model includes:
将所述第一图像输入至所述初始图像生成模型中,得到输出的优化第一图像;Inputting the first image into the initial image generation model to obtain an output optimized first image;
将所述优化第一图像、所述第二图像作为判别网络的输入,对所述判别网络进行训练,确定训练后的所述判别网络的参数;Using the optimized first image and the second image as input of a discrimination network, training the discrimination network, and determining parameters of the discrimination network after training;
将所述第一图像作为所述初始图像生成模型的输入,对所述初始图像生成模型进行训练;Training the initial image generation model by using the first image as an input of the initial image generation model;
将训练后的所述初始图像生成模型输出的优化第一图像和所述第二图像输入至所述训练后的所述判别网络,确定所述训练后的所述判别网络的损失函数值;Inputting the optimized first image and the second image output by the initial image generation model after training to the discriminant network after training to determine a loss function value of the discriminant network after training;
当所述损失函数值收敛,将所述初始图像生成模型确定为所述图像生成模型。When the value of the loss function converges, the initial image generation model is determined as the image generation model.
进一步地,所述卷积神经网络模型通过如下步骤进行训练:Further, the convolutional neural network model is trained by the following steps:
搭建由两层沙漏型卷积神经网络组成的卷积神经网络模型;Build a convolutional neural network model consisting of two layers of hourglass convolutional neural networks;
获取用于训练所述卷积神经网络模型的数据集,所述数据集中包括若干二维人脸图片和所述二维人脸图片对应的三维人像扫描数据;Obtaining a data set for training the convolutional neural network model, where the data set includes several two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures;
对所述二维人脸图片进行预处理得到人脸特征点信息;Pre-processing the two-dimensional face picture to obtain facial feature point information;
将所述人脸特征点信息输入至所述卷积神经网络模型得到第二三维人脸模型参数信息;Inputting the facial feature point information into the convolutional neural network model to obtain the second three-dimensional facial model parameter information;
利用交叉熵损失函数对所述卷积神经网络的参数进行优化,直至所述第二三维人脸模型参数信息与所述三维人像扫描数据的损失函数收敛到预设阈值。The cross-entropy loss function is used to optimize the parameters of the convolutional neural network until the second 3D face model parameter information and the loss function of the 3D portrait scan data converge to a preset threshold.
进一步地,通过图像获取设备获取所述目标图片,所述图像获取设备包括镜头、自动聚焦音圈马达、机械防抖器以及图像传感器,所述镜头固装在所述自动聚焦音圈马达上,所述镜头用于获取图像(图片),所述图像传感器将所述镜头获取的图像传输至所述识别模块,所述自动聚焦音圈马达安装在所述机械防抖器上,所述处理模块根据镜头内的陀螺仪检测到的镜头抖动的反馈驱动所述机械防抖器的动作,实现镜头的抖动补偿。Further, the target picture is obtained through an image acquisition device, which includes a lens, an autofocus voice coil motor, a mechanical image stabilizer, and an image sensor, and the lens is fixed on the autofocus voice coil motor, The lens is used to acquire an image (picture), the image sensor transmits the image acquired by the lens to the recognition module, the autofocus voice coil motor is mounted on the mechanical image stabilizer, and the processing module According to the feedback of the lens shake detected by the gyroscope in the lens, the action of the mechanical image stabilizer is driven to realize the lens shake compensation.
进一步地,所述机械防抖器包括活动板、基板以及补偿机构,所述活动板和所述基板的中部均设有所述镜头穿过的通孔,所述自动聚焦音圈马达安装在所述活动板上,所述活动板安装在所述基板上,且所述基板的尺寸大于所述活动板,所述补偿机构在所述处理模块的驱动下带动所述活动板和活动板上的镜头动作,以实现镜头的抖动补偿;所述补偿机构包括安装在所述基板四周的第一补偿组件、第二补偿组件、第三补偿组件以及第四补偿组件,其中所述第一补偿组件和所述第三补偿组件相对设置,所述第二补偿组件与所述第四补偿组件相对设置,所述第一补偿组件与第三补偿组件之间的连线与所述第一补偿组件与第三补偿组件之间的连线相互垂直;所述第一补偿组件、第二补偿组件、第三补偿组件以及第四补偿组件均包括驱动件、转轴、单向轴承以及转动齿圈;所述驱动件受控于所述处理模块,所述驱动件与所述转轴传动连接,以带动所述转轴转动;所述转轴与所述单向轴承的内圈相连接,以带动所述单向轴承的内圈转动;所述转动齿圈套设在所述单向轴承上并与所述单向轴承的外圈相连接,所述转动齿圈的外表面沿其周向设有一圈外齿,所述活动板的底面设有多排均匀间隔布设的条形槽,所述条形槽与所述外齿相啮合,且所述外齿可沿所述条形槽的长度方向滑动;其中,所述第一补偿组件的单向轴承的可转动方向与所述第三补偿组件的单向轴承的可转动方向相反,所述第二补偿组件的单向轴承的可转动方向与所述第四补偿组件的单向轴承的可转动方向相反。Further, the mechanical image stabilizer includes a movable plate, a base plate, and a compensation mechanism. Each of the movable plate and the base plate is provided with a through hole through which the lens passes, and the auto-focusing voice coil motor is installed at The movable plate is mounted on the substrate, and the size of the substrate is larger than the movable plate. The compensation mechanism drives the movable plate and the movable plate under the driving of the processing module. The lens moves to achieve lens shake compensation; the compensation mechanism includes a first compensation component, a second compensation component, a third compensation component, and a fourth compensation component installed around the substrate, wherein the first compensation component and The third compensation component is disposed opposite to each other, the second compensation component is disposed opposite to the fourth compensation component, and a line between the first compensation component and the third compensation component is connected to the first compensation component and the first compensation component. The lines between the three compensation components are perpendicular to each other; the first compensation component, the second compensation component, the third compensation component, and the fourth compensation component all include a driving member, a rotating shaft, and a one-way bearing. Rotate the ring gear; the driving member is controlled by the processing module, and the driving member is drivingly connected to the rotating shaft to drive the rotating shaft to rotate; the rotating shaft is connected to the inner ring of the one-way bearing to Driving the inner ring of the one-way bearing to rotate; the rotating ring gear is sleeved on the one-way bearing and connected to the outer ring of the one-way bearing, and an outer surface of the rotating ring gear is provided with a ring in its circumferential direction External teeth, the bottom surface of the movable plate is provided with a plurality of rows of strip grooves arranged at even intervals, the strip grooves are engaged with the external teeth, and the external teeth can slide along the length direction of the strip grooves ; Wherein the rotatable direction of the one-way bearing of the first compensation component is opposite to the rotatable direction of the one-way bearing of the third compensation component, and the rotatable direction of the one-way bearing of the second compensation component is different from that The rotatable direction of the one-way bearing of the fourth compensation assembly is opposite.
进一步地,所述固定板的四周开设有四个贯穿的安装孔,所述安装孔上安装有所述单向轴承和所述转动齿圈。Further, four fixed mounting holes are formed around the fixing plate, and the one-way bearing and the rotating ring gear are mounted on the mounting holes.
进一步地,所述驱动件为微型电机,所述微型电机与所述处理模块电连接,所述微型电机的转动输出端与所述转轴相连接;或,所述驱动件包括记忆合金丝和曲柄连杆,所述记忆合金丝一端固定于所述固定板上,并与所述处理模块通过电路相连接,所述记忆合金丝另一端通过所述曲柄连杆与所述转轴相连接,以带动所述转轴转动。Further, the driving member is a micro motor, the micro motor is electrically connected to the processing module, and a rotary output end of the micro motor is connected to the rotating shaft; or the driving member includes a memory alloy wire and a crank A connecting rod, one end of the memory alloy wire is fixed on the fixing plate and connected with the processing module through a circuit, and the other end of the memory alloy wire is connected with the rotating shaft through the crank connecting rod to drive The rotation shaft rotates.
进一步地,所述图像获取设备设置在手机上,手机包括支架。所述支架包括手机安装座和可伸缩的支撑杆;所述手机安装座包括可伸缩的连接板和安装于连接板相对两端的折叠板组,所述支撑杆的一端与所述连接板中部通过阻尼铰链相连接;所述折叠板组包括第一板体、第二板体及第三板体,其中,所述第一板体的相对两端中的一端与所述连接板相铰接,所述第一板体的相对两端中的另一端与所述第二板体的相对两端中的一端相铰接;所述第二板体相对两端的另一端与所述第三板体相对两端中的一端相铰接;所述第二板体设有供手机边角插入的开口;所述手机安装座用于安装手机时,所述第一板体、第二板体和第三板体折叠呈直角三角形状态,所述第二板体为直角三角形的斜边,所述第一板体和所述第三板体为直角三角形的直角边,其中,所述第三板体的一个侧面与所述连接板的一个侧面并排贴合,所述第三板体相对两端中的另一端与所述第一板体相对两端中的一端相抵。Further, the image acquisition device is disposed on a mobile phone, and the mobile phone includes a stand. The bracket includes a mobile phone mount and a retractable support rod; the mobile phone mount includes a retractable connection plate and a folding plate group installed at opposite ends of the connection plate, and one end of the support rod passes through the middle of the connection plate The damping hinge is connected; the folding plate group includes a first plate body, a second plate body, and a third plate body, wherein one of two opposite ends of the first plate body is hinged with the connecting plate, so The other end of the two opposite ends of the first plate is hinged to one of the two opposite ends of the second plate; the other end of the opposite ends of the second plate is two opposite to the third plate. One end of the ends is hinged; the second plate body is provided with an opening for inserting a corner of the mobile phone; when the mobile phone mounting seat is used to install the mobile phone, the first plate body, the second plate body, and the third plate body The folded state is a right triangle, the second plate is a hypotenuse of a right triangle, the first plate and the third plate are right angles of a right triangle, and one side of the third plate is Affixed side by side with one side of the connecting plate, the first The other end of the plate opposite ends with one end of opposite ends of said first plate offset.
进一步地,所述第三板体的一个侧面设有第一连接部,所述连接板与所述第三板体相贴合的侧面设有与所述第一连接部相配合的第一配合部,所述支架手机安装座用于安装手机时,所述第一连接部和所述第一配合部卡合连接。Further, one side of the third plate body is provided with a first connection portion, and a side surface of the connection plate that is in contact with the third plate body is provided with a first fit that is matched with the first connection portion. When the mobile phone mounting base is used to install a mobile phone, the first connection portion and the first mating portion are snap-connected.
进一步地,所述第一板体相对两端中的一端设有第二连接部,所述第三板体相对两端中的另一端设有与所述第二连接部相配合的第二配合部,所述支架手机安装座用于安装手机时,所述第二连接部和所述第二配合部卡合连接。Further, a second connection portion is provided on one end of the opposite ends of the first plate body, and a second connection is provided on the other end of the opposite ends of the third plate body to cooperate with the second connection portion. When the mobile phone mounting base is used to install a mobile phone, the second connection portion and the second mating portion are snap-connected.
进一步地,所述支撑杆的另一端可拆卸连接有底座。Further, the other end of the support rod is detachably connected with a base.
本发明实施例的另一方面提供了一种基于光线的三维人脸优化装置,包括:Another aspect of the embodiments of the present invention provides a light-based three-dimensional face optimization device, including:
判断模块,用于判断获取的目标图片中的人脸图像是否光照不均匀;A judging module, configured to judge whether the face image in the obtained target picture has uneven illumination;
优化模块,若所述人脸图像存在光照不均匀现象,则对所述人脸图像进行光线调整,以获得优化人脸图像;An optimization module, if the face image has uneven illumination, performing light adjustment on the face image to obtain an optimized face image;
获取模块,用于基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;An acquisition module, configured to process the optimized face image based on a pre-trained convolutional neural network model to obtain first first three-dimensional face model parameter information;
处理模块,用于根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。A processing module is configured to process a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
进一步地,所述判断模块具体用于:Further, the judgment module is specifically configured to:
获得所述目标图片的灰度直方图;Obtaining a grayscale histogram of the target picture;
根据所述灰度直方图计算所述目标图片的灰度级分布方差;Calculating the gray level distribution variance of the target picture according to the gray level histogram;
将所述灰度级分布方差与灰度级分布临界方差进行比较,当所述灰度级分布方差大于或等于所述灰度级分布临界方差时,确定所述目标图片中的人脸图像存在光照不均匀。Comparing the gray level distribution variance with a gray level distribution critical variance, and when the gray level distribution variance is greater than or equal to the gray level distribution critical variance, determining that a face image exists in the target picture The light is uneven.
进一步地,所述优化模块还包括第一训练模块,所述第一训练模块用于:Further, the optimization module further includes a first training module, the first training module is configured to:
获取训练样本和初始图像生成模型,所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像;Obtaining a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到图像生成模型;Using a machine learning method to train the initial image generation model based on the training samples to obtain an image generation model;
利用所述图像生成模型对所述人脸图像进行光线调整,以获得优化人脸图像。Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
进一步地,所述第一训练模块还用于:Further, the first training module is further configured to:
将所述第一图像输入至所述初始图像生成模型中,得到输出的优化第一图像;Inputting the first image into the initial image generation model to obtain an output optimized first image;
将所述优化第一图像、所述第二图像作为判别网络的输入,对所述判别网络进行训练,确定训练后的所述判别网络的参数;Using the optimized first image and the second image as input of a discrimination network, training the discrimination network, and determining parameters of the discrimination network after training;
将所述第一图像作为所述初始图像生成模型的输入,对所述初始图像生成模型进行训练;Training the initial image generation model by using the first image as an input of the initial image generation model;
将训练后的所述初始图像生成模型输出的优化第一图像和所述第二图像输入至 所述训练后的所述判别网络,确定所述训练后的所述判别网络的损失函数值;Inputting the optimized first image and the second image output from the trained initial image generation model to the discriminative network after training to determine a loss function value of the discriminative network after training;
当所述损失函数值收敛,将所述初始图像生成模型确定为所述图像生成模型。When the value of the loss function converges, the initial image generation model is determined as the image generation model.
进一步地,所述装置还包括第二训练模块,所述第二训练模块用于,搭建由两层沙漏型卷积神经网络组成的卷积神经网络模型;获取用于训练所述卷积神经网络模型的数据集,所述数据集中包括若干二维人脸图片和所述二维人脸图片对应的三维人像扫描数据;对所述二维人脸图片进行预处理得到人脸特征点信息;将所述人脸特征点信息输入至所述卷积神经网络模型得到第二三维人脸模型参数信息;利用交叉熵损失函数对所述卷积神经网络的参数进行优化,直至所述第二三维人脸模型参数信息与所述三维人像扫描数据的损失函数收敛到预设阈值。Further, the device further includes a second training module, the second training module is configured to build a convolutional neural network model composed of two layers of hourglass-type convolutional neural networks; and acquire and use to train the convolutional neural network A data set of the model, where the data set includes several two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures; pre-processing the two-dimensional face pictures to obtain facial feature point information; and The facial feature point information is input to the convolutional neural network model to obtain the second three-dimensional face model parameter information; the cross-entropy loss function is used to optimize the parameters of the convolutional neural network until the second three-dimensional human. The face model parameter information and the loss function of the three-dimensional portrait scan data converge to a preset threshold.
本发明实施例的又一方面提供一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,Another aspect of the embodiments of the present invention provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本发明实施例上述任一项基于光线的三维人脸优化方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute any one of the foregoing light-based Three-dimensional face optimization method.
由以上技术方案可见,本发明实施例提供的基于光线的三维人脸优化方法、装置及电子设备,对在光照环境较差的情况下(例如逆光、侧光等情况)所拍摄的人脸图像进行优化,从而得到清晰的人脸;同时仅需单张图片即可生成三维人脸图像,通过卷积神经网络模型可自动生成更准确和更逼真的人脸表情和姿态,且无需硬件的支持,多方面降低成本。It can be seen from the above technical solutions that the light-based three-dimensional face optimization method, device, and electronic device provided by the embodiments of the present invention are applicable to face images taken in situations where the lighting environment is poor (such as backlighting, sidelighting, etc.) Optimize to get a clear face; at the same time, only a single picture can be used to generate a three-dimensional face image. A convolutional neural network model can automatically generate more accurate and realistic face expressions and poses without the need for hardware support Reduce costs in many ways.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明实施例中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly explain the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are merely These are some of the embodiments described in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to these drawings.
图1为本发明一个实施例提供的基于光线的三维人脸优化方法流程图;FIG. 1 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention; FIG.
图2为本发明一个实施例提供的基于光线的三维人脸优化方法流程图;2 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention;
图3为本发明一个实施例提供的基于光线的三维人脸优化方法流程图;3 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention;
图4为本发明一个实施例提供的基于光线的三维人脸优化装置结构图;4 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention;
图5为本发明一个实施例提供的基于光线的三维人脸优化装置结构图;5 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention;
图6为执行本发明方法实施例提供的执行光线的三维人脸优化方法的电子设备的硬件结构示意图;FIG. 6 is a schematic diagram of a hardware structure of an electronic device that executes a method for optimizing a three-dimensional human face according to a method embodiment of the present invention; FIG.
图7为本发明一个实施例提供的图像获取设备的结构图;7 is a structural diagram of an image acquisition device according to an embodiment of the present invention;
图8为本发明一个实施例提供的光学防抖器的结构图;8 is a structural diagram of an optical image stabilizer provided by an embodiment of the present invention;
图9为图8的A部放大图;FIG. 9 is an enlarged view of part A of FIG. 8; FIG.
图10为本发明一个实施例提供的微型记忆合金光学防抖器的活动板的底面示意图;10 is a schematic bottom view of a movable plate of a micro memory alloy optical image stabilizer provided by an embodiment of the present invention;
图11为本发明一个实施例提供的支架的结构图;11 is a structural diagram of a stent provided by an embodiment of the present invention;
图12为本发明一个实施例提供的支架的一个状态示意图;FIG. 12 is a schematic state diagram of a stent according to an embodiment of the present invention; FIG.
图13为本发明一个实施例提供的支架的另一个状态示意图;13 is a schematic view of another state of a stent according to an embodiment of the present invention;
图14为本发明一个实施例提供的安装座与手机相连接时的结构状态图。FIG. 14 is a structural state diagram when the mounting base and the mobile phone are connected according to an embodiment of the present invention.
具体实施方式detailed description
为了使本领域的人员更好地理解本发明实施例中的技术方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明实施例一部分实施例,而不是全部的实施例。基于本发明实施例中的实施例,本领域普通技术人员所获得的所有其他实施例,都应当属于本发明实施例保护的范围。In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described The embodiments are only a part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments in the embodiments of the present invention, all other embodiments obtained by those skilled in the art should belong to the protection scope of the embodiments of the present invention.
下面结合附图,对本发明的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互结合。图1为本发明实施例提供的基于光线的三维人脸优化方法流程图。如图1所示,本发明实施例提供的基于光线的三维人脸优化方法,包括:Hereinafter, some embodiments of the present invention will be described in detail with reference to the drawings. In the case of no conflict, the following embodiments and features in the embodiments can be combined with each other. FIG. 1 is a flowchart of a light-based three-dimensional face optimization method according to an embodiment of the present invention. As shown in FIG. 1, a light-based three-dimensional face optimization method provided by an embodiment of the present invention includes:
S101,获取目标图片,判断所述目标图片中的人脸图像是否处于非均匀光线条件。S101: Obtain a target picture, and determine whether a face image in the target picture is in a non-uniform light condition.
在本步骤中,目标图片可以是实时拍摄的图片,也可以是保存于终端的本地的图片中的图像。当目标图片是在逆光或者侧光条件下拍摄的,目标图片中的人脸就处在非均匀的光线条线中,从而使得人像的五官不清晰,导致生成的三维人脸图像有误差。因此,在本步骤中,获取目标图片后,首先需要判断目标图片中的人脸图像是否处于非均匀光线条件。In this step, the target picture may be a picture taken in real time, or an image stored in a local picture of the terminal. When the target picture is taken in backlight or side light conditions, the face in the target picture is in non-uniform light lines, which makes the facial features of the portrait unclear, resulting in errors in the generated three-dimensional face image. Therefore, in this step, after obtaining the target picture, it is first necessary to determine whether the face image in the target picture is in a non-uniform light condition.
作为本发明实施例的可选实施方式,在判断人脸图像是否处于非均匀光线条件时,首先对目标图片进行处理,得到该目标图片的灰度直方图;As an optional implementation of the embodiment of the present invention, when determining whether a face image is in a non-uniform light condition, first process a target picture to obtain a grayscale histogram of the target picture;
根据该灰度直方图计算该目标图片的灰度级分布方差;将该灰度级分布方差与灰度级分布临界方差进行比较,当灰度级分布方差大于或等于灰度级分布临界方差时,确定目标图片中的人脸图像处于非均匀光线条件。Calculate the grayscale distribution variance of the target picture according to the grayscale histogram; compare the grayscale distribution variance with the grayscale distribution critical variance, and when the grayscale distribution variance is greater than or equal to the grayscale distribution critical variance To determine that the face image in the target picture is in non-uniform lighting conditions.
具体地,图片的灰度直方图可以明确地表示图像的明暗分布,并且其分布与图像的内容无关。一般来说,逆光或侧光场景和非逆光、侧光场景的灰度直方图的分布是完全不同的。逆光或侧光场景的灰度直方图分布是极亮和极暗灰度级上的像素分布高,而非逆光、侧光场景的像素主要集中在中间的灰度级上。因此,对于逆光或侧 光的灰度直方图,其灰度级分布方差很大;而对于非逆光、侧光场景的灰度直方图,其灰度级分布方差很小。Specifically, the grayscale histogram of the picture can clearly represent the light and dark distribution of the image, and its distribution has nothing to do with the content of the image. Generally speaking, the distribution of grayscale histograms of backlit or sidelight scenes and non-backlit or sidelight scenes is completely different. The grayscale histogram distribution of backlight or sidelight scenes is high in pixel distribution on extremely bright and dark grayscale levels, while pixels in non-backlight or sidelight scenes are mainly concentrated in the middle grayscale level. Therefore, the gray level histogram of backlight or side light has a large variance in gray level distribution, while the gray level histogram of non-backlit or side light scene has a small gray level distribution variance.
在进行本步骤之前,可以通过多张图片(包括逆光、侧光、非逆光、非侧光)得到灰度级分布的临界方差,大于该临界方差则确定为逆光或侧光图片,即目标图片处于非均匀光线条件;小于该临界方差则确定为非逆光、侧光图片,即目标图片处于均匀光线条件。Before this step, the critical variance of the gray level distribution can be obtained from multiple pictures (including backlight, sidelight, non-backlight, non-sidelight). If the critical variance is greater than this, it is determined as the backlight or sidelight picture, that is, the target picture It is in non-uniform light conditions; if it is less than the critical variance, it is determined as a non-backlit and side-light picture, that is, the target picture is in uniform light conditions.
当确定人脸图像处于非均匀光线条件,则执行步骤S102。When it is determined that the face image is in a non-uniform light condition, step S102 is performed.
S102,将所述人脸图像输入至预先训练的图像生成模型,得到对所述人脸图像进行光线调整后的优化人脸图像。S102. Input the face image into a pre-trained image generation model to obtain an optimized face image after light adjustment is performed on the face image.
具体地,优化人脸图像可以是在均匀光源条件下所呈现的人脸图像,在此条件下能够得到清晰的人脸五官。需要说明的是,图像生成模型可以用于对在非正面均匀光源条件下所拍摄的人脸图像进行光线调整以生成正面均匀光源条件下的人脸图像。Specifically, the optimized face image may be a face image presented under a uniform light source condition, and clear facial features can be obtained under this condition. It should be noted that the image generation model can be used to perform light adjustment on a face image captured under a non-positive uniform light source condition to generate a face image under a front uniform light source condition.
作为示例,图像生成模型可以是预先利用机器学习方法,基于训练样本对用于进行图像处理的模型(例如,现有的卷积神经网络模型等)进行训练后所得到的模型。上述卷积神经网络可以包括卷积层、池化层、反池化层和反卷积层,卷积神经网络的最后一个反卷积层可以输出优化人脸图像,所输出的优化人脸图像可以用RGB三通道的矩阵进行表达,且所输出的优化人脸图像的尺寸可以与目标图片中的人脸图像相同。As an example, the image generation model may be a model obtained by using a machine learning method in advance to train a model (for example, an existing convolutional neural network model, etc.) for image processing based on training samples. The above convolutional neural network may include a convolutional layer, a pooling layer, a depooling layer, and a deconvolution layer. The last deconvolution layer of the convolutional neural network may output an optimized face image, and the output optimized face image It can be expressed by a matrix of RGB three channels, and the size of the output optimized face image can be the same as the face image in the target picture.
如图2所示,图像生成模型可以通过如下步骤进行训练:As shown in Figure 2, the image generation model can be trained by the following steps:
S1021,获取训练样本和初始图像生成模型(现有技术,此处不做赘述),所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像。S1021: Obtain training samples and an initial image generation model (the prior art, which is not described herein), the training samples include multiple first images generated under a non-positive uniform light source condition, and generated under a front uniform light source condition. A second image corresponding to the first image.
S1022,利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到所述图像生成模型。S1022. Use a machine learning method to train the initial image generation model based on the training samples to obtain the image generation model.
作为本发明实施例的可选实施方式,可以确定一个初始图像生成模型以及该模型中的初始参数,并通过设置判别网络来对初始图像生成模型的输出结果进行评价修正。具体地,首先,将训练样本中的第一图像输入至初始图像生成模型中,得到该初始图像生成模型输出的优化第一图像;其次,将该优化第一图像、该优化第一图像对应的第二图像作为判别网络的输入,对该判别网络进行训练,确定并固定训练后的该判别网络的参数,将利用该参数评价修正修正后续的输出结果;再次,将上述第一图像作为初始图像生成模型的输入,对初始图像生成模型进行训练,不断对该模型的初始参数进行调整修正;最后,将训练后的初始图像生成模型输出的优化第一图像和该优化第一图像对应的第二图像输入至上述训练后的判别网络,确定该训练后的所述判别网络的损失函数值,当所述损失函数值收敛,将所述初始图像生成模型确定为 所述图像生成模型。As an optional implementation of the embodiment of the present invention, an initial image generation model and initial parameters in the model may be determined, and an output of the initial image generation model may be evaluated and corrected by setting a discriminant network. Specifically, first, the first image in the training sample is input into the initial image generation model to obtain an optimized first image output by the initial image generation model; second, the optimized first image and the corresponding first optimized image are The second image is used as the input of the discriminative network. The discriminative network is trained, the parameters of the discriminated network after training are determined and fixed, and the subsequent output results will be evaluated and corrected by using this parameter. Again, the first image will be used as the initial image. Generate the input of the model, train the initial image generation model, and continuously adjust and modify the initial parameters of the model; finally, the optimized first image output by the trained initial image generation model and the second corresponding to the optimized first image An image is input to the trained discrimination network, and a loss function value of the trained discrimination network is determined. When the loss function value converges, the initial image generation model is determined as the image generation model.
上述损失函数的值可以用于表征上述图像生成模型输出的优化第一图像与上述第二图像的差异程度。损失函数越小,上述优化第一图像与上述第二图像的差异程度越小。示例性地,上述损失函数可以使用欧氏距离函数、hingle函数等。The value of the loss function may be used to characterize the degree of difference between the optimized first image and the second image output by the image generation model. The smaller the loss function, the smaller the degree of difference between the optimized first image and the second image. Exemplarily, the aforementioned loss function may use an Euclidean distance function, a hinge function, or the like.
S103,基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息。S103: Process the optimized face image based on a pre-trained convolutional neural network model to obtain first first three-dimensional face model parameter information.
具体地,第一三维人脸参数信息包括人脸形状信息和人脸表情信息,将步骤S102中得到的人脸图像输入至预先训练的卷积神经网络模型,输出该第一三维人脸模型参数信息。Specifically, the first three-dimensional face parameter information includes face shape information and facial expression information. The face image obtained in step S102 is input to a pre-trained convolutional neural network model, and the first three-dimensional face model parameter is output. information.
在进行本步骤之前,需要训练卷积神经网络模型。如图3所示,对卷积神经网络模型的训练可以包括如下步骤:Before performing this step, you need to train a convolutional neural network model. As shown in Figure 3, training the convolutional neural network model can include the following steps:
S1031,搭建由两层沙漏型卷积神经网络组成的卷积神经网络模型。S1031. Construct a convolutional neural network model composed of a two-layer hourglass convolutional neural network.
S1032,获取用于训练所述卷积神经网络模型的数据集,所述数据集中包括若干二维人脸图片和所述二维人脸图片对应的三维人像扫描数据。S1032: Obtain a data set for training the convolutional neural network model, where the data set includes a plurality of two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures.
需要说明是,步骤S1031和步骤S1032没有先后顺序的限制,可以先获取数据集、再进行卷积神经网络模型的搭建,也可以先进行卷及神经网络模型的搭建、在获取数据集,本发明在此不做限制。It should be noted that there is no restriction on the sequence of steps S1031 and S1032. The data set can be acquired first, and then the convolutional neural network model can be constructed. The volume and neural network model can also be constructed first. There are no restrictions here.
具体来说,本步骤中获取输入样本数据集的方式包括从互联网上直接下载图片作为输入样本数据集,以及人为拍摄图片作为输入样本数据集,其中人为拍摄的图片可以包括不同种族的人的图片、不同光影效果的人的图片。三维人像扫描数据主要包括人脸的姿态信息(比如人脸的倾斜角度、偏转角度、转动角度等、人脸特征点的形状参数以及人脸特征点的表情参数。Specifically, the method for obtaining the input sample data set in this step includes downloading pictures directly from the Internet as the input sample data set, and artificially taking pictures as the input sample data set. The artificially taken pictures may include pictures of people of different races. , Pictures of people with different light and shadow effects. The 3D portrait scan data mainly includes the pose information of the face (such as the tilt angle, deflection angle, and rotation angle of the face, the shape parameters of the face feature points, and the expression parameters of the face feature points.
S1033,对所述二维人脸图片进行预处理得到人脸特征点信息。S1033: Preprocess the two-dimensional face picture to obtain face feature point information.
具体地,人脸特征点信息包括但不限于人脸特征点在图片中的坐标参数值以及纹理参数(即RGB特征的纹理参数)。相关技术中包括许多识别人脸图像的识别方法,例如可以根据图像的边缘信息和/或颜色信息等识别出人脸图像的范围,在本实施例中,通过识别预先定义的关键点,基于检测到的关键点确定人脸特征点信息。例如,人脸图像中的眉毛、眼睛、鼻子、脸庞和嘴巴等分别有若干个所述关键点组成,即通过所述关键点的坐标位置能够确定所述人脸图像中的眉毛、眼睛、鼻子、脸庞和嘴巴的位置及纹理。Specifically, the facial feature point information includes, but is not limited to, coordinate parameter values of the facial feature points in the picture and texture parameters (that is, texture parameters of the RGB features). The related art includes many recognition methods for recognizing a face image. For example, the range of a face image can be recognized according to the edge information and / or color information of the image. In this embodiment, a pre-defined key point is identified based on detection. The key points obtained determine facial feature point information. For example, the eyebrows, eyes, nose, face, and mouth in the face image are each composed of several key points, that is, the eyebrows, eyes, and nose in the face image can be determined by the coordinate positions of the key points. , Face and mouth position and texture.
作为本步骤的一种可选实施方式,可以利用人像特征点识别算法来获取人脸特征点信息。对于人脸特征点识别算法的训练可以包括如下步骤:首先,获取一定数量的训练集,该训练集中为携带有人脸特征点信息的图片;其次,利用该训练集训练形成初始回归函数r0和初始训练集;再次,利用该初始训练集和初始回归函数r0迭代形成下一次训练集和回归函数rn;每次迭代回归函数均使用梯度提升算法进行学习, 从而当第n次训练集与训练集中的人脸特征点信息满足收敛条件时,则其对应的回归函数rn即为训练完成的人脸特征点识别算法。As an optional implementation of this step, a facial feature point recognition algorithm may be used to obtain facial feature point information. The training of the facial feature point recognition algorithm may include the following steps: first, a certain number of training sets are obtained, and the training set is a picture carrying human facial feature point information; second, the training set is used to form an initial regression function r0 and an initial Training set; again, using the initial training set and initial regression function r0 to iterate to form the next training set and regression function rn; each iteration of the regression function uses a gradient boosting algorithm to learn, so that when the nth training set and the training set are When the facial feature point information meets the convergence conditions, the corresponding regression function rn is the facial feature point recognition algorithm after training.
在本步骤中,使用算法对图片进行人脸检测,得到人脸在图片中的位置,用范围矩形框标识人脸的范围,例如(左,上,右,下)。通过训练好的特征点识别算法中的回归函数对输入人像照片识别得到第一预设数量的特征点、以及每个人脸特征点坐标(x i,y i),其中,i代表识别得到的第i个特征点,第一预设数量可以是68个,包括眉毛,眼睛,鼻子,嘴巴,脸庞的关键点。对每个人脸特征点,根据其坐标(x i,y i)以及高斯算法形成一个代表该特征点周围第二预设数量像素的纹理参数(R i,G i,B i)。可选地,该第二预设数量可以是6个、8个等,本发明在此不做限定。 In this step, an algorithm is used to perform face detection on the picture to obtain the position of the face in the picture, and a range rectangle is used to identify the range of the face, for example (left, top, right, bottom). The first preset number of feature points and the coordinates (x i , y i ) of each face feature point are obtained through the regression function in the trained feature point recognition algorithm for the input portrait photo recognition, where i represents the first The first preset number of i feature points may be 68, including key points of eyebrows, eyes, nose, mouth, and face. For each face feature point, a texture parameter (R i , G i , B i ) representing a second preset number of pixels around the feature point is formed according to its coordinates (x i , y i ) and a Gaussian algorithm. Optionally, the second preset number may be 6, 8 or the like, which is not limited in the present invention.
S1034,将所述人脸特征点信息输入至所述卷积神经网络模型得到第二三维人脸模型参数信息。S1034: Enter the feature point information of the face into the convolutional neural network model to obtain the second three-dimensional face model parameter information.
在本步骤中,卷积神经该算法每次输入的是人脸特征点信息,该人脸特征点信息可以反映当前人脸形状的信息,算法的输出为第二三维人脸模型参数p。该算法使用卷积神经网络拟合从输入到输出的映射函数,网络结构包含了4个卷积层,3个池化层和2个全连接层。通过级联多个卷积神经网络直至在训练集上收敛,根据当前预测的人脸形状更新,并作为下一级卷积神经网络的输入。In this step, the algorithm of the convolutional nerve inputs face feature point information each time. The face feature point information can reflect the current face shape information. The output of the algorithm is the second three-dimensional face model parameter p. The algorithm uses a convolutional neural network to fit the mapping function from input to output. The network structure includes 4 convolutional layers, 3 pooling layers, and 2 fully connected layers. By concatenating multiple convolutional neural networks until convergence on the training set, it is updated according to the currently predicted face shape and used as the input of the next level of convolutional neural network.
该网络的前两个卷积层通过权值共享的方法抽取面部特征,后两个卷积层通过局部感知抽取面部特征,进一步回归一个256维空间的特征向量,输出的一个234维空间的特征向量,第二三维人脸模型参数p。其中包括人脸姿态参数[f,pitch,yaw,roll,t 2dx,t 2dy],形状参数α id,表情参数α exp。其中,f是比例因子、pitch为倾斜角度、yaw为偏转角度、roll为转动角度,t 2dx、t 2dy是偏置项。 The first two convolutional layers of the network extract facial features through weight-sharing methods, and the last two convolutional layers extract facial features through local perception, further returning a feature vector in a 256-dimensional space and outputting a feature in a 234-dimensional space. Vector, the second three-dimensional face model parameter p. These include face pose parameters [f, pitch, yaw, roll, t 2dx , t 2dy ], shape parameters α id , and expression parameters α exp . Among them, f is a scale factor, pitch is a tilt angle, yaw is a deflection angle, roll is a rotation angle, and t 2dx and t 2dy are offset terms.
S1035,利用交叉熵损失函数对所述卷积神经网络的参数进行优化,直至所述第二三维人脸模型参数信息与所述三维人像扫描数据的损失函数收敛到预设阈值。S1035: Optimize parameters of the convolutional neural network by using a cross-entropy loss function until the second three-dimensional face model parameter information and the loss function of the three-dimensional portrait scan data converge to a preset threshold.
在深度学习中,损失函数是模型数据拟合程度的反映,当拟合的结果越差,损失函数的值就会越大。总体上来看,在经过k(k=0,1,...K)次迭后,经过一个初始化的参数的变化后会得到参数p k,根据上述三维人像扫描数据训练一个神经网络Net K来预测参数p,不断的更新p k。该网络用数学公式表示如下: In deep learning, the loss function is a reflection of the degree of fit of the model data. When the result of the fit is worse, the value of the loss function will be larger. Generally speaking, after k (k = 0, 1, ... K) iterations, the parameter p k will be obtained after an initial parameter change, and a neural network Net K is trained according to the above three-dimensional portrait scan data. The prediction parameter p is continuously updated p k . The network is expressed mathematically as follows:
△p k=Net K(I,PNCC(p k)) △ p k = Net K (I, PNCC (p k ))
经过网络模型的每一次迭代都会得到一个更好的参数p k+1=p k+△p k作为下一层网络的输入,其中的结构和Net K一样,直至p k+1与所述三维人像扫描数据的损失函数收敛到预设阈值,说明卷及神经网络模型训练完成。 After each iteration of the network model, a better parameter p k + 1 = p k + △ p k is obtained as the input of the next layer of the network, where the structure is the same as Net K , until p k + 1 is equal to the three-dimensional The loss function of the portrait scan data converges to a preset threshold, indicating that the training of the volume and neural network model is complete.
S104,根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。S104. Process the three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
人脸共性较多,正常人脸都是有一个鼻子、两只眼睛、一个嘴巴、两只耳朵,从上到下,从左到右顺序都不变,所以可以首先建三维平均人脸模型,因为人脸的相 似性较大,总是可以从一张正常人脸变化到另外一张正常人脸,通过计算变化量来改变平均人脸模型,所以这也就是三维人脸重建的基础。Faces have many similarities. Normal faces have one nose, two eyes, one mouth, and two ears. The order from top to bottom and left to right is unchanged, so you can first build a three-dimensional average face model. Because the similarity of faces is large, it is always possible to change from one normal face to another normal face, and the average face model can be changed by calculating the amount of change, so this is also the basis of 3D face reconstruction.
具体地,首先,根据所述人脸形状信息和所述人脸表情信息对所述三维平均人脸模型进行处理,得到初始三维人脸模型。Specifically, first, the three-dimensional average face model is processed according to the face shape information and the facial expression information to obtain an initial three-dimensional face model.
具体地,可以根据如下公式进行处理:Specifically, it can be processed according to the following formula:
S=S 0+A idid+A expexp S = S 0 + A id * α id + A exp * α exp
上式中S是初始三维人脸模型,S 0是平均人脸模型,A id是形状的基向量,α id是形状参数,A exp是表情的基向量,α exp是表情参数。A exp和A exp均是分别利用现有算法预先求得的。 In the above formula, S is the initial three-dimensional face model, S 0 is the average face model, A id is the base vector of the shape, α id is the shape parameter, A exp is the base vector of the expression, and α exp is the expression parameter. A exp and A exp are obtained in advance using existing algorithms respectively.
其次,根据所述人脸姿态信息对所述初始三维人脸图像进行调整,得到所述人脸对应的三维人脸图像。Secondly, the initial three-dimensional face image is adjusted according to the face posture information to obtain a three-dimensional face image corresponding to the face.
具体地,初始三维人脸模型通过弱透视投影将人脸模型投影到图像平面上,得到所述人脸对应的三维人脸图像,公式表示如下:Specifically, the initial three-dimensional face model projects the face model onto the image plane through a weak perspective projection to obtain a three-dimensional face image corresponding to the face, and the formula is expressed as follows:
V(p)=F*Pr*R(S 0+A idα id+A expα exp)+t 2d V (p) = F * Pr * R (S 0 + A id α id + A exp α exp ) + t 2d
上式中V(p)就是重建的所述人脸对应的三维人脸图像,f是比例因子,Pr是直角投影矩阵,R是旋转矩阵,由倾斜角度(pitch)、偏转角度(yaw)、转动角度(roll)组成,是根据特征点识别到的二维图像中人脸的姿态信息得到的。In the above formula, V (p) is the reconstructed three-dimensional face image corresponding to the face, f is a scale factor, Pr is a right-angle projection matrix, and R is a rotation matrix. The tilt angle (pitch), deflection angle (yaw), The rotation angle (roll) is obtained based on the pose information of the human face in the two-dimensional image identified by the feature points.
本发明实施例提供的基于光线的三维人脸优化方法,对在光照环境较差的情况下(例如逆光、侧光等情况)所拍摄的人脸图像进行优化,从而得到清晰的人脸;同时仅需单张图片即可生成三维人脸图像,通过卷积神经网络模型可自动生成更准确和更逼真的人脸表情和姿态,且无需硬件的支持,多方面降低成本。The light-based three-dimensional face optimization method provided by the embodiment of the present invention optimizes a face image taken in a poor lighting environment (such as backlighting, sidelighting, etc.) to obtain a clear human face; Only a single picture can be used to generate a three-dimensional face image. Convolutional neural network models can automatically generate more accurate and realistic face expressions and poses, without the support of hardware, and reduce costs in many ways.
图4为本发明实施例提供的基于光线的三维人脸优化装置结构图。如图4所示,该装置具体包括:判断模块100,优化模块200,获取模块300和处理模块400。其中,FIG. 4 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention. As shown in FIG. 4, the device specifically includes a judgment module 100, an optimization module 200, an acquisition module 300, and a processing module 400. among them,
判断模块100,用于获取目标图片,判断所述目标图片中的人脸图像是否处于非均匀光线条件;优化模块200,用于若所述人脸图像处于非均匀光线条件,将所述人脸图像输入至预先训练的图像生成模型,得到对所述人脸图像进行光线调整后的优化人脸图像;获取模块300,用于基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;处理模块400,用于根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。A judging module 100 is configured to obtain a target picture and determine whether a face image in the target picture is in a non-uniform light condition; an optimization module 200 is configured to, if the face image is in a non-uniform light condition, convert the human face The image is input to a pre-trained image generation model to obtain an optimized face image after light adjustment of the face image; an acquisition module 300 is configured to perform the optimized face image based on a pre-trained convolutional neural network model Processing to obtain first three-dimensional face model parameter information; a processing module 400 for processing a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image .
本发明实施例提供的基于光线的三维人脸优化装置具体用于执行图1所示实施例提供的所述方法,其实现原理、方法和功能用途等与图1所示实施例类似,在此不再赘述。The light-based three-dimensional face optimization device provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1, and its implementation principles, methods, and functional uses are similar to the embodiment shown in FIG. 1, and here No longer.
图5为本发明实施例提供的基于光线的三维人脸优化装置结构图。如图5所示,该装置具体包括:第一训练模块500,第二训练模块600,判断模块100,优化模块200,获取模块300和处理模块400。其中,FIG. 5 is a structural diagram of a light-based three-dimensional face optimization device according to an embodiment of the present invention. As shown in FIG. 5, the device specifically includes: a first training module 500, a second training module 600, a determination module 100, an optimization module 200, an acquisition module 300, and a processing module 400. among them,
判断模块100,用于获取目标图片,判断所述目标图片中的人脸图像是否处于非均匀光线条件;优化模块200,用于若所述人脸图像处于非均匀光线条件,将所述人脸图像输入至预先训练的图像生成模型,得到对所述人脸图像进行光线调整后的优化人脸图像;获取模块300,用于基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;处理模块400,用于根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。A judging module 100 is configured to obtain a target picture and determine whether a face image in the target picture is in a non-uniform light condition; an optimization module 200 is configured to, if the face image is in a non-uniform light condition, convert the human face The image is input to a pre-trained image generation model to obtain an optimized face image after light adjustment of the face image; an acquisition module 300 is configured to perform the optimized face image based on a pre-trained convolutional neural network model Processing to obtain first three-dimensional face model parameter information; a processing module 400 for processing a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image .
第一训练模块500用于,获取训练样本和初始图像生成模型,所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像;利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到所述图像生成模型。The first training module 500 is configured to obtain a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and the first image generated under the front uniform light source condition and the first image generation model. A second image corresponding to one image; using a machine learning method, training the initial image generation model based on the training samples to obtain the image generation model.
第二训练模块600用于,搭建由两层沙漏型卷积神经网络组成的卷积神经网络模型;获取用于训练所述卷积神经网络模型的数据集,所述数据集中包括若干二维人脸图片和所述二维人脸图片对应的三维人像扫描数据;对所述二维人脸图片进行预处理得到人脸特征点信息;将所述人脸特征点信息输入至所述卷积神经网络模型得到第二三维人脸模型参数信息;利用交叉熵损失函数对所述卷积神经网络的参数进行优化,直至所述第二三维人脸模型参数信息与所述三维人像扫描数据的损失函数收敛到预设阈值。The second training module 600 is configured to build a convolutional neural network model composed of a two-layer hourglass-type convolutional neural network; and acquire a data set for training the convolutional neural network model, where the data set includes a plurality of two-dimensional people 3D portrait scan data corresponding to the face picture and the 2D face picture; pre-processing the 2D face picture to obtain face feature point information; and inputting the face feature point information to the convolutional nerve The network model obtains the second three-dimensional face model parameter information; using the cross-entropy loss function to optimize the parameters of the convolutional neural network until the second three-dimensional face model parameter information and the loss function of the three-dimensional portrait scan data Converge to a preset threshold.
可选地,判断模块100用于,对所述目标图片进行处理,得到所述目标图片的灰度直方图;根据所述灰度直方图计算所述目标图片的灰度级分布方差;将所述灰度级分布方差与灰度级分布临界方差进行比较,当所述灰度级分布方差大于或等于所述灰度级分布临界方差时,确定所述目标图片中的人脸图像处于非均匀光线条件。Optionally, the judgment module 100 is configured to process the target picture to obtain a grayscale histogram of the target picture; calculate a grayscale distribution variance of the target picture according to the grayscale histogram; The gray level distribution variance is compared with the gray level distribution critical variance. When the gray level distribution variance is greater than or equal to the gray level distribution critical variance, it is determined that the face image in the target picture is non-uniform. Lighting conditions.
可选地,第一训练模块500还用于,将所述第一图像输入至所述初始图像生成模型中,得到输出的优化第一图像;将所述优化第一图像、所述第二图像作为判别网络的输入,对所述判别网络进行训练,确定训练后的所述判别网络的参数;将所述第一图像作为所述初始图像生成模型的输入,对所述初始图像生成模型进行训练;将训练后的所述初始图像生成模型输出的优化第一图像和所述第二图像输入至所述训练后的所述判别网络,确定所述训练后的所述判别网络的损失函数值;当所述损失函数值收敛,将所述初始图像生成模型确定为所述图像生成模型。Optionally, the first training module 500 is further configured to input the first image into the initial image generation model to obtain an output optimized first image; and to input the optimized first image and the second image As the input of the discrimination network, train the discrimination network to determine the parameters of the discrimination network after training; use the first image as an input to the initial image generation model, and train the initial image generation model ; Inputting the optimized first image and the second image output by the initial image generation model after training to the discrimination network after training, and determining a loss function value of the discrimination network after training; When the value of the loss function converges, the initial image generation model is determined as the image generation model.
本发明实施例提供的基于光线的三维人脸优化装置具体用于执行图1-图3所示实施例提供的所述方法,其实现原理、方法和功能用途和图1-图3所示实施例类似, 在此不再赘述。The light-based three-dimensional face optimization device provided by the embodiment of the present invention is specifically configured to execute the method provided by the embodiment shown in FIG. 1 to FIG. 3, and its implementation principles, methods, and functional uses are as shown in FIG. 1-3. The examples are similar and will not be repeated here.
上述这些本发明实施例的基于光线的三维人脸优化装置可以作为其中一个软件或者硬件功能单元,独立设置在上述电子设备中,也可以作为整合在处理器中的其中一个功能模块,执行本发明实施例的基于光线的三维人脸优化方法。The above-mentioned light-based three-dimensional face optimization device according to the embodiments of the present invention may be used as one of the software or hardware functional units, independently set in the above-mentioned electronic device, or may be implemented as one of the functional modules integrated in the processor to execute the present invention. A method for optimizing a three-dimensional human face based on light according to an embodiment.
图6为执行本发明方法实施例提供的基于光线的三维人脸优化方法的电子设备的硬件结构示意图。根据图6所示,该电子设备包括:FIG. 6 is a schematic diagram of a hardware structure of an electronic device that performs a light-based three-dimensional face optimization method according to an embodiment of the method of the present invention. According to FIG. 6, the electronic device includes:
一个或多个处理器610以及存储器620,图6中以一个处理器610为例。One or more processors 610 and a memory 620. One processor 610 is taken as an example in FIG. 6.
执行所述的基于光线的三维人脸优化方法的设备还可以包括:输入装置630和输出装置630。The device for performing the light-based three-dimensional face optimization method may further include: an input device 630 and an output device 630.
处理器610、存储器620、输入装置630和输出装置640可以通过总线或者其他方式连接,图6中以通过总线连接为例。The processor 610, the memory 620, the input device 630, and the output device 640 may be connected through a bus or other methods. In FIG. 6, the connection through the bus is taken as an example.
存储器620作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块,如本发明实施例中的所述基于光线的三维人脸优化方法对应的程序指令/模块。处理器610通过运行存储在存储器620中的非易失性软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现所述基于光线的三维人脸优化方法。The memory 620 is a non-volatile computer-readable storage medium, and can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the light-based three-dimensional person in the embodiment of the present invention. Program instructions / modules corresponding to the face optimization method. The processor 610 executes various functional applications and data processing of the server by running non-volatile software programs, instructions, and modules stored in the memory 620, that is, implementing the light-based three-dimensional face optimization method.
存储器620可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据本发明实施例提供的基于光线的三维人脸优化装置的使用所创建的数据等。此外,存储器620可以包括高速随机存取存储器620,还可以包括非易失性存储器620,例如至少一个磁盘存储器620件、闪存器件、或其他非易失性固态存储器620件。在一些实施例中,存储器620可选包括相对于处理器66远程设置的存储器620,这些远程存储器620可以通过网络连接至所述基于光线的三维人脸优化装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 620 may include a storage program area and a storage data area, where the storage program area may store an operating system and an application program required for at least one function; the storage data area may store a light-based three-dimensional face optimization provided according to an embodiment of the present invention Data created using the device, etc. In addition, the memory 620 may include a high-speed random access memory 620, and may further include a non-volatile memory 620, such as at least one magnetic disk memory 620, a flash memory device, or other non-volatile solid-state memory 620. In some embodiments, the memory 620 may optionally include a memory 620 remotely disposed with respect to the processor 66, and these remote memories 620 may be connected to the light-based three-dimensional face optimization device through a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
输入装置630可接收输入的数字或字符信息,以及产生与基于光线的三维人脸优化装置的用户设置以及功能控制有关的键信号输入。输入装置630可包括按压模组等设备。The input device 630 may receive inputted numeric or character information, and generate key signal inputs related to user settings and function control of a light-based three-dimensional face optimization device. The input device 630 may include a device such as a pressing module.
所述一个或者多个模块存储在所述存储器620中,当被所述一个或者多个处理器610执行时,执行所述基于光线的三维人脸优化方法。The one or more modules are stored in the memory 620, and when executed by the one or more processors 610, execute the light-based three-dimensional face optimization method.
本发明实施例的电子设备以多种形式存在,包括但不限于:The electronic devices in the embodiments of the present invention exist in various forms, including but not limited to:
(1)移动通信设备:这类设备的特点是具备移动通信功能,并且以提供话音、数据通信为主要目标。这类终端包括:智能手机(例如iPhone)、多媒体手机、功能性手机,以及低端手机等。(1) Mobile communication equipment: This type of equipment is characterized by mobile communication functions, and its main goal is to provide voice and data communication. Such terminals include: smart phones (such as iPhone), multimedia phones, feature phones, and low-end phones.
(2)超移动个人计算机设备:这类设备属于个人计算机的范畴,有计算和处理功 能,一般也具备移动上网特性。这类终端包括:PDA、MID和UMPC设备等,例如iPad。(2) Ultra-mobile personal computer equipment: This type of equipment belongs to the category of personal computers, has computing and processing functions, and generally has the characteristics of mobile Internet access. Such terminals include: PDA, MID and UMPC devices, such as iPad.
(3)便携式娱乐设备:这类设备可以显示和播放多媒体内容。该类设备包括:音频、视频播放器(例如iPod),掌上游戏机,电子书,以及智能玩具和便携式车载导航设备。(3) Portable entertainment equipment: This type of equipment can display and play multimedia content. Such devices include: audio and video players (such as iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices.
(4)其他具有数据交互功能的电子装置。(4) Other electronic devices with data interaction functions.
优选的,所述电子设备上设置有用于获取图像的图像获取设备,图像获取设备上为保证获取图像的质量往往设置有软件或硬件防抖器。现有的防抖器大多由通电线圈在磁场中产生洛伦磁力驱动镜头移动,而要实现光学防抖,需要在至少两个方向上驱动镜头,这意味着需要布置多个线圈,会给整体结构的微型化带来一定挑战,而且容易受外界磁场干扰,进而影响防抖效果,因此公开号为CN106131435A的中国专利提供了一种微型光学防抖摄像头模组,其通过温度变化实现记忆合金丝的拉伸和缩短,以此拉动自动聚焦音圈马达移动,实现镜头的抖动补偿,微型记忆合金光学防抖致动器的控制芯片可以控制驱动信号的变化来改变记忆合金丝的温度,以此控制记忆合金丝的伸长和缩短,并且根据记忆合金丝的电阻来计算致动器的位置和移动距离。当微型记忆合金光学防抖致动器上移动到指定位置后反馈记忆合金丝此时的电阻,通过比较这个电阻值与目标值的偏差,可以校正微型记忆合金光学防抖致动器上的移动偏差。Preferably, an image acquisition device for acquiring an image is provided on the electronic device, and a software or hardware image stabilizer is often provided on the image acquisition device to ensure the quality of the acquired image. Most of the existing image stabilizers are powered by coils that generate Loren magnetic force in the magnetic field to drive the lens. To achieve optical image stabilization, the lens needs to be driven in at least two directions, which means that multiple coils need to be arranged, which will give the whole The miniaturization of the structure brings certain challenges, and it is easy to be affected by external magnetic fields, which will affect the anti-shake effect. Therefore, the Chinese patent published as CN106131435A provides a miniature optical anti-shake camera module, which realizes memory alloy wires through temperature changes. Stretching and shortening to pull the auto-focusing voice coil motor to achieve lens shake compensation. The control chip of the micro memory alloy optical anti-shake actuator can control the change of the driving signal to change the temperature of the memory alloy wire. Control the elongation and shortening of the memory alloy wire, and calculate the position and moving distance of the actuator based on the resistance of the memory alloy wire. When the micro memory alloy optical image stabilization actuator moves to the specified position, the resistance of the memory alloy wire at this time is fed back. By comparing the deviation of this resistance value and the target value, the movement on the micro memory alloy optical image stabilization actuator can be corrected. deviation.
但是申请人发现,由于抖动的随机性和不确定性,仅仅依靠上述技术方案的结构是无法实现在多次抖动发生的情况下能够对镜头进行精确的补偿,这是由于形状记忆合金的升温和降温均需要一定的时间,当抖动向第一方向发生时,上述技术方案可以实现镜头对第一方向抖动的补偿,但是当随之而来的第二方向的抖动发生时,由于记忆合金丝来不及在瞬间变形,因此容易造成补偿不及时,无法精准实现对多次抖动和不同方向的连续抖动的镜头抖动补偿,因此需要对其结构上进行改进,以期获得更好的图像质量,从而便于后续三维图像的生成。However, the applicant found that due to the randomness and uncertainty of the shake, the structure of the above technical solution alone cannot achieve accurate compensation of the lens in the case of multiple shakes. This is due to the rising temperature and shape of the shape memory alloy. It takes a certain amount of time to cool down. When the shake occurs in the first direction, the above technical solution can compensate the lens for the shake in the first direction, but when the subsequent shake in the second direction occurs, it is too late due to the memory alloy wire. Deformation in an instant, so it is easy to cause untimely compensation, and it is impossible to accurately realize lens shake compensation for multiple shakes and continuous shakes in different directions. Therefore, it is necessary to improve its structure in order to obtain better image quality and facilitate subsequent 3D Image generation.
结合附图8-10所示,本实施例对学防抖器进行改进,将其设计为机械防抖器3000,其具体结构如下:With reference to Figures 8-10, this embodiment improves the anti-shake device and designs it as a mechanical anti-shake device 3000. The specific structure is as follows:
本实施例的所述机械防抖器3000包括活动板3100、基板3200以及补偿机构3300,所述活动板3100和所述基板3200的中部均设有所述镜头1000穿过的通孔,所述自动聚焦音圈马达2000安装在所述活动板3100上,所述活动板3100安装在所述基板3200上,且所述基板3200的尺寸大于所述活动板3100,所述活动板3100通过其上方的自动聚焦音圈马达限位其上下的移动,所述补偿机构3300在所述处理模块的驱动下带动所述活动板3100和活动板3100上的镜头1000动作,以实现镜头1000的抖动补偿。The mechanical image stabilizer 3000 of this embodiment includes a movable plate 3100, a base plate 3200, and a compensation mechanism 3300. Each of the movable plate 3100 and the base plate 3200 is provided with a through hole through which the lens 1000 passes. An autofocus voice coil motor 2000 is mounted on the movable plate 3100, and the movable plate 3100 is mounted on the base plate 3200. The size of the base plate 3200 is larger than the movable plate 3100, and the movable plate 3100 passes above it. The auto-focusing voice coil motor limits its up and down movement, and the compensation mechanism 3300 drives the movable plate 3100 and the lens 1000 on the movable plate 3100 to move under the driving of the processing module to achieve shake compensation of the lens 1000.
具体的,本实施例的所述补偿机构3300包括安装在所述基板3200四周的第一补偿组件3310、第二补偿组件3320、第三补偿组件3330以及第四补偿组件3340,其中所述第一补偿组件3310和所述第三补偿组件3330相对设置,所述第二补偿组件 3320与所述第四补偿组件3340相对设置,所述第一补偿组件3310与第三补偿组件3330之间的连线与所述第一补偿组件3310与第三补偿组件3330之间的连线相互垂直,即一补偿组件、第二补偿组件3320、第三补偿组件3330分别布设在活动板3100的前后左右四个方位,第一补偿组件3310可使得活动板3100向前运动,第三补偿组件3330可使得活动板3100向后运动,第二补偿组件3320可使得活动板3100向左运动,第四补偿组件3340可使得活动板3100向左运动,而且第一补偿组件3310可以与第二补偿组件3320或者第四补偿组件3340相配合实现活动板3100向倾斜方向的运动,第三补偿组件3330也可以与第二补偿组件3320或者第四补偿组件3340相配合实现活动板3100向倾斜方向的运动,实现可以对镜头1000在各个抖动方向上的补偿。Specifically, the compensation mechanism 3300 in this embodiment includes a first compensation component 3310, a second compensation component 3320, a third compensation component 3330, and a fourth compensation component 3340 installed around the substrate 3200. A compensation component 3310 and the third compensation component 3330 are disposed opposite to each other, the second compensation component 3320 is disposed opposite to the fourth compensation component 3340, and a connection line between the first compensation component 3310 and the third compensation component 3330 The connection lines between the first compensation component 3310 and the third compensation component 3330 are perpendicular to each other, that is, a compensation component, a second compensation component 3320, and a third compensation component 3330 are respectively arranged in the front, rear, left, and right directions of the movable plate 3100. The first compensation component 3310 can make the movable plate 3100 move forward, the third compensation component 3330 can make the movable plate 3100 move backward, the second compensation component 3320 can make the movable plate 3100 move left, and the fourth compensation component 3340 can make The movable plate 3100 moves to the left, and the first compensation component 3310 can cooperate with the second compensation component 3320 or the fourth compensation component 3340 to realize the operation of the movable plate 3100 in an inclined direction. , The third component 3330 may be compensated 1000 compensation and the second compensation component 3320 or the fourth compensation component 3340 cooperate to achieve movement of the movable plate 3100 to the tilt direction, the lens implemented in the respective direction of jitter.
具体的,本实施例的所述第一补偿组件3310、第二补偿组件3320、第三补偿组件3330以及第四补偿组件3340均包括驱动件3301、转轴3302、单向轴承3303以及转动齿圈3304。所述驱动件3301受控于所述处理模块,所述驱动件3301与所述转轴3302传动连接,以带动所述转轴3302转动。所述转轴3302与所述单向轴承3303的内圈相连接,以带动所述单向轴承3303的内圈转动;所述转动齿圈3304套设在所述单向轴承3303上并与所述单向轴承3303的外圈固定连接,所述转动齿圈3304的外表面沿其周向设有一圈外齿,所述活动板3100的底面设有多排均匀间隔布设的条形槽3110,所述条形槽3110与所述外齿相啮合,且所述外齿可沿所述条形槽3110的长度方向滑动;其中,所述第一补偿组件3310的单向轴承3303的可转动方向与所述第三补偿组件3330的单向轴承3303的可转动方向相反,所述第二补偿组件3320的单向轴承3303的可转动方向与所述第四补偿组件3340的单向轴承3303的可转动方向相反。Specifically, the first compensation component 3310, the second compensation component 3320, the third compensation component 3330, and the fourth compensation component 3340 in this embodiment each include a driving member 3301, a rotating shaft 3302, a one-way bearing 3303, and a rotating ring gear 3304. . The driving member 3301 is controlled by the processing module, and the driving member 3301 is drivingly connected to the rotating shaft 3302 to drive the rotating shaft 3302 to rotate. The rotating shaft 3302 is connected to the inner ring of the one-way bearing 3303 to drive the inner ring of the one-way bearing 3303 to rotate. The rotating ring gear 3304 is sleeved on the one-way bearing 3303 and is connected to the one-way bearing 3303. The outer ring of the one-way bearing 3303 is fixedly connected. The outer surface of the rotating ring gear 3304 is provided with a ring of external teeth along its circumferential direction. The shaped groove 3110 is meshed with the external teeth, and the external teeth can slide along the length direction of the strip groove 3110; wherein the rotatable direction of the one-way bearing 3303 of the first compensation component 3310 and the external teeth The rotation direction of the one-way bearing 3303 of the third compensation component 3330 is opposite, and the rotation direction of the one-way bearing 3303 of the second compensation component 3320 is opposite to the rotation direction of the one-way bearing 3303 of the fourth compensation component 3340. .
单向轴承3303是在一个方向上可以自由转动,而在另一个方向上锁死的一种轴承,当需要使得活动板3100向前移动时,第一补偿组件3310的驱动件3301使得转轴3302带动单向轴承3303的内圈转动,此时,单向轴承3303处于锁死状态,因此单向轴承3303的内圈可以带动外圈转动,进而带动转动齿圈3304转动,转动齿圈3304通过与条形槽3110的啮合带动活动板3100向可以补偿抖动的方向运动;当抖动补偿后需要活动板3100复位时,可以通过第三补偿组件3330带动活动板3100转动,第三补偿组件3330的运行过程过程与第一补偿组件3310同理,此时,第一补偿组件3310的单向轴承3303处于可转动状态,因此第一补偿组件3310上的齿圈为与活动板3100随动状态,不会影响活动板3100的复位。One-way bearing 3303 is a bearing that can rotate freely in one direction and lock in the other direction. When the movable plate 3100 needs to be moved forward, the driving member 3301 of the first compensation component 3310 causes the rotating shaft 3302 to drive The inner ring of the one-way bearing 3303 rotates. At this time, the one-way bearing 3303 is locked. Therefore, the inner ring of the one-way bearing 3303 can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate. The engagement of the groove 3110 drives the movable plate 3100 to move in a direction that can compensate for shake. When the movable plate 3100 needs to be reset after shake compensation, the third compensation component 3330 can be used to drive the movable plate 3100 to rotate. The operation process of the third compensation component 3330 Similar to the first compensation component 3310, at this time, the one-way bearing 3303 of the first compensation component 3310 is in a rotatable state, so the ring gear on the first compensation component 3310 follows the movable plate 3100, and will not affect the activity Reset of board 3100.
优选的,为了降低整个机械防抖器3000的整体厚度,本实施例在所述固定板的四周开设有四个贯穿的安装孔(图中未示出),所述安装孔上安装有所述单向轴承3303和所述转动齿圈3304,通过将单向轴承3303和转动齿圈3304的部分隐藏在安装孔内,以降低整个机械防抖器3000的整体厚度。或者直接将整个补偿组件的部分 置于所述安装孔内。Preferably, in order to reduce the overall thickness of the entire mechanical image stabilizer 3000, in this embodiment, four through-holes (not shown in the drawings) are provided on the periphery of the fixing plate, and the mounting holes are provided with the mounting holes. The one-way bearing 3303 and the rotating ring gear 3304 can reduce the overall thickness of the entire mechanical vibration stabilizer 3000 by concealing parts of the one-way bearing 3303 and the rotating ring gear 3304 in the mounting holes. Alternatively, a part of the entire compensation assembly may be directly placed in the mounting hole.
具体,本实施例的所述驱动件3301可以是微型电机,所述微型电机与所述处理模块电连接,所述微型电机的转动输出端与所述转轴3302相连接,所述微型电机受控于所述处理模块。或者,所述驱动件3301由记忆合金丝和曲柄连杆组成,所述记忆合金丝一端固定于所述固定板上,并与所述处理模块通过电路相连接,所述记忆合金丝另一端通过所述曲柄连杆与所述转轴3302相连接,以带动所述转轴3302转动,具体为处理模块根据陀螺仪的反馈计算出记忆合金丝的伸长量,并驱动相应的电路对该形状记忆合金丝进行升温,该形状记忆合金丝伸长带动曲柄连杆机构运动,曲柄连杆机构的曲柄带动转轴3302转动,使得单向轴承3303的内圈转动,单向轴承3303处于锁死状态时,内圈带动外圈转动,转动齿圈3304通过条形槽3110带动活动板3100运动。Specifically, the driving member 3301 in this embodiment may be a micro motor, the micro motor is electrically connected to the processing module, a rotation output end of the micro motor is connected to the rotating shaft 3302, and the micro motor is controlled To the processing module. Alternatively, the driving member 3301 is composed of a memory alloy wire and a crank connecting rod. One end of the memory alloy wire is fixed on the fixing plate and is connected to the processing module through a circuit. The other end of the memory alloy wire passes The crank link is connected to the rotating shaft 3302 to drive the rotating shaft 3302 to rotate. Specifically, the processing module calculates the elongation of the memory alloy wire according to the feedback from the gyroscope, and drives the corresponding circuit to the shape memory alloy. The temperature of the wire is increased, and the shape memory alloy wire is stretched to drive the crank link mechanism. The crank of the crank link mechanism drives the rotation shaft 3302 to rotate the inner ring of the one-way bearing 3303. When the one-way bearing 3303 is locked, the inner The ring drives the outer ring to rotate, and the rotating ring gear 3304 drives the movable plate 3100 through the strip groove 3110.
下面结合上述结构对本实施例的机械防抖器3000的工作过程进行详细的描述,以镜头1000两次抖动为例,两次抖动方向相反,且需要使得活动板3100向前运动补偿一次,并随后向左运动补偿一次。需要活动板3100向前运动补偿时,陀螺仪事先将检测到的镜头1000抖动方向和距离反馈给所述处理模块,处理模块计算出需要活动板3100的运动距离,进而驱动第一补偿组件3310的驱动件3301使得转轴3302带动单向轴承3303的内圈转动,此时,单向轴承3303处于锁死状态,因此内圈可以带动外圈转动,进而带动转动齿圈3304转动,转动齿圈3304通过条形槽3110带动活动板3100向前运动,随后第三补偿组件3330带动活动板3100复位。需要活动板3100向左运动补偿时,陀螺仪事先将检测到的镜头1000抖动方向和距离反馈给所述处理模块,处理模块计算出需要活动板3100的运动距离,进而驱动第二补偿组件3320的驱动件3301使得转轴3302带动单向轴承3303的内圈转动,此时,单向轴承3303处于锁死状态,因此内圈可以带动外圈转动,进而带动转动齿圈3304转动,转动齿圈3304通过条形槽3110带动活动板3100向前运动,而且由于转动齿圈3304的外齿可沿所述条形槽3110的长度方向滑动,在活动板3100向左运动时,活动板3100与第一补偿组件3310和第三补偿组件3330之间为滑动配合,不会影响活动板3100向左运动,在补偿结束后,再通过第四补偿组件3340带动活动板3100复位。The following describes the working process of the mechanical image stabilizer 3000 of this embodiment in detail in combination with the above structure. Taking the lens 1000 as an example of two shakes, the directions of the two shakes are opposite, and the movable plate 3100 needs to be compensated for forward motion, and then Left motion compensation once. When forward motion compensation of the movable plate 3100 is required, the gyroscope feeds the detected lens 1000 shake direction and distance in advance to the processing module. The processing module calculates the required movement distance of the movable plate 3100, and then drives the first compensation component 3310. The driving member 3301 causes the rotating shaft 3302 to drive the inner ring of the one-way bearing 3303. At this time, the one-way bearing 3303 is locked, so the inner ring can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate, and the rotating ring gear 3304 passes The strip groove 3110 drives the movable plate 3100 to move forward, and then the third compensation component 3330 drives the movable plate 3100 to reset. When the motion board 3100 needs motion compensation to the left, the gyroscope feeds back the detected lens 1000 shake direction and distance to the processing module in advance, and the processing module calculates the motion distance required for the motion board 3100 to drive the second compensation component 3320. The driving member 3301 causes the rotating shaft 3302 to drive the inner ring of the one-way bearing 3303. At this time, the one-way bearing 3303 is locked, so the inner ring can drive the outer ring to rotate, which in turn drives the rotating ring gear 3304 to rotate, and the rotating ring gear 3304 passes The strip groove 3110 drives the movable plate 3100 to move forward, and because the external teeth of the ring gear 3304 can slide along the length direction of the strip groove 310, when the movable plate 3100 moves to the left, the movable plate 3100 and the first compensation The sliding fitting between the component 3310 and the third compensation component 3330 does not affect the leftward movement of the movable plate 3100. After the compensation is completed, the fourth compensation component 3340 is used to drive the movable plate 3100 to reset.
当然上述仅仅为简单的两次抖动,当发生多次抖动时,或者抖动的方向并非往复运动时,可以通过驱动多个补偿组件以补偿抖动,其基础工作过程与上述描述原理相同,这里不过多赘述,另外关于形状记忆合金电阻的检测反馈、陀螺仪的检测反馈等均为现有技术,这里也不过多描述。Of course, the above is just two simple jitters. When multiple jitters occur or the direction of the jitter is not reciprocating, you can drive multiple compensation components to compensate for the jitter. The basic working process is the same as the principle described above. To repeat, in addition, the detection feedback of the shape memory alloy resistance and the detection feedback of the gyroscope are existing technologies, and are not described here too.
结合上述说明可知,本实施例提供的机械补偿器不仅不会受到外界磁场干扰,防抖效果好,而且可以实现在多次抖动发生的情况下能够对镜头1000进行精确的补偿,补偿及时准确,大大改善改了获取图像的质量,简化了后续三维图像的处理难度。Based on the above description, it can be known that the mechanical compensator provided by this embodiment not only is not affected by external magnetic fields and has a good anti-shake effect, but also can accurately compensate the lens 1000 in the case of multiple shakes, and the compensation is timely and accurate. Greatly improved the quality of the acquired images, and simplified the difficulty of subsequent 3D image processing.
进一步地,电子设备包括带有所述图像获取设备的手机。该手机包括支架,手 机支架的目的是由于图像获取环境的不确定性,因此需要使用支架对手机进行支撑和固定,以期获得更稳定的图像质量。Further, the electronic device includes a mobile phone with the image acquisition device. The mobile phone includes a stand. The purpose of the mobile phone stand is due to the uncertainty of the image acquisition environment, so the phone needs to be supported and fixed with a stand in order to obtain more stable image quality.
另外,申请人发现,现有的手机支架仅仅具有支撑手机的功能,而不具有自拍杆的功能,因此申请人对支架做出第一步改进,将手机支架6000和支撑杆6200相结合,结合附图11所示,本实施例的所述支架6000包括手机安装座6100和可伸缩的支撑杆6200,支撑杆6200与手机安装座6100的中部(具体为下述基板3200的中部)通过阻尼铰链相连接,使得支撑杆6200在转动至图12的状态时,支架6000可形成自拍杆结构,而支撑杆6200在转动至图13的状态时,支架6000可形成手机支架6000结构。In addition, the applicant found that the existing mobile phone holder only has the function of supporting the mobile phone, but does not have the function of a selfie stick. Therefore, the applicant made the first step of improving the holder, combining the mobile phone holder 6000 and the support rod 6200. As shown in FIG. 11, the bracket 6000 in this embodiment includes a mobile phone mounting base 6100 and a retractable supporting rod 6200. The supporting rod 6200 and the middle portion of the mobile phone mounting base 6100 (specifically, the middle portion of the substrate 3200 described below) pass through a damping hinge. When the supporting rod 6200 is rotated to the state of FIG. 12, the bracket 6000 may form a selfie stick structure, and when the supporting rod 6200 is rotated to the state of FIG. 13, the bracket 6000 may form a mobile phone bracket 6000 structure.
而结合上述支架结构申请人又发现,手机安装座6100与支撑杆6200结合后占用空间较大,即使支撑杆6200可伸缩,但是手机安装座6100无法进行结构的变化,体积不会进一步缩小,无法将其放入衣兜或者小型的包内,造成支架6000携带不便的问题,因此本实施例对支架6000做出第二步改进,使得支架6000的整体收容性得到进一步的提高。In combination with the above bracket structure, the applicant also found that the combination of the mobile phone mounting base 6100 and the support pole 6200 takes up a lot of space. Even if the support pole 6200 is retractable, the mobile phone mounting base 6100 cannot undergo structural changes and the volume will not be further reduced. Putting it in a pocket or a small bag causes the inconvenience of carrying the bracket 6000. Therefore, in this embodiment, a second step improvement is performed on the bracket 6000, so that the overall accommodation of the bracket 6000 is further improved.
结合图12-14所示,本实施例的所述手机安装座6100包括可伸缩的连接板6110和安装于连接板6110相对两端的折叠板组6120,所述支撑杆6200与所述连接板6110中部通过阻尼铰链相连接;所述折叠板组6120包括第一板体6121、第二板体6122及第三板体6123,其中,所述第一板体6121的相对两端中的一端与所述连接板6110相铰接,所述第一板体6121的相对两端中的另一端与所述第二板体6122的相对两端中的一端相铰接;所述第二板体6122相对两端的另一端与所述第三板体6123相对两端中的一端相铰接;所述第二板体6122设有供手机边角插入的开口6130。As shown in FIGS. 12-14, the mobile phone mounting base 6100 of this embodiment includes a retractable connection plate 6110 and a folding plate group 6120 installed at opposite ends of the connection plate 6110. The support rod 6200 and the connection plate 6110 The middle part is connected by a damping hinge; the folding plate group 6120 includes a first plate body 6121, a second plate body 6122, and a third plate body 6123, wherein one of the two opposite ends of the first plate body 6121 is connected to the first plate body 6121. The connecting plate 6110 is hinged, the other end of the opposite ends of the first plate body 6121 is hinged to one of the opposite ends of the second plate body 6122, and the opposite ends of the second plate body 6122 are The other end is hinged to one of opposite ends of the third plate body 6123; the second plate body 6122 is provided with an opening 6130 for inserting a corner of the mobile phone.
结合附图14所示,所述手机安装座6100用于安装手机时,所述第一板体6121、第二板体6122和第三板体6123折叠呈直角三角形状态,所述第二板体6122为直角三角形的斜边,所述第一板体6121和所述第三板体6123为直角三角形的直角边,其中,所述第三板体6123的一个侧面与所述连接板6110的一个侧面并排贴合,所述第三板体6123相对两端中的另一端与所述第一板体6121相对两端中的一端相抵,该结构可以使得三个折叠板处于自锁状态,并且将手机下部的两个边角插入到两侧的两个开口6130时,手机5000的下部两侧位于两个直角三角形内,通过手机、连接板6110和折叠板组6120件的共同作可以完成手机5000的固定,三角形状态在外力情况下无法打开,只有从开口6130抽出手机后才能解除折叠板组6120件的三角形状态。As shown in FIG. 14, when the mobile phone mounting base 6100 is used to install a mobile phone, the first plate body 6121, the second plate body 6122 and the third plate body 6123 are folded into a right triangle state, and the second plate body 6122 is a hypotenuse of a right-angled triangle, and the first plate body 6121 and the third plate 6123 are right-angled sides of a right triangle, wherein one side of the third plate body 6123 and one of the connection plate 6110 The sides are attached side by side, and the other end of the opposite ends of the third plate body 6123 and one of the opposite ends of the first plate body 6121 abut against each other. This structure can make the three folding plates in a self-locking state, and When the two corners of the lower part of the mobile phone are inserted into the two openings 6130 on both sides, the lower sides of the mobile phone 5000 are located in two right-angled triangles. The mobile phone 5000 can be completed through the joint work of the mobile phone, the connecting plate 6110, and the folding plate group 6120. The triangle state cannot be opened under external force. The triangle state of 6120 pieces of folding plate group can only be released after the mobile phone is pulled out from the opening 6130.
而在手机安装座6100不处于工作状态时,将连接板6110缩小至最小长度,并且将折叠板组6120件与连接板6110相互折叠,用户可以将手机安装座6100折叠呈最小体积,而由于支撑杆6200的可伸缩性,因此可以将整个支架6000收容呈体积最小的状态,提高了支架6000的收荣幸,用户甚至可以直接将支架6000放入衣兜或小的手包内,十分方便。When the mobile phone mounting base 6100 is not in working state, the connecting plate 6110 is reduced to a minimum length, and the folding plate group 6120 and the connecting plate 6110 are folded to each other. The user can fold the mobile phone mounting base 6100 to a minimum volume, and due to the support The scalability of the lever 6200 allows the entire bracket 6000 to be accommodated in the smallest volume, which improves the collection of the bracket 6000. Users can even put the bracket 6000 directly into their pockets or small handbags, which is very convenient.
优选的,本实施例还在所述第三板体6123的一个侧面设有第一连接部,所述连接板6110与所述第三板体6123相贴合的侧面设有与所述第一连接部相配合的第一配合部,所述支架6000手机安装座6100用于安装手机时,所述第一连接部和所述第一配合部卡合连接。具体的,本实施例的第一连接部为一个凸条或凸起(图中未示出),第一配合部为开设在连接板6110上的卡槽(图中未示出)。该结构不仅提高了折叠板组6120件处于三角形状态时的稳定性,而且在需要将手机安装座6100折叠至最小状态时也便于折叠板组6120件与连接板6110的连接。Preferably, in this embodiment, a first connection portion is also provided on one side of the third plate body 6123, and a side surface where the connection plate 6110 is in contact with the third plate body 6123 is provided with the first connection portion. A first mating portion that mates with a connecting portion. When the bracket 6000 mobile phone mounting base 6100 is used to mount a mobile phone, the first connecting portion and the first mating portion are snap-fitted. Specifically, the first connecting portion of this embodiment is a convex strip or protrusion (not shown in the figure), and the first matching portion is a card slot (not shown in the figure) opened on the connecting plate 6110. This structure not only improves the stability when the 6120 pieces of the folding plate group are in a triangle state, but also facilitates the connection between the 6120 pieces of the folding plate group and the connecting plate 6110 when the mobile phone mounting base 6100 needs to be folded to a minimum state.
优选的,本实施例还在所述第一板体6121相对两端中的一端设有第二连接部,所述第三板体6123相对两端中的另一端设有与所述第二连接部相配合的第二配合部,所述支架6000手机安装座6100用于安装手机时,所述第二连接部和所述第二配合部卡合连接。第二连接部可以是凸起(图中未示出),第二配合部为与凸起相配合的开口6130或卡槽(图中未示出)。该结构提高了叠板组件处于三角形状态时的稳定性Preferably, in this embodiment, a second connection portion is also provided at one end of the opposite ends of the first plate body 6121, and the other end of the opposite ends of the third plate body 6123 is provided with the second connection portion. When the bracket 6000 is used to install a mobile phone, the second connecting portion is a second matching portion that is matched with the second fitting portion, and the second connecting portion and the second fitting portion are engaged and connected. The second connecting portion may be a protrusion (not shown in the figure), and the second mating portion is an opening 6130 or a card slot (not shown in the figure) that cooperates with the protrusion. This structure improves the stability when the laminated board assembly is in a triangular state
另外,本实施例还可以在所述支撑杆6200的另一端可拆卸连接有底座(图中未示出),在需要固定手机并且使手机5000具有一定高度时,可以将支撑杆6200拉伸呈一定长度,并通过底座将支架6000置于一个平面上,再将手机放置到手机安装座6100内,完成手机的固定;而支撑杆6200和底座的可拆卸连接可以使得两者可以单独携带,进一步提高了支架6000的收容性和携带的方便性。In addition, in this embodiment, a base (not shown in the figure) can be detachably connected to the other end of the support rod 6200. When the mobile phone needs to be fixed and the mobile phone 5000 has a certain height, the support rod 6200 can be stretched to A certain length and place the bracket 6000 on a plane through the base, and then place the mobile phone in the mobile phone mounting base 6100 to complete the fixing of the mobile phone; and the detachable connection of the support bar 6200 and the base can make the two can be carried separately, further The accommodating of the bracket 6000 and the convenience of carrying are improved.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。The device embodiments described above are only schematic, and the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, which may be located in One place, or can be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the objective of the solution of this embodiment. Those of ordinary skill in the art can understand and implement without creative labor.
本发明实施例提供了一种非暂态计算机可读存存储介质,所述计算机存储介质存储有计算机可执行指令,其中,当所述计算机可执行指令被电子设备执行时,使所述电子设备上执行上述任意方法实施例中的基于光线的三维人脸优化方法。An embodiment of the present invention provides a non-transitory computer-readable storage storage medium, where the computer storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by an electronic device, the electronic device is caused The three-dimensional face optimization method based on light in any of the method embodiments described above is performed.
本发明实施例提供了一种计算机程序产品,其中,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算机程序,所述计算机程序包括程序指令,其中,当所述程序指令被电子设备执行时,使所述电子设备执行上述任意方法实施例中的基于光线的三维人脸优化方法。An embodiment of the present invention provides a computer program product, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions When executed by an electronic device, the electronic device is caused to execute the light-based three-dimensional face optimization method in any of the foregoing method embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到各实施方式可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件。基于这样的理解,上述技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,所述计算机可读记录介质包括用于以计算机(例如计算机)可读的形式存储或传送信息的任何机制。 例如,机器可读介质包括只读存储器(ROM)、随机存取存储器(RAM)、磁盘存储介质、光存储介质、闪速存储介质、电、光、声或其他形式的传播信号(例如,载波、红外信号、数字信号等)等,该计算机软件产品包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行各个实施例或者实施例的某些部分所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware. Based on such an understanding, the above-mentioned technical solution in essence or a part that contributes to the existing technology may be embodied in the form of a software product, and the computer software product may be stored in a computer-readable storage medium, the computer-readable record A medium includes any mechanism for storing or transmitting information in a form readable by a computer (eg, a computer). For example, machine-readable media include read-only memory (ROM), random-access memory (RAM), magnetic disk storage media, optical storage media, flash storage media, electrical, optical, acoustic, or other forms of propagation signals (e.g., carrier waves , Infrared signals, digital signals, etc.), the computer software product includes a number of instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute various embodiments or certain parts of the embodiments Methods.
最后应说明的是:以上实施例仅用以说明本发明实施例的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。In the end, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than limiting them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: The technical solutions described in the foregoing embodiments can still be modified, or some of the technical features are equivalently replaced; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and range.

Claims (10)

  1. 一种基于光线的三维人脸优化方法,其特征在于,包括:A light-based three-dimensional face optimization method, which is characterized by:
    判断获取的目标图片中的人脸图像是否光照不均匀;Determine whether the face image in the obtained target picture is unevenly lit;
    若所述人脸图像存在光照不均匀现象,则对所述人脸图像进行光线调整,以获得优化人脸图像;If the face image has uneven illumination, performing light adjustment on the face image to obtain an optimized face image;
    基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;Processing the optimized face image based on a pre-trained convolutional neural network model to obtain the first three-dimensional face model parameter information;
    根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。The three-dimensional average face model is processed according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
  2. 根据权利要求1所述的方法,其特征在于,所述判断获取的目标图片中的人脸图像是否光照不均匀的步骤包括:The method according to claim 1, wherein the step of determining whether the face image in the obtained target picture has uneven illumination includes:
    获得所述目标图片的灰度直方图;Obtaining a grayscale histogram of the target picture;
    根据所述灰度直方图计算所述目标图片的灰度级分布方差;Calculating the gray level distribution variance of the target picture according to the gray level histogram;
    将所述灰度级分布方差与灰度级分布临界方差进行比较,当所述灰度级分布方差大于或等于所述灰度级分布临界方差时,确定所述目标图片中的人脸图像存在光照不均匀。Comparing the gray level distribution variance with a gray level distribution critical variance, and when the gray level distribution variance is greater than or equal to the gray level distribution critical variance, determining that a face image exists in the target picture The light is uneven.
  3. 根据权利要求1所述的方法,其特征在于:所述对所述人脸图像进行光线调整,以获得优化人脸图像的步骤包括:The method according to claim 1, wherein the step of performing light adjustment on the face image to obtain an optimized face image comprises:
    获取训练样本和初始图像生成模型,所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像;Obtaining a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
    利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到图像生成模型;Using a machine learning method to train the initial image generation model based on the training samples to obtain an image generation model;
    利用所述图像生成模型对所述人脸图像进行光线调整,以获得优化人脸图像。Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
  4. 根据权利要求3所述的方法,其特征在于,所述利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到所述图像生成模型,包括:The method according to claim 3, wherein the using a machine learning method to train the initial image generation model based on the training samples to obtain the image generation model comprises:
    将所述第一图像输入至所述初始图像生成模型中,得到输出的优化第一图像;Inputting the first image into the initial image generation model to obtain an output optimized first image;
    将所述优化第一图像、所述第二图像作为判别网络的输入,对所述判别网络进行训练,确定训练后的所述判别网络的参数;Using the optimized first image and the second image as input of a discrimination network, training the discrimination network, and determining parameters of the discrimination network after training;
    将所述第一图像作为所述初始图像生成模型的输入,对所述初始图像生成模型进行训练;Training the initial image generation model by using the first image as an input of the initial image generation model;
    将训练后的所述初始图像生成模型输出的优化第一图像和所述第二图像输入至所述训练后的所述判别网络,确定所述训练后的所述判别网络的损失函数值;Inputting the optimized first image and the second image output by the initial image generation model after training to the discriminant network after training to determine a loss function value of the discriminant network after training;
    当所述损失函数值收敛,将所述初始图像生成模型确定为所述图像生成模型。When the value of the loss function converges, the initial image generation model is determined as the image generation model.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述卷积神经网络模型通 过如下步骤进行训练:The method according to any one of claims 1-4, wherein the convolutional neural network model is trained by the following steps:
    搭建由两层沙漏型卷积神经网络组成的卷积神经网络模型;Build a convolutional neural network model consisting of two layers of hourglass convolutional neural networks;
    获取用于训练所述卷积神经网络模型的数据集,所述数据集中包括若干二维人脸图片和所述二维人脸图片对应的三维人像扫描数据;Obtaining a data set for training the convolutional neural network model, where the data set includes several two-dimensional face pictures and three-dimensional portrait scan data corresponding to the two-dimensional face pictures;
    对所述二维人脸图片进行预处理得到人脸特征点信息;Pre-processing the two-dimensional face picture to obtain facial feature point information;
    将所述人脸特征点信息输入至所述卷积神经网络模型得到第二三维人脸模型参数信息;Inputting the facial feature point information into the convolutional neural network model to obtain the second three-dimensional facial model parameter information;
    利用交叉熵损失函数对所述卷积神经网络的参数进行优化,直至所述第二三维人脸模型参数信息与所述三维人像扫描数据的损失函数收敛到预设阈值。The cross-entropy loss function is used to optimize the parameters of the convolutional neural network until the second 3D face model parameter information and the loss function of the 3D portrait scan data converge to a preset threshold.
  6. 一种基于光线的三维人脸优化装置,其特征在于,包括:A light-based three-dimensional human face optimization device, comprising:
    判断模块,用于判断获取的目标图片中的人脸图像是否光照不均匀;A judging module, configured to judge whether the face image in the obtained target picture has uneven illumination;
    优化模块,若所述人脸图像存在光照不均匀现象,则对所述人脸图像进行光线调整,以获得优化人脸图像;An optimization module, if the face image has uneven illumination, performing light adjustment on the face image to obtain an optimized face image;
    获取模块,用于基于预先训练的卷积神经网络模型对所述优化人脸图像进行处理,得到第一三维人脸模型参数信息;An acquisition module, configured to process the optimized face image based on a pre-trained convolutional neural network model to obtain first first three-dimensional face model parameter information;
    处理模块,用于根据所述第一三维人脸模型参数信息对三维平均人脸模型进行处理,得到所述人脸图像对应的三维人脸图像。A processing module is configured to process a three-dimensional average face model according to the first three-dimensional face model parameter information to obtain a three-dimensional face image corresponding to the face image.
  7. 根据权利要求6所述的装置,其特征在于,所述判断模块具体用于:The device according to claim 6, wherein the determining module is specifically configured to:
    获得所述目标图片的灰度直方图;Obtaining a grayscale histogram of the target picture;
    根据所述灰度直方图计算所述目标图片的灰度级分布方差;Calculating the gray level distribution variance of the target picture according to the gray level histogram;
    将所述灰度级分布方差与灰度级分布临界方差进行比较,当所述灰度级分布方差大于或等于所述灰度级分布临界方差时,确定所述目标图片中的人脸图像存在光照不均匀。Comparing the gray level distribution variance with a gray level distribution critical variance, and when the gray level distribution variance is greater than or equal to the gray level distribution critical variance, determining that a face image exists in the target picture The light is uneven.
  8. 根据权利要求6所述的装置,其特征在于,所述优化模块还包括第一训练模块,所述第一训练模块用于:The apparatus according to claim 6, wherein the optimization module further comprises a first training module, and the first training module is configured to:
    获取训练样本和初始图像生成模型,所述训练样本包括多个在非正面均匀光源条件下生成的第一图像、以及在正面均匀光源条件下生成的与所述第一图像对应的第二图像;Obtaining a training sample and an initial image generation model, where the training sample includes a plurality of first images generated under a non-positive uniform light source condition, and a second image corresponding to the first image generated under a front uniform light source condition;
    利用机器学习方法,基于所述训练样本对所述初始图像生成模型进行训练,得到图像生成模型;Using a machine learning method to train the initial image generation model based on the training samples to obtain an image generation model;
    利用所述图像生成模型对所述人脸图像进行光线调整,以获得优化人脸图像。Light adjustment is performed on the face image using the image generation model to obtain an optimized face image.
  9. 根据权利要求8所述的方法,其特征在于,所述第一训练模块还用于:The method according to claim 8, wherein the first training module is further configured to:
    将所述第一图像输入至所述初始图像生成模型中,得到输出的优化第一图像;Inputting the first image into the initial image generation model to obtain an output optimized first image;
    将所述优化第一图像、所述第二图像作为判别网络的输入,对所述判别网络进行训练,确定训练后的所述判别网络的参数;Using the optimized first image and the second image as input of a discrimination network, training the discrimination network, and determining parameters of the discrimination network after training;
    将所述第一图像作为所述初始图像生成模型的输入,对所述初始图像生成模型进行训练;Training the initial image generation model by using the first image as an input of the initial image generation model;
    将训练后的所述初始图像生成模型输出的优化第一图像和所述第二图像输入至所述训练后的所述判别网络,确定所述训练后的所述判别网络的损失函数值;Inputting the optimized first image and the second image output by the initial image generation model after training to the discriminant network after training to determine a loss function value of the discriminant network after training;
    当所述损失函数值收敛,将所述初始图像生成模型确定为所述图像生成模型。When the value of the loss function converges, the initial image generation model is determined as the image generation model.
  10. 一种电子设备,其特征在于,包括:至少一个处理器;以及,An electronic device, comprising: at least one processor; and
    与所述至少一个处理器通信连接的存储器;其中,A memory connected in communication with the at least one processor; wherein,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1至5中任一项所述的基于光线的三维人脸优化方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute any one of claims 1 to 5. Light-based 3D face optimization method.
PCT/CN2018/102333 2018-08-24 2018-08-24 Light-based three-dimensional face optimization method and apparatus, and electronic device WO2020037680A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/102333 WO2020037680A1 (en) 2018-08-24 2018-08-24 Light-based three-dimensional face optimization method and apparatus, and electronic device
CN201811031365.5A CN109271911B (en) 2018-08-24 2018-09-05 Three-dimensional face optimization method and device based on light rays and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/102333 WO2020037680A1 (en) 2018-08-24 2018-08-24 Light-based three-dimensional face optimization method and apparatus, and electronic device

Publications (1)

Publication Number Publication Date
WO2020037680A1 true WO2020037680A1 (en) 2020-02-27

Family

ID=65187883

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/102333 WO2020037680A1 (en) 2018-08-24 2018-08-24 Light-based three-dimensional face optimization method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN109271911B (en)
WO (1) WO2020037680A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111951372A (en) * 2020-06-30 2020-11-17 重庆灵翎互娱科技有限公司 Three-dimensional face model generation method and equipment
CN112052805A (en) * 2020-09-10 2020-12-08 深圳数联天下智能科技有限公司 Face detection frame display method, image processing device, equipment and storage medium
CN112488178A (en) * 2020-11-26 2021-03-12 推想医疗科技股份有限公司 Network model training method and device, image processing method and device, and equipment
CN113255511A (en) * 2021-05-21 2021-08-13 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for living body identification
CN113345069A (en) * 2020-03-02 2021-09-03 京东方科技集团股份有限公司 Modeling method, device and system of three-dimensional human body model and storage medium
CN113378715A (en) * 2021-06-10 2021-09-10 北京华捷艾米科技有限公司 Living body detection method based on color face image and related equipment
CN117456144A (en) * 2023-11-10 2024-01-26 中国人民解放军海军航空大学 Target building three-dimensional model optimization method based on visible light remote sensing image

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110473248A (en) * 2019-08-16 2019-11-19 上海索倍信息科技有限公司 A kind of measurement method using picture construction human 3d model
CN110706169A (en) * 2019-09-26 2020-01-17 深圳市半冬科技有限公司 Star portrait optimization method and device and storage device
CN110691195B (en) * 2019-10-15 2021-03-30 重庆灵翎互娱科技有限公司 Light detection method and device based on three-dimensional face shooting
CN112766105A (en) * 2021-01-07 2021-05-07 北京码牛科技有限公司 Image conversion method and device applied to image code joint acquisition system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159015A (en) * 2007-11-08 2008-04-09 清华大学 Two-dimension human face image recognizing method
CN106910247A (en) * 2017-03-20 2017-06-30 厦门幻世网络科技有限公司 Method and apparatus for generating three-dimensional head portrait model
CN107358648A (en) * 2017-07-17 2017-11-17 中国科学技术大学 Real-time full-automatic high quality three-dimensional facial reconstruction method based on individual facial image
CN108133201A (en) * 2018-01-17 2018-06-08 百度在线网络技术(北京)有限公司 Face character recognition methods and device
CN108229276A (en) * 2017-03-31 2018-06-29 北京市商汤科技开发有限公司 Neural metwork training and image processing method, device and electronic equipment

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4857021B2 (en) * 2006-05-08 2012-01-18 株式会社タムロン Actuator and lens unit and camera provided with the same
CN101251706A (en) * 2008-03-24 2008-08-27 香港应用科技研究院有限公司 Optical die set, camera and mobile terminal equipment
TW200951493A (en) * 2008-06-05 2009-12-16 Asia Optical Co Inc Camera and image detecting module thereof
CN105629626A (en) * 2014-11-05 2016-06-01 惠州友华微电子科技有限公司 Camera, optical system and optical image stabilization camera apparatus
KR101825731B1 (en) * 2014-12-04 2018-03-23 에이에이씨 어쿠스틱 테크놀로지스(심천)컴퍼니 리미티드 Camera lens module with structure for optical image stabilization
KR101589149B1 (en) * 2015-05-27 2016-02-03 수원대학교산학협력단 Face recognition and face tracking method using radial basis function neural networks pattern classifier and object tracking algorithm and system for executing the same
CN106067190B (en) * 2016-05-27 2019-04-30 俞怡斐 A kind of generation of fast face threedimensional model and transform method based on single image
CN106169067B (en) * 2016-07-01 2019-05-28 恒东信息科技无锡有限公司 A kind of police dynamic human face acquisition comparison method of high throughput and system
CN106131435B (en) * 2016-08-25 2021-12-07 东莞市亚登电子有限公司 Miniature optical anti-shake camera module
CN107680158A (en) * 2017-11-01 2018-02-09 长沙学院 A kind of three-dimensional facial reconstruction method based on convolutional neural networks model
CN108171206B (en) * 2018-01-17 2019-10-25 百度在线网络技术(北京)有限公司 Information generating method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101159015A (en) * 2007-11-08 2008-04-09 清华大学 Two-dimension human face image recognizing method
CN106910247A (en) * 2017-03-20 2017-06-30 厦门幻世网络科技有限公司 Method and apparatus for generating three-dimensional head portrait model
CN108229276A (en) * 2017-03-31 2018-06-29 北京市商汤科技开发有限公司 Neural metwork training and image processing method, device and electronic equipment
CN107358648A (en) * 2017-07-17 2017-11-17 中国科学技术大学 Real-time full-automatic high quality three-dimensional facial reconstruction method based on individual facial image
CN108133201A (en) * 2018-01-17 2018-06-08 百度在线网络技术(北京)有限公司 Face character recognition methods and device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113345069A (en) * 2020-03-02 2021-09-03 京东方科技集团股份有限公司 Modeling method, device and system of three-dimensional human body model and storage medium
CN111951372A (en) * 2020-06-30 2020-11-17 重庆灵翎互娱科技有限公司 Three-dimensional face model generation method and equipment
CN111951372B (en) * 2020-06-30 2024-01-05 重庆灵翎互娱科技有限公司 Three-dimensional face model generation method and equipment
CN112052805A (en) * 2020-09-10 2020-12-08 深圳数联天下智能科技有限公司 Face detection frame display method, image processing device, equipment and storage medium
CN112052805B (en) * 2020-09-10 2023-12-12 深圳数联天下智能科技有限公司 Face detection frame display method, image processing device, equipment and storage medium
CN112488178A (en) * 2020-11-26 2021-03-12 推想医疗科技股份有限公司 Network model training method and device, image processing method and device, and equipment
CN112488178B (en) * 2020-11-26 2022-07-26 推想医疗科技股份有限公司 Network model training method and device, image processing method and device, and equipment
CN113255511A (en) * 2021-05-21 2021-08-13 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for living body identification
CN113378715A (en) * 2021-06-10 2021-09-10 北京华捷艾米科技有限公司 Living body detection method based on color face image and related equipment
CN113378715B (en) * 2021-06-10 2024-01-05 北京华捷艾米科技有限公司 Living body detection method based on color face image and related equipment
CN117456144A (en) * 2023-11-10 2024-01-26 中国人民解放军海军航空大学 Target building three-dimensional model optimization method based on visible light remote sensing image
CN117456144B (en) * 2023-11-10 2024-05-07 中国人民解放军海军航空大学 Target building three-dimensional model optimization method based on visible light remote sensing image

Also Published As

Publication number Publication date
CN109271911A (en) 2019-01-25
CN109271911B (en) 2021-04-16

Similar Documents

Publication Publication Date Title
WO2020037680A1 (en) Light-based three-dimensional face optimization method and apparatus, and electronic device
WO2020037676A1 (en) Three-dimensional face image generation method and apparatus, and electronic device
WO2020037679A1 (en) Video processing method and apparatus, and electronic device
WO2020037678A1 (en) Method, device, and electronic apparatus for generating three-dimensional human face image from occluded image
US11582423B2 (en) Virtual 3D communications with actual to virtual cameras optical axes compensation
CN108596827B (en) Three-dimensional face model generation method and device and electronic equipment
CN109727303B (en) Video display method, system, computer equipment, storage medium and terminal
WO2020037681A1 (en) Video generation method and apparatus, and electronic device
CN108537870B (en) Image processing method, device and electronic equipment
US11765332B2 (en) Virtual 3D communications with participant viewpoint adjustment
CN110677591B (en) Sample set construction method, image imaging method, device, medium and electronic equipment
CN108200337B (en) Photographing processing method, device, terminal and storage medium
WO2020056690A1 (en) Method and apparatus for presenting interface associated with video content, and electronic device
WO2020056689A1 (en) Ar imaging method and apparatus and electronic device
WO2020056692A1 (en) Information interaction method and apparatus, and electronic device
US11734888B2 (en) Real-time 3D facial animation from binocular video
CN116095353A (en) Live broadcast method and device based on volume video, electronic equipment and storage medium
WO2022231582A1 (en) Photo relighting and background replacement based on machine learning models
WO2020056693A1 (en) Picture synthesizing method and apparatus, and electronic device
CN114049250B (en) Method, device and medium for correcting face pose of certificate photo
CN113658304A (en) Animation method of target object and related device and equipment

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: 18931038

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18931038

Country of ref document: EP

Kind code of ref document: A1