Face detection method, device, readable medium and electronic device

By establishing an anti-counterfeiting detection model on smart devices, combining the gravity map of RGB cameras and gravity sensors, the face detection problem that old devices cannot be upgraded is solved, and anti-counterfeiting face detection without increasing hardware costs is achieved.

CN114863529BActive Publication Date: 2025-08-12BEIJING XUEZHITU NETWORK TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210502264.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2025-08-12
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

Existing smart devices are difficult to achieve anti-counterfeiting functions in face detection, especially for old devices that are not equipped with additional sensors, which cannot be upgraded through hardware modification, resulting in an increase in additional hardware costs.

Method used

By establishing an anti-counterfeiting detection model based on artificial intelligence, combining the gravity map collected by RGB cameras and gravity sensors, the model is trained using comparative learning data to judge the potential laws of the image and gravity maps to achieve anti-counterfeiting detection.

Benefits of technology

Without increasing hardware costs, the anti-counterfeit face detection function of smart devices is realized, which is easy to apply and promote on old models of devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114863529B_ABST
    Figure CN114863529B_ABST
Patent Text Reader

Abstract

The present invention discloses a face detection method, device, readable medium and electronic device, comprising: collecting an image to be detected and determining a gravity map to be detected corresponding to the image to be detected; using a predetermined anti-counterfeiting detection model, determining an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected; when the anti-counterfeiting result meets a first preset condition, performing face detection based on the image to be detected; the method realizes a face detection function with anti-counterfeiting ability without performing hardware modification on conventional smart devices; does not increase additional hardware costs, and is easy to apply and promote on old models of smart devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a face detection method, device, readable medium and electronic device. Background Art

[0002] Face detection is an authentication and recognition method currently used by many smart devices. To prevent counterfeiting and distinguish between real faces and image forgeries, most smart devices use a solution that combines RGB cameras with other sensors.

[0003] However, integrating other sensor solutions incurs additional hardware costs. Furthermore, it's often impossible to retrofit hardware into older devices that don't have the appropriate sensors, allowing them to be upgraded with face detection capabilities. Summary of the Invention

[0004] The present invention provides a face detection method, device, readable medium and electronic device, which realize anti-counterfeiting in the face detection process through an anti-counterfeiting detection model established based on artificial intelligence.

[0005] In a first aspect, the present invention provides a face detection method, comprising:

[0006] Acquire an image to be detected, and determine a gravity map to be detected corresponding to the image to be detected;

[0007] Determining an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected using a predetermined anti-counterfeiting detection model;

[0008] When the anti-counterfeiting result meets a first preset condition, face detection is performed based on the image to be detected.

[0009] Preferably, determining the gravity map to be detected corresponding to the image to be detected includes:

[0010] Determining a time range for acquiring the image to be detected;

[0011] determining a value of gravity sensor data within the time range;

[0012] The gravity map to be detected is determined according to the value of the gravity sensing data.

[0013] Preferably, it also includes:

[0014] The anti-counterfeiting detection model is predetermined by using contrastive learning data training.

[0015] Preferably, the method of using contrastive learning data training to predetermine the anti-counterfeiting detection model includes:

[0016] determining a sample image and a sample gravity map;

[0017] Determine the initial model;

[0018] Using the sample image and the sample gravity map, performing the comparative learning data training on the initial model;

[0019] The trained initial model is determined as the anti-counterfeiting detection model.

[0020] Preferably, the sample images include real sample images and fake sample images; the sample gravity maps include real sample gravity maps and fake sample gravity maps;

[0021] The performing the comparative learning data training on the initial model using the sample image and the sample gravity map includes:

[0022] Determining the true sample image and the true sample gravity map as a first positive sample pair;

[0023] Determining the fake sample image and the true sample gravity map as a second positive sample pair;

[0024] Determine the true sample image and the false sample gravity map as a first negative sample pair;

[0025] Determining the fake sample image and the fake sample gravity map as a second negative sample pair;

[0026] The contrastive learning data training is performed on the initial model using the first positive sample pair, the second positive sample pair, the first negative sample pair, and the second negative sample pair.

