WO2020177226A1 - Improved resnet-based human face in-vivo detection method and related device - Google Patents

Improved resnet-based human face in-vivo detection method and related device Download PDF

Info

Publication number
WO2020177226A1
WO2020177226A1 PCT/CN2019/089163 CN2019089163W WO2020177226A1 WO 2020177226 A1 WO2020177226 A1 WO 2020177226A1 CN 2019089163 W CN2019089163 W CN 2019089163W WO 2020177226 A1 WO2020177226 A1 WO 2020177226A1
Authority
WO
WIPO (PCT)
Prior art keywords
single frame
frame image
image
detected
face image
Prior art date
Application number
PCT/CN2019/089163
Other languages
French (fr)
Chinese (zh)
Inventor
庞烨
王义文
王健宗
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020177226A1 publication Critical patent/WO2020177226A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/40Spoof detection, e.g. liveness detection
    • G06V40/45Detection of the body part being alive

Definitions

  • This application relates to the field of live body detection, and in particular to a method and related equipment for face live body detection based on an improved Resnet.
  • this application provides a face live detection method and related equipment based on an improved Resnet.
  • a method for face living detection based on improved Resnet includes: obtaining a single frame image to be detected containing a face image; and for each face in the single frame image to be detected Based on the improved Resnet, the probability value that the face image is directly derived from a living body is acquired; based on the matching result of the probability value and a preset threshold, it is determined whether the face image is directly derived from the living body.
  • an apparatus for face living detection based on an improved Resnet including: a first acquisition module configured to acquire a single frame image to be detected containing a face image; a second acquisition module configured For each face image in the single frame image to be detected, based on the improved Resnet, obtain the probability value that the face image is directly derived from a living body; the determination module is configured to be based on the probability value and a preset threshold According to the matching result, it is determined whether the face image is directly derived from a living body.
  • an electronic device for face living detection based on an improved Resnet including: a memory configured to store executable instructions; a processor configured to execute executable instructions stored in the memory To perform the method described above.
  • a computer non-volatile readable storage medium which stores computer program instructions that, when executed by a computer, cause the computer to execute the method described above.
  • the embodiments of the present disclosure use an improved Resnet to perform live detection of face images, which reduces hardware requirements and improves Accuracy of face live detection.
  • Fig. 1 shows a flow chart of the steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 2 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 3 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 4 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 5 shows a block diagram of a device for face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 6 shows a system architecture diagram of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • Fig. 7 shows a diagram of an electronic device for face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure.
  • FIG. 8 shows a diagram of a computer non-volatile readable storage medium for face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • a method for face living detection based on an improved Resnet includes: acquiring a single frame image to be detected containing a face image; and for each face image in the single frame image to be detected, based on the improvement Resnet of, obtaining the probability value that the face image is directly derived from a living body; based on the matching result of the probability value and a preset threshold, it is determined whether the face image is directly derived from the living body.
  • the embodiments of the present disclosure use an improved Resnet to perform live detection of face images, which reduces hardware requirements and improves Accuracy of face live detection.
  • Fig. 1 shows a flow chart of face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure: Step S100: Obtain a single frame image to be detected containing a face image; Step S110: Check the single frame to be detected For each face image in the image, based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained; step S120: based on the matching result of the probability value and a preset threshold, it is determined whether the face image is Directly derived from living organisms.
  • the deep residual network Resnet used for face live detection has been improved in structure in advance, and the improved Resnet can realize face live detection with more excellent performance.
  • face live detection obtain a single frame image to be detected containing a face image, apply an improved Resnet to each face image in the single frame image to be detected, and determine the probability value of each face directly derived from a living body. According to the probability value, it is judged whether the corresponding face image is directly derived from a living body.
  • step S100 a single frame image to be detected containing a human face image is obtained.
  • the single-frame image to be detected refers to the image obtained by decomposing the to-be-detected video into single frames.
  • step S100 includes: step S1001: obtaining a video to be detected; step S1002: decomposing the video to be detected into single frame images; step S1003: based on the dlib framework, from the single frame A single frame image to be detected containing a face image is obtained from the frame image.
  • the video to be detected refers to the video obtained by the server that needs to detect whether the face image appearing in the video is directly derived from a living body.
  • dlib is a toolkit containing machine learning algorithms that can determine the area of the face in the image, that is, recognize the face image in a single frame of image.
  • the server obtains the video to be detected from a video recording terminal, such as a camera, which needs to be detected whether the face image appears directly from a living body.
  • the video to be detected may be obtained by the video recording terminal directly shooting the action of a living body, or may be obtained by the video recording terminal shooting the video played by the electronic device. Therefore, it is necessary to perform live detection on the acquired video to determine whether the face image appearing in the video is directly derived from a living body.
  • the video to be detected is decomposed into single frame images. Based on the dlib framework, face detection is performed on a single frame image, and the single frame image containing the face image is determined as the single frame image to be detected. In this way, the single frame image to be detected containing the face image is extracted, so that the server can further perform live detection on the single frame image to be detected containing the face image.
  • step S1003 includes: step S10031: randomly extract one from the single frame image as the original single frame image; step S10032: confirm the original single frame image based on the dlib framework Step S10033: if it is confirmed that the original single-frame image contains a human face image, use the original single-frame image as the single-frame image to be detected; if it is confirmed that the original single-frame image contains no human For a face image, another one is randomly selected from the single frame image as the original single frame image until it is confirmed that the original single frame image contains a face image, and the original single frame image is used as the single frame image to be detected.
  • the server decomposes the to-be-detected video into a single frame image frame by frame. Randomly select an image from the single frame image, determine whether the image contains a human face image based on the dlib framework, if so, use the image as a single frame image to be detected for live detection; if not, then randomly Select an image until a single-frame image of a human face image is obtained, and use it as a single-frame image to be detected for living body detection.
  • the purpose of obtaining a single frame image to be detected containing a face image is achieved.
  • step S110 for each face image in the single frame image to be detected, the probability value that the face image is directly derived from a living body is obtained based on the improved Resnet.
  • Resnet refers to a deep residual network based on residual learning to solve the problem of gradient disappearance during machine learning training.
  • the server after the server obtains the single frame image to be detected containing the face image, it extracts each face image contained in the single frame image separately and inputs it into the improved Resnet to obtain each face output by Resnet
  • the image is directly derived from the probability value of a living body.
  • the method for obtaining each face image in the single frame image to be detected in step S110 includes: Step S1101: extract the face features in the single frame image to be detected based on the dlib framework Point; Step S1102: Use each group of images of the predetermined shape and size area where the facial feature points are located as the facial image.
  • a group of face feature points is obtained.
  • each group of facial feature points corresponds to a facial image.
  • An image of a predetermined-sized square area where each group of facial feature points is located is determined as the facial image corresponding to the facial feature points.
  • each face image in the single frame image to be detected is obtained.
  • each face image in the single frame image to be detected is determined.
  • the improved Resnet includes: adding a dropout layer after the Resnet pooling layer; and using a sigmoid function to output the probability value that the face image is directly derived from a living body.
  • the dropout layer makes the neural network ignore half of the feature detectors in each training batch, thereby reducing the occurrence of overfitting during the training process.
  • the sigmoid function is a special case of the logistic regression function.
  • the mathematical curve is in the shape of "S" and is used to deal with two classification problems.
  • adding a dropout layer after the Resnet pooling layer can effectively prevent the occurrence of overfitting.
  • Resnet for processing multi-classification problems is improved to deal with two-class classification problems, that is, the sigmoid function is used to output the probability value of the face image directly derived from a living body, instead of the softmax function used in the prior art Output probability value.
  • the probability value output by using the sigmoid function is more suitable for further binary classification judgments, which makes the sigmoid function perform better than the softmax function specially used to deal with multi-classification problems in dealing with two classification problems.
  • the Resnet improved in accordance with this method performs better in dealing with the two-category problem of living detection ("living" and "non-living").
  • the improved Resnet is trained in the following manner:
  • the face images labeled "living” and “non-living” in advance according to whether they are directly derived from a living body are taken as samples, and they are randomly divided into training set and verification set; based on the gradient descent algorithm, the training set is used to Improved Resnet for training: For each input sample of the training set, the improved Resnet will output the probability value of the sample directly derived from the living body, and paste the sample with the probability value greater than or equal to the preset standard value On the label of "living”, label the samples with the probability value less than the preset standard value as "non-living” to determine whether the improved Resnet judges whether the training set samples are directly derived from the living body, If the correct rate of judgment for the training set samples is less than the preset expected value, the improved Resnet is updated, and then the training set is used to train it until the training set samples are The correct judgment rate of is greater than or equal to the preset expected value; the verification set is used to verify the improved Resnet whose correct rate of labeling the training set samples is greater than or equal to
  • the preset standard value is 97%, and the preset expected value is 99%.
  • the preset standard value is used to measure how likely the training set samples are directly derived from living bodies; the preset expected value is to measure the accuracy of Resnet's judgment on the training set samples. That is, only when the probability value of Resnet output training set samples directly derived from a living body is greater than or equal to 97%, the training set samples will be labeled as "live body". Due to the existence of the Resnet error, according to this method, the final label will be mislabeled, that is, the judgment of the training set samples may not be accurate.
  • the purpose of using the training set for training is to achieve this method, so that the accuracy of the judgment of the training set samples can be greater than or equal to the preset expected value, which is 99%.
  • Resnet After using the training set samples to meet the training purpose, Resnet must be verified. This is because the training process is repeated training using the same set of samples, and there is sample deviation.
  • the judgment accuracy rate of the training set samples can be greater than or equal to the preset expected value, which does not mean that the judgment accuracy rate of the samples outside the training set can also be greater than or equal to the preset expected value. Therefore, the validation set samples are used for verification and adjustment, so that Resnet's judgment accuracy of the training set samples and the validation set samples is greater than or equal to the preset expected value, which is 99%. At this point, Resnet's training is complete. Through this method, the occurrence of over-fitting is further reduced, so that in practical applications, Resnet can correctly determine whether the input face image is directly derived from a living body.
  • obtaining the probability value that the face image is directly derived from a living body includes: according to the area where the face image is located From left to right, sequentially input each of the face images into the improved Resnet, and obtain the probability value that the face image output by the improved Resnet is directly derived from a living body. Through this method, the probability value that each face image in the single frame image to be detected is directly derived from a living body is determined.
  • determining whether the face image is directly derived from a living body includes: if the probability value is greater than or equal to the preset threshold, determining the person The face image is directly derived from a living body; if the probability value is less than a preset threshold, it is determined that the face image is directly derived from a non-living body.
  • the preset threshold value is 98.7%, that is, only the corresponding face image with a probability value of greater than or equal to 98.7% directly derived from a living body will be determined to be directly derived from a living body.
  • face image A After the face image A is input to the improved Resnet, the probability value of the direct source from the living body output by Resnet is 99.1%, which is greater than the preset threshold. Therefore, it is determined that the face image A is directly derived from the living body; the face image B is input to the improvement After the Resnet, the probability value of the direct source from the living body output by the Resnet is 95.3%, which is less than the preset threshold. Therefore, it is determined that the face image B is directly derived from the non-living body.
  • the probability value with a preset threshold value it is determined whether the face image is directly derived from a living body, thereby achieving the purpose of living body detection.
  • a face living detection device 20 based on an improved Resnet which specifically includes: a first acquisition module 201 configured to acquire a single frame image containing a face image to be detected
  • the second acquisition module 202 is configured to acquire the probability value of the face image directly derived from a living body based on the improved Resnet for each face image in the single frame image to be detected;
  • the determination module 203 is configured to be based on According to the matching result of the probability value and the preset threshold value, it is determined whether the face image is directly derived from a living body.
  • the first acquisition module 201 in the improved Resnet-based face living detection device 20 includes: a video acquisition module 2011 to be detected, configured to acquire a video to be detected; a decomposition module 2012, configured to The video to be detected is decomposed into single-frame images; the single-frame image acquisition module 2013 to be detected is configured to acquire a single-frame image to be detected containing a face image from the single-frame image based on the dlib framework.
  • the single-frame image acquisition module 2013 to be detected in the improved Resnet-based face living detection device 20 includes: a single-frame image extraction module 20131 configured to randomly extract one frame from the single-frame image
  • the face image detection module 20132 is configured to confirm whether the original single frame image contains a face image based on the dlib framework
  • the discrimination module 20133 is configured to determine whether the original single frame image contains a person Face image, using the original single frame image as the single frame image to be detected; if it is confirmed that the original single frame image does not contain a human face image, another one is randomly selected from the single frame image as the original single frame image Until it is confirmed that the original single frame image contains a human face image, the original single frame image is used as the single frame image to be detected.
  • the second acquisition module 202 in the improved Resnet-based face living detection device 20 includes: a face image acquisition module 2021, configured to acquire each face in the single frame image to be detected Image; the probability value acquisition module 2022, configured to acquire the probability value of the face image directly derived from a living body based on an improved Resnet.
  • the face image acquisition module 2021 in the improved Resnet-based face living detection device 20 includes: a face feature point extraction module 20111, configured to extract the single frame to be detected based on the dlib framework Face feature points in the image; the face feature point combination module 20112 is configured to use each group of images of a predetermined shape and size area where the face feature points are located as the face image.
  • modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory.
  • the features and functions of two or more modules or units described above may be embodied in one module or unit.
  • the features and functions of a module or unit described above can be further divided into multiple modules or units to be embodied.
  • the exemplary embodiments described herein can be implemented by software, or can be implemented by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) execute the method according to the embodiment of the present disclosure.
  • a computing device which may be a personal computer, a server, a mobile terminal, or a network device, etc.
  • Fig. 6 shows a system architecture diagram of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
  • the system architecture includes: a video recording terminal 310, a server 320, and a management terminal 330.
  • the management terminal 330 sends the parameters required for Resnet training: preset standard values and preset expected values to the server 320, so that the server 320 can complete the Resnet training.
  • the server 320 obtains the video to be detected uploaded from the video recording terminal 310, and obtains a single frame image after framing the video to be detected. After obtaining the single-frame image to be detected containing the face image therefrom, input each face image in the single-frame image to be detected into the improved Resnet, thereby determining whether each face image is directly derived from a living body.
  • the server 320 sends the recognition result to the management terminal 330, so that the management terminal 330 performs corresponding service processing based on the recognition result.
  • an electronic device capable of implementing the above method is also provided.
  • the electronic device 400 according to this embodiment of the present application will be described below with reference to FIG. 7.
  • the electronic device 400 shown in FIG. 7 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present application.
  • the electronic device 400 takes the form of a general-purpose computing device.
  • the components of the electronic device 400 may include, but are not limited to: the aforementioned at least one processing unit 410, the aforementioned at least one storage unit 420, and a bus 430 connecting different system components (including the storage unit 420 and the processing unit 410).
  • the storage unit stores program code, and the program code can be executed by the processing unit 410, so that the processing unit 410 executes the various exemplary methods described in the "Exemplary Method" section of this specification.
  • the processing unit 410 may perform step S100 as shown in FIG. 1: Obtain a single frame image to be detected containing a face image; Step S110: For each face image in the single frame image to be detected, based on improved Resnet of, obtains the probability value that the face image is directly derived from a living body; Step S120: Based on the matching result of the probability value and a preset threshold, determine whether the face image is directly derived from a living body.
  • the storage unit 420 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 4201 and/or a cache storage unit 4202, and may further include a read-only storage unit (ROM) 4203.
  • RAM random access storage unit
  • ROM read-only storage unit
  • the storage unit 420 may also include a program/utility tool 4204 having a set of (at least one) program module 4205.
  • program module 4205 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data, Each of these examples or some combination may include the implementation of a network environment.
  • the bus 430 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local area using any bus structure among multiple bus structures. bus.
  • the electronic device 400 can also communicate with one or more external devices 500 (such as keyboards, pointing devices, Bluetooth devices, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 400, and/or communicate with Any device (such as a router, modem, etc.) that enables the electronic device 400 to communicate with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 450.
  • the electronic device 400 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 460.
  • networks for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet
  • the network adapter 460 communicates with other modules of the electronic device 400 through the bus 430. It should be understood that although not shown in the figure, other hardware and/or software modules can be used in conjunction with the electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
  • the exemplary embodiments described herein can be implemented by software, or can be implemented by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiments of the present disclosure.
  • a computing device which may be a personal computer, a server, a terminal device, or a network device, etc.
  • a computer non-volatile readable storage medium on which is stored a program product capable of implementing the above-mentioned method in this specification.
  • various aspects of the present application can also be implemented in the form of a program product, which includes program code.
  • the program product runs on a terminal device, the program code is used to enable the The terminal device executes the steps according to various exemplary embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.
  • a program product 600 for implementing the above method according to an embodiment of the present application is described. It can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be installed in a terminal device, For example, running on a personal computer.
  • the program product of this application is not limited to this.
  • the non-volatile readable storage medium can be any tangible medium that contains or stores a program.
  • the program can be used by or combined with an instruction execution system, device, or device. use.
  • the program product can use any combination of one or more readable media.
  • the non-volatile readable storage medium may be a readable signal medium or a readable storage medium.
  • the non-volatile readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above.
  • non-volatile readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM ), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read-only memory
  • EPROM or flash memory erasable programmable read-only memory
  • CD-ROM compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • the computer-readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the readable signal medium may also be any readable medium other than a non-volatile readable storage medium, and the readable medium may send, propagate, or transmit a program for use by or in combination with the instruction execution system, apparatus, or device.
  • the program code contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
  • the program code for performing the operations of this application can be written in any combination of one or more programming languages.
  • the programming languages include object-oriented programming languages such as Java, C++, etc., as well as conventional procedural programming languages. Programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computing device, partly on the user's device, executed as an independent software package, partly on the user's computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on.
  • the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using Internet service providers) Business to connect via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service providers Internet service providers

Landscapes

  • Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • Image Analysis (AREA)

Abstract

The present application discloses an improved Resnet-based human face in-vivo detection method and related device, relating to the field of in-vivo detection, the method comprises: obtaining a single-frame image to be detected containing a human face image; for each human face image in the single-frame image to be detected, based on the improved Resnet, obtaining a probability value that the human face image directly comes from a living body; judging whether the human face image directly comes from a living body based on a matching result of the probability value with a preset threshold. The method improves the accuracy of human face in-vivo detection.

Description

基于改进的Resnet的人脸活体检测的方法及相关设备Method and related equipment for face live detection based on improved Resnet 技术领域Technical field
本申请基于并要求2019年03月04日递交、发明名称为“基于改进的Resnet的人脸活体检测的方法及相关设备”的中国专利申请CN201910160807.4的优先权,在此通过引用将其全部内容合并于此。This application is based on and claims the priority of the Chinese patent application CN201910160807.4 filed on March 4, 2019 with the title of "Improved Resnet-based method and related equipment for face living detection", which is hereby incorporated by reference in its entirety The content is merged here.
本申请涉及活体检测领域,特别是涉及基于改进的Resnet的人脸活体检测的方法及相关设备。This application relates to the field of live body detection, and in particular to a method and related equipment for face live body detection based on an improved Resnet.
背景技术Background technique
在互联网技术高速发展的今天,人脸识别的应用与生活的联系越来越紧密,例如:门禁系统、刷脸支付等。在这些场景中,除了要求能够识别出人脸外,还要对人脸的真实性进行判断,以防恶意人员使用他人的照片、视频进行不法活动。针对人脸的真实性判断,即活体检测。本申请的发明人意识到,在现有的活体检测技术中,多依赖于温度传感硬件,例如:红外传感器。通过温度传感硬件来确定当前获取的视频是否直接来源于活体。这种方法的缺点在于不适用于便携终端、以及对于硬件的部署增加了活体检测系统的成本。而且在部分特殊环境下,这种活体检测系统的活体检测准确率也不尽如人意。Today, with the rapid development of Internet technology, the application of face recognition is more and more closely related to life, such as: access control systems, facial payment, etc. In these scenarios, in addition to being able to recognize the human face, it is also necessary to judge the authenticity of the human face to prevent malicious persons from using other people's photos and videos for illegal activities. To judge the authenticity of human faces, namely live body detection. The inventor of the present application realizes that in the existing living body detection technology, most rely on temperature sensing hardware, such as an infrared sensor. The temperature sensing hardware is used to determine whether the currently acquired video is directly from a living body. The disadvantage of this method is that it is not suitable for portable terminals, and the deployment of hardware increases the cost of the living body detection system. Moreover, in some special environments, the accuracy of the living body detection system of this kind of living body detection system is not satisfactory.
发明概述Summary of the invention
技术问题technical problem
基于此,为解决相关技术中如何从技术层面上提高人脸活体检测准确率所面临的技术问题,本申请提供了一种基于改进的Resnet的人脸活体检测的方法及相关设备。Based on this, in order to solve the technical problem of how to improve the accuracy of face live detection in related technologies, this application provides a face live detection method and related equipment based on an improved Resnet.
问题的解决方案The solution to the problem
技术解决方案Technical solutions
根据本公开的一个方面,提供了一种基于改进的Resnet的人脸活体检测的方法,包括:获取含有人脸图像的待检测单帧图像;对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值; 基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。According to one aspect of the present disclosure, a method for face living detection based on improved Resnet is provided, which includes: obtaining a single frame image to be detected containing a face image; and for each face in the single frame image to be detected Based on the improved Resnet, the probability value that the face image is directly derived from a living body is acquired; based on the matching result of the probability value and a preset threshold, it is determined whether the face image is directly derived from the living body.
根据本公开的一个方面,提供了一种基于改进的Resnet的人脸活体检测的装置,包括:第一获取模块,配置为获取含有人脸图像的待检测单帧图像;第二获取模块,配置为对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;判定模块,配置为基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。According to one aspect of the present disclosure, there is provided an apparatus for face living detection based on an improved Resnet, including: a first acquisition module configured to acquire a single frame image to be detected containing a face image; a second acquisition module configured For each face image in the single frame image to be detected, based on the improved Resnet, obtain the probability value that the face image is directly derived from a living body; the determination module is configured to be based on the probability value and a preset threshold According to the matching result, it is determined whether the face image is directly derived from a living body.
根据本公开的一个方面,提供了一种基于改进的Resnet的人脸活体检测的电子设备,包括:存储器,配置为存储可执行指令;处理器,配置为执行所述存储器中存储的可执行指令,以执行以上所述的方法。According to one aspect of the present disclosure, there is provided an electronic device for face living detection based on an improved Resnet, including: a memory configured to store executable instructions; a processor configured to execute executable instructions stored in the memory To perform the method described above.
根据本公开的一个方面,提供了一种计算机非易失性可读存储介质,其存储有计算机程序指令,所述计算机指令在被计算机执行时,使计算机执行以上所述的方法。According to one aspect of the present disclosure, there is provided a computer non-volatile readable storage medium, which stores computer program instructions that, when executed by a computer, cause the computer to execute the method described above.
与传统技术中对人脸图像进行活体检测是依赖于外置温度传感设备相比,本公开的实施例通过使用改进的Resnet对人脸图像进行活体检测,降低硬件要求的同时,提高了人脸活体检测的精准度。Compared with the traditional technology that relies on external temperature sensing equipment for live detection of face images, the embodiments of the present disclosure use an improved Resnet to perform live detection of face images, which reduces hardware requirements and improves Accuracy of face live detection.
本公开的其他特性和优点将通过下面的详细描述变得显然,或部分地通过本公开的实践而习得。Other characteristics and advantages of the present disclosure will become apparent through the following detailed description, or partly learned through the practice of the present disclosure.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性的,并不能限制本公开。It should be understood that the above general description and the following detailed description are only exemplary and cannot limit the present disclosure.
发明的有益效果The beneficial effects of the invention
对附图的简要说明Brief description of the drawings
附图说明Description of the drawings
图1示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的步骤流程图。Fig. 1 shows a flow chart of the steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
图2示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的部分步骤流程图。Fig. 2 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
图3示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的部分 步骤流程图。Fig. 3 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
图4示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的部分步骤流程图。Fig. 4 shows a flow chart of partial steps of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
图5示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的装置的组成框图。Fig. 5 shows a block diagram of a device for face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure.
图6示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的系统架构图。Fig. 6 shows a system architecture diagram of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
图7示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的电子设备图。Fig. 7 shows a diagram of an electronic device for face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure.
图8示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的计算机非易失性可读存储介质图。FIG. 8 shows a diagram of a computer non-volatile readable storage medium for face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure.
发明实施例Invention embodiment
本发明的实施方式Embodiments of the invention
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本公开的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而省略所述特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本公开的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments can be implemented in various forms, and should not be construed as being limited to the examples set forth herein; on the contrary, the provision of these embodiments makes the present disclosure more comprehensive and complete, and fully conveys the concept of the example embodiments To those skilled in the art. The described features, structures or characteristics may be combined in one or more embodiments in any suitable way. In the following description, many specific details are provided to give a sufficient understanding of the embodiments of the present disclosure. However, those skilled in the art will realize that the technical solutions of the present disclosure can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. can be used. In other cases, the well-known technical solutions are not shown or described in detail to avoid overwhelming the crowd and obscure all aspects of the present disclosure.
此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。In addition, the drawings are only schematic illustrations of the present disclosure, and are not necessarily drawn to scale. The same reference numerals in the figures denote the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in the form of software, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and/or processor devices and/or microcontroller devices.
本公开的目的在于从技术方面提高人脸活体检测的精准度。根据本公开一个实施例的基于改进的Resnet的人脸活体检测的方法,包括:获取含有人脸图像的待检测单帧图像;对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。与传统技术中对人脸图像进行活体检测是依赖于外置温度传感设备相比,本公开的实施例通过使用改进的Resnet对人脸图像进行活体检测,降低硬件要求的同时,提高了人脸活体检测的精准度。The purpose of the present disclosure is to improve the accuracy of face living detection from the technical aspect. According to an embodiment of the present disclosure, a method for face living detection based on an improved Resnet includes: acquiring a single frame image to be detected containing a face image; and for each face image in the single frame image to be detected, based on the improvement Resnet of, obtaining the probability value that the face image is directly derived from a living body; based on the matching result of the probability value and a preset threshold, it is determined whether the face image is directly derived from the living body. Compared with the traditional technology that relies on external temperature sensing equipment for live detection of face images, the embodiments of the present disclosure use an improved Resnet to perform live detection of face images, which reduces hardware requirements and improves Accuracy of face live detection.
图1示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的流程图:步骤S100:获取含有人脸图像的待检测单帧图像;步骤S110:对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;步骤S120:基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。Fig. 1 shows a flow chart of face living detection based on an improved Resnet according to an exemplary embodiment of the present disclosure: Step S100: Obtain a single frame image to be detected containing a face image; Step S110: Check the single frame to be detected For each face image in the image, based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained; step S120: based on the matching result of the probability value and a preset threshold, it is determined whether the face image is Directly derived from living organisms.
本公开实施例中用于进行人脸活体检测的深度残差网络Resnet事先进行了结构的改进,改进后的Resnet能够以更优异的性能实现人脸的活体检测。进行人脸活体检测时,获取含有人脸图像的待检测单帧图像,对该待检测单帧图像中的每一人脸图像,应用改进的Resnet,确定每一人脸直接来源于活体的概率值,根据概率值判断对应的人脸图像是否直接来源于活体。In the embodiments of the present disclosure, the deep residual network Resnet used for face live detection has been improved in structure in advance, and the improved Resnet can realize face live detection with more excellent performance. When performing face live detection, obtain a single frame image to be detected containing a face image, apply an improved Resnet to each face image in the single frame image to be detected, and determine the probability value of each face directly derived from a living body. According to the probability value, it is judged whether the corresponding face image is directly derived from a living body.
下面,将结合附图对本公开实施例中各步骤进行详细的解释以及说明。Hereinafter, each step in the embodiment of the present disclosure will be explained and described in detail with reference to the accompanying drawings.
在步骤S100中,获取含有人脸图像的待检测单帧图像。In step S100, a single frame image to be detected containing a human face image is obtained.
待检测单帧图像是指将待检测视频分解为单帧后得到的图像。The single-frame image to be detected refers to the image obtained by decomposing the to-be-detected video into single frames.
在一实施例中,如图2所示,步骤S100包括:步骤S1001:获取待检测视频;步骤S1002:将所述待检测视频分解为单帧图像;步骤S1003:基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。In one embodiment, as shown in FIG. 2, step S100 includes: step S1001: obtaining a video to be detected; step S1002: decomposing the video to be detected into single frame images; step S1003: based on the dlib framework, from the single frame A single frame image to be detected containing a face image is obtained from the frame image.
待检测视频是指服务器获取的、需要检测视频中出现的人脸图像是否直接来源于活体的视频。The video to be detected refers to the video obtained by the server that needs to detect whether the face image appearing in the video is directly derived from a living body.
dlib是一个包含机器学习算法的工具包,能够确定图像中人脸所在区域,即,识别出单帧图像中的人脸图像。dlib is a toolkit containing machine learning algorithms that can determine the area of the face in the image, that is, recognize the face image in a single frame of image.
在一实施例中,服务器从视频录入终端,例如摄像头,获取需要检测其中出现的人脸图像是否直接来源于活体的待检测视频。所述待检测视频可能是由视频录入终端直接拍摄活体的动作得到的,也有可能是由视频录入终端拍摄电子设备播放的视频得到的。因此,需要对获取的视频进行活体检测,以判断视频中出现的人脸图像是否直接来源于活体。获取所述待检测视频后,将所述待检测视频分解为单帧图像。基于dlib框架,对单帧图像进行人脸检测,将含有人脸图像的单帧图像确定为待检测单帧图像。通过这种方法,提取出含有人脸图像的待检测单帧图像,使得服务器可以对所述含有人脸图像的待检测单帧图像进一步地进行活体检测。In one embodiment, the server obtains the video to be detected from a video recording terminal, such as a camera, which needs to be detected whether the face image appears directly from a living body. The video to be detected may be obtained by the video recording terminal directly shooting the action of a living body, or may be obtained by the video recording terminal shooting the video played by the electronic device. Therefore, it is necessary to perform live detection on the acquired video to determine whether the face image appearing in the video is directly derived from a living body. After the video to be detected is obtained, the video to be detected is decomposed into single frame images. Based on the dlib framework, face detection is performed on a single frame image, and the single frame image containing the face image is determined as the single frame image to be detected. In this way, the single frame image to be detected containing the face image is extracted, so that the server can further perform live detection on the single frame image to be detected containing the face image.
在一实施例中,如图3所示,步骤S1003包括:步骤S10031:从所述单帧图像中随机抽取一张作为原始单帧图像;步骤S10032:基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;步骤S10033:如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。In one embodiment, as shown in FIG. 3, step S1003 includes: step S10031: randomly extract one from the single frame image as the original single frame image; step S10032: confirm the original single frame image based on the dlib framework Step S10033: if it is confirmed that the original single-frame image contains a human face image, use the original single-frame image as the single-frame image to be detected; if it is confirmed that the original single-frame image contains no human For a face image, another one is randomly selected from the single frame image as the original single frame image until it is confirmed that the original single frame image contains a face image, and the original single frame image is used as the single frame image to be detected.
在一实施例中,服务器将待检测视频分解成了一帧一帧的单帧图像。从所述单帧图像中随机选取一张图像,基于dlib框架确定该图像中是否包含有人脸图像,如果有,就将该图像作为待检测单帧图像以进行活体检测;如果没有,就再随机选取一张图像,直到获得一张有人脸图像的单帧图像,将其作为待检测单帧图像以进行活体检测。通过这种方法,达到了获取含有人脸图像的待检测单帧图像的目的。In an embodiment, the server decomposes the to-be-detected video into a single frame image frame by frame. Randomly select an image from the single frame image, determine whether the image contains a human face image based on the dlib framework, if so, use the image as a single frame image to be detected for live detection; if not, then randomly Select an image until a single-frame image of a human face image is obtained, and use it as a single-frame image to be detected for living body detection. Through this method, the purpose of obtaining a single frame image to be detected containing a face image is achieved.
在步骤S110中,对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。In step S110, for each face image in the single frame image to be detected, the probability value that the face image is directly derived from a living body is obtained based on the improved Resnet.
Resnet是指基于残差学习以解决机器学习训练过程中梯度消失问题的深度残差网络。Resnet refers to a deep residual network based on residual learning to solve the problem of gradient disappearance during machine learning training.
在一实施例中,服务器获取含有人脸图像的待检测单帧图像后,将该单帧图像中包含的每一人脸图像单独提取出、并输入改进的Resnet,获取由Resnet输出的 每一人脸图像直接来源于活体的概率值。通过这种方法,使得当待检测单帧图像中存在多个人脸图像时,服务器可以根据各人脸图像直接来源于活体的概率值,对各人脸图像是否直接来源于活体进行判断。In one embodiment, after the server obtains the single frame image to be detected containing the face image, it extracts each face image contained in the single frame image separately and inputs it into the improved Resnet to obtain each face output by Resnet The image is directly derived from the probability value of a living body. By this method, when there are multiple face images in a single frame of image to be detected, the server can judge whether each face image is directly derived from a living body according to the probability value that each face image is directly derived from a living body.
在一实施例中,如图5所示,步骤S110中待检测单帧图像中每一人脸图像的获得方法包括:步骤S1101:基于dlib框架,提取所述待检测单帧图像中的人脸特征点;步骤S1102:将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。In one embodiment, as shown in FIG. 5, the method for obtaining each face image in the single frame image to be detected in step S110 includes: Step S1101: extract the face features in the single frame image to be detected based on the dlib framework Point; Step S1102: Use each group of images of the predetermined shape and size area where the facial feature points are located as the facial image.
在一实施例中,对含有人脸图像的待检测单帧图像进行人脸特征点提取后,得到一组组的人脸特征点。其中,每一组人脸特征点对应着一张人脸图像。将每一组人脸特征点所在预定大小的正方形区域的图像确定为所述人脸特征点对应的人脸图像。由此,获得了待检测单帧图像中的每一人脸图像。通过这种方法,确定了所述待检测单帧图像中的每一人脸图像。In one embodiment, after extracting face feature points on a single frame image to be detected containing a face image, a group of face feature points is obtained. Among them, each group of facial feature points corresponds to a facial image. An image of a predetermined-sized square area where each group of facial feature points is located is determined as the facial image corresponding to the facial feature points. Thus, each face image in the single frame image to be detected is obtained. Through this method, each face image in the single frame image to be detected is determined.
在一实施例中,改进的Resnet,包括:于Resnet池化层后添加了dropout层;使用sigmoid函数输出所述人脸图像直接来源于活体的概率值。In one embodiment, the improved Resnet includes: adding a dropout layer after the Resnet pooling layer; and using a sigmoid function to output the probability value that the face image is directly derived from a living body.
dropout层使得神经网络在每个训练批次中,忽略一半的特征检测器,从而减少训练过程中过拟合现象的出现。The dropout layer makes the neural network ignore half of the feature detectors in each training batch, thereby reducing the occurrence of overfitting during the training process.
sigmoid函数是逻辑回归函数的一个特例,数学曲线呈“S”型,用于处理二分类问题。The sigmoid function is a special case of the logistic regression function. The mathematical curve is in the shape of "S" and is used to deal with two classification problems.
在一实施例中,在Resnet池化层后添加dropout层,能够有效防止过拟合的出现。In one embodiment, adding a dropout layer after the Resnet pooling layer can effectively prevent the occurrence of overfitting.
在一实施例中,将用于处理多分类问题的Resnet改进为处理二分类问题,即,使用sigmoid函数输出所述人脸图像直接来源于活体的概率值,而非现有技术中使用softmax函数输出概率值。这是因为,使用sigmoid函数输出的概率值更加适合进一步的二分类判断,这使得sigmoid函数在处理二分类问题方面,比专门用于处理多分类问题的softmax函数性能更加优秀。通过这种方法,使得按照该方法改进的Resnet,在处理活体检测(“活体”、“非活体”)这一二分类的问题上表现更加优异。In one embodiment, Resnet for processing multi-classification problems is improved to deal with two-class classification problems, that is, the sigmoid function is used to output the probability value of the face image directly derived from a living body, instead of the softmax function used in the prior art Output probability value. This is because the probability value output by using the sigmoid function is more suitable for further binary classification judgments, which makes the sigmoid function perform better than the softmax function specially used to deal with multi-classification problems in dealing with two classification problems. Through this method, the Resnet improved in accordance with this method performs better in dealing with the two-category problem of living detection ("living" and "non-living").
在一实施例中,所述改进的Resnet通过以下方式训练:In an embodiment, the improved Resnet is trained in the following manner:
将预先依照是否直接来源于活体而打上“活体”、“非活体”标签的人脸图像作为样本,随机分为训练集与验证集两部分;基于梯度下降算法,使用所述训练集对所述改进的Resnet进行训练:对每个输入的所述训练集的样本,所述改进的Resnet会输出该样本直接来源于活体的概率值,将所述概率值大于或等于预设标准值的样本贴上“活体”的标签,将所述概率值小于预设标准值的样本贴上“非活体”的标签,确定所述改进的Resnet对所述训练集样本是否直接来源于活体的判断正确率,如果所述对所述训练集样本的判断正确率小于预设期待值,则对该所述改进的Resnet进行更新,再使用所述训练集对其进行训练,直到所述对所述训练集样本的判断正确率大于或等于预设期待值;使用验证集对所述对训练集样本贴标签的正确率大于或等于预设的期待值的所述改进的Resnet进行验证:确定所述改进的Resnet对所述验证集样本是否直接来源于活体的判断正确率,如果所述对所述验证集样本的判断正确率大于或等于预设期待值,则所述Resnet训练完毕;如果小于预设期待值,则对所述改进的Resnet重新进行训练,直到所述对所述验证集样本的判断正确率大于或等于预设期待值。The face images labeled "living" and "non-living" in advance according to whether they are directly derived from a living body are taken as samples, and they are randomly divided into training set and verification set; based on the gradient descent algorithm, the training set is used to Improved Resnet for training: For each input sample of the training set, the improved Resnet will output the probability value of the sample directly derived from the living body, and paste the sample with the probability value greater than or equal to the preset standard value On the label of "living", label the samples with the probability value less than the preset standard value as "non-living" to determine whether the improved Resnet judges whether the training set samples are directly derived from the living body, If the correct rate of judgment for the training set samples is less than the preset expected value, the improved Resnet is updated, and then the training set is used to train it until the training set samples are The correct judgment rate of is greater than or equal to the preset expected value; the verification set is used to verify the improved Resnet whose correct rate of labeling the training set samples is greater than or equal to the preset expected value: the improved Resnet pair is determined Whether the verification set samples are directly derived from the judgment accuracy rate of the living body, if the judgment accuracy rate of the verification set samples is greater than or equal to the preset expected value, the Resnet training is completed; if it is less than the preset expected value, Then, the improved Resnet is re-trained until the correct rate of judging the verification set samples is greater than or equal to the preset expected value.
在一实施例中,使用训练集样本进行训练时,预设标准值为97%,预设期待值为99%。其中,预设标准值是用来衡量训练集样本有多大可能直接来源于活体;预设期待值则是衡量Resnet对训练集样本判断的准确率。即,只有当Resnet输出训练集样本直接来源于活体的概率值大于或等97%时,所述训练集样本才会被贴上“活体”的标签。由于Resnet误差的存在,按照这种方法,会出现最终标签贴错的情况,即,对训练集样本的判断不一定准确。而使用训练集进行训练的目的,就是要达到按照这种方法,使得对训练集样本的判断准确率能大于或等于预设期待值,即99%。In one embodiment, when the training set samples are used for training, the preset standard value is 97%, and the preset expected value is 99%. Among them, the preset standard value is used to measure how likely the training set samples are directly derived from living bodies; the preset expected value is to measure the accuracy of Resnet's judgment on the training set samples. That is, only when the probability value of Resnet output training set samples directly derived from a living body is greater than or equal to 97%, the training set samples will be labeled as "live body". Due to the existence of the Resnet error, according to this method, the final label will be mislabeled, that is, the judgment of the training set samples may not be accurate. The purpose of using the training set for training is to achieve this method, so that the accuracy of the judgment of the training set samples can be greater than or equal to the preset expected value, which is 99%.
使用训练集样本满足训练目的后,还要对Resnet进行验证。这是由于训练的过程是使用同一集合的样本反复训练的,存在样本的偏差。对训练集样本的判断准确率能够大于或等于预设期待值,不代表能够对训练集以外的样本的判断准确率也能够大于或等于预设期待值。因此,使用验证集样本进行验证以及调整,使得Resnet对训练集样本以及验证集样本的判断准确率均大于或等于预设期待值,即99%。至此,Resnet的训练完毕。通过这种方法,进一步减少了过拟合的 出现,使得实际应用中,Resnet能够正确判断输入的人脸图像是否直接来源于活体。After using the training set samples to meet the training purpose, Resnet must be verified. This is because the training process is repeated training using the same set of samples, and there is sample deviation. The judgment accuracy rate of the training set samples can be greater than or equal to the preset expected value, which does not mean that the judgment accuracy rate of the samples outside the training set can also be greater than or equal to the preset expected value. Therefore, the validation set samples are used for verification and adjustment, so that Resnet's judgment accuracy of the training set samples and the validation set samples is greater than or equal to the preset expected value, which is 99%. At this point, Resnet's training is complete. Through this method, the occurrence of over-fitting is further reduced, so that in practical applications, Resnet can correctly determine whether the input face image is directly derived from a living body.
在一实施例中,对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值,包括:按照所述人脸图像所在区域从左到右的顺序,依次将每一所述人脸图像输入所述改进的Resnet,获取由所述改进的Resnet输出的所述人脸图像直接来源于活体的概率值。通过这种方法,确定出了待检测单帧图像中每一人脸图像直接来源于活体的概率值。In an embodiment, for each face image in the single frame image to be detected, based on an improved Resnet, obtaining the probability value that the face image is directly derived from a living body includes: according to the area where the face image is located From left to right, sequentially input each of the face images into the improved Resnet, and obtain the probability value that the face image output by the improved Resnet is directly derived from a living body. Through this method, the probability value that each face image in the single frame image to be detected is directly derived from a living body is determined.
在一实施例中,基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体,包括:如果所述概率值大于或等于预设阈值,则判定所述人脸图像直接来源于活体;如果所述概率值小于预设阈值,则判定所述人脸图像直接来源于非活体。In an embodiment, based on the matching result of the probability value and a preset threshold, determining whether the face image is directly derived from a living body includes: if the probability value is greater than or equal to the preset threshold, determining the person The face image is directly derived from a living body; if the probability value is less than a preset threshold, it is determined that the face image is directly derived from a non-living body.
在一实施例中,预设阈值为98.7%,即只有对应的直接来源于活体的概率值大于或等于98.7%的人脸图像才会被判定直接来源于活体。待检测单帧图像中有两张人脸图像:人脸图像A,人脸图像B。将人脸图像A输入改进的Resnet后,得到由Resnet输出的直接来源于活体的概率值为99.1%,大于预设阈值,因此确定人脸图像A直接来源于活体;将人脸图像B输入改进的Resnet后,得到由Resnet输出的直接来源于活体的概率值为95.3%,小于预设阈值,因此确定人脸图像B直接来源于非活体。通过将所述概率值与预设阈值进行对比,确定了所述人脸图像是否直接来源于活体,从而达到了活体检测的目的。In one embodiment, the preset threshold value is 98.7%, that is, only the corresponding face image with a probability value of greater than or equal to 98.7% directly derived from a living body will be determined to be directly derived from a living body. There are two face images in the single frame image to be detected: face image A and face image B. After the face image A is input to the improved Resnet, the probability value of the direct source from the living body output by Resnet is 99.1%, which is greater than the preset threshold. Therefore, it is determined that the face image A is directly derived from the living body; the face image B is input to the improvement After the Resnet, the probability value of the direct source from the living body output by the Resnet is 95.3%, which is less than the preset threshold. Therefore, it is determined that the face image B is directly derived from the non-living body. By comparing the probability value with a preset threshold value, it is determined whether the face image is directly derived from a living body, thereby achieving the purpose of living body detection.
在一实施例中,如图5所示,提供了一种基于改进的Resnet的人脸活体检测装置20,具体包括:第一获取模块201,配置为获取含有人脸图像的待检测单帧图像;第二获取模块202,配置为对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;判定模块203,配置为基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。In one embodiment, as shown in FIG. 5, a face living detection device 20 based on an improved Resnet is provided, which specifically includes: a first acquisition module 201 configured to acquire a single frame image containing a face image to be detected The second acquisition module 202 is configured to acquire the probability value of the face image directly derived from a living body based on the improved Resnet for each face image in the single frame image to be detected; the determination module 203 is configured to be based on According to the matching result of the probability value and the preset threshold value, it is determined whether the face image is directly derived from a living body.
根据图5所示,所述基于改进的Resnet的人脸活体检测装置20中的第一获取模块201包括:待检测视频获取模块2011,配置为获取待检测视频;分解模块2012,配置为将所述待检测视频分解为单帧图像;待检测单帧图像获取模块2013,配 置为基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。As shown in FIG. 5, the first acquisition module 201 in the improved Resnet-based face living detection device 20 includes: a video acquisition module 2011 to be detected, configured to acquire a video to be detected; a decomposition module 2012, configured to The video to be detected is decomposed into single-frame images; the single-frame image acquisition module 2013 to be detected is configured to acquire a single-frame image to be detected containing a face image from the single-frame image based on the dlib framework.
根据图5所示,所述基于改进的Resnet的人脸活体检测装置20中的待检测单帧图像获取模块2013包括:单帧图像抽取模块20131,配置为从所述单帧图像中随机抽取一张作为原始单帧图像;人脸图像检测模块20132,配置为基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;判别模块20133,配置为如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。As shown in FIG. 5, the single-frame image acquisition module 2013 to be detected in the improved Resnet-based face living detection device 20 includes: a single-frame image extraction module 20131 configured to randomly extract one frame from the single-frame image The face image detection module 20132 is configured to confirm whether the original single frame image contains a face image based on the dlib framework; the discrimination module 20133 is configured to determine whether the original single frame image contains a person Face image, using the original single frame image as the single frame image to be detected; if it is confirmed that the original single frame image does not contain a human face image, another one is randomly selected from the single frame image as the original single frame image Until it is confirmed that the original single frame image contains a human face image, the original single frame image is used as the single frame image to be detected.
根据图5所示,所述基于改进的Resnet的人脸活体检测装置20中的第二获取模块202包括:人脸图像获取模块2021,配置为获取所述待检测单帧图像中的每一人脸图像;概率值获取模块2022,配置为基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。As shown in FIG. 5, the second acquisition module 202 in the improved Resnet-based face living detection device 20 includes: a face image acquisition module 2021, configured to acquire each face in the single frame image to be detected Image; the probability value acquisition module 2022, configured to acquire the probability value of the face image directly derived from a living body based on an improved Resnet.
根据图5所示,所述基于改进的Resnet的人脸活体检测装置20中的人脸图像获取模块2021包括:人脸特征点提取模块20211,配置为基于dlib框架,提取所述待检测单帧图像中的人脸特征点;人脸特征点组合模块20212,配置为将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。As shown in FIG. 5, the face image acquisition module 2021 in the improved Resnet-based face living detection device 20 includes: a face feature point extraction module 20111, configured to extract the single frame to be detected based on the dlib framework Face feature points in the image; the face feature point combination module 20112 is configured to use each group of images of a predetermined shape and size area where the face feature points are located as the face image.
上述装置中各个模块的功能和作用的实现过程具体详见上述基于改进的Resnet的人脸活体检测的方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and roles of each module in the above-mentioned device, please refer to the implementation process of corresponding steps in the above-mentioned improved Resnet-based face living detection method for details, which will not be repeated here.
应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of a module or unit described above can be further divided into multiple modules or units to be embodied.
此外,尽管在附图中以特定顺序描述了本公开中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等。In addition, although the various steps of the method of the present disclosure are described in a specific order in the drawings, this does not require or imply that these steps must be performed in the specific order, or that all the steps shown must be performed to achieve the desired result. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution, etc.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、移动终端、或者网络设备等)执行根据本公开实施方式的方法。Through the description of the foregoing embodiments, those skilled in the art can easily understand that the exemplary embodiments described herein can be implemented by software, or can be implemented by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) execute the method according to the embodiment of the present disclosure.
图6示出根据本公开一示例实施方式的基于改进的Resnet的人脸活体检测的系统架构图。该系统架构包括:视频录入终端310、服务器320、管理端330。Fig. 6 shows a system architecture diagram of face living detection based on improved Resnet according to an exemplary embodiment of the present disclosure. The system architecture includes: a video recording terminal 310, a server 320, and a management terminal 330.
在一实施例中,管理端330将Resnet训练所需的参数:预设标准值、预设期待值发送给服务器320,使得服务器320能够完成Resnet的训练。服务器320获取从视频录入终端310上传的待检测视频,对待检测视频进行分帧后得到单帧图像。从中获取含有人脸图像的待检测单帧图像后,将所述待检测单帧图像中的每一人脸图像输入改进的Resnet,从而确定所述每一人脸图像是否直接来源于活体。服务器320将识别结果发送给管理端330,使得管理端330基于识别结果进行相应的业务处理。In one embodiment, the management terminal 330 sends the parameters required for Resnet training: preset standard values and preset expected values to the server 320, so that the server 320 can complete the Resnet training. The server 320 obtains the video to be detected uploaded from the video recording terminal 310, and obtains a single frame image after framing the video to be detected. After obtaining the single-frame image to be detected containing the face image therefrom, input each face image in the single-frame image to be detected into the improved Resnet, thereby determining whether each face image is directly derived from a living body. The server 320 sends the recognition result to the management terminal 330, so that the management terminal 330 performs corresponding service processing based on the recognition result.
通过以上对系统架构的描述,本领域的技术人员易于理解,这里描述的系统架构能够实现图5所示的基于改进的Resnet的人脸活体检测的装置中各个模块的功能。Through the above description of the system architecture, those skilled in the art can easily understand that the system architecture described here can realize the functions of each module in the device for face living detection based on the improved Resnet shown in FIG. 5.
在本公开的示例性实施例中,还提供了一种能够实现上述方法的电子设备。In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
所属技术领域的技术人员能够理解,本申请的各个方面可以实现为系统、方法或程序产品。因此,本申请的各个方面可以具体实现为以下形式,即:完全的硬件实施方式、完全的软件实施方式(包括固件、微代码等),或硬件和软件方面结合的实施方式,这里可以统称为“电路”、“模块”或“系统”。Those skilled in the art can understand that various aspects of the present application can be implemented as a system, method, or program product. Therefore, each aspect of the present application can be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which can be collectively referred to herein as "Circuit", "Module" or "System".
下面参照图7来描述根据本申请的这种实施方式的电子设备400。图7显示的电子设备400仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。The electronic device 400 according to this embodiment of the present application will be described below with reference to FIG. 7. The electronic device 400 shown in FIG. 7 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present application.
如图7所示,电子设备400以通用计算设备的形式表现。电子设备400的组件可以包括但不限于:上述至少一个处理单元410、上述至少一个存储单元420、连 接不同系统组件(包括存储单元420和处理单元410)的总线430。As shown in FIG. 7, the electronic device 400 takes the form of a general-purpose computing device. The components of the electronic device 400 may include, but are not limited to: the aforementioned at least one processing unit 410, the aforementioned at least one storage unit 420, and a bus 430 connecting different system components (including the storage unit 420 and the processing unit 410).
其中,所述存储单元存储有程序代码,所述程序代码可以被所述处理单元410执行,使得所述处理单元410执行本说明书上述“示例性方法”部分中描述的根据本申请各种示例性实施方式的步骤。例如,所述处理单元410可以执行如图1中所示步骤S100:获取含有人脸图像的待检测单帧图像;步骤S110:对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;步骤S120:基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。Wherein, the storage unit stores program code, and the program code can be executed by the processing unit 410, so that the processing unit 410 executes the various exemplary methods described in the "Exemplary Method" section of this specification. Implementation steps. For example, the processing unit 410 may perform step S100 as shown in FIG. 1: Obtain a single frame image to be detected containing a face image; Step S110: For each face image in the single frame image to be detected, based on improved Resnet of, obtains the probability value that the face image is directly derived from a living body; Step S120: Based on the matching result of the probability value and a preset threshold, determine whether the face image is directly derived from a living body.
存储单元420可以包括易失性存储单元形式的可读介质,例如随机存取存储单元(RAM)4201和/或高速缓存存储单元4202,还可以进一步包括只读存储单元(ROM)4203。The storage unit 420 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 4201 and/or a cache storage unit 4202, and may further include a read-only storage unit (ROM) 4203.
存储单元420还可以包括具有一组(至少一个)程序模块4205的程序/实用工具4204,这样的程序模块4205包括但不限于:操作系统、一个或者多个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。The storage unit 420 may also include a program/utility tool 4204 having a set of (at least one) program module 4205. Such program module 4205 includes but is not limited to: an operating system, one or more application programs, other program modules, and program data, Each of these examples or some combination may include the implementation of a network environment.
总线430可以为表示几类总线结构中的一种或多种,包括存储单元总线或者存储单元控制器、外围总线、图形加速端口、处理单元或者使用多种总线结构中的任意总线结构的局域总线。The bus 430 may represent one or more of several types of bus structures, including a storage unit bus or a storage unit controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local area using any bus structure among multiple bus structures. bus.
电子设备400也可以与一个或多个外部设备500(例如键盘、指向设备、蓝牙设备等)通信,还可与一个或者多个使得用户能与该电子设备400交互的设备通信,和/或与使得该电子设备400能与一个或多个其它计算设备进行通信的任何设备(例如路由器、调制解调器等等)通信。这种通信可以通过输入/输出(I/O)接口450进行。并且,电子设备400还可以通过网络适配器460与一个或者多个网络(例如局域网(LAN),广域网(WAN)和/或公共网络,例如因特网)通信。如图所示,网络适配器460通过总线430与电子设备400的其它模块通信。应当明白,尽管图中未示出,可以结合电子设备400使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、RAID系统、磁带驱动器以及数据备份存储系统等。The electronic device 400 can also communicate with one or more external devices 500 (such as keyboards, pointing devices, Bluetooth devices, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 400, and/or communicate with Any device (such as a router, modem, etc.) that enables the electronic device 400 to communicate with one or more other computing devices. This communication can be performed through an input/output (I/O) interface 450. Moreover, the electronic device 400 may also communicate with one or more networks (for example, a local area network (LAN), a wide area network (WAN), and/or a public network, such as the Internet) through the network adapter 460. As shown in the figure, the network adapter 460 communicates with other modules of the electronic device 400 through the bus 430. It should be understood that although not shown in the figure, other hardware and/or software modules can be used in conjunction with the electronic device 400, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives And data backup storage system, etc.
通过以上的实施方式的描述,本领域的技术人员易于理解,这里描述的示例实施方式可以通过软件实现,也可以通过软件结合必要的硬件的方式来实现。因此,根据本公开实施方式的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性存储介质(可以是CD-ROM,U盘,移动硬盘等)中或网络上,包括若干指令以使得一台计算设备(可以是个人计算机、服务器、终端装置、或者网络设备等)执行根据本公开实施方式的方法。Through the description of the foregoing embodiments, those skilled in the art can easily understand that the exemplary embodiments described herein can be implemented by software, or can be implemented by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (can be a CD-ROM, U disk, mobile hard disk, etc.) or on the network , Including several instructions to make a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiments of the present disclosure.
在本公开的示例性实施例中,还提供了一种计算机非易失性可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施方式中,本申请的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行本说明书上述“示例性方法”部分中描述的根据本申请各种示例性实施方式的步骤。In the exemplary embodiment of the present disclosure, there is also provided a computer non-volatile readable storage medium on which is stored a program product capable of implementing the above-mentioned method in this specification. In some possible implementation manners, various aspects of the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to enable the The terminal device executes the steps according to various exemplary embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.
参考图8所示,描述了根据本申请的实施方式的用于实现上述方法的程序产品600,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本申请的程序产品不限于此,在本文件中,非易失性可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。Referring to FIG. 8, a program product 600 for implementing the above method according to an embodiment of the present application is described. It can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be installed in a terminal device, For example, running on a personal computer. However, the program product of this application is not limited to this. In this document, the non-volatile readable storage medium can be any tangible medium that contains or stores a program. The program can be used by or combined with an instruction execution system, device, or device. use.
所述程序产品可以采用一个或多个可读介质的任意组合。非易失性可读存储介质可以是可读信号介质或者可读存储介质。非易失性可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。非易失性可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product can use any combination of one or more readable media. The non-volatile readable storage medium may be a readable signal medium or a readable storage medium. The non-volatile readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples (non-exhaustive list) of non-volatile readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM ), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是非易失性可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输 用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。The computer-readable signal medium may include a data signal propagated in baseband or as a part of a carrier wave, and readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The readable signal medium may also be any readable medium other than a non-volatile readable storage medium, and the readable medium may send, propagate, or transmit a program for use by or in combination with the instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。The program code contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本申请操作的程序代码,所述程序设计语言包括面向对象的程序设计语言一诸如Java、C++等,还包括常规的过程式程序设计语言一诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。The program code for performing the operations of this application can be written in any combination of one or more programming languages. The programming languages include object-oriented programming languages such as Java, C++, etc., as well as conventional procedural programming languages. Programming language-such as "C" language or similar programming language. The program code can be executed entirely on the user's computing device, partly on the user's device, executed as an independent software package, partly on the user's computing device and partly executed on the remote computing device, or entirely on the remote computing device or server Executed on. In the case of a remote computing device, the remote computing device can be connected to a user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using Internet service providers) Business to connect via the Internet).
此外,上述附图仅是根据本申请示例性实施例的方法所包括的处理的示意性说明,而不是限制目的。易于理解,上述附图所示的处理并不表明或限制这些处理的时间顺序。另外,也易于理解,这些处理可以是例如在多个模块中同步或异步执行的。In addition, the above-mentioned drawings are only schematic illustrations of the processing included in the method according to the exemplary embodiments of the present application, and are not intended for limitation. It is easy to understand that the processing shown in the above drawings does not indicate or limit the time sequence of these processings. In addition, it is easy to understand that these processes can be executed synchronously or asynchronously in multiple modules, for example.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其他实施例。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由权利要求指出。Those skilled in the art will easily think of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptive changes of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not disclosed in the present disclosure . The description and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the claims.

Claims (20)

  1. 一种基于改进的Resnet的人脸活体检测的方法,其特征在于,包括:A method for face live detection based on improved Resnet, which is characterized in that it includes:
    获取含有人脸图像的待检测单帧图像;Obtain a single frame image to be detected containing a face image;
    对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;For each face image in the single frame image to be detected, based on the improved Resnet, obtain the probability value that the face image is directly derived from a living body;
    基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。Based on the matching result of the probability value and the preset threshold value, it is determined whether the face image is directly derived from a living body.
  2. 根据权利要求1所述的方法,其特征在于,所述获取含有人脸图像的待检测单帧图像,包括:The method according to claim 1, wherein the obtaining a single frame image to be detected containing a human face image comprises:
    获取待检测视频;Obtain the video to be detected;
    将所述待检测视频分解为单帧图像;Decompose the to-be-detected video into single frame images;
    基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。Based on the dlib framework, a single frame image to be detected containing a face image is obtained from the single frame image.
  3. 根据权利要求2所述的方法,其特征在于,所述基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像,包括:The method according to claim 2, wherein the obtaining a single frame image to be detected containing a face image from the single frame image based on the dlib framework comprises:
    从所述单帧图像中随机抽取一张作为原始单帧图像;Randomly extract one from the single frame image as the original single frame image;
    基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;Based on the dlib framework, confirm whether the original single frame image contains a face image;
    如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。If it is confirmed that the original single frame image contains a human face image, use the original single frame image as the single frame image to be detected; if it is confirmed that the original single frame image does not contain a human face image, select the single frame image from Another randomly selected one is used as the original single frame image until it is confirmed that the original single frame image contains a human face image, and the original single frame image is used as the single frame image to be detected.
  4. 根据权利要求1所述的方法,其特征在于,所述对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值,包括:The method according to claim 1, characterized in that, for each face image in the single frame image to be detected, based on an improved Resnet, obtaining the probability value that the face image directly comes from a living body includes :
    获取所述待检测单帧图像中的每一人脸图像;Acquiring each face image in the single frame image to be detected;
    基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。Based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained.
  5. 根据权利要求4所述的方法,其特征在于,所述获取所述待检测单帧图像中的每一人脸图像,包括:The method according to claim 4, wherein the acquiring each face image in the single frame image to be detected comprises:
    基于dlib框架,提取所述待检测单帧图像中的人脸特征点;Based on the dlib framework, extract the facial feature points in the single frame image to be detected;
    将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。Each group of images of the predetermined shape and size area where the facial feature points are located is used as the facial image.
  6. 一种基于改进的Resnet的人脸活体检测的装置,其特征在于,包括:An improved Resnet-based live face detection device, which is characterized in that it comprises:
    第一获取模块,配置为获取含有人脸图像的待检测单帧图像;The first acquisition module is configured to acquire a single frame image to be detected containing a face image;
    第二获取模块,配置为对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;The second acquisition module is configured to acquire, for each face image in the single frame image to be detected, the probability value that the face image is directly derived from a living body based on the improved Resnet;
    活体判定模块,配置为基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。The living body determination module is configured to determine whether the face image is directly derived from a living body based on the matching result of the probability value and a preset threshold.
  7. 根据权利要求6所述的装置,其特征在于,所述第一获取模块包括:The apparatus according to claim 6, wherein the first obtaining module comprises:
    待检测视频获取模块,配置为获取待检测视频;The video acquisition module to be detected is configured to acquire the video to be detected;
    分解模块,配置为将所述待检测视频分解为单帧图像;A decomposition module, configured to decompose the to-be-detected video into a single frame image;
    待检测单帧图像获取模块,配置为基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。The single-frame image acquisition module to be detected is configured to obtain a single-frame image to be detected containing a face image from the single-frame image based on the dlib framework.
  8. 根据权利要求6所述的装置,其特征在于,所述待检测单帧图像获取模块包括:The device according to claim 6, wherein the acquisition module of the single frame image to be detected comprises:
    单帧图像抽取模块,配置为从所述单帧图像中随机抽取一张作为原始单帧图像;The single frame image extraction module is configured to randomly extract one of the single frame images as the original single frame image;
    人脸图像检测模块,配置为基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;The face image detection module is configured to confirm whether the original single frame image contains a face image based on the dlib framework;
    判别模块,配置为如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作 为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。The discrimination module is configured to use the original single frame image as the single frame image to be detected if it is confirmed that the original single frame image contains a human face image; One more piece of the single frame image is randomly selected as the original single frame image until it is confirmed that the original single frame image contains a face image, and the original single frame image is used as the single frame image to be detected.
  9. 根据权利要求6所述的装置,其特征在于,所述第二获取模块包括:The device according to claim 6, wherein the second acquisition module comprises:
    人脸图像获取模块,配置为获取所述待检测单帧图像中的每一人脸图像;A face image acquisition module, configured to acquire each face image in the single frame image to be detected;
    概率值获取模块,配置为基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。The probability value acquisition module is configured to acquire the probability value that the face image is directly derived from a living body based on the improved Resnet.
  10. 根据权利要求6所述的装置,其特征在于,所述人脸图像获取模块包括:The apparatus according to claim 6, wherein the facial image acquisition module comprises:
    人脸特征点提取模块,配置为基于dlib框架,提取所述待检测单帧图像中的人脸特征点;The facial feature point extraction module is configured to extract the facial feature points in the single frame image to be detected based on the dlib framework;
    人脸特征点组合模块,配置为将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。The face feature point combination module is configured to use each group of images of a predetermined shape and size area where the face feature points are located as the face image.
  11. 一种基于改进的Resnet的人脸活体检测的电子设备,其特征在于,包括:An electronic device for face live detection based on improved Resnet, which is characterized in that it includes:
    存储器,配置为存储可执行指令;Memory, configured to store executable instructions;
    处理器,配置为执行所述存储器中存储的可执行指令;A processor configured to execute executable instructions stored in the memory;
    其中,所述处理器在执行所述可执行指令时配置为执行以下处理:Wherein, the processor is configured to perform the following processing when executing the executable instruction:
    获取含有人脸图像的待检测单帧图像;Obtain a single frame image to be detected containing a face image;
    对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;For each face image in the single frame image to be detected, based on the improved Resnet, obtain the probability value that the face image is directly derived from a living body;
    基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。Based on the matching result of the probability value and the preset threshold value, it is determined whether the face image is directly derived from a living body.
  12. 根据权利要求11所述的电子设备,其特征在于,所述处理器在执行所述可执行指令时配置为执行以下处理来实现所述获取含有人脸图像的待检测单帧图像:The electronic device according to claim 11, wherein the processor is configured to perform the following processing when executing the executable instruction to implement the acquisition of the single-frame image to be detected containing the face image:
    获取待检测视频;Obtain the video to be detected;
    将所述待检测视频分解为单帧图像;Decompose the to-be-detected video into single frame images;
    基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。Based on the dlib framework, a single frame image to be detected containing a face image is obtained from the single frame image.
  13. 根据权利要求11所述的电子设备,其特征在于,所述处理器在执行所述可执行指令时配置为执行以下处理来实现所述基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像:The electronic device according to claim 11, wherein the processor is configured to execute the following processing when executing the executable instruction to implement the dlib-based framework to obtain the human face from the single frame image Single frame of image to be detected:
    从所述单帧图像中随机抽取一张作为原始单帧图像;Randomly extract one from the single frame image as the original single frame image;
    基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;Based on the dlib framework, confirm whether the original single frame image contains a face image;
    如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。If it is confirmed that the original single frame image contains a human face image, use the original single frame image as the single frame image to be detected; if it is confirmed that the original single frame image does not contain a human face image, select the single frame image from Another randomly selected one is used as the original single frame image until it is confirmed that the original single frame image contains a human face image, and the original single frame image is used as the single frame image to be detected.
  14. 根据权利要求11所述的电子设备,其特征在于,所述处理器在执行所述可执行指令时配置为执行以下处理来实现所述对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值:The electronic device according to claim 11, wherein the processor is configured to perform the following processing when executing the executable instruction to implement the processing of each face image in the single frame image to be detected, Based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained:
    获取所述待检测单帧图像中的每一人脸图像;Acquiring each face image in the single frame image to be detected;
    基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。Based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained.
  15. 根据权利要求11所述的电子设备,其特征在于,所述处理器在执行所述可执行指令时配置为执行以下处理来实现获取所述待检测单帧图像中的每一人脸图像:The electronic device according to claim 11, wherein the processor is configured to perform the following processing when executing the executable instruction to obtain each face image in the single frame image to be detected:
    基于dlib框架,提取所述待检测单帧图像中的人脸特征点;Based on the dlib framework, extract the facial feature points in the single frame image to be detected;
    将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。Each group of images of the predetermined shape and size area where the facial feature points are located is used as the facial image.
  16. 一种计算机非易失性可读存储介质,其特征在于,其存储有计算机程序指令,所述计算机指令在被计算机执行时将所述处理器配 置为:A computer non-volatile readable storage medium, characterized in that it stores computer program instructions, and when the computer instructions are executed by a computer, the processor is configured as:
    获取含有人脸图像的待检测单帧图像;Obtain a single frame image to be detected containing a face image;
    对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值;For each face image in the single frame image to be detected, based on the improved Resnet, obtain the probability value that the face image is directly derived from a living body;
    基于所述概率值与预设阈值的匹配结果,判定所述人脸图像是否直接来源于活体。Based on the matching result of the probability value and the preset threshold value, it is determined whether the face image is directly derived from a living body.
  17. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述计算机指令在被处理器执行时将所述处理器配置为通过执行以下处理来实现所述获取含有人脸图像的待检测单帧图像:获取待检测视频;The computer non-volatile readable storage medium according to claim 16, wherein when the computer instructions are executed by the processor, the processor is configured to perform the following processing to achieve the acquisition of the human face Single frame image of the image to be detected: obtain the video to be detected;
    将所述待检测视频分解为单帧图像;Decompose the to-be-detected video into single frame images;
    基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像。Based on the dlib framework, a single frame image to be detected containing a face image is obtained from the single frame image.
  18. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述计算机指令在被处理器执行时将所述处理器配置为通过执行以下处理来实现所述基于dlib框架,从所述单帧图像中获取含有人脸图像的待检测单帧图像:The computer non-volatile readable storage medium according to claim 16, wherein when the computer instructions are executed by the processor, the processor is configured to implement the dlib-based framework by executing the following processing, Obtain a single frame image to be detected containing a face image from the single frame image:
    从所述单帧图像中随机抽取一张作为原始单帧图像;Randomly extract one from the single frame image as the original single frame image;
    基于dlib框架,确认所述原始单帧图像中是否含有人脸图像;Based on the dlib framework, confirm whether the original single frame image contains a face image;
    如果确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像;如果确认所述原始单帧图像不含有人脸图像,从所述单帧图像中再随机抽取一张作为原始单帧图像,直到确认所述原始单帧图像含有人脸图像,将所述原始单帧图像作为所述待检测单帧图像。If it is confirmed that the original single frame image contains a human face image, use the original single frame image as the single frame image to be detected; if it is confirmed that the original single frame image does not contain a human face image, select the single frame image from Another randomly selected one is used as the original single frame image until it is confirmed that the original single frame image contains a human face image, and the original single frame image is used as the single frame image to be detected.
  19. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述计算机指令在被处理器执行时将所述处理器配置为通过执行以下处理来实现所述对所述待检测单帧图像中的每一人脸图像,基于改进的Resnet,获取所述人脸图像直接来源于活体的概率 值:The computer non-volatile readable storage medium according to claim 16, wherein when the computer instructions are executed by a processor, the processor is configured to perform the following processing to implement the processing Detect each face image in a single frame image, and obtain the probability value that the face image directly comes from a living body based on the improved Resnet:
    获取所述待检测单帧图像中的每一人脸图像;Acquiring each face image in the single frame image to be detected;
    基于改进的Resnet,获取所述人脸图像直接来源于活体的概率值。Based on the improved Resnet, the probability value that the face image is directly derived from a living body is obtained.
  20. 根据权利要求16所述的计算机非易失性可读存储介质,其特征在于,所述计算机指令在被处理器执行时将所述处理器配置为通过执行以下处理来实现所述获取所述待检测单帧图像中的每一人脸图像:The computer non-volatile readable storage medium according to claim 16, wherein when the computer instructions are executed by the processor, the processor is configured to perform the following processing to achieve the obtaining of the waiting Detect each face image in a single frame image:
    基于dlib框架,提取所述待检测单帧图像中的人脸特征点;Based on the dlib framework, extract the facial feature points in the single frame image to be detected;
    将每一组所述人脸特征点所在预定形状、大小区域的图像,作为所述人脸图像。Each group of images of the predetermined shape and size area where the facial feature points are located is used as the facial image.
PCT/CN2019/089163 2019-03-04 2019-05-30 Improved resnet-based human face in-vivo detection method and related device WO2020177226A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910160807.4A CN110059542A (en) 2019-03-04 2019-03-04 The method and relevant device of face In vivo detection based on improved Resnet
CN201910160807.4 2019-03-04

Publications (1)

Publication Number Publication Date
WO2020177226A1 true WO2020177226A1 (en) 2020-09-10

Family

ID=67316559

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/089163 WO2020177226A1 (en) 2019-03-04 2019-05-30 Improved resnet-based human face in-vivo detection method and related device

Country Status (2)

Country Link
CN (1) CN110059542A (en)
WO (1) WO2020177226A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112329730A (en) * 2020-11-27 2021-02-05 上海商汤智能科技有限公司 Video detection method, device, equipment and computer readable storage medium
CN112364724A (en) * 2020-10-27 2021-02-12 北京地平线信息技术有限公司 Living body detection method and apparatus, storage medium, and electronic device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111079606B (en) * 2019-12-06 2023-05-26 北京爱笔科技有限公司 Face anti-counterfeiting method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106960177A (en) * 2015-02-15 2017-07-18 北京旷视科技有限公司 Living body faces verification method and system, living body faces checking device
CN109101871A (en) * 2018-08-07 2018-12-28 北京华捷艾米科技有限公司 A kind of living body detection device based on depth and Near Infrared Information, detection method and its application

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106960177A (en) * 2015-02-15 2017-07-18 北京旷视科技有限公司 Living body faces verification method and system, living body faces checking device
CN109101871A (en) * 2018-08-07 2018-12-28 北京华捷艾米科技有限公司 A kind of living body detection device based on depth and Near Infrared Information, detection method and its application

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112364724A (en) * 2020-10-27 2021-02-12 北京地平线信息技术有限公司 Living body detection method and apparatus, storage medium, and electronic device
CN112329730A (en) * 2020-11-27 2021-02-05 上海商汤智能科技有限公司 Video detection method, device, equipment and computer readable storage medium
CN112329730B (en) * 2020-11-27 2024-06-11 上海商汤智能科技有限公司 Video detection method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN110059542A (en) 2019-07-26

Similar Documents

Publication Publication Date Title
CN108875833B (en) Neural network training method, face recognition method and device
US11996091B2 (en) Mixed speech recognition method and apparatus, and computer-readable storage medium
CN109564618B (en) Method and system for facial image analysis
US9183429B2 (en) Method and apparatus for facial recognition
WO2018121737A1 (en) Keypoint prediction, network training, and image processing methods, device, and electronic device
WO2022105118A1 (en) Image-based health status identification method and apparatus, device and storage medium
AU2011318719B2 (en) Method and apparatus for recognizing an emotion of an individual based on facial action units
CN108288051B (en) Pedestrian re-recognition model training method and device, electronic equipment and storage medium
WO2020253127A1 (en) Facial feature extraction model training method and apparatus, facial feature extraction method and apparatus, device, and storage medium
WO2020177226A1 (en) Improved resnet-based human face in-vivo detection method and related device
CN111476309A (en) Image processing method, model training method, device, equipment and readable medium
WO2020024484A1 (en) Method and device for outputting data
CN112071322B (en) End-to-end voiceprint recognition method, device, storage medium and equipment
WO2020019591A1 (en) Method and device used for generating information
US11734954B2 (en) Face recognition method, device and electronic equipment, and computer non-volatile readable storage medium
WO2020006964A1 (en) Image detection method and device
CN111242291A (en) Neural network backdoor attack detection method and device and electronic equipment
CN109118420B (en) Watermark identification model establishing and identifying method, device, medium and electronic equipment
CN109214501B (en) Method and apparatus for identifying information
CN111291902B (en) Detection method and device for rear door sample and electronic equipment
WO2022127480A1 (en) Facial recognition method and related device
WO2023019927A1 (en) Facial recognition method and apparatus, storage medium, and electronic device
CN113140012B (en) Image processing method, device, medium and electronic equipment
CN112651467B (en) Training method and system and prediction method and system for convolutional neural network
WO2020215682A1 (en) Fundus image sample expansion method and apparatus, electronic device, and computer non-volatile readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19917559

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

Free format text: NOTING OF LOSS OF RIGHTS (EPO FORM 1205A DATED 26.10.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19917559

Country of ref document: EP

Kind code of ref document: A1