CN111667403B - Method and device for generating human face image with shielding - Google Patents
Method and device for generating human face image with shielding Download PDFInfo
- Publication number
- CN111667403B CN111667403B CN202010633219.0A CN202010633219A CN111667403B CN 111667403 B CN111667403 B CN 111667403B CN 202010633219 A CN202010633219 A CN 202010633219A CN 111667403 B CN111667403 B CN 111667403B
- Authority
- CN
- China
- Prior art keywords
- face
- coordinate value
- face image
- average
- target
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 50
- 239000011159 matrix material Substances 0.000 claims abstract description 75
- 230000009466 transformation Effects 0.000 claims abstract description 61
- 230000001815 facial effect Effects 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 abstract description 10
- 230000000875 corresponding effect Effects 0.000 description 22
- 238000001514 detection method Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 6
- 230000009471 action Effects 0.000 description 3
- 230000000903 blocking effect Effects 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 239000011521 glass Substances 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000002596 correlated effect Effects 0.000 description 1
- 210000004709 eyebrow Anatomy 0.000 description 1
- 210000000887 face Anatomy 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000008570 general process Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003062 neural network model Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/02—Affine transformations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/04—Context-preserving transformations, e.g. by using an importance map
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/161—Detection; Localisation; Normalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30196—Human being; Person
- G06T2207/30201—Face
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Image Processing (AREA)
Abstract
The invention discloses a method and a device for generating shielded face image data, wherein the method comprises the following steps: determining a target average face according to coordinate values of all key points in the face images with a first preset number; calculating the standard deviation between the first preset number of face images and the target average face; selecting at least one face image to be shielded based on the standard deviation; determining a first transformation matrix based on a face image to be shielded and a shielding object; covering the shelter to the target area in the face image to be sheltered according to the first transformation matrix to obtain the face image with the shelter. In the generation method, the key point coordinate values are only required to be calculated when the target average face is determined, and for the generation of a large number of face images with shielding, the shielding object can be covered in the face image to be shielded based on the standard deviation, the target average face and the first transformation matrix, so that the key point coordinates do not need to be calculated, and the calculation amount is reduced.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a method and a device for generating a face image with shielding.
Background
In the process of training a face recognition model, in order to increase the accuracy of face recognition model recognition, not only a face image without a mask but also a face image with a mask needs to be present, and aiming at the generation of the face image with the mask, the current common method is to obtain the coordinates of key points of a face, perform translation rotation and scaling on a mask (such as a mask image, an eyeglass image and the like) in a proper proportion based on the coordinates of the key points, cover the mask on the face image without the mask and simulate the face image with the mask.
In the prior art, the coordinates of the key points of the human face are obtained by detecting based on a detection model of the key points of the human face, the coordinates of the key points of the human face are detected once every time a human face image with shielding is generated, and when a large number of human face images with shielding need to be simulated, a large number of coordinates of the key points of the human face need to be detected, so that the calculation amount is large.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for generating a face image with an occlusion, so as to solve the problem that since coordinates of key points of a face are obtained by detection based on a face key point detection model, the coordinates of key points of the face need to be detected once every time a face image with an occlusion is generated, and when a large number of face key point images with an occlusion need to be simulated, a large number of coordinates of key points of the face need to be detected, which results in a large amount of calculation. The specific scheme is as follows:
a method for generating a face image with an occlusion comprises the following steps:
determining a target average face according to coordinate values of all key points in the face images with a first preset number;
calculating the standard deviation of the coordinate values of the corresponding key points in the first preset number of face images and the target average face;
selecting at least one face image to be shielded based on the standard deviation and the target average face;
determining a first transformation matrix based on the face image to be shielded and the shielding object;
and covering the shelter on a target area in the face image to be sheltered according to the first transformation matrix to obtain the sheltered face image.
Optionally, the method for determining the target average face according to the coordinate values of the key points in the first preset number of face images includes:
acquiring a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in an initial average face, wherein the first coordinate value and the second coordinate value are the same in quantity, and the initial average face is a reference face image;
determining a second transformation matrix based on the first coordinate value and the second coordinate value;
and determining the target average face according to the second transformation matrix.
Optionally, in the above method, selecting a facial image to be occluded based on the standard deviation and the target average face includes:
acquiring average coordinate values of key points of each target average human face in the target average human face;
adding a disturbance interval for each average coordinate value based on the standard deviation to obtain each average coordinate disturbance interval;
and selecting a target coordinate value in each average coordinate disturbance interval, and constructing the face image to be shielded based on the target coordinate value.
The above method, optionally, determining a first transformation matrix based on the face image to be occluded and the occlusion object, includes:
acquiring a second preset number of third coordinate values in the shelter;
identifying the type of the shielding object and acquiring a fourth coordinate value of a second preset number in the face image to be shielded according to the type of the shielding object;
and determining the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
Optionally, in the method, the step of covering the object in the face image to be covered with the covering according to the first transformation matrix to obtain a face image with a covering includes:
determining a target area in the face image to be shielded corresponding to the shielding object;
obtaining coordinate values and pixel values of all pixel points in the shelter;
and determining the projection coordinate value of each coordinate value in the target region based on the first transformation matrix, and adding the corresponding pixel value to the corresponding projection coordinate value.
An apparatus for generating an occluded face image, comprising:
the average face determining module is used for determining a target average face according to the coordinate values of all key points in the face images with the first preset number;
the calculating module is used for calculating the standard deviation of the coordinate values of the corresponding key points in the second preset number of face images and the target average face;
the selecting module is used for selecting at least one facial image to be occluded based on the standard deviation and the target average face;
the matrix determination module is used for determining a first transformation matrix based on the face image to be shielded and the shielding object;
and the covering module is used for covering the shelter to the target area in the face image to be sheltered according to the first transformation matrix to obtain the sheltered face image.
The above apparatus, optionally, the average face determining module includes:
a first coordinate value obtaining unit, configured to obtain a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in an initial average face, where the first coordinate value and the second coordinate value are the same in quantity, and the initial average face is a reference face image;
a first matrix determination unit configured to determine a second transformation matrix based on the first coordinate value and the second coordinate value;
and the average face determining unit is used for determining the target average face according to the second transformation matrix.
The above apparatus, optionally, the selecting module includes:
a second coordinate value obtaining unit, configured to obtain an average coordinate value of each key point of the target average face in the target average face;
the adding unit is used for adding a disturbance interval to each average coordinate value based on the standard deviation to obtain each average coordinate disturbance interval;
and the selecting unit is used for selecting a target coordinate value in each average coordinate disturbance interval and constructing the face image to be shielded based on the target coordinate value.
The above apparatus, optionally, the matrix determining module includes:
the third coordinate value acquisition unit is used for acquiring a second preset number of third coordinate values in the shelter;
the identification and acquisition unit is used for identifying the type of the shielding object and acquiring a fourth coordinate value of a second preset number in the face image to be shielded according to the type of the shielding object;
a second matrix determining unit, configured to determine the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
The above apparatus, optionally, the covering module includes:
the area determining unit is used for determining a target area in the face image to be shielded corresponding to the shielding object;
the acquisition unit is used for acquiring coordinate values and pixel values of all pixel points in the shelter;
and the determining and adding unit is used for determining the projection coordinate value of each coordinate value in the target area based on the first transformation matrix and adding the corresponding pixel value to the corresponding projection coordinate value.
Compared with the prior art, the invention has the following advantages:
the invention discloses a method and a device for generating shielded face image data, wherein the method comprises the following steps: determining a target average face according to coordinate values of all key points in the face images with a first preset number; calculating the standard deviation between the first preset number of face images and the target average face; selecting at least one face image to be shielded based on the standard deviation; determining a first transformation matrix based on the face image to be shielded and the shielding object; and covering the shelter on a target area in the face image to be sheltered according to the first transformation matrix to obtain the face image with the shelter. In the generation method, the key point coordinate values are only required to be calculated when the target average face is determined, and the occlusion object can be obtained by covering the occlusion object in the face image to be occluded based on the standard deviation, the target average face and the first transformation matrix aiming at a large number of face images with occlusion, so that the key point coordinates are not required to be calculated, and the calculation amount is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart of a method for generating occluded face image data according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for generating occluded face image data according to the embodiment of the present application;
FIG. 3 is another flowchart of a method for generating occluded face image data according to an embodiment of the present application;
fig. 4 is a block diagram of a device for generating facial image data with occlusion according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The invention discloses a method and a device for generating shielded face image data, which are applied to the generation of shielded face images, wherein the shielded face images are mainly used for training a face recognition model in a face recognition system, a common face recognition system usually comprises a plurality of neural network models, such as a face detection model for detecting the position of a face in an image, a face key point detection model for detecting facial features and chin contour coordinates, a face quality model for judging the quality of the face in the image, a living body model for judging whether the face appearing in the image is from a real person or a photo, a living body model and the like, and finally, a face recognition model for judging whether two images are of the same person is entered. The general process is as follows: firstly, detecting and key points are made on a face picture, then filtering is carried out through a quality model (some living bodies exist), and finally, judgment is made on a face recognition model. To ensure the end result is reliable, high-quality face pictures with high resolution (e.g. the size of the face image is larger than 64 x 64), correct angle (e.g. the deflection angle of the face is smaller than 30 °), and small occlusion (e.g. the occlusion range does not exceed 20% of the face) need to be screened. The detection and quality model usually eliminates part of low-quality face pictures, and a shelter (such as a mask, glasses and the like) belongs to large-area face shelter. Under the background, the identification requirement of a sudden face image with a shielding object is met, a face identification model is trained based on a large number of face identification images with shielding objects, but aiming at the generation of the face image with shielding, the current common method is to obtain the coordinates of key points of the face, perform translation rotation and scaling with a proper proportion on the shielding object based on the coordinates of the key points, cover the shielding object on the face image without shielding and simulate the face image with shielding. The face key point coordinates are obtained by detecting based on a face key point detection model, the face key point coordinates need to be detected once every time a shielded face image is generated, when a large number of shielded face key point images need to be simulated, a large number of face key point coordinates need to be detected, and the calculation amount is large.
In order to solve the problem of large calculation amount of generating an occluded face image, the embodiment of the present invention provides a method for generating an occluded face image, where an execution flow of the generating method is shown in fig. 1, and the method includes the steps of:
s101, determining a target average face according to coordinate values of all key points in the face images with a first preset number;
in the embodiment of the present invention, the target average face is a front face image, and is obtained by mapping and averaging the coordinate values of the key points in the first preset number of face key faces, and the key points in the target average face are correlated with the key points in the first preset number of face images and have the same number. The coordinate values of the key points are obtained by a key point detector, the coordinate values of the key points can be the contours of key parts such as the face, the eyebrows, the eyes, the nose, the mouth and the like, and 68 points, 72 points, 108 points, 118 points and other key points can be selected optionally. In the embodiment of the present invention, taking 72 as an example for description, the number of the target average face key points in the target average face is also 72.
S102, calculating a standard deviation of coordinate values of corresponding key points in the first preset number of face images and the target average face;
in the embodiment of the invention, the coordinate values of the corresponding key points in the preset face image are obtained aiming at the average coordinate value of each target average face key point in the target average face, the standard deviation of the coordinate values of the corresponding key points relative to the preset face image is calculated, the calculation process is shown as formula (1),
wherein, s-standard deviation;
x 1 ,x 2 …x n -corresponding keypoint coordinate values;
x-average coordinate value of current target average human face key point in the target average face;
further, according to the central limit theorem, when the data is large enough, it can be considered that most of the data falls within 3 standard deviations from the mean value, i.e. 3 σ law, and therefore, random position disturbance with 3 times of variance is added near the mean region, and it can be approximately considered that real data is simulated.
S103, selecting at least one to-be-occluded face image based on the standard deviation and the target average face;
in the embodiment of the invention, the average coordinate values of all target average face key points in the target average face are obtained, a disturbance interval is added to all average coordinate values based on the standard deviation to obtain all average coordinate disturbance intervals, and target coordinate values are selected from all average coordinate disturbance intervals, wherein the selection principle is that the average coordinate disturbance intervals do not exceed the corresponding average disturbance intervals, for example, if the average coordinate disturbance intervals are 4.5-5.5, the corresponding target standard values can be selected as any value in the intervals.
S104, determining a first transformation matrix based on the face image to be shielded and the shielding object;
in the embodiment of the invention, the type of the shielding object is determined, the key point of the shielding object corresponding to the type of the shielding object and the key point to be shielded corresponding to the key point of the shielding object are obtained according to the type of the shielding object, and the first transformation matrix is determined according to the key point of the shielding object and the key point to be shielded.
S105, covering the shelter to a target area in the face image to be sheltered according to the first transformation matrix to obtain the sheltered face image.
In the embodiment of the present invention, based on the type of the obstruction, a target area in the face image to be obstructed corresponding to the obstruction is determined, for example: if the shelter is a mask, the target area is an oral-nasal area, the shelter is glasses, the target area is an eye area, each point in the shelter is covered in a corresponding point of the target area based on affine transformation, and when the pixel value of each point in the shelter is the same as the pixel value of the corresponding point in the face image to be sheltered, the affine transformation is completed, and the face image to be sheltered is obtained.
Furthermore, after the face image to be shielded is obtained, a face recognition model is trained based on the face image to be shielded, so that the diversity of face recognition model training data and the robustness of the face recognition model are improved.
Covering the shelter to a target area in the face image to be sheltered according to the first transformation matrix based on affine transformation
The invention discloses a method for generating shielded face image data, which comprises the following steps: determining a target average face according to coordinate values of all key points in the face images of a first preset number, wherein the target average face is a front face image; calculating the standard deviation between the first preset number of face images and the target average face; selecting at least one face image to be shielded based on the standard deviation; determining a first transformation matrix based on a face image to be shielded and a shielding object; covering the shelter to a target area in the face image to be sheltered according to the first transformation matrix to obtain the face image with the shelter. In the generation method, the key point coordinate values are only required to be calculated when the target average face is determined, and for the generation of a large number of face images with shielding, the shielding object can be covered in the face image to be shielded based on the standard deviation, the target average face and the first transformation matrix, so that the key point coordinates do not need to be calculated, and the calculation amount is reduced.
Based on the generation method, the face image can be acquired in real time, the shielded face image can be generated on line, the face image can also be acquired in advance, the shielded face image can be generated off line, and an off-line or on-line generation mode can be selected according to specific requirements.
In the embodiment of the present invention, an execution flow for determining a target average face according to coordinate values of each key point in a first preset number of face images is shown in fig. 2, and includes the steps of:
s201, acquiring a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in an initial average face, wherein the first coordinate value and the second coordinate value are the same in quantity, and the initial average face is a reference face image;
in the embodiment of the invention, the initial average face is a face image, an average value of coordinate values of all key points is obtained by carrying out statistical analysis based on big data, the average value is used as a second coordinate value of all average face key points of the initial average face and is used as a reference face image, wherein the number of the average face key points in the initial average face is the same as the number of all face key points in each face image, and a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in the initial average face are obtained.
S202, determining a second transformation matrix based on the first coordinate value and the second coordinate value;
in the embodiment of the present invention, assuming that the first coordinate value is a = (x, y), the second coordinate value is B = (u, v), and a is transformed into a point B satisfying an affine relationship through affine transformation by performing matrix operation on a, in this scheme, an existing coordinate point is a first coordinate value of each face key point of a face image, a desired coordinate point is a second coordinate value of each average face key point of a target average face, and the second matrix is H, according to formula (2)
B=H*A (2)
Fitting an H matrix through all the face key points and the average face key point
And S203, determining the target average face according to the second transformation matrix.
In the embodiment of the present invention, the first preset number of face images are mapped to the initial average face based on affine transformation according to the second transformation matrix, and an average value of the coordinate values of the first preset number of key points obtained by mapping is calculated based on each average face key point in the initial average face, so as to obtain the target average face.
In the embodiment of the present invention, an execution flow for determining a first transformation matrix based on the face image to be occluded and the occlusion object is shown in fig. 3, and includes the steps of:
s301, obtaining a second preset number of third coordinate values in the shelter;
in the embodiment of the present invention, for different types of shielding objects, a second preset number of third coordinate values in the shielding object are selected in advance, where the selection process may be selected according to specific situations or experiences.
S302, identifying the type of the blocking object, and acquiring a second preset number of fourth coordinate values in the face image to be blocked according to the type of the blocking object;
in the embodiment of the invention, an incidence relation is established in advance based on the type of the shielding object and the coordinate values corresponding to the second preset number in the face image with the shielding object, the type of the shielding object is identified, and the fourth coordinate values of the second preset number in the face image to be shielded are obtained according to the type of the shielding object.
S303, determining the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
In the embodiment of the present invention, the first transformation matrix is determined based on the second preset number of third coordinate values and the second preset number of fourth coordinate values, and a specific determination process is the same as that of the second matrix, which is not described herein again.
Based on the foregoing method for generating an occluded facial image, in an embodiment of the present invention, a device for generating an occluded facial image is further provided, where a structural block diagram of the device is shown in fig. 4, and the device includes:
an average face determination module 401, a calculation module 402, a selection module 403, a matrix determination module 404, and a coverage module 405.
Wherein,
the average face determining module 401 is configured to determine a target average face according to coordinate values of key points in a first preset number of face images;
the calculating module 402 is configured to calculate a standard deviation between the first preset number of face images and the coordinate values of the corresponding key points in the target average face;
the selecting module 403 is configured to select at least one to-be-occluded face image based on the standard deviation and the target average face;
the matrix determining module 404 is configured to determine a first transformation matrix based on the face image to be occluded and the occlusion object;
the covering module 405 is configured to cover the blocking object to the target area in the face image to be blocked according to the first transformation matrix, so as to obtain a blocked face image.
The invention discloses a method and a device for generating shielded face image data, wherein the method comprises the following steps: determining a target average face according to the coordinate values of all key points in the face images with the first preset number; calculating the standard deviation between the first preset number of face images and the target average face; selecting at least one face image to be shielded based on the standard deviation; determining a first transformation matrix based on a face image to be shielded and a shielding object; covering the shelter to the target area in the face image to be sheltered according to the first transformation matrix to obtain the face image with the shelter. In the generation method, the key point coordinate values are only required to be calculated when the target average face is determined, and for the generation of a large number of face images with shielding, the shielding object can be covered in the face image to be shielded based on the standard deviation, the target average face and the first transformation matrix, so that the key point coordinates do not need to be calculated, and the calculation amount is reduced.
In this embodiment of the present invention, the average face determining module 401 includes:
a first coordinate value acquisition unit 406, a first matrix determination unit 407, and an average face determination unit 408.
Wherein,
the first coordinate value obtaining unit 406 is configured to obtain a first coordinate value of each key point of a face in each face image and a second coordinate value of each key point of an average face in an initial average face, where the first coordinate value and the second coordinate value are the same in quantity, and the initial average face is a reference face image;
the first matrix determination unit 407 is configured to determine a second transformation matrix based on the first coordinate value and the second coordinate value;
the average face determining unit 408 is configured to determine the target average face according to the second transformation matrix.
In this embodiment of the present invention, the selecting module 403 includes:
a second coordinate value acquisition unit 409, an adding unit 410, and a selecting unit 411.
Wherein,
the second coordinate value obtaining unit 409 is configured to obtain an average coordinate value of each target average face key point in the target average face;
the adding unit 410 is configured to add a disturbance interval to each average coordinate value based on the standard deviation to obtain each average coordinate disturbance interval;
the selecting unit 411 is configured to select a target coordinate value in each average coordinate disturbance interval, and construct the facial image to be occluded based on the target coordinate value.
In this embodiment of the present invention, the matrix determining module 404 includes:
a third coordinate value acquisition unit 412, a recognition and acquisition unit 413, and a second matrix determination unit 414.
Wherein,
the third coordinate value obtaining unit 412 is configured to obtain a second preset number of third coordinate values in the obstruction;
the identifying and acquiring unit 413 is configured to identify an obstruction type of the obstruction and acquire a fourth coordinate value of a second preset number in the face image to be obstructed according to the obstruction type;
the second matrix determining unit 414 is configured to determine the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
In this embodiment of the present invention, the covering module 405 includes:
an area determination unit 415, an acquisition unit 416, and a determination and addition unit 417.
Wherein,
the region determining unit 415 is configured to determine a target region in the face image to be occluded, which corresponds to the occlusion;
the obtaining unit 416 is configured to obtain coordinate values and pixel values of each pixel point in the shelter;
the determining and adding unit 417 is configured to determine a projection coordinate value of each coordinate value in the target region based on the first transformation matrix, and add a corresponding pixel value to the corresponding projection coordinate value.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "...," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the units may be implemented in the same software and/or hardware or in a plurality of software and/or hardware when implementing the invention.
From the above description of the embodiments, it is clear to those skilled in the art that the present invention can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present invention may be embodied in the form of software products, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The method and the device for generating the facial image data with the occlusion provided by the invention are described in detail above, a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (8)
1. A method for generating a face image with an occlusion is characterized by comprising the following steps:
determining a target average face according to coordinate values of all key points in the face images of the first preset number;
calculating the standard deviation of the coordinate values of the corresponding key points in the first preset number of face images and the target average face;
selecting at least one face image to be shielded based on the standard deviation and the target average face;
determining a first transformation matrix based on the face image to be shielded and the shielding object;
covering the shelter to a target area in the face image to be sheltered according to the first transformation matrix to obtain a sheltered face image;
selecting a face image to be occluded based on the standard deviation and the target average face, including:
acquiring average coordinate values of key points of each target average human face in the target average human face;
adding a disturbance interval for each average coordinate value based on the standard deviation to obtain each average coordinate disturbance interval;
and selecting a target coordinate value in each average coordinate disturbance interval, and constructing the face image to be shielded based on the target coordinate value.
2. The method according to claim 1, wherein determining the target average face according to the coordinate values of the key points in the first preset number of face images comprises:
acquiring a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in an initial average face, wherein the first coordinate value and the second coordinate value are the same in quantity, and the initial average face is a reference face image;
determining a second transformation matrix based on the first coordinate value and the second coordinate value;
and determining the target average face according to the second transformation matrix.
3. The method according to claim 1, wherein determining a first transformation matrix based on the face image to be occluded and an occlusion comprises:
acquiring a second preset number of third coordinate values in the shelter;
identifying the type of the shielding object and acquiring a fourth coordinate value of a second preset number in the face image to be shielded according to the type of the shielding object;
and determining the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
4. The method according to claim 1, wherein covering the obstruction to the target area in the face image to be obstructed according to the first transformation matrix to obtain an obstructed face image comprises:
determining a target area in the face image to be shielded corresponding to the shielding object;
obtaining coordinate values and pixel values of all pixel points in the shielding object;
and determining the projection coordinate value of each coordinate value in the target region based on the first transformation matrix, and adding the corresponding pixel value to the corresponding projection coordinate value.
5. An apparatus for generating an occluded face image, comprising:
the average face determining module is used for determining a target average face according to the coordinate values of all key points in the face images with the first preset number;
the calculating module is used for calculating the standard deviation of the coordinate values of the corresponding key points in the first preset number of face images and the target average face;
the selecting module is used for selecting at least one facial image to be occluded based on the standard deviation and the target average face;
the matrix determination module is used for determining a first transformation matrix based on the face image to be shielded and the shielding object;
the covering module is used for covering the shelter to a target area in the face image to be sheltered according to the first transformation matrix to obtain a sheltered face image;
the selecting module comprises:
a second coordinate value obtaining unit, configured to obtain an average coordinate value of each key point of the target average face in the target average face;
the adding unit is used for adding disturbance intervals to each average coordinate value based on the standard deviation to obtain each average coordinate disturbance interval;
and the selecting unit is used for selecting a target coordinate value in each average coordinate disturbance interval and constructing the face image to be shielded based on the target coordinate value.
6. The apparatus of claim 5, wherein the average face determination module comprises:
a first coordinate value obtaining unit, configured to obtain a first coordinate value of each face key point in each face image and a second coordinate value of each average face key point in an initial average face, where the first coordinate value and the second coordinate value are the same in number, and the initial average face is a reference face image;
a first matrix determination unit configured to determine a second transformation matrix based on the first coordinate value and the second coordinate value;
and the average face determining unit is used for determining the target average face according to the second transformation matrix.
7. The apparatus of claim 5, wherein the matrix determination module comprises:
the third coordinate value acquisition unit is used for acquiring a second preset number of third coordinate values in the shelter;
the identification and acquisition unit is used for identifying the type of the shielding object and acquiring a fourth coordinate value of a second preset number in the face image to be shielded according to the type of the shielding object;
a second matrix determining unit, configured to determine the first transformation matrix based on the second preset number of third coordinate values and the second preset number of fourth coordinate values.
8. The apparatus of claim 5, wherein the overlay module comprises:
the area determining unit is used for determining a target area in the face image to be shielded corresponding to the shielding object;
the acquisition unit is used for acquiring coordinate values and pixel values of all pixel points in the shelter;
and the determining and adding unit is used for determining the projection coordinate value of each coordinate value in the target region based on the first transformation matrix and adding the corresponding pixel value to the corresponding projection coordinate value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010633219.0A CN111667403B (en) | 2020-07-02 | 2020-07-02 | Method and device for generating human face image with shielding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010633219.0A CN111667403B (en) | 2020-07-02 | 2020-07-02 | Method and device for generating human face image with shielding |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111667403A CN111667403A (en) | 2020-09-15 |
CN111667403B true CN111667403B (en) | 2023-04-18 |
Family
ID=72390924
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010633219.0A Active CN111667403B (en) | 2020-07-02 | 2020-07-02 | Method and device for generating human face image with shielding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111667403B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112487923A (en) * | 2020-11-25 | 2021-03-12 | 奥比中光科技集团股份有限公司 | Method and system for acquiring training data of human face head posture |
CN113327284B (en) * | 2021-05-27 | 2022-08-26 | 北京百度网讯科技有限公司 | Image recognition method and device, electronic equipment and storage medium |
CN113421317B (en) * | 2021-06-10 | 2023-04-18 | 浙江大华技术股份有限公司 | Method and system for generating image and electronic equipment |
CN115018696B (en) * | 2022-06-08 | 2024-05-03 | 东北师范大学 | Face mask data generation method based on OpenCV affine transformation |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107679497A (en) * | 2017-10-11 | 2018-02-09 | 齐鲁工业大学 | Video face textures effect processing method and generation system |
CN109815813A (en) * | 2018-12-21 | 2019-05-28 | 深圳云天励飞技术有限公司 | Image processing method and Related product |
CN110175558A (en) * | 2019-05-24 | 2019-08-27 | 北京达佳互联信息技术有限公司 | A kind of detection method of face key point, calculates equipment and storage medium at device |
CN110909690A (en) * | 2019-11-26 | 2020-03-24 | 电子科技大学 | Method for detecting occluded face image based on region generation |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO1999010832A1 (en) * | 1997-08-27 | 1999-03-04 | Plettac Electronic Security Gmbh | Method for localizing objects in still images used to localize faces |
JP6458569B2 (en) * | 2015-03-12 | 2019-01-30 | オムロン株式会社 | Image processing apparatus and image processing method |
CN105224935B (en) * | 2015-10-28 | 2018-08-24 | 南京信息工程大学 | A kind of real-time face key independent positioning method based on Android platform |
CN105760836A (en) * | 2016-02-17 | 2016-07-13 | 厦门美图之家科技有限公司 | Multi-angle face alignment method based on deep learning and system thereof and photographing terminal |
CN107463865B (en) * | 2016-06-02 | 2020-11-13 | 北京陌上花科技有限公司 | Face detection model training method, face detection method and device |
CN109635659B (en) * | 2018-11-12 | 2020-10-30 | 东软集团股份有限公司 | Face key point positioning method and device, storage medium and electronic equipment |
CN109522841A (en) * | 2018-11-16 | 2019-03-26 | 重庆邮电大学 | A kind of face identification method restored based on group's rarefaction representation and low-rank matrix |
CN109508678B (en) * | 2018-11-16 | 2021-03-30 | 广州市百果园信息技术有限公司 | Training method of face detection model, and detection method and device of face key points |
CN109558837B (en) * | 2018-11-28 | 2024-03-22 | 北京达佳互联信息技术有限公司 | Face key point detection method, device and storage medium |
CN110020600B (en) * | 2019-03-05 | 2021-04-16 | 厦门美图之家科技有限公司 | Method for generating a data set for training a face alignment model |
CN110309815B (en) * | 2019-07-11 | 2021-05-11 | 广州方硅信息技术有限公司 | Method and system for processing face recognition data |
CN111291678B (en) * | 2020-02-06 | 2024-01-12 | 北京爱笔科技有限公司 | Face image clustering method and device based on multi-feature fusion |
-
2020
- 2020-07-02 CN CN202010633219.0A patent/CN111667403B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107679497A (en) * | 2017-10-11 | 2018-02-09 | 齐鲁工业大学 | Video face textures effect processing method and generation system |
CN109815813A (en) * | 2018-12-21 | 2019-05-28 | 深圳云天励飞技术有限公司 | Image processing method and Related product |
CN110175558A (en) * | 2019-05-24 | 2019-08-27 | 北京达佳互联信息技术有限公司 | A kind of detection method of face key point, calculates equipment and storage medium at device |
CN110909690A (en) * | 2019-11-26 | 2020-03-24 | 电子科技大学 | Method for detecting occluded face image based on region generation |
Also Published As
Publication number | Publication date |
---|---|
CN111667403A (en) | 2020-09-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111667403B (en) | Method and device for generating human face image with shielding | |
USRE45768E1 (en) | Method and system for enhancing three dimensional face modeling using demographic classification | |
EP2339507B1 (en) | Head detection and localisation method | |
CN111445531B (en) | Multi-view camera navigation method, device, equipment and storage medium | |
CN109376631A (en) | A kind of winding detection method and device neural network based | |
CN105989326A (en) | Method and device for determining three-dimensional position information of human eyes | |
WO2022237026A1 (en) | Plane information detection method and system | |
CN111008935A (en) | Face image enhancement method, device, system and storage medium | |
CN111563492B (en) | Fall detection method, fall detection device and storage device | |
CN107368817B (en) | Face recognition method and device | |
JP2013051477A (en) | Video monitoring device, video monitoring method, and program | |
CN111586428A (en) | Cosmetic live broadcast system and method with virtual character makeup function | |
CN103761011B (en) | A kind of method of virtual touch screen, system and the equipment of calculating | |
CN107341824A (en) | A kind of comprehensive evaluation index generation method of image registration | |
CN111353325A (en) | Key point detection model training method and device | |
JP6773825B2 (en) | Learning device, learning method, learning program, and object recognition device | |
Prasad et al. | A robust head pose estimation system for uncalibrated monocular videos | |
US8948461B1 (en) | Method and system for estimating the three dimensional position of an object in a three dimensional physical space | |
CN112991159B (en) | Face illumination quality evaluation method, system, server and computer readable medium | |
JP6950644B2 (en) | Attention target estimation device and attention target estimation method | |
CN111898552B (en) | Method and device for distinguishing person attention target object and computer equipment | |
CN111767876A (en) | Method and device for generating face image with shielding | |
US11080920B2 (en) | Method of displaying an object | |
Mayer et al. | Mcmc linked with implicit shape models and plane sweeping for 3d building facade interpretation in image sequences | |
JP7533937B2 (en) | Image processing device, image processing method, and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |