WO2022022154A1 - 脸部图像处理方法、装置、设备及存储介质 - Google Patents

脸部图像处理方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022022154A1
WO2022022154A1 PCT/CN2021/100912 CN2021100912W WO2022022154A1 WO 2022022154 A1 WO2022022154 A1 WO 2022022154A1 CN 2021100912 W CN2021100912 W CN 2021100912W WO 2022022154 A1 WO2022022154 A1 WO 2022022154A1
Authority
WO
WIPO (PCT)
Prior art keywords
face image
face
image
target
mask
Prior art date
Application number
PCT/CN2021/100912
Other languages
English (en)
French (fr)
Inventor
张勇
罗宇辰
严骏驰
刘威
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2022022154A1 publication Critical patent/WO2022022154A1/zh
Priority to US17/989,169 priority Critical patent/US20230085605A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/002Image coding using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/772Determining representative reference patterns, e.g. averaging or distorting patterns; Generating dictionaries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/776Validation; Performance evaluation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • G06V10/803Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level of input or preprocessed data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/95Pattern authentication; Markers therefor; Forgery detection
    • 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
    • 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
    • G06V40/171Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
    • 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/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • 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 present application relates to the field of computer technology, and in particular, to a facial image processing method, apparatus, computer device and storage medium.
  • a facial image processing method, apparatus, computer device and storage medium are provided.
  • a face image processing method comprising:
  • first face image and the second face image are images containing real faces
  • the target face mask being generated by randomly deforming the face region of the first face image
  • the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image.
  • a face image processing device comprising:
  • an image acquisition module for acquiring a first facial image and a second facial image, the first facial image and the second facial image are images containing real faces;
  • an image processing module for processing the first facial image to generate a first updated facial image with non-real facial image characteristics
  • a color adjustment module configured to adjust the color distribution of the first updated face image according to the color distribution of the second face image to obtain the first adjusted face image
  • a mask acquisition module for acquiring a target face mask of the first face image, where the target face mask is generated by randomly deforming the face region of the first face image
  • the image fusion module is used for fusing the first adjusted face image and the second face image according to the target face mask to obtain the target face image.
  • a computer device includes a memory and a processor, the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, causes the processor to perform the following steps:
  • first face image and the second face image are images containing real faces
  • the target face mask being generated by randomly deforming the face region of the first face image
  • the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image.
  • One or more non-volatile storage media storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the following steps when executed:
  • first face image and the second face image are images containing real faces
  • the target face mask being generated by randomly deforming the face region of the first face image
  • the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image.
  • Fig. 1 is the application environment diagram of the facial image processing method in one embodiment
  • FIG. 2 is a schematic flowchart of a facial image processing method in one embodiment
  • FIG. 3 is a schematic diagram of generating a first updated face image in one embodiment
  • FIG. 4 is a schematic flowchart of generating a target face mask in one embodiment
  • FIG. 5 is a schematic diagram of adjusting the face mask obtained in a specific embodiment
  • FIG. 6 is a schematic flowchart of obtaining a first adjusted face image in one embodiment
  • FIG. 7 is a schematic flowchart of obtaining a target face image in one embodiment
  • FIG. 8 is a schematic flowchart of obtaining a target face image in another embodiment
  • FIG. 9 is a schematic flowchart of obtaining a target face image in yet another embodiment
  • FIG. 10 is a schematic flowchart of obtaining a face detection model in one embodiment
  • FIG. 11 is a schematic flowchart of obtaining a target face image in a specific embodiment
  • FIG. 12 is a schematic diagram of a randomly selected image processing method in the specific embodiment of FIG. 11;
  • FIG. 13 is a schematic diagram of the name of the color adjustment algorithm randomly selected in the specific embodiment of FIG. 11;
  • FIG. 14 is a schematic diagram of mask generation and deformation in the specific embodiment of FIG. 11;
  • FIG. 15 is a schematic diagram of the name of the image fusion algorithm randomly selected in the specific embodiment of FIG. 11;
  • FIG. 16 is a schematic diagram of a framework of a face image processing method in a specific embodiment
  • Fig. 17 is a partial schematic diagram of the target face image generated in the specific embodiment of Fig. 16;
  • FIG. 18 is a schematic diagram of an application environment of the facial image processing method in the specific embodiment of FIG. 16;
  • FIG. 19 is a structural block diagram of a facial image processing apparatus in one embodiment
  • Figure 20 is a diagram of the internal structure of a computer device in one embodiment.
  • the facial image processing method provided in this application can be applied to the application environment shown in FIG. 1 .
  • the terminal 102 communicates with the server 104 through the network.
  • the server 104 acquires the first facial image and the second facial image from the terminal 102, and the first facial image and the second facial image are images containing real faces;
  • the server 104 processes the first facial image to generate The first update face image with the characteristics of the non-real face image; adjust the color distribution of the first update face image according to the color distribution of the second face image to obtain the first adjusted face image; obtain the target of the first face image face mask, the target face mask is generated by randomly deforming the face region of the first face image;
  • the server 104 fuses the first adjusted face image with the second face image according to the target face mask , get the target face image.
  • the terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
  • a method for processing a face image is provided, and the method is applied to the server in FIG. 1 as an example for description. It can be understood that the method can also be applied to a terminal. , can also be applied to a system including a terminal and a server, and is realized through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
  • Step 202 Acquire a first face image and a second face image, where the first face image and the second face image are images containing real faces.
  • the face image refers to a real, unforged face image, including a human face image, an animal face image, and the like.
  • the first face image refers to the source face image that needs to be fused with the face images
  • the second face image refers to the face image to be fused that needs to be fused with the face images.
  • the server acquires the first facial image and the second facial image, wherein the server can acquire the facial image in various ways, for example, the server acquires the facial image uploaded by the terminal.
  • the server may acquire the face image from a preset face image database.
  • the server may also obtain face images from third-party platforms.
  • the server may be facial images collected from the Internet.
  • the server may obtain the face image from the video.
  • the first face image and the second face image to be fused are determined from the acquired face images.
  • the acquired first facial image and the second facial image may be the same type of facial image, for example, the first facial image and the second facial image may be facial images of the same animal, the first facial image
  • the face image and the second face image may both be male face images.
  • the acquired first and second facial images may also be different types of facial images, for example, the first facial image is a cat's facial image, and the second facial image is a dog's facial image.
  • the first face image is a male face image
  • the second face image is a female face image.
  • the server obtains the first facial image and the second facial image, and when the sizes of the first facial image and the second facial image are inconsistent, the first facial image and the second facial image are The size is adjusted to the same size.
  • the size of the first face image can be adjusted to be the same as the size of the second face image. It is also possible to adjust the size of the second face image to be the same as the size of the first face image.
  • the preset size can also be obtained, and the size of the first face image and the size of the second face image are respectively adjusted to be consistent with the preset size.
  • the size of the first face image is 2.5*3.5cm
  • the size of the second face image is 3.5*4.9cm
  • the size of the first face image and the size of the second face image are adjusted to match the size of the second face image.
  • the preset size is the same as 3.5*4.9cm.
  • Step 204 Process the first face image to generate a first updated face image with the characteristics of a non-real face image.
  • the non-real face image refers to a face image that is not real and is forged by technical means, such as a face-changing image obtained through artificial intelligence face-changing technology.
  • the non-real face image characteristics refer to the image characteristics of the non-real face image, and the image characteristics include smooth image transition, inconsistent image definition, image noise, and the like.
  • the first updated face image refers to a face image obtained after image processing, and the first updated face image has the characteristics of a non-real face image. For example, the first updated face image has the effect of a face image generated using an adversarial generative network.
  • the server may use an image processing algorithm to process the first face image, and the image processing algorithm includes an image blurring algorithm, an image compression algorithm, a random noise adding algorithm, and the like.
  • the image blur algorithm includes Gaussian blur algorithm, mean value blur algorithm, double blur algorithm, bokeh blur algorithm, axis shift blur algorithm and so on.
  • Image compression algorithms include JPEG (Joint Photographic Experts Group) compression algorithms, Huffman coding compression algorithms and run-length coding compression algorithms, etc.
  • the random noise adding algorithm includes Gaussian noise adding algorithm, Poisson noise adding algorithm, salt and pepper noise adding algorithm and so on.
  • the server may randomly select an image processing algorithm to process the first face image, and obtain a first updated face image with the characteristics of a non-real face image.
  • the obtained first updated face image may have the characteristics of smooth transition. Or the characteristics of inconsistent image sharpness or the characteristics of image noise. It is also possible to select multiple image processing algorithms to process the first face image, and use the final processed image as the first updated face image with the characteristics of a non-real face image.
  • the obtained first updated face image may have characteristics of transition smoothness and inconsistent image definition, or the obtained first updated face image may have characteristics of transition smoothness and image noise, or may have inconsistent image definition and image definition. characteristics of noise. Or the obtained first updated face image has the characteristics of smooth image transition, inconsistent image definition and image noise.
  • the server may first use an image blurring algorithm to process the first face image to obtain a processed image, and then use an image compression algorithm to compress the processed image to obtain a compressed image.
  • the first updated face image can also be obtained by adding random noise to the compressed image using a random noise adding algorithm to obtain the first updated face image.
  • Step 206 Adjust the color distribution of the first updated face image according to the color distribution of the second face image to obtain a first adjusted face image.
  • the color distribution refers to the distribution of the image in the RGB (a color standard) color space.
  • the first adjusted face image refers to a face image obtained by adjusting the color distribution of the first updated face image, and the adjusted color distribution is similar to the color distribution of the second face image.
  • the server uses a color adjustment algorithm to adjust the color distribution of the first updated face image according to the color distribution of the second face image to obtain the first adjusted face image
  • the color adjustment algorithm may include a linear color migration algorithm, LAB space color migration, Probability density-based color migration and color sub-histogram matching algorithms, etc.
  • the server can randomly select a color adjustment algorithm, and then adjust the color distribution of the first updated face image according to the color distribution of the second face image according to the randomly selected color adjustment algorithm, so as to obtain the first adjustment face image.
  • Step 208 Obtain a target face mask of the first face image, where the target face mask is generated by randomly deforming the face region of the first face image.
  • the face mask means that all pixel values in the face area in the first face image are initialized to 255, that is, the face area is initialized to white, and The pixel value of the area is initialized to 0, that is, the area other than the face area is initialized to black, and the resulting image is obtained.
  • the target face mask is an image generated by randomly deforming the face region of the first face image.
  • the server obtains the target face mask of the first face image, wherein the face key points of the first face image can be extracted in advance, the face area is obtained according to the face key points, and then the face area is Perform random deformation to obtain a face image with a deformed face area, and then generate a corresponding target face mask according to the deformed face image of the face area.
  • the area of the face area can be obtained, and then the area of the face area can be adjusted randomly, for example, the area of the face area is 20, and the area of the face area is adjusted to be 21.
  • the boundary line of the face area can also be obtained, and the position or type of the boundary line of the face area can be adjusted randomly.
  • the boundary line of the straight type is adjusted by randomly shifting the position of the center point of the boundary line.
  • the coordinates of the center point of the boundary line are (1, 1), which can be randomly adjusted to (1, 2).
  • the boundary key points of the face region can also be obtained, and the positions of the boundary key points of the face region can be adjusted randomly, for example, the positions of all boundary key points are randomly shifted.
  • the server may also generate a face mask of the first face image in advance, and then randomly deform the face area in the face mask of the first face image to obtain the target face mask. In one embodiment, the server may also directly obtain the target face mask of the first face image from the database.
  • Step 210 fuse the first adjusted face image with the second face image according to the target face mask to obtain the target face image.
  • the target face image refers to a face image that is fused with the second face image according to the first adjustment, and the target face image is an unreal face image, that is, a fake face image.
  • the server uses an image fusion algorithm to fuse the first adjusted face image and the second face image according to the target face mask to obtain the target face image, wherein the image fusion algorithm includes an Alpha Blending (Alpha Blending) algorithm, Poisson fusion algorithm, Laplacian pyramid fusion algorithm, image fusion algorithm based on wavelet transform, image fusion algorithm based on neural network, etc., each time the server compares the first adjusted face image with the first adjusted face image according to the target face mask.
  • the image fusion algorithm is randomly selected first, and then the target face image is obtained by merging according to the randomly selected image fusion algorithm.
  • the first updated facial image with the characteristics of the non-real facial image is generated, and then the first updated facial image is adjusted according to the color distribution of the second facial image.
  • the color distribution of the first face image is obtained, and the first adjusted face image is obtained; and the target face mask of the first face image is obtained, and the target face mask is generated by randomly deforming the face area of the first face image.
  • the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image.
  • the target face image constructed by the above method can accurately imitate the effect of the fake face image, such as including Unreal face image characteristics, color distribution with unreal face image, face area shape with unreal face image, etc., and when a large number of target face images are generated by the above method, due to the obtained target face mask.
  • the membrane is generated by randomly deforming the face region of the first face image, so that a large number of target face images are generated with rich diversity.
  • step 204 processing the first face image to generate a first updated face image with characteristics of a non-real face image, including:
  • Step 302a using a Gaussian function to calculate the weight of the pixel points in the first face image, to obtain a pixel point fuzzy weight matrix.
  • the Gaussian function refers to the density function of the normal distribution, and the two-dimensional form of the Gaussian function is shown in the following formula (1):
  • G refers to the pixel point fuzzy weight matrix
  • e refers to the natural constant
  • refers to the pi
  • refers to the Gaussian radius, which is preset
  • x and y refer to the coordinates of the pixel points in the first face image.
  • the server obtains the preset Gaussian radius and the coordinates of the pixels in the first facial image, and then uses the Gaussian function to calculate the weights of the pixels in the first facial image to obtain a pixel fuzzy weight matrix.
  • Step 302b calculating the fuzzy pixel value of the pixel point according to the original pixel value of the pixel point in the first face image and the pixel point fuzzy weight matrix, and generating the first update with the characteristics of the non-real face image based on the fuzzy pixel value of the pixel point. face image.
  • the server uses the original pixel value of the pixel in the first face image and the fuzzy weight matrix of the pixel to perform convolution operation to obtain the fuzzy pixel value of the pixel.
  • the server may blur the first facial image using Gaussian convolution.
  • the scale of Gaussian convolution includes 3x3, 5x5, 7x7, 9x9 and 11x11 and so on.
  • the server uses Gaussian convolution to blur the first face image, it randomly selects a scale of Gaussian convolution to blur the first face image, and uses the blurred first face image to obtain the blurred first face image.
  • the image generates the target face image, which improves the diversity of the generated target face image.
  • the weight of pixels in the first face image is calculated by using a Gaussian function to obtain a pixel point fuzzy weight matrix, and then the pixel point fuzzy weight matrix is calculated according to the original pixel value of the pixel points in the first face image and the pixel point fuzzy weight matrix Obtaining the blurred pixel value of the pixel point and generating the first updated face image can quickly obtain the first updated face image, which is convenient for subsequent processing and ensures that the effect of generating the target face image reaches the effect of the fake face image.
  • step 204 processing the first face image to generate a first updated face image with characteristics of a non-real face image, including:
  • Step 304a obtaining a compression rate, and using the compression rate to compress the first face image to obtain a compressed first face image; using the compressed first face image as the first update with the characteristics of a non-real face image face image.
  • the compression ratio refers to the ratio of the memory size occupied by the face image after compression to the memory size occupied by the face image before compression, and the compression ratio has multiple preset values.
  • the server randomly obtains the compression rate used in the current compression from the preset compression rate, and then uses the compression rate to compress the first facial image, and obtains a compressed
  • the compressed first face image is used as the first updated face image with the characteristics of a non-real face image, so that the first face image with different definitions can be obtained, which is convenient for subsequent use. , and ensure that the effect of generating the target face image reaches the effect of the fake face image and improves the diversity of the generated target face image.
  • the compression rate may also be acquired by the server and sent by the terminal, that is, the user may input the compression rate through the terminal, so that the server acquires the compression rate.
  • the server takes the compression rate sent by the terminal as the compression rate used in the current compression, and compresses the first facial image to obtain a compressed first facial image.
  • step 204 processing the first face image to generate a first updated face image with characteristics of a non-real face image, including:
  • Step 306a generating a Gaussian noise value, adding the Gaussian noise value to the pixel value of the first face image, to obtain a first updated face image with characteristics of a non-real face image.
  • Gaussian noise refers to the noise whose probability density function obeys Gaussian distribution.
  • a Gaussian noise value is a sequence of random numbers randomly generated based on the mean and variance of the Gaussian noise.
  • the server pre-stores the mean and variance of different Gaussian noises.
  • the server randomly selects the mean and variance of the Gaussian noise to be used currently, and generates a Gaussian noise value according to the mean and variance of the Gaussian noise.
  • the Gaussian noise value is added to the pixel value of the first face image, and the obtained pixel value is compressed into the content of the pixel value interval to obtain the first face image with the characteristics of the non-real face image.
  • the Gaussian noise value Generate the first updated face image with the characteristics of the non-real face image, which is convenient for subsequent use, and ensures that the effect of generating the target face image reaches the effect of the fake face image.
  • the server may directly obtain the preset Gaussian noise value from the database.
  • the server can also obtain the Gaussian noise value uploaded by the terminal, and can also obtain the Gaussian noise value sent by the service server.
  • a target face mask of the first face image is obtained, and the target face mask is generated by randomly deforming the face region of the first face image, include:
  • Step 402 extracting face key points in the first face image, and determining a face region of the first face image according to the face key points.
  • the face key points are used to represent the features of the face.
  • the server uses a facial key point extraction algorithm to extract the facial key points in the first facial image, wherein the facial key point extraction algorithm includes an extraction algorithm based on a feature point distribution model (Point Distribution Model, PDM), Based on Cascaded Pose Regression (CPR, Cascaded Pose Regression) algorithm and deep learning-based algorithm, etc.
  • a feature point distribution model Point Distribution Model, PDM
  • CPR Cascaded Pose Regression
  • deep learning-based algorithm etc.
  • the facial key point extraction algorithm may specifically be an ASM (Active Shape Model, active shape model) algorithm, AAM (Active Appearnce Modl, active appearance model) algorithm, CPR (Cascaded pose regression, cascaded pose regression), SDM (Supervised Descent Method, supervised descent method) algorithm and Deep Convolutional Neural Network (DCNN, Deep Convolutional Network) algorithm, and then connect the extracted face key points into a polygon, which contains all the extracted face key points, inside the polygon is the face region of the first face image.
  • ASM Active Shape Model, active shape model
  • AAM Active Appearnce Modl, active appearance model
  • CPR Cascaded pose regression, cascaded pose regression
  • SDM Supervised Descent Method, supervised descent method
  • DCNN Deep Convolutional Neural Network
  • the server extracts 68 facial key points by using landmark (a technology of human facial feature point extraction) algorithm, and by connecting the facial key points into a polygon, the polygon contains 68 faces The key point is to obtain the face region of the first face image.
  • landmark a technology of human facial feature point extraction
  • the server may generate a face mask based on determining the face region of the first face image. That is, the face mask is generated by using the undeformed first face image, and the generated face mask is used as the target face mask for subsequent processing, so that the generated target face image has diversity.
  • Step 404 Randomly adjust the positions of key points of the face in the face region of the first face image to obtain a deformed face region, and generate a target face mask according to the deformed face region.
  • the server randomly changes the position of the face key points in the face region of the first face image, and connects the face key points whose positions are changed into polygons to obtain the deformed face region, and then according to the deformed face region and other regions of the first face image to generate a target face mask.
  • the position of each face key point changes randomly, that is, the random change value of the face key point position and the original value of the face key point position can be obtained, and the random change value of the face key point position and the original face key point position can be calculated. The sum of the values, get the position value of the face key point after the change.
  • the server may randomly adjust the position of the face key points on the polygon boundary, and connect the face key points whose positions have changed into a polygon to obtain a deformed face area.
  • the position of the facial key points in the first facial image can be directly adjusted randomly to obtain the deformed facial region.
  • the face region generates the target face mask.
  • the deformed facial area is obtained, the target facial mask is generated according to the deformed facial area, and the target face is used The facial mask is used for subsequent processing, which improves the diversity of the generated target face images.
  • the target face mask is generated by randomly morphing the face region of the first face image, and further Include steps:
  • the occlusion detection refers to detecting whether the face region in the second face image is occluded.
  • the face occlusion area refers to an area in the second face image where the face is occluded. Adjusting the face mask is a face mask obtained by removing the face occlusion area from the face area in the target face mask.
  • the server performs face occlusion detection on the second facial image by using a deep learning segmentation network algorithm, obtains each segmented area, and determines the facial occlusion area from the segmented areas. Then adjust the binarization value corresponding to each pixel in the target face mask according to the binarization value corresponding to each pixel in the face occlusion area, and obtain the adjusted binarization value of each pixel. The adjusted binarization value of each pixel is obtained as the adjusted face mask.
  • the deep learning segmentation network algorithm can be Unet (a semantic segmentation network based on FCN) network algorithm
  • FCN Full convolutional networks for semantic segmentation, fully convolutional neural network
  • SegNet an encoder-decoder structure of convolutional neural network
  • Deeplab Deeplab (hole convolutional network) network algorithm and so on.
  • FIG. 5 it is a schematic diagram of adjusting the face mask.
  • the adjusted face mask 52 is obtained by adjusting the target face mask 50 according to the face occlusion area.
  • Step 210 fusing the first adjusted face image with the second face image according to the target face mask to obtain the target face image, including the steps:
  • the first adjusted face image and the second face image are fused according to the adjusted face mask to obtain the target face image.
  • the server uses an image fusion algorithm to fuse the first adjusted face image and the second face image according to the adjusted face mask to obtain the target face image.
  • the adjusted face mask is obtained by performing occlusion detection on the second face image, and the adjusted face mask is used to fuse the first adjusted face image and the second face image to obtain the target face image to improve the diversity of generated target face images.
  • adjusting the target face mask according to the face occlusion area to obtain the adjusted face mask includes the steps of:
  • the adjusted face mask is obtained according to the mask adjustment value.
  • the pixel point mask value refers to the binarization value of the pixel point in the target face mask
  • the occlusion value refers to the binarization value of the pixel point in the face occlusion area.
  • the mask adjustment value refers to the binarization value of each pixel of the adjusted face mask.
  • the server calculates the difference between the mask value of each pixel in the target face mask and the occlusion value of the pixel in the face occlusion area in the second facial image to obtain the mask adjustment value.
  • the value of the pixels in the face region in the target face mask is 1, and the pixels in other regions are 0.
  • the pixel in the face occlusion area is 1, and the unoccluded area is 0.
  • Use the value of each pixel in the target face mask to subtract the value of each pixel in the second face image to obtain the value of each pixel after adjustment, and obtain the adjusted face according to the value of each pixel after adjustment external mask.
  • the difference between the mask value of the pixel in the target face mask and the occlusion value of the pixel in the face occlusion area is directly calculated, the difference is used as the mask adjustment value, and the adjusted face is obtained according to the mask adjustment value. It is ensured that when the face mask is adjusted to generate the target face image, the generated target face image achieves the effect of a fake face.
  • step 206 adjusting the color distribution of the first updated face image according to the color distribution of the second face image to obtain the first adjusted face image, including:
  • Step 602 Obtain a target color adjustment algorithm identifier, call the target color adjustment algorithm according to the target color adjustment algorithm identifier, and the target color adjustment algorithm includes at least one of a color migration algorithm and a color matching algorithm.
  • the target color adjustment algorithm identifier is used to uniquely identify the color adjustment algorithm. Both the target color transfer algorithm and the color matching algorithm are used to make adjustments to the color distribution. Among them, the color migration algorithm includes: linear color migration algorithm, LAB space color migration algorithm, and probability density-based color migration algorithm. The color matching algorithm includes a color histogram matching algorithm and the like.
  • each time the server adjusts the color distribution of the first updated face image according to the color distribution of the second face image it randomly selects the target color adjustment algorithm, that is, obtains the target color adjustment algorithm identifier corresponding to the selected target color adjustment algorithm .
  • the target color adjustment algorithm is then called with the target color adjustment algorithm flag.
  • the calling interface of each target color adjustment algorithm may be generated in advance, the corresponding calling interface may be obtained according to the target color adjustment algorithm identifier, and the target color adjustment algorithm may be called by using the calling interface.
  • Step 604 based on the target color adjustment algorithm, adjust the color distribution of the first updated face image to be consistent with the color distribution of the second face image to obtain a first adjusted face image.
  • the server executes the target color adjustment algorithm, and adjusts the color distribution of the first updated face image to be consistent with the color distribution of the second face image to obtain the first adjusted face image.
  • the color distribution of the first updated face image may be adjusted to obtain the first adjusted face image when the color distribution of the second face image is within a preset threshold.
  • the color distribution of the first updated face image is adjusted to be consistent with the color distribution of the second face image, and the first adjusted face image is obtained, so that the first adjusted face image has the color distribution of the second face image.
  • Color information so that the generated target face image does not contain obvious face-changing boundaries, ensuring that the generated target face image can accurately simulate the effect of fake face, and each time the color distribution adjustment is performed, the target color adjustment is randomly selected.
  • the algorithm performs color distribution adjustments, thereby increasing the diversity of the generated target face images.
  • step 210 the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image, including:
  • Step 702 Obtain a target image fusion algorithm identifier, and call the target image fusion algorithm according to the target image fusion algorithm identifier; the target image fusion algorithm includes at least one of a transparent hybrid algorithm, a Poisson fusion algorithm, and a neural network algorithm.
  • the target image fusion algorithm identifier is used to uniquely identify the target image fusion algorithm, and is used to call the corresponding target image fusion algorithm.
  • the server randomly selects the target image fusion algorithm identifier from the stored image fusion algorithm identifiers, and executes the corresponding image fusion algorithm according to the target image fusion algorithm identifier.
  • the server obtains a call interface of the corresponding target image fusion algorithm according to the target image fusion algorithm identifier, and uses the call interface to call the target image fusion algorithm.
  • the target image fusion algorithm includes at least one of transparent mixing algorithm, Poisson fusion algorithm and neural network algorithm.
  • the neural network algorithm uses the neural network training to obtain the image fusion model in advance, and uses the image fusion model for fusion.
  • Step 704 using the target image fusion algorithm to fuse the first adjusted face image and the second face image based on the target face mask to obtain the target face image.
  • each time the server fuses the first adjusted face image with the second face image uses a randomly selected target image fusion algorithm to fuse based on the target face mask to obtain a fused face image, that is, the target face image.
  • the server inputs the target face mask, the first adjusted face image, and the second face image into an image fusion model trained by using a neural network to obtain an output fused face image, that is, Get the target face image.
  • the generated target face image can be with diversity.
  • step 704 using a target image fusion algorithm to fuse the first adjusted face image and the second face image based on the target face mask to obtain the target face image, including:
  • Step 802 Determine a first adjusted face region from the first adjusted face image according to the target face mask.
  • the first adjusted face area refers to the face area in the first adjusted face image.
  • the server calculates the product of the mask value of each pixel in the target face mask and the pixel value of each pixel in the first adjusted face image, and obtains the first adjusted face region according to the multiplication result.
  • Step 804 fuse the first adjusted face region to the position of the face region in the second face image to obtain a target face image.
  • the server calculates the product of the inverse value of the mask value of each pixel in the target face mask and the pixel value of each pixel in the second facial image, and determines the position of the face region in the second facial image according to the multiplication result , and then fuse the first adjusted face region to the position of the face region in the second face image to obtain the target face image.
  • out refers to the output pixel value
  • refers to the pixel value in the target face mask
  • the value range is [0, 1].
  • A is the pixel value in the second face image
  • B is the pixel value in the first adjusted face image.
  • the target face image is obtained by fusing the first adjusted face region to the position of the face region in the second face image, which can conveniently and quickly obtain the target face image.
  • step 704 using a target image fusion algorithm to fuse the first adjusted face image and the second face image based on the target face mask to obtain the target face image, including:
  • Step 902 Determine a region of interest from the first adjusted face image according to the target face mask, and calculate a first gradient field of the region of interest and a second gradient field of the second face image.
  • the region of interest refers to a face region in the first adjusted face image.
  • the server determines the region of interest from the first adjusted face image according to the face region in the target face mask, and uses the difference operation to calculate the first gradient field of the region of interest and the second gradient field of the second face image .
  • the gradients of the region of interest in two directions can be calculated, and the first gradient field can be obtained according to the gradients in the two directions. It is also possible to calculate the gradients of the second face image in two directions, and obtain the second gradient field according to the gradients in the two directions.
  • Step 904 Determine a fusion gradient field according to the first gradient field and the second gradient field, and use the fusion gradient field to calculate the fusion divergence field.
  • the fusion gradient field refers to the gradient field corresponding to the target face image.
  • the fused divergence field refers to the divergence corresponding to the target face image, that is, the Laplacian coordinates.
  • the server overlays the first gradient field on the second gradient field to obtain a fusion gradient field.
  • the server calculates the partial derivatives of the gradients in the fused gradient field to obtain the fused divergence field.
  • the server can separately calculate the partial derivatives of the gradient in two different directions in the fusion gradient field, and then add the partial derivatives in the two different directions to obtain the fusion divergence field.
  • Step 906 Determine the second fusion pixel value based on the fusion divergence field, and obtain the target face image according to the second fusion pixel value.
  • the second fusion pixel value refers to the pixel value of each pixel point in the target face image.
  • the server uses the fusion divergence field to construct a coefficient matrix according to the Poisson re-intersection equation, then calculates the second fusion pixel value according to the coefficient matrix, and obtains the target face image according to the second fusion pixel value.
  • the obtained target face image can have various sex.
  • the target face image is used to train a face detection model, which is used to detect the authenticity of the face image.
  • the server uses the method for obtaining the target face image in the above embodiments to generate a large number of target face images for training to obtain a face detection model, and the face detection model is used to detect the authenticity of the face image.
  • the face detection model is used to detect the authenticity of the face image.
  • the training of the face detection model includes the following steps:
  • Step 1002 obtaining a real face image data set and a target face image data set, each target face image in the target face image data set is a first real face image and a second real face image different in the real face image data set. If the face image is generated, the target face image dataset is used as the current face image dataset.
  • the real face image dataset refers to an image dataset composed of real face images.
  • the real face image data set obtained by the server may be obtained from a third-party real face image database. It can also be obtained by collecting images of real faces.
  • the server uses different first real face images and second real face images in the real face image data set to generate each target face image, wherein the first real face image and the second real face image may use different Different image processing algorithms, different color adjustment algorithms and different image fusion algorithms are randomly combined to generate different target face images.
  • the respective different target face images may also be generated using a random combination of different first real face images and second real face images using different image processing algorithms, different color adjustment algorithms, and different image fusion algorithms.
  • the real face image dataset may be obtained from the real face video provided in FaceForensic++ (a face image dataset). Then use the real face in FaceForensic++ to generate the target face image dataset.
  • Step 1004 take each real face image in the real face image data set as positive sample data, and use each current face image in the current face image data set as negative sample data, use a deep neural network algorithm for training, and obtain the current face image. Detection model.
  • the server uses each real face image in the real face image data set and each current face image in the current face image data set as input to the model for training, and when the training completion condition is met, the current face detection model is obtained.
  • the training completion condition includes that the training reaches the maximum number of iterations or the value of the loss function meets the preset threshold condition.
  • the server uses the Xception (an extension of the Inception deep convolutional network) network as the network structure of the model, and uses cross-entropy (cross entropy) as the loss function for model training.
  • the training completion condition is reached, the current face detection model is obtained.
  • a network with stronger expressive ability can also be used as the network result of the model for training, for example, using ResNet101 deep residual network, ResNet152 deep residual network and so on.
  • Step 1006 obtain the test face image data, use the test face image data to test the current face detection model, obtain the corresponding accuracy of the current face detection model, and the test face image data and the real face image data set are different data sets .
  • the server may obtain test face image data from a third-party database, where the test face image data and the real face image data set are different data sets. Then use the test face image data to test the current face detection model, in which AUC (area under curve, area under the curve) and AP (average precision, average accuracy) can be used as evaluation indicators to obtain the current face detection model to detect the face accuracy of the authenticity of the external image.
  • AUC area under curve, area under the curve
  • AP average precision, average accuracy
  • Step 1008 determine whether the accuracy exceeds the preset accuracy threshold, and when the accuracy exceeds the preset accuracy threshold, execute step 1010a. When the preset accuracy threshold is not exceeded, step 1010b is performed.
  • Step 1010b obtain the update target face image data set, the update target face image data set includes each target face image in the target face image data set and each update target face image, and each update target face image is a real face image.
  • the first real face image and the second real face image are regenerated from different first real face images in the external image dataset. Take the update target face image data set as the current face image data set, and return to step 1004 for execution.
  • Step 1010a using the obtained current face detection model as a face detection model.
  • the preset accuracy threshold refers to the preset accuracy threshold of the face detection model for detecting the authenticity of the face image.
  • the server obtains the updated target face image dataset, and uses the updated target face Iteratively trains the current face detection model again on the partial image dataset.
  • the updated target face image dataset includes the target face image used in the previous training and the regenerated target face image. That is, the face detection model is trained by augmenting the target face images in the training samples.
  • the target face image data set by obtaining the target face image data set, and then using the target face image data set and the real face image data set to train to obtain the face detection model, since the target face image data set has rich diversity of targets face image, thereby improving the generalization ability of the trained face detection model, and then using the face detection model to detect the authenticity of the face image, thereby improving the accuracy of detecting the authenticity of the face image.
  • the existing face intelligence model and the face detection model of the present application are tested by using the test face image data, and the obtained evaluation index data is shown in Table 1 below:
  • the test data set 1 can be celeb-DF (deep face extraction data set), and the test data set 2 can be the data set of DFDC (Deepfake Detection Challenge, deep fake action detection challenge).
  • DFDC Deep false action detection challenge
  • the evaluation indicators of the face detection model obtained by training after data enhancement in this application have achieved better results than the evaluation indicators of the existing artificial intelligence models. That is, the face detection model of the present application significantly improves the generalization performance of the model, thereby making the detection result more accurate.
  • the method further includes:
  • the face image to be detected is acquired, the face image to be detected is input into the face detection model for detection, the detection result is obtained, and alarm information is generated when the detection result is a non-real face image.
  • the face image to be detected refers to a face image whose authenticity needs to be detected. Detect whether the face image to be detected by the test strip is the result of the real face image, including the result of the non-real face image and the real face image.
  • the alarm information is used to remind that the face image to be detected is unreal, indicating that the face image to be detected is an unreal face image.
  • the server obtains the face image to be detected, and the face image to be detected may be a face image uploaded by a user, a face image recognized by the server from various videos, or a database in the server. Saved face images and more.
  • the server deploys the trained face detection model in advance, and then inputs the face image to be detected into the face detection model for detection, that is, the detection result output by the face detection model is obtained.
  • the detection result is that the face image to be detected is a real face image
  • no processing is performed.
  • the detection result is that the face image to be detected is an unreal face image
  • alarm information is generated, and the alarm information is sent to the management terminal for display, so that the management terminal can perform subsequent processing.
  • the detection result is obtained, and when the detection result is a non-real face image, alarm information is generated, which improves the detection model of the face detection model for non-real faces.
  • the accuracy of the detection of the external image is improved.
  • the facial image processing method specifically includes the following steps:
  • Step 1102 obtaining a real face image data set, and randomly selecting a first face image and a second face image from the real face image data set;
  • Step 1104 using a Gaussian function to calculate the weight of the pixels in the first face image to obtain a pixel point blur weight matrix.
  • the first updated face image is generated by calculating the blurred pixel value of the pixel point according to the original pixel value of the pixel point in the first face image and the blurred weight matrix of the pixel point. That is, Gaussian blur is performed.
  • Step 1106 Randomly obtain a compression ratio, and use the compression ratio to compress the first updated face image to obtain a second updated face image. That is, image compression is performed.
  • Step 1108 Generate a Gaussian noise value, add the Gaussian noise value to the pixel value of the second updated face image, and obtain a third updated face image. That is, random noise addition is performed.
  • the server when generating the target face image, may randomly select the steps to be performed from steps 1104, 1106 and 1108, obtain the corresponding updated face image, and use the corresponding updated face image to perform subsequent steps. deal with.
  • the server can execute step 1104 or step 1106 or step 1108 or execute steps 1104 and 1106 or execute steps 1106 and 1108 to obtain the corresponding execution result, where the execution result of the previous step is the execution result of the previous step. to be processed.
  • the generated updated face image has the effect of confronting the generation network, it can have one effect or multiple effects, as shown in FIG.
  • Step 1110 Randomly obtain the target color adjustment algorithm identification, call the target color adjustment algorithm according to the target color adjustment algorithm identification, and adjust the color distribution of the third updated face image according to the color distribution of the second face image based on the target color adjustment algorithm to obtain the first - Adjust the face image.
  • the target image fusion algorithm is randomly selected from the target color adjustment algorithms included in FIG. 13 .
  • Step 1112 extracting face key points in the first face image, determining the face region of the first face image according to the face key points, randomly adjusting the position of the face key points in the face region of the first face image, The deformed face area is obtained, and the target face mask is generated according to the deformed face area.
  • Figure 14 it is a schematic diagram of mask generation and random deformation.
  • Step 1114 Perform face occlusion detection on the second face image to obtain a face occlusion area, calculate the difference between the mask value of the pixel points in the target face mask and the occlusion value of the pixel points in the face occlusion area, and calculate the difference value.
  • the mask adjustment value an adjusted face mask is obtained according to the mask adjustment value.
  • Step 1116 Randomly obtain the target image fusion algorithm identifier, call the target image fusion algorithm according to the target image fusion algorithm identifier, and use the target image fusion algorithm to fuse the first adjusted face image and the second face image based on the target face mask, Get the target face image.
  • FIG. 15 it is a schematic diagram of the names of image fusion algorithms that can be randomly selected, and the name of the target image fusion algorithm is randomly selected from the 15 kinds of image fusion algorithms included in the figure.
  • the server repeatedly executes the above steps, and each time during execution, randomly selects a corresponding method from FIG. 12 , FIG. 13 , FIG. 14 and FIG. 15 to execute the corresponding steps to ensure the generation of diverse
  • Each target face image is obtained to obtain a target face image dataset.
  • the present application also provides an application scenario where the above-mentioned facial image processing method is applied.
  • the application of the face image processing method in this application scenario is as follows:
  • a schematic diagram of a face image processing framework is improved.
  • the server obtains a real face image A and a real face image B.
  • the real face image A is processed to generate a first updated face image with non-real face image characteristics; the color distribution of the first updated face image is adjusted according to the color distribution of the real face image B, and the first adjusted face image is obtained.
  • a corresponding face mask is generated according to the real face image A, and then the face mask is deformed to obtain the deformed target face mask.
  • the first adjusted face image and the real face image B are fused according to the target face mask to obtain the target face image.
  • FIG 17 a partial schematic diagram of the generated target face images is shown in Figure 17, including synthetic face images with high realism and synthetic people with poor realism Face images, the synthetic face images shown in Fig. 17 are all colored images. Then use the generated large number of target face images and real face images to train the face authenticity detection model. Then the face authenticity detection model is deployed in the face recognition payment platform, as shown in Figure 18, which is a schematic diagram of the application environment of the face image processing method. The face image processing method is applied to the face recognition payment platform, wherein , including the user terminal 1802 , the platform server 1804 and the monitoring terminal 1806 .
  • the face image is collected by the camera, and the face image is transmitted to the platform server 1804 through the network.
  • the platform server 1804 uses the deployed face authenticity detection model to collect the face image. Authenticity detection is carried out to obtain the detection result.
  • the detection result is a non-real face
  • an alarm message is generated indicating that the face recognition failed, the face is a non-real face
  • the alarm information is sent to the monitoring terminal 1806 for display.
  • the payment failure information is sent to the user terminal 1802 for display.
  • the present application further provides an application scenario, where the above-mentioned facial image processing method is applied to the application scenario.
  • the application of the face image processing method in this application scenario is as follows:
  • a first face image and a second face image are acquired, where the first face image and the second face image are images containing real faces.
  • the first face image is processed to generate a first updated face image with characteristics of a non-real face image. Adjust the color distribution of the first updated face image according to the color distribution of the second face image to obtain the first adjusted face image.
  • the target face mask of the first face image is obtained, and the target face mask is generated by randomly deforming the face area of the first face image.
  • the first adjusted face image and the second face image are fused according to the target face mask to obtain the target face image.
  • a large number of target face images are generated by the above method, a large number of target face images and real face image data sets are used to train a face-swapping detection model, and the face-swapping detection model is deployed to the Internet video media platform for use.
  • the Internet video media platform obtains the video uploaded by the user, it obtains the face image from the video, inputs the face image to be detected into the face-changing detection model, and obtains the face-changing detection result.
  • the face-changing detection result includes The face image after face change and the face image without face change, wherein, the face image after face change is a non-real face image, and the face image without face change is a real face image.
  • the face image to be detected is the face image after face swap, and it is recognized that the face image after face swap violates the portrait right, it is forbidden to publish the video uploaded by the user, and the reason for prohibiting the publication of the video is returned to the user.
  • steps in the flowcharts of FIGS. 2-4 and 6-11 are sequentially displayed according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIGS. 2 to 4 and FIGS. 6 to 11 may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in the other steps.
  • a facial image processing apparatus 1900 is provided.
  • the apparatus can adopt software modules or hardware modules, or a combination of the two to become a part of computer equipment.
  • the apparatus specifically includes: Image acquisition module 1902, image processing module 1904, color adjustment module 1906, mask acquisition module 1908 and image fusion module 1910, wherein:
  • An image acquisition module 1902 configured to acquire a first facial image and a second facial image, the first facial image and the second facial image are images containing real faces;
  • the image processing module 1904 is used to process the first face image to generate a first updated face image with the characteristics of a non-real face image;
  • the color adjustment module 1906 is configured to adjust the color distribution of the first updated face image according to the color distribution of the second face image to obtain the first adjusted face image;
  • the mask obtaining module 1908 is used to obtain the target face mask of the first face image, where the target face mask is generated by randomly deforming the face region of the first face image;
  • the image fusion module 1910 is configured to fuse the first adjusted face image with the second face image according to the target face mask to obtain the target face image.
  • the image processing module 1904 includes:
  • Gaussian blur unit used to calculate the weight of the pixel points in the first face image by using the Gaussian function, and obtain the pixel point fuzzy weight matrix; calculate the pixel point according to the original pixel value of the pixel point in the first face image and the pixel point fuzzy weight matrix.
  • the blurred pixel value of the point based on the blurred pixel value of the pixel point, the first updated face image with the characteristics of the non-real face image is generated.
  • the image processing module 1904 includes:
  • the image compression unit is used to obtain a compression rate, and use the compression rate to compress the first face image to obtain a compressed first face image; take the compressed first face image as a non-real face image characteristic First update the face image.
  • the image processing module 1904 includes:
  • the noise condition unit is used to generate a Gaussian noise value, and add the Gaussian noise value to the pixel value of the first face image to obtain a first updated face image with characteristics of a non-real face image.
  • the mask acquisition module 1908 includes:
  • a key point extraction unit used for extracting face key points in the first face image, and determining the face area of the first face image according to the face key points;
  • the calling unit is used for randomly adjusting the position of the key points of the face in the face region of the first face image, to obtain the deformed face region, and to generate a target face mask according to the deformed face region.
  • the facial image processing apparatus 1900 further includes:
  • an occlusion detection module configured to perform face occlusion detection on the second face image to obtain a face occlusion area
  • the mask adjustment module is used to adjust the target face mask according to the face occlusion area to obtain the adjusted face mask
  • the image fusion module 1910 is further configured to fuse the first adjusted face image with the second face image according to the adjusted face mask to obtain the target face image.
  • the mask adjustment module is further configured to calculate the difference between the mask value of the pixel points in the target face mask and the occlusion value of the pixel points in the face occlusion area, and use the difference as the mask adjustment value; Membrane adjustment value gets adjusted face mask.
  • the color adjustment module 1906 is further configured to obtain a target color adjustment algorithm identification, and call the target color adjustment algorithm according to the target color adjustment algorithm identification, and the target color adjustment algorithm includes at least one of a color migration algorithm and a color matching algorithm; Based on the target color adjustment algorithm, the color distribution of the first updated face image is adjusted to be consistent with the color distribution of the second face image to obtain the first adjusted face image.
  • the image fusion module 1910 includes:
  • a calling unit configured to obtain a target image fusion algorithm identifier, and call the target image fusion algorithm according to the target image fusion algorithm identifier;
  • the target image fusion algorithm includes at least one of a transparent hybrid algorithm, a Poisson fusion algorithm, and a neural network algorithm;
  • the fusion unit is configured to use the target image fusion algorithm to fuse the first adjusted face image and the second face image based on the target face mask to obtain the target face image.
  • the fusion unit is further configured to determine the first adjusted face area from the first adjusted face image according to the target face mask; and fuse the first adjusted face area into the face in the second face image At the location of the region, the target face image is obtained.
  • the fusion unit is further configured to determine a region of interest from the first adjusted face image according to the face mask, and calculate a first gradient field of the region of interest and a second gradient field of the second face image;
  • the fusion gradient field is determined according to the first gradient field and the second gradient field, and the fusion gradient field is used to calculate the fusion divergence field;
  • the second fusion pixel value is determined based on the fusion divergence field, and the target face image is obtained according to the second fusion pixel value.
  • the facial image processing apparatus 1900 further includes:
  • the data acquisition module is used to acquire the real face image data set and the target face image data set.
  • Each target face image in the target face image data set is obtained by using different first real face images and different real face images in the real face image data set.
  • the second real face image is generated, and the target face image data set is used as the current face image data set.
  • the model training module is used to use each real face image in the real face image data set as positive sample data, and use each current face image in the current face image data set as negative sample data, and use the deep neural network algorithm for training to obtain current face detection model;
  • the model test module is used to obtain the test face image data, use the test face image data to test the current face detection model, and obtain the corresponding accuracy of the current face detection model.
  • the test face image data and the real face image data set are: different datasets;
  • the update data acquisition module is used to acquire and update the target face image data set when the accuracy is less than the preset accuracy threshold, and the update target face image data set includes each target face image in the target face image data set and each update target face images, each updated target face image is regenerated using different first real face images and second real face images in the real face image data set;
  • the iterative loop module is used to take the update target face image data set as the current face image data set, return each real face image in the real face image data set as positive sample data, and use the current face image data set of each current face image data set as positive sample data.
  • the face image is used as negative sample data, and the deep neural network algorithm is used for training to obtain the current face detection model.
  • the steps are executed until the accuracy exceeds the preset accuracy threshold, and the obtained current face detection model is used as the face detection model. .
  • the facial image processing apparatus 1900 further includes:
  • the image detection module is used to obtain the face image to be detected, input the face image to be detected into the face detection model for detection, obtain the detection result, and generate alarm information when the detection result is a non-real face image.
  • Each module in the above-mentioned facial image processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof.
  • the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device in one embodiment, the computer device may be a server, and its internal structure diagram may be as shown in FIG. 20 .
  • the computer device includes a processor, memory, and a network interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions and a database.
  • the internal memory provides an environment for the execution of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the computer device's database is used to store target face image data.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer readable instructions when executed by a processor, implement a facial image processing method.
  • FIG. 20 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
  • a computer device is also provided, including a memory and a processor, where computer-readable instructions are stored in the memory, and when the processor executes the computer-readable instructions, the steps in the foregoing method embodiments are implemented.
  • a computer device including a memory and a processor, where computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the processor, the above-mentioned method embodiments are implemented when the processor is executed. steps in .
  • one or more non-volatile storage media are provided that store computer-readable instructions that, when executed by one or more processors, cause the one or more processors to execute At the same time, the steps in the above method embodiments are implemented.
  • a computer program product or computer program comprising computer instructions stored in a computer readable storage medium.
  • the processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps in the foregoing method embodiments.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, or optical memory, and the like.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • the RAM may be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Human Computer Interaction (AREA)
  • Image Processing (AREA)

Abstract

一种脸部图像处理方法、装置、计算机设备和存储介质。所述方法包括:获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像(步骤202);对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像(步骤204);根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像(步骤206);获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的(步骤208);根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。采用本方法能够生成多样性的目标脸部图像(步骤210)。

Description

脸部图像处理方法、装置、设备及存储介质
本申请要求于2020年07月27日提交中国专利局,申请号为2020107302099,申请名称为“脸部图像处理方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及一种脸部图像处理方法、装置、计算机设备和存储介质。
背景技术
随着人工智能技术的发展,出现了换脸技术,即将人脸图像中的人脸替换成另一个人脸,得到假脸图像。越来越多的应用场景需要使用假脸图像,比如,人脸识别场景中对假脸图像的识别,使用假脸图像生成搞笑视频等等。然而,目前的假脸图像都是直接将人脸图像中的人脸替换成另一个人脸,生成的假脸图像多样性较低。
发明内容
根据本申请提供的各种实施例,提供一种脸部图像处理方法、装置、计算机设备和存储介质。
一种脸部图像处理方法,所述方法包括:
获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;
对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;
获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;及
根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
一种脸部图像处理装置,所述装置包括:
图像获取模块,用于获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;
图像处理模块,用于对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
颜色调整模块,用于根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;
掩膜获取模块,用于获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;及
图像融合模块,用于根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤:
获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;
对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;
获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;及
根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
一个或多个存储有计算机可读指令的非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行时实现以下步骤:
获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;
对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;
获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;及
根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本发明实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为一个实施例中脸部图像处理方法的应用环境图;
图2为一个实施例中脸部图像处理方法的流程示意图;
图3为一个实施例中生成第一更新脸部图像的示意图;
图4为一个实施例中生成目标脸部掩膜的流程示意图;
图5为一个具体实施例中得到的调整脸部掩膜的示意图;
图6为一个实施例中得到第一调整脸部图像的流程示意图;
图7为一个实施例中得到目标脸部图像的流程示意图;
图8为另一个实施例中得到目标脸部图像的流程示意图;
图9为又一个实施例中得到目标脸部图像的流程示意图;
图10为一个实施例中得到脸部检测模型的流程示意图;
图11为一个具体实施例中得到目标脸部图像的流程示意图;
图12为图11具体实施例中随机选择的图像处理方法的示意图;
图13为图11具体实施例中随机选择的颜色调整算法名称示意图;
图14为图11具体实施例中掩膜生成与变形的示意图;
图15为图11具体实施例中随机选择的图像融合算法名称示意图;
图16为一个具体实施例中脸部图像处理方法的框架示意图;
图17为图16具体实施例中生成的目标脸部图像的部分示意图;
图18为图16具体实施例中脸部图像处理方法的应用环境示意图;
图19为一个实施例中脸部图像处理装置的结构框图;
图20为一个实施例中计算机设备的内部结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申 请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例提供的方案涉及人工智能的图像检测、深度学习等技术,具体通过如下实施例进行说明:
本申请提供的脸部图像处理方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。服务器104从终端102获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;服务器104对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;服务器104根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
在一个实施例中,如图2所示,提供了一种脸部图像处理方法,以该方法应用于图1中的服务器为例进行说明,可以理解的是,该方法也可以应用于终端中,还可以应用于包括终端和服务器的系统,并通过终端和服务器的交互实现。本实施例中,该方法包括以下步骤:
步骤202,获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像。
其中,脸部图像是指真实存在,未被伪造的脸部图像,包括人脸部图像和动物脸部图像等等。第一脸部图像是指需要进行脸部图像融合的源脸部图像,第二脸部图像是指需要进行脸部图像融合的待融合脸部图像。
具体的,服务器获取到第一脸部图像和第二脸部图像,其中,服务器可以通过多种不同的方式获取脸部图像,比如,服务器获取到终端上传的脸部图像。服务器可以从预设的脸部图像数据库中获取到脸部图像。服务器还可以从第三方的平台中获取到脸部图像。服务器可以是从互联网采集的脸部图像。服务器可以是从视频中获取到脸部图像。然后从获取到的脸部图像中确定要融合的第一脸部图像和第二脸部图像。其中,获取到的第一脸部图像和第二脸部图像可以是同类型的脸部图像,比如,第一脸部图像和第二脸部图像可以是同种动物的脸部图像,第一脸部图像和第二脸部图像也可以都是男性的人脸图像。获取到的第一脸部图像和第二脸部图像也可以是不同类型的脸部图像,比如,第一脸部图像是猫的脸部图像,第二脸部图像是狗的脸部图像。又比如,第一脸部图像是男性的人脸图像,第二脸部图像是女性的人脸图像。
在一个实施例中,服务器获取到第一脸部图像和第二脸部图像,当第一脸部图像和第二脸部图像尺寸大小不一致时,将第一脸部图像和第二脸部图像的尺寸大小调整到一致。比如,可以将第一脸部图像尺寸大小调整至于与第二脸部图像的尺寸大小相同。也可以将第二脸部图像尺寸大小调整至于与第一脸部图像的尺寸大小相同。还可以获取到预先设置好的尺寸大小,分别将第一脸部图像尺寸大小和第二脸部图像的尺寸大小调整至于与预先设置好的尺寸大小一致。例如,第一脸部图像的尺寸大小为2.5*3.5cm,第二脸部图像的尺寸大小为3.5*4.9cm,将第一脸部图像尺寸大小和第二脸部图像的尺寸大小调整至于与预先设置好的尺寸大小3.5*4.9cm一致。
步骤204,对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像。
其中,非真实脸部图像是指不是真实的,是通过技术手段伪造的脸部图像,比如,通过人工智能换脸技术得到的换脸后的图像。非真实脸部图像特性是指非真实脸部图像的图像特性,该图像特性包括图像过渡平滑、图像清晰度不一致以及有图像噪声等等。第一更新脸部图像是指经过图像处理后得到的脸部图像,该第一更新脸部图像具有非真实脸部图像特性。 比如,该第一更新脸部图像具有使用对抗生成网络生成的脸部图像的效果。
具体地,服务器可以使用图像处理算法对第一脸部图像进行处理,该图像处理算法包括图像模糊算法、图像压缩算法和随机噪声添加算法等等。其中,图像模糊算法包括高斯模糊算法、均值模糊算法、双重模糊算法、散景模糊算法和移轴模糊算法等等。图像压缩算法包括JPEG(Joint Photographic Experts Group)压缩算法、霍夫曼编码压缩算法和行程编码压缩算法等等。随机噪声添加算法包括高斯噪声添加算法、泊松噪声添加算法和椒盐噪声添加算法等等。服务器可以随机选择一种图像处理算法对第一脸部图像进行处理,得到具有非真实脸部图像特性的第一更新脸部图像,比如,得到的第一更新脸部图像可以具有过渡平滑的特性或者图像清晰度不一致的特性或者有图像噪声的特性。也可以选择多种图像处理算法对第一脸部图像进行处理,将最后处理得到的图像作为具有非真实脸部图像特性的第一更新脸部图像。比如,得到的第一更新脸部图像可以具有过渡平滑的特性和图像清晰度不一致的特性,或者得到的第一更新脸部图像具有过渡平滑和有图像噪声的特性或者具有图像清晰度不一致和图像噪声的特性。或者得到的第一更新脸部图像具有图像过渡平滑、图像清晰度不一致以及有图像噪声的特性。
在一个实施例中,服务器先可以使用图像模糊算法对第一脸部图像进行处理,得到处理后的图像,然后使用图像压缩算法对处理后的图像进行压缩,得到压缩后的图像,将压缩后的图像作为第一更新脸部图像,也可以对压缩后的图像使用随机噪声添加算法添加随机噪声后,得到第一更新脸部图像。通过对图像进行处理,模拟对抗生成网络生成的图像的效果,提高了生成的目标脸部图像的多样性。
步骤206,根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像。
其中,颜色分布是指图像在RGB(一种颜色标准)颜色空间中的分布。第一调整脸部图像是指将第一更新脸部图像的颜色分布进行调整后得到的脸部图像,该调整后的颜色分布与第二脸部图像的颜色分布相近。
具体地。服务器使用颜色调整算法根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像,其中,颜色调整算法可以包括线性颜色迁移算法、LAB空间颜色迁移、基于概率密度的颜色迁移和颜色子直方图匹配算法等。服务器每次在生成目标脸部图像时,可以随机选取颜色调整算法,然后根据随机选取的颜色调整算法根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像。
步骤208,获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的。
其中,脸部掩膜是指对第一脸部图像中的脸部区域中的所有像素值初始化为255,即将脸部区域初始化为白色,同时对第一脸部图像中除脸部区域以外的区域的像素值初始化为0,即除脸部区域以外的区域初始化为黑色,得到的图像。目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的图像。
具体地,服务器获取到第一脸部图像的目标脸部掩膜,其中,可以预先提取得到第一脸部图像的脸部关键点,根据脸部关键点得到脸部区域,然后将脸部区域进行随机变形,得到脸部区域变形的脸部图像,然后根据脸部区域变形的脸部图像生成对应的目标脸部掩膜。其中,脸部区域进行随机变形时,可以获取到脸部区域的面积,然后随机调整脸部区域的面积大小,比如,脸部区域的面积为20,调整使脸部区域的面积为21。还可以获取到脸部区域的边界线,随机调整脸部区域边界线的位置或者类型。比如,将直线类型的边界线调整成曲线。比如,将边界线中心点的位置随机进行位移来调整边界线的位置。比如,边界线中心点的坐标为(1,1),可以随机调整到(1,2)。还可以获取到脸部区域的边界关键点,随机调整脸部区域边界关键点的位置,比如,将所有边界关键点的位置进行随机位移。
在一个实施例中,服务器也可以预先生成第一脸部图像的脸部掩膜,然后对第一脸部图 像的脸部掩膜中的脸部区域进行随机变形后得到目标脸部掩膜。在一个实施例中,服务器也可以直接从数据库中获取到第一脸部图像的目标脸部掩膜。
步骤210,根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
其中,目标脸部图像是指根据第一调整脸部图像与第二脸部图像融合的脸部图像,该目标脸部图像是具有非真实性的脸部图像,即假脸图像。
具体地,服务器使用图像融合算法根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,其中,图像融合算法包括阿尔法混合(Alpha Blending)算法、泊松融合算法、拉普拉斯金字塔融合算法、基于小波变换的图像融合算法和基于神经网络的图像融合算法等等,服务器每次在根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合时,先随机选择图像融合算法,然后根据随机选择的图像融合算法进行融合,得到目标脸部图像。
在上述图像处理方法中,通过对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,然后根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;并获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的。根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,通过上述方法构造的目标脸部图像能够准确的模仿出假脸图像的效果,比如包含非真实脸部图像特性、具有非真实脸部图像颜色分布,具有非真实脸部图像的脸部区域形状等,并且在通过上述方法生成大量目标脸部图像时,由于获取到的目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的,使得生成的大量目标脸部图像具有丰富的多样性。
在一个实施例中,如图3所示,步骤204,对第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
步骤302a,使用高斯函数计算第一脸部图像中像素点的权重,得到像素点模糊权重矩阵。
其中,高斯函数是指正态分布的密度函数,二维形式的高斯函数如下公式(1)所示:
Figure PCTCN2021100912-appb-000001
其中,G是指像素点模糊权重矩阵,e是指自然常数,π是圆周率,σ是指高斯半径,是预先设置好的,x和y是指第一脸部图像中像素点的坐标。
具体地,服务器获取到预先设置好的高斯半径和第一脸部图像中像素点的坐标,然后使用高斯函数计算第一脸部图像中像素点的权重,得到像素点模糊权重矩阵。
步骤302b,根据第一脸部图像中像素点的原始像素值和像素点模糊权重矩阵计算得到像素点的模糊像素值,基于像素点的模糊像素值生成具有非真实脸部图像特性的第一更新脸部图像。
具体地,服务器使用第一脸部图像中像素点的原始像素值和像素点模糊权重矩阵进行卷积运行,得到像素点的模糊像素值,根据每个像素点的模糊像素值就得到了具有非真实脸部图像特性的第一更新脸部图像。
在一个实施例中,服务器可以使用高斯卷积对第一脸部图像进行模糊处理。其中,高斯卷积的尺度包括3x3,5x5,7x7,9x9和11x11等等。服务器每次使用高斯卷积对第一脸部图像进行模糊处理时随机选择一种尺度的高斯卷积进行模糊处理,得到模糊处理后的第一脸部图像,使用模糊处理后的第一脸部图像生成目标脸部图像,提高了生成目标脸部图像的多样性。
在上述实施例中,通过使用高斯函数计算第一脸部图像中像素点的权重,得到像素点模糊权重矩阵,然后根据第一脸部图像中像素点的原始像素值和像素点模糊权重矩阵计算得到像素点的模糊像素值,生成第一更新脸部图像,能够快速得到第一更新脸部图像,方便后续 处理并保证生成目标脸部图像的效果达到假脸图像的效果。
在一个实施例中,如图3所示,步骤204,对第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
步骤304a,获取压缩率,使用压缩率将第一脸部图像进行压缩,得到压缩后的第一脸部图像;将压缩后的第一脸部图像作为具有非真实脸部图像特性的第一更新脸部图像。
其中,压缩率是指压缩后的脸部图像占用内存大小与压缩前脸部图像占用内存大小的比值,该压缩率有多个预先设置好的。
具体地,服务器在每次进行脸部图像压缩时,随机从预先设置好的压缩率中获取到当前压缩时使用的压缩率,然后使用该压缩率对第一脸部图像进行压缩,得到压缩后的第一脸部图像,将压缩后的第一脸部图像作为具有非真实脸部图像特性的第一更新脸部图像,从而能够得到具有不同清晰度的第一脸部图像,方便后续的使用,并保证生成目标脸部图像的效果达到假脸图像的效果和提高生成目标脸部图像的多样性。在一个实施例中,压缩率也可以是服务器获取到终端发送的,即用户可以通过终端输入压缩率,从而使服务器获取到压缩率。服务器将终端发送的压缩率作为当前压缩时使用的压缩率,并对对第一脸部图像进行压缩,得到压缩后的第一脸部图像。
在一个实施例中,如图3所示,步骤204,对第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
步骤306a,生成高斯噪声值,将高斯噪声值添加到第一脸部图像的像素值中,得到具有非真实脸部图像特性的第一更新脸部图像。
其中,高斯噪声是指概率密度函数服从高斯分布的噪声。高斯噪声值是指根据高斯噪声的均值和方差随机生成的随机数序列。
具体地,服务器预先保存有不同的高斯噪声的均值和方差,服务器在每次添加噪声时,随机选取到当前需要使用的高斯噪声的均值和方差,根据高斯噪声的均值和方差生成高斯噪声值,然后将高斯噪声值添加到第一脸部图像的像素值中,并将得到的像素值压缩到像素值区间内容,得到具有非真实脸部图像特性的第一脸部图像,通过添加高斯噪声值生成具有非真实脸部图像特性的第一更新脸部图像,方便后续的使用,并保证生成目标脸部图像的效果达到假脸图像的效果,并且由于随机选取当前需要使用的高斯噪声的均值和方差,提高了生成的目标脸部图像的多样性。在一个实施例中,服务器可以直接从数据库中获取到预先设置好的高斯噪声值。服务器也可以获取到终端上传的高斯噪声值,还可以获取到业务服务器发送的高斯噪声值等。
在一个实施例中,如图4所示,步骤208,获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的,包括:
步骤402,提取第一脸部图像中的脸部关键点,根据脸部关键点确定第一脸部图像的脸部区域。
其中,脸部关键点用于表征脸部的特征。
具体地,服务器使用脸部关键点提取算法来提取第一脸部图像中的脸部关键点,其中,脸部关键点提取算法包括基于特征点分布模型(Point Distribution Model,PDM)的提取算法、基于级联形状回归(CPR,Cascaded Pose Regression)算法和基于深度学习的算法等。该脸部关键点提取算法具体可以是ASM(Active Shape Model,主动形状模型)算法、AAM(Active Appearnce Modl,主动外观模型)算法、CPR(Cascaded pose regression,级联的姿势回归)、SDM(Supervised Descent Method,监督下降法)算法和深度卷积神经网络(DCNN,Deep Convolutional Network)算法,然后将提取到的脸部关键点连接成多边形,该多边形包含所有提取到的脸部关键点,多边形内部为第一脸部图像的脸部区域。
在一个具体地实施例中,服务器使用landmark(一种人脸部特征点提取的技术)算法提取到68个脸部关键点,通过将脸部关键点连接成多边形,该多边形包含68个脸部关键点, 得到第一脸部图像的脸部区域。
在一个实施例中,服务器可以根据确定第一脸部图像的脸部区域生成脸部掩膜。即使用未变形的第一脸部图像生成脸部掩膜,将生成的脸部掩膜作为目标脸部掩膜进行后续处理,使得生成的目标脸部图像具有多样性。
步骤404,随机调整第一脸部图像的脸部区域中脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜。
具体地,服务器随机改变第一脸部图像的脸部区域中脸部关键点位置,将改变位置的脸部关键点连接成多边形,得到变形后的脸部区域,然后根据变形后的脸部区域和第一脸部图像的其他区域生成目标脸部掩膜。其中,每个脸部关键点位置随机变化,即可以获取到脸部关键点位置随机变化值,和脸部关键点位置原始值,计算脸部关键点位置随机变化值与脸部关键点位置原始值的和,得到脸部关键点改变后的位置值。在一个实施例中,服务器可以随机调整多边形边界上的脸部关键点位置,将改变位置的脸部关键点连接成多边形,得到变形后的脸部区域。
在一个实施例中,可以在提取第一脸部图像中的脸部关键点之后,直接随机调整第一脸部图像中的脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜。
在上述实施例中,通过随机调整第一脸部图像的脸部区域中脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜,使用目标脸部掩膜进行后续的处理,提高了生成的目标脸部图像的多样性。
在一个实施例中,在步骤208之后,即在获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的之后,还包括步骤:
对第二脸部图像进行脸部遮挡检测,得到脸部遮挡区域;根据脸部遮挡区域调整目标脸部掩膜,得到调整脸部掩膜。
其中,遮挡检测是指检测第二脸部图像中的脸部区域是否被遮挡。脸部遮挡区域是指第二脸部图像中脸部被遮挡的区域。调整脸部掩膜是将脸部遮挡区域从目标脸部掩膜中的脸部区域去除后得到脸部掩膜。
具体地,服务器使用深度学习分割网络算法对第二脸部图像进行脸部遮挡检测,得到各个分割区域,从所述分割区域中确定脸部遮挡区域。然后根据脸部遮挡区域中每个像素点对应的二值化值调整目标脸部掩膜中每个像素点对应的二值化值,得到每个像素点调整后的二值化值,根据每个像素点调整后的二值化值得到调整脸部掩膜。其中,深度学习分割网络算法可以是Unet(基于FCN的一个语义分割网络)网络算法FCN(Fully convolutional networks for semantic segmentation,全卷积神经网络)网络算法、SegNet(一个encoder-decoder结构的卷积神经网络)网络算法和Deeplab(空洞卷积网络)网络算法等等。
在一个具体的实施例中,如图5所示,为得到调整脸部掩膜的示意图。其中,根据脸部遮挡区域将目标脸部掩膜50进行调整,得到的调整脸部掩膜52。
步骤210,根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,包括步骤:
根据调整脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
具体的,服务器根据调整脸部掩膜使用图像融合算法将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
在上述实施例中,通过对第二脸部图像进行遮挡检测,得到调整脸部掩膜,使用调整脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,提高生成目标脸部图像的多样性。
在一个实施例中,根据脸部遮挡区域调整目标脸部掩膜,得到调整脸部掩膜,包括步骤:
计算目标脸部掩膜中像素点掩膜值与脸部遮挡区域中像素点遮挡值的差值,将差值作为 掩膜调整值;根据掩膜调整值得到调整脸部掩膜。
其中,像素点掩膜值是指目标脸部掩膜中像素点的二值化值,遮挡值是指脸部遮挡区域中像素点的二值化值。掩膜调整值是指调整后脸部掩膜每个像素点的二值化值。
具体地,服务器根据目标脸部掩膜中每个像素点掩膜值计算与第二脸部图像中脸部遮挡区域中像素点遮挡值的差值,得到掩膜调整值。在一个具体的实施例中,目标脸部掩膜中脸部区域像素点的值为1,其他区域像素点为0。第二脸部图像中脸部遮挡区域中像素点为1,未遮挡区域为0。使用目标脸部掩膜中每个像素点的值减去第二脸部图像中每个像素点的值,得到调整后每个像素点的值,根据调整后每个像素点的值得到调整脸部掩膜。
在上述实施例中,直接计算目标脸部掩膜中像素点掩膜值与脸部遮挡区域中像素点遮挡值的差值,将差值作为掩膜调整值,根据掩膜调整值得到调整脸部掩膜,保证得到调整脸部掩膜在生成目标脸部图像时,使生成的目标脸部图像达到假脸具有的效果。
在一个实施例中,如图6所示,步骤206,根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像,包括:
步骤602,获取目标颜色调整算法标识,根据目标颜色调整算法标识调用目标颜色调整算法,目标颜色调整算法包括颜色迁移算法和颜色匹配算法中的至少一种。
其中,目标颜色调整算法标识用于唯一标识颜色调整算法。目标颜色迁移算法和颜色匹配算法都用于对颜色分布进行调整。其中,颜色迁移算法包括:线性颜色迁移算法、LAB空间颜色迁移算法和基于概率密度的颜色迁移算法等。颜色匹配算法包括颜色直方图匹配算法等。
具体地,服务器每次在根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布时,随机选择目标颜色调整算法,即得到选取的目标颜色调整算法对应的目标颜色调整算法标识。然后使用目标颜色调整算法标识调用目标颜色调整算法。其中,可以预先生成每个目标颜色调整算法的调用接口,根据目标颜色调整算法标识获取到对应的调用接口,使用调用接口调用目标颜色调整算法。
步骤604,基于目标颜色调整算法将第一更新脸部图像的颜色分布调整至与第二脸部图像的颜色分布一致,得到第一调整脸部图像。
具体地,服务器执行目标颜色调整算法,将第一更新脸部图像的颜色分布调整至与第二脸部图像的颜色分布一致,得到第一调整脸部图像。在一个实施例中,可以将第一更新脸部图像的颜色分布调整至与第二脸部图像的颜色分布在预设阈值内时,得到第一调整脸部图像。
通过上述实施例,将第一更新脸部图像的颜色分布调整至与第二脸部图像的颜色分布一致,得到第一调整脸部图像,使第一调整脸部图像拥有第二脸部图像的颜色信息,从而使得生成的目标脸部图像不包含明显的换脸边界,保证生成的目标脸部图像能够准确的模拟假脸的效果,并且每次在进行颜色分布调整时,随机选择目标颜色调整算法进行颜色分布调整,从而提高了生成的目标脸部图像的多样性。
在一个实施例中,如图7所示,步骤210,根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,包括:
步骤702,获取目标图像融合算法标识,根据目标图像融合算法标识调用目标图像融合算法;目标图像融合算法包括透明混合算法、泊松融合算法和神经网络算法中的至少一种。
其中,目标图像融合算法标识用于唯一标识目标图像融合算法,用于调用对应的目标图像融合算法。
具体地,服务器从保存的各个图像融合算法标识中随机选取到目标图像融合算法标识,根据该目标图像融合算法标识执行对应的图像融合算法。在一个实施例中,服务器根据目标图像融合算法标识获取到对应的目标图像融合算法的调用接口,使用调用接口调用目标图像融合算法。目标图像融合算法包括透明混合算法、泊松融合算法和神经网络算法中的至少一种。其中,神经网络算法是预先使用神经网络训练得到图像融合模型,使用图像融合模型进 行融合。
步骤704,使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
具体地,服务器每次在进行第一调整脸部图像与第二脸部图像融合时,使用随机选取的目标图像融合算法基于目标脸部掩膜进行融合,得到融合后的脸部图像,即目标脸部图像。在一个实施例中,服务器将目标脸部掩膜、第一调整脸部图像与第二脸部图像输入到使用神经网络训练得到的图像融合模型中,得到输出的融合后的脸部图像,即得到目标脸部图像。
在上述实施例中,通过使用随机选取目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,能够使生成的目标脸部图像具有多样性。
在一个实施例中,如图8所示,步骤704,使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,包括:
步骤802,根据目标脸部掩膜从第一调整脸部图像中确定第一调整脸部区域。
其中,第一调整脸部区域是指第一调整脸部图像中的脸部区域。
具体地,服务器计算目标脸部掩膜中各个像素点的掩膜值与第一调整脸部图像中各个像素点像素值的乘积,根据乘积结果得到第一调整脸部区域。
步骤804,将第一调整脸部区域融合到第二脸部图像中脸部区域位置处,得到目标脸部图像。
具体地,服务器计算目标脸部掩膜中各个像素点的掩膜值的反值与第二脸部图像中各个像素点像素值的乘积,根据乘积结果确定第二脸部图像中脸部区域位置,然后将第一调整脸部区域融合到第二脸部图像中脸部区域位置处,得到目标脸部图像。
在一个具体的实施例中,使用如下公式(2)得到目标脸部图像:
out=(1-α)A+αB公式(2)
其中,out是指输出的像素值,α是指目标脸部掩膜中的像素值,取值范围为[0,1]。A为第二脸部图像中的像素值,B为第一调整脸部图像中的像素值。当α=0时,输出的是背景区域像素值,当α=1时,输出的是脸部区域像素值,当0<α<1时,输出的像素值是混合后的像素值。
在上述实施例中,通过将第一调整脸部区域融合到第二脸部图像中脸部区域位置处,得到目标脸部图像,能够方便快速的得到目标脸部图像。
在一个实施例中,如图9所示,步骤704,使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,包括:
步骤902,根据目标脸部掩膜从第一调整脸部图像中确定感兴趣区域,计算感兴趣区域的第一梯度场和第二脸部图像的第二梯度场。
其中,感兴趣区域是指第一调整脸部图像中的脸部区域。
具体地,服务器根据目标脸部掩膜中脸部区域从第一调整脸部图像中确定感兴趣区域,使用差分运算计算感兴趣区域的第一梯度场和第二脸部图像的第二梯度场。其中,可以计算感兴趣区域在两个方向上的梯度,根据两个方向上的梯度得到第一梯度场。也可以计算第二脸部图像在两个方向上的梯度,根据两个方向上的梯度得到第二梯度场。
步骤904,根据第一梯度场和第二梯度场确定融合梯度场,使用融合梯度场计算融合散度场。
其中,融合梯度场是指目标脸部图像对应的梯度场。融合散度场是指目标脸部图像对应的散度,即拉普拉斯坐标。
具体地,服务器将第一梯度场覆盖到第二梯度场上得到融合梯度场。然后服务器计算融合梯度场中梯度的偏导,得到融合散度场。其中,服务器可以分别计算融合梯度场中梯度在 两个不同方向上的偏导,然后将两个不同方向上的偏导进行相加得到融合散度场。
步骤906,基于融合散度场确定第二融合像素值,根据第二融合像素值得到目标脸部图像。
其中,第二融合像素值是指目标脸部图像中各个像素点的像素值。
具体地,服务器使用融合散度场根据泊松重交方程构建系数矩阵,然后根据系数矩阵计算得到第二融合像素值,根据第二融合像素值得到目标脸部图像。
在上述实施例中,通过使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像,能够使得到的目标脸部图像具备多样性。
在一个实施例中,目标脸部图像用于训练脸部检测模型,脸部检测模型用于检测脸部图像的真实性。
具体地,服务器使用上述各实施例中得到目标脸部图像的方法生成大量目标脸部图像训练得到脸部检测模型,该脸部检测模型用于检测脸部图像的真实性,其中,当检测脸部图像的真实性超过预设阈值时,得到该脸部图像为真实性脸部图像,当检测脸部图像的真实性未超过预设阈值时,得到该脸部图像为非真实性脸部图像,即为假脸图像。
在一个实施例中,如图10所示,脸部检测模型的训练包括以下步骤:
步骤1002,获取真实脸部图像数据集和目标脸部图像数据集,目标脸部图像数据集中的各个目标脸部图像是使用真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像生成的,将目标脸部图像数据集作为当前脸部图像数据集。
其中,真实脸部图像数据集是指由真实脸部图像组成的图像数据集。
具体地,服务器获取到真实脸部图像数据集,可以是从第三方的真实脸部图像数据库中获取得到的。也可以是通过对真实的脸进行图像采集得到的。同时服务器使用真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像生成各个目标脸部图像,其中,可以对第一真实脸部图像和第二真实脸部图像使用不同的图像处理算法、不同的颜色调整算法和不同的图像融合算法随机组合来生成各个不同的目标脸部图像。也可以使用不同的第一真实脸部图像和第二真实脸部图像使用不同的图像处理算法、不同的颜色调整算法和不同的图像融合算法随机组合来生成各个不同的目标脸部图像。
在一个具体的实施例中,真实脸部图像数据集可以是从FaceForensic++(一种人脸图像数据集)中提供的真实人脸视频中得到的。然后使用FaceForensic++中的真实人脸生成目标人脸图像数据集。
步骤1004,将真实脸部图像数据集中各个真实脸部图像作为正样本数据,并将当前脸部图像数据集中各个当前脸部图像作为负样本数据,使用深度神经网络算法进行训练,得到当前脸部检测模型。
具体的,服务器将真实脸部图像数据集中的各个真实脸部图像和当前脸部图像数据集中各个当前脸部图像作为模型的输入进行训练,当达到训练完成条件时,得到当前脸部检测模型。其中,训练完成条件包括训练达到最大迭代次数或者损失函数的值符合预设阈值条件。比如,服务器使用Xception(Inception深度卷积网络的扩展)网络作为模型的网络结构,使用cross-entropy(交叉熵)作为损失函数进行模型训练,当达到训练完成条件时,得到当前脸部检测模型。其中,也可以使用表达能力更强的网络作为模型的网络结果进行训练,比如,使用ResNet101深度残差网络、ResNet152深度残差网络等等。
步骤1006,获取测试脸部图像数据,使用测试脸部图像数据测试当前脸部检测模型,得到当前脸部检测模型对应的准确性,测试脸部图像数据与真实脸部图像数据集为不同数据集。
具体地,服务器可以从第三方数据库中获取到测试脸部图像数据,该测试脸部图像数据与真实脸部图像数据集为不同数据集。然后使用测试脸部图像数据测试当前脸部检测模型,其中可以使用AUC(area under curve,曲线下的面积)和AP(average precision,平均正确率)作为评价指标,得到当前脸部检测模型检测脸部图像真实性的准确性。
步骤1008,判断准确性是否超过预设准确性阈值,当超过预设准确性阈值时,执行步骤1010a。当未超过预设准确性阈值时,执行步骤1010b。
步骤1010b,获取更新目标脸部图像数据集,更新目标脸部图像数据集包括目标脸部图像数据集中的各个目标脸部图像和各个更新目标脸部图像,各个更新目标脸部图像是使用真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像重新生成的。将更新目标脸部图像数据集作为当前脸部图像数据集,并返回步骤1004执行。
步骤1010a,将得到的当前脸部检测模型作为脸部检测模型。
其中,预设准确性阈值是指预先设置好的脸部检测模型检测脸部图像真实性的准确性阈值。
具体地,当准确性未超过预设准确性阈值时,说明训练得到的模型在其他数据集上的泛化能力较差,此时,服务器获取到更新目标脸部图像数据集,使用更新目标脸部图像数据集再次迭代训练当前脸部检测模型。该更新目标脸部图像数据集中包括之前训练使用的目标脸部图像和重新生成的目标脸部图像。即通过增强训练样本中的目标脸部图像来训练脸部检测模型。
在上述实施例中,通过得到目标脸部图像数据集,然后使用目标脸部图像数据集和真实脸部图像数据集训练得到脸部检测模型,由于目标脸部图像数据集中具有丰富多样性的目标脸部图像,从而提高了训练得到的脸部检测模型的泛化能力,然后使用脸部检测模型检测脸部图像的真实性,从而能够提高检测脸部图像真实性的准确性。
在一个具体的实施例中,使用测试脸部图像数据对现有的人脸智能模型和本申请的脸部检测模型进行测试,得到的评价指标数据如下表1所示,
表1评价指标数据表
Figure PCTCN2021100912-appb-000002
其中,测试数据集1可以是celeb-DF(深度人脸提取数据集),测试数据集2可以是DFDC(Deepfake Detection Challenge,深度假动作检测挑战)的数据集。本申请中通过数据增强后训练得到的脸部检测模型的评价指标都取得了比现有的人工智能模型的评价指标更好的结果。即本申请的脸部检测模型明显提高了模型的泛化性能,从而使检测结果更加的准确。
在一个实施例中,在将得到的当前脸部检测模型作为脸部检测模型之后,还包括:
获取待检测脸部图像,将待检测脸部图像输入到脸部检测模型中进行检测,得到检测结果,当检测结果为非真实脸部图像时,生成报警信息。
其中,待检测脸部图像是指需要检测真实性的脸部图像。检测试纸待检测脸部图像是否为真实脸部图像的结果,包括非真实脸部图像和真实脸部图像结果。报警信息用于对待检测脸部图像为非真实性进行提醒,说明待检测脸部图像为非真实脸部图像。
具体地,服务器获取到待检测脸部图像,该待检测脸部图像可以是用户上传的脸部图像,也可以是服务器从各种视频中识别到的脸部图像,还可以是服务器中数据库中保存的脸部图像等等。服务器预先将训练好的脸部检测模型部署,然后将待检测脸部图像输入到脸部检测模型中进行检测,即得到脸部检测模型输出的检测结果。当检测结果为待检测脸部图像是真实脸部图像时,不做处理。当检测结果为待检测脸部图像是非真实脸部图像时,生成报警信息,将报警信息发送到管理终端进行显示,以使管理终端进行后续的处理。
在上述实施例中,通过将待检测脸部图像使用脸部检测模型进行检测,得到检测结果,当检测结果为非真实脸部图像时,生成报警信息,提高了脸部检测模型对非真实脸部图像进行检测的准确性。
在一个具体地实施例中,如图11所示,脸部图像处理方法的具体包括以下步骤:
步骤1102,获取真实脸部图像数据集,从真实脸部图像数据集中随机选取第一脸部图像和第二脸部图像;
步骤1104,使用高斯函数计算第一脸部图像中像素点的权重,得到像素点模糊权重矩阵。根据第一脸部图像中像素点的原始像素值和像素点模糊权重矩阵计算得到像素点的模糊像素值,生成第一更新脸部图像。即进行高斯模糊。
步骤1106,随机获取压缩率,使用压缩率将第一更新脸部图像进行压缩,得到第二更新脸部图像。即进行图像压缩。
步骤1108,生成高斯噪声值,将高斯噪声值添加到第二更新脸部图像的像素值中,得到第三更新脸部图像。即进行随机噪声添加。
在该实施例中,服务器在生成目标脸部图像时可以从步骤1104、步骤1106和步骤1108中随机选择需要执行的步骤,得到对应的更新脸部图像,使用对应的更新脸部图像进行后续的处理。比如,服务器可以执行步骤1104或者执行步骤1106或者执行步骤1108或者执行步骤1104和步骤1106或者执行步骤1106和步骤1108等得到对应的执行结果,其中,在执行步骤时是对上一个步骤的执行结果进行处理。即使生成的更新脸部图像具有对抗生成网络的效果,其中,可以具有一种效果,也可以具有多种效果,如图12所示,为可随机选择的模拟对抗生成网络的效果的方法示意图。
步骤1110,随机获取目标颜色调整算法标识,根据目标颜色调整算法标识调用目标颜色调整算法,基于目标颜色调整算法根据第二脸部图像的颜色分布调整第三更新脸部图像的颜色分布,得到第一调整脸部图像。其中,如图13所示,为可随机选择的目标颜色调整算法名称示意图,从该图13中包括的目标颜色调整算法中随机选取目标图像融合算法。
步骤1112,提取第一脸部图像中的脸部关键点,根据脸部关键点确定第一脸部图像的脸部区域,随机调整第一脸部图像的脸部区域中脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜。其中,如图14所示,为mask生成与随机变形的示意图。
步骤1114,对第二脸部图像进行脸部遮挡检测,得到脸部遮挡区域,计算目标脸部掩膜中像素点掩膜值与脸部遮挡区域中像素点遮挡值的差值,将差值作为掩膜调整值,根据掩膜调整值得到调整脸部掩膜。
步骤1116,随机获取目标图像融合算法标识,根据目标图像融合算法标识调用目标图像融合算法,使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。其中,如图15所示,为可随机选择的图像融合算法名称示意图,从该图15种包括的图像融合算法中随机选取目标图像融合算法名称。
在该实施例中,服务器重复不断执行上述步骤,每次在执行时,从图12、图13、图14和图15中随机选取对应的一种方法执行相应的步骤,保证生成具有多样性的各个目标脸部图像,得到目标脸部图像数据集。
本申请还提供一种应用场景,该应用场景应用上述的脸部图像处理方法。具体地,该脸部图像处理方法在该应用场景的应用如下:
如图16所示,提高一种人脸图像处理框架示意图,具体来说:服务器获取真实人脸图像A和真实人脸图像B。对真实人脸图像A进行处理,生成具有非真实人脸图像特性的第一更新人脸图像;根据真实人脸图像B的颜色分布调整第一更新人脸图像的颜色分布,得到第一调整人脸图像。根据真实人脸图像A生成对应的脸部掩膜,然后对脸部掩膜进行变形,得到变形后的目标脸部掩膜。根据目标人脸掩膜将第一调整人脸图像与真实人脸图像B进行融合,得到目标人脸图像。通过使用图16所示的框架生成大量目标人脸图像,生成的目标人脸图像的部分示意图如图17所示,其中,包括真实感较高的合成人脸图像和真实感较差的合成人脸图像,该图17种所示的合成人脸图像都是有色彩的图像。然后使用生成的大量目标人脸图像 和真实人脸图像训练得到人脸真实性检测模型。然后将人脸真实性检测模型部署到人脸识别支付平台中,如图18所示,为脸部图像处理方法的应用环境示意图,该脸部图像处理方法应用到人脸识别支付平台中,其中,包括用户终端1802、平台服务器1804以及监控终端1806。即用户终端1802在进行人脸支付时,通过摄像头采集到人脸图像,将人脸图像通过网络传输到平台服务器1804,平台服务器1804通过部署的人脸真实性检测模型对采集到的人脸图像进行真实性检测,得到检测结果,当检测结果为非真实人脸时,生成报警信息为人脸识别未通过,该人脸为非真实人脸,并将报警信息发送到监控终端1806进行展示,同时向用户终端1802发送支付失败信息进行显示。通过识别监控设备采集的人脸的真实性,可以提高人脸支付的安全性。
本申请还另外提供一种应用场景,该应用场景应用上述的脸部图像处理方法。具体地,该脸部图像处理方法在该应用场景的应用如下:
获取第一人脸图像和第二人脸图像,第一人脸图像和第二脸部图像是包含真实人脸的图像。对第一人脸图像进行处理,生成具有非真实人脸图像特性的第一更新人脸图像。根据第二人脸图像的颜色分布调整第一更新人脸图像的颜色分布,得到第一调整人脸图像。获取第一人脸图像的目标人脸掩膜,目标人脸掩膜是对第一人脸图像的人脸区域进行随机变形生成的。根据目标人脸掩膜将第一调整人脸图像与第二人脸图像进行融合,得到目标人脸图像。通过上述方法生成大量目标人脸图像,使用大量目标人脸图像和真实人脸图像数据集训练得到人脸换脸检测模型,将人脸换脸检测模型部署到互联网视频媒体平台中进行使用。当互联网视频媒体平台获取到用户上传的视频时,从视频中获取答人脸图像,将要检测的人脸图像输入到人脸换脸检测模型中,得到换脸检测结果,换脸检测结果包括换脸后的人脸图像和未换脸的人脸图像,其中,换脸后的人脸图像是非真实人脸图像,未换脸的人脸图像是真实人脸图像。当要检测的人脸图像是换脸后的人脸图像,且识别到换脸后的人脸图像侵犯肖像权时,禁止将用户上传的视频进行发布,并向用户返回禁止视频发布的原因。
应该理解的是,虽然图2-图4以及图6-图11的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-图4以及图6-图11中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。
在一个实施例中,如图19所示,提供了一种脸部图像处理装置1900,该装置可以采用软件模块或硬件模块,或者是二者的结合成为计算机设备的一部分,该装置具体包括:图像获取模块1902、图像处理模块1904、颜色调整模块1906、掩膜获取模块1908和图像融合模块1910,其中:
图像获取模块1902,用于获取第一脸部图像和第二脸部图像,第一脸部图像和第二脸部图像是包含真实脸部的图像;
图像处理模块1904,用于对第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
颜色调整模块1906,用于根据第二脸部图像的颜色分布调整第一更新脸部图像的颜色分布,得到第一调整脸部图像;
掩膜获取模块1908,用于获取第一脸部图像的目标脸部掩膜,目标脸部掩膜是对第一脸部图像的脸部区域进行随机变形生成的;
图像融合模块1910,用于根据目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
在一个实施例中,图像处理模块1904,包括:
高斯模糊单元,用于使用高斯函数计算第一脸部图像中像素点的权重,得到像素点模糊权重矩阵;根据第一脸部图像中像素点的原始像素值和像素点模糊权重矩阵计算得到像素点的模糊像素值,基于像素点的模糊像素值生成具有非真实脸部图像特性的第一更新脸部图像。
在一个实施例中,图像处理模块1904,包括:
图像压缩单元,用于获取压缩率,使用压缩率将第一脸部图像进行压缩,得到压缩后的第一脸部图像;将压缩后的第一脸部图像作为具有非真实脸部图像特性的第一更新脸部图像。
在一个实施例中,图像处理模块1904,包括:
噪声条件单元,用于生成高斯噪声值,将高斯噪声值添加到第一脸部图像的像素值中,得到具有非真实脸部图像特性的第一更新脸部图像。
在一个实施例中,掩膜获取模块1908,包括:
关键点提取单元,用于提取第一脸部图像中的脸部关键点,根据脸部关键点确定第一脸部图像的脸部区域;
调用单元,用于随机调整第一脸部图像的脸部区域中脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜。
在一个实施例中,脸部图像处理装置1900,还包括:
遮挡检测模块,用于对第二脸部图像进行脸部遮挡检测,得到脸部遮挡区域;
掩膜调整模块,用于根据脸部遮挡区域调整目标脸部掩膜,得到调整脸部掩膜;
图像融合模块1910还用于根据调整脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
在一个实施例中,掩膜调整模块还用于计算目标脸部掩膜中像素点掩膜值与脸部遮挡区域中像素点遮挡值的差值,将差值作为掩膜调整值;根据掩膜调整值得到调整脸部掩膜。
在一个实施例中,颜色调整模块1906还用于获取目标颜色调整算法标识,根据目标颜色调整算法标识调用目标颜色调整算法,目标颜色调整算法包括颜色迁移算法和颜色匹配算法中的至少一种;基于目标颜色调整算法将第一更新脸部图像的颜色分布调整至与第二脸部图像的颜色分布一致,得到第一调整脸部图像。
在一个实施例中,图像融合模块1910,包括:
调用单元,用于获取目标图像融合算法标识,根据目标图像融合算法标识调用目标图像融合算法;目标图像融合算法包括透明混合算法、泊松融合算法和神经网络算法中的至少一种;
融合单元,用于使用目标图像融合算法基于目标脸部掩膜将第一调整脸部图像与第二脸部图像进行融合,得到目标脸部图像。
在一个实施例中,融合单元还用于根据目标脸部掩膜从第一调整脸部图像中确定第一调整脸部区域;将第一调整脸部区域融合到第二脸部图像中脸部区域位置处,得到目标脸部图像。
在一个实施例中,融合单元还用于根据脸部掩膜从第一调整脸部图像中确定感兴趣区域,计算感兴趣区域的第一梯度场和第二脸部图像的第二梯度场;根据第一梯度场和第二梯度场确定融合梯度场,使用融合梯度场计算融合散度场;基于融合散度场确定第二融合像素值,根据第二融合像素值得到目标脸部图像。
在一个实施例中,脸部图像处理装置1900,还包括:
数据获取模块,用于获取真实脸部图像数据集和目标脸部图像数据集,目标脸部图像数据集中的各个目标脸部图像是使用真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像生成的,将目标脸部图像数据集作为当前脸部图像数据集。
模型训练模块,用于将真实脸部图像数据集中各个真实脸部图像作为正样本数据,并将当前脸部图像数据集中各个当前脸部图像作为负样本数据,使用深度神经网络算法进行训练,得到当前脸部检测模型;
模型测试模块,用于获取测试脸部图像数据,使用测试脸部图像数据测试当前脸部检测模型,得到当前脸部检测模型对应的准确性,测试脸部图像数据与真实脸部图像数据集为不同数据集;
更新数据获取模块,用于当准确性小于预设准确性阈值时,获取更新目标脸部图像数据集,更新目标脸部图像数据集包括目标脸部图像数据集中的各个目标脸部图像和各个更新目标脸部图像,各个更新目标脸部图像是使用真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像重新生成的;
迭代循环模块,用于将更新目标脸部图像数据集作为当前脸部图像数据集,返回将真实脸部图像数据集中各个真实脸部图像作为正样本数据,并将当前脸部图像数据集中各个当前脸部图像作为负样本数据,使用深度神经网络算法进行训练,得到当前脸部检测模型的步骤执行,直到准确性超过预设准确性阈值时,将得到的当前脸部检测模型作为脸部检测模型。
在一个实施例中,脸部图像处理装置1900,还包括:
图像检测模块,用于获取待检测脸部图像,将待检测脸部图像输入到脸部检测模型中进行检测,得到检测结果,当检测结果为非真实脸部图像时,生成报警信息。
关于脸部图像处理装置的具体限定可以参见上文中对于脸部图像处理方法的限定,在此不再赘述。上述脸部图像处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图20所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储目标脸部图像数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种脸部图像处理方法。
本领域技术人员可以理解,图20中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机可读指令,该处理器执行计算机可读指令时实现上述各方法实施例中的步骤。
在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机可读指令,计算机可读指令被处理器执行时,使得处理器执行时实现上述各方法实施例中的步骤。
在一个实施例中,提供了一个或多个存储有计算机可读指令的非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行时实现上述各方法实施例中的步骤。
在一个实施例中,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述各方法实施例中的步骤。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易 失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种脸部图像处理方法,其特征在于,由计算机设备执行,所述方法包括:
    获取第一脸部图像和第二脸部图像,所述第一脸部图像和所述第二脸部图像是包含真实脸部的图像;
    对所述第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
    根据所述第二脸部图像的颜色分布调整所述第一更新脸部图像的颜色分布,得到第一调整脸部图像;
    获取所述第一脸部图像的目标脸部掩膜,所述目标脸部掩膜是对所述第一脸部图像的脸部区域进行随机变形生成的;及
    根据所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像。
  2. 根据权利要求1所述的方法,其特征在于,所述对所述第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
    使用高斯函数计算所述第一脸部图像中像素点的权重,得到像素点模糊权重矩阵;及
    根据所述第一脸部图像中像素点的原始像素值和所述像素点模糊权重矩阵计算得到所述像素点的模糊像素值,基于所述像素点的模糊像素值生成所述具有非真实脸部图像特性的第一更新脸部图像。
  3. 根据权利要求1所述的方法,其特征在于,所述对所述第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
    获取压缩率,使用所述压缩率将所述第一脸部图像进行压缩,得到压缩后的第一脸部图像;及
    将所述压缩后的第一脸部图像作为所述具有非真实脸部图像特性的第一更新脸部图像。
  4. 根据权利要求1所述的方法,其特征在于,所述对所述第一脸部图像的进行处理,生成具有非真实脸部图像特性的第一更新脸部图像,包括:
    生成高斯噪声值,将所述高斯噪声值添加到所述第一脸部图像的像素值中,得到具有非真实脸部图像特性的第一更新脸部图像。
  5. 根据权利要求1所述的方法,其特征在于,所述获取所述第一脸部图像的目标脸部掩膜,所述目标脸部掩膜是对所述第一脸部图像的脸部区域进行随机变形生成的,包括:
    提取所述第一脸部图像中的脸部关键点,根据所述脸部关键点确定所述第一脸部图像的脸部区域;及
    随机调整所述第一脸部图像的脸部区域中脸部关键点位置,得到变形后的脸部区域,根据变形后的脸部区域生成目标脸部掩膜。
  6. 根据权利要求1所述的方法,其特征在于,在所述获取所述第一脸部图像的目标脸部掩膜,所述目标脸部掩膜是对所述第一脸部图像的脸部区域进行随机变形生成的之后,还包括:
    对所述第二脸部图像进行脸部遮挡检测,得到脸部遮挡区域;及
    根据所述脸部遮挡区域调整所述目标脸部掩膜,得到调整脸部掩膜;
    所述根据所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像,包括:
    根据所述调整脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像。
  7. 根据权利要求6所述的方法,其特征在于,所述根据所述脸部遮挡区域调整所述目标脸部掩膜,得到调整脸部掩膜,包括:
    计算所述目标脸部掩膜中像素点掩膜值与所述脸部遮挡区域中像素点遮挡值的差值,将所述差值作为所述掩膜调整值;
    根据所述掩膜调整值得到所述调整脸部掩膜。
  8. 根据权利要求1所述的方法,其特征在于,根据所述第二脸部图像的颜色分布调整所述第一更新脸部图像的颜色分布,得到第一调整脸部图像,包括:
    获取目标颜色调整算法标识,根据所述目标颜色调整算法标识调用目标颜色调整算法,所述目标颜色调整算法包括颜色迁移算法和颜色匹配算法中的至少一种;及
    基于所述目标颜色调整算法将所述第一更新脸部图像的颜色分布调整至与所述第二脸部图像的颜色分布一致,得到第一调整脸部图像。
  9. 根据权利要求1所述的方法,其特征在于,根据所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像,包括:
    获取目标图像融合算法标识,根据所述目标图像融合算法标识调用目标图像融合算法;所述目标图像融合算法包括透明混合算法、泊松融合算法和神经网络算法中的至少一种;及
    使用所述目标图像融合算法基于所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像。
  10. 根据权利要求9所述的方法,其特征在于,所述使用所述目标图像融合算法基于所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像,包括:
    根据所述目标脸部掩膜从所述第一调整脸部图像中确定第一调整脸部区域;及
    将所述第一调整脸部区域融合到所述第二脸部图像中脸部区域位置处,得到所述目标脸部图像。
  11. 根据权利要求9所述的方法,其特征在于,所述使用所述目标图像融合算法基于所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像,包括:
    根据所述目标脸部掩膜从所述第一调整脸部图像中确定感兴趣区域,计算所述感兴趣区域的第一梯度场和所述第二脸部图像的第二梯度场;
    根据所述第一梯度场和所述第二梯度场确定融合梯度场,使用所述融合梯度场计算融合散度场;及
    基于所述融合散度场确定第二融合像素值,根据所述第二融合像素值得到所述目标脸部图像。
  12. 根据权利要求1所述的方法,其特征在于,所述目标脸部图像用于训练脸部检测模型,所述脸部检测模型用于检测脸部图像的真实性。
  13. 根据权利要求12所述的方法,其特征在于,所述脸部检测模型的训练包括以下步骤:
    获取真实脸部图像数据集和目标脸部图像数据集,所述目标脸部图像数据集中的各个目标脸部图像是使用所述真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像生成的;
    将所述目标脸部图像数据集作为当前脸部图像数据集,将所述真实脸部图像数据集中各个真实脸部图像作为正样本数据,并将所述当前脸部图像数据集中各个当前脸部图像作为负样本数据,使用深度神经网络算法进行训练,得到当前脸部检测模型;
    获取测试脸部图像数据,使用测试脸部图像数据测试所述当前脸部检测模型,得到所述当前脸部检测模型对应的准确性,所述测试脸部图像数据与所述真实脸部图像数据集为不同数据集;
    当所述准确性小于预设准确性阈值时,获取更新目标脸部图像数据集,所述更新目标脸部图像数据集包括所述目标脸部图像数据集中的各个目标脸部图像和各个更新目标脸部图像,所述各个更新目标脸部图像是使用所述真实脸部图像数据集中不同的第一真实脸部图像和第二真实脸部图像重新生成的;及将所述更新目标脸部图像数据集作为当前脸部图像数据集,返回将所述真实脸部图像数据集中各个真实脸部图像作为正样本数据,并将所述当前脸 部图像数据集中各个当前脸部图像作为负样本数据,使用深度神经网络算法进行训练,得到当前脸部检测模型的步骤执行,直到所述准确性超过所述预设准确性阈值时,将得到的当前脸部检测模型作为所述脸部检测模型。
  14. 根据权利要求13所述的方法,其特征在于,在所述将得到的当前脸部检测模型作为脸部检测模型之后,还包括:
    获取所述待检测脸部图像,将所述待检测脸部图像输入到脸部检测模型中进行检测,得到检测结果,当所述检测结果为非真实脸部图像时,生成报警信息。
  15. 一种脸部图像处理装置,其特征在于,所述装置包括:
    图像获取模块,用于获取第一脸部图像和第二脸部图像,所述第一脸部图像和所述第二脸部图像是包含真实脸部的图像;
    图像处理模块,用于对所述第一脸部图像进行处理,生成具有非真实脸部图像特性的第一更新脸部图像;
    颜色调整模块,用于根据所述第二脸部图像的颜色分布调整所述第一更新脸部图像的颜色分布,得到第一调整脸部图像;
    掩膜获取模块,用于获取所述第一脸部图像的目标脸部掩膜,所述目标脸部掩膜是对所述第一脸部图像的脸部区域进行随机变形生成的;及
    图像融合模块,用于根据所述目标脸部掩膜将所述第一调整脸部图像与所述第二脸部图像进行融合,得到目标脸部图像,所述目标脸部图像用于训练脸部检测模型,所述脸部检测模型用于检测脸部图像的真实性。
  16. 根据权利要求15所述的装置,其特征在于,所述图像处理模块,包括:
    高斯模糊单元,用于使用高斯函数计算所述第一脸部图像中像素点的权重,得到像素点模糊权重矩阵;根据所述第一脸部图像中像素点的原始像素值和所述像素点模糊权重矩阵计算得到所述像素点的模糊像素值,基于所述像素点的模糊像素值生成所述具有非真实脸部图像特性的第一更新脸部图像。
  17. 根据权利要求15所述的装置,其特征在于,所述图像处理模块,包括:
    图像压缩单元,用于获取压缩率,使用所述压缩率将所述第一脸部图像进行压缩,得到压缩后的第一脸部图像;将所述压缩后的第一脸部图像作为所述具有非真实脸部图像特性的第一更新脸部图像。
  18. 根据权利要求15所述的装置,其特征在于,图像处理模块,包括:
    噪声条件单元,用于生成高斯噪声值,将所述高斯噪声值添加到所述第一脸部图像的像素值中,得到具有非真实脸部图像特性的第一更新脸部图像。
  19. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至14中任一项所述的方法的步骤。
  20. 一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至14中任一项所述的方法的步骤。
PCT/CN2021/100912 2020-07-27 2021-06-18 脸部图像处理方法、装置、设备及存储介质 WO2022022154A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/989,169 US20230085605A1 (en) 2020-07-27 2022-11-17 Face image processing method, apparatus, device, and storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010730209.9A CN111754396B (zh) 2020-07-27 2020-07-27 脸部图像处理方法、装置、计算机设备和存储介质
CN202010730209.9 2020-07-27

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/989,169 Continuation US20230085605A1 (en) 2020-07-27 2022-11-17 Face image processing method, apparatus, device, and storage medium

Publications (1)

Publication Number Publication Date
WO2022022154A1 true WO2022022154A1 (zh) 2022-02-03

Family

ID=72712070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/100912 WO2022022154A1 (zh) 2020-07-27 2021-06-18 脸部图像处理方法、装置、设备及存储介质

Country Status (3)

Country Link
US (1) US20230085605A1 (zh)
CN (1) CN111754396B (zh)
WO (1) WO2022022154A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111754396B (zh) * 2020-07-27 2024-01-09 腾讯科技(深圳)有限公司 脸部图像处理方法、装置、计算机设备和存储介质
CN112085701B (zh) * 2020-08-05 2024-06-11 深圳市优必选科技股份有限公司 一种人脸模糊度检测方法、装置、终端设备及存储介质
US11941844B2 (en) * 2020-08-05 2024-03-26 Ubtech Robotics Corp Ltd Object detection model generation method and electronic device and computer readable storage medium using the same
CN112383765B (zh) * 2020-11-10 2023-04-07 中移雄安信息通信科技有限公司 一种vr图像传输方法及装置
CN112541926B (zh) * 2020-12-15 2022-07-01 福州大学 一种基于改进FCN和DenseNet的歧义像素优化分割方法
CN112598580B (zh) * 2020-12-29 2023-07-25 广州光锥元信息科技有限公司 提升人像照片清晰度的方法及装置
CN113344832A (zh) * 2021-05-28 2021-09-03 杭州睿胜软件有限公司 图像处理方法及装置、电子设备和存储介质
CN114140319A (zh) * 2021-12-09 2022-03-04 北京百度网讯科技有限公司 图像迁移方法和图像迁移模型的训练方法、装置
CN115187446A (zh) * 2022-05-26 2022-10-14 北京健康之家科技有限公司 换脸视频的生成方法、装置、计算机设备及可读存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109003282A (zh) * 2018-07-27 2018-12-14 京东方科技集团股份有限公司 一种图像处理的方法、装置及计算机存储介质
CN109191410A (zh) * 2018-08-06 2019-01-11 腾讯科技(深圳)有限公司 一种人脸图像融合方法、装置及存储介质
CN109829930A (zh) * 2019-01-15 2019-05-31 深圳市云之梦科技有限公司 人脸图像处理方法、装置、计算机设备及可读存储介质
CN110458781A (zh) * 2019-08-14 2019-11-15 北京百度网讯科技有限公司 用于处理图像的方法和装置
CN111242852A (zh) * 2018-11-29 2020-06-05 奥多比公司 边界感知对象移除和内容填充
CN111325657A (zh) * 2020-02-18 2020-06-23 北京奇艺世纪科技有限公司 图像处理方法、装置、电子设备和计算机可读存储介质
CN111754396A (zh) * 2020-07-27 2020-10-09 腾讯科技(深圳)有限公司 脸部图像处理方法、装置、计算机设备和存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011090569A (ja) * 2009-10-23 2011-05-06 Sony Corp 画像処理装置および画像処理方法
US9544308B2 (en) * 2014-11-01 2017-01-10 RONALD Henry Minter Compliant authentication based on dynamically-updated credentials
CN107392142B (zh) * 2017-07-19 2020-11-13 广东工业大学 一种真伪人脸识别方法及其装置
CN109978754A (zh) * 2017-12-28 2019-07-05 广东欧珀移动通信有限公司 图像处理方法、装置、存储介质及电子设备
CN113569790B (zh) * 2019-07-30 2022-07-29 北京市商汤科技开发有限公司 图像处理方法及装置、处理器、电子设备及存储介质
CN111353392B (zh) * 2020-02-18 2022-09-30 腾讯科技(深圳)有限公司 换脸检测方法、装置、设备及存储介质
CN111368796B (zh) * 2020-03-20 2024-03-08 北京达佳互联信息技术有限公司 人脸图像的处理方法、装置、电子设备及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109003282A (zh) * 2018-07-27 2018-12-14 京东方科技集团股份有限公司 一种图像处理的方法、装置及计算机存储介质
CN109191410A (zh) * 2018-08-06 2019-01-11 腾讯科技(深圳)有限公司 一种人脸图像融合方法、装置及存储介质
CN111242852A (zh) * 2018-11-29 2020-06-05 奥多比公司 边界感知对象移除和内容填充
CN109829930A (zh) * 2019-01-15 2019-05-31 深圳市云之梦科技有限公司 人脸图像处理方法、装置、计算机设备及可读存储介质
CN110458781A (zh) * 2019-08-14 2019-11-15 北京百度网讯科技有限公司 用于处理图像的方法和装置
CN111325657A (zh) * 2020-02-18 2020-06-23 北京奇艺世纪科技有限公司 图像处理方法、装置、电子设备和计算机可读存储介质
CN111754396A (zh) * 2020-07-27 2020-10-09 腾讯科技(深圳)有限公司 脸部图像处理方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN111754396A (zh) 2020-10-09
CN111754396B (zh) 2024-01-09
US20230085605A1 (en) 2023-03-16

Similar Documents

Publication Publication Date Title
WO2022022154A1 (zh) 脸部图像处理方法、装置、设备及存储介质
US11830230B2 (en) Living body detection method based on facial recognition, and electronic device and storage medium
US11983850B2 (en) Image processing method and apparatus, device, and storage medium
CN111814620B (zh) 人脸图像质量评价模型建立方法、优选方法、介质及装置
CN111311578A (zh) 基于人工智能的对象分类方法以及装置、医学影像设备
CN110807757B (zh) 基于人工智能的图像质量评估方法、装置及计算机设备
KR101603019B1 (ko) 화상 처리 장치, 화상 처리 방법 및 컴퓨터로 판독 가능한 기록 매체
CN110569756A (zh) 人脸识别模型构建方法、识别方法、设备和存储介质
WO2022179401A1 (zh) 图像处理方法、装置、计算机设备、存储介质和程序产品
CN111368672A (zh) 一种用于遗传病面部识别模型的构建方法及装置
WO2022247539A1 (zh) 活体检测方法、估算网络处理方法、装置、计算机设备和计算机可读指令产品
CN110942456B (zh) 篡改图像检测方法、装置、设备及存储介质
US20230326173A1 (en) Image processing method and apparatus, and computer-readable storage medium
CN110222718A (zh) 图像处理的方法及装置
CN111310724A (zh) 基于深度学习的活体检测方法、装置、存储介质及设备
CN113011253B (zh) 基于ResNeXt网络的人脸表情识别方法、装置、设备及存储介质
CN111145106A (zh) 一种图像增强方法、装置、介质及设备
CN112651333A (zh) 静默活体检测方法、装置、终端设备和存储介质
CN116977674A (zh) 图像匹配方法、相关设备、存储介质及程序产品
CN113688839B (zh) 视频处理方法及装置、电子设备、计算机可读存储介质
WO2024041108A1 (zh) 图像矫正模型训练及图像矫正方法、装置和计算机设备
CN112016592A (zh) 基于交叉领域类别感知的领域适应语义分割方法及装置
CN114998814B (zh) 目标视频生成方法、装置、计算机设备和存储介质
CN114648800A (zh) 人脸图像检测模型训练方法、人脸图像检测方法及装置
CN114677578A (zh) 确定训练样本数据的方法和装置

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 04.07.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21848716

Country of ref document: EP

Kind code of ref document: A1