Face recognition method and device, equipment and storage medium

By combining background maps and deep learning technology to identify and confirm the authenticity of face pictures, the problem of poor recognition accuracy in the existing technology when processing high-definition attack scenes is solved, and effective recognition and defense of high-definition image attacks is achieved.

CN120014679APending Publication Date: 2025-05-16SHANGHAI DIANZE INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411980910.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

The prior art has poor recognition accuracy when handling high-definition attack scenarios, making it difficult to capture complex details and dynamic information, resulting in poor results in the face of attacks such as high-definition videos and photos.

Method used

By obtaining the target picture of the target scene, and obtaining the background map of the same period based on the acquisition period of the target picture, face detection and recognition are performed. When a face is detected, the background map is used to identify the target image as a real person image or an attack image, and the recognition result is confirmed through deep learning.

Benefits of technology

It improves the accuracy of facial recognition, can effectively prevent high-definition video attacks, high-definition photo attacks, etc., and realizes recognition and defense of high-definition image attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120014679A_ABST
    Figure CN120014679A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and discloses a face recognition method, device and equipment and a storage medium, and the method comprises the steps: obtaining a target picture of a target scene, and obtaining a background base map corresponding to the same time period based on the obtaining time period of the target picture; performing face detection on the target picture, and when a face is detected, identifying that the target picture is a real person picture or an attack picture by using the background base picture corresponding to the same time period; and when the target picture is judged to be a real person picture based on the background base picture, determining whether the current real person picture is an attack picture or not through deep learning. According to the method, high-definition image attack recognition can be realized, and the attack recognition accuracy is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular, to a face recognition method, device, equipment and storage medium, and more particularly, to a background modeling monocular silent face liveness recognition method, device, equipment and medium. Background Art

[0002] Among the existing monocular silent face liveness recognition methods, the rPPG method has poor effect when processing attack scenarios such as high-definition videos and high-definition photos, because this method mainly relies on the skin's absorption and reflection of light to measure heart rate and pulse waves, and high-definition videos and photos will affect the accuracy of skin reflection, resulting in reduced recognition effect. The method based on pseudo-depth information can effectively identify attack scenarios such as mobile phone photos and printed photos, but it has poor effect when processing video recognition such as high-definition videos, mainly because the complexity and details of high-definition videos make recognition difficult. The method based on Fourier spectrum converts color space features into spectral features, and has poor recognition effect for high-definition attack scenes because the complexity and details of high-definition images make it difficult to extract spectral features. The method based on moiré features was used more frequently in the early days, but with the popularization of high-definition equipment, this method is basically no longer applicable, mainly because the resolution and accuracy of high-definition equipment have improved, making moiré features no longer obvious or effective.

[0003] Therefore, in the prior art, when processing high-definition attack scenarios, there are generally problems such as poor recognition accuracy and difficulty in capturing complex details and dynamic information, resulting in poor effects when facing attacks such as high-definition videos and photos. The technical solution of the present invention can solve this technical problem. Summary of the invention

[0004] The main purpose of the present invention is to solve the problems in the prior art of processing high-definition attack scenarios, such as poor recognition accuracy and difficulty in capturing complex details and dynamic information, resulting in poor effect when facing attacks such as high-definition videos and photos.

[0005] A first aspect of the present invention provides a face recognition method, comprising: acquiring a target image of a target scene, and based on the acquisition time period of the target image, obtaining a background base map corresponding to the same time period; performing face detection on the target image, and when a face is detected, using the background base map corresponding to the same time period to identify the target image as a real person image or an attack image; when the target image is determined to be a real person image based on the background base map, confirming whether the current real person image is an attack image through deep learning.

[0006] Optionally, in a first implementation method of the first aspect of the present invention, the background map corresponding to the same time period is obtained based on the acquisition time period of the target image, including: using the image of the target scene acquired by a single camera at any time in different time periods in an unmanned state as the background map corresponding to the corresponding time period; based on multiple background maps corresponding to different time periods, obtaining the background map corresponding to the time period for acquiring the target image.

[0007] Optionally, in a second implementation of the first aspect of the present invention, performing face detection on the target image includes: detecting a face in the target image using a face detection model and obtaining position information of the face; extracting a face rectangular area of ​​the target image according to the position information of the face; and defining the face rectangular area as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Represents the width and height of the rectangular area of ​​the face; the face detection model implements face detection and obtains the position information of the face through a deep learning network.

[0008] Optionally, in a third implementation of the first aspect of the present invention, the identifying the target image as a real person image or an attack image using the background map corresponding to the same time period includes: based on the background map corresponding to the same time period, according to the location information of the designated area , extract the specified area of ​​the background map; where, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when When it is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image.

[0009] Optionally, in a fourth implementation of the first aspect of the present invention, the identifying the target image as a real person image or an attack image using the background map corresponding to the same time period includes: extracting the specified area of ​​the background map in the same time period respectively The feature vector and the target image specifying the area Calculate the feature vector of the current background map specified area The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is determined to be a real person image, otherwise it is an attack image; wherein the specified area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0010] Optionally, in a fifth implementation of the first aspect of the present invention, the identifying the target image as a real person image or an attack image using the background map corresponding to the same time period includes: based on the background map corresponding to the same time period, according to the location information of the designated area , extract the specified area of ​​the background map; where, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when If the value is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image; when the current target image is determined to be a real person image, further confirm whether the current real person image is attacked, including: extracting the specified area of ​​the background map in the same time period respectively The feature vector and the target image specifying the area Calculate the feature vector of the current background map specified area The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is determined to be a real person image, otherwise it is an attack image; wherein the specified area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0011] Optionally, in a sixth implementation of the first aspect of the present invention, the extracting of the background map designated areas within the same time period The feature vector and the target image specifying the area The method comprises: extracting texture feature vectors and color feature vectors of a designated area of ​​a current background map and a designated area of ​​a target image respectively; splicing the texture feature vectors and color feature vectors of the designated area of ​​the current background map to form a comprehensive feature vector of the background map; splicing the texture feature vectors and color feature vectors of the designated area of ​​the current target image to form a comprehensive feature vector of the target image; wherein, respectively extracting texture feature vectors and color feature vectors of a designated area of ​​the current background map and a designated area of ​​the target image comprises: extracting texture features of the designated area based on different directions respectively; wherein, the texture features comprise: contrast, homogeneity, energy and correlation; combining and splicing the texture features extracted from each direction to form a final texture feature vector of the designated area; respectively extracting color features of a designated area of ​​the current background map and a designated area of ​​the current image to be identified comprises: converting the RGB space of the designated area into the HSV space; dividing the HSV space into image blocks; extracting the first-order and second-order color moments of each image block; and obtaining a color feature vector based on the first-order and second-order color moments extracted from each image block.

[0012] Optionally, in a seventh implementation of the first aspect of the present invention, when the target image is determined to be a real person image based on the background map, confirming whether the current real person image is an attack image through deep learning includes: , extract the specified area of ​​the current real person picture ;in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner coordinate point and the height of the rectangular area of ​​the face; use the deep learning network to infer the specified area and determine whether the current real person image is an attack image.

[0013] The second aspect of the present invention provides a face recognition device, including: a background map acquisition module, which is used to obtain the background map corresponding to the same time period based on the acquisition time period of the target image; a preliminary judgment module, which is used to perform face detection on the target image, and when a face is detected, use the background map in the same time period to identify the target image as a real person image or an attack image; a confirmation judgment module is used to confirm whether the current real person image is an attack image through deep learning when the target image is determined to be a real person image based on the background map.

[0014] Optionally, in a first implementation method of the second aspect of the present invention, the background map acquisition module includes: using the image of the target scene acquired by a single camera at any time in different time periods in an unmanned state as the background map corresponding to the corresponding time period; based on multiple background maps corresponding to different time periods, obtaining the background map corresponding to the target image acquisition time period.

[0015] Optionally, in a second implementation of the second aspect of the present invention, the face recognition device further includes: a face detection module, the face detection module being used to detect a face in a target image using a face detection model and obtain position information of the face; extracting a face rectangular area of ​​the target image according to the position information of the face; and defining the face rectangular area as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Represents the width and height of the rectangular area of ​​the face; the face detection model implements face detection and obtains the position information of the face through a deep learning network.

[0016] Optionally, in a third implementation of the second aspect of the present invention, the preliminary judgment module includes: the identification of the target image as a real person image or an attack image using the background base map corresponding to the same time period includes: based on the background base map corresponding to the same time period, according to the designated area location information , extract the specified area of ​​the background map; where, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when When it is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image.

[0017] Optionally, in a fourth implementation of the second aspect of the present invention, the preliminary judgment module includes: extracting the specified areas of the background map in the same time period respectively The feature vector and the target image specifying the area Calculate the feature vector of the current background map specified area The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is determined to be a real person image, otherwise it is an attack image; wherein the specified area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0018] Optionally, in a fifth implementation of the second aspect of the present invention, the preliminary judgment module includes: a first-order judgment unit for judging the location of the designated area based on the background map corresponding to the same time period. , extract the specified area of ​​the background map; where, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when When the value is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image; the second-order judgment unit is used to further confirm whether the current real person image is attacked when the current target image is determined to be a real person image; specifically, the specified area of ​​the background map in the same time period is extracted respectively The feature vector and the target image specifying the area Calculate the feature vector of the current background map specified area The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is determined to be a real person image, otherwise it is an attack image; wherein the specified area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0019] Optionally, in a sixth implementation of the second aspect of the present invention, the extracting of the background map designated areas within the same time period The feature vector and the target image specifying the area The method comprises: extracting texture feature vectors and color feature vectors of a designated area of ​​a current background map and a designated area of ​​a target image respectively; splicing the texture feature vectors and color feature vectors of the designated area of ​​the current background map to form a comprehensive feature vector of the background map; splicing the texture feature vectors and color feature vectors of the designated area of ​​the current target image to form a comprehensive feature vector of the target image; wherein, respectively extracting texture feature vectors and color feature vectors of a designated area of ​​the current background map and a designated area of ​​the target image comprises: extracting texture features of the designated area based on different directions respectively; wherein, the texture features comprise: contrast, homogeneity, energy and correlation; combining and splicing the texture features extracted from each direction to form a final texture feature vector of the designated area; respectively extracting color features of a designated area of ​​the current background map and a designated area of ​​the current image to be identified comprises: converting the RGB space of the designated area into the HSV space; dividing the HSV space into image blocks; extracting the first-order and second-order color moments of each image block; and obtaining a color feature vector based on the first-order and second-order color moments extracted from each image block.

[0020] Optionally, in a seventh implementation of the second aspect of the present invention, the confirmation and judgment module includes: , extract the specified area of ​​the current real person picture ;in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner coordinate point and the height of the rectangular area of ​​the face; use the deep learning network to infer the specified area and determine whether the current real person image is an attack image.

[0021] The third aspect of the present invention provides an electronic device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned face recognition method as described above.

[0022] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned face recognition method.

[0023] Compared with the prior art, the present invention has the following beneficial effects: 1. The time consumption of the background image inference method of the present invention is almost the same as that of the face recognition method using deep learning, but the accuracy can be greatly improved; 2. The face recognition method, device, equipment and storage medium provided by the present invention can effectively prevent high-definition video attacks, high-definition photo attacks, printing paper attacks, etc.; 3. The present invention combines background image reasoning with deep learning methods, taking into account both background features and facial features, and making up for the problem that existing methods almost only focus on the facial area features themselves, thereby achieving high-definition image attack recognition and greatly improving the accuracy of attack recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings: Figure 1 A first flow chart of a face recognition method provided in an embodiment of the present invention.

[0025] Figure 2 A second flow chart of the face recognition method provided by an embodiment of the present invention.

[0026] Figure 3 A third flow chart of the face recognition method provided by an embodiment of the present invention.

[0027] Figure 4 A schematic diagram of the structure of a face recognition device provided by an embodiment of the present invention.

[0028] Figure 5 Another structural schematic diagram of a face recognition device provided by an embodiment of the present invention.

[0029] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The embodiment of the present invention provides a face recognition method, device, equipment and storage medium, which detects the face of a target image through a face detection model. When a face is detected, the target image is identified as a real person image or an attack image through an image processing method using a background image corresponding to the same time period; when the current image is judged to be a real person image, a deep learning method is used to confirm whether the current real person image is an attack image. The present invention solves the problem that the recognition accuracy is poor and it is difficult to capture complex details and dynamic information when processing high-definition attack scenes, resulting in poor effect when facing attacks such as high-definition videos and photos.

[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , a first embodiment of the face recognition method in the embodiment of the present invention includes: 101. Obtain a target image of a target scene, and based on the acquisition period of the target image, obtain a background base map corresponding to the same period; In this embodiment, a single camera is used to obtain multiple background images at any time in different time periods; wherein the background image is an image of the target scene in an unmanned state; Based on multiple background maps corresponding to different time periods, the background map corresponding to the target image acquisition time period is obtained.

[0033] This embodiment can effectively prevent the recognition accuracy rate from failing to meet the standard due to a large difference between the target image and the background image caused by the influence of lighting by selecting the background image corresponding to the target image acquisition period.

[0034] 102. Perform face detection on the target image. When a face is detected, use the background image corresponding to the same time period to identify the target image as a real person image or an attack image; In this embodiment, a face detection model is used to detect a face in a target image, and position information of the face, such as coordinate information of a rectangular frame, is obtained; Extract the face rectangular area of ​​the target image according to the position information of the face; The face rectangle area is defined as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Indicates the width and height of the rectangular area of ​​the face; Based on the background map corresponding to the same period, according to the location information of the specified area , extract the specified area of ​​the background map; in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; when When it is less than or equal to the preset value, for example: , then the current target image is judged to be a real person image, otherwise it is an attack image.

[0035] This embodiment detects the face in the target image through the existing face detection model and obtains the position information of the face; then extracts the face rectangular area based on the obtained face position information; combines the currently obtained face rectangular area with the background base map, takes into account both the background features and the face features, performs a preliminary recognition of the target image, and determines whether the current target image is a real person image or an attack image.

[0036] 103. When the target image is determined to be a real person image based on the background image, deep learning is used to confirm whether the current real person image is an attack image; According to the specified area location information , extract the specified area of ​​the current real person picture ; in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; Use the deep learning network to infer the specified area and determine whether the current real-person picture is an attack picture.

[0037] This embodiment combines background image reasoning with deep learning methods to achieve high-definition image attack recognition and improve the accuracy of attack recognition.

[0038] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 2 , a second embodiment of the face recognition method in the embodiment of the present invention includes: 201. Obtain images of the target scene at any time in different time periods when no one is present through a single camera, and use them as the background map corresponding to the corresponding time period; In this embodiment, when face recognition is performed using the face recognition method provided by the present invention, in order to improve the accuracy of recognition, the background map used needs to be close to the time of acquisition of the target image to prevent a large difference between the background map and the target image due to the influence of lighting.

[0039] When the target image is determined, the corresponding background image is obtained according to the acquisition period of the target image.

[0040] 202. Perform face detection on the target image through a face detection model; In this embodiment, the face detection model includes MTCNN, RetinaFace or CenterFace; based on the above face detection model, the face in the target image is detected, and the position information of the face is obtained; According to the position information of the face, extract the face rectangular area of ​​the target image; The face rectangle area is defined as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Indicates the width and height of the rectangular area of ​​the face.

[0041] 203. Using the background image corresponding to the same time period, identify the target image as a real person image or an attack image; In this embodiment, the background map designated areas within the same time period are extracted respectively. The feature vector and the target image specifying the area The eigenvector of Calculate the specified area of ​​the current background map The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is judged to be a real person image, otherwise it is an attack image; The designated area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0042] Among them, the specified areas of the background map within the same time period are extracted respectively The feature vector and the target image specifying the area The feature vectors include: Extract the texture feature vector and color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image respectively; The texture feature vector and the color feature vector of the specified area of ​​the current background map are concatenated to form a comprehensive feature vector of the background map; The texture feature vector and color feature vector of the specified area of ​​the current target image are concatenated to form a comprehensive feature vector of the target image; The step of respectively extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image includes: Extracting texture features from the designated area based on different directions respectively; wherein the texture features include: contrast, homogeneity, energy and correlation; The texture features extracted in each direction are combined and spliced ​​to form the final texture feature vector of the specified area; The step of respectively extracting the color features of the current background map designated area and the current to-be-recognized picture designated area comprises: Convert the RGB space of the specified area to the HSV space; Divide the HSV space into The image block; Extract the first-order and second-order color moments of each image block; Based on the first-order and second-order color moments extracted from each image block, a color feature vector is obtained.

[0043] 204. When the target image is determined to be a real person image based on the background image, confirm whether the current real person image is an attack image through deep learning; Use deep learning models, including single-frame face recognition models such as DC-CDN / PatchNet, to infer the specified area and determine whether the current real-person picture is an attack picture; Wherein, the designated area includes: according to the designated area location information , extract the specified area of ​​the current real person picture ; in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

[0044] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 3 , a third embodiment of the face recognition method in the embodiment of the present invention includes: 301. Obtain images of the target scene at any time in different time periods when no one is present through a single camera, and use them as the background map corresponding to the corresponding time period; 302. When the target image is determined, a corresponding background image is obtained according to the acquisition period of the target image; 303. Perform face detection on the target image through a face detection model; 304. Extract the specified area of ​​the background map , ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when If it is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image; 305. When the current target image is determined to be a real person image, the specified area of ​​the current background image is calculated. The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, it is confirmed again whether the current target image is a real person image; In this embodiment, the background map designated areas within the same time period are extracted respectively. The feature vector and the target image specifying the area The eigenvector of The method includes extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image respectively; The texture feature vector and the color feature vector of the specified area of ​​the current background map are concatenated to form a comprehensive feature vector of the background map; The texture feature vector and color feature vector of the specified area of ​​the current target image are concatenated to form a comprehensive feature vector of the target image; The step of respectively extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image includes: Extracting texture features from the designated area based on different directions respectively; wherein the texture features include: contrast, homogeneity, energy and correlation; The texture features extracted in each direction are combined and spliced ​​to form the final texture feature vector of the specified area; The step of respectively extracting the color features of the current background map designated area and the current to-be-recognized picture designated area comprises: Convert the RGB space of the specified area to the HSV space; Divide the HSV space into The image block; Extract the first-order and second-order color moments of each image block; Based on the first-order and second-order color moments extracted from each image block, a color feature vector is obtained.

[0045] This embodiment performs a second determination based on the first determination. The use of this cascade determination method can greatly improve the accuracy of recognition.

[0046] 306. When it is determined that the target image is a real person image, deep learning is used again to confirm whether the current real person image is an attack image; In this embodiment, according to the designated area location information , extract the specified area of ​​the current real person picture ; in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; Use the deep learning network to infer the specified area and determine whether the current real-person picture is an attack picture.

[0047] In the embodiment, background image reasoning is combined with deep learning methods, taking into account both background features and facial features to achieve high-definition image attack recognition. At the same time, the attack recognition accuracy is greatly improved through the cascade recognition method.

[0048] The above describes the face recognition method in the embodiment of the present invention. The following describes the face recognition device in the embodiment of the present invention. Figure 4 , an embodiment of the face recognition device in the embodiment of the present invention includes: The background base map acquisition module 401 is used to obtain the background base map corresponding to the same period based on the acquisition period of the target image; In this embodiment, when the target image is acquired at 10 o'clock, the background map adopts the background map around 10 o'clock to prevent the influence of lighting. For example, the illumination angles in the morning and afternoon are quite different, which leads to a large difference between the background map and the target image.

[0049] The preliminary judgment module 402 is used to perform face detection on the target image. When a face is detected, the target image is identified as a real person image or an attack image using the background image in the same time period; In this embodiment, the face detection model is used to detect the face of the target image and locate the face area. ;in, Indicates the coordinate point of the upper left corner of the face rectangular area; Indicates the width and height of the rectangular area of ​​the face.

[0050] Based on the background map corresponding to the same period, extract the specified area of ​​the background map ;in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when When it is less than or equal to 5, the current target image is judged to be a real person image, otherwise it is an attack image.

[0051] The confirmation and judgment module 403 is used to confirm whether the current real-person picture is an attack picture through deep learning when the target picture is determined to be a real-person picture based on the background base map.

[0052] Extract the specified area of ​​the current real person picture ,in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner coordinate point and the height of the rectangular area of ​​the face; use the deep learning network to infer the specified area and determine whether the current real person picture is an attack picture.

[0053] See also Figure 5 Another embodiment of the face recognition device in the embodiment of the present invention includes: The background base map acquisition module 501 is used to obtain the background base map corresponding to the same period based on the acquisition period of the target image; The preliminary judgment module 502 is used to perform face detection on the target image. When a face is detected, the target image is identified as a real person image or an attack image using the background image in the same time period; The confirmation and judgment module 503 is used to confirm whether the current real-person picture is an attack picture through deep learning when the target picture is determined to be a real-person picture based on the background base map.

[0054] In this embodiment, the background map acquisition module 501 includes: The background base map unit 5011 for obtaining each time period is used to obtain images of the target scene at any time in different time periods when no one is present through a single camera, and use them as the background base map corresponding to the corresponding time period; The corresponding background base map obtaining unit 5012 is used to obtain the corresponding background base map according to the acquisition period of the target image.

[0055] In this embodiment, the preliminary determination module 502 includes: A face detection unit 5021 is used to perform face detection on a target image using a face detection model; The face detection model includes MTCNN, RetinaFace or CenterFace; based on the above face detection model, the face in the target image is detected and the position information of the face is obtained; According to the position information of the face, extract the face rectangular area of ​​the target image; The face rectangle area is defined as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Indicates the width and height of the rectangular area of ​​the face.

[0056] First-order judgment unit 5022, used to extract the specified area of ​​the background map , ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle area; when If it is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image; The second-order judgment unit 5023, when determining that the current target image is a real person image, calculates the current background image specified area The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, it is confirmed again whether the current target image is a real person image; In this embodiment, the background map designated areas within the same time period are extracted respectively. The feature vector and the target image specifying the area The eigenvector of The method includes extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image respectively; The texture feature vector and the color feature vector of the specified area of ​​the current background map are concatenated to form a comprehensive feature vector of the background map; The texture feature vector and color feature vector of the specified area of ​​the current target image are concatenated to form a comprehensive feature vector of the target image; The step of respectively extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image includes: Extracting texture features from the designated area based on different directions respectively; wherein the texture features include: contrast, homogeneity, energy and correlation; The texture features extracted in each direction are combined and spliced ​​to form the final texture feature vector of the specified area; The step of respectively extracting the color features of the current background map designated area and the current to-be-recognized picture designated area comprises: Convert the RGB space of the specified area to the HSV space; Divide the HSV space into The image block; Extract the first-order and second-order color moments of each image block; Based on the first-order and second-order color moments extracted from each image block, a color feature vector is obtained.

[0057] In this embodiment, the confirmation judgment module 503 includes: In this embodiment, according to the designated area location information , extract the specified area of ​​the current real person picture ; in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; Use the deep learning network to infer the specified area and determine whether the current real-person picture is an attack picture.

[0058] above Figure 4 and Figure 5 The live face recognition device in the embodiment of the present invention is described in detail from the perspective of modular functional entities, and the electronic device in the embodiment of the present invention is described in detail from the perspective of hardware processing.

[0059] Figure 6 6 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 610 (for example, one or more processors) and a memory 620, and one or more storage media 630 (for example, one or more mass storage devices) storing application programs 633 or data 632. Among them, the memory 620 and the storage medium 630 can be short-term storage or permanent storage. The program stored in the storage medium 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the electronic device 600. Furthermore, the processor 610 may be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the electronic device 600.

[0060] The electronic device 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input and output interfaces 650, and / or one or more operating systems 631, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc. It will be appreciated by those skilled in the art that Figure 6 The structure of the electronic device shown does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0061] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the liveness face recognition method.

[0062] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0063] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0064] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A face recognition method, characterized in that: include: Obtain a target image of the target scene, and based on the acquisition period of the target image, obtain a background base map corresponding to the same period; Perform face detection on the target image. When a face is detected, use the background image corresponding to the same time period to identify the target image as a real person image or an attack image. When the target image is determined to be a real-person image based on the background image, deep learning is used to confirm whether the current real-person image is an attack image.

2. The face recognition method according to claim 1, characterized in that: The step of obtaining a background image corresponding to a target image during a certain period of time includes: Acquire multiple background images at any time in different time periods through a single camera; wherein the background image is an image of the target scene in an unmanned state; Based on multiple background maps corresponding to different time periods, the background map corresponding to the target image acquisition time period is obtained.

3. The face recognition method according to claim 1, characterized in that: The performing face detection on the target image includes: Use the face detection model to detect the face in the target image and obtain the location information of the face; Extracting a face rectangular area of ​​the target image according to the face position information; wherein the face rectangular area is combined with the background base map corresponding to the same time period to identify the target image as a real person image or an attack image; The face rectangle area is defined as: ,in, Indicates the coordinate point of the upper left corner of the face rectangular area; Indicates the width and height of the rectangular area of ​​the face; The face detection model implements face detection and obtains face location information through a deep learning network.

4. The face recognition method according to claim 1, characterized in that: The method of using the background image corresponding to the same time period to identify the target image as a real person image or an attack image includes: Based on the background map corresponding to the same period, according to the location information of the specified area , extract the specified area of ​​the background map; where, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; when When it is less than or equal to the preset value, the current target image is determined to be a real person image, otherwise it is an attack image.

5. The face recognition method according to claim 1 or 4, characterized in that: The method of using the background image corresponding to the same time period to identify the target image as a real person image or an attack image includes: Extract the specified areas of the background map in the same time period respectively The feature vector and the target image specifying the area The eigenvector of Calculate the specified area of ​​the current background map The feature vector of the target image specifies the area The cosine distance between the feature vectors of ; when the cosine distance is less than the threshold, the current target image is judged to be a real person image, otherwise it is an attack image; The designated area middle, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangular area.

6. The face recognition method according to claim 5, characterized in that: The method of extracting the background map designated areas in the same time period respectively The feature vector and the target image specifying the area The feature vectors include: Extract the texture feature vector and color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image respectively; The texture feature vector and the color feature vector of the specified area of ​​the current background map are concatenated to form a comprehensive feature vector of the background map; The texture feature vector and the color feature vector of the specified area of ​​the current target image are concatenated to form a comprehensive feature vector of the target image; The step of respectively extracting the texture feature vector and the color feature vector of the specified area of ​​the current background image and the specified area of ​​the target image includes: Extracting texture features from the designated area based on different directions respectively; wherein the texture features include: at least one of contrast, homogeneity, energy, and correlation; The texture features extracted in each direction are combined and spliced ​​to form the final texture feature vector of the specified area; The step of respectively extracting the color features of the current background map designated area and the current to-be-recognized picture designated area comprises: Convert the RGB space of the specified area to the HSV space; Divide the HSV space into The image block; Extract the first-order and second-order color moments of each image block; Based on the first-order and second-order color moments extracted from each image block, a color feature vector is obtained.

7. The face recognition method according to claim 1, characterized in that: When the target image is determined to be a real person image based on the background image, confirming whether the current real person image is an attack image through deep learning includes: According to the specified area location information , extract the specified area of ​​the current real person picture ;in, ; Respectively represent the rectangular area of ​​the face in the target image The y-axis coordinate of the upper left corner and the height of the face rectangle; Use the deep learning network to infer the specified area and determine whether the current real-person picture is an attack picture.

8. A face recognition device, characterized in that: include: A background base map acquisition module, used to obtain the background base map corresponding to the same period based on the acquisition period of the target image; The preliminary judgment module is used to detect faces in the target image. When faces are detected, the target image is identified as a real person image or an attack image using the background image in the same time period. The confirmation and judgment module is used to confirm whether the current real-person picture is an attack picture through deep learning when the target picture is judged to be a real-person picture based on the background base map.

9. An electronic device, comprising a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the electronic device executes each step of the face recognition method as described in any one of claims 1-7.

10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the various steps of the face recognition method for express delivery as described in any one of claims 1-7 are implemented.