CN106169075A - Auth method and device - Google Patents
Auth method and device Download PDFInfo
- Publication number
- CN106169075A CN106169075A CN201610543529.7A CN201610543529A CN106169075A CN 106169075 A CN106169075 A CN 106169075A CN 201610543529 A CN201610543529 A CN 201610543529A CN 106169075 A CN106169075 A CN 106169075A
- Authority
- CN
- China
- Prior art keywords
- facial
- image
- face
- elements
- images
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/30—Authentication, i.e. establishing the identity or authorisation of security principals
- G06F21/31—User authentication
- G06F21/32—User authentication using biometric data, e.g. fingerprints, iris scans or voiceprints
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/168—Feature extraction; Face representation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/168—Feature extraction; Face representation
- G06V40/169—Holistic features and representations, i.e. based on the facial image taken as a whole
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/168—Feature extraction; Face representation
- G06V40/171—Local features and components; Facial parts ; Occluding parts, e.g. glasses; Geometrical relationships
Landscapes
- Engineering & Computer Science (AREA)
- Oral & Maxillofacial Surgery (AREA)
- Health & Medical Sciences (AREA)
- Theoretical Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Image Analysis (AREA)
- Collating Specific Patterns (AREA)
Abstract
本公开提供了一种身份验证方法及装置,属于人脸识别技术领域。方法包括:获取摄像头实时采集的至少两张人脸图像;对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征;根据所述每张人脸图像中的多个面部元素,确定所述至少两张人脸图像中是否存在指定图像;当所述至少两张人脸图像中至少存在预设数量的所述指定图像时,验证通过。本公开使用包含多个损失函数的验证模型实时采集到的多张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,还能够保证所提取到的多个面部元素和人脸特征的准确度。
The disclosure provides an identity verification method and device, which belong to the technical field of face recognition. The method includes: acquiring at least two face images collected by a camera in real time; performing image processing on each of the collected face images to obtain a plurality of facial elements and face features in each face image; according to the Multiple facial elements in each face image, determine whether there is a designated image in the at least two face images; when there are at least a preset number of the designated images in the at least two face images, verify pass. This disclosure uses a verification model containing multiple loss functions to process multiple face images collected in real time, which can not only output the location information of facial feature points, but also extract multiple facial elements at the same time, avoiding the use of different classifiers The problem of large amount of calculation caused by extracting different facial elements, in addition, can also ensure the accuracy of the extracted multiple facial elements and facial features.
Description
技术领域technical field
本公开涉及人脸识别技术领域,尤其涉及一种身份验证方法及装置。The present disclosure relates to the technical field of face recognition, and in particular to an identity verification method and device.
背景技术Background technique
人脸识别技术是指利用分析比较人脸视觉特征信息进行身份鉴别的计算机技术。广义的人脸识别实际包括构建人脸识别系统的一系列相关技术,包括人脸图像采集、人脸定位、人脸识别预处理、身份验证以及身份查找等;而狭义的人脸识别特指通过人脸进行身份验证或者身份查找的技术或系统。具体地,人脸识别技术是基于人的脸部特征,对输入的人脸图像或者视频流,首先判断图像或视频流中是否存在人脸,如果存在人脸,则进一步检测出每个人脸的位置、大小,以及每个人脸中各个主要面部器官的位置信息。并依据这些信息,进一步提取每个人脸对应的身份特征,并将其与已知的人脸进行对比,从而识别每个人脸对应的身份。Face recognition technology refers to computer technology that uses the analysis and comparison of facial visual feature information for identity identification. Face recognition in a broad sense actually includes a series of related technologies for building a face recognition system, including face image acquisition, face positioning, face recognition preprocessing, identity verification, and identity search; A technology or system for face authentication or identity lookup. Specifically, face recognition technology is based on human facial features. For an input face image or video stream, first judge whether there is a human face in the image or video stream, and if there is a human face, then further detect each face. Position, size, and location information of each major facial organ in each face. Based on this information, the identity features corresponding to each face are further extracted, and compared with known faces, so as to identify the identity corresponding to each face.
随着人脸识别技术的日益成熟,该技术的应用场景也越来越多,如门禁系统、在线身份验证等,该技术应用在门禁系统中能够避免非内部人员的随意进出,应用在在线身份验证中能够确保只有合法用户才能执行相应的在线操作。通过人脸识别技术进行身份验证,具有安全性高的特点,进而能够确保用户信息及财产安全。With the maturity of face recognition technology, there are more and more application scenarios of this technology, such as access control system and online identity verification. Verification can ensure that only legitimate users can perform corresponding online operations. Identity verification through face recognition technology has the characteristics of high security, which can ensure the safety of user information and property.
发明内容Contents of the invention
为克服相关技术中存在的问题,本公开提供一种身份验证方法及装置。In order to overcome the problems existing in related technologies, the present disclosure provides an identity verification method and device.
根据本公开实施例的第一方面,提供一种身份验证方法,包括:According to a first aspect of an embodiment of the present disclosure, an identity verification method is provided, including:
获取摄像头实时采集的至少两张人脸图像;Obtain at least two face images captured by the camera in real time;
对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征;Image processing is performed on each face image collected to obtain a plurality of facial elements and face features in each face image;
根据所述每张人脸图像中的多个面部元素,确定所述至少两张人脸图像中是否存在指定图像,所述指定图像为所述多个面部元素中指定面部元素符合预设标准的人脸图像;According to the plurality of facial elements in each of the facial images, determine whether there is a specified image in the at least two facial images, and the specified image is a specified facial element in the plurality of facial elements that meets a preset standard face image;
当所述至少两张人脸图像中存在所述指定图像时,验证通过。When the specified image exists in the at least two face images, the verification is passed.
通过使用包含多个损失函数的验证模型实时采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,由于验证模型对应的待训练模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度。By using at least two face images collected in real time by a verification model containing multiple loss functions for processing, not only can output the location information of facial feature points, but also extract multiple facial elements at the same time, avoiding the use of different classifiers The problem of large amount of calculation caused by extracting different facial elements. In addition, since the model to be trained corresponding to the verification model contains multiple loss functions, the verification model obtained by training can have higher precision and accuracy, thereby ensuring The accuracy of the extracted multiple facial elements and facial features.
在本公开的第一方面的第一种可能实现方式中,对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征信息,包括:In a first possible implementation of the first aspect of the present disclosure, image processing is performed on each collected face image to obtain multiple facial elements and face feature information in each face image, including :
将所述每张人脸图像输入验证模型,得到所述每张人脸图像的多个面部元素和人脸特征,所述验证模型用于提取人脸图像中的面部元素及分析人脸特征,所述验证模型由卷积神经网络和多个损失函数构成。Each face image is input into a verification model to obtain a plurality of face elements and face features of each face image, and the verification model is used to extract face elements in the face image and analyze face features, The verification model is composed of a convolutional neural network and multiple loss functions.
通过使用包含多个损失函数的验证模型对采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题。By using a verification model containing multiple loss functions to process at least two face images collected, not only can output the location information of facial feature points, but also extract multiple facial elements at the same time, avoiding the use of different classifiers The problem of large amount of calculation caused by extracting different facial elements.
在本公开的第一方面的第二种可能实现方式中,根据所述每张人脸图像中的多个面部元素,检测所述至少两张人脸图像中是否存在指定图像之后,所述方法还包括:In a second possible implementation of the first aspect of the present disclosure, after detecting whether a specified image exists in the at least two face images according to the plurality of facial elements in each face image, the method Also includes:
获取所述至少两张人脸图像中的所述指定图像的图像数量;Acquiring the number of images of the specified image in the at least two face images;
检测所述图像数量是否大于预设数量;Detecting whether the number of images is greater than a preset number;
当所述图像数量大于所述预设数量时,验证通过;When the number of images is greater than the preset number, the verification is passed;
当所述图像数量不大于所述预设数量时,验证不通过。When the number of images is not greater than the preset number, the verification fails.
在本公开的第一方面的第三种可能实现方式中,所述多个面部元素至少包括眼部状态信息、嘴部状态信息、头部状态信息、鼻部状态信息。In a third possible implementation manner of the first aspect of the present disclosure, the plurality of facial elements at least include eye state information, mouth state information, head state information, and nose state information.
通过获取多个面部元素,能够避免使用单一面部元素造成验证结果不准确或准确性低的问题,同时还能够提高本公开所提供的身份验证方法的适用场景。By acquiring multiple facial elements, the problem of inaccurate or low verification results caused by using a single facial element can be avoided, and at the same time, the applicable scenarios of the identity verification method provided by the present disclosure can be improved.
在本公开的第一方面的第四种可能实现方式中,所述多个损失函数至少包括用于检测眼部状态的第一损失函数、用于检测嘴部状态的第二损失函数和用于检测头部状态的第三损失函数。In a fourth possible implementation manner of the first aspect of the present disclosure, the plurality of loss functions include at least a first loss function for detecting the state of the eyes, a second loss function for detecting the state of the mouth, and a second loss function for detecting the state of the mouth. A third loss function to detect the state of the head.
通过使用不同损失函数检测人脸不同部位的状态,能够避免使用不同分类器进行分类以获取人脸不同部位的状态造成计算量大的问题;且还能够同时得到人脸的多个部位的状态信息,即同时得到多个面部元素。By using different loss functions to detect the state of different parts of the face, it is possible to avoid the problem of using different classifiers for classification to obtain the state of different parts of the face, resulting in a large amount of calculation; and it is also possible to obtain the state information of multiple parts of the face at the same time , that is, get multiple facial elements at the same time.
在本公开的第一方面的第五种可能实现方式中,所述第一损失函数和所述第二损失函数为二分类函数,所述第三损失函数为三分类函数。In a fifth possible implementation manner of the first aspect of the present disclosure, the first loss function and the second loss function are binary classification functions, and the third loss function is a three-classification function.
通过不同损失函数得到不同的分类结果,能够有针对性地对人脸的不同部位进行检测。Different classification results are obtained through different loss functions, and different parts of the face can be detected in a targeted manner.
在本公开的第一方面的第六种可能实现方式中,当所述至少两张人脸图像中至少存在预设数量的所述指定图像时,验证通过,包括:In a sixth possible implementation manner of the first aspect of the present disclosure, when at least a preset number of the specified images exist in the at least two face images, the verification is passed, including:
当所述至少两张人脸图像中至少存在预设数量的处于睁眼状态的人脸图像时,验证通过;或,When there are at least a preset number of face images with eyes open in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的处于张嘴状态的人脸图像时,验证通过;或,When there are at least a preset number of face images in a mouth-opening state in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的头部处于左转或右转状态的人脸图像时,验证通过。When there are at least a preset number of face images whose heads are turned left or right in the at least two face images, the verification is passed.
通过检测该至少两张人脸图像中是否存在该指定图像实现活体验证,当该至少两张人脸图像中存在该指定图像时,能够快速确定该人脸为活体人脸,进而验证通过,使得终端根据验证结果执行相应操作或显示相应操作界面。Liveness verification is realized by detecting whether the designated image exists in the at least two face images, and when the designated image exists in the at least two face images, it can be quickly determined that the face is a live face, and then the verification is passed, so that The terminal performs a corresponding operation or displays a corresponding operation interface according to the verification result.
在本公开的第一方面的第七种可能实现方式中,所述多个面部元素和人脸特征以197维向量表示,所述197维向量包括95个人脸特征点的二维坐标、二维眼部状态信息、二维嘴部状态信息和三维头部状态信息。In a seventh possible implementation of the first aspect of the present disclosure, the plurality of facial elements and facial features are represented by a 197-dimensional vector, and the 197-dimensional vector includes two-dimensional coordinates of 95 facial feature points, two-dimensional Eye state information, 2D mouth state information and 3D head state information.
通过使用一个多维向量输出该多个面部元素和人脸特征,能够实现同时得到多个面部元素和人脸特征的目的,且能够提高结果的整洁清晰度,避免多个结果混淆的情况。By using a multi-dimensional vector to output the multiple facial elements and facial features, the purpose of obtaining multiple facial elements and facial features at the same time can be achieved, and the neatness and clarity of the results can be improved, and the confusion of multiple results can be avoided.
根据本公开实施例的第二方面,提供一种身份验证装置,所述装置包括:According to a second aspect of an embodiment of the present disclosure, an identity verification device is provided, the device comprising:
图像获取模块,用于获取摄像头实时采集的至少两张人脸图像;An image acquisition module, configured to acquire at least two face images collected by the camera in real time;
图像处理模块,用于对采集到的的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征;An image processing module, configured to perform image processing on each face image collected to obtain multiple facial elements and face features in each face image;
确定模块,用于根据所述每张人脸图像中的多个面部元素,确定所述至少两张人脸图像中是否存在指定图像,所述指定图像为所述多个面部元素中指定面部元素符合预设标准的人脸图像;A determining module, configured to determine whether there is a designated image in the at least two face images according to the plurality of facial elements in each of the facial images, and the designated image is a designated facial element in the plurality of facial elements Face images that meet preset standards;
验证模块,用于当所述至少两张人脸图像中存在所述指定图像时,验证通过。A verification module, configured to pass the verification when the specified image exists in the at least two face images.
通过使用包含多个损失函数的验证模型实时采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,由于验证模型对应的待训练模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度。By using at least two face images collected in real time by a verification model containing multiple loss functions for processing, not only can output the location information of facial feature points, but also extract multiple facial elements at the same time, avoiding the use of different classifiers The problem of large amount of calculation caused by extracting different facial elements. In addition, since the model to be trained corresponding to the verification model contains multiple loss functions, the verification model obtained by training can have higher precision and accuracy, thereby ensuring The accuracy of the extracted multiple facial elements and facial features.
在本公开的第二方面的第一种可能实现方式中,所述图像处理模块用于:In a first possible implementation manner of the second aspect of the present disclosure, the image processing module is configured to:
将所述每张人脸图像输入验证模型,得到所述每张人脸图像的多个面部元素和人脸特征,所述验证模型用于提取人脸图像中的面部元素及分析人脸特征,所述验证模型由卷积神经网络和多个损失函数构成。Each face image is input into a verification model to obtain a plurality of face elements and face features of each face image, and the verification model is used to extract face elements in the face image and analyze face features, The verification model is composed of a convolutional neural network and multiple loss functions.
通过使用包含多个损失函数的验证模型对采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题。By using a verification model containing multiple loss functions to process at least two face images collected, not only can output the location information of facial feature points, but also extract multiple facial elements at the same time, avoiding the use of different classifiers The problem of large amount of calculation caused by extracting different facial elements.
在本公开的第二方面的第二种可能实现方式中,所述装置还包括:In a second possible implementation manner of the second aspect of the present disclosure, the device further includes:
图像数量获取模块,用于获取所述至少两张人脸图像中的所述指定图像的图像数量;An image quantity acquisition module, configured to acquire the image quantity of the specified image in the at least two face images;
所述检测模块还用于检测所述图像数量是否大于预设数量;The detection module is also used to detect whether the number of images is greater than a preset number;
所述验证模块还用于当所述图像数量大于所述预设数量时,验证通过;当所述图像数量不大于所述预设数量时,验证不通过。The verification module is further configured to pass the verification when the number of images is greater than the preset number; fail the verification when the number of images is not greater than the preset number.
在本公开的第二方面的第三种可能实现方式中,所述多个面部元素至少包括眼部状态信息、嘴部状态信息、头部状态信息、鼻部状态信息。In a third possible implementation manner of the second aspect of the present disclosure, the plurality of facial elements at least include eye state information, mouth state information, head state information, and nose state information.
通过获取多个面部元素,能够避免使用单一面部元素造成验证结果不准确或准确性低的问题,同时还能够提高本公开所提供的身份验证方法的适用场景。By acquiring multiple facial elements, the problem of inaccurate or low verification results caused by using a single facial element can be avoided, and at the same time, the applicable scenarios of the identity verification method provided by the present disclosure can be improved.
在本公开的第二方面的第四种可能实现方式中,所述多个损失函数至少包括用于检测眼部状态的第一损失函数、用于检测嘴部状态的第二损失函数和用于检测头部状态的第三损失函数。In a fourth possible implementation manner of the second aspect of the present disclosure, the multiple loss functions include at least a first loss function for detecting the state of the eyes, a second loss function for detecting the state of the mouth, and a second loss function for detecting the state of the mouth. A third loss function to detect the state of the head.
通过使用不同损失函数检测人脸不同部位的状态,能够避免使用不同分类器进行分类以获取人脸不同部位的状态造成计算量大的问题;且还能够同时得到人脸的多个部位的状态信息,即同时得到多个面部元素。By using different loss functions to detect the state of different parts of the face, it is possible to avoid the problem of using different classifiers for classification to obtain the state of different parts of the face, resulting in a large amount of calculation; and it is also possible to obtain the state information of multiple parts of the face at the same time , that is, get multiple facial elements at the same time.
在本公开的第二方面的第五种可能实现方式中,所述第一损失函数和所述第二损失函数为二分类函数,所述第三损失函数为三分类函数。In a fifth possible implementation manner of the second aspect of the present disclosure, the first loss function and the second loss function are binary classification functions, and the third loss function is a three-classification function.
通过不同损失函数得到不同的分类结果,能够有针对性地对人脸的不同部位进行检测。Different classification results are obtained through different loss functions, and different parts of the face can be detected in a targeted manner.
在本公开的第二方面的第六种可能实现方式中,所述验证模块用于:In a sixth possible implementation manner of the second aspect of the present disclosure, the verification module is configured to:
当所述至少两张人脸图像中至少存在预设数量的处于睁眼状态的人脸图像时,验证通过;或,When there are at least a preset number of face images with eyes open in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的处于张嘴状态的人脸图像时,验证通过;或,When there are at least a preset number of face images in a mouth-opening state in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的头部处于左转或右转状态的人脸图像时,验证通过。When there are at least a preset number of face images whose heads are turned left or right in the at least two face images, the verification is passed.
通过检测该至少两张人脸图像中是否存在预设数量的该指定图像实现活体验证,当该至少两张人脸图像中存在该指定图像时,能够快速确定该人脸为活体人脸,进而验证通过,使得终端根据验证结果执行相应操作或显示相应操作界面。Liveness verification is realized by detecting whether there is a preset number of the designated images in the at least two face images, and when the designated image exists in the at least two face images, it can be quickly determined that the face is a live face, and then If the verification is passed, the terminal executes a corresponding operation or displays a corresponding operation interface according to the verification result.
在本公开的第二方面的第七种可能实现方式中,所述多个面部元素和人脸特征以197维向量表示,所述197维向量包括95个人脸特征点的二维坐标、二维眼部状态信息、二维嘴部状态信息和三维头部状态信息。In a seventh possible implementation of the second aspect of the present disclosure, the plurality of facial elements and facial features are represented by a 197-dimensional vector, and the 197-dimensional vector includes two-dimensional coordinates of 95 facial feature points, two-dimensional Eye state information, 2D mouth state information and 3D head state information.
通过使用一个多维向量输出该多个面部元素和人脸特征,能够实现同时得到多个面部元素和人脸特征的目的,且能够提高结果的整洁清晰度,避免多个结果混淆的情况。By using a multi-dimensional vector to output the multiple facial elements and facial features, the purpose of obtaining multiple facial elements and facial features at the same time can be achieved, and the neatness and clarity of the results can be improved, and the confusion of multiple results can be avoided.
第三方面,还提供了一种身份验证装置,包括:In a third aspect, an identity verification device is also provided, including:
处理器;processor;
用于存储处理器可执行的指令的存储器;memory for storing processor-executable instructions;
其中,该处理器被配置为:Among them, the processor is configured as:
获取摄像头实时采集的至少两张人脸图像;Obtain at least two face images captured by the camera in real time;
对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征;Image processing is performed on each face image collected to obtain a plurality of facial elements and face features in each face image;
根据所述每张人脸图像中的多个面部元素,确定所述至少两张人脸图像中是否存在指定图像,所述指定图像为所述多个面部元素中指定面部元素符合预设标准的人脸图像;According to the plurality of facial elements in each of the facial images, determine whether there is a specified image in the at least two facial images, and the specified image is a specified facial element in the plurality of facial elements that meets a preset standard face image;
当所述至少两张人脸图像中存在所述指定图像时,验证通过。When the specified image exists in the at least two face images, the verification is passed.
本公开实施例提供的技术方案带来的有益效果是:The beneficial effects brought by the technical solutions provided by the embodiments of the present disclosure are:
本公开通过使用包含多个损失函数的验证模型实时采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,由于验证模型对应的待训练模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度。This disclosure processes at least two face images collected in real time by using a verification model containing multiple loss functions, not only can output the location information of face feature points, but also can extract multiple facial elements at the same time, avoiding the use of different The problem of large amount of calculation caused by the extraction of different facial elements by the classifier. In addition, since the model to be trained corresponding to the verification model contains multiple loss functions, the verification model obtained by training can have higher precision and accuracy, and then The accuracy of the extracted multiple facial elements and facial features can be guaranteed.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
图1是根据一示例性实施例示出的一种身份验证方法的流程图;Fig. 1 is a flowchart of an identity verification method shown according to an exemplary embodiment;
图2A是根据一示例性实施例示出的一种身份验证方法的流程图;Fig. 2A is a flowchart of an identity verification method according to an exemplary embodiment;
图2B是根据一示例性实施例示出的一种CNN(Convolutional Neural Networks,卷积神经网络)网络设计图;FIG. 2B is a CNN (Convolutional Neural Networks, Convolutional Neural Networks) network design diagram shown according to an exemplary embodiment;
图2C是根据一示例性实施例示出的一种待训练CNN模型示意图;Fig. 2C is a schematic diagram of a CNN model to be trained according to an exemplary embodiment;
图3是根据一示例性实施例示出的一种身份验证装置框图;Fig. 3 is a block diagram of an identity verification device according to an exemplary embodiment;
图4是根据一示例性实施例示出的一种身份验证装置400的框图。Fig. 4 is a block diagram of an identity verification device 400 according to an exemplary embodiment.
具体实施方式detailed description
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。In order to make the purpose, technical solution and advantages of the present disclosure clearer, the implementation manners of the present disclosure will be further described in detail below in conjunction with the accompanying drawings.
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatuses and methods consistent with aspects of the present disclosure as recited in the appended claims.
图1是根据一示例性实施例示出的一种身份验证方法的流程图,如图1所示,身份验证方法用于终端中,包括以下步骤。Fig. 1 is a flowchart showing an identity verification method according to an exemplary embodiment. As shown in Fig. 1 , the identity verification method is used in a terminal and includes the following steps.
在步骤101中,获取摄像头实时采集的至少两张人脸图像。In step 101, at least two face images collected by a camera in real time are obtained.
在步骤102中,对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征。In step 102, image processing is performed on each collected face image to obtain a plurality of facial elements and face features in each face image.
在步骤103中,根据所述每张人脸图像中的多个面部元素,检测所述至少两张人脸图像中是否存在指定图像,所述指定图像为所述多个面部元素中指定面部元素符合预设标准的人脸图像。In step 103, according to the plurality of facial elements in each of the human face images, it is detected whether there is a specified image in the at least two human face images, and the specified image is a specified facial element in the plurality of facial elements Face images that meet preset standards.
在步骤104中,当所述至少两张人脸图像中至少存在预设数量的所述指定图像时,验证通过。In step 104, when at least a preset number of the specified images exist in the at least two face images, the verification is passed.
本公开实施例提供的方法,通过使用包含多个损失函数的验证模型实时采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,由于验证模型对应的待训练模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度。The method provided by the embodiment of the present disclosure processes at least two face images collected in real time by using a verification model containing multiple loss functions, not only can output the location information of facial feature points, but also can extract multiple facial elements at the same time , which can avoid the problem of large amount of calculation caused by using different classifiers to extract different facial elements. In addition, since the model to be trained corresponding to the verification model contains multiple loss functions, the verification model obtained by training can have a higher Accuracy and accuracy, and thus can ensure the accuracy of the extracted multiple facial elements and facial features.
在本公开的第一种可能实现方式中,对所采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征信息,包括:In a first possible implementation of the present disclosure, image processing is performed on each of the collected face images to obtain multiple facial elements and face feature information in each of the face images, including:
将所述每张人脸图像输入验证模型,得到所述每张人脸图像的多个面部元素和人脸特征,所述验证模型用于提取人脸图像中的面部元素及分析人脸特征,所述验证模型由卷积神经网络和多个损失函数构成。Each face image is input into a verification model to obtain a plurality of face elements and face features of each face image, and the verification model is used to extract face elements in the face image and analyze face features, The verification model is composed of a convolutional neural network and multiple loss functions.
在本公开的第二种可能实现方式中,根据所述每张人脸图像中的多个面部元素,检测所述至少两张人脸图像中是否存在指定图像之后,所述方法还包括:In a second possible implementation of the present disclosure, after detecting whether a specified image exists in the at least two face images according to the plurality of facial elements in each face image, the method further includes:
获取所述至少两张人脸图像中的所述指定图像的图像数量;Acquiring the number of images of the specified image in the at least two face images;
检测所述图像数量是否大于预设数量;Detecting whether the number of images is greater than a preset number;
当所述图像数量大于所述预设数量时,验证通过;When the number of images is greater than the preset number, the verification is passed;
当所述图像数量不大于所述预设数量时,验证不通过。When the number of images is not greater than the preset number, the verification fails.
在本公开的第三种可能实现方式中,所述多个面部元素至少包括眼部状态信息、嘴部状态信息、头部状态信息、鼻部状态信息。。In a third possible implementation manner of the present disclosure, the plurality of facial elements at least include eye state information, mouth state information, head state information, and nose state information. .
在本公开的第四种可能实现方式中,所述多个损失函数至少包括用于检测眼部状态的第一损失函数、用于检测嘴部状态的第二损失函数和用于检测头部状态的第三损失函数。In a fourth possible implementation manner of the present disclosure, the multiple loss functions include at least a first loss function for detecting the state of the eyes, a second loss function for detecting the state of the mouth, and a second loss function for detecting the state of the head. The third loss function of .
在本公开的第五种可能实现方式中,所述第一损失函数和所述第二损失函数为二分类函数,所述第三损失函数为三分类函数。In a fifth possible implementation manner of the present disclosure, the first loss function and the second loss function are binary classification functions, and the third loss function is a three-classification function.
在本公开的第六种可能实现方式中,当所述至少两张人脸图像中至少存在预设数量的所述指定图像时,验证通过,包括:In a sixth possible implementation manner of the present disclosure, when at least a preset number of the specified images exist in the at least two face images, the verification is passed, including:
当所述至少两张人脸图像中至少存在预设数量的处于睁眼状态的人脸图像时,验证通过;或,When there are at least a preset number of face images with eyes open in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的处于张嘴状态的人脸图像时,验证通过;或,When there are at least a preset number of face images in a mouth-opening state in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的头部处于左转或右转状态的人脸图像时,验证通过。When there are at least a preset number of face images whose heads are turned left or right in the at least two face images, the verification is passed.
在本公开的第七种可能实现方式中,所述多个面部元素和人脸特征以197维向量表示,所述197维向量包括95个人脸特征点的二维坐标、二维眼部状态信息、二维嘴部状态信息和三维头部状态信息。In the seventh possible implementation of the present disclosure, the multiple facial elements and facial features are represented by a 197-dimensional vector, and the 197-dimensional vector includes two-dimensional coordinates of 95 facial feature points and two-dimensional eye state information , two-dimensional mouth state information and three-dimensional head state information.
上述所有可选技术方案,可以采用任意结合形成本公开的可选实施例,在此不再一一赘述。All the above optional technical solutions may be combined in any way to form optional embodiments of the present disclosure, which will not be repeated here.
图2是根据一示例性实施例示出的一种身份验证方法的流程图。该实施例的执行主体可以为终端,参照图2,该实施例具体包括:Fig. 2 is a flowchart of an identity verification method according to an exemplary embodiment. The execution subject of this embodiment may be a terminal. Referring to FIG. 2, this embodiment specifically includes:
在步骤201中,获取摄像头实时采集的至少两张人脸图像。In step 201, at least two face images collected by a camera in real time are acquired.
在终端检测到用户正在执行或者将要执行敏感操作时,自动开启摄像头,由摄像头对人脸图像进行实时采集,以达到对用户身份进行验证的目的;其中,该敏感操作可以包括在线支付,网上转账及用户信息修改等操作。例如,当终端检测到用户对支付选项的触发操作时,自动开启摄像头,并提醒用户将摄像头对准其面部区域,以使得该摄像头能够完整采集到该人脸的全部区域。When the terminal detects that the user is performing or is about to perform a sensitive operation, the camera is automatically turned on, and the camera collects the face image in real time to achieve the purpose of verifying the user's identity; the sensitive operation can include online payment, online transfer And user information modification and other operations. For example, when the terminal detects the user's trigger operation on the payment option, it automatically turns on the camera and reminds the user to aim the camera at the face area, so that the camera can completely capture the entire area of the face.
需要说明的是,本公开实施例所提供的身份验证方法用于对人脸进行活体验证,因此,当摄像头开启之后,终端还可以提醒用户做出不同的表情,以使得终端能够在用户做不同表情的过程中进行图像采集,进而验证所采集到的人脸是否为活体。终端对用户进行提醒的方式可以为语音提醒,例如,语音播放“请眨眼”、“请张嘴”或“请摇头”等,也可以通过在终端屏幕显示文字的方式对用户进行提醒,当然,还可以采用其他方式对用户进行提醒,本公开实施例对该提醒方式不作具体限定。It should be noted that the identity verification method provided by the embodiment of the present disclosure is used to perform live body verification on the face. Therefore, when the camera is turned on, the terminal can also remind the user to make different expressions, so that the terminal can perform different facial expressions when the user makes different facial expressions. Image acquisition is performed during the expression process, and then it is verified whether the collected face is a living body. The way the terminal reminds the user can be a voice reminder, for example, the voice plays "Please blink", "Please open your mouth" or "Please shake your head", etc., or the user can be reminded by displaying text on the terminal screen. The user may be reminded in other ways, which are not specifically limited in the embodiments of the present disclosure.
通过摄像头实时采集至少两张人脸图像,能够实现对所采集到的至少两张人脸图像分别进行图像处理,以达到活体验证的目的。By collecting at least two face images in real time through the camera, it is possible to perform image processing on the at least two collected face images respectively, so as to achieve the purpose of living body verification.
在步骤202中,对采集到的每张人脸图像进行图像处理,得到该每张人脸图像中的多个面部元素和人脸特征。In step 202, image processing is performed on each collected face image to obtain a plurality of facial elements and face features in each face image.
该多个面部元素是指人脸的五官分别所处的状态信息,例如,眼部处于闭眼状态、嘴部处于张嘴状态等;该人脸特征是指人脸的特征点位置信息。在本公开实施例中,该多个面部元素至少包括眼部状态信息、嘴部状态信息、头部状态信息、鼻部状态信息,还可以包括法令纹信息等其他信息;该人脸特征可以为95个特征点的位置信息,该位置信息以坐标的形式表示。The plurality of facial elements refers to the status information of the five sense organs of the human face, for example, the eyes are in the closed state, the mouth is in the open state, etc.; the facial feature refers to the feature point position information of the human face. In the embodiment of the present disclosure, the plurality of facial elements at least include eye state information, mouth state information, head state information, nose state information, and may also include other information such as nasolabial fold information; the facial features may be The location information of 95 feature points, the location information is expressed in the form of coordinates.
对该至少两张人脸图像中的每张人脸图像进行图像处理的具体方法可以为:将该至少两张人脸图像输入验证模型,以得到该至少两张人脸图像中每张人脸图像的多个面部元素和人脸特征,该验证模型用于提取人脸图像中的面部元素及分析人脸特征,该验证模型由卷积神经网络和多个损失函数构成。具体地,对于该至少两张人脸图像中的每张人脸图像,先通过人脸检测算法从人脸图像中确定人脸位置,在通过CNN确定该人脸图像中的人脸特征点位置,并获取该人脸特征点的位置信息,将通过深度学习算法输出的人脸特征分别输入该多个损失函数,以得到该人脸图像中的多个面部元素。The specific method for performing image processing on each face image in the at least two face images may be: input the at least two face images into the verification model to obtain each face in the at least two face images Multiple facial elements and facial features of the image. The verification model is used to extract facial elements in the face image and analyze facial features. The verification model is composed of a convolutional neural network and multiple loss functions. Specifically, for each face image in the at least two face images, the face position is first determined from the face image by a face detection algorithm, and the face feature point position in the face image is determined by CNN , and obtain the position information of the face feature points, and input the face features output by the deep learning algorithm into the multiple loss functions to obtain multiple facial elements in the face image.
其中,该人脸检测算法可以是Adaboost算法,也即是通过Adaboost分类器获取每张图像中的人脸数目。具体地,该Adaboost分类器对任一图像进行划分,得到该图像的多个区域,对于划分得到的每个区域,根据预设特征提取算法,提取该区域的特征,将该区域的特征输入至该分类器,基于该分类器,对该区域的特征进行计算,得到该分类器的输出结果,即可得到该区域的分类结果,该分类结果为人脸区域或者非人脸区域。Wherein, the face detection algorithm may be an Adaboost algorithm, that is, the number of faces in each image is obtained through an Adaboost classifier. Specifically, the Adaboost classifier divides any image to obtain multiple regions of the image, and for each region obtained by division, extracts the features of the region according to the preset feature extraction algorithm, and inputs the features of the region to The classifier calculates the features of the region based on the classifier, and obtains an output result of the classifier, and then obtains a classification result of the region, and the classification result is a face region or a non-face region.
该Adaboost分类器由多个弱分类器组成,该多个弱分类器基于同一训练样本集训练而成。例如,可以获取多个样本图像的弱特征,如矩形特征等,将每个样本图像的弱特征作为训练样本,将多个训练样本构成训练样本集。从该训练样本集中选取若干个训练样本,构成第一训练集,根据该第一训练集,训练出第一个弱分类器,再从该训练样本集中选取若干个新的训练样本,将本次选取的训练样本与第一个弱分类器分错的训练样本构成第二训练集,根据该第二训练集,训练出第二个弱分类器,再从该训练样本集中选取若干个新的训练样本,将本次选取的训练样本与第一个弱分类器和第二个弱分类器均分错的训练样本构成第三训练集,根据该第三训练集,训练出第三个弱分类器,以此类推,直至错误率小于预设最小错误率时,将训练出的多个弱分类器组成一个强分类器,该强分类器可用于对图像进行分类。The Adaboost classifier is composed of multiple weak classifiers, and the multiple weak classifiers are trained based on the same training sample set. For example, weak features of multiple sample images, such as rectangular features, can be obtained, and the weak features of each sample image can be used as training samples, and multiple training samples can be used to form a training sample set. Select a number of training samples from the training sample set to form the first training set. According to the first training set, train the first weak classifier, and then select a number of new training samples from the training sample set. The selected training samples and the training samples misclassified by the first weak classifier constitute the second training set. According to the second training set, the second weak classifier is trained, and then several new training samples are selected from the training sample set. Samples, the training samples selected this time and the training samples of the first weak classifier and the second weak classifier are equally divided to form the third training set, and according to the third training set, the third weak classifier is trained , and so on, until the error rate is less than the preset minimum error rate, the trained multiple weak classifiers are combined into a strong classifier, which can be used to classify images.
CNN作为人工神经网络的一种,目前已成为图像识别领域的研究热点。CNN为识别二维形状而特殊设计的一个多层感知器,这种网络结构对平移、倾斜或者其他形式的变形具有高度不变性。CNN的权值共享网络结构使之更类似于生物神经网络,通过学习大量的输入与输出之间的映射关系,无需任何输入和输出之间精确的数学表达式,即可输出处理结果,从而有效地降低了网络模型的复杂度,减少了权值的数量。尤其是在网络输入为多维图像时,CNN的优点表现的更为明显,避免了传统图像识别算法中复杂的特征提取和数据重建过程。As a kind of artificial neural network, CNN has become a research hotspot in the field of image recognition. CNN is a multi-layer perceptron specially designed to recognize two-dimensional shapes. This network structure is highly invariant to translation, tilt or other forms of deformation. CNN's weight sharing network structure makes it more similar to biological neural networks. By learning a large number of mapping relationships between input and output, it can output processing results without any precise mathematical expressions between input and output, thus effectively It greatly reduces the complexity of the network model and reduces the number of weights. Especially when the network input is a multi-dimensional image, the advantages of CNN are more obvious, avoiding the complex feature extraction and data reconstruction process in traditional image recognition algorithms.
图2B是根据一示例性实施例示出的一种CNN网络设计图。由图2B可知,CNN网络由1个输入层及7个训练层组成,7个训练层分别为C1层、S2层、C3层、S4层、C5层、F6层及输出层,其中,C1、C3、C5层为卷积层,用于通过卷积运算,增强原始图像的特征,降低噪声;S2、S4为下采样层,用于利用图像局部相关性原理,对图像进行子抽样,以减少数据处理量并保留有效特征。其中,输入层所输入的图像大小为32*32。每个训练层具有多个特征图像,每个特征图像为通过一种卷积滤波器提取输入的一种特征,且每个特征图像具有多个神经元。另外,每个训练层均包含多个待训练的参数。Fig. 2B is a design diagram of a CNN network according to an exemplary embodiment. As can be seen from Figure 2B, the CNN network consists of an input layer and 7 training layers, and the 7 training layers are C1 layer, S2 layer, C3 layer, S4 layer, C5 layer, F6 layer and output layer, among them, C1, Layers C3 and C5 are convolution layers, which are used to enhance the characteristics of the original image and reduce noise through convolution operations; S2 and S4 are down-sampling layers, which are used to sub-sample the image using the principle of local correlation of the image to reduce Data processing volume and retain valid features. Wherein, the image size input by the input layer is 32*32. Each training layer has a plurality of feature images, each feature image is a feature extracted from an input through a convolution filter, and each feature image has a plurality of neurons. In addition, each training layer contains multiple parameters to be trained.
其中,C1层为第一级卷积层,由6个大小为28*28的特征图像构成。每个特征图像中的每个神经元与输入图像中5*5的邻域相连。C1层中每个滤波器具有5*5=25个滤波器参数以及1个bias参数,6个滤波器总共具有(5*5+1)*6=156个待训练的参数。针对156个待训练的参数,共计具有156*(28*28)=122304个连接。Among them, the C1 layer is the first-level convolutional layer, which is composed of 6 feature images with a size of 28*28. Each neuron in each feature image is connected to a 5×5 neighborhood in the input image. Each filter in the C1 layer has 5*5=25 filter parameters and 1 bias parameter, and the 6 filters have (5*5+1)*6=156 parameters to be trained in total. For 156 parameters to be trained, there are 156*(28*28)=122304 connections in total.
S2层为第一级下采样层,由6个14*14的特征图像构成。每个特征图像中的每个单元与C1层中相对应特征图像的2*2邻域相连接。另外,S2层有12个待训练的参数及5880个连接。The S2 layer is the first-level downsampling layer, consisting of six 14*14 feature images. Each unit in each feature image is connected to a 2×2 neighborhood of the corresponding feature image in layer C1. In addition, the S2 layer has 12 parameters to be trained and 5880 connections.
C3层为第二级卷积层,由16个10*10的特征图像构成。其中,10*10的特征图像为通过5*5的卷积核对下采样层S2进行卷积计算得到。C3层中的每个特征图像与S2层中的全部或部分特征图像相连,也即是,C3层中的特征图像为S2层中所提取到的特征图像的组合。The C3 layer is the second-level convolutional layer, which consists of 16 feature images of 10*10. Among them, the feature image of 10*10 is obtained by convoluting the downsampling layer S2 with a convolution kernel of 5*5. Each feature image in the C3 layer is connected to all or part of the feature images in the S2 layer, that is, the feature image in the C3 layer is a combination of the feature images extracted in the S2 layer.
S4层为第二级下采样层,由16个5*5的特征图像构成。每个特征图中的每个单元与C3层中相应特征图像的2*2邻域相连接。另外,S4层有32个待训练的参数及2000个连接。The S4 layer is the second downsampling layer, which consists of 16 5*5 feature images. Each unit in each feature map is connected to a 2×2 neighborhood of the corresponding feature image in layer C3. In addition, the S4 layer has 32 parameters to be trained and 2000 connections.
C5层为第二级卷积层,由120个特征图像构成。每个特征图像中的每个单元与S4层中16个特征图像的5*5邻域相连。由于S4层的特征图像的大小也为5*5,因此,C5层的特征图像与S4层的特征图像的比例应为1*1,也即是S4层和C5层之间为全连接。另外,C5层有48120个待训练的连接。Layer C5 is the second-level convolutional layer, consisting of 120 feature images. Each unit in each feature image is connected to a 5*5 neighborhood of 16 feature images in the S4 layer. Since the size of the feature image of the S4 layer is also 5*5, the ratio of the feature image of the C5 layer to the feature image of the S4 layer should be 1*1, that is, there is a full connection between the S4 layer and the C5 layer. In addition, the C5 layer has 48120 connections to be trained.
F6层由84个特征图像构成,与C5层之间为全连接。另外,F6层有10164个待训练的参数。The F6 layer consists of 84 feature images and is fully connected with the C5 layer. In addition, the F6 layer has 10164 parameters to be trained.
输出层由RBF(Radial Basis Function,径向基函数)单元组成,每个RBF单元用于计算输入向量和输出向量之间的欧式距离,输入向量与输出向量之间的欧氏距离越大,RBF单元的输出也越大。RBF单元的输出用于衡量输入向量和与RBF单元相关联类的一个模型匹配程度的惩罚项。在概率论上,RBF单元的输出可以认为是F6层配置空间的高斯分布的负log-likelihood。任意给定一个输入向量,损失函数应能使F6层的配置与RBF输出向量足够接近。The output layer is composed of RBF (Radial Basis Function, Radial Basis Function) units. Each RBF unit is used to calculate the Euclidean distance between the input vector and the output vector. The greater the Euclidean distance between the input vector and the output vector, the RBF The output of the unit is also larger. The output of the RBF unit is used as a penalty term that measures how well the input vector matches a model of the class associated with the RBF unit. Probabilistically, the output of the RBF unit can be considered as the negative log-likelihood of the Gaussian distribution of the configuration space of the F6 layer. Given any input vector, the loss function should make the configuration of the F6 layer close enough to the RBF output vector.
在本公开另一实施例中,该多个损失函数至少包括用于检测眼部状态的第一损失函数、用于检测嘴部状态的第二损失函数和用于检测头部状态的第三损失函数;其中,该第一损失函数、第二损失函数和第三损失函数分别可以为Softmax函数,也可以是其他具有多分类功能的函数,本公开实施例对此不作具体限定。In another embodiment of the present disclosure, the multiple loss functions include at least a first loss function for detecting the state of the eyes, a second loss function for detecting the state of the mouth, and a third loss for detecting the state of the head functions; wherein, the first loss function, the second loss function and the third loss function may be Softmax functions or other functions with multi-classification functions, which are not specifically limited in the embodiments of the present disclosure.
在本公开实施例中,该第一损失函数和该第二损失函数为二分类函数,该第三损失函数为三分类函数。具体地,用于检测眼部状态的第一损失函数的输出包括处于睁眼状态的概率和处于闭眼状态的概率,用于检测嘴部状态的第二损失函数的输出包括处于张嘴状态的概率和处于闭嘴状态的概率,用于检测头部状态的第三损失函数的输出包括脸部正对摄像头的概率、头部处于左转状态的概率以及头部处于右转状态的概率。In the embodiment of the present disclosure, the first loss function and the second loss function are two-category functions, and the third loss function is three-category functions. Specifically, the output of the first loss function for detecting the eye state includes the probability of being in the eye-open state and the probability of being in the eye-closed state, and the output of the second loss function for detecting the mouth state includes the probability of being in the mouth-open state and the probability of being in the closed state, the output of the third loss function used to detect the head state includes the probability that the face is facing the camera, the probability that the head is turned left, and the probability that the head is turned right.
当然,该第一损失函数、第二损失函数和该第三损失函数还可以得到两个或三个以上的分类结果,例如,用于检测嘴部状态的第一分类函数的输出可以包括处于睁眼状态的概率、半睁眼状态的概率及睁眼状态的概率等。此外,该第一损失函数、第二损失函数和该第三损失函数还可以分别用于提取其他面部元素,本公开实施例对上述三个损失函数的特征提取目标及所得到的检测结果均不作具体限定。Of course, the first loss function, the second loss function and the third loss function can also obtain two or more classification results, for example, the output of the first classification function used to detect the state of the mouth can include The probability of the eye state, the probability of the half-open state, and the probability of the open state. In addition, the first loss function, the second loss function, and the third loss function can also be used to extract other facial elements, and the embodiment of the present disclosure does not make any feature extraction targets and detection results of the above three loss functions. Specific limits.
需要说明的是,该多个损失函数还包括一个用于回归95个特征点坐标的第四损失函数,该第四损失函数用于使得最终得到的95个特征点的坐标与标定的95个特征点的坐标之间的误差最小,该第四损失函数可以为欧氏距离函数。It should be noted that the multiple loss functions also include a fourth loss function for regressing the coordinates of the 95 feature points, and the fourth loss function is used to make the coordinates of the 95 feature points finally obtained and the calibrated 95 features The error between the coordinates of the points is the smallest, and the fourth loss function may be a Euclidean distance function.
当然,该多个损失函数还可以包括用于检测其他面部元素的损失函数,例如,用于检测鼻部状态和法令纹的第五损失函数和第六损失函数,该第五损失函数可以为二分类函数,输出包括鼻部处于平坦状态的概率和处于皱起状态的概率;该第六损失函数可以为三分类以上的多分类函数,输出包括法令纹处于不同深度的概率,当用户笑的时候,法令纹较深,当用户处于正常无表情状态时,法令纹较浅。本公开实施例对该多个损失函数的具体检测区域及输出类型等均不作限定。Of course, the plurality of loss functions may also include loss functions for detecting other facial elements, for example, a fifth loss function and a sixth loss function for detecting the state of the nose and nasolabial folds, and the fifth loss function may be two Classification function, the output includes the probability that the nose is in a flat state and the probability that it is in a wrinkled state; the sixth loss function can be a multi-classification function with more than three classifications, and the output includes the probability that the nasolabial folds are at different depths, when the user laughs , the nasolabial folds are darker, and when the user is in a normal expressionless state, the nasolabial folds are lighter. The embodiments of the present disclosure do not limit the specific detection areas and output types of the multiple loss functions.
在本公开又一实施例中,该多个面部元素和人脸特征以197维向量表示,该197维向量包括95个人脸特征点的二维坐标、二维眼部状态信息、二维嘴部状态信息和三维头部状态信息。具体地,该197维向量的第1维至第190维表示该95个人脸特征点的二维坐标,第191维至第192维表示二维眼部状态信息,第193维至第194维表示二维嘴部状态信息,第195维至第197维表示三维头部状态信息;当然,该197维向量对应的具体内容可以由开发人员进行设置,本公开实施例对此不作具体限定。In yet another embodiment of the present disclosure, the plurality of facial elements and facial features are represented by a 197-dimensional vector, and the 197-dimensional vector includes two-dimensional coordinates of 95 facial feature points, two-dimensional eye state information, two-dimensional mouth State information and 3D head state information. Specifically, the first to 190th dimensions of the 197-dimensional vector represent the two-dimensional coordinates of the 95 facial feature points, the 191st to 192nd dimensions represent two-dimensional eye state information, and the 193rd to 194th dimensions represent For two-dimensional mouth state information, the 195th to 197th dimensions represent three-dimensional head state information; of course, the specific content corresponding to the 197-dimensional vector can be set by the developer, which is not specifically limited in the embodiments of the present disclosure.
需要说明的是,根据该多个损失函数中每个损失函数对应的分类结果不同,所得到的该多个面部元素和人脸特征对应的向量维数也不同。It should be noted that, according to the different classification results corresponding to each of the multiple loss functions, the obtained vector dimensions corresponding to the multiple facial elements and human face features are also different.
在本公开再一实施例中,上述过程是使用验证模型对人脸图像进行图像处理,以得到人脸图像中的多个面部元素和人脸特征的过程,在实现上述过程之前,需要对由CNN和多个损失函数构成的初始模型进行训练,以得到该验证模型,需要说明的是,对该初始模型的训练过程即为确定该初始模型中CNN的模型参数的过程,具体训练方法可以为:可以先给待训练CNN模型初始化一个初始模型参数,将大量具有不同面部元素的人脸图像作为训练样本,将该训练样本分成多组,对于每组训练样本,将该组训练样本输入该初始模型,将得到的结果与标定结果进行对比以获取误差值,如果误差值大于预设阈值,则通过反向传播调节CNN的模型参数,直至得到的误差值小于或等于该预设阈值;如果误差值小于或等于该预设阈值,则输入下一组训练样本继续训练,直至所有训练样本训练结束,得到验证模型。其中,每组训练样本可以包含预设数量的人脸图像,该预设数量的具体数值可以由开发人员根据需要进行设置,本公开实施例对该预设数量的数值和设置方法均不作具体限定。In yet another embodiment of the present disclosure, the above-mentioned process is a process of using a verification model to perform image processing on a face image to obtain multiple facial elements and face features in the face image. Before realizing the above-mentioned process, it is necessary to The initial model composed of CNN and multiple loss functions is trained to obtain the verification model. It should be noted that the training process of the initial model is the process of determining the model parameters of the CNN in the initial model. The specific training method can be : You can first initialize an initial model parameter for the CNN model to be trained, use a large number of face images with different facial elements as training samples, divide the training samples into multiple groups, and for each group of training samples, input the group of training samples into the initial Model, compare the obtained result with the calibration result to obtain the error value, if the error value is greater than the preset threshold, adjust the model parameters of CNN through backpropagation until the obtained error value is less than or equal to the preset threshold; if the error If the value is less than or equal to the preset threshold, then input the next set of training samples to continue training until all training samples are trained to obtain a verification model. Wherein, each group of training samples can contain a preset number of face images, and the specific value of the preset number can be set by the developer according to needs, and the embodiment of the present disclosure does not specifically limit the value and setting method of the preset number .
其中,待训练CNN模型通常包括至少两级卷积层和至少一级全连接层,且每级卷积层包括多个卷积核和多个偏置矩阵,每级全连接层包括多个权重矩阵和多个偏置向量,因此,获取到的模型参数包括各级卷积层的初始卷积核、各级卷积层的初始偏置矩阵、全连接层的初始权重矩阵和全连接层的初始偏置向量。关于待训练CNN模型包括的卷积层的数量和全连接层的数量,本公开实施例不作具体限定。具体实施时,可以根据需要设定。例如,如图2C所示,该图示出了一种待训练CNN模型的示意图。图2C所示的待训练CNN模型包括五级卷积层和两级全连接层。Among them, the CNN model to be trained usually includes at least two levels of convolutional layers and at least one level of fully connected layers, and each level of convolutional layers includes multiple convolution kernels and multiple bias matrices, and each level of fully connected layers includes multiple weights Matrix and multiple bias vectors. Therefore, the obtained model parameters include the initial convolution kernel of each level of convolutional layer, the initial bias matrix of each level of convolutional layer, the initial weight matrix of the fully connected layer, and the initial weight matrix of the fully connected layer. Initial bias vector. The embodiments of the present disclosure do not specifically limit the number of convolutional layers and the number of fully connected layers included in the CNN model to be trained. During specific implementation, it can be set as required. For example, as shown in FIG. 2C , this figure shows a schematic diagram of a CNN model to be trained. The CNN model to be trained shown in FIG. 2C includes five convolutional layers and two fully connected layers.
进一步地,关于每级卷积层包括的卷积核和偏置矩阵的数量,以及每级全连接层包括的权重矩阵和偏置向量的数量,本公开实施例不作具体限定。另外,本公开实施例同样不对每个卷积核和偏置矩阵的维度,以及每个权重矩阵和每个偏置向量的维度进行限定。具体实施时,每级卷积层包括的卷积核和偏置矩阵的数量及其维度,以及每级全连权重矩阵和偏置向量的数量和维度,均可以取经验值。Further, the embodiments of the present disclosure do not specifically limit the number of convolution kernels and offset matrices included in each level of convolutional layer, and the number of weight matrices and offset vectors included in each level of fully connected layer. In addition, the embodiments of the present disclosure also do not limit the dimensions of each convolution kernel and offset matrix, and the dimensions of each weight matrix and each offset vector. During specific implementation, the number and dimensions of convolution kernels and offset matrices included in each level of convolutional layer, and the number and dimensions of fully connected weight matrices and offset vectors at each level can be empirical values.
结合上述内容,在获取待训练CNN模型的初始模型参数时,可以在指定数值范围内随机选取一个值作为初始模型参数中各个元素的值。例如,对于每一个初始卷积核、初始权重矩阵、初始偏置矩阵和初始偏置向量中的每一个元素,可以在[-r,r]区间中取一个随机数。此处,r是初始化模型参数的阈值,其可以为经验值。例如,r可以取0.001。In combination with the above content, when obtaining the initial model parameters of the CNN model to be trained, a value can be randomly selected within the specified value range as the value of each element in the initial model parameters. For example, for each element in each initial convolution kernel, initial weight matrix, initial bias matrix, and initial bias vector, a random number can be taken in the interval [-r, r]. Here, r is a threshold for initializing model parameters, which may be an empirical value. For example, r can take 0.001.
在本公开另一实施例中,该验证模型中CNN的第一层输入的图像大小参数可以设置为64*64,在将待训练图像或待验证图像输入该初始模型或该验证模型时,将图像大小调整为64*64。In another embodiment of the present disclosure, the image size parameter input by the first layer of CNN in the verification model can be set to 64*64, and when the image to be trained or the image to be verified is input into the initial model or the verification model, the The image is resized to 64*64.
通过将该验证模型中CNN的第一层输入的图像大小参数设置为64*64,能够避免在该参数为224*224时,该验证模型只能对部分图像进行验证,或者只能保证对部分图像的验证准确度,进而能够提高该验证模型的适用范围。By setting the input image size parameter of the first layer of CNN in the verification model to 64*64, it can be avoided that when the parameter is 224*224, the verification model can only verify part of the image, or can only guarantee part of the image. The verification accuracy of the image can be improved, thereby improving the scope of application of the verification model.
通过使用包含多个损失函数的验证模型对步骤201中实时获取到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题;此外,由于验证模型对应的初始模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度。By using a verification model containing multiple loss functions to process at least two face images obtained in real time in step 201, not only can output the position information of face feature points, but also extract multiple facial elements at the same time, which can avoid using Different classifiers extract different facial elements, resulting in a large amount of calculation; in addition, since the initial model corresponding to the verification model contains multiple loss functions, it can make the trained verification model have higher precision and accuracy, Furthermore, the accuracy of the extracted facial elements and facial features can be guaranteed.
在步骤203中,根据该每张人脸图像中的多个面部元素,确定该至少两张人脸图像中是否存在指定图像,该指定图像为该多个面部元素中指定面部元素符合预设标准的人脸图像。当该至少两张人脸图像中存在该指定图像时,执行步骤204;当该至少两张人脸图像中不存在该指定图像时,执行步骤205。In step 203, according to the plurality of face elements in each face image, it is determined whether there is a specified image in the at least two face images, and the specified image is a specified face element in the plurality of face elements that meets a preset standard face images. When the specified image exists in the at least two human face images, perform step 204; when the specified image does not exist in the at least two human face images, perform step 205.
该指定图像可以根据步骤201中在摄像头实时采集人脸图像的过程中对用户进行的提示信息确定;例如,当提示信息提示用户执行眨眼动作时,该指定图像可以为处于闭眼状态的人脸图像,即该指定面部元素为眼部状态信息,相应地,该预设标准为眼睛处于闭眼状态;当提示信息提示用户执行张嘴动作时,该指定图像可以为处于张嘴状态的人脸图像,即该指定面部元素为嘴部状态信息,相应地,该预设标准为嘴巴处于张嘴状态;当提示信息提示用户执行摇头动作时,该指定图像可以为头部处于左转或右转状态的人脸图像,即该指定面部元素为头部状态信息,相应地,该预设标准为头部处于左转或右转状态。The specified image can be determined according to the prompt information given to the user during the process of capturing the face image by the camera in real time in step 201; for example, when the prompt information prompts the user to perform an eye blinking action, the specified image can be a human face in a closed-eye state The image, that is, the specified facial element is the eye state information, and accordingly, the preset standard is that the eyes are closed; when the prompt information prompts the user to perform an action of opening the mouth, the specified image can be a face image in the state of opening the mouth, That is, the specified facial element is mouth state information, and correspondingly, the preset standard is that the mouth is in an open state; when the prompt information prompts the user to perform a head shaking action, the specified image can be a person whose head is turned left or right The face image, that is, the designated facial element is head state information, and correspondingly, the preset standard is that the head is turned left or right.
如果终端未播放或未显示提示信息,该指定图像可以是该多个面部元素中任一面部元素处于对应状态的人脸图像,例如,当所得到的面部元素包括眼部状态信息、嘴部状态信息、头部状态信息和鼻部状态信息时,该指定图像可以是处于闭眼状态或处于张嘴状态或头部处于左转或右转状态或鼻部处于皱起状态的人脸图像中的任一种图像,即该指定面部元素可以是眼部状态信息、嘴部状态信息、头部状态信息或鼻部状态信息中的任一种状态信息,相应地,该预设标准为与指定面部元素对应的任一种状态信息。If the terminal does not play or display the prompt information, the specified image may be a face image of any of the multiple facial elements in a corresponding state, for example, when the obtained facial elements include eye state information, mouth state information , head state information and nose state information, the specified image can be any of the face images in the state of eyes closed or mouth open, the head in the state of turning left or right, or the state of the nose in a wrinkled state One kind of image, that is, the designated facial element can be any state information in eye state information, mouth state information, head state information or nose state information, and correspondingly, the preset standard is corresponding to the designated facial element any status information.
该预设标准可以根据该提示信息确定,也可以根据所提取到的多个面部元素进行确定,本公开实施例对此不作具体限定。The preset standard may be determined according to the prompt information, or may be determined according to multiple extracted facial elements, which is not specifically limited in this embodiment of the present disclosure.
需要说明的是,当该多个面部元素和人脸特征以197维向量表示时,该197维向量中表示眼部状态信息的二维数值之和为1,且概率较大对应的状态为该人脸图像中的眼部状态;例如,对任一人脸图像的面部元素的提取结果中,当眼睛状态对应的二维数值为(0.7,0.3),且0.7对应的位置表示处于闭眼状态的概率,0.3对应的位置表示处于睁眼状态的概率,则该人脸图像中的人眼处于闭眼状态;其他面部元素的提取结果同理。It should be noted that when the multiple facial elements and facial features are represented by a 197-dimensional vector, the sum of the two-dimensional values representing the eye state information in the 197-dimensional vector is 1, and the corresponding state with a higher probability is the The state of the eyes in the face image; for example, in the extraction result of the facial elements of any face image, when the two-dimensional value corresponding to the eye state is (0.7,0.3), and the position corresponding to 0.7 indicates that the eye is closed Probability, the position corresponding to 0.3 represents the probability of being in the eye-open state, then the human eyes in the face image are in the eye-closed state; the extraction results of other facial elements are the same.
在步骤204中,当该至少两张人脸图像中存在该指定图像时,验证通过。In step 204, when the specified image exists in the at least two face images, the verification is passed.
当该至少两张人脸图像中存在该指定图像时,表示该人脸为活体人脸,验证通过,终端继续执行相应操作或显示相应操作界面。When the specified image exists in the at least two face images, it means that the face is a live face, and the verification is passed, and the terminal continues to perform corresponding operations or display a corresponding operation interface.
具体地,在本公开实施例中,当该至少两张人脸图像中存在该指定图像时,验证通过,包括:当该至少两张人脸图像中存在处于睁眼状态的人脸图像时,验证通过;或,当该至少两张人脸图像中存在处于张嘴状态的人脸图像时,验证通过;或,当该至少两张人脸图像中存在头部处于左转或右转状态的人脸图像时,验证通过。Specifically, in the embodiment of the present disclosure, when the specified image exists in the at least two human face images, the verification is passed, including: when there is a human face image in an open-eyed state in the at least two human face images, The verification is passed; or, when there is a face image in the state of opening the mouth in the at least two face images, the verification is passed; or, when there is a person whose head is turned left or right in the at least two face images When the face image is displayed, the verification is passed.
在本公开另一实施例中,当该至少两张人脸图像中存在该指定图像时,获取该至少两张人脸图像中的该指定图像的图像数量;检测该图像数量是否大于预设数量;当该图像数量大于该预设数量时,验证通过;当该图像数量不大于该预设数量时,验证不通过。其中,该预设数量可以设置为任一小于该至少两张人脸图像数量的任一数值,本公开实施例对该预设数量的设置方法及具体数值均不作限定。In another embodiment of the present disclosure, when the designated image exists in the at least two face images, the number of images of the designated image in the at least two face images is obtained; and whether the number of images is greater than a preset number is detected ; When the number of images is greater than the preset number, the verification is passed; when the number of images is not greater than the preset number, the verification is not passed. Wherein, the preset number can be set to any value smaller than the number of the at least two face images, and the embodiment of the present disclosure does not limit the setting method and specific value of the preset number.
通过当该指定图像的图像数量大于预设数量时,对当前用户验证通过,能够避免面部元素提取过程中出现误差时导致验证出错的情况,进而能够提高本公开实施例所提供的验证方法的安全性。By passing the verification of the current user when the number of images of the specified image is greater than the preset number, it is possible to avoid the situation that a verification error occurs when an error occurs in the facial element extraction process, thereby improving the security of the verification method provided by the embodiment of the present disclosure. sex.
在步骤205中,当该至少两张人脸图像中不存在该指定图像时,验证不通过。In step 205, when the specified image does not exist in the at least two face images, the verification fails.
当该至少两张人脸图像中不存在该指定图像时,表示该人脸不是活体人脸,验证不通过,终端继续终止执行相应操作,并显示验证失败的提示信息,或者重新执行步骤201及其以后步骤,以避免在图像采集过程中出错导致面部元素和人脸特征提取不准确的情况。When the specified image does not exist in the at least two face images, it means that the face is not a live face, and the verification fails, and the terminal continues to terminate the execution of the corresponding operation, and displays a prompt message of verification failure, or re-executes steps 201 and 201. Its subsequent steps are to avoid the inaccurate extraction of facial elements and facial features caused by errors in the image acquisition process.
在本公开另一实施例中,当重复执行步骤201及其以后步骤的次数大于预设次数后,锁定终端或当前应用预设时长,以达到进一步保护用户隐私和财产安全的目的。其中,该预设次数和该预设时长可以由开发人员设置,也可以由用户根据需要自行设置,本公开实施例对此不作限定;同样地,本公开实施例对该预设次数的具体数值和该预设时长的具体数值均不作限定。In another embodiment of the present disclosure, when step 201 and subsequent steps are repeated for more than a preset number of times, the terminal or the current application is locked for a preset duration, so as to further protect user privacy and property security. Wherein, the preset number of times and the preset duration can be set by the developer, or can be set by the user according to the needs, which is not limited in the embodiment of the present disclosure; similarly, the specific value of the preset number of times in the embodiment of the present disclosure Neither the specific value nor the preset duration is limited.
本公开实施例提供的方法,通过使用包含多个损失函数的验证模型实时采集到的至少两张人脸图像进行处理,不仅能够输出人脸特征点的位置信息,还可以同时提取多个面部元素,能够避免使用不同的分类器对不同面部元素进行提取造成的计算量大的问题,此外,由于验证模型对应的待训练模型包含多个损失函数,因此能够使训练得到的验证模型具有更高的精度和准确度,进而能够保证所提取到的多个面部元素和人脸特征的准确度;进一步地,通过当该指定图像的图像数量大于预设数量时,对当前用户验证通过,能够避免面部元素提取过程中出现误差时导致验证出错的情况,进而能够提高验证方法的安全性。The method provided by the embodiment of the present disclosure processes at least two face images collected in real time by using a verification model containing multiple loss functions, not only can output the location information of facial feature points, but also can extract multiple facial elements at the same time , which can avoid the problem of large amount of calculation caused by using different classifiers to extract different facial elements. In addition, since the model to be trained corresponding to the verification model contains multiple loss functions, the verification model obtained by training can have a higher Accuracy and accuracy, thereby ensuring the accuracy of the extracted multiple facial elements and facial features; further, by passing the verification of the current user when the number of images of the specified image is greater than the preset number, it is possible to avoid facial Errors in the element extraction process lead to verification errors, thereby improving the security of the verification method.
图3是根据一示例性实施例示出的一种身份验证装置框图。参照图3,该装置包括图像获取模块301,图像处理模块302,确定模块303和验证模块304。Fig. 3 is a block diagram of an identity verification device according to an exemplary embodiment. Referring to FIG. 3 , the device includes an image acquisition module 301 , an image processing module 302 , a determination module 303 and a verification module 304 .
图像获取模块301,用于获取摄像头实时采集的至少两张人脸图像;An image acquisition module 301, configured to acquire at least two face images collected by the camera in real time;
图像处理模块302,用于对采集到的每张人脸图像进行图像处理,得到所述每张人脸图像中的多个面部元素和人脸特征;An image processing module 302, configured to perform image processing on each face image collected to obtain a plurality of facial elements and face features in each face image;
确定模块303,用于根据所述每张人脸图像中的多个面部元素,确定所述至少两张人脸图像中是否存在指定图像,所述指定图像为所述多个面部元素中指定面部元素符合预设标准的人脸图像;A determining module 303, configured to determine whether there is a designated image in the at least two face images according to the plurality of facial elements in each of the facial images, and the designated image is a designated face in the plurality of facial elements Face images whose elements meet the preset standards;
验证模块304,用于当所述至少两张人脸图像中至少存在预设数量的所述指定图像时,验证通过。The verification module 304 is configured to pass the verification when there are at least a preset number of the specified images in the at least two face images.
在本公开提供的第一种可能实现方式中,所述图像处理模块302用于:In the first possible implementation manner provided in the present disclosure, the image processing module 302 is configured to:
将所述每张人脸图像输入验证模型,得到所述每张人脸图像的多个面部元素和人脸特征,所述验证模型用于提取人脸图像中的面部元素及分析人脸特征,所述验证模型由卷积神经网络和多个损失函数构成。Each face image is input into a verification model to obtain a plurality of face elements and face features of each face image, and the verification model is used to extract face elements in the face image and analyze face features, The verification model is composed of a convolutional neural network and multiple loss functions.
在本公开提供的第二种可能实现方式中,所述装置还包括:In a second possible implementation manner provided in the present disclosure, the device further includes:
图像数量获取模块,用于获取所述至少两张人脸图像中的所述指定图像的图像数量;An image quantity acquisition module, configured to acquire the image quantity of the specified image in the at least two face images;
所述确定模块303还用于确定所述图像数量是否大于预设数量;The determination module 303 is also used to determine whether the number of images is greater than a preset number;
所述验证模块304还用于当所述图像数量大于所述预设数量时,验证通过;当所述图像数量不大于所述预设数量时,验证不通过。The verification module 304 is further configured to pass the verification when the number of images is greater than the preset number; fail the verification when the number of images is not greater than the preset number.
在本公开提供的第三种可能实现方式中,所述多个面部元素至少包括眼部状态信息、嘴部状态信息、头部状态信息、鼻部状态信息。In a third possible implementation manner provided in the present disclosure, the plurality of facial elements at least include eye state information, mouth state information, head state information, and nose state information.
在本公开提供的第四种可能实现方式中,所述多个损失函数至少包括用于检测眼部状态的第一损失函数、用于检测嘴部状态的第二损失函数和用于检测头部状态的第三损失函数。In the fourth possible implementation manner provided by the present disclosure, the multiple loss functions include at least a first loss function for detecting the state of the eyes, a second loss function for detecting the state of the mouth, and a second loss function for detecting the state of the head The third loss function for the state.
在本公开提供的第五种可能实现方式中,所述第一损失函数和所述第二损失函数为二分类函数,所述第三损失函数为三分类函数。In a fifth possible implementation manner provided in the present disclosure, the first loss function and the second loss function are binary classification functions, and the third loss function is a three-classification function.
在本公开提供的第六种可能实现方式中,所述验证模块304用于:In a sixth possible implementation manner provided in the present disclosure, the verification module 304 is configured to:
当所述至少两张人脸图像中至少存在预设数量的处于睁眼状态的人脸图像时,验证通过;或,When there are at least a preset number of face images with eyes open in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的处于张嘴状态的人脸图像时,验证通过;或,When there are at least a preset number of face images in a mouth-opening state in the at least two face images, the verification is passed; or,
当所述至少两张人脸图像中至少存在预设数量的头部处于左转或右转状态的人脸图像时,验证通过。When there are at least a preset number of face images whose heads are turned left or right in the at least two face images, the verification is passed.
在本公开提供的第七种可能实现方式中,所述多个面部元素和人脸特征以197维向量表示,所述197维向量包括95个人脸特征点的二维坐标、二维眼部状态信息、二维嘴部状态信息和三维头部状态信息。In the seventh possible implementation mode provided by the present disclosure, the multiple facial elements and facial features are represented by a 197-dimensional vector, and the 197-dimensional vector includes the two-dimensional coordinates of 95 facial feature points, the two-dimensional eye state information, two-dimensional mouth state information, and three-dimensional head state information.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the apparatus in the foregoing embodiments, the specific manner in which each module executes operations has been described in detail in the embodiments related to the method, and will not be described in detail here.
图4是根据一示例性实施例示出的一种身份验证装置400的框图。例如,装置400可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等。Fig. 4 is a block diagram of an identity verification device 400 according to an exemplary embodiment. For example, the apparatus 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
参照图4,装置400可以包括以下一个或多个组件:处理组件402,存储器404,电源组件406,多媒体组件408,音频组件410,输入/输出(I/O)接口412,传感器组件414,以及通信组件416。4, apparatus 400 may include one or more of the following components: processing component 402, memory 404, power supply component 406, multimedia component 408, audio component 410, input/output (I/O) interface 412, sensor component 414, and communication component 416 .
处理组件402通常控制装置400的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件402可以包括一个或多个处理器420来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件402可以包括一个或多个模块,便于处理组件402和其他组件之间的交互。例如,处理组件402可以包括多媒体模块,以方便多媒体组件408和处理组件402之间的交互。The processing component 402 generally controls the overall operations of the device 400, such as those associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 402 may include one or more modules that facilitate interaction between processing component 402 and other components. For example, processing component 402 may include a multimedia module to facilitate interaction between multimedia component 408 and processing component 402 .
存储器404被配置为存储各种类型的数据以支持在装置400的操作。这些数据的示例包括用于在装置400上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器404可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 404 is configured to store various types of data to support operations at the device 400 . Examples of such data include instructions for any application or method operating on device 400, contact data, phonebook data, messages, pictures, videos, and the like. The memory 404 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
电源组件406为装置400的各种组件提供电力。电源组件406可以包括电源管理系统,一个或多个电源,及其他与为装置400生成、管理和分配电力相关联的组件。The power supply component 406 provides power to various components of the device 400 . Power components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for device 400 .
多媒体组件408包括在所述装置400和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件408包括一个前置摄像头和/或后置摄像头。当装置400处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 408 includes a screen that provides an output interface between the device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 408 includes a front camera and/or a rear camera. When the device 400 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件410被配置为输出和/或输入音频信号。例如,音频组件410包括一个麦克风(MIC),当装置400处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器404或经由通信组件416发送。在一些实施例中,音频组件410还包括一个扬声器,用于输出音频信号。The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a microphone (MIC), which is configured to receive external audio signals when the device 400 is in operation modes, such as call mode, recording mode and voice recognition mode. Received audio signals may be further stored in memory 404 or sent via communication component 416 . In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.
I/O接口412为处理组件402和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 412 provides an interface between the processing component 402 and a peripheral interface module. The peripheral interface module may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.
传感器组件414包括一个或多个传感器,用于为装置400提供各个方面的状态评估。例如,传感器组件414可以检测到装置400的打开/关闭状态,组件的相对定位,例如所述组件为装置400的显示器和小键盘,传感器组件414还可以检测装置400或装置400一个组件的位置改变,用户与装置400接触的存在或不存在,装置400方位或加速/减速和装置400的温度变化。传感器组件414可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件414还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件414还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。Sensor assembly 414 includes one or more sensors for providing status assessments of various aspects of device 400 . For example, the sensor component 414 can detect the open/closed state of the device 400, the relative positioning of components, such as the display and keypad of the device 400, and the sensor component 414 can also detect a change in the position of the device 400 or a component of the device 400 , the presence or absence of user contact with the device 400 , the device 400 orientation or acceleration/deceleration and the temperature change of the device 400 . The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
通信组件416被配置为便于装置400和其他设备之间有线或无线方式的通信。装置400可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件416经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件416还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 416 is configured to facilitate wired or wireless communication between the apparatus 400 and other devices. The device 400 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 416 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,装置400可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述身份验证方法。In an exemplary embodiment, apparatus 400 may be programmed by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the authentication method described above.
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器404,上述指令可由装置400的处理器420执行以完成上述方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as the memory 404 including instructions, which can be executed by the processor 420 of the device 400 to implement the above method. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
在示例性实施例中,还提供了一种非临时性计算机可读存储介质,当所述存储介质中的指令由移动终端的处理器执行时,使得移动终端能够执行上述身份验证方法。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium, and when the instructions in the storage medium are executed by the processor of the mobile terminal, the mobile terminal can execute the above identity verification method.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求指出。Other embodiments of the present disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, and these modifications, uses or adaptations follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not disclosed in the present disclosure . The specification and examples are to be considered exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求来限制。It should be understood that the present disclosure is not limited to the precise constructions which have been described above and shown in the drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (15)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610543529.7A CN106169075A (en) | 2016-07-11 | 2016-07-11 | Auth method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610543529.7A CN106169075A (en) | 2016-07-11 | 2016-07-11 | Auth method and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN106169075A true CN106169075A (en) | 2016-11-30 |
Family
ID=58065929
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201610543529.7A Pending CN106169075A (en) | 2016-07-11 | 2016-07-11 | Auth method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106169075A (en) |
Cited By (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107085733A (en) * | 2017-05-15 | 2017-08-22 | 山东工商学院 | Nearshore Infrared Ship Recognition Method Based on CNN Deep Learning |
| CN107491759A (en) * | 2017-08-21 | 2017-12-19 | 厦门中控智慧信息技术有限公司 | A kind of mixed mode register method and device |
| CN107908635A (en) * | 2017-09-26 | 2018-04-13 | 百度在线网络技术(北京)有限公司 | Establish textual classification model and the method, apparatus of text classification |
| CN108549849A (en) * | 2018-03-27 | 2018-09-18 | 康体佳智能科技(深圳)有限公司 | Pattern recognition system based on neural network and recognition methods |
| CN108596037A (en) * | 2018-03-27 | 2018-09-28 | 康体佳智能科技(深圳)有限公司 | Face identification system based on neural network and recognition methods |
| CN108664879A (en) * | 2017-03-28 | 2018-10-16 | 三星电子株式会社 | Face authentication method and apparatus |
| CN109165627A (en) * | 2018-09-11 | 2019-01-08 | 广东惠禾科技发展有限公司 | A kind of model building method, device and testimony of a witness checking method |
| CN109995761A (en) * | 2019-03-06 | 2019-07-09 | 百度在线网络技术(北京)有限公司 | Service processing method, device, electronic equipment and storage medium |
| CN110634219A (en) * | 2019-10-22 | 2019-12-31 | 软通动力信息技术有限公司 | Access control identification system, method, equipment and storage medium |
| CN111860057A (en) * | 2019-04-29 | 2020-10-30 | 北京眼神智能科技有限公司 | Face image blurring and living body detection method, device, storage medium and device |
| CN114078270A (en) * | 2020-08-19 | 2022-02-22 | 上海新氦类脑智能科技有限公司 | Human face identity verification method, device, equipment and medium based on shielding environment |
| CN119649506A (en) * | 2024-11-11 | 2025-03-18 | 安徽建工生态科技股份有限公司 | Image processing-based face access control recognition system, method and storage medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105184277A (en) * | 2015-09-29 | 2015-12-23 | 杨晴虹 | Living body human face recognition method and device |
| CN105243386A (en) * | 2014-07-10 | 2016-01-13 | 汉王科技股份有限公司 | Face liveness judgment method and system |
| CN105260726A (en) * | 2015-11-11 | 2016-01-20 | 杭州海量信息技术有限公司 | Interactive video in vivo detection method based on face attitude control and system thereof |
| CN105518713A (en) * | 2015-02-15 | 2016-04-20 | 北京旷视科技有限公司 | Live face verification method and system, computer program product |
| CN105678249A (en) * | 2015-12-31 | 2016-06-15 | 上海科技大学 | Face identification method aiming at registered face and to-be-identified face image quality difference |
| CN105701468A (en) * | 2016-01-12 | 2016-06-22 | 华南理工大学 | Face attractiveness evaluation method based on deep learning |
-
2016
- 2016-07-11 CN CN201610543529.7A patent/CN106169075A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105243386A (en) * | 2014-07-10 | 2016-01-13 | 汉王科技股份有限公司 | Face liveness judgment method and system |
| CN105518713A (en) * | 2015-02-15 | 2016-04-20 | 北京旷视科技有限公司 | Live face verification method and system, computer program product |
| CN105184277A (en) * | 2015-09-29 | 2015-12-23 | 杨晴虹 | Living body human face recognition method and device |
| CN105260726A (en) * | 2015-11-11 | 2016-01-20 | 杭州海量信息技术有限公司 | Interactive video in vivo detection method based on face attitude control and system thereof |
| CN105678249A (en) * | 2015-12-31 | 2016-06-15 | 上海科技大学 | Face identification method aiming at registered face and to-be-identified face image quality difference |
| CN105701468A (en) * | 2016-01-12 | 2016-06-22 | 华南理工大学 | Face attractiveness evaluation method based on deep learning |
Non-Patent Citations (1)
| Title |
|---|
| ZHANPENG ZHANG 等: "Facial Landmark Detection by Deep Multi-task Learning", 《ECCV 2014》 * |
Cited By (18)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108664879A (en) * | 2017-03-28 | 2018-10-16 | 三星电子株式会社 | Face authentication method and apparatus |
| US12525054B2 (en) | 2017-03-28 | 2026-01-13 | Samsung Electronics Co., Ltd. | Face verification method and apparatus |
| CN108664879B (en) * | 2017-03-28 | 2023-09-05 | 三星电子株式会社 | Face verification method and device |
| CN107085733A (en) * | 2017-05-15 | 2017-08-22 | 山东工商学院 | Nearshore Infrared Ship Recognition Method Based on CNN Deep Learning |
| CN107491759A (en) * | 2017-08-21 | 2017-12-19 | 厦门中控智慧信息技术有限公司 | A kind of mixed mode register method and device |
| CN107908635B (en) * | 2017-09-26 | 2021-04-16 | 百度在线网络技术(北京)有限公司 | Establishing text classification model and method and device for text classification |
| CN107908635A (en) * | 2017-09-26 | 2018-04-13 | 百度在线网络技术(北京)有限公司 | Establish textual classification model and the method, apparatus of text classification |
| US10783331B2 (en) | 2017-09-26 | 2020-09-22 | Baidu Online Network Technology (Beijing) Co., Ltd. | Method and apparatus for building text classification model, and text classification method and apparatus |
| CN108549849A (en) * | 2018-03-27 | 2018-09-18 | 康体佳智能科技(深圳)有限公司 | Pattern recognition system based on neural network and recognition methods |
| CN108596037A (en) * | 2018-03-27 | 2018-09-28 | 康体佳智能科技(深圳)有限公司 | Face identification system based on neural network and recognition methods |
| CN109165627A (en) * | 2018-09-11 | 2019-01-08 | 广东惠禾科技发展有限公司 | A kind of model building method, device and testimony of a witness checking method |
| CN109995761B (en) * | 2019-03-06 | 2021-10-19 | 百度在线网络技术(北京)有限公司 | Service processing method, device, electronic device and storage medium |
| CN109995761A (en) * | 2019-03-06 | 2019-07-09 | 百度在线网络技术(北京)有限公司 | Service processing method, device, electronic equipment and storage medium |
| CN111860057A (en) * | 2019-04-29 | 2020-10-30 | 北京眼神智能科技有限公司 | Face image blurring and living body detection method, device, storage medium and device |
| CN110634219A (en) * | 2019-10-22 | 2019-12-31 | 软通动力信息技术有限公司 | Access control identification system, method, equipment and storage medium |
| CN114078270A (en) * | 2020-08-19 | 2022-02-22 | 上海新氦类脑智能科技有限公司 | Human face identity verification method, device, equipment and medium based on shielding environment |
| CN114078270B (en) * | 2020-08-19 | 2024-09-06 | 上海新氦类脑智能科技有限公司 | Face identity verification method, device, equipment and medium based on shielding environment |
| CN119649506A (en) * | 2024-11-11 | 2025-03-18 | 安徽建工生态科技股份有限公司 | Image processing-based face access control recognition system, method and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN106169075A (en) | Auth method and device | |
| TWI754887B (en) | Method, device and electronic equipment for living detection and storage medium thereof | |
| TWI714834B (en) | Human face live detection method, device and electronic equipment | |
| TWI751161B (en) | Terminal equipment, smart phone, authentication method and system based on face recognition | |
| CN105654033B (en) | Face image verification method and device | |
| CN109376592B (en) | Liveness detection method, apparatus, and computer-readable storage medium | |
| CN106295566B (en) | Facial expression recognizing method and device | |
| US20190095701A1 (en) | Living-body detection method, device and storage medium | |
| CN105608425B (en) | The method and device of classification storage is carried out to photo | |
| CN108280418A (en) | The deception recognition methods of face image and device | |
| CN106295511B (en) | Face tracking method and device | |
| CN105631406B (en) | Image recognition processing method and device | |
| JP2018032391A (en) | Liveness test method and apparatus | |
| CN106897658A (en) | The discrimination method and device of face live body | |
| CN106557726A (en) | A face identity authentication system and method with silent liveness detection | |
| CN107545248A (en) | Biological characteristic biopsy method, device, equipment and storage medium | |
| CN110287672A (en) | Verification method and device, electronic device and storage medium | |
| CN105528078B (en) | The method and device of controlling electronic devices | |
| CN113409342A (en) | Training method and device for image style migration model and electronic equipment | |
| CN110287671A (en) | Verification method and device, electronic device and storage medium | |
| CN107766820A (en) | Image classification method and device | |
| WO2022048352A1 (en) | Unlocking method and apparatus based on facial expression, and computer device and storage medium | |
| CN108197585A (en) | Recognition algorithms and device | |
| CN108921178A (en) | Obtain method, apparatus, the electronic equipment of the classification of image fog-level | |
| CN106096510B (en) | Method and device for fingerprint recognition |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161130 |
|
| RJ01 | Rejection of invention patent application after publication |