[0027] Preferably, the performing the comparative learning data training on the initial model includes:

[0028] Inputting the sample image and the sample gravity map into the initial model so that the initial model outputs a calculation result;

[0029] Determining the loss index of the calculation result using a preset loss function;

[0030] When the loss indicator meets the second preset condition, the internal parameters of the initial model are adjusted.

[0031] Preferably, when the anti-counterfeiting result satisfies the first preset condition, performing face detection based on the image to be detected includes:

[0032] When the anti-counterfeiting result is true, it is considered that the first preset condition is met;

[0033] Perform face detection based on the image to be detected to determine identity information corresponding to the image to be detected.

[0034] In a second aspect, the present invention provides a face detection device, comprising:

[0035] A data acquisition module is used to acquire an image to be detected and determine a gravity map to be detected corresponding to the image to be detected;

[0036] an anti-counterfeiting module, configured to determine an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected by using a predetermined anti-counterfeiting detection model;

[0037] The detection module is used to perform face detection based on the image to be detected when the anti-counterfeiting result meets a first preset condition.

[0038] In a third aspect, the present invention provides a readable medium comprising an execution instruction. When a processor of an electronic device executes the execution instruction, the electronic device executes any method described in the first aspect.

[0039] In a fourth aspect, the present invention provides an electronic device comprising a processor and a memory storing execution instructions, wherein when the processor executes the execution instructions stored in the memory, the processor executes any method described in the first aspect.

[0040] The present invention provides a face detection method, device, readable medium and electronic device, which realize anti-counterfeiting face detection function without hardware modification of conventional smart devices; do not increase additional hardware costs, and are easy to apply and promote on old models of smart devices.

[0041] The further effects of the above-mentioned non-conventional preferred embodiment will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the existing technical solutions, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 A schematic flow chart of a face detection method provided by one embodiment of the present invention;

[0044] Figure 2 A schematic diagram of the process of training an anti-counterfeiting detection model in a face detection method provided by one embodiment of the present invention;

[0045] Figure 3 A schematic structural diagram of a face detection device provided by one embodiment of the present invention;

[0046] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0048] Face detection is an authentication and recognition method currently used by many smart devices. However, face detection can be susceptible to counterfeiting. This involves using photos of people to replace real faces in an attempt to pass face detection. To prevent counterfeiting during face detection and distinguish between real faces and image forgeries, most smart devices use a solution that combines RGB cameras with other sensors.

[0049] These other sensors can be infrared cameras or time-of-flight (TOF) sensors. These sensors can determine whether the detected object is alive, that is, whether it is a real human face. Combined with the RGB sensor to collect images and perform image analysis, the identity of the detected object can be determined, indicating whether it is a legitimate user of the smart device. This enables anti-counterfeiting face detection.

[0050] However, integrating other sensor solutions incurs additional hardware costs, increasing the overall cost of smart devices. Furthermore, hardware retrofits are often not feasible for older devices that don't already have the appropriate sensors. This means that devices without facial detection capabilities cannot be retrofitted to include anti-counterfeiting features.

[0051] In view of this, the present invention provides a face detection method. Figure 1 FIG. 1 is a specific embodiment of the face detection method provided by the present invention. In this embodiment, the method includes:

[0052] Step 101: collect an image to be detected, and determine a gravity map to be detected corresponding to the image to be detected.

[0053] The image to be detected is, in this embodiment, the facial image to be detected. In this embodiment, this image can be captured using an RGB camera typically found on smart devices. Face detection can present the risk of forgery; that is, the "face" in the image to be detected may be a real face or a forgery from a photograph. In this embodiment, this is determined during the face detection process, thereby achieving anti-forgery protection.

[0054] In this embodiment, anti-counterfeiting measures are implemented by combining a gravity map to be detected. The gravity map to be detected is determined based on gravity sensor data collected by a gravity sensor typically installed on smart devices. Specifically, while capturing the image to be detected, the time range for capturing the image to be detected can be determined. The values of the gravity sensor data collected by the gravity sensor within this time range are then obtained. In other words, the gravity sensor data obtained by the gravity sensor of the smart device and the changes in this data during the capture of the image to be detected are determined. This gravity sensor data can reflect the position of the smart device when the image to be detected was captured. Based on the values of the gravity sensor data within this time range, the gravity map to be detected can be determined. Typically, the gravity map to be detected is time series data, representing the changes in the gravity sensor data values over time within this time range. From a visualization perspective, the gravity map to be detected can be a two-dimensional curve, with the horizontal axis representing time and the vertical axis representing the data values.

[0055] It's understandable that when a user performs face detection using a real face, their movements often differ from when performing face detection using a fake portrait photo. For example, during a normal standing or sitting test, the user holds the smart device, which will be in an upright position. However, if the smart device is used to capture and detect a portrait photo placed on a table, the smart device will be nearly flat. Therefore, the posture of the smart device may also vary during the authenticity detection process. Furthermore, gravity sensor data can reflect the posture of the smart device. Therefore, theoretically, the differences in the posture of the smart device during the authenticity detection process described above will be reflected in the gravity map being tested.

[0056] Based on this conclusion, this embodiment combines the gravity map to be detected to achieve anti-counterfeiting. It should also be noted that the RGB camera used to capture the image to be detected and the gravity sensor used to determine the gravity map to be detected in this embodiment are both hardware that is essential on general smart devices. Therefore, no additional hardware is required, nor is any hardware modification required to implement the method in this embodiment.

[0057] Step 102: using a predetermined anti-counterfeiting detection model, according to the image to be detected and the gravity map to be detected, determine the anti-counterfeiting result corresponding to the image to be detected.

[0058] In this embodiment, the anti-counterfeiting detection model is a computational model built based on artificial intelligence technology. Specifically, the anti-counterfeiting detection model can be pre-determined using comparative learning data training. This embodiment does not limit the specific training process for the anti-counterfeiting detection model. Any training process based on the same or similar principles may be incorporated into the overall technical solution of this embodiment.

[0059] As previously known, the positional differences of smart devices during the authenticity detection process are related to the gravity map being tested. This means that, when detecting real or fake faces, there are underlying patterns between the image being tested and the gravity map being tested. Anti-counterfeiting detection models built using artificial intelligence can grasp these underlying patterns to a certain extent during data training. In subsequent applications, they can then use this information to perform calculations and determine whether the input image and gravity map represent a real face or a fake.

[0060] Therefore, the input data for the anti-counterfeiting detection model is the image to be detected and the gravity map to be detected. Through the internal calculations of the anti-counterfeiting detection model, the corresponding anti-counterfeiting result can be calculated based on the input image to be detected and the gravity map to be detected. The anti-counterfeiting result can be "authentic" or "forged". If the anti-counterfeiting result is "authentic", it means that the anti-counterfeiting detection model determines that the image to be detected is from a real human face. Conversely, if the anti-counterfeiting result is "forged", it means that the image to be detected is not from a real human face and is therefore forged.

[0061] Step 103: When the anti-counterfeiting result meets the first preset condition, face detection is performed based on the image to be detected.

[0062] If the anti-counterfeiting result is "authentic," it can be considered that the anti-counterfeiting result meets the first preset condition. At this point, actual face detection can be further performed on the image to be detected. That is, the "face" in the image to be detected is detected and analyzed using image analysis technology to determine the identity information corresponding to the image to be detected. This completes the conventional face detection and recognition function of the smart device.

[0063] It should also be noted that the above-mentioned anti-counterfeiting detection model can complete the relevant data training through specialized equipment (such as large computers, servers and other equipment). And it can be installed on commonly used smart devices in the form of a software program. In the process of implementing the method in this embodiment on the smart device, the hardware only needs to rely on a conventional RGB camera and a gravity sensor. The anti-counterfeiting detection model and the related image analysis algorithm are all at the software level. In other words, the smart device only needs to undergo a software upgrade, without the need for hardware modification, to obtain a face detection function with anti-counterfeiting capabilities.

[0064] Through the above technical solution, it can be seen that the beneficial effects of this embodiment are: without making hardware modifications to conventional smart devices, a face detection function with anti-counterfeiting capabilities is realized; no additional hardware costs are added, and it is easy to apply and promote on old models of smart devices.

[0065] Figure 1 What is shown is only a basic embodiment of the method of the present invention. By performing certain optimization and expansion on this basis, other preferred embodiments of the method can be obtained.

[0066] like Figure 2 FIG. 1 is a flow chart of the anti-counterfeiting detection model training process in a face detection method according to the present invention. In this embodiment, the training process of the anti-counterfeiting detection model will be specifically described, which specifically includes the following steps:

[0067] Step 201: Determine a sample image and a sample gravity map.

[0068] In this embodiment, the anti-counterfeiting detection model is trained by contrastive learning training. A certain number of sample images and sample gravity maps are required during the training process. The sample image is a face image captured by an RGB camera. The sample gravity map also corresponds to the time range of the sample image. However, it should be noted that in order to meet the requirements of the corresponding samples for contrastive learning training, the sample images include true sample images and false sample images. Among them, the true sample image is an image from a real face, and the false sample image is an image that is not from a real face. The sample gravity map also includes a true sample gravity map and a false sample gravity map. The true sample gravity map is real and corresponds to the time when the sample image is captured, and the false sample gravity map does not correspond to the time when the sample image is captured.

[0069] Thus, the true sample image and the true sample gravity map can be determined as the first positive sample pair. The false sample image and the true sample gravity map can be determined as the second positive sample pair. The true sample image and the false sample gravity map can be determined as the first negative sample pair. The false sample image and the false sample gravity map can be determined as the second negative sample pair.

[0070] In other words, the positive sample pairs (including the first positive sample pair and the second positive sample pair) demonstrate a true correspondence between the sample image and the sample gravity map (regardless of whether the sample image is forged). In contrast, the negative sample pairs (including the first negative sample pair and the second negative sample pair) demonstrate an untrue correspondence between the sample image and the sample gravity map. This comparative learning allows the trained anti-counterfeiting detection model to discover regularities between the sample image and the sample gravity map, thereby further enabling the distinction between genuine and counterfeit images.

[0071] Step 202: Determine the initial model.

[0072] The initial model is an untrained network model whose structural characteristics can be applied to contrastive learning training. The specific structure of the initial model is not limited in this embodiment. Any network model with the above characteristics in the art can be combined with the overall solution of this embodiment.

[0073] Step 203: Use the sample images and sample gravity maps to perform comparative learning data training on the initial model.

[0074] In this embodiment, the initial model is trained on the aforementioned comparative learning data using the first positive sample pair, the second positive sample pair, the first negative sample pair, and the second negative sample pair. The training process can be described as follows: a sample image and a sample gravity map are input into the initial model, causing the initial model to output a computation result. This computation result can determine whether the input data is a positive or negative sample pair, or whether the sample image is true or false. A pre-set loss function is then used to determine a loss index for the computation result. The specific content of the loss function is not limited in this embodiment; any loss function in the art that can perform the same or similar function can be incorporated into the overall solution of this embodiment. The so-called loss index, to a certain extent, reflects the accuracy of the computation result. When the loss index meets a second preset condition, the internal parameters of the initial model are adjusted. If the loss index meets the second preset condition, this indicates that the accuracy of the computation result is still low, indicating that the computation result of the initial model is inaccurate. At this point, the internal parameters of the initial model are adjusted, and the training process is repeated until the loss index no longer meets the second preset condition, at which point the training is considered complete.

[0075] Step 204: Determine the trained initial model as the anti-counterfeiting detection model.

[0076] The initial model after training, i.e. Figure 1 The anti-counterfeiting detection model used in the illustrated embodiment can be run as a software program and implemented on a smart device to achieve anti-counterfeiting functionality during face detection.

[0077] like Figure 3 The figure shows a specific embodiment of a face detection device according to the present invention. The device described in this embodiment is used to perform Figures 1-2 The physical device of the method. Its technical solution is essentially consistent with the above embodiment, and the corresponding description in the above embodiment is also applicable to this embodiment. The device in this embodiment includes:

[0078] The data acquisition module 301 is used to acquire an image to be detected and determine a gravity map to be detected corresponding to the image to be detected.

[0079] The anti-counterfeiting module 302 is configured to determine an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected using a predetermined anti-counterfeiting detection model;

[0080] The detection module 303 is configured to perform face detection based on the image to be detected when the anti-counterfeiting result meets a first preset condition.

[0081] In addition Figure 3 Based on the embodiment shown, preferably, the present invention further includes:

[0082] The data acquisition module 301 includes:

[0083] The image acquisition unit 311 is used to acquire the image to be detected.

[0084] The gravity map acquisition unit 312 is used to determine the time range for acquiring the image to be detected; determine the value of the gravity sensor data within the time range; and determine the gravity map to be detected based on the value of the gravity sensor data.

[0085] Also includes:

[0086] The training module 304 is used to train the anti-counterfeiting detection model using comparative learning data.

[0087] The training module 304 includes:

[0088] The sample determination unit 341 is configured to determine a sample image and a sample gravity map.

[0089] The initial model determining unit 342 is configured to determine an initial model.

[0090] The model training unit 343 is configured to perform comparative learning data training on the initial model using the sample image and the sample gravity map; and determine the trained initial model as the anti-counterfeiting detection model.

[0091] The sample images include true sample images and false sample images; the sample gravity maps include true sample gravity maps and false sample gravity maps; the sample determination unit 341 includes:

[0092] The first positive sample pair determining subunit 3411 is configured to determine the true sample image and the true sample gravity map as a first positive sample pair.

[0093] The second positive sample pair determining subunit 3412 is configured to determine the false sample image and the true sample gravity map as a second positive sample pair.

[0094] The first negative sample pair determining subunit 3413 is configured to determine the true sample image and the false sample gravity map as a first negative sample pair.

[0095] The second negative sample pair determining subunit 3414 is configured to determine the fake sample image and the fake sample gravity map as a second negative sample pair.

[0096] The contrastive learning data training is performed on the initial model using the first positive sample pair, the second positive sample pair, the first negative sample pair, and the second negative sample pair.

[0097] The model training unit 343 includes:

[0098] The operation subunit 3431 is used to input the sample image and the sample gravity map into the initial model so that the initial model outputs the operation result.

[0099] The loss calculation subunit 3432 is used to determine the loss index of the operation result using a preset loss function.

[0100] The parameter adjustment subunit 3433 is used to adjust the internal parameters of the initial model when the loss index meets the second preset condition.

[0101] Figure 4 : This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Among them, the memory may include internal memory, such as high-speed random access memory (RAM), and may also include non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.

[0102] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0103] Memory is used to store execution instructions. Specifically, execution instructions are computer programs that can be executed. Memory can include internal memory and non-volatile memory, and provides execution instructions and data to the processor.

[0104] In one possible implementation, a processor reads corresponding execution instructions from non-volatile memory into internal memory and then executes them. Alternatively, the processor may obtain corresponding execution instructions from other devices to form a face detection device at a logical level. The processor executes the execution instructions stored in the memory to implement the face detection method provided in any embodiment of the present invention.

[0105] The present invention Figure 3 The method performed by the face detection device provided in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor or software instructions. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0106] The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the method described above.

[0107] The embodiment of the present invention further provides a readable medium, which stores an execution instruction. When the stored execution instruction is executed by the processor of the electronic device, the electronic device can execute the face detection method provided in any embodiment of the present invention, and is specifically used to execute the following Figure 1 or Figure 2 The method shown.

[0108] The electronic device described in each of the aforementioned embodiments may be a computer.

[0109] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or a combination of software and hardware.

[0110] The various embodiments of the present invention are described in a progressive manner. Similar portions between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so their description is relatively simple. For relevant portions, refer to the description of the method embodiments.

[0111] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0112] The foregoing is merely an embodiment of the present invention and is not intended to limit the present invention. It will be apparent to those skilled in the art that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention are intended to be included within the scope of the claims of the present invention.

Claims

1. A face detection method, characterized in that: include: Acquire an image to be detected, and determine a gravity map to be detected corresponding to the image to be detected; Determining an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected using a predetermined anti-counterfeiting detection model; When the anti-counterfeiting result meets the first preset condition, performing face detection based on the image to be detected; Predetermining the anti-counterfeiting detection model using contrastive learning data training; The method of using contrastive learning data training to predetermine the anti-counterfeiting detection model includes: determining a sample image and a sample gravity map; Determine the initial model; Using the sample image and the sample gravity map, performing the comparative learning data training on the initial model; Determining the trained initial model as the anti-counterfeiting detection model; The sample images include true sample images and false sample images; the sample gravity maps include true sample gravity maps and false sample gravity maps; The performing the comparative learning data training on the initial model using the sample image and the sample gravity map includes: Determining the true sample image and the true sample gravity map as a first positive sample pair; Determining the fake sample image and the true sample gravity map as a second positive sample pair; Determine the true sample image and the false sample gravity map as a first negative sample pair; Determining the fake sample image and the fake sample gravity map as a second negative sample pair; Performing the contrastive learning data training on the initial model using the first positive sample pair, the second positive sample pair, the first negative sample pair, and the second negative sample pair; The gravity map to be detected is determined based on gravity sensing data collected by a gravity sensor commonly carried by smart devices; the image to be detected is a face image that needs to be detected.

2. The method according to claim 1, characterized in that Determining the gravity map to be detected corresponding to the image to be detected includes: Determining a time range for acquiring the image to be detected; determining a value of gravity sensor data within the time range; The gravity map to be detected is determined according to the value of the gravity sensing data.

3. The method according to claim 1, characterized in that The performing the comparative learning data training on the initial model includes: Inputting the sample image and the sample gravity map into the initial model so that the initial model outputs a calculation result; Determining the loss index of the calculation result using a preset loss function; When the loss indicator meets the second preset condition, the internal parameters of the initial model are adjusted.

4. The method according to any one of claims 1 to 3, characterized in that When the anti-counterfeiting result satisfies the first preset condition, performing face detection according to the image to be detected includes: When the anti-counterfeiting result is true, it is considered that the first preset condition is met; Perform face detection based on the image to be detected to determine identity information corresponding to the image to be detected.

5. A face detection device, characterized in that: include: A data acquisition module is used to acquire an image to be detected and determine a gravity map to be detected corresponding to the image to be detected; an anti-counterfeiting module, configured to determine an anti-counterfeiting result corresponding to the image to be detected based on the image to be detected and the gravity map to be detected by using a predetermined anti-counterfeiting detection model; a detection module, configured to perform face detection based on the image to be detected when the anti-counterfeiting result meets a first preset condition; A training module for predetermining an anti-counterfeiting detection model using contrastive learning data for training; The training module includes: a sample determination unit for determining a sample image and a sample gravity map; An initial model determination unit is used to determine an initial model; a model training unit is used to perform comparative learning data training on the initial model using sample images and sample gravity maps; and the trained initial model is determined as an anti-counterfeiting detection model; The sample images include true sample images and false sample images; the sample gravity maps include true sample gravity maps and false sample gravity maps; the sample determination unit includes: a first positive sample pair determination subunit, used to determine the true sample image and the true sample gravity map as a first positive sample pair; a second positive sample pair determination subunit, used to determine the false sample image and the true sample gravity map as a second positive sample pair; a first negative sample pair determination subunit, used to determine the true sample image and the false sample gravity map as a first negative sample pair; a second negative sample pair determination subunit, used to determine the false sample image and the false sample gravity map as a second negative sample pair; the initial model is trained with the comparative learning data using the first positive sample pair, the second positive sample pair, the first negative sample pair, and the second negative sample pair; The gravity map to be detected is determined based on gravity sensing data collected by a gravity sensor commonly carried by smart devices; the image to be detected is a face image that needs to be detected.

6. A computer-readable storage medium storing a computer program, wherein the computer program is used to execute the face detection method according to any one of claims 1 to 4.

7. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the face detection method described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Face anti-counterfeiting detection method and system

    CN112733760A

  • Face feature point detection method and apparatus, computer device, and storage medium

    WO2020037898A1