Method, device, electronic device and medium for detecting synthetic face images
Through the multi-stage detection method, frequency domain conversion and RGB network model weighting are used to calculate the face probability, which solves the problem of insufficient face image detection accuracy in the existing technology and achieves more accurate distinction between real faces and synthetic faces.
Patent Information
- Application Number
- CN202111088172.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-16
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-09-16
AI Technical Summary
Face image detection methods in the prior art have insufficient detection accuracy and the detection angle is too single, resulting in the inability to effectively distinguish between real faces and synthetic face images.
Using a multi-stage detection method, first detect whether there is face information in the image through the preset face detection algorithm. If it exists, perform frequency domain conversion and use high-pass filter to denoise, and combine the prebuilt frequency domain model and RGB network model calculation Face probability, and finally weighted calculation of comprehensive face probability to determine the authenticity of the image.
It improves the accuracy of face synthetic image detection, can more accurately distinguish real faces and synthetic face images, reduces the waste of computing resources, and improves the accuracy of detection.
Smart Images

Figure CN113792671B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device and computer-readable storage medium for detecting synthetic facial images. Background Art
[0002] As face recognition and face unlocking technologies are widely used in various fields, people are paying more and more attention to the security of face recognition and face retrieval. In order to improve the security of face recognition and face retrieval, the existing technology improves the security of face recognition and face retrieval by detecting whether the face image is a synthetic image.
[0003] However, the current algorithms for detecting whether a face image is a synthetic image often only use one model or method for detection, and the detection angle is too single, resulting in insufficient detection accuracy. Summary of the invention
[0004] The present invention provides a method, device, electronic device and computer-readable storage medium for detecting a composite face image, the main purpose of which is to improve the detection accuracy of the composite face image.
[0005] To achieve the above object, the present invention provides a method for detecting a composite face image, comprising:
[0006] Acquire an original image to be detected, and use a preset face detection algorithm to detect whether there is face information in the original image to be detected;
[0007] If there is face information in the original image to be detected, the original image to be detected is converted into a frequency domain to obtain a frequency domain image to be detected;
[0008] Filtering the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detecting the face probability of the denoised frequency domain image by using a pre-built frequency domain model to obtain the face probability of the frequency domain image;
[0009] Using a preset face recognition algorithm to obtain the face area in the original image to be detected, and obtain a set of intercepted face images;
[0010] Calculate the face probability value of each intercepted face image in the intercepted face image set by using the pre-built RGB network model to obtain a face probability value set, and merge the face probability values in the face probability value set to obtain the intercepted image face probability;
[0011] Weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability;
[0012] When the comprehensive face probability is greater than a preset detection threshold, determining that the original image to be detected is a real face image;
[0013] When the comprehensive face probability is less than or equal to the preset detection threshold, the original image to be detected is determined to be a synthetic face image.
[0014] Optionally, the using a preset face detection algorithm to detect whether there is face information in the original image to be detected includes:
[0015] Performing convolution operations and pooling operations on the original images to be detected of different scales to obtain multiple original feature detection images;
[0016] Performing non-maximum suppression processing on the plurality of original feature detection images to obtain a plurality of screening feature images;
[0017] Using the pre-trained XGBoost model to determine whether there is face information in the plurality of screening feature maps;
[0018] When there is face information in any of the screening feature maps, determining that there is face information in the original image to be detected;
[0019] When no face information exists in all the screened feature maps, it is determined that no face information exists in the original image to be detected.
[0020] Optionally, performing frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected includes:
[0021] Acquire the spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtain the spatial domain image to be detected;
[0022] The spatial domain image to be detected is converted into a frequency domain using a fast Fourier transform formula to obtain a frequency domain image to be detected.
[0023] Optionally, the fast Fourier transform formula is:
[0024]
[0025] Among them, x and y represent the pixel coordinates of the spatial domain image to be detected, u and v represent the pixel coordinates of the frequency domain image to be detected, M and N represent the width and height of the spatial domain image to be detected, and j is a fixed parameter.
[0026] Optionally, the using a preset face recognition algorithm to obtain a face region in the original image to be detected to obtain a set of intercepted face images includes:
[0027] Using a preset face recognition algorithm to detect and process the original image to be detected to obtain a face frame;
[0028] Using the face frame to intercept the original image to be detected to obtain a set of intercepted images;
[0029] The sizes of the captured images in the captured image set are adjusted to be consistent to obtain a captured face image set.
[0030] Optionally, before performing frequency domain conversion on the original image to be detected, the method further includes:
[0031] Calculating the area of the face image in the original image to be detected;
[0032] If the ratio of the area of the face image in the image to be detected to the original image to be detected is less than a preset threshold, reacquiring the original image to be detected;
[0033] 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, the operation of performing frequency domain conversion on the original image to be detected is performed.
[0034] Optionally, calculating the area of the face image in the original image to be detected includes:
[0035] Acquire the face edge of the face image in the original image to be detected by using an edge detection algorithm;
[0036] The number of pixels of the face image in the original image to be detected is counted based on the face edge, and the area of the face image in the original image to be detected is determined according to the number of pixels.
[0037] In order to solve the above problem, the present invention also provides a detection device for a face composite image, the device comprising:
[0038] A face information detection module is used to obtain an original image to be detected and detect whether there is face information in the original image to be detected using a preset face detection algorithm;
[0039] A frequency domain face probability calculation module is used to perform frequency domain conversion on the original image to be detected if there is face information in the original image to be detected to obtain a frequency domain image to be detected, filter the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detect the face probability of the denoised frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
[0040] The intercepted face probability calculation module is used to obtain the face area in the original image to be detected by using a preset face recognition algorithm to obtain a set of intercepted face images, calculate the face probability value of each intercepted face image in the set of intercepted face images by using a pre-built RGB network model to obtain a face probability value set, and fuse the face probability values in the set of face probability values to obtain the intercepted image face probability;
[0041] A comprehensive face probability calculation module, used for weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability;
[0042] The synthetic face judgment module is used to determine 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 to determine 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.
[0043] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0044] at least one processor; and,
[0045] a memory communicatively connected to the at least one processor; wherein,
[0046] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method for detecting a synthetic face image as described above.
[0047] In order to solve the above problems, the present invention also provides a computer-readable storage medium, including a data storage area and a program storage area, the data storage area stores created data, and the program storage area stores a computer program; wherein, when the computer program is executed by a processor, the method for detecting a synthetic face image as described above is implemented.
[0048] In an embodiment of the present invention, it is first detected whether the original image to be detected contains facial information to avoid wasting computing resources by incorporating meaningless images into the detection process. If facial information exists, the original image to be detected is converted into a frequency domain to obtain a frequency domain map to be detected, and then the light noise interference is filtered out by a high-pass filter to obtain a denoised frequency domain map. The noisy frequency domain map is input into a pre-constructed frequency domain model to obtain a face probability in the frequency domain map. Then, the original image to be detected is intercepted by face recognition to obtain a captured image. The captured image is input into and out of a pre-constructed RGB network model to obtain a face probability in the captured image. Finally, the probabilities obtained by the two models are weighted to obtain a comprehensive face probability. Finally, a filtering condition is added to determine whether the image is a real face or a synthetic face. This embodiment extracts features of image details through an RGB network model and a frequency domain model, and can better extract feature information in the image to be detected. Therefore, the embodiment of the present invention can achieve the purpose of improving the detection accuracy of synthetic face images. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a flow chart of a method for detecting a composite face image provided by an embodiment of the present invention;
[0050] Figure 2 A detailed flowchart of a step in a method for detecting a synthetic face image is provided for one embodiment of the present invention;
[0051] Figure 3 A schematic diagram of a module of a detection device for a synthetic face image provided by an embodiment of the present invention;
[0052] Figure 4 A schematic diagram of the internal structure of an electronic device for implementing a method for detecting a synthetic face image provided by an embodiment of the present invention;
[0053] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0055] The embodiment of the present application provides a method for detecting a composite face image. The execution subject of the method for detecting a composite face image includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. Among them, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as 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 big data and artificial intelligence platforms. In other words, the method for detecting a composite face image can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0056] Reference Figure 1 FIG. 1 is a flow chart of a method for detecting a composite face image provided by an embodiment of the present invention. In this embodiment, the method for detecting a composite face image includes:
[0057] S1. Obtain the original image to be detected.
[0058] In an embodiment of the present invention, the original image to be detected may be an image captured by a terminal device such as a mobile phone, a camera or a tablet computer, and is used to detect whether the facial image is a synthetic facial image, that is, to determine whether the facial image in the original image to be detected is a normally taken real person image or an artificially synthesized image.
[0059] In another embodiment of the present invention, the original image to be detected may also be a publicly available image crawled from the Internet using crawler technology, or an image obtained from a preset database of images to be detected, or an image uploaded by a user.
[0060] S2. Detect whether there is face information in the original image to be detected using a preset face detection algorithm.
[0061] See also Figure 2 , Figure 2 A detailed flowchart of a step in a method for detecting a composite face image is provided for one embodiment of the present invention.
[0062] In the embodiment of the present invention, the step of using a preset face detection algorithm to detect whether there is face information in the original image to be detected includes:
[0063] S201, scaling the original image to be detected at different ratios to obtain a plurality of original images to be detected at different scales;
[0064] S202, performing convolution operations and pooling operations on the multiple original images to be detected of different scales respectively, to obtain multiple original feature detection images;
[0065] S203, performing non-maximum suppression processing on the plurality of original feature detection images to obtain a plurality of screening feature images;
[0066] S204, using the pre-trained XGBoost model to determine whether there is face information in the plurality of screening feature graphs;
[0067] S205, when there is face information in any of the screening feature maps, determining that there is face information in the original image to be detected;
[0068] S206: When no face information exists in any of the screened feature maps, determine that no face information exists in the original image to be detected.
[0069] The face detection algorithm described in the embodiment of the present invention is a DenseBox algorithm, which is used to detect faces from a target image.
[0070] In an embodiment of the present invention, the convolution operation is a 2D convolution operation, which is used to obtain image features from the original image to be detected by convolving with 2D convolution kernels with different functions, the pooling operation is used to average the image features, and the non-maximum suppression is used to screen the original feature detection image.
[0071] The XGBoost (eXtreme Gradient Boosting) extreme gradient boosting model described in the embodiment of the present invention is a model based on GBDT, which is a strong classification model used to determine whether there is face information in each of the screening feature maps.
[0072] S3: If there is no face information in the original image to be detected, reacquire the original image to be detected.
[0073] Furthermore, if there is no face information in the original image to be detected, the operation of acquiring the original image to be detected is performed again.
[0074] Specifically, if there is no face information in the original image to be detected, it means that the original image to be detected is an image without detection value, and the original image to be detected is discarded, and a new original image to be detected is obtained again.
[0075] Specifically, reacquiring the new original image to be detected may be reshooting the target acquisition image 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.
[0076] S4. If there is face information in the original image to be detected, frequency domain conversion is performed on the original image to be detected to obtain a frequency domain image to be detected.
[0077] In the embodiment of the present invention, if there is face information in the original image to be detected, it means that the original image to be detected is a usable image, an image with detection value of a face composite image, and subsequent operations will be performed on the original image to be detected.
[0078] In the embodiment of the present invention, the frequency domain conversion is to convert an image displayed as a spatial signal into an image displayed as a frequency signal.
[0079] In detail, the frequency domain conversion of the original image to be detected to obtain the frequency domain image to be detected includes:
[0080] Acquire the spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtain the spatial domain image to be detected;
[0081] The spatial domain image to be detected is converted into a frequency domain using a fast Fourier transform formula to obtain a frequency domain image to be detected.
[0082] In the embodiment of the present invention, the spatial domain can also be called image space, which represents the set of pixels constituting the original image to be detected. The frequency domain is a coordinate system used to describe the characteristics of the signal in terms of frequency, with the horizontal axis being the frequency and the vertical axis being the intensity of the frequency signal.
[0083] In the embodiment of the present invention, the fast Fourier transform formula is a formula in the Fourier transform (Fast Fourier Transform), which can express a function that meets certain conditions in the form of a trigonometric function. In this solution, the purpose of the fast Fourier transform is to decompose the pixel signal into a frequency spectrum and display the amplitude corresponding to the frequency.
[0084] Specifically, the Fourier transform formula is:
[0085]
[0086] Among them, x and y represent the pixel coordinates of the spatial domain image to be detected, u and v represent the pixel coordinates of the frequency domain image to be detected, M and N represent the width and height of the spatial domain image to be detected, and j is a fixed parameter.
[0087] Furthermore, before performing frequency domain conversion on the original image to be detected, the method further includes:
[0088] Calculating the area of the face image in the original image to be detected;
[0089] If the ratio of the area of the face image in the image to be detected to the original image to be detected is less than a preset threshold, reacquiring the original image to be detected;
[0090] If the area of the face image in the image to be detected and the wallpaper of the original image to be detected are greater than or equal to the preset threshold, the operation of performing frequency domain conversion on the original image to be detected is performed.
[0091] Optionally, the preset threshold is 0.65.
[0092] In the embodiment of the present invention, the step of calculating the area of the face image in the original image to be detected includes:
[0093] Acquire the face edge of the face image in the original image to be detected by using an edge detection algorithm;
[0094] The number of pixels of the face image in the original image to be detected is counted based on the face edge, and the area of the face image in the original image to be detected is determined according to the number of pixels.
[0095] S5. Filter the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detect the face probability of the denoised frequency domain image by using a pre-built frequency domain model to obtain the face probability of the frequency domain image.
[0096] In the embodiment of the present invention, since the noise is mainly concentrated in the high-frequency part during the transmission of the image, and the edge and the sharply changing part of the image are also related to the high-frequency component, the image can be effectively sharpened by a high-frequency filter.
[0097] In the embodiment of the present invention, the high-pass filter includes a high-pass filter formula, and the high-pass filter formula is:
[0098]
[0099] Among them, H(u,v) is the denoised frequency domain image, D(u,v) is the frequency domain image to be detected, and D0 is a fixed parameter.
[0100] In one embodiment of the present invention, the value of D0 is 115.
[0101] In the embodiment of the present invention, the denoised frequency domain image is an image from which high-frequency noise interference in the frequency domain image to be detected is removed.
[0102] In an embodiment of the present invention, the frequency domain model is composed of a densely connected convolutional neural network (DenseNet) and an attention mechanism network (Coordinate Attention, CA).
[0103] S6. Using a preset face recognition algorithm to obtain the face region in the original image to be detected, to obtain a set of captured face images.
[0104] In detail, the face recognition algorithm may be an existing lightweight face recognition algorithm, for example, a centerface algorithm.
[0105] In the embodiment of the present invention, the method of obtaining the face region in the original image to be detected by using a preset face recognition algorithm to obtain a set of intercepted face images includes:
[0106] Using a preset face recognition algorithm to detect and process the original image to be detected to obtain a face frame;
[0107] Using the face frame to intercept the original image to be detected to obtain a set of intercepted images;
[0108] The sizes of the captured images in the captured image set are adjusted to be consistent to obtain a captured face image set.
[0109] In the embodiment of the present invention, the face frame is a candidate frame used to select a range of a face image.
[0110] In the embodiment of the present invention, since it is impossible to confirm the specific part of the artificially synthesized image where the synthesis traces exist, multiple different face areas are set in this embodiment to obtain more face image features, so as to more clearly distinguish the synthesized face image from the real face image.
[0111] Further, for example, the preset area is divided into scale1 and scale2, and the two areas have corresponding coordinate sizes.
[0112] Specifically, the coordinates of the upper left corner of the face scale1 area are: (face_box.x, face_box.y), the width of the face scale1 area is: face_box_w, the height of the face scale1 area is: face_box_h, and the coordinates of the upper left corner of the face scale2 area are: Face scale2 area width: face_box_w*1.5, face scale2 box height: face_box_h*1.5.
[0113] In this embodiment, the resize() function may be used to adjust the image sizes to be consistent, for example, to a uniform size of 224*224 pixels.
[0114] S7. Calculate the face probability value of each intercepted face image in the intercepted face image set using a pre-built RGB network model to obtain a face probability value set, and merge the face probability values in the face probability value set to obtain the intercepted image face probability.
[0115] In an embodiment of the present invention, the RGB network model and the frequency domain model have the same network structure, and the only difference is the training process and input of the model. The input of the RGB network model is a captured face image, and the input of the frequency domain model is a denoised frequency domain image.
[0116] 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 can be expressed as a CA_DenseNet model.
[0117] Specifically, the RGB network model includes three CA_Dense Blocks, and the CA_Dense Block is obtained by adding a CA attention mechanism module to the last two layers of the DenseNet Block in the DenseNet network.
[0118] In the embodiment of the present invention, the face probability values in the face probability value set are merged by averaging the face probability values in the face probability value set. For example, two face probability values cls1 and cls2 are obtained based on the scale1 area and the scale2 area to obtain the face probability of the intercepted image:
[0119]
[0120] Among them, cls1 and cls2 are face probability value 1 and face probability value 2 in the face probability value set, and P(RGB) is the face probability of the captured image.
[0121] S8. Weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability.
[0122] In the embodiment of the present invention, the comprehensive face probability is a face probability that combines the frequency domain image face probability and the cut image face probability, reflecting the possibility that the original image to be detected is a real person image.
[0123] In the embodiment of the present invention, the formula for weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image is:
[0124] P(cls)=0.45*P(Fr)+0.55*P(RGB)
[0125] Among them, P(cls) is the comprehensive face probability, P(Fr) is the face probability of the frequency domain image, and P(RGB) is the face probability of the cropped image.
[0126] S9. Determine whether the comprehensive face probability is greater than a preset detection threshold.
[0127] In an embodiment of the present invention, the preset detection threshold is a score threshold used to determine whether the original image to be detected is a real person image. By comparing the preset detection threshold with the comprehensive face probability, the original image to be detected can be judged more intuitively.
[0128] In the embodiment of the present invention, a judgment is made based on the comprehensive face probability and the preset detection threshold. 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:
[0129]
[0130] Among them, y is the judgment result, and N is the preset detection threshold.
[0131] Optionally, the value of N is 0.65.
[0132] S10. When the comprehensive face probability is greater than the preset detection threshold, determine that the original image to be detected is a real face image.
[0133] In the embodiment of the present invention, if it is determined that the original image to be detected is a real face image, subsequent operations can be performed, such as authenticating the user identity in the real face image, and completing operations such as mobile payment after the authentication is passed.
[0134] S11. When the comprehensive face probability is less than or equal to the preset detection threshold, determine that the original image to be detected is a synthetic face image.
[0135] In an embodiment of the present invention, if the original image to be detected is determined to be a synthesized facial image, no further operations can be performed subsequently. For example, when performing facial mobile payment based on the original image to be detected, if the original image to be detected is determined to be a synthesized facial image, the payment fails. When performing access control recognition based on the original image to be detected, if the original image to be detected is determined to be a synthesized face and fails, the access control cannot be opened and passage is not allowed.
[0136] In an embodiment of the present invention, it is first detected whether the original image to be detected contains facial information to avoid wasting computing resources by incorporating meaningless images into the detection process. If facial information exists, the original image to be detected is converted into a frequency domain to obtain a frequency domain map to be detected, and then the light noise interference is filtered out by a high-pass filter to obtain a denoised frequency domain map. The noisy frequency domain map is input into a pre-constructed frequency domain model to obtain a face probability in the frequency domain map. Then, the original image to be detected is intercepted by face recognition to obtain a captured image. The captured image is input into and out of a pre-constructed RGB network model to obtain a face probability in the captured image. Finally, the probabilities obtained by the two models are weighted to obtain a comprehensive face probability. Finally, a filtering condition is added to determine whether the image is a real face or a synthetic face. This embodiment extracts features of image details through an RGB network model and a frequency domain model, and can better extract feature information in the image to be detected. Therefore, the embodiment of the present invention can achieve the purpose of improving the detection accuracy of synthetic face images.
[0137] like Figure 3 , which is a module schematic diagram of the detection device for face composite image of the present invention.
[0138] The detection device 100 for synthetic face images of the present invention can be installed in an electronic device. According to the functions to be implemented, the detection device for synthetic face images can include a face information detection module 101, a frequency domain face probability calculation module 102, a captured face probability calculation module 103, a comprehensive face probability calculation module 104 and a synthetic face judgment module 105. The module of the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0139] In this embodiment, the functions of each module / unit are as follows:
[0140] The face information detection module 101 is used to obtain an original image to be detected and use a preset face detection algorithm to detect whether there is face information in the original image to be detected.
[0141] The frequency domain face probability calculation module 102 is used to perform frequency domain conversion on the original image to be detected to obtain a frequency domain image to be detected if there is face information in the original image to be detected, filter the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detect the face probability of the denoised frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image;
[0142] The intercepted face probability calculation module 103 is used to obtain the face area in the original image to be detected by using a preset face recognition algorithm to obtain a set of intercepted face images, calculate the face probability value of each intercepted face image in the set of intercepted face images by using a pre-built RGB network model to obtain a set of face probability values, and merge the face probability values in the set of face probability values to obtain the intercepted image face probability;
[0143] A comprehensive face probability calculation module 104 is used to perform weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability;
[0144] The synthetic face judgment module 105 is used to determine 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 to determine 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.
[0145] In detail, each module in the face composite image detection device 100 of the embodiment of the present invention is used in the same manner as described above. Figure 1 to Figure 2 The same technical means as the detection method of the face synthetic image described in , and can produce the same technical effect, will not be repeated here.
[0146] like Figure 4 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a method for detecting a synthetic face image according to the present invention.
[0147] The electronic device may include a processor 10, a memory 11, a communication bus 12, and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a detection program for a synthetic face image.
[0148] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a detection program for a synthetic face image, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0149] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the detection program of the face synthesis image, etc., but also be used to temporarily store data that has been output or is to be output.
[0150] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0151] The communication interface 13 is used for communication between the above-mentioned 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 (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally 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)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0152] Figure 4 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 4The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0153] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0154] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0155] The facial composite image detection program stored in the memory 11 of the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0156] Acquire an original image to be detected, and use a preset face detection algorithm to detect whether there is face information in the original image to be detected;
[0157] If there is face information in the original image to be detected, the original image to be detected is converted into a frequency domain to obtain a frequency domain image to be detected;
[0158] Filtering the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detecting the face probability of the denoised frequency domain image by using a pre-built frequency domain model to obtain the face probability of the frequency domain image;
[0159] Using a preset face recognition algorithm to obtain the face area in the original image to be detected, and obtain a set of intercepted face images;
[0160] Calculate the face probability value of each intercepted face image in the intercepted face image set by using the pre-built RGB network model to obtain a face probability value set, and merge the face probability values in the face probability value set to obtain the intercepted image face probability;
[0161] Weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability;
[0162] When the comprehensive face probability is greater than a preset detection threshold, determining that the original image to be detected is a real face image;
[0163] When the comprehensive face probability is less than or equal to the preset detection threshold, the original image to be detected is determined to be a synthetic face image.
[0164] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0165] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0166] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0167] Acquire an original image to be detected, and use a preset face detection algorithm to detect whether there is face information in the original image to be detected;
[0168] If there is face information in the original image to be detected, the original image to be detected is converted into a frequency domain to obtain a frequency domain image to be detected;
[0169] Filtering the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detecting the face probability of the denoised frequency domain image by using a pre-built frequency domain model to obtain the face probability of the frequency domain image;
[0170] Using a preset face recognition algorithm to obtain the face area in the original image to be detected, and obtain a set of intercepted face images;
[0171] Calculate the face probability value of each intercepted face image in the intercepted face image set by using the pre-built RGB network model to obtain a face probability value set, and merge the face probability values in the face probability value set to obtain the intercepted image face probability;
[0172] Weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability;
[0173] When the comprehensive face probability is greater than a preset detection threshold, determining that the original image to be detected is a real face image;
[0174] When the comprehensive face probability is less than or equal to the preset detection threshold, the original image to be detected is determined to be a synthetic face image.
[0175] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0176] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on 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.
[0177] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0178] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0179] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0180] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0181] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0182] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for detecting a synthetic face image, characterized in that: The method comprises: Acquire an original image to be detected, and use a preset face detection algorithm to detect whether there is face information in the original image to be detected, including: scaling the original image to be detected at different ratios to obtain multiple original images to be detected of different scales, performing convolution operations and pooling operations on the multiple original images to be detected of different scales to obtain multiple original feature detection maps, performing non-maximum suppression processing on the multiple original feature detection maps to obtain multiple screening feature maps, and using a pre-trained XGBoost model to determine whether there is face information in the multiple screening feature maps. When there is face information in any of the screening feature maps, it is determined that there is face information in the original image to be detected, and when there is no face information in all the screening feature maps, it is determined that there is no face information in the original image to be detected; If there is face information in the original image to be detected, the original image to be detected is converted into a frequency domain to obtain a frequency domain image to be detected; Filtering the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detecting the face probability of the denoised frequency domain image by using a pre-built frequency domain model to obtain the face probability of the frequency domain image; Using a preset face recognition algorithm to obtain the face area in the original image to be detected, and obtain a set of intercepted face images; Calculate the face probability value of each intercepted face image in the intercepted face image set by using the pre-built RGB network model to obtain a face probability value set, and average the face probability values in the face probability value set to obtain the intercepted image face probability; Weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability; When the comprehensive face probability is greater than a preset detection threshold, determining that the original image to be detected is a real face image; When the comprehensive face probability is less than or equal to the preset detection threshold, the original image to be detected is determined to be a synthetic face image.
2. The method for detecting a composite face 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: Acquire the spatial domain of the original image to be detected based on the pixel points of the original image to be detected, and obtain the spatial domain image to be detected; The spatial domain image to be detected is converted into a frequency domain using a fast Fourier transform formula to obtain a frequency domain image to be detected.
3. The method for detecting a synthetic face image according to claim 2, wherein: The fast Fourier transform formula is: Among them, x and y represent the pixel coordinates of the spatial domain image to be detected, u and v represent the pixel coordinates of the frequency domain image to be detected, M and N represent the width and height of the spatial domain image to be detected, and j is a fixed parameter.
4. The method for detecting a composite face image according to claim 1, wherein: The method of using a preset face recognition algorithm to obtain a face region in the original image to be detected to obtain a set of intercepted face images includes: Using a preset face recognition algorithm to detect and process the original image to be detected to obtain a face frame; Using the face frame to intercept the original image to be detected to obtain a set of intercepted images; The sizes of the captured images in the captured image set are adjusted to be consistent to obtain a captured face image set.
5. The method for detecting a synthetic face image according to claim 1, wherein: Before performing frequency domain conversion on the original image to be detected, the method further includes: Calculating the area of the 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 less than a preset threshold, reacquiring the original image to be detected; 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, the operation of performing frequency domain conversion on the original image to be detected is performed.
6. The method for detecting a synthetic face image according to claim 5, wherein: The calculating the area of the face image in the original image to be detected includes: Acquire the face edge of the face image in the original image to be detected by using an edge detection algorithm; The number of pixels of the face image in the original image to be detected is counted based on the face edge, and the area of the face image in the original image to be detected is determined according to the number of pixels.
7. A detection device for a synthetic face image, characterized in that: The device comprises: A face information detection module is used to obtain an original image to be detected, and use a preset face detection algorithm to detect whether there is face information in the original image to be detected, including: scaling the original image to be detected at different ratios to obtain multiple original images to be detected of different scales, performing convolution operations and pooling operations on the multiple original images to be detected of different scales to obtain multiple original feature detection images, performing non-maximum suppression processing on the multiple original feature detection images to obtain multiple screening feature images, and using a pre-trained XGBoost model to determine whether there is face information in the multiple screening feature images. When there is face information in any of the screening feature images, it is determined that there is face information in the original image to be detected, and when there is no face information in all the screening feature images, it is determined that there is no face information in the original image to be detected. A frequency domain face probability calculation module is used to perform frequency domain conversion on the original image to be detected if there is face information in the original image to be detected to obtain a frequency domain image to be detected, filter the noise of the frequency domain image to be detected by using a high-pass filter to obtain a denoised frequency domain image, and detect the face probability of the denoised frequency domain image by using a pre-constructed frequency domain model to obtain the face probability of the frequency domain image; The intercepted face probability calculation module is used to obtain the face area in the original image to be detected by using a preset face recognition algorithm to obtain a set of intercepted face images, calculate the face probability value of each intercepted face image in the set of intercepted face images by using a pre-built RGB network model to obtain a face probability value set, and average the face probability values in the set of face probability values to obtain the intercepted image face probability; A comprehensive face probability calculation module, used for weighted calculation of the face probability of the frequency domain image and the face probability of the intercepted image to obtain a comprehensive face probability; The synthetic face judgment module is used to determine 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 to determine 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.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the method for detecting a synthetic face image according to any one of claims 1 to 6.
9. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores created data and the program storage area stores a computer program; wherein: When the computer program is executed by a processor, the method for detecting a synthetic face image according to any one of claims 1 to 6 is implemented.
