CN113792671B - Face synthetic image detection method and device, electronic equipment and medium - Google Patents
Face synthetic image detection method and device, electronic equipment and medium Download PDFInfo
- Publication number
- CN113792671B CN113792671B CN202111088172.5A CN202111088172A CN113792671B CN 113792671 B CN113792671 B CN 113792671B CN 202111088172 A CN202111088172 A CN 202111088172A CN 113792671 B CN113792671 B CN 113792671B
- Authority
- CN
- China
- Prior art keywords
- face
- image
- detected
- frequency domain
- original
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 65
- 238000000034 method Methods 0.000 claims abstract description 38
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 35
- 238000006243 chemical reaction Methods 0.000 claims abstract description 24
- 238000001914 filtration Methods 0.000 claims abstract description 12
- 238000004364 calculation method Methods 0.000 claims description 18
- 238000012216 screening Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 12
- 239000002131 composite material Substances 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 8
- 238000011176 pooling Methods 0.000 claims description 5
- 238000003708 edge detection Methods 0.000 claims description 3
- 230000001629 suppression Effects 0.000 claims description 3
- 238000010586 diagram Methods 0.000 abstract description 14
- 238000013473 artificial intelligence Methods 0.000 abstract description 6
- 230000006870 function Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 5
- 238000007726 management method Methods 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 101150115304 cls-2 gene Proteins 0.000 description 2
- 101150053100 cls1 gene Proteins 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 230000005764 inhibitory process Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 238000013145 classification model Methods 0.000 description 1
- 230000009193 crawling Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
- G06F18/2148—Generating training patterns; Bootstrap methods, e.g. bagging or boosting characterised by the process organisation or structure, e.g. boosting cascade
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
Landscapes
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
The invention relates to the technical field of artificial intelligence, and discloses a detection method of a face synthetic image, which comprises the following steps: performing frequency domain conversion on an original image to be detected to obtain a frequency domain image to be detected; filtering noise of the frequency domain map to be detected to obtain a denoising frequency domain map; detecting a denoising frequency domain diagram to obtain the face probability of the frequency domain diagram; acquiring a face region in an original image to be detected by using a face recognition algorithm to obtain a truncated face image set; calculating a face probability value of the truncated face image by using the RGB network model to obtain the face probability of the truncated image; weighting and calculating the face probability of the frequency domain graph and the face probability of the truncated graph to obtain the comprehensive face probability; and determining whether the original image to be detected is a synthesized face image or not according to the comprehensive face probability. The invention also provides a device, equipment and storage medium for detecting the face synthesized image. The invention also relates to a blockchain technique, wherein the original diagram to be detected can be stored in a blockchain node. The invention can improve the detection precision of the face synthetic image.
Description
Technical Field
The present invention relates to the field of artificial intelligence technologies, and in particular, to a method and apparatus for detecting a face synthetic image, an electronic device, and a computer readable storage medium.
Background
Along with the wide application of the face recognition and face unlocking technology in various large fields, people pay more attention to the safety of face recognition and face retrieval, and in order to improve the safety of face recognition and face retrieval, the safety of face recognition and face retrieval is improved by detecting whether a face image is a synthesized image or not in the prior art.
However, the algorithm for detecting whether the face image is a synthesized image at the present stage usually only adopts one model or method for detection, and the detection angle is too single, so that the problem of insufficient detection precision is caused.
Disclosure of Invention
The invention provides a method, a device, electronic equipment and a computer readable storage medium for detecting a face synthetic image, and mainly aims to improve the detection precision of the face synthetic image.
In order to achieve the above object, the present invention provides a method for detecting a face synthetic image, including:
Acquiring an original image to be detected, and detecting whether face information exists in the original image to be detected by using a preset face detection algorithm;
If the face information exists in the original image to be detected, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected;
filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting the face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
Acquiring a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set;
Calculating the face probability value of each truncated face image in the truncated face image set by using a pre-constructed RGB network model to obtain a face probability value set, and fusing the face probability values in the face probability value set to obtain the face probability of the truncated image;
weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
when the comprehensive face probability is larger than a preset detection threshold, judging that the original image to be detected is a real face image;
And when the comprehensive face probability is smaller than or equal to the preset detection threshold, judging that the original image to be detected is a composite face image.
Optionally, the detecting whether the face information exists in the original image to be detected by using a preset face detection algorithm includes:
respectively carrying out convolution operation and pooling operation on a plurality of original images to be detected with different scales to obtain a plurality of original feature detection images;
performing non-maximum value inhibition processing on the plurality of original feature detection images to obtain a plurality of screening feature images;
judging whether face information exists in the screening feature images or not by utilizing a pre-trained XGBoost model;
When the face information exists in any screening feature diagram, determining that the face information exists in the original image to be detected;
and when the face information does not exist in all the screening feature images, determining that the face information does not exist in the original image to be detected.
Optionally, the performing frequency domain conversion on the original image to be detected to obtain a frequency domain diagram to be detected includes:
Acquiring a spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtaining a spatial domain image to be detected;
and carrying out frequency domain conversion on the spatial domain image to be detected through a fast Fourier transform formula to obtain a frequency domain image to be detected.
Optionally, the fast fourier transform formula is:
wherein x and y represent pixel coordinates of the to-be-detected spatial domain image, u and v represent pixel coordinates of the to-be-detected frequency domain image, M, N represent width and height of the to-be-detected spatial domain image, and j is a fixed parameter.
Optionally, the acquiring the face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set includes:
Detecting the original image to be detected by using a preset face recognition algorithm to obtain a face frame;
intercepting the original image to be detected by using the face frame to obtain an intercepted image set;
And adjusting the sizes of the intercepted images in the intercepted image set to be consistent to obtain an intercepted face image set.
Optionally, before the performing frequency domain conversion on the original image to be detected, the method further includes:
Calculating the area of a face image in the original image to be detected;
if the ratio of the area of the face image in the image to be detected to the original image to be detected is smaller than a preset threshold value, the original image to be detected is acquired again;
and if the ratio of the face image area in the image to be detected to the original image to be detected is greater than or equal to the preset threshold value, executing the operation of performing frequency domain conversion on the original image to be detected.
Optionally, the calculating the area of the face image in the original image to be detected includes:
Acquiring the face edge of a face image in the original image to be detected by using an edge detection algorithm;
And counting the number of pixels of the face image in the original image to be detected based on the face edge, and determining the area of the face image in the original image to be detected according to the number of pixels.
In order to solve the above problem, the present invention further provides a device for detecting a face synthetic image, the device comprising:
the face information detection module is used for acquiring an original image to be detected, and detecting whether the face information exists in the original image to be detected by using a preset face detection algorithm;
The frequency domain face probability calculation module is used for carrying out frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected if face information exists in the original image to be detected, filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
The truncated face probability calculation module is used for obtaining a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set, calculating face probability values of each truncated face image in the truncated face image set by using a pre-built RGB network model to obtain a face probability value set, and fusing the face probability values in the face probability value set to obtain truncated image face probability;
the comprehensive face probability calculation module is used for weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
The synthetic face judging module is used for judging that the original image to be detected is a real face image when the comprehensive face probability is larger than a preset detection threshold value, and judging that the original image to be detected is a synthetic face image when the comprehensive face probability is smaller than or equal to the preset detection threshold value.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of detecting a face composite image as described above.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium including a storage data area storing created data and a storage program area storing a computer program; wherein the computer program when executed by a processor implements the method of detecting a face composite image as described above.
In the embodiment of the invention, whether the original image to be detected contains face information is detected firstly, the waste of calculation resources caused by bringing nonsensical images into a detection flow is avoided, if the face information exists, the original image to be detected is subjected to frequency domain conversion to obtain a frequency domain image to be detected, then a noise frequency domain image is obtained by filtering light noise interference through a high-pass filter, the noise frequency domain image is input into a pre-constructed frequency domain model to obtain the face probability of the frequency domain image, then the original image to be detected is subjected to face recognition interception to obtain an intercepted image, the intercepted image is input into a pre-constructed RGB network model to obtain the face probability of the intercepted image, finally the probability obtained by the two models is weighted and calculated to obtain the comprehensive face probability, and finally the filtering condition is added to judge the image as a real face or a synthetic face.
Drawings
Fig. 1 is a schematic flow chart of a method for detecting a face synthetic image according to an embodiment of the present invention;
FIG. 2 is a detailed flowchart of a step in a method for detecting a face synthetic image according to an embodiment of the present invention;
Fig. 3 is a schematic block diagram of a device for detecting a face synthesized image according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an internal structure of an electronic device for implementing a method for detecting a face synthetic image according to an embodiment of the present invention;
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a detection method of a face synthetic image. The execution subject of the method for detecting the face synthetic image includes, but is not limited to, at least one of a server, a terminal, and the like, which can be configured to execute the method provided by the embodiment of the application. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. In other words, the method for detecting the face synthetic image may be performed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a method for detecting a face synthetic image according to an embodiment of the invention is shown. In this embodiment, the method for detecting a face synthetic image includes:
S1, acquiring an original image to be detected.
In the embodiment of the invention, the original image to be detected can be an image acquired through terminal equipment such as a mobile phone, a camera or a tablet personal computer, and is used for detecting whether the face image is a face synthesized image, namely judging whether the face image in the original image to be detected is a normal photographed real person image or an artificially synthesized image.
In another embodiment of the present invention, the original image to be detected may be an image obtained by crawling a published image from a network by using a crawler technology, or an image obtained from a preset image database to be detected, or an image uploaded by a user.
S2, detecting whether the face information exists in the original image to be detected or not by using a preset face detection algorithm.
Referring to fig. 2, fig. 2 is a detailed flowchart of a step in a method for detecting a face synthetic image according to an embodiment of the invention.
In the embodiment of the present invention, the detecting whether the face information exists in the original image to be detected by using a preset face detection algorithm includes:
S201, scaling the original image to be detected in different proportions to obtain a plurality of original images to be detected with different scales;
S202, performing convolution operation and pooling operation on a plurality of original images to be detected with different scales respectively to obtain a plurality of original feature detection images;
s203, performing non-maximum value inhibition processing on a plurality of original feature detection graphs to obtain a plurality of screening feature graphs;
s204, judging whether face information exists in the screening feature images by utilizing a pre-trained XGBoost model;
s205, when face information exists in any screening feature diagram, determining that the face information exists in the original image to be detected;
s206, when the face information does not exist in all the screening feature images, determining that the face information does not exist in the original image to be detected.
The face detection algorithm in the embodiment of the invention is DenseBox algorithm, and is used for detecting the face from the target image.
In the embodiment of the invention, the convolution operation is a 2D convolution operation, and is used for convolving the original image to be detected with 2D convolution kernels with different actions to obtain image features, the pooling operation is used for averaging the image features, and the non-maximum suppression is used for screening the original feature detection image.
The XGBoost (eXtreme Gradient Boosting) extreme gradient lifting model in the embodiment of the invention is a GBDT-based model, and is a strong classification model for judging whether face information exists in each screening feature map.
S3, if the face information does not exist in the original image to be detected, the original image to be detected is acquired again.
Further, if no face information exists in the original image to be detected, the operation of acquiring the original image to be detected is executed again.
Specifically, if the face information does not exist in the original image to be detected, the original image to be detected is an image which does not have detection value, the original image to be detected is discarded, and a new original image to be detected is acquired again.
Specifically, the re-acquiring the new original image to be detected may be re-shooting the target acquisition image by using a terminal such as a mobile phone, a camera or a tablet computer, or acquiring other images from the preset image database to be detected as the original image to be detected.
And S4, if the face information exists in the original image to be detected, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected.
In the embodiment of the invention, if the face information exists in the original image to be detected, the original image to be detected is an available image, and the image with the detection value of the face synthetic image is subjected to subsequent operation.
In the embodiment of the invention, the frequency domain conversion is to convert an image displayed in a spatial signal into an image displayed in a frequency signal.
In detail, the performing frequency domain conversion on the original image to be detected to obtain a frequency domain diagram to be detected includes:
Acquiring a spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtaining a spatial domain image to be detected;
and carrying out frequency domain conversion on the spatial domain image to be detected through a fast Fourier transform formula to obtain a frequency domain image to be detected.
In the embodiment of the present invention, the spatial domain may also be referred to as an image space, and represents a set of pixel points that form the original image to be detected. The frequency domain is a coordinate system used for describing the characteristics of the signal in terms of frequency, the horizontal axis is frequency, and the vertical axis is the intensity of the frequency signal.
In the embodiment of the invention, the fast fourier transform formula is a formula in fourier transform (Fast Fourier Transform), and a certain function meeting a certain condition can be expressed as a trigonometric function.
Specifically, the fourier transform formula is:
wherein x and y represent pixel coordinates of the to-be-detected spatial domain image, u and v represent pixel coordinates of the to-be-detected frequency domain image, M, N represent width and height of the to-be-detected spatial domain image, and j is a fixed parameter.
Further, before the performing frequency domain conversion on the original image to be detected, the method further includes:
Calculating the area of a face image in the original image to be detected;
if the ratio of the area of the face image in the image to be detected to the original image to be detected is smaller than a preset threshold value, the original image to be detected is acquired again;
And if the face image area in the image to be detected and the wallpaper of the original image to be detected are larger than or equal to the preset threshold, executing the operation of performing frequency domain conversion on the original image to be detected.
Optionally, the preset threshold is 0.65.
In the embodiment of the present invention, the calculating the area of the face image in the original image to be detected includes:
Acquiring the face edge of a face image in the original image to be detected by using an edge detection algorithm;
And counting the number of pixels of the face image in the original image to be detected based on the face edge, and determining the area of the face image in the original image to be detected according to the number of pixels.
S5, filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting the face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image.
In the embodiment of the invention, because the noise is mainly concentrated in the high-frequency part in the image transmission process, and the edge and the steep transformation part of the image are also related to the high-frequency component, the image can be effectively sharpened by the high-frequency filter.
In the embodiment of the present invention, the high-pass filter includes a high-pass filter formula, where the high-pass filter formula is:
Wherein H (u, v) is the denoising frequency domain map, D (u, v) is the frequency domain map to be detected, and D 0 is a fixed parameter.
In one embodiment of the invention, D 0 has a value of 115.
In the embodiment of the invention, the denoising frequency domain diagram is an image from which high-frequency noise interference in the frequency domain diagram to be detected is removed.
In an embodiment of the invention, the frequency domain model is composed of a densely connected convolutional neural network (DenseNet) and an attention mechanism network (Coordinate Attention, CA).
S6, acquiring a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set.
In detail, the face recognition algorithm may be an existing lightweight face recognition algorithm, for example, centerface algorithm.
In the embodiment of the present invention, the acquiring the face region in the original image to be detected by using a preset face recognition algorithm to obtain the captured face image set includes:
Detecting the original image to be detected by using a preset face recognition algorithm to obtain a face frame;
intercepting the original image to be detected by using the face frame to obtain an intercepted image set;
And adjusting the sizes of the intercepted images in the intercepted image set to be consistent to obtain an intercepted face image set.
In the embodiment of the invention, the face frame is a candidate frame and is used for selecting a face image range.
In the embodiment of the invention, because the synthetic trace of the artificially synthesized image can not be confirmed, and a plurality of different face areas are arranged in the embodiment to acquire more face image characteristics, thereby distinguishing the synthesized face image from the real face image more clearly.
Further, for example, the preset area is divided into scale1 and scale2, and the two areas have corresponding coordinate sizes.
Specifically, the upper left corner coordinates of the face scale1 region: (face_box.x, face_box.y), face scale1 area is wide: face_box_w, face scale1 area high: face_box_h, upper left corner coordinates of face scale2 region: Face scale2 area is wide: face_box_w 1.5, face scale2 frame high: face_box_h 1.5.
In this embodiment, the size of the image may be adjusted to be uniform using a size () function, for example, uniformly adjusted to 224×224 pixel sizes.
S7, calculating the face probability value of each truncated face image in the truncated face image set by using the pre-constructed RGB network model to obtain a face probability value set, and fusing the face probability values in the face probability value set to obtain the face probability of the truncated image.
In the embodiment of the invention, the RGB network model has the same network structure as the frequency domain model, only the training process and the input of the model are different, the input of the RGB network model is to intercept a face image, and the input of the frequency domain model is to denoise a frequency domain diagram.
In detail, the RGB network model is composed of a densely connected convolutional neural network (DenseNet) and an attention mechanism network (Coordinate Attention, CA), which may be denoted as a ca_ DenseNet model.
Specifically, the RGB network model includes 3 ca_Dense blocks, where the ca_Dense blocks are obtained by adding CA attention mechanism modules to the DenseNet Block later two layers in the DenseNet network.
In the embodiment of the invention, the face probability values in the face probability value set are fused by carrying out average calculation on each face probability value in the face probability value set. For example, two face probability values cls1 and cls2 are obtained according to the scale1 region and the scale2 region, and the face probability of the truncated image is obtained:
Wherein cls1 and cls2 are face probability value 1 and face probability value 2 in the face probability value set, and p (RGB) is the truncated graph face probability.
And S8, weighting and calculating the frequency domain image face probability and the truncated image face probability to obtain comprehensive face probability.
In the embodiment of the invention, the comprehensive face probability is a face probability combining the face probability of the frequency domain image and the face probability of the truncated image, and reflects the possibility that the original image to be detected is a true image.
In the embodiment of the invention, the formula for weighted calculation of the face probability of the frequency domain image and the face probability of the truncated image is as follows:
P(cls)=0.45*P(Fr)+0.55*P(RGB)
Wherein, P (cls) is the comprehensive face probability, P (Fr) is the frequency domain image face probability, and P (RGB) is the truncated image face probability.
And S9, judging whether the comprehensive face probability is larger than a preset detection threshold.
In the embodiment of the invention, the preset detection threshold is a score threshold for judging whether the original image to be detected is a true image, and the original image to be detected can be intuitively judged by comparing the preset detection threshold with the comprehensive face probability.
In the embodiment of the invention, the judgment is performed according to the comprehensive face probability and the preset detection threshold, and when the comprehensive face probability is greater than the preset detection threshold, the original image is judged to be a real face image, wherein the judgment formula is as follows:
wherein y is a judgment result, and N is a preset detection threshold.
Alternatively, the value of N is 0.65.
And S10, when the comprehensive face probability is larger than the preset detection threshold, judging that the original image to be detected is judged to be a real face image.
In the embodiment of the invention, if the original image to be detected is judged to be a real face image, subsequent operations such as authentication of the user identity in the real face image and mobile payment after the authentication is passed can be performed.
And S11, when the comprehensive face probability is smaller than or equal to the preset detection threshold, judging that the original image to be detected is a composite face image.
In the embodiment of the invention, if the original image to be detected is determined to be a synthesized face image, no further operation can be performed subsequently, for example, when face mobile payment is performed according to the original image to be detected, if the original image to be detected is determined to be the synthesized face image, payment fails, and when access control identification is performed according to the original image to be detected, if the original image to be detected is determined to be the synthesized face failure, access control cannot be opened, and no access is permitted.
In the embodiment of the invention, whether the original image to be detected contains face information is detected firstly, the waste of calculation resources caused by bringing nonsensical images into a detection flow is avoided, if the face information exists, the original image to be detected is subjected to frequency domain conversion to obtain a frequency domain image to be detected, then a noise frequency domain image is obtained by filtering light noise interference through a high-pass filter, the noise frequency domain image is input into a pre-constructed frequency domain model to obtain the face probability of the frequency domain image, then the original image to be detected is subjected to face recognition interception to obtain an intercepted image, the intercepted image is input into a pre-constructed RGB network model to obtain the face probability of the intercepted image, finally the probability obtained by the two models is weighted and calculated to obtain the comprehensive face probability, and finally the filtering condition is added to judge the image as a real face or a synthetic face.
Fig. 3 is a schematic block diagram of a detection device for a face synthetic image according to the present invention.
The apparatus 100 for detecting a face synthesized image according to the present invention may be installed in an electronic device. The detection device of the face synthesized image may include a face information detection module 101, a frequency domain face probability calculation module 102, a truncated face probability calculation module 103, a comprehensive face probability calculation module 104, and a synthesized face judgment module 105 according to the implemented functions. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
The face information detection module 101 is configured to obtain an original image to be detected, and detect whether face information exists in the original image to be detected by using a preset face detection algorithm.
The frequency domain face probability calculation module 102 is configured to, if face information exists in the original image to be detected, perform frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected, filter noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detect face probability of the denoised frequency domain image by using a pre-constructed frequency domain model to obtain a frequency domain image face probability;
The truncated face probability calculation module 103 is configured to obtain a face region in the original image to be detected by using a preset face recognition algorithm, obtain a truncated face image set, calculate face probability values of each truncated face image in the truncated face image set by using a pre-constructed RGB network model, obtain a face probability value set, and fuse the face probability values in the face probability value set to obtain a truncated image face probability;
the comprehensive face probability calculation module 104 is configured to calculate the face probability of the frequency domain graph and the face probability of the truncated graph in a weighted manner, so as to obtain a comprehensive face probability;
The synthetic face judging module 105 is configured to judge that the original image to be detected is a real face image when the comprehensive face probability is greater than a preset detection threshold, and judge that the original image to be detected is a synthetic face image when the comprehensive face probability is less than or equal to the preset detection threshold.
In detail, each module in the face synthetic image detection apparatus 100 in the embodiment of the present invention adopts the same technical means as the face synthetic image detection method described in fig. 1 to 2, and can generate the same technical effects, which is not described herein.
Fig. 4 is a schematic structural diagram of an electronic device for implementing the method for detecting a face synthetic image according to the present invention.
The electronic device may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program stored in the memory 11 and executable on the processor 10, such as a detection program of a face synthesized image.
The processor 10 may be formed by an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or may be formed by a plurality of integrated circuits packaged with the same function or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects respective components of the entire electronic device using various interfaces and lines, executes various functions of the electronic device and processes data by running or executing programs or modules stored in the memory 11 (for example, executing a detection program of a face synthesized image, etc.), and calls data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, a removable hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only for storing application software installed in an electronic device and various types of data, such as codes of detection programs of face synthesized images, but also for temporarily storing data that has been output or is to be output.
The communication bus 12 may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
The communication interface 13 is used for communication between the electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), or alternatively a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device and for displaying a visual user interface.
Fig. 4 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 4 is not limiting of the electronic device and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power source (such as a battery) for supplying power to the respective components, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device may further include various sensors, bluetooth modules, wi-Fi modules, etc., which are not described herein.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The detection program of the face synthesized image stored in the memory 11 in the electronic device is a combination of a plurality of computer programs, and when executed in the processor 10, can implement:
Acquiring an original image to be detected, and detecting whether face information exists in the original image to be detected by using a preset face detection algorithm;
If the face information exists in the original image to be detected, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected;
filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting the face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
Acquiring a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set;
Calculating the face probability value of each truncated face image in the truncated face image set by using a pre-constructed RGB network model to obtain a face probability value set, and fusing the face probability values in the face probability value set to obtain the face probability of the truncated image;
weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
when the comprehensive face probability is larger than a preset detection threshold, judging that the original image to be detected is a real face image;
And when the comprehensive face probability is smaller than or equal to the preset detection threshold, judging that the original image to be detected is a composite face image.
In particular, the specific implementation method of the processor 10 on the computer program may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein.
Further, the electronic device integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a non-volatile computer readable storage medium. The computer readable storage medium may be volatile or nonvolatile. For example, the computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
Acquiring an original image to be detected, and detecting whether face information exists in the original image to be detected by using a preset face detection algorithm;
If the face information exists in the original image to be detected, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected;
filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting the face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
Acquiring a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set;
Calculating the face probability value of each truncated face image in the truncated face image set by using a pre-constructed RGB network model to obtain a face probability value set, and fusing the face probability values in the face probability value set to obtain the face probability of the truncated image;
weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
when the comprehensive face probability is larger than a preset detection threshold, judging that the original image to be detected is a real face image;
And when the comprehensive face probability is smaller than or equal to the preset detection threshold, judging that the original image to be detected is a composite face image.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Wherein artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) is the theory, method, technique, and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain optimal results.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.
Claims (9)
1. A method for detecting a face composite image, the method comprising:
Acquiring an original image to be detected, and detecting whether face information exists in the original image to be detected by using a preset face detection algorithm, wherein the method comprises the following steps: scaling the original to-be-detected images in different proportions to obtain a plurality of original to-be-detected images with different scales, respectively carrying out convolution operation and pooling operation on the plurality of original to-be-detected images with different scales to obtain a plurality of original feature detection images, carrying out non-maximum suppression processing on the plurality of original feature detection images to obtain a plurality of screening feature images, judging whether face information exists in the plurality of screening feature images by utilizing a pre-trained XGBoost model, determining that the face information exists in the original to-be-detected images when the face information exists in any one of the screening feature images, and determining that the face information does not exist in the original to-be-detected images when the face information does not exist in all the screening feature images;
If the face information exists in the original image to be detected, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected;
filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting the face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
Acquiring a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set;
calculating the face probability value of each truncated face image in the truncated face image set by using a pre-constructed RGB network model to obtain a face probability value set, and carrying out average calculation on the face probability values in the face probability value set to obtain the face probability of the truncated image;
weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
when the comprehensive face probability is larger than a preset detection threshold, judging that the original image to be detected is a real face image;
And when the comprehensive face probability is smaller than or equal to the preset detection threshold, judging that the original image to be detected is a composite face image.
2. The method for detecting a face synthesized image according to claim 1, wherein the performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected includes:
Acquiring a spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtaining a spatial domain image to be detected;
and carrying out frequency domain conversion on the spatial domain image to be detected through a fast Fourier transform formula to obtain a frequency domain image to be detected.
3. The method for detecting a face synthesized image according to claim 2, wherein the fast fourier transform formula is:
wherein x and y represent pixel coordinates of the to-be-detected spatial domain image, u and v represent pixel coordinates of the to-be-detected frequency domain image, M, N represent width and height of the to-be-detected spatial domain image, and j is a fixed parameter.
4. The method for detecting a face synthesized image according to claim 1, wherein the step of obtaining a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set includes:
Detecting the original image to be detected by using a preset face recognition algorithm to obtain a face frame;
intercepting the original image to be detected by using the face frame to obtain an intercepted image set;
And adjusting the sizes of the intercepted images in the intercepted image set to be consistent to obtain an intercepted face image set.
5. The method for detecting a face synthesized image according to claim 1, wherein before the performing frequency domain conversion on the original image to be detected, the method further comprises:
Calculating the area of a face image in the original image to be detected;
if the ratio of the area of the face image in the image to be detected to the original image to be detected is smaller than a preset threshold value, the original image to be detected is acquired again;
and if the ratio of the face image area in the image to be detected to the original image to be detected is greater than or equal to the preset threshold value, executing the operation of performing frequency domain conversion on the original image to be detected.
6. The method for detecting a face synthesized image according to claim 5, wherein the calculating an area of a face image in the original image to be detected includes:
Acquiring the face edge of a face image in the original image to be detected by using an edge detection algorithm;
And counting the number of pixels of the face image in the original image to be detected based on the face edge, and determining the area of the face image in the original image to be detected according to the number of pixels.
7. A device for detecting a face synthesized image, the device comprising:
The face information detection module is used for acquiring an original image to be detected, detecting whether face information exists in the original image to be detected by using a preset face detection algorithm, and comprises the following steps: scaling the original to-be-detected images in different proportions to obtain a plurality of original to-be-detected images with different scales, respectively carrying out convolution operation and pooling operation on the plurality of original to-be-detected images with different scales to obtain a plurality of original feature detection images, carrying out non-maximum suppression processing on the plurality of original feature detection images to obtain a plurality of screening feature images, judging whether face information exists in the plurality of screening feature images by utilizing a pre-trained XGBoost model, determining that the face information exists in the original to-be-detected images when the face information exists in any one of the screening feature images, and determining that the face information does not exist in the original to-be-detected images when the face information does not exist in all the screening feature images;
The frequency domain face probability calculation module is used for carrying out frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected if face information exists in the original image to be detected, filtering noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoising frequency domain image, and detecting face probability of the denoising frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
the truncated face probability calculation module is used for obtaining a face region in the original image to be detected by using a preset face recognition algorithm to obtain a truncated face image set, calculating face probability values of each truncated face image in the truncated face image set by using a pre-built RGB network model to obtain a face probability value set, and carrying out average calculation on the face probability values in the face probability value set to obtain truncated image face probability;
the comprehensive face probability calculation module is used for weighting and calculating the face probability of the frequency domain image and the face probability of the truncated image to obtain comprehensive face probability;
The synthetic face judging module is used for judging that the original image to be detected is a real face image when the comprehensive face probability is larger than a preset detection threshold value, and judging that the original image to be detected is a synthetic face image when the comprehensive face probability is smaller than or equal to the preset detection threshold value.
8. An electronic device, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of detecting a face composite image as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium comprising a storage data area storing created data and a storage program area storing a computer program; wherein the computer program, when executed by a processor, implements a method of detecting a face composite image as claimed in any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111088172.5A CN113792671B (en) | 2021-09-16 | 2021-09-16 | Face synthetic image detection method and device, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111088172.5A CN113792671B (en) | 2021-09-16 | 2021-09-16 | Face synthetic image detection method and device, electronic equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113792671A CN113792671A (en) | 2021-12-14 |
CN113792671B true CN113792671B (en) | 2024-09-27 |
Family
ID=78878707
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111088172.5A Active CN113792671B (en) | 2021-09-16 | 2021-09-16 | Face synthetic image detection method and device, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113792671B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115147705B (en) * | 2022-09-06 | 2023-02-03 | 平安银行股份有限公司 | Face copying detection method and device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106778704A (en) * | 2017-01-23 | 2017-05-31 | 安徽理工大学 | A kind of recognition of face matching process and semi-automatic face matching system |
CN112507903A (en) * | 2020-12-15 | 2021-03-16 | 平安科技(深圳)有限公司 | False face detection method and device, electronic equipment and computer readable storage medium |
CN112507934A (en) * | 2020-12-16 | 2021-03-16 | 平安银行股份有限公司 | Living body detection method, living body detection device, electronic apparatus, and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106326823B (en) * | 2015-07-07 | 2020-06-30 | 北京神州泰岳软件股份有限公司 | Method and system for obtaining head portrait in picture |
-
2021
- 2021-09-16 CN CN202111088172.5A patent/CN113792671B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106778704A (en) * | 2017-01-23 | 2017-05-31 | 安徽理工大学 | A kind of recognition of face matching process and semi-automatic face matching system |
CN112507903A (en) * | 2020-12-15 | 2021-03-16 | 平安科技(深圳)有限公司 | False face detection method and device, electronic equipment and computer readable storage medium |
CN112507934A (en) * | 2020-12-16 | 2021-03-16 | 平安银行股份有限公司 | Living body detection method, living body detection device, electronic apparatus, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN113792671A (en) | 2021-12-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113159147B (en) | Image recognition method and device based on neural network and electronic equipment | |
CN111695609B (en) | Target damage degree judging method and device, electronic equipment and storage medium | |
CN113283446B (en) | Method and device for identifying object in image, electronic equipment and storage medium | |
CN112507934B (en) | Living body detection method, living body detection device, electronic equipment and storage medium | |
CN113705461B (en) | Face definition detection method, device, equipment and storage medium | |
CN113705462B (en) | Face recognition method, device, electronic equipment and computer readable storage medium | |
CN112651953B (en) | Picture similarity calculation method and device, computer equipment and storage medium | |
CN114049568B (en) | Target object deformation detection method, device, equipment and medium based on image comparison | |
CN112132812B (en) | Certificate verification method and device, electronic equipment and medium | |
CN116168351B (en) | Inspection method and device for power equipment | |
CN113887408B (en) | Method, device, equipment and storage medium for detecting activated face video | |
CN112132216B (en) | Vehicle type recognition method and device, electronic equipment and storage medium | |
CN113792671B (en) | Face synthetic image detection method and device, electronic equipment and medium | |
CN112507903B (en) | False face detection method, false face detection device, electronic equipment and computer readable storage medium | |
CN113723280B (en) | Method, device, equipment and medium for detecting countermeasure sample based on static face | |
CN112862703B (en) | Image correction method and device based on mobile photographing, electronic equipment and medium | |
CN114463685B (en) | Behavior recognition method, behavior recognition device, electronic equipment and storage medium | |
CN117333929A (en) | Method and system for identifying abnormal personnel under road construction based on deep learning | |
CN113869269B (en) | Method and device for detecting crowdedness degree of activity site, electronic equipment and storage medium | |
CN113255456B (en) | Inactive living body detection method, inactive living body detection device, electronic equipment and storage medium | |
CN113792801B (en) | Method, device, equipment and storage medium for detecting face dazzling degree | |
CN112541436B (en) | Concentration analysis method and device, electronic equipment and computer storage medium | |
CN115601684A (en) | Emergency early warning method and device, electronic equipment and storage medium | |
CN112541899A (en) | Incomplete certificate detection method and device, electronic equipment and computer storage medium | |
CN114627535B (en) | Coordinate matching method, device, equipment and medium based on binocular camera |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |