WO2022126914A1 - Living body detection method and apparatus, electronic device, and storage medium - Google Patents
Living body detection method and apparatus, electronic device, and storage medium Download PDFInfo
- Publication number
- WO2022126914A1 WO2022126914A1 PCT/CN2021/083721 CN2021083721W WO2022126914A1 WO 2022126914 A1 WO2022126914 A1 WO 2022126914A1 CN 2021083721 W CN2021083721 W CN 2021083721W WO 2022126914 A1 WO2022126914 A1 WO 2022126914A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- face
- network
- living body
- loss value
- training
- Prior art date
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 181
- 238000012545 processing Methods 0.000 claims abstract description 20
- 238000012549 training Methods 0.000 claims description 89
- 230000004807 localization Effects 0.000 claims description 43
- 230000006870 function Effects 0.000 claims description 34
- 238000000034 method Methods 0.000 claims description 26
- 238000004590 computer program Methods 0.000 claims description 12
- 238000012216 screening Methods 0.000 claims description 11
- 238000013145 classification model Methods 0.000 claims description 4
- 238000005516 engineering process Methods 0.000 abstract description 5
- 230000001815 facial effect Effects 0.000 abstract 2
- 238000001914 filtration Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000012706 support-vector machine Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/172—Classification, e.g. identification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/10—Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
- G06V40/16—Human faces, e.g. facial parts, sketches or expressions
- G06V40/161—Detection; Localisation; Normalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/40—Spoof detection, e.g. liveness detection
- G06V40/45—Detection of the body part being alive
Definitions
- the present application relates to the technical field of financial technology, and in particular, to a method, apparatus, electronic device, and computer-readable storage medium for detecting a living body.
- a live detection method provided by this application includes:
- a weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- the present application also provides a device for detecting a living body, the device comprising:
- a face classification module used to obtain a set of images to be detected, and to classify and process the set of images to be detected by using a face classification network, and to obtain a set of face images after screening;
- a face localization module used for using a face localization network to perform a face localization operation on the face image set to obtain a face region image set
- a living body detection module configured to perform living body detection processing on the face region image set by using a living body detection network to obtain multiple detection results
- the result generating module is configured to perform a weighted average of the multiple detection results to obtain the living body detection result of the image set to be detected.
- the present application also provides an electronic device, the electronic device comprising:
- the memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the steps of:
- a weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- the present application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:
- a weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- FIG. 1 is a schematic flowchart of a method for model training in a live detection method provided by an embodiment of the present application
- FIG. 2 is a schematic flowchart of a method for performing living body detection on an image set to be detected using a trained model provided by an embodiment of the present application;
- FIG. 3 is a schematic diagram of a module of a living body detection device provided by an embodiment of the present application.
- FIG. 4 is a schematic diagram of an internal structure of an electronic device for implementing a method for detecting a living body provided by an embodiment of the present application.
- Embodiments of the present application provide a method for detecting a living body, where an executing subject of the method includes but is not limited to at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
- the liveness detection method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform.
- the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
- FIG. 1 is a schematic flowchart of a model training method in a living body detection method provided by an embodiment of the present application.
- the model training method includes:
- the face classification network may be a MobileNet network (mobile terminal network), the face localization network is a Coarse-to-fine CNN network (coarse localization convolutional neural network), and the living body detection network
- the network is an SVM (Support Vector Machine) classifier with a linear kernel.
- the training image set includes a plurality of photos containing human faces.
- the present application uses the face classification network to perform classification on the training image set to obtain a face training set, and uses the following first loss function to calculate the difference between the face training image and the preset real face label.
- ⁇ and ⁇ are the hyperparameters of the first loss function
- Y x, y represent the gray value of coordinates (x, y) in the true label
- N is the number of samples in the face training set.
- the embodiment of the present application adjusts the parameters of the face classification network and re-executes the training of the face classification network using the training image set until the The number of times that the face classification network is trained reaches the first preset number of times.
- the embodiment of the present application uses the face classification network to classify the training image set, generates a face training set, and uses the face localization network to locate the face region of the face training set to obtain a face area image set, and calculate the face scale set and face position offset set in the face area image set. Further, the embodiment of the present application uses the following joint loss function to calculate the joint loss value L det of the face region image set and the preset face region label:
- L size is the loss value of face scale
- is the area of intersection between the picture in the face scale set and the picture in the real scale set
- is the picture in the face scale set
- is the area of the smallest closure between the pictures in the face scale set and the pictures in the true scale set
- L off is the face position offset loss value
- x is the difference between the Kth real position offset and the face position offset
- the embodiment of the present application adjusts the parameters of the face classification network and the face location network, and re-executes the face classification using the training image set
- the network and the face location network are jointly trained until the number of times of training reaches a second preset number of times.
- the S4 includes:
- the network detects the training image set to obtain a predicted living body detection set, and calculates a fourth loss value between the predicted living body detection set and a preset real living body detection set;
- the first loss value, the second loss value, the third loss value and the fourth loss value are processed in series by using a preset weight to obtain a joint loss value. If the joint loss value is greater than the preset threshold, the The face classification network, the face location network, and the living body detection network are adjusted and updated until the joint loss value is less than or equal to a preset threshold, and the training completed includes the face classification network, The face positioning network and the face living body judgment model of the living body detection network.
- the calculation of the first loss value between the face training set and the preset real label includes:
- the first loss value is calculated using the following first loss function:
- ⁇ and ⁇ are the hyperparameters of the first loss function
- Y x, y represent the gray value of coordinates (x, y) in the true label
- N is the number of samples in the face training set.
- calculating the second loss value between the face scale set and the preset real scale set as described above including:
- the second loss value L size is calculated using the following second loss function:
- the calculation of the third loss value between the face position offset set and the preset real position offset set includes:
- the third loss value L off is calculated using the following third loss function:
- x is the difference between the Kth real position offset and the face position offset
- M is the number of samples of the real center offset map.
- the calculating the fourth loss value between the predicted live detection set and the preset real live detection set includes:
- the fourth loss value is calculated using the following fourth loss function
- a preset weight performing series processing on the first loss value, the second loss value, the third loss value and the fourth loss value by using a preset weight to obtain a joint loss value, including:
- L is the joint loss value
- ⁇ size , ⁇ off are preset weights, which can be 1 and 0.1 respectively.
- FIG. 2 it is a schematic flowchart of a method for performing living body detection using a trained model to be detected image set according to an embodiment of the present application.
- the method for detecting a living body includes:
- the image set to be detected may include video frames in a face video captured by a camera.
- the set of images to be detected and the like may be stored in a blockchain node.
- a face localization operation is performed on the face image set by using a face localization model to obtain the face scale set and the face position offset set, and the face scale set is used to determine The approximate position of the face region in the face image set, the face position offset is used to fine-tune the face scale set, and finally a face region image set is obtained.
- the face region image set is input into the living body detection network for living body detection processing, and multiple detection results are obtained, wherein the detection results are determined as The probability value of living body.
- the weighted average is performed on the multiple detection results by using a preset weighting formula, including:
- P(cls) is the detection probability value
- RA cls , Re cls and Rd cls are the probability values that are determined to be living bodies after being detected and processed by the living body detection network
- a, b and c are preset weights.
- the detection probability value is compared with a preset detection threshold value in combination with a preset determination formula to obtain a living body detection result of the to-be-detected image set, including:
- the determination formula is:
- y is the determination result
- N is the preset detection threshold
- N is 0.65.
- a face image set with faces is selected from the set of images to be detected through a face classification network and a face localization network, and further positioning is performed from the set of face images.
- using the living body detection network to perform the living body detection processing on the face area image set can reduce the computational resources consumed in the living body detection, and can improve the accuracy of the living body detection. Therefore, the living body detection method, device and computer-readable storage medium proposed in the present application can improve the efficiency of the living body detection method, and solve the problems that traditional image recognition algorithms consume a lot of computing resources and have low accuracy when performing living body detection.
- FIG. 3 it is a schematic diagram of a module of a living body detection device provided by an embodiment of the present application.
- the living body detection apparatus 100 described in the present application may be installed in an electronic device. According to the implemented functions, the living body detection apparatus 100 may include a face classification module 101 , a face positioning module 102 , a living body detection module 103 , and a result generation module 104 .
- the modules described in this application may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can perform fixed functions, and are stored in the memory of the electronic device.
- each module/unit is as follows:
- the face classification module 101 is used to obtain a set of images to be detected, and to perform classification processing on the set of images to be detected by using a face classification network, and to obtain a set of face images after screening;
- the face location module 102 is configured to use a face location network to perform a face location operation on the face image set to obtain a face area image set;
- the living body detection module 103 is configured to use a living body detection network to perform a living body detection process on the face region image set to obtain multiple detection results;
- the result generation module 104 is configured to perform a weighted average of the multiple detection results to obtain a living body detection result of the image set to be detected.
- the living body detection method shown in FIG. 2 can be implemented, and the same beneficial effects can be produced, which will not be repeated here.
- FIG. 4 it is a schematic structural diagram of an electronic device implementing the method for detecting a living body of the present application.
- the electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a living body detection program 12.
- the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
- the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 .
- the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc.
- the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
- the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as codes of the living body detection program 12 , etc., but also can be used to temporarily store data that has been output or will be output.
- the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
- Central Processing Unit CPU
- microprocessor digital processing chip
- graphics processor and combination of various control chips, etc.
- the processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing the program or module (for example, executing the program) stored in the memory 11. living body detection program, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
- the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like.
- PCI peripheral component interconnect
- EISA Extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
- FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
- the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management
- the device implements functions such as charge management, discharge management, and power consumption management.
- the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
- the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
- the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
- a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
- the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
- the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
- the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
- the living body detection program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions, and when running in the processor 10, can realize:
- a weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- the modules/units integrated in the electronic device 1 may be stored in a computer-readable storage medium.
- the computer-readable storage medium may be volatile or non-volatile, for example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U Disk, removable hard disk, magnetic disk, CD-ROM, computer memory, read-only memory (ROM, Read-Only Memory).
- the present application also provides a computer-readable storage medium, the computer-readable storage medium may be volatile or non-volatile, and the readable storage medium stores a computer A program, when the computer program is executed by the processor of the electronic device, it can realize:
- a weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- the computer-usable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required by at least one function, and the like; using the created data, etc.
- modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
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 relates to face recognition technology; disclosed is a living body detection method, comprising: acquiring an image set to be detected, using a face classification network to perform classification processing on the image set to be detected, and filtering to obtain a face image set; using a face positioning network to execute a face positioning operation on the face image set to obtain a facial area image set; using a living body detection network to perform living body detection processing on the facial area image set to obtain a plurality of detection results; and executing a weighted average of the plurality of detection results to obtain a living body detection result of the image set to be detected. The present application also relates to blockchain technology, as the image set to be detected can be stored in a blockchain node. Also disclosed in the present application are a living body detection apparatus, an electronic device, and a storage medium. The present application can reduce the computing resources consumed during living body detection and increase the accuracy of living body detection.
Description
本申请要求于2020年12月18日提交中国专利局、申请号为CN202011508401.X、名称为“活体检测方法、装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number CN202011508401.X and the title of "Method, Device, Electronic Device and Storage Medium for Living Body Detection" filed with the China Patent Office on December 18, 2020, the entire contents of which are by reference Incorporated in this application.
本申请涉及金融科技技术领域,尤其涉及一种活体检测方法、装置、电子设备及计算机可读存储介质。The present application relates to the technical field of financial technology, and in particular, to a method, apparatus, electronic device, and computer-readable storage medium for detecting a living body.
随着人脸识别、解锁等技术在金融、门禁、移动设备等场景中应用广泛,人脸鉴伪技术近些年得到人们越来越多的关注,一个正常工作的人脸识别系统,除了实现识别身份以外,还需要具备活体检测的功能。As face recognition, unlocking and other technologies are widely used in finance, access control, mobile devices and other scenarios, face forgery technology has received more and more attention in recent years. A normal working face recognition system, in addition to realizing In addition to identification, it also needs to have the function of live detection.
发明人发现通用活体检测方法主要利用传统图像识别算法进行检测,定位到图像中的人脸后选用多种判定模型进行活体判别,这种检测方法对于数量及类别众多的攻击图片,需要消耗大量计算资源且准确率较低。The inventor found that the general living body detection method mainly uses traditional image recognition algorithms for detection, and selects a variety of judgment models for living body discrimination after locating the face in the image. resources and low accuracy.
发明内容SUMMARY OF THE INVENTION
本申请提供的一种活体检测方法,包括:A live detection method provided by this application includes:
获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;
利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;
将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
本申请还提供一种活体检测装置,所述装置包括:The present application also provides a device for detecting a living body, the device comprising:
人脸分类模块,用于获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;a face classification module, used to obtain a set of images to be detected, and to classify and process the set of images to be detected by using a face classification network, and to obtain a set of face images after screening;
人脸定位模块,用于利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;a face localization module, used for using a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
活体检测模块,用于利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;a living body detection module, configured to perform living body detection processing on the face region image set by using a living body detection network to obtain multiple detection results;
结果生成模块,用于将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。The result generating module is configured to perform a weighted average of the multiple detection results to obtain the living body detection result of the image set to be detected.
本申请还提供一种电子设备,所述电子设备包括:The present application also provides an electronic device, the electronic device comprising:
至少一个处理器;以及,at least one processor; and,
与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,
所述存储器存储有可被所述至少一个处理器执行的计算机程序指令,所述计算机程序指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:The memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the steps of:
获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;
利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;
将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
本申请还提供一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:The present application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:
获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;
利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;
将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
图1为本申请实施例提供的活体检测方法中模型训练的方法流程示意图;1 is a schematic flowchart of a method for model training in a live detection method provided by an embodiment of the present application;
图2为本申请实施例提供的利用训练完成的模型对待检测图像集执行活体检测方法的流程示意图;2 is a schematic flowchart of a method for performing living body detection on an image set to be detected using a trained model provided by an embodiment of the present application;
图3为本申请实施例提供的活体检测装置的模块示意图;3 is a schematic diagram of a module of a living body detection device provided by an embodiment of the present application;
图4为本申请实施例提供的实现活体检测方法的电子设备的内部结构示意图。FIG. 4 is a schematic diagram of an internal structure of an electronic device for implementing a method for detecting a living body provided by an embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the purpose of the present application will be further described with reference to the accompanying drawings in conjunction with the embodiments.
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
本申请实施例提供一种活体检测方法,所述活体检测方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述活体检测方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。Embodiments of the present application provide a method for detecting a living body, where an executing subject of the method includes but is not limited to at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal. In other words, the liveness detection method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
参照图1所示,图1为本申请实施例提供的活体检测方法中模型训练方法的流程示意图。在本实施例中,所述模型训练方法包括:Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a model training method in a living body detection method provided by an embodiment of the present application. In this embodiment, the model training method includes:
S1、构建包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。S1. Build a face living body judgment model including the face classification network, the face positioning network, and the living body detection network.
本申请实施例中,所述人脸分类网络可以是MobileNet网络(移动端网络),所述人脸定位网络是Coarse-to-fine CNN网络(粗定位卷积神经网络),以及所述活体检测网络是是采用linear核的SVM(支持向量机)分类器。In the embodiment of this application, the face classification network may be a MobileNet network (mobile terminal network), the face localization network is a Coarse-to-fine CNN network (coarse localization convolutional neural network), and the living body detection network The network is an SVM (Support Vector Machine) classifier with a linear kernel.
S2、利用训练图像集对所述人脸分类网络进行训练。S2, using the training image set to train the face classification network.
本申请实施例中,所述训练图像集包含多张含有人脸的照片。In the embodiment of the present application, the training image set includes a plurality of photos containing human faces.
详细地,本申请利用所述人脸分类网络对所述训练图像集执行分类,得到人脸训练集,并利用如下第一损失函数计算所述人脸训练图像与预设的真实人脸标签之间的第一损失值L
cls:
In detail, the present application uses the face classification network to perform classification on the training image set to obtain a face training set, and uses the following first loss function to calculate the difference between the face training image and the preset real face label. The first loss value L cls between:
其中,α和β是第一损失函数的超参数,Y
x,y表示所述真实标签中坐标(x,y)的灰度值,
表示所述人脸训练集中坐标(x,y)的灰度值,N为所述人脸训练集中的样本数量。
where α and β are the hyperparameters of the first loss function, Y x, y represent the gray value of coordinates (x, y) in the true label, represents the gray value of the coordinates (x, y) in the face training set, and N is the number of samples in the face training set.
当所述第一损失值L
cls大于第一标准值时,本申请实施例调整所述人脸分类网络的参数并重新执行利用训练图像集对所述人脸分类网络进行训练,直到对所述人脸分类网络进行训练的次数达到第一预设次数。
When the first loss value L cls is greater than the first standard value, the embodiment of the present application adjusts the parameters of the face classification network and re-executes the training of the face classification network using the training image set until the The number of times that the face classification network is trained reaches the first preset number of times.
S3、当所述人脸分类模型的训练次数达到第一预设次数时,利用所述训练图像集对所述人脸分类网络及所述人脸定位网络进行联合训练。S3. When the number of training times of the face classification model reaches a first preset number of times, use the training image set to jointly train the face classification network and the face location network.
本申请实施例利用所述人脸分类网络对所述训练图像集进行分类,生成人脸训练集,并利用所述人脸定位网络对所述人脸训练集进行脸部区域定位,得到脸部区域图像集,并计算所述脸部区域图像集中的人脸尺度集及人脸位置偏移集。进一步地,本申请实施例利用下述联合损失函数计算所述脸部区域图像集与预设脸部区域标签的联合损失值L
det:
The embodiment of the present application uses the face classification network to classify the training image set, generates a face training set, and uses the face localization network to locate the face region of the face training set to obtain a face area image set, and calculate the face scale set and face position offset set in the face area image set. Further, the embodiment of the present application uses the following joint loss function to calculate the joint loss value L det of the face region image set and the preset face region label:
L
det=L
cls+λ
sizeL
size+λ
offL
off
L det =L cls +λ size L size +λ off L off
其中,L
size是人脸尺度损失值,|A∪B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相交的面积,|A∩B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相并的面积,|A
c|是所述人脸尺度集中图片与所述真实尺度集中图片之间的最小闭包的面积,L
off为人脸位置偏移损失值,x是第K个真实位置偏移与人脸位置偏移的差值,此外,λ
size及λ
off为预设权重,本申请实施例中,所述λ
size=1,以及所述λ
off=0.1。
Wherein, L size is the loss value of face scale, |A∪B| is the area of intersection between the picture in the face scale set and the picture in the real scale set, and |A∩B| is the picture in the face scale set The area merged with the pictures in the true scale set, |A c | is the area of the smallest closure between the pictures in the face scale set and the pictures in the true scale set, L off is the face position offset loss value, x is the difference between the Kth real position offset and the face position offset, in addition, λ size and λ off are preset weights, in the embodiment of the present application, the λ size =1, and the λ off = 0.1.
当所述联合损失值L
det大于第二标准值时,本申请实施例调整所述人脸分类网络以及所述人脸定位网络的参数并重新执行利用所述训练图像集对所述人脸分类网络及所述人脸定位网络进行联合训练,直到训练的次数达到第二预设次数。
When the joint loss value L det is greater than the second standard value, the embodiment of the present application adjusts the parameters of the face classification network and the face location network, and re-executes the face classification using the training image set The network and the face location network are jointly trained until the number of times of training reaches a second preset number of times.
S4、当所述人脸分类网络及所述人脸定位网络的联合训练次数达到第二预设次数时,利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。S4. When the number of joint training times of the face classification network and the face location network reaches a second preset number of times, use the training image set to perform a The living body detection network is jointly trained, and the trained face living body judgment model including the face classification network, the face localization network and the living body detection network is obtained.
详细地,所述S4包括:In detail, the S4 includes:
利用所述人脸分类网络对所述训练图像集进行分类,得到人脸训练集,计算所述人脸训练集和预设的真实标签之间的第一损失值;Use the face classification network to classify the training image set to obtain a face training set, and calculate the first loss value between the face training set and a preset real label;
利用所述人脸定位网络对所述人脸训练集进行定位,得到脸部区域训练图,并计算所述脸部区域训练图的人脸尺度集和人脸位置偏移集,分别计算所述人脸尺度集和预设的真实尺度集之间的第二损失值及计算所述人脸位置偏移集和预设的真实位置偏移集之间的第三损失值;利用所述活体检测网络对所述训练图像集进行检测,得到预测活体检测集,计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值;Use the face localization network to locate the face training set to obtain a face region training map, and calculate the face scale set and face position offset set of the face region training map, and calculate the The second loss value between the face scale set and the preset real scale set and the third loss value between the face position offset set and the preset real position offset set are calculated; using the living body detection The network detects the training image set to obtain a predicted living body detection set, and calculates a fourth loss value between the predicted living body detection set and a preset real living body detection set;
利用预设的权重对所述第一损失值、第二损失值、第三损失值和第四损失值进行串联处理,得到联合损失值,若所述联合损失值大于预设的阈值时,对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行调整更新,直到所述联合损失值小于或者等于预设的阈值时,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。The first loss value, the second loss value, the third loss value and the fourth loss value are processed in series by using a preset weight to obtain a joint loss value. If the joint loss value is greater than the preset threshold, the The face classification network, the face location network, and the living body detection network are adjusted and updated until the joint loss value is less than or equal to a preset threshold, and the training completed includes the face classification network, The face positioning network and the face living body judgment model of the living body detection network.
同上所述,所述计算所述人脸训练集和预设的真实标签之间的第一损失值,包括:As described above, the calculation of the first loss value between the face training set and the preset real label includes:
利用如下第一损失函数计算所述第一损失值:The first loss value is calculated using the following first loss function:
其中,α和β是第一损失函数的超参数,Y
x,y表示所述真实标签中坐标(x,y)的灰度值,
表示所述人脸训练集中坐标(x,y)的灰度值,N为所述人脸训练集中的样本数量。
where α and β are the hyperparameters of the first loss function, Y x, y represent the gray value of coordinates (x, y) in the true label, represents the gray value of the coordinates (x, y) in the face training set, and N is the number of samples in the face training set.
进一步地,同上所述所述计算所述人脸尺度集和预设的真实尺度集之间的第二损失值,包括:Further, calculating the second loss value between the face scale set and the preset real scale set as described above, including:
利用如下第二损失函数计算所述第二损失值L
size:
The second loss value L size is calculated using the following second loss function:
其中,|A∪B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相交的面积,|A∩B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相并的面积,|A
c|是所述人脸尺度集中图片与所述真实尺度集中图片之间的最小闭包的面积。
Wherein, |A∪B| is the intersection area between the picture in the face scale set and the picture in the real scale set, and |A∩B| is the area between the picture in the face scale set and the picture in the real scale set The combined area, |A c | is the area of the smallest closure between the picture in the face scale set and the picture in the true scale set.
进一步地,同上所述,所述计算人脸位置偏移集和预设的真实位置偏移集之间的第三损失值,包括:Further, as described above, the calculation of the third loss value between the face position offset set and the preset real position offset set includes:
利用如下第三损失函数计算所述第三损失值L
off:
The third loss value L off is calculated using the following third loss function:
其中,x是第K个真实位置偏移与人脸位置偏移的差值,M为真实中心偏移量图的样本数。Among them, x is the difference between the Kth real position offset and the face position offset, and M is the number of samples of the real center offset map.
进一步地,所述计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值,包括:Further, the calculating the fourth loss value between the predicted live detection set and the preset real live detection set includes:
其中,
为所述预测活体检测集,Y为所述真实活体检测集,Q为所述预测活体检测集的样本数量,λ表示误差因子。
in, is the predicted live detection set, Y is the real live detection set, Q is the number of samples in the predicted live detection set, and λ represents an error factor.
具体地,所述利用预设的权重对所述第一损失值、第二损失值、第三损失值和第四损失值进行串联处理,得到联合损失值,包括:Specifically, performing series processing on the first loss value, the second loss value, the third loss value and the fourth loss value by using a preset weight to obtain a joint loss value, including:
其中,L为联合损失值,λ
size,λ
off为预设的权重,可以分别取值为1和0.1。
Among them, L is the joint loss value, λ size , λ off are preset weights, which can be 1 and 0.1 respectively.
将所述联合损失值与预设的阈值进行比较,若所述联合损失值大于预设的阈值时,对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行调整更新,直到所述联合损失值小于或者等于预设的阈值时,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。Compare the joint loss value with a preset threshold, and if the joint loss value is greater than the preset threshold, adjust and update the face classification network, the face location network, and the living body detection network , until the joint loss value is less than or equal to a preset threshold, a trained face living body judgment model including the face classification network, the face localization network and the living body detection network is obtained.
参阅图2所示,为本申请实施例提供的利用训练完成的模型对待检测图像集执行活体检测方法的流程示意图。本申请实施例中,所述活体检测方法包括:Referring to FIG. 2 , it is a schematic flowchart of a method for performing living body detection using a trained model to be detected image set according to an embodiment of the present application. In the embodiment of the present application, the method for detecting a living body includes:
S10、获取待检测图像集,利用所述人脸分类网络对所述待检测图像集进行分类处理, 筛选得到人脸图像集。S10. Acquire a set of images to be detected, use the face classification network to classify the set of images to be detected, and filter to obtain a set of face images.
本申请实施例中,所述待检测图像集中可以包括摄像头拍摄的人脸视频中的视频帧。本申请其中一个实施例中,所述待检测图像集等可以存储在区块链节点中。In this embodiment of the present application, the image set to be detected may include video frames in a face video captured by a camera. In one of the embodiments of the present application, the set of images to be detected and the like may be stored in a blockchain node.
S20、利用所述人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集。S20, using the face localization network to perform a face localization operation on the face image set to obtain a face region image set.
本申请实施例中,利用人脸定位模型对所述人脸图像集进行人脸定位操作,得到所述人脸尺度集和所述人脸位置偏移集,所述人脸尺度集用于确定所述人脸图像集中人脸区域的大概位置,所述人脸位置偏移量用于对所述人脸尺度集微调,最后得到脸部区域图像集。In the embodiment of the present application, a face localization operation is performed on the face image set by using a face localization model to obtain the face scale set and the face position offset set, and the face scale set is used to determine The approximate position of the face region in the face image set, the face position offset is used to fine-tune the face scale set, and finally a face region image set is obtained.
S30、利用所述活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果。S30. Use the living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results.
本申请实施例中,将所述脸部区域图像集输入至所述活体检测网络进行活体检测处理,得到多个检测结果,其中,所述检测结果为经过所述活体检测网络检测处理后判断为活体的概率值。In the embodiment of the present application, the face region image set is input into the living body detection network for living body detection processing, and multiple detection results are obtained, wherein the detection results are determined as The probability value of living body.
S40、将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。S40. Perform a weighted average on the multiple detection results to obtain a living body detection result of the image set to be detected.
本申请实施例中,利用预设的加权公式对所述多个检测结果执行加权平均,包括:In the embodiment of the present application, the weighted average is performed on the multiple detection results by using a preset weighting formula, including:
P(cls)=a*RA
cls+b*Re
cls+c*Rd
cls
P(cls)=a*RA cls +b*Re cls +c*Rd cls
其中,P(cls)为检测概率值,RA
cls、Re
cls和Rd
cls为经过所述活体检测网络检测处理后判断为活体的概率值,a、b和c为预设的权重。
Wherein, P(cls) is the detection probability value, RA cls , Re cls and Rd cls are the probability values that are determined to be living bodies after being detected and processed by the living body detection network, and a, b and c are preset weights.
具体地,结合预设的判定公式将所述检测概率值与预设的检测阈值进行比较,得到所述待检测图像集的活体检测结果,包括:Specifically, the detection probability value is compared with a preset detection threshold value in combination with a preset determination formula to obtain a living body detection result of the to-be-detected image set, including:
所述判定公式为:The determination formula is:
其中,y为判定结果,N为预设的检测阈值。Wherein, y is the determination result, and N is the preset detection threshold.
优选地,本申请实施例中,N为0.65。Preferably, in the embodiment of the present application, N is 0.65.
本申请实施例通过对待检测图像集进行获取检测之前,先通过人脸分类网络及人脸定位网络从待检测图像集中筛选出具有人脸的人脸图像集,并进一步从所述人脸图像集中定位到脸部区域图像集,利用活体检测网络对所述脸部区域图像集进行活体检测处理可以较少活体检测中消耗的计算资源,并可以提高活体检测准确率。因此,本申请提出的活体检测方法、装置及计算机可读存储介质,可以提高活体检测方法的效率,解决传统图像识别算法进行活体检测时消耗大量计算资源且准确率较低的问题。In this embodiment of the present application, before acquiring and detecting the image set to be detected, a face image set with faces is selected from the set of images to be detected through a face classification network and a face localization network, and further positioning is performed from the set of face images. As for the face area image set, using the living body detection network to perform the living body detection processing on the face area image set can reduce the computational resources consumed in the living body detection, and can improve the accuracy of the living body detection. Therefore, the living body detection method, device and computer-readable storage medium proposed in the present application can improve the efficiency of the living body detection method, and solve the problems that traditional image recognition algorithms consume a lot of computing resources and have low accuracy when performing living body detection.
如图3所示,是本申请实施例提供的活体检测装置的模块示意图。As shown in FIG. 3 , it is a schematic diagram of a module of a living body detection device provided by an embodiment of the present application.
本申请所述活体检测装置100可以安装于电子设备中。根据实现的功能,所述活体检测装置100可以包括人脸分类模块101、人脸定位模块102、活体检测模块103、结果生成模块104。本申请所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。The living body detection apparatus 100 described in the present application may be installed in an electronic device. According to the implemented functions, the living body detection apparatus 100 may include a face classification module 101 , a face positioning module 102 , a living body detection module 103 , and a result generation module 104 . The modules described in this application may also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can perform fixed functions, and are stored in the memory of the electronic device.
在本实施例中,关于各模块/单元的功能如下:In this embodiment, the functions of each module/unit are as follows:
所述人脸分类模块101,用于获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;The face classification module 101 is used to obtain a set of images to be detected, and to perform classification processing on the set of images to be detected by using a face classification network, and to obtain a set of face images after screening;
所述人脸定位模块102,用于利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;The face location module 102 is configured to use a face location network to perform a face location operation on the face image set to obtain a face area image set;
所述活体检测模块103,用于利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;The living body detection module 103 is configured to use a living body detection network to perform a living body detection process on the face region image set to obtain multiple detection results;
所述结果生成模块104,用于将所述多个检测结果执行加权平均,得到所述待检测图 像集的活体检测结果。The result generation module 104 is configured to perform a weighted average of the multiple detection results to obtain a living body detection result of the image set to be detected.
本申请实施例中,所述活体检测装置100中的各个模块在使用时,可以实现如图2所示的所述活体检测方法,并产生相同的有益效果,这里不再赘述。In the embodiment of the present application, when each module in the living body detection apparatus 100 is used, the living body detection method shown in FIG. 2 can be implemented, and the same beneficial effects can be produced, which will not be repeated here.
如图4所示,是本申请实现活体检测方法的电子设备的结构示意图。As shown in FIG. 4 , it is a schematic structural diagram of an electronic device implementing the method for detecting a living body of the present application.
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如活体检测程序12。The electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a living body detection program 12.
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如活体检测程序12的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 . In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as codes of the living body detection program 12 , etc., but also can be used to temporarily store data that has been output or will be output.
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如执行活体检测程序等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。In some embodiments, the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits. Central Processing Unit (CPU), microprocessor, digital processing chip, graphics processor and combination of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing the program or module (for example, executing the program) stored in the memory 11. living body detection program, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。The bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. The bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
图4仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management The device implements functions such as charge management, discharge management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。Further, the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。Optionally, the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like. The display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the embodiments are only used for illustration, and are not limited by this structure in the scope of the patent application.
所述电子设备1中的所述存储器11存储的活体检测程序12是多个指令的组合,在所述处理器10中运行时,可以实现:The living body detection program 12 stored in the memory 11 in the electronic device 1 is a combination of multiple instructions, and when running in the processor 10, can realize:
获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;
利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;
将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的,例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。Further, if the modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. The computer-readable storage medium may be volatile or non-volatile, for example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U Disk, removable hard disk, magnetic disk, CD-ROM, computer memory, read-only memory (ROM, Read-Only Memory).
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质可以是易失性的,也可以是非易失性的,所述可读存储介质,所述可读存储介质存储有计算机程序,所述计算机程序在被电子设备的处理器所执行时,可以实现:The present application also provides a computer-readable storage medium, the computer-readable storage medium may be volatile or non-volatile, and the readable storage medium stores a computer A program, when the computer program is executed by the processor of the electronic device, it can realize:
获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;
利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;
利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;
将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
进一步地,所述计算机可用存储介质可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。Further, the computer-usable storage medium may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required by at least one function, and the like; using the created data, etc.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division manners in actual implementation.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。It will be apparent to those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application.
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图表记视为限制所涉及的权利要求。Accordingly, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the application is to be defined by the appended claims rather than the foregoing description, which is therefore intended to fall within the scope of the claims. All changes within the meaning and scope of the equivalents of , are included in this application. Any accompanying reference signs in the claims should not be construed as limiting the involved claims.
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. Several units or means recited in the system claims can also be realized by one unit or means by means of software or hardware. Second-class terms are used to denote names and do not denote any particular order.
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application rather than limitations. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present application.
Claims (22)
- 一种活体检测方法,其中,所述方法包括:A method for detecting a living body, wherein the method comprises:获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- 如权利要求1所述的活体检测方法,其中,所述获取待检测图像集之前,所述方法还包括:The living body detection method according to claim 1, wherein, before the acquisition of the image set to be detected, the method further comprises:构建包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型;constructing a face living body judgment model including the face classification network, the face positioning network and the living body detection network;利用训练图像集对所述人脸分类网络进行训练;using the training image set to train the face classification network;当所述人脸分类模型的训练次数达到第一预设次数时,利用所述训练图像集对所述人脸分类网络及所述人脸定位网络进行联合训练;When the number of training times of the face classification model reaches a first preset number of times, use the training image set to jointly train the face classification network and the face location network;当所述人脸分类网络及所述人脸定位网络的联合训练次数达到第二预设次数时,利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。When the number of joint training times of the face classification network and the face location network reaches a second preset number of times, the face classification network, the face location network and the living body are analyzed using the training image set. The detection network is jointly trained, and a trained face living body judgment model including the face classification network, the face localization network and the living body detection network is obtained.
- 如权利要求2所述的活体检测方法,其中,所述利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型,包括:The living body detection method according to claim 2, wherein the joint training of the face classification network, the face localization network and the living body detection network is performed by using the training image set, and the obtained training completed comprises: The face living body judgment model of the face classification network, the face positioning network and the living body detection network, including:利用所述人脸分类网络对所述训练图像集进行分类,得到人脸训练集,计算所述人脸训练集和预设的真实标签之间的第一损失值;Use the face classification network to classify the training image set to obtain a face training set, and calculate the first loss value between the face training set and a preset real label;利用所述人脸定位网络对所述人脸训练集进行定位,得到脸部区域训练图,并计算所述脸部区域训练图的人脸尺度集和人脸位置偏移集,分别计算所述人脸尺度集和预设的真实尺度集之间的第二损失值及计算所述人脸位置偏移集和预设的真实位置偏移集之间的第三损失值;Use the face localization network to locate the face training set to obtain a face region training map, and calculate the face scale set and face position offset set of the face region training map, and calculate the the second loss value between the face scale set and the preset real scale set and calculating the third loss value between the face position offset set and the preset real position offset set;利用所述活体检测网络对所述脸部区域训练图进行检测,得到预测活体检测集,计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值;Use the living body detection network to detect the face region training map to obtain a predicted live body detection set, and calculate a fourth loss value between the predicted live body detection set and a preset real live body detection set;利用预设的权重对所述第一损失值、第二损失值、第三损失值和第四损失值进行串联处理,得到联合损失值;The first loss value, the second loss value, the third loss value and the fourth loss value are processed in series by using a preset weight to obtain a joint loss value;若所述联合损失值大于预设的阈值时,对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行调整更新,直到所述联合损失值小于或者等于预设的阈值时,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。If the joint loss value is greater than a preset threshold, adjust and update the face classification network, the face location network and the living body detection network until the joint loss value is less than or equal to the preset threshold When the training is completed, the face living body judgment model including the face classification network, the face positioning network and the living body detection network is obtained.
- 如权利要求3所述的活体检测方法,其中,所述计算所述人脸训练集和预设的真实标签之间的第一损失值,包括:The method for living body detection according to claim 3, wherein the calculating the first loss value between the face training set and a preset real label comprises:利用如下第一损失函数计算所述第一损失值L c: The first loss value L c is calculated using the following first loss function:其中,α和β是第一损失函数的超参数,Y x,y表示所述真实标签中坐标(x,y)的灰度值, 表示所述人脸训练集中坐标(x,y)的灰度值,N为所述人脸训练集中的样本数量。 where α and β are the hyperparameters of the first loss function, Y x, y represent the gray value of coordinates (x, y) in the true label, represents the gray value of the coordinates (x, y) in the face training set, and N is the number of samples in the face training set.
- 如权利要求3所述的活体检测方法,其中,所述计算所述人脸尺度集和预设的真实尺度集之间的第二损失值,包括:The liveness detection method according to claim 3, wherein the calculating the second loss value between the face scale set and the preset real scale set comprises:利用如下第二损失函数计算所述第二损失值L size: The second loss value L size is calculated using the following second loss function:其中,|A∪B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相交的面积,|A∩B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相并的面积,|A c|是所述人脸尺度集中图片与所述真实尺度集中图片之间的最小闭包的面积。 Wherein, |A∪B| is the intersection area between the picture in the face scale set and the picture in the real scale set, and |A∩B| is the area between the picture in the face scale set and the picture in the real scale set The combined area, |A c | is the area of the smallest closure between the picture in the face scale set and the picture in the true scale set.
- 如权利要求3所述的活体检测方法,其中,所述计算人脸位置偏移集和预设的真实位置偏移集之间的第三损失值,包括:The living body detection method according to claim 3, wherein the calculating the third loss value between the face position offset set and the preset real position offset set comprises:利用如下第三损失函数计算所述第三损失值L off: The third loss value L off is calculated using the following third loss function:其中,x是第K个真实位置偏移与人脸位置偏移的差值,M为真实中心偏移量图的样本数。Among them, x is the difference between the Kth real position offset and the face position offset, and M is the number of samples of the real center offset map.
- 如权利要求3所述的活体检测方法,其中,所述计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值,包括:The method of living body detection according to claim 3, wherein the calculating a fourth loss value between the predicted living body detection set and the preset real living body detection set comprises:
- 一种活体检测装置,其中,所述装置包括:A living body detection device, wherein the device comprises:人脸分类模块,用于获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;a face classification module, used to obtain a set of images to be detected, and to classify and process the set of images to be detected by using a face classification network, and to obtain a set of face images after screening;人脸定位模块,用于利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;a face localization module, used for using a face localization network to perform a face localization operation on the face image set to obtain a face region image set;活体检测模块,用于利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;a living body detection module, configured to perform living body detection processing on the face region image set by using a living body detection network to obtain multiple detection results;结果生成模块,用于将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。The result generating module is configured to perform a weighted average of the multiple detection results to obtain the living body detection result of the image set to be detected.
- 一种电子设备,其中,所述电子设备包括:An electronic device, wherein the electronic device comprises:至少一个处理器;以及,at least one processor; and,与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,所述存储器存储有可被所述至少一个处理器执行的计算机程序指令,所述计算机程序指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:The memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the steps of:获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到 人脸图像集;Obtaining an image set to be detected, using a face classification network to classify the image set to be detected, and screening to obtain a face image set;利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- 如权利要求9所述的电子设备,其中,所述获取待检测图像集之前,所述方法还包括:The electronic device according to claim 9, wherein, before acquiring the image set to be detected, the method further comprises:构建包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型;constructing a face living body judgment model including the face classification network, the face positioning network and the living body detection network;利用训练图像集对所述人脸分类网络进行训练;using the training image set to train the face classification network;当所述人脸分类模型的训练次数达到第一预设次数时,利用所述训练图像集对所述人脸分类网络及所述人脸定位网络进行联合训练;When the number of training times of the face classification model reaches a first preset number of times, use the training image set to jointly train the face classification network and the face location network;当所述人脸分类网络及所述人脸定位网络的联合训练次数达到第二预设次数时,利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。When the number of joint training times of the face classification network and the face location network reaches a second preset number of times, the face classification network, the face location network and the living body are analyzed using the training image set. The detection network is jointly trained, and a trained face living body judgment model including the face classification network, the face localization network and the living body detection network is obtained.
- 如权利要求10所述的电子设备,其中,所述利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型,包括:The electronic device according to claim 10, wherein the joint training is performed on the face classification network, the face localization network and the living body detection network by using the training image set, and the obtained training completed includes all the The face living body judgment model of the face classification network, the face positioning network and the living body detection network, including:利用所述人脸分类网络对所述训练图像集进行分类,得到人脸训练集,计算所述人脸训练集和预设的真实标签之间的第一损失值;Use the face classification network to classify the training image set to obtain a face training set, and calculate the first loss value between the face training set and a preset real label;利用所述人脸定位网络对所述人脸训练集进行定位,得到脸部区域训练图,并计算所述脸部区域训练图的人脸尺度集和人脸位置偏移集,分别计算所述人脸尺度集和预设的真实尺度集之间的第二损失值及计算所述人脸位置偏移集和预设的真实位置偏移集之间的第三损失值;Use the face localization network to locate the face training set to obtain a face region training map, and calculate the face scale set and face position offset set of the face region training map, and calculate the the second loss value between the face scale set and the preset real scale set and calculating the third loss value between the face position offset set and the preset real position offset set;利用所述活体检测网络对所述脸部区域训练图进行检测,得到预测活体检测集,计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值;Use the living body detection network to detect the face region training map to obtain a predicted live body detection set, and calculate a fourth loss value between the predicted live body detection set and a preset real live body detection set;利用预设的权重对所述第一损失值、第二损失值、第三损失值和第四损失值进行串联处理,得到联合损失值;The first loss value, the second loss value, the third loss value and the fourth loss value are processed in series by using a preset weight to obtain a joint loss value;若所述联合损失值大于预设的阈值时,对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行调整更新,直到所述联合损失值小于或者等于预设的阈值时,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。If the joint loss value is greater than a preset threshold, adjust and update the face classification network, the face location network and the living body detection network until the joint loss value is less than or equal to the preset threshold When the training is completed, the face living body judgment model including the face classification network, the face positioning network and the living body detection network is obtained.
- 如权利要求11所述的电子设备,其中,所述计算所述人脸训练集和预设的真实标签之间的第一损失值,包括:The electronic device according to claim 11, wherein the calculating a first loss value between the face training set and a preset real label comprises:利用如下第一损失函数计算所述第一损失值L c: The first loss value L c is calculated using the following first loss function:其中,α和β是第一损失函数的超参数,Y x,y表示所述真实标签中坐标(x,y)的灰度值, 表示所述人脸训练集中坐标(x,y)的灰度值,N为所述人脸训练集中的样本数量。 where α and β are the hyperparameters of the first loss function, Y x, y represent the gray value of coordinates (x, y) in the true label, represents the gray value of the coordinates (x, y) in the face training set, and N is the number of samples in the face training set.
- 如权利要求11所述的电子设备,其中,所述计算所述人脸尺度集和预设的真实尺度集之间的第二损失值,包括:The electronic device according to claim 11, wherein the calculating a second loss value between the face scale set and a preset real scale set comprises:利用如下第二损失函数计算所述第二损失值L size: The second loss value L size is calculated using the following second loss function:其中,|A∪B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相交的面积,|A∩B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相并的面积,|A c|是所述人脸尺度集中图片与所述真实尺度集中图片之间的最小闭包的面积。 Wherein, |A∪B| is the intersection area between the picture in the face scale set and the picture in the real scale set, and |A∩B| is the area between the picture in the face scale set and the picture in the real scale set The combined area, |A c | is the area of the smallest closure between the picture in the face scale set and the picture in the true scale set.
- 如权利要求11所述的电子设备,其中,所述计算人脸位置偏移集和预设的真实位置偏移集之间的第三损失值,包括:The electronic device according to claim 11, wherein the calculating the third loss value between the face position offset set and the preset real position offset set comprises:利用如下第三损失函数计算所述第三损失值L off: The third loss value L off is calculated using the following third loss function:其中,x是第K个真实位置偏移与人脸位置偏移的差值,M为真实中心偏移量图的样本数。Among them, x is the difference between the Kth real position offset and the face position offset, and M is the number of samples of the real center offset map.
- 如权利要求11所述的电子设备,其中,所述计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值,包括:The electronic device of claim 11, wherein the calculating a fourth loss value between the predicted liveness detection set and a preset real liveness detection set comprises:
- 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium storing a computer program, wherein the computer program implements the following steps when executed by a processor:获取待检测图像集,利用人脸分类网络对所述待检测图像集进行分类处理,筛选得到人脸图像集;Obtaining a set of images to be detected, using a face classification network to classify the set of images to be detected, and screening to obtain a set of face images;利用人脸定位网络对所述人脸图像集执行人脸定位操作,得到脸部区域图像集;Use a face localization network to perform a face localization operation on the face image set to obtain a face region image set;利用活体检测网络对所述脸部区域图像集进行活体检测处理,得到多个检测结果;Using a living body detection network to perform living body detection processing on the face region image set to obtain multiple detection results;将所述多个检测结果执行加权平均,得到所述待检测图像集的活体检测结果。A weighted average is performed on the multiple detection results to obtain a living body detection result of the image set to be detected.
- 如权利要求16所述的计算机可读存储介质,其中,所述获取待检测图像集之前,所述方法还包括:The computer-readable storage medium of claim 16, wherein before the acquiring the image set to be detected, the method further comprises:构建包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型;constructing a face living body judgment model including the face classification network, the face positioning network and the living body detection network;利用训练图像集对所述人脸分类网络进行训练;using the training image set to train the face classification network;当所述人脸分类模型的训练次数达到第一预设次数时,利用所述训练图像集对所述人脸分类网络及所述人脸定位网络进行联合训练;When the number of training times of the face classification model reaches a first preset number of times, use the training image set to jointly train the face classification network and the face location network;当所述人脸分类网络及所述人脸定位网络的联合训练次数达到第二预设次数时,利用所述训练图像集对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。When the number of joint training times of the face classification network and the face location network reaches a second preset number of times, the face classification network, the face location network and the living body are analyzed using the training image set. The detection network is jointly trained, and a trained face living body judgment model including the face classification network, the face localization network and the living body detection network is obtained.
- 如权利要求17所述的计算机可读存储介质,其中,所述利用所述训练图像集对 所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行联合训练,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型,包括:The computer-readable storage medium according to claim 17, wherein the joint training of the face classification network, the face localization network and the living body detection network is performed by using the training image set, and the training is completed. The face living body judgment model including the face classification network, the face localization network and the living body detection network, including:利用所述人脸分类网络对所述训练图像集进行分类,得到人脸训练集,计算所述人脸训练集和预设的真实标签之间的第一损失值;Use the face classification network to classify the training image set to obtain a face training set, and calculate the first loss value between the face training set and a preset real label;利用所述人脸定位网络对所述人脸训练集进行定位,得到脸部区域训练图,并计算所述脸部区域训练图的人脸尺度集和人脸位置偏移集,分别计算所述人脸尺度集和预设的真实尺度集之间的第二损失值及计算所述人脸位置偏移集和预设的真实位置偏移集之间的第三损失值;Use the face localization network to locate the face training set to obtain a face region training map, and calculate the face scale set and face position offset set of the face region training map, and calculate the the second loss value between the face scale set and the preset real scale set and calculating the third loss value between the face position offset set and the preset real position offset set;利用所述活体检测网络对所述脸部区域训练图进行检测,得到预测活体检测集,计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值;Use the living body detection network to detect the face region training map to obtain a predicted live body detection set, and calculate a fourth loss value between the predicted live body detection set and a preset real live body detection set;利用预设的权重对所述第一损失值、第二损失值、第三损失值和第四损失值进行串联处理,得到联合损失值;The first loss value, the second loss value, the third loss value and the fourth loss value are processed in series by using a preset weight to obtain a joint loss value;若所述联合损失值大于预设的阈值时,对所述人脸分类网络、所述人脸定位网络以及所述活体检测网络进行调整更新,直到所述联合损失值小于或者等于预设的阈值时,得到训练完成的包括所述人脸分类网络、所述人脸定位网络以及所述活体检测网络的人脸活体判断模型。If the joint loss value is greater than a preset threshold, adjust and update the face classification network, the face location network and the living body detection network until the joint loss value is less than or equal to the preset threshold When the training is completed, the face living body judgment model including the face classification network, the face positioning network and the living body detection network is obtained.
- 如权利要求18所述的计算机可读存储介质,其中,所述计算所述人脸训练集和预设的真实标签之间的第一损失值,包括:The computer-readable storage medium of claim 18, wherein the calculating a first loss value between the face training set and a preset real label comprises:利用如下第一损失函数计算所述第一损失值L c: The first loss value L c is calculated using the following first loss function:其中,α和β是第一损失函数的超参数,Y x,y表示所述真实标签中坐标(x,y)的灰度值, 表示所述人脸训练集中坐标(x,y)的灰度值,N为所述人脸训练集中的样本数量。 where α and β are the hyperparameters of the first loss function, Y x, y represent the gray value of coordinates (x, y) in the true label, represents the gray value of the coordinates (x, y) in the face training set, and N is the number of samples in the face training set.
- 如权利要求18所述的计算机可读存储介质,其中,所述计算所述人脸尺度集和预设的真实尺度集之间的第二损失值,包括:The computer-readable storage medium of claim 18, wherein the calculating a second loss value between the face scale set and a preset real scale set comprises:利用如下第二损失函数计算所述第二损失值L size: The second loss value L size is calculated using the following second loss function:其中,|A∪B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相交的面积,|A∩B|是所述人脸尺度集中图片与所述真实尺度集中图片之间相并的面积,|A c|是所述人脸尺度集中图片与所述真实尺度集中图片之间的最小闭包的面积。 Wherein, |A∪B| is the intersection area between the picture in the face scale set and the picture in the real scale set, and |A∩B| is the area between the picture in the face scale set and the picture in the real scale set The combined area, |A c | is the area of the smallest closure between the picture in the face scale set and the picture in the true scale set.
- 如权利要求18所述的计算机可读存储介质,其中,所述计算人脸位置偏移集和预设的真实位置偏移集之间的第三损失值,包括:The computer-readable storage medium of claim 18, wherein the calculating a third loss value between the set of face position offsets and a preset set of real position offsets comprises:利用如下第三损失函数计算所述第三损失值L off: The third loss value L off is calculated using the following third loss function:其中,x是第K个真实位置偏移与人脸位置偏移的差值,M为真实中心偏移量图的样本数。Among them, x is the difference between the Kth real position offset and the face position offset, and M is the number of samples of the real center offset map.
- 如权利要求18所述的计算机可读存储介质,其中,所述计算所述预测活体检测集和预设的真实活体检测集之间的第四损失值,包括:The computer-readable storage medium of claim 18, wherein the calculating a fourth loss value between the predicted liveness detection set and a preset real liveness detection set comprises:
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011508401.XA CN112528908B (en) | 2020-12-18 | 2020-12-18 | Living body detection method, living body detection device, electronic equipment and storage medium |
CN202011508401.X | 2020-12-18 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022126914A1 true WO2022126914A1 (en) | 2022-06-23 |
Family
ID=75001867
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/083721 WO2022126914A1 (en) | 2020-12-18 | 2021-03-30 | Living body detection method and apparatus, electronic device, and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112528908B (en) |
WO (1) | WO2022126914A1 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112528908B (en) * | 2020-12-18 | 2024-06-28 | 平安科技(深圳)有限公司 | Living body detection method, living body detection device, electronic equipment and storage medium |
CN113159202B (en) * | 2021-04-28 | 2023-09-26 | 平安科技(深圳)有限公司 | Image classification method, device, electronic equipment and storage medium |
CN113887408B (en) * | 2021-09-30 | 2024-04-23 | 平安银行股份有限公司 | Method, device, equipment and storage medium for detecting activated face video |
CN113688957A (en) * | 2021-10-26 | 2021-11-23 | 苏州浪潮智能科技有限公司 | Target detection method, device, equipment and medium based on multi-model fusion |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020088029A1 (en) * | 2018-10-29 | 2020-05-07 | 北京三快在线科技有限公司 | Liveness detection method, storage medium, and electronic device |
CN111932755A (en) * | 2020-07-02 | 2020-11-13 | 北京市威富安防科技有限公司 | Personnel passage verification method and device, computer equipment and storage medium |
CN111985427A (en) * | 2020-08-25 | 2020-11-24 | 深圳前海微众银行股份有限公司 | Living body detection method, living body detection apparatus, and readable storage medium |
CN112528908A (en) * | 2020-12-18 | 2021-03-19 | 平安科技(深圳)有限公司 | Living body detection method, living body detection device, electronic apparatus, and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106599856A (en) * | 2016-12-19 | 2017-04-26 | 四川长虹电器股份有限公司 | Combined face detection, positioning and identification method |
CN110941986B (en) * | 2019-10-10 | 2023-08-01 | 平安科技(深圳)有限公司 | Living body detection model training method, living body detection model training device, computer equipment and storage medium |
CN111914775B (en) * | 2020-08-06 | 2023-07-28 | 平安科技(深圳)有限公司 | Living body detection method, living body detection device, electronic equipment and storage medium |
-
2020
- 2020-12-18 CN CN202011508401.XA patent/CN112528908B/en active Active
-
2021
- 2021-03-30 WO PCT/CN2021/083721 patent/WO2022126914A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020088029A1 (en) * | 2018-10-29 | 2020-05-07 | 北京三快在线科技有限公司 | Liveness detection method, storage medium, and electronic device |
CN111932755A (en) * | 2020-07-02 | 2020-11-13 | 北京市威富安防科技有限公司 | Personnel passage verification method and device, computer equipment and storage medium |
CN111985427A (en) * | 2020-08-25 | 2020-11-24 | 深圳前海微众银行股份有限公司 | Living body detection method, living body detection apparatus, and readable storage medium |
CN112528908A (en) * | 2020-12-18 | 2021-03-19 | 平安科技(深圳)有限公司 | Living body detection method, living body detection device, electronic apparatus, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112528908B (en) | 2024-06-28 |
CN112528908A (en) | 2021-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022126914A1 (en) | Living body detection method and apparatus, electronic device, and storage medium | |
WO2022116423A1 (en) | Object posture estimation method and apparatus, and electronic device and computer storage medium | |
WO2022048209A1 (en) | License plate recognition method and apparatus, electronic device, and storage medium | |
WO2022105179A1 (en) | Biological feature image recognition method and apparatus, and electronic device and readable storage medium | |
US10395094B2 (en) | Method and apparatus for detecting glasses in a face image | |
WO2021189911A1 (en) | Target object position detection method and apparatus based on video stream, and device and medium | |
WO2018212809A1 (en) | Efficient image analysis using environment sensor data | |
WO2022021029A1 (en) | Detection model training method and device, detection model using method and storage medium | |
CN112507934A (en) | Living body detection method, living body detection device, electronic apparatus, and storage medium | |
WO2021147113A1 (en) | Plane semantic category identification method and image data processing apparatus | |
WO2021151338A1 (en) | Medical imagery analysis method, apparatus, electronic device and readable storage medium | |
WO2021189913A1 (en) | Method and apparatus for target object segmentation in image, and electronic device and storage medium | |
WO2012139271A1 (en) | Smile detection techniques | |
CN112445922A (en) | Picture processing method and device | |
CN111309825A (en) | Data clustering storage method and device and computer readable storage medium | |
JP6351243B2 (en) | Image processing apparatus and image processing method | |
WO2022095359A1 (en) | Anti-screen-capturing-based information security protection method and apparatus, electronic device and medium | |
CN111598149B (en) | Loop detection method based on attention mechanism | |
CN112100425A (en) | Label labeling method and device based on artificial intelligence, electronic equipment and medium | |
CN112507923A (en) | Certificate copying detection method and device, electronic equipment and medium | |
CN113705460A (en) | Method, device and equipment for detecting opening and closing of eyes of human face in image and storage medium | |
CN113190703A (en) | Intelligent retrieval method and device for video image, electronic equipment and storage medium | |
CN108154130B (en) | Target image detection method and device, storage medium and robot | |
CN112528903B (en) | Face image acquisition method and device, electronic equipment and medium | |
CN111008634B (en) | Character recognition method and character recognition device based on instance segmentation |
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: 21904854 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21904854 Country of ref document: EP Kind code of ref document: A1 |