WO2021036436A1 - Facial recognition method and apparatus - Google Patents

Facial recognition method and apparatus Download PDF

Info

Publication number
WO2021036436A1
WO2021036436A1 PCT/CN2020/096992 CN2020096992W WO2021036436A1 WO 2021036436 A1 WO2021036436 A1 WO 2021036436A1 CN 2020096992 W CN2020096992 W CN 2020096992W WO 2021036436 A1 WO2021036436 A1 WO 2021036436A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
recognized
face
compared
features
Prior art date
Application number
PCT/CN2020/096992
Other languages
French (fr)
Chinese (zh)
Inventor
韩雨
杭欣
Original Assignee
苏宁易购集团股份有限公司
苏宁云计算有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏宁易购集团股份有限公司, 苏宁云计算有限公司 filed Critical 苏宁易购集团股份有限公司
Priority to CA3152812A priority Critical patent/CA3152812A1/en
Publication of WO2021036436A1 publication Critical patent/WO2021036436A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/172Classification, e.g. identification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/161Detection; Localisation; Normalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V40/00Recognition of biometric, human-related or animal-related patterns in image or video data
    • G06V40/10Human or animal bodies, e.g. vehicle occupants or pedestrians; Body parts, e.g. hands
    • G06V40/16Human faces, e.g. facial parts, sketches or expressions
    • G06V40/168Feature extraction; Face representation

Definitions

  • the present invention relates to the technical field of computer vision, in particular to a face recognition method and device.
  • Face recognition is a kind of biometric recognition technology based on human facial feature information.
  • a series of related technologies that use a video camera or camera to collect images or video streams containing human faces, and automatically detect and track human faces in the images, and then recognize the detected human faces, usually also called face recognition and facial recognition.
  • face recognition technology has become one of the hottest applications of artificial intelligence, such as swiping face to board plane, swiping face to get toilet paper, swiping face to pay, swiping face to check attendance, swiping face to recognize pedestrians running red lights, and so on.
  • Face recognition usually has the following three application modes:
  • the 1:1 mode also known as the identity verification mode, is essentially a process in which the computer quickly compares the current face with the portrait database and finds whether it matches. It can be simply understood as proving that you are you. "Face-swiping" boarding, ticket checking, and payment all belong to the 1:1 verification;
  • the 1 to N mode is to find the current user's face data (ie the image to be recognized) in a massive portrait database and perform matching. People who commit abductions and expose red lights are all classified as 1:N face recognition, that is, one target is found out of N faces;
  • the M-to-N mode is a process of facial recognition of all people in the scene through the computer and comparison with the portrait database. It is a dynamic face comparison, which can be fully applied to a variety of scenarios, such as public security, welcoming, and Robot applications, etc.
  • the factors that affect the accuracy of face recognition include:
  • the embodiments of the present invention provide a face recognition method and device to overcome the face recognition caused by factors such as the increase in the number of comparisons and the increase in the number of registered base IDs in the prior art. Problems such as low accuracy.
  • the technical solution adopted by the present invention is:
  • a face recognition method includes the following steps:
  • each ID in the comparison library includes multiple reference images with different poses in different scenarios;
  • the facial features of the image to be identified and all features of the reference image to be compared it is determined whether the image to be identified matches the reference image to be compared.
  • the acquiring the facial features of the image to be recognized according to the image to be recognized includes:
  • the identification request when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
  • the obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
  • the judging whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all the features of the reference image to be compared includes:
  • the reference images to be compared are all reference images under all IDs in the comparison library
  • the obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
  • the judging whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all the features of the reference image to be compared includes:
  • a face recognition device in another aspect, includes:
  • the data acquisition module is used to acquire the recognition request and the image to be recognized
  • the first feature acquisition module is configured to acquire the facial features of the image to be identified according to the image to be identified;
  • the second feature acquisition module is configured to acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes references of different poses in multiple different scenarios image;
  • the image recognition module is configured to determine whether the image to be recognized matches the reference image to be compared based on the facial features of the image to be recognized and all the features of the reference image to be compared.
  • the first feature acquisition module includes:
  • An image detection unit configured to perform face frame detection and face key point detection on the to-be-recognized image, and obtain a face image and key point positions corresponding to the to-be-recognized image;
  • a normalization processing unit configured to perform normalization processing on the face image according to the position of the key point to obtain a processed face image
  • the feature extraction unit is configured to perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
  • the identification request when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
  • the second feature acquisition module is specifically used for:
  • the image recognition module includes:
  • the first calculation unit is configured to calculate each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized The similarity;
  • a first comparison unit configured to compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully;
  • the second comparison unit is configured to obtain the number of reference images that are successfully matched with the image to be identified, and if the number exceeds half of the total number of the reference images, determine that the image to be identified is compared with the image to be identified The ID of the reference image matches successfully.
  • the reference images to be compared are all reference images under all IDs in the comparison library
  • the second feature acquisition module is also used for:
  • the image recognition module further includes:
  • the second calculation unit is configured to calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
  • the third comparison unit is used to determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, and if so, it is determined that the image to be recognized matches the ID with the highest similarity value, otherwise it is determined that the The image to be recognized is an unregistered image.
  • the face recognition method and device provided by the embodiments of the present invention use a comparison library of reference images of different poses in multiple different scenarios with the same ID as the matching standard, which improves the accuracy of recognition and enhances the robustness of the algorithm It has good adaptability to the facial expression and picture quality of the recognized image;
  • the face recognition method and device provided by the embodiments of the present invention adopt the scheme of detecting the face frame and the key points of the face together, which can not only accurately locate the face position, but also reduce the steps and time in the recognition process. , Improve the efficiency of recognition;
  • the face recognition method and device provided by the embodiments of the present invention select the ID with the highest similarity by first calculating the similarity between each reference image under each ID and the image to be recognized in a 1:N recognition scenario , And then determine whether the similarity meets the second preset threshold to match the ID matching the image to be recognized, which improves the anti-attack ability of the algorithm.
  • Fig. 1 is a flowchart showing a face recognition method according to an exemplary embodiment
  • Fig. 2 is a flow chart showing obtaining facial features of an image to be recognized according to an image to be recognized according to an exemplary embodiment
  • Fig. 3 shows according to an exemplary embodiment in the 1:1 mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared Flow chart
  • Fig. 4 shows according to an exemplary embodiment in the 1 to N mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared Flow chart
  • Fig. 5 is a schematic structural diagram of a face recognition device according to an exemplary embodiment.
  • Facial features are the most suitable type of biological features for identification. Compared with fingerprints, iris and other features, they have the advantages of simple collection, low cost, and easy identification.
  • the use of human face for identity recognition has a wide range of applications in many scenarios such as face-swiping login, face-swiping credit investigation, and security verification. On the one hand, face recognition reduces manual operations and can save costs. On the other hand, it facilitates identity verification and improves user experience.
  • the basic process of face recognition is to extract features from the face image to be recognized, and then compare with the face features registered in the database.
  • Fig. 1 is a flowchart of a face recognition method according to an exemplary embodiment. Referring to Fig. 1, the method includes the following steps:
  • the image to be recognized is collected from the photo, video or camera, and the corresponding recognition request is obtained.
  • face recognition includes three modes: 1:1 mode, 1:N mode, and M:N mode.
  • the face recognition method provided by the embodiment of the present invention is mainly applicable to 1:1 recognition scenarios and 1:N recognition scenarios. Therefore, the recognition request in the embodiment of the present invention mainly includes a 1:1 recognition request or a 1:1 recognition request. N identifies the request.
  • 1:1 matching mainly solves the problem of determining whether the image to be recognized and the reference image belong to the same person
  • 1:N matching mainly solves the problem of determining which person the image to be recognized belongs to.
  • S2 Acquire the facial features of the image to be recognized according to the image to be recognized.
  • the facial features of the image to be recognized need to be extracted from the image to be recognized.
  • a convolutional neural network may be used in the embodiment of the present invention to extract the facial features of the image to be recognized.
  • the facial features of the image that is, the depth features of the image to be recognized).
  • the identification request in the embodiment of the present invention mainly includes a 1:1 identification request or a 1:N identification request.
  • a method of comparing the facial features of the image to be recognized with the features of the reference image to be compared is adopted. Since different recognition requests use different reference images to be compared, it is also necessary to obtain all the features of the corresponding reference images to be compared from the comparison library according to the recognition request.
  • Each ID in the comparison library includes multiple reference images with different poses in different scenarios to ensure the diversity of the comparison library, thereby increasing the probability of successful recognition.
  • the reference image maintained under each ID in the comparison library mainly includes the following three scenarios:
  • the ID photos uploaded by the company or group members are authorized to be used for internal personnel authentication, and can be used as a reference image for a class of scenes.
  • the face-scanning login function of social software will ask for the user's authorization and use the avatar for personal identity authentication.
  • the user is asked to nod or shake his head.
  • the camera will check the action, and automatically collect the right and left deflection facial image and store it under the corresponding ID as a reference image.
  • the reference image when the reference image is collected, it must meet the following quality screening standards: meet the multi-dimensional thresholds of sharpness, angle and facial features, and the selected reference image should take into account the face and small deflection.
  • the profile of the face is used to increase the probability of matching successfully with the image to be recognized in a variety of poses.
  • the reference image in the comparison library is collected through a 1:1 port, when registering to the comparison library, enter a video of the registrant, and use the quality algorithm to obtain the best quality from the video. Feature extraction of several photos is registered and stored. If it is collected through a 1:N port, after collecting the photos to be recognized, compare them with the existing reference images in the comparison library. If the similarity of the closest reference image is also lower than the set threshold, then Considering that there is no reference image corresponding to the ID in the base library, track the person in the image to be recognized, collect a video, use a quality algorithm to select several pictures with the best quality from the video, and create a new ID to add to the registration library.
  • S4 Determine whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all features of the reference image to be compared.
  • the similarity between the image to be identified and the reference image to be compared is calculated based on the facial features of the image to be identified and all the features of the reference image to be compared, and then the image to be identified and the reference image to be compared are judged based on the similarity. Whether the reference image matches.
  • Fig. 2 is a flow chart showing the acquisition of facial features of the image to be recognized according to the image to be recognized according to an exemplary embodiment.
  • the Obtaining the facial features of the image to be recognized according to the image to be recognized includes:
  • S2.1 Perform face frame detection and face key point detection on the image to be recognized, and obtain the face image and key point positions corresponding to the image to be recognized.
  • performing face frame detection on the image to be recognized refers to detecting and locating the face in the image to be recognized, returning high-precision face frame coordinates, and intercepting the face image in the image to be recognized according to the coordinates.
  • the key points of the face are detected on the image to be recognized, and the key areas of the face are located, including the key points of the eyes, nose, and mouth.
  • the detected face images in the image to be recognized include one or more, and the user can decide whether to recognize a single face frame or a multi-person face frame according to the actual application scenario, which is not limited in the embodiment of the present invention.
  • S2.2 Perform normalization processing on the face image according to the position of the key point, and obtain a processed face image.
  • Face normalization includes two aspects: one is geometric normalization, and the other is gray normalization. Geometric normalization is also called position calibration. It will help correct size differences and angle tilts caused by changes in imaging distance and face pose, and can solve the problems of face scale changes and face rotation. Specifically, it includes three links: normalization of face scale, flat face rotation correction (tilted head), and deep face rotation correction (face twisting). For some highly demanding deep face rotation correction, a 3D model of the face can be used.
  • Gray normalization is used to compensate the face image obtained under different light intensities and light source directions, so as to reduce the change of the image signal caused by the change of light alone. It should be noted here that, in order to facilitate subsequent use of models (such as convolutional neural networks) to extract facial features, in the embodiment of the present invention, the facial image needs to be adjusted to a size suitable for the input model.
  • S2.3 Perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
  • a pre-trained convolutional neural network is used to perform feature extraction on the face image processed by the above steps to obtain the face feature corresponding to the image to be recognized.
  • the identification request when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
  • the obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
  • the acquired recognition request is a 1:1 recognition request.
  • the recognition request includes the recognition request.
  • the ID of the compared reference image At this time, according to the ID of the reference image to be compared, all the features of all the reference images under the ID are obtained from the comparison library.
  • Fig. 3 is a flow chart showing whether the image to be recognized matches the reference image to be compared according to the facial features of the image to be recognized and all the features of the reference image to be compared according to an exemplary embodiment, refer to Fig. 3 As shown, as a preferred embodiment, in the embodiment of the present invention, the judgment is made based on the facial features of the image to be recognized and all the features of the reference image to be compared. Whether the reference image to be compared matches or not includes:
  • S401 Calculate the similarity between each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized.
  • each reference image under the ID of the reference image to be compared needs to be compared with the image to be recognized.
  • the similarity between each reference image and the image to be recognized can be calculated based on all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized, and the image can be determined based on the similarity. Comparison.
  • S402 Compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully.
  • the first preset threshold may be set according to actual requirements, and the specific value of the first preset threshold is not limited here.
  • the similarity between the reference image and the image to be recognized exceeds (that is, greater than) the first preset threshold, it is determined that the reference image is successfully matched with the image to be recognized.
  • S403 Acquire the number of reference images that are successfully matched with the image to be recognized, and if the number exceeds half of the total number of reference images, determine the ID of the image to be recognized and the reference image to be compared The match is successful.
  • the number of reference images successfully matched with the image to be recognized under the ID of the reference image to be compared exceeds the total number of reference images participating in the matching (here refers to the total number of reference images under the ID of the reference image to be compared )
  • it is finally determined that the ID matching of the image to be identified and the reference image to be compared is successful; otherwise, it is determined that the ID matching of the image to be identified and the reference image to be compared is unsuccessful.
  • This setting can avoid the low similarity between the reference image with the same ID and the single image to be recognized due to large differences in scenes, occlusions, etc., and it can also shield the reference image with different IDs and the image to be recognized due to accident
  • the problem of high similarity caused by factors can improve the accuracy of recognition.
  • the reference images to be compared are all reference images under all IDs in the comparison library ;
  • the acquiring all the features of the reference image to be compared from the comparison library according to the recognition request includes:
  • the obtained recognition request is a 1:N recognition request.
  • the reference image to be compared Compare all reference images under all IDs in the library. At this time, all features of all reference images under all IDs need to be obtained from the comparison library.
  • Fig. 4 shows according to an exemplary embodiment in the 1 to N mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared 4, as a preferred embodiment, in an embodiment of the present invention, according to the facial features of the image to be recognized and all features of the reference image to be compared, Determining whether the image to be recognized matches the reference image to be compared includes:
  • S501 Calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized.
  • the face recognition mode is a 1:N mode
  • all reference images under all IDs in the comparison library need to be compared with the image to be recognized.
  • the similarity between each reference image and the image to be recognized can be calculated based on all the features of each reference image under each ID and the facial features of the image to be recognized, and the image comparison can be performed based on the similarity.
  • S502 Determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, if so, determine that the image to be recognized matches the ID with the highest similarity value; otherwise, determine that the image to be recognized is unidentified. Register the image.
  • the second preset threshold can be set according to actual needs.
  • the specific value of the second preset threshold is not limited here, and the second preset threshold is set to shield the attack of unregistered ID photos.
  • the image to be recognized that is unsuccessfully matched with the reference image to be compared is registered with the comparison library, a new ID is generated, and the The image to be recognized is stored in the new ID as a reference image under the new ID.
  • Fig. 5 is a schematic structural diagram of a face recognition device according to an exemplary embodiment. Referring to Fig. 5, the device includes:
  • the data acquisition module is used to acquire the recognition request and the image to be recognized
  • the first feature acquisition module is configured to acquire the facial features of the image to be identified according to the image to be identified;
  • the second feature acquisition module is configured to acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes references of different poses in multiple different scenarios image;
  • the image recognition module is configured to determine whether the image to be recognized matches the reference image to be compared based on the facial features of the image to be recognized and all the features of the reference image to be compared.
  • the first feature acquisition module includes:
  • An image detection unit configured to perform face frame detection and face key point detection on the to-be-recognized image, and obtain a face image and key point positions corresponding to the to-be-recognized image;
  • a normalization processing unit configured to perform normalization processing on the face image according to the position of the key point to obtain a processed face image
  • the feature extraction unit is configured to perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
  • the identification request when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
  • the second feature acquisition module is specifically used for:
  • the image recognition module includes:
  • the first calculation unit is configured to calculate each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized The similarity;
  • a first comparison unit configured to compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully;
  • the second comparison unit is configured to obtain the number of reference images that are successfully matched with the image to be identified, and if the number exceeds half of the total number of the reference images, determine that the image to be identified is compared with the image to be identified The ID of the reference image matches successfully.
  • the reference images to be compared are all reference images under all IDs in the comparison library ;
  • the second feature acquisition module is also used for:
  • the image recognition module further includes:
  • the second calculation unit is configured to calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
  • the third comparison unit is used to determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, and if so, it is determined that the image to be recognized matches the ID with the highest similarity value, otherwise it is determined that the The image to be recognized is an unregistered image.
  • the face recognition method and device provided by the embodiments of the present invention use a comparison library of reference images of different poses in multiple different scenarios with the same ID as the matching standard, which improves the accuracy of recognition and enhances the robustness of the algorithm It has good adaptability to the facial expression and picture quality of the recognized image;
  • the face recognition method and device provided by the embodiments of the present invention adopt the scheme of detecting the face frame and the key points of the face together, which can not only accurately locate the face position, but also reduce the steps and time in the recognition process. , Improve the efficiency of recognition;
  • the face recognition method and device provided by the embodiments of the present invention select the ID with the highest similarity by first calculating the similarity between each reference image under each ID and the image to be recognized in a 1:N recognition scenario , And then determine whether the similarity meets the second preset threshold to match the ID matching the image to be recognized, which improves the anti-attack ability of the algorithm.
  • the face recognition device provided in the above embodiment triggers the face recognition service
  • only the division of the above functional modules is used as an example for illustration.
  • the above functions can be allocated to different functions according to needs.
  • Module completion that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the face recognition device provided in the above embodiment and the face recognition method embodiment belong to the same concept, that is, the device is based on the face recognition method.
  • the specific implementation process please refer to the method embodiment, which will not be repeated here.
  • the program can be stored in a computer-readable storage medium.
  • the storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Oral & Maxillofacial Surgery (AREA)
  • General Health & Medical Sciences (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)
  • Collating Specific Patterns (AREA)

Abstract

Disclosed are a facial recognition method and apparatus. The method comprises: acquiring a recognition request and an image to be recognized; according to the image to be recognized, acquiring a facial feature of the image to be recognized; according to the recognition request, acquiring, from a comparison library, all features of a reference image for comparison, wherein each ID in the comparison library comprises reference images of different postures in a plurality of different scenarios; and according to the facial feature of the image to be recognized, and all the features of the reference image for comparison, determining whether the image to be recognized matches the reference image for comparison. According to the present invention, by using the comparison library of reference images, of the same ID, of different postures in a plurality of different scenarios as a matching standard, the recognition accuracy is improved, the robustness of an algorithm is enhanced, and a better adaptability to the expression, image quality, etc. of an image to be recognized is provided.

Description

一种人脸识别方法及装置Face recognition method and device 技术领域Technical field
本发明涉及计算机视觉技术领域,特别涉及一种人脸识别方法及装置。The present invention relates to the technical field of computer vision, in particular to a face recognition method and device.
背景技术Background technique
人脸识别,是基于人的脸部特征信息进行身份识别的一种生物识别技术。用摄像机或摄像头采集含有人脸的图像或视频流,并自动在图像中检测和跟踪人脸,进而对检测到的人脸进行识别的一系列相关技术,通常也叫做人像识别、面部识别。随着技术的发展,人脸识别技术已成人工智能最火热的应用之一,如刷脸登机、刷脸取厕纸、刷脸支付、刷脸考勤、刷脸识别闯红灯的行人等等。Face recognition is a kind of biometric recognition technology based on human facial feature information. A series of related technologies that use a video camera or camera to collect images or video streams containing human faces, and automatically detect and track human faces in the images, and then recognize the detected human faces, usually also called face recognition and facial recognition. With the development of technology, face recognition technology has become one of the hottest applications of artificial intelligence, such as swiping face to board plane, swiping face to get toilet paper, swiping face to pay, swiping face to check attendance, swiping face to recognize pedestrians running red lights, and so on.
人脸识别的通常有以下三种应用模式:Face recognition usually has the following three application modes:
1、1比1模式,又称身份验证模式,本质上是计算机对当前人脸与人像数据库进行快速人脸比对并得出是否匹配的过程,可以简单理解为证明你就是你。“刷脸”登机、验票、支付都属于1∶1的人证核验;1. The 1:1 mode, also known as the identity verification mode, is essentially a process in which the computer quickly compares the current face with the portrait database and finds whether it matches. It can be simply understood as proving that you are you. "Face-swiping" boarding, ticket checking, and payment all belong to the 1:1 verification;
2、1比N模式,是在海量的人像数据库中找出当前用户的人脸数据(即待识别图像)并进行匹配。打拐、曝光闯红灯者均属于1∶N人脸识别,即从N个人脸中找出1个目标;2. The 1 to N mode is to find the current user's face data (ie the image to be recognized) in a massive portrait database and perform matching. People who commit abductions and expose red lights are all classified as 1:N face recognition, that is, one target is found out of N faces;
3、M比N模式,是通过计算机对场景内所有人进行面部识别并与人像数据库进行比对的过程,是动态人脸比对,能充分应用于多种场景,例如公共安防,迎宾,机器人应用等。3. The M-to-N mode is a process of facial recognition of all people in the scene through the computer and comparison with the portrait database. It is a dynamic face comparison, which can be fully applied to a variety of scenarios, such as public security, welcoming, and Robot applications, etc.
但是,随着1比1模式中比对次数的增加以及1比N模式中注册底库ID数量的增长等因素,匹配失败和匹配错误的概率会明显增加,这主要是由于人脸特征的变化差异大造成的。其中,影响人脸识别准确率的因素包括:However, with the increase in the number of comparisons in the 1:1 mode and the increase in the number of registered base IDs in the 1:N mode, the probability of matching failures and matching errors will increase significantly, mainly due to changes in facial features Caused by big differences. Among them, the factors that affect the accuracy of face recognition include:
(1)人脸特征并非是固定不变的,会随着年龄、表情、姿态、化妆等发生明显的变化;(1) The facial features are not fixed and will change significantly with age, expression, posture, makeup, etc.;
(2)饰物、眼镜、口罩或者其他物体的遮挡造成的人脸不全也会增加识别的难度;(2) The incomplete face caused by the occlusion of accessories, glasses, masks or other objects will also increase the difficulty of recognition;
(3)训练集的采集环境如光照、设备的参数等会限制算法模型在其他场景测试集上的表现;(3) The collection environment of the training set, such as lighting, equipment parameters, etc., will limit the performance of the algorithm model on the test set of other scenarios;
(4)不同人可能采用相似的化妆方式和造型、佩戴相似的饰物等增加了不同人的相似性。(4) Different people may adopt similar makeup methods and styles, wear similar accessories, etc., which increase the similarity of different people.
因此,亟需提出一种新的人脸识别方法,已解决上述诸多问题Therefore, there is an urgent need to propose a new face recognition method that has solved many of the above problems
发明内容Summary of the invention
为了解决现有技术的问题,本发明实施例提供了一种人脸识别方法及装置,以克服现有技术中由于比对次数的增加以及注册底库ID数量的增长等因素导致的人脸识别准确率低等问题。In order to solve the problems of the prior art, the embodiments of the present invention provide a face recognition method and device to overcome the face recognition caused by factors such as the increase in the number of comparisons and the increase in the number of registered base IDs in the prior art. Problems such as low accuracy.
为解决上述一个或多个技术问题,本发明采用的技术方案是:In order to solve one or more of the above technical problems, the technical solution adopted by the present invention is:
一方面,提供了一种人脸识别方法,该方法包括如下步骤:On the one hand, a face recognition method is provided, and the method includes the following steps:
获取识别请求以及待识别图像;Obtain the recognition request and the image to be recognized;
根据所述待识别图像获取所述待识别图像的人脸特征;Acquiring the facial features of the image to be recognized according to the image to be recognized;
根据所述识别请求从比对库中获取待比对的参照图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像;Acquiring all the features of the reference image to be compared from the comparison library according to the recognition request, each ID in the comparison library includes multiple reference images with different poses in different scenarios;
根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。According to the facial features of the image to be identified and all features of the reference image to be compared, it is determined whether the image to be identified matches the reference image to be compared.
进一步的,所述根据所述待识别图像获取所述待识别图像的人脸特征包括:Further, the acquiring the facial features of the image to be recognized according to the image to be recognized includes:
对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置;Performing face frame detection and face key point detection on the image to be recognized, and acquiring a face image and key point positions corresponding to the image to be recognized;
根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人脸图 像;Normalize the face image according to the position of the key point, and obtain a processed face image;
对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。Perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
进一步的,当所述识别请求为1比1识别请求时,所述识别请求包括待比对的参照图像的ID;Further, when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
根据所述待比对的参照图像的ID从所述比对库中获取所述待比对的参照图像的ID下的所有参照图像的所有特征。Obtain all features of all reference images under the ID of the reference image to be compared from the comparison library according to the ID of the reference image to be compared.
进一步的,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:Further, the judging whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all the features of the reference image to be compared includes:
将所述待比对的参照图像的ID下的每一参照图像的所有特征与所述待识别图像的人脸特征进行比较,若相似度超过第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功;All the features of each reference image under the ID of the reference image to be compared are compared with the facial features of the image to be recognized, and if the similarity exceeds a first preset threshold, it is determined that the reference image is The image to be recognized is successfully matched;
获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。Acquire the number of reference images that are successfully matched with the image to be recognized, and if the number exceeds half of the total number of reference images, determine that the ID of the image to be recognized and the reference image to be compared are successfully matched .
进一步的,当所述识别请求为1比N识别请求时,所述待比对的参照图像为所述比对库中所有ID下的所有参照图像;Further, when the recognition request is a 1 to N recognition request, the reference images to be compared are all reference images under all IDs in the comparison library;
所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
根据所述识别请求从所述比对库中获取所有ID下的所有参照图像的所有特征。Obtain all features of all reference images under all IDs from the comparison library according to the identification request.
进一步的,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:Further, the judging whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all the features of the reference image to be compared includes:
根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度;Calculating and acquiring the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定 所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。Determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, if it is satisfied, determine that the image to be recognized matches the ID with the highest similarity value, otherwise determine that the image to be recognized is an unregistered image .
另一方面,提供了一种人脸识别装置,所述装置包括:In another aspect, a face recognition device is provided, and the device includes:
数据获取模块,用于获取识别请求以及待识别图像;The data acquisition module is used to acquire the recognition request and the image to be recognized;
第一特征获取模块,用于根据所述待识别图像获取所述待识别图像的人脸特征;The first feature acquisition module is configured to acquire the facial features of the image to be identified according to the image to be identified;
第二特征获取模块,用于根据所述识别请求从比对库中获取待比对的参照图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像;The second feature acquisition module is configured to acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes references of different poses in multiple different scenarios image;
图像识别模块,用于根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。The image recognition module is configured to determine whether the image to be recognized matches the reference image to be compared based on the facial features of the image to be recognized and all the features of the reference image to be compared.
进一步的,所述第一特征获取模块包括:Further, the first feature acquisition module includes:
图像检测单元,用于对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置;An image detection unit, configured to perform face frame detection and face key point detection on the to-be-recognized image, and obtain a face image and key point positions corresponding to the to-be-recognized image;
归一化处理单元,用于根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人脸图像;A normalization processing unit, configured to perform normalization processing on the face image according to the position of the key point to obtain a processed face image;
特征提取单元,用于对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。The feature extraction unit is configured to perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
进一步的,当所述识别请求为1比1识别请求时,所述识别请求包括待比对的参照图像的ID;Further, when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
所述第二特征获取模块具体用于:The second feature acquisition module is specifically used for:
根据所述待比对的参照图像的ID从所述比对库中获取所述待比对的参照图像的ID下的所有参照图像的所有特征。Obtain all features of all reference images under the ID of the reference image to be compared from the comparison library according to the ID of the reference image to be compared.
进一步的,所述图像识别模块包括:Further, the image recognition module includes:
第一计算单元,用于根据所述待比对的参照图像的ID下的每一参照图像的 所有特征与所述待识别图像的人脸特征计算所述每一参照图像与所述待识别图像的相似度;The first calculation unit is configured to calculate each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized The similarity;
第一比较单元,用于将所述相似度与第一预设阈值进行比较,若所述相似度大于所述第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功;A first comparison unit, configured to compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully;
第二比较单元,用于获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。The second comparison unit is configured to obtain the number of reference images that are successfully matched with the image to be identified, and if the number exceeds half of the total number of the reference images, determine that the image to be identified is compared with the image to be identified The ID of the reference image matches successfully.
进一步的,当所述识别请求为1比N识别请求时,所述待比对的参照图像为所述比对库中所有ID下的所有参照图像;Further, when the recognition request is a 1 to N recognition request, the reference images to be compared are all reference images under all IDs in the comparison library;
所述第二特征获取模块还用于:The second feature acquisition module is also used for:
根据所述识别请求从所述比对库中获取所有ID下的所有参照图像的所有特征。Obtain all features of all reference images under all IDs from the comparison library according to the identification request.
进一步的,所述图像识别模块还包括:Further, the image recognition module further includes:
第二计算单元,用于根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度;The second calculation unit is configured to calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
第三比较单元,用于判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。The third comparison unit is used to determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, and if so, it is determined that the image to be recognized matches the ID with the highest similarity value, otherwise it is determined that the The image to be recognized is an unregistered image.
本发明实施例提供的技术方案带来的有益效果是:The beneficial effects brought about by the technical solutions provided by the embodiments of the present invention are:
1、本发明实施例提供的人脸识别方法及装置,通过使用同一ID的多个不同场景下的不同姿态的参照图像的对比库作为匹配标准,提高了识别的准确率,增强算法的鲁棒性,并且对待识别图像的表情、画质等有较好的适应性;1. The face recognition method and device provided by the embodiments of the present invention use a comparison library of reference images of different poses in multiple different scenarios with the same ID as the matching standard, which improves the accuracy of recognition and enhances the robustness of the algorithm It has good adaptability to the facial expression and picture quality of the recognized image;
2、本发明实施例提供的人脸识别方法及装置,通过采用人脸框以及人脸关键点一起检测的方案,不仅可以准确地定位人脸位置,还可以减少了识别过程中的步骤和时间,提高识别效率;2. The face recognition method and device provided by the embodiments of the present invention adopt the scheme of detecting the face frame and the key points of the face together, which can not only accurately locate the face position, but also reduce the steps and time in the recognition process. , Improve the efficiency of recognition;
3、本发明实施例提供的人脸识别方法及装置,通过在1比N识别场景下采 用先计算每一ID下的每一参照图像与待识别图像的相似度,选取出相似度最高的ID,然后判断该相似度是否满足第二预设阈值从而匹配出与待识别图像匹配的ID,提高了算法的抗攻击能力。3. The face recognition method and device provided by the embodiments of the present invention select the ID with the highest similarity by first calculating the similarity between each reference image under each ID and the image to be recognized in a 1:N recognition scenario , And then determine whether the similarity meets the second preset threshold to match the ID matching the image to be recognized, which improves the anti-attack ability of the algorithm.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present invention more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained from these drawings without creative work.
图1是根据一示例性实施例示出的人脸识别方法的流程图;Fig. 1 is a flowchart showing a face recognition method according to an exemplary embodiment;
图2是根据一示例性实施例示出的根据待识别图像获取待识别图像的人脸特征的流程图;Fig. 2 is a flow chart showing obtaining facial features of an image to be recognized according to an image to be recognized according to an exemplary embodiment;
图3是根据一示例性实施例示出的在1比1模式时,根据待识别图像的人脸特征以及待比对的参照图像的所有特征,判断待识别图像与待比对的参照图像是否匹配的流程图;Fig. 3 shows according to an exemplary embodiment in the 1:1 mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared Flow chart
图4是根据一示例性实施例示出的在1比N模式时,根据待识别图像的人脸特征以及待比对的参照图像的所有特征,判断待识别图像与待比对的参照图像是否匹配的流程图;Fig. 4 shows according to an exemplary embodiment in the 1 to N mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared Flow chart
图5是根据一示例性实施例示出的人脸识别装置的结构示意图。Fig. 5 is a schematic structural diagram of a face recognition device according to an exemplary embodiment.
具体实施方式detailed description
为使本发明的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only A part of the embodiments of the present invention, but not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
人脸特征是最适合标定身份的一类生物特征,相较于指纹、虹膜等特征具有采集简单、费用低廉、易识别的优点。利用人脸进行身份识别在刷脸登录、刷脸征信、安防验证等许多场景中都有广泛的应用。一方面人脸识别减少了人工操作,能够节省成本,另一方面方便身份校验,提升了用户的体验。人脸识别的基本过程是对待识别的人脸图像提取特征,然后和数据库中已经注册的人脸特征进行比对。Facial features are the most suitable type of biological features for identification. Compared with fingerprints, iris and other features, they have the advantages of simple collection, low cost, and easy identification. The use of human face for identity recognition has a wide range of applications in many scenarios such as face-swiping login, face-swiping credit investigation, and security verification. On the one hand, face recognition reduces manual operations and can save costs. On the other hand, it facilitates identity verification and improves user experience. The basic process of face recognition is to extract features from the face image to be recognized, and then compare with the face features registered in the database.
图1是根据一示例性实施例示出的人脸识别方法的流程图,参照图1所示,该方法包括如下步骤:Fig. 1 is a flowchart of a face recognition method according to an exemplary embodiment. Referring to Fig. 1, the method includes the following steps:
S1:获取识别请求以及待识别图像。S1: Obtain the recognition request and the image to be recognized.
具体的,首先,从照片、视频或摄像头中采集待识别图像,并获取对应的识别请求。通常人脸识别包括三种模式:1比1模式、1比N模式以及M:N模式。这里需要说明的是,本发明实施例提供的人脸识别方法主要适用于1比1识别场景以及1比N识别场景,因而本发明实施例中的识别请求主要包括1比1识别请求或1比N识别请求。其中,1比1匹配主要解决的是判定待识别图像与参照图像是否属于同一个人的问题,而1比N匹配主要解决的是判定待识别图像属于哪一个人的问题。Specifically, first, the image to be recognized is collected from the photo, video or camera, and the corresponding recognition request is obtained. Generally, face recognition includes three modes: 1:1 mode, 1:N mode, and M:N mode. It should be noted here that the face recognition method provided by the embodiment of the present invention is mainly applicable to 1:1 recognition scenarios and 1:N recognition scenarios. Therefore, the recognition request in the embodiment of the present invention mainly includes a 1:1 recognition request or a 1:1 recognition request. N identifies the request. Among them, 1:1 matching mainly solves the problem of determining whether the image to be recognized and the reference image belong to the same person, while 1:N matching mainly solves the problem of determining which person the image to be recognized belongs to.
S2:根据所述待识别图像获取所述待识别图像的人脸特征。S2: Acquire the facial features of the image to be recognized according to the image to be recognized.
具体的,对待识别图像进行人脸识别前,需要先从待识别图像中提取待识别图像的人脸特征,作为一种较优的示例,本发明实施例中可以采用卷积神经网络提取待识别图像的人脸特征(即待识别图像的深度特征)。Specifically, before performing face recognition on the image to be recognized, the facial features of the image to be recognized need to be extracted from the image to be recognized. As a better example, a convolutional neural network may be used in the embodiment of the present invention to extract the facial features of the image to be recognized. The facial features of the image (that is, the depth features of the image to be recognized).
S3:根据所述识别请求从比对库中获取待比对的参照图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像。S3: Acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes multiple reference images with different poses in different scenarios.
具体的,本发明实施例中识别请求主要包括1比1识别请求或1比N识别请求。具体进行识别时,采用将待识别图像的人脸特征与待比对的参照图像的特征进行比对的方式。由于不同的识别请求所采用的待比对的参照图像也有所不同,因此,还需根据识别请求从比对库中获取相应的待比对的参照图像的所 有特征。Specifically, the identification request in the embodiment of the present invention mainly includes a 1:1 identification request or a 1:N identification request. When performing specific recognition, a method of comparing the facial features of the image to be recognized with the features of the reference image to be compared is adopted. Since different recognition requests use different reference images to be compared, it is also necessary to obtain all the features of the corresponding reference images to be compared from the comparison library according to the recognition request.
比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像,保证比对库的多样性,从而提升识别成功的概率。其中,本发明实施例中,比对库中每一个ID下维护的参照图像主要包括以下三种场景:Each ID in the comparison library includes multiple reference images with different poses in different scenarios to ensure the diversity of the comparison library, thereby increasing the probability of successful recognition. Among them, in the embodiment of the present invention, the reference image maintained under each ID in the comparison library mainly includes the following three scenarios:
1、得到授权,可用于个人身份认证的证件照1. Authorized ID photo that can be used for personal identity authentication
公司或团体成员上传的证件照被授权用于内部人员的人份认证,可以作为一类场景的参照图像。The ID photos uploaded by the company or group members are authorized to be used for internal personnel authentication, and can be used as a reference image for a class of scenes.
2、得到授权的刷脸登录注册照2. Authorized face-swiping login registration photo
社交软件的刷脸登录功能会征求用户的授权,把头像用于个人身份认证。在软件的配合式注册过程中,用户被要求做点头、摇头等动作,这时摄像头会对动作进行核对,并自动采集左右偏转适度的人脸图像存储至对应的ID下作为参照图像。The face-scanning login function of social software will ask for the user's authorization and use the avatar for personal identity authentication. During the software registration process, the user is asked to nod or shake his head. At this time, the camera will check the action, and automatically collect the right and left deflection facial image and store it under the corresponding ID as a reference image.
3、内部安防采集照3. Collect photos of internal security
在内部办公场所,用于安防监控的终端设备会积累一定量的安防人脸图片。出于安防考虑,这些照片也可以作为一类场景的参照图像。在采用安防采集照存储至对应的ID下作为参照图像时,一般采用先自己聚类,再和比对库匹配的方式,具体过程如下:In internal offices, terminal equipment used for security monitoring will accumulate a certain amount of security face images. For security reasons, these photos can also be used as reference images for a class of scenes. When the security collection photos are stored under the corresponding ID as the reference image, the method of clustering by itself and then matching with the comparison library is generally adopted. The specific process is as follows:
首先,检验以及校对采集安防照的摄像头的画质和朝向,保证能够采集到角度、光照合适的照片。然后将质量合格的安防照注册到一个临时底库中,如果最新采集到的安防照与临时底库中最匹配的注册照的相似度超过阈值,则把采集照划归到对应ID下,否则注册为新ID。ID下每新增一张照片,就进行一次注册照的更新,更新的注册照与ID下其他的照片的总相似度应该为最大,这张注册照被认为最能够代表这个ID。将得到的注册照作为待识别照,采用1比N的逻辑在比对库中匹配最近似ID作为该安防照的ID。First of all, check and proofread the image quality and orientation of the camera that collects security photos to ensure that photos with appropriate angles and lighting can be collected. Then register the qualified security photos into a temporary base library. If the similarity between the newly collected security photos and the most matching registered photo in the temporary base library exceeds the threshold, then the collected photos will be classified under the corresponding ID, otherwise Register as a new ID. Every time a new photo is added under the ID, the registration photo is updated once. The total similarity between the updated registration photo and other photos under the ID should be the largest. This registration photo is considered to be the most representative of this ID. Take the obtained registered photo as the photo to be identified, and use the logic of 1 to N to match the most approximate ID in the comparison library as the ID of the security photo.
这里还需要说明的是,参照图像在采集时,需满足以下质量筛选标准:满足清晰度、角度和五官动作幅度等多维度的阈值,并且筛选出来的参照图像中 要兼顾正脸和小幅度偏转侧脸的情况,以提高和多种姿态的待识别图像匹配成功概率。It should also be noted here that when the reference image is collected, it must meet the following quality screening standards: meet the multi-dimensional thresholds of sharpness, angle and facial features, and the selected reference image should take into account the face and small deflection. The profile of the face is used to increase the probability of matching successfully with the image to be recognized in a variety of poses.
这里还需要说明的是,如果对比库中的参照图像是通过1比1端口采集的,在向比对库进行注册时,录入注册人的一段视频,用质量算法从视频中获得质量最好的数张照片提取特征注册入库。如果是通过1比N端口采集的,在采集到待识别照后,和比对库中已有的参照图像进行比对,如果最相近的参照图像的相似度也低于设定的阈值,就认为在底库中没有对应ID的参照图像,跟踪待识别图像中的人,采集一段视频,用质量算法从视频中选取数张质量最好的照片,创建新的ID加入注册库中。It should also be noted here that if the reference image in the comparison library is collected through a 1:1 port, when registering to the comparison library, enter a video of the registrant, and use the quality algorithm to obtain the best quality from the video. Feature extraction of several photos is registered and stored. If it is collected through a 1:N port, after collecting the photos to be recognized, compare them with the existing reference images in the comparison library. If the similarity of the closest reference image is also lower than the set threshold, then Considering that there is no reference image corresponding to the ID in the base library, track the person in the image to be recognized, collect a video, use a quality algorithm to select several pictures with the best quality from the video, and create a new ID to add to the registration library.
S4:根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。S4: Determine whether the image to be identified matches the reference image to be compared according to the facial features of the image to be identified and all features of the reference image to be compared.
具体的,通过根据待识别图像的人脸特征以及待比对的参照图像的所有特征计算待识别图像与待比对的参照图像的相似度,然后根据相似度判断待识别图像与待比对的参照图像是否匹配。Specifically, the similarity between the image to be identified and the reference image to be compared is calculated based on the facial features of the image to be identified and all the features of the reference image to be compared, and then the image to be identified and the reference image to be compared are judged based on the similarity. Whether the reference image matches.
图2是根据一示例性实施例示出的根据待识别图像获取待识别图像的人脸特征的流程图,参照图2所示,作为一种较优的实施方式,本发明实施例中,所述根据所述待识别图像获取所述待识别图像的人脸特征包括:Fig. 2 is a flow chart showing the acquisition of facial features of the image to be recognized according to the image to be recognized according to an exemplary embodiment. Referring to Fig. 2, as a preferred embodiment, in the embodiment of the present invention, the Obtaining the facial features of the image to be recognized according to the image to be recognized includes:
S2.1:对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置。S2.1: Perform face frame detection and face key point detection on the image to be recognized, and obtain the face image and key point positions corresponding to the image to be recognized.
具体的,对待识别图像进行人脸框检测是指检测并定位待识别图像中的人脸,返回高精度的人脸框坐标,根据坐标在待识别图像截取出人脸图像。对待识别图像进行人脸关键点检测,定位出人脸面部的关键区域位置,包括眼睛、鼻子、嘴巴等关键点位置。其中,待识别图像中检测出的人脸图像包括一个或多个,用户可以根据实际的应用场景决定识别单一人脸框还是多人人脸框,本发明实施例中,对此不做限制。Specifically, performing face frame detection on the image to be recognized refers to detecting and locating the face in the image to be recognized, returning high-precision face frame coordinates, and intercepting the face image in the image to be recognized according to the coordinates. The key points of the face are detected on the image to be recognized, and the key areas of the face are located, including the key points of the eyes, nose, and mouth. Wherein, the detected face images in the image to be recognized include one or more, and the user can decide whether to recognize a single face frame or a multi-person face frame according to the actual application scenario, which is not limited in the embodiment of the present invention.
S2.2:根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人 脸图像。S2.2: Perform normalization processing on the face image according to the position of the key point, and obtain a processed face image.
具体的,对人脸图像进行归一化处理,目的是使不同成像条件(如光照强度、方向、距离、姿势等)下拍摄的同一个人的照片具有一致性,方便后续用于提取人脸特征。人脸归一化处理包括两个方面的内容:一是几何归一化,二是灰度归一化。几何归一化也称为位置校准,它将有助于矫正因成像距离和人脸姿势变化造成的尺寸差异和角度倾斜,可以解决人脸尺度变化和人脸旋转问题。具体包括人脸尺度归一化、平面人脸旋转矫正(歪头)、深度人脸旋转矫正(扭脸)三个环节。对于一些要求较高的深度人脸旋转矫正,可以利用人脸的3D模型。灰度归一化用来对不同光强、光源方向下得到的人脸图像进行补偿,以减弱单纯由于光照变化造成的图像信号的变化。这里需要说明的是,为了方便后续使用模型(如卷积神经网络等)提取人脸特征,本发明实施例中,还需将人脸图像调整至适合输入模型的大小。Specifically, the normalization process is performed on the face image, the purpose is to make the photos of the same person taken under different imaging conditions (such as light intensity, direction, distance, posture, etc.) have consistency, so as to facilitate subsequent facial features extraction . Face normalization includes two aspects: one is geometric normalization, and the other is gray normalization. Geometric normalization is also called position calibration. It will help correct size differences and angle tilts caused by changes in imaging distance and face pose, and can solve the problems of face scale changes and face rotation. Specifically, it includes three links: normalization of face scale, flat face rotation correction (tilted head), and deep face rotation correction (face twisting). For some highly demanding deep face rotation correction, a 3D model of the face can be used. Gray normalization is used to compensate the face image obtained under different light intensities and light source directions, so as to reduce the change of the image signal caused by the change of light alone. It should be noted here that, in order to facilitate subsequent use of models (such as convolutional neural networks) to extract facial features, in the embodiment of the present invention, the facial image needs to be adjusted to a size suitable for the input model.
S2.3:对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。S2.3: Perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
具体的,作为一种示例,本发明实施例中,采用预先训练的卷积神经网络对经上述步骤处理后人脸图像进行特征提取,获取待识别图像对应的人脸特征。Specifically, as an example, in the embodiment of the present invention, a pre-trained convolutional neural network is used to perform feature extraction on the face image processed by the above steps to obtain the face feature corresponding to the image to be recognized.
作为一种较优的实施方式,本发明实施例中,当所述识别请求为1比1识别请求时,所述识别请求包括待比对的参照图像的ID;As a preferred embodiment, in the embodiment of the present invention, when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The obtaining all the features of the reference image to be compared from the comparison library according to the recognition request includes:
根据所述待比对的参照图像的ID从所述比对库中获取所述待比对的参照图像的ID下的所有参照图像的所有特征。Obtain all features of all reference images under the ID of the reference image to be compared from the comparison library according to the ID of the reference image to be compared.
具体的,当人脸识别模式为1比1模式时,则获取到的识别请求为1比1识别请求,此时需要识别待识别图像与参照图像是否属于同一个人,因此,识别请求中包括待比对的参照图像的ID。此时,根据待比对的参照图像的ID从比对库中获取该ID下的所有参照图像的所有特征。Specifically, when the face recognition mode is a 1:1 mode, the acquired recognition request is a 1:1 recognition request. At this time, it is necessary to recognize whether the image to be recognized and the reference image belong to the same person. Therefore, the recognition request includes the recognition request. The ID of the compared reference image. At this time, according to the ID of the reference image to be compared, all the features of all the reference images under the ID are obtained from the comparison library.
图3是根据一示例性实施例示出的根据待识别图像的人脸特征以及待比对 的参照图像的所有特征,判断待识别图像与待比对的参照图像是否匹配的流程图,参照图3所示,作为一种较优的实施方式,本发明实施例中,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:Fig. 3 is a flow chart showing whether the image to be recognized matches the reference image to be compared according to the facial features of the image to be recognized and all the features of the reference image to be compared according to an exemplary embodiment, refer to Fig. 3 As shown, as a preferred embodiment, in the embodiment of the present invention, the judgment is made based on the facial features of the image to be recognized and all the features of the reference image to be compared. Whether the reference image to be compared matches or not includes:
S401:根据所述待比对的参照图像的ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算所述每一参照图像与所述待识别图像的相似度。S401: Calculate the similarity between each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized.
具体的,当人脸识别模式为1比1模式时,需将待比对的参照图像的ID下的每一参照图像与待识别图像进行比较。具体实施时,可以根据待比对的参照图像的ID下的每一参照图像的所有特征与待识别图像的人脸特征计算每一参照图像与待识别图像的相似度,根据相似度来进行图像的比较。Specifically, when the face recognition mode is a 1:1 mode, each reference image under the ID of the reference image to be compared needs to be compared with the image to be recognized. During specific implementation, the similarity between each reference image and the image to be recognized can be calculated based on all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized, and the image can be determined based on the similarity. Comparison.
S402:将所述相似度与第一预设阈值进行比较,若所述相似度大于所述第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功。S402: Compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully.
具体的,第一预设阈值可以根据实际需求进行设置,这里不对第一预设阈值的具体数值进行限制。当参照图像与待识别图像的相似度超过(即大于)第一预设阈值时,则判定该参照图像与待识别图像匹配成功。Specifically, the first preset threshold may be set according to actual requirements, and the specific value of the first preset threshold is not limited here. When the similarity between the reference image and the image to be recognized exceeds (that is, greater than) the first preset threshold, it is determined that the reference image is successfully matched with the image to be recognized.
S403:获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。S403: Acquire the number of reference images that are successfully matched with the image to be recognized, and if the number exceeds half of the total number of reference images, determine the ID of the image to be recognized and the reference image to be compared The match is successful.
具体的,当待比对的参照图像的ID下与待识别图像匹配成功的参照图像的数量超过参与匹配的参照图像的总数量(这里指待比对的参照图像的ID下参照图像的总数量)的一半时,最终判定该待识别图像与该待比对的参照图像的ID匹配成功,否则,认定该待识别图像与该待比对的参照图像的ID匹配不成功。这样设置,可以避免相同ID的参照图像与单张待识别图像之间由于场景、遮挡等差别较大造成的相似度偏低,也可以屏蔽掉不同ID的参照图像和待识别图像之间由于偶然因素造成的相似度过高等问题,提高识别的精度。Specifically, when the number of reference images successfully matched with the image to be recognized under the ID of the reference image to be compared exceeds the total number of reference images participating in the matching (here refers to the total number of reference images under the ID of the reference image to be compared ), it is finally determined that the ID matching of the image to be identified and the reference image to be compared is successful; otherwise, it is determined that the ID matching of the image to be identified and the reference image to be compared is unsuccessful. This setting can avoid the low similarity between the reference image with the same ID and the single image to be recognized due to large differences in scenes, occlusions, etc., and it can also shield the reference image with different IDs and the image to be recognized due to accident The problem of high similarity caused by factors can improve the accuracy of recognition.
作为一种较优的实施方式,本发明实施例中,当所述识别请求为1比N识 别请求时,所述待比对的参照图像为所述比对库中所有ID下的所有参照图像;As a preferred embodiment, in the embodiment of the present invention, when the recognition request is a 1:N recognition request, the reference images to be compared are all reference images under all IDs in the comparison library ;
所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The acquiring all the features of the reference image to be compared from the comparison library according to the recognition request includes:
根据所述识别请求从所述比对库中获取所有ID下的所有参照图像的所有特征。Obtain all features of all reference images under all IDs from the comparison library according to the identification request.
具体的,当人脸识别模式为1比N模式时,则获取到的识别请求为1比N识别请求,此时需要识别待识别图像属于哪一个人的问题,因此,待比对的参照图像为比对库中所有ID下的所有参照图像。此时,需要从比对库中获取所有ID下的所有参照图像的所有特征。Specifically, when the face recognition mode is a 1:N mode, the obtained recognition request is a 1:N recognition request. At this time, it is necessary to recognize which person the image to be recognized belongs to. Therefore, the reference image to be compared Compare all reference images under all IDs in the library. At this time, all features of all reference images under all IDs need to be obtained from the comparison library.
图4是根据一示例性实施例示出的在1比N模式时,根据待识别图像的人脸特征以及待比对的参照图像的所有特征,判断待识别图像与待比对的参照图像是否匹配的流程图,参照图4所示,作为一种较优的实施方式,本发明实施例中,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:Fig. 4 shows according to an exemplary embodiment in the 1 to N mode, according to the facial features of the image to be recognized and all the features of the reference image to be compared, it is determined whether the image to be recognized matches the reference image to be compared 4, as a preferred embodiment, in an embodiment of the present invention, according to the facial features of the image to be recognized and all features of the reference image to be compared, Determining whether the image to be recognized matches the reference image to be compared includes:
S501:根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度。S501: Calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized.
具体的,当人脸识别模式为1比N模式时,需将比对库中所有ID下的所有参照图像与待识别图像进行比较。具体实施时,可以根据每一ID下的每一参照图像的所有特征与待识别图像的人脸特征计算每一参照图像与待识别图像的相似度,根据相似度来进行图像的比较。Specifically, when the face recognition mode is a 1:N mode, all reference images under all IDs in the comparison library need to be compared with the image to be recognized. During specific implementation, the similarity between each reference image and the image to be recognized can be calculated based on all the features of each reference image under each ID and the facial features of the image to be recognized, and the image comparison can be performed based on the similarity.
S502:判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。S502: Determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, if so, determine that the image to be recognized matches the ID with the highest similarity value; otherwise, determine that the image to be recognized is unidentified. Register the image.
具体的,可以先根据相似度值的高低对所有参照图像进行排序,选取出与待识别图像的相似度最高的参照图像对应的ID,然后判断该相似度值是否满足第二预设阈值,若满足,则判定待识别图像与该相似度值最高的ID匹配,否则判定该待识别图像为未注册图像。这里需要说明的是,在每个ID都有多个场景 的多张参照图像的情况下,待识别图像与自身ID下的参照图像匹配为最大相似度的概率得到了提高,避免了单张待识别图像因偶然因素引起的自身ID下的参照图像和待识别图像之间相似度低的问题。同样,第二预设阈值可以根据实际需求进行设置,这里不对第二预设阈值的具体数值进行限制,设定第二预设阈值是为了屏蔽未注册ID照片的攻击。Specifically, it is possible to sort all the reference images according to the similarity value first, select the ID corresponding to the reference image with the highest similarity of the image to be recognized, and then determine whether the similarity value meets the second preset threshold, if If it is satisfied, it is determined that the image to be recognized matches the ID with the highest similarity value; otherwise, it is determined that the image to be recognized is an unregistered image. It should be noted here that in the case of multiple reference images with multiple scenes for each ID, the probability that the image to be recognized matches the reference image under its own ID as the maximum similarity is improved, avoiding a single pending image. The problem of low similarity between the reference image under its ID and the image to be recognized due to accidental factors in the recognition image Similarly, the second preset threshold can be set according to actual needs. The specific value of the second preset threshold is not limited here, and the second preset threshold is set to shield the attack of unregistered ID photos.
作为一种较优的实施方式,本发明实施例中,将与所述待比对的参照图像匹配不成功的所述待识别图像向所述比对库进行注册,生成新的ID,并将所述待识别图像存储至所述新的ID,作为所述新的ID下的参照图像。As a preferred embodiment, in the embodiment of the present invention, the image to be recognized that is unsuccessfully matched with the reference image to be compared is registered with the comparison library, a new ID is generated, and the The image to be recognized is stored in the new ID as a reference image under the new ID.
图5是根据一示例性实施例示出的人脸识别装置的结构示意图,参照图5所示,该装置包括:Fig. 5 is a schematic structural diagram of a face recognition device according to an exemplary embodiment. Referring to Fig. 5, the device includes:
数据获取模块,用于获取识别请求以及待识别图像;The data acquisition module is used to acquire the recognition request and the image to be recognized;
第一特征获取模块,用于根据所述待识别图像获取所述待识别图像的人脸特征;The first feature acquisition module is configured to acquire the facial features of the image to be identified according to the image to be identified;
第二特征获取模块,用于根据所述识别请求从比对库中获取待比对的参照图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像;The second feature acquisition module is configured to acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes references of different poses in multiple different scenarios image;
图像识别模块,用于根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。The image recognition module is configured to determine whether the image to be recognized matches the reference image to be compared based on the facial features of the image to be recognized and all the features of the reference image to be compared.
作为一种较优的实施方式,本发明实施例中,所述第一特征获取模块包括:As a preferred implementation manner, in an embodiment of the present invention, the first feature acquisition module includes:
图像检测单元,用于对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置;An image detection unit, configured to perform face frame detection and face key point detection on the to-be-recognized image, and obtain a face image and key point positions corresponding to the to-be-recognized image;
归一化处理单元,用于根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人脸图像;A normalization processing unit, configured to perform normalization processing on the face image according to the position of the key point to obtain a processed face image;
特征提取单元,用于对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。The feature extraction unit is configured to perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
作为一种较优的实施方式,本发明实施例中,当所述识别请求为1比1识 别请求时,所述识别请求包括待比对的参照图像的ID;As a preferred embodiment, in the embodiment of the present invention, when the identification request is a 1:1 identification request, the identification request includes the ID of the reference image to be compared;
所述第二特征获取模块具体用于:The second feature acquisition module is specifically used for:
根据所述待比对的参照图像的ID从所述比对库中获取所述待比对的参照图像的ID下的所有参照图像的所有特征。Obtain all features of all reference images under the ID of the reference image to be compared from the comparison library according to the ID of the reference image to be compared.
作为一种较优的实施方式,本发明实施例中,所述图像识别模块包括:As a preferred implementation manner, in an embodiment of the present invention, the image recognition module includes:
第一计算单元,用于根据所述待比对的参照图像的ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算所述每一参照图像与所述待识别图像的相似度;The first calculation unit is configured to calculate each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized The similarity;
第一比较单元,用于将所述相似度与第一预设阈值进行比较,若所述相似度大于所述第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功;A first comparison unit, configured to compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully;
第二比较单元,用于获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。The second comparison unit is configured to obtain the number of reference images that are successfully matched with the image to be identified, and if the number exceeds half of the total number of the reference images, determine that the image to be identified is compared with the image to be identified The ID of the reference image matches successfully.
作为一种较优的实施方式,本发明实施例中,当所述识别请求为1比N识别请求时,所述待比对的参照图像为所述比对库中所有ID下的所有参照图像;As a preferred embodiment, in the embodiment of the present invention, when the recognition request is a 1:N recognition request, the reference images to be compared are all reference images under all IDs in the comparison library ;
所述第二特征获取模块还用于:The second feature acquisition module is also used for:
根据所述识别请求从所述比对库中获取所有ID下的所有参照图像的所有特征。Obtain all features of all reference images under all IDs from the comparison library according to the identification request.
作为一种较优的实施方式,本发明实施例中,所述图像识别模块还包括:As a preferred implementation manner, in an embodiment of the present invention, the image recognition module further includes:
第二计算单元,用于根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度;The second calculation unit is configured to calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
第三比较单元,用于判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。The third comparison unit is used to determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, and if so, it is determined that the image to be recognized matches the ID with the highest similarity value, otherwise it is determined that the The image to be recognized is an unregistered image.
综上所述,本发明实施例提供的技术方案带来的有益效果是:In summary, the beneficial effects brought about by the technical solutions provided by the embodiments of the present invention are:
1、本发明实施例提供的人脸识别方法及装置,通过使用同一ID的多个不 同场景下的不同姿态的参照图像的对比库作为匹配标准,提高了识别的准确率,增强算法的鲁棒性,并且对待识别图像的表情、画质等有较好的适应性;1. The face recognition method and device provided by the embodiments of the present invention use a comparison library of reference images of different poses in multiple different scenarios with the same ID as the matching standard, which improves the accuracy of recognition and enhances the robustness of the algorithm It has good adaptability to the facial expression and picture quality of the recognized image;
2、本发明实施例提供的人脸识别方法及装置,通过采用人脸框以及人脸关键点一起检测的方案,不仅可以准确地定位人脸位置,还可以减少了识别过程中的步骤和时间,提高识别效率;2. The face recognition method and device provided by the embodiments of the present invention adopt the scheme of detecting the face frame and the key points of the face together, which can not only accurately locate the face position, but also reduce the steps and time in the recognition process. , Improve the efficiency of recognition;
3、本发明实施例提供的人脸识别方法及装置,通过在1比N识别场景下采用先计算每一ID下的每一参照图像与待识别图像的相似度,选取出相似度最高的ID,然后判断该相似度是否满足第二预设阈值从而匹配出与待识别图像匹配的ID,提高了算法的抗攻击能力。3. The face recognition method and device provided by the embodiments of the present invention select the ID with the highest similarity by first calculating the similarity between each reference image under each ID and the image to be recognized in a 1:N recognition scenario , And then determine whether the similarity meets the second preset threshold to match the ID matching the image to be recognized, which improves the anti-attack ability of the algorithm.
需要说明的是:上述实施例提供的人脸识别装置在触发人脸识别业务时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的人脸识别装置与人脸识别方法实施例属于同一构思,即该装置是基于该人脸识别方法的,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that when the face recognition device provided in the above embodiment triggers the face recognition service, only the division of the above functional modules is used as an example for illustration. In practical applications, the above functions can be allocated to different functions according to needs. Module completion, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the face recognition device provided in the above embodiment and the face recognition method embodiment belong to the same concept, that is, the device is based on the face recognition method. For the specific implementation process, please refer to the method embodiment, which will not be repeated here.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。A person of ordinary skill in the art can understand that all or part of the steps in the above embodiments can be implemented by hardware, or by a program to instruct relevant hardware. The program can be stored in a computer-readable storage medium. The storage medium mentioned can be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection of the present invention. Within range.

Claims (10)

  1. 一种人脸识别方法,其特征在于,所述方法包括如下步骤:A face recognition method, characterized in that the method includes the following steps:
    获取识别请求以及待识别图像;Obtain the recognition request and the image to be recognized;
    根据所述待识别图像获取所述待识别图像的人脸特征;Acquiring the facial features of the image to be recognized according to the image to be recognized;
    根据所述识别请求从比对库中获取待比对的参照图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像;Acquiring all the features of the reference image to be compared from the comparison library according to the recognition request, each ID in the comparison library includes multiple reference images with different poses in different scenarios;
    根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。According to the facial features of the image to be identified and all features of the reference image to be compared, it is determined whether the image to be identified matches the reference image to be compared.
  2. 根据权利要求1所述的人脸识别方法,其特征在于,所述根据所述待识别图像获取所述待识别图像的人脸特征包括:The face recognition method according to claim 1, wherein the acquiring the facial features of the image to be recognized according to the image to be recognized comprises:
    对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置;Performing face frame detection and face key point detection on the image to be recognized, and acquiring a face image and key point positions corresponding to the image to be recognized;
    根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人脸图像;Performing normalization processing on the face image according to the position of the key point to obtain a processed face image;
    对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。Perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
  3. 根据权利要求1或2所述的人脸识别方法,其特征在于,当所述识别请求为1比1识别请求时,所述识别请求包括待比对的参照图像的ID;The face recognition method according to claim 1 or 2, wherein when the recognition request is a 1:1 recognition request, the recognition request includes the ID of the reference image to be compared;
    所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The acquiring all the features of the reference image to be compared from the comparison library according to the recognition request includes:
    根据所述待比对的参照图像的ID从所述比对库中获取所述待比对的参照图像的ID下的所有参照图像的所有特征。Obtain all features of all reference images under the ID of the reference image to be compared from the comparison library according to the ID of the reference image to be compared.
  4. 根据权利要求3所述的人脸识别方法,其特征在于,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:The face recognition method according to claim 3, characterized in that, the judgment is made based on the facial features of the image to be recognized and all the features of the reference image to be compared to determine the difference between the image to be recognized and the Whether the reference image to be compared matches includes:
    根据所述待比对的参照图像的ID下的每一参照图像的所有特征与所述待识 别图像的人脸特征计算所述每一参照图像与所述待识别图像的相似度;Calculating the similarity between each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized;
    将所述相似度与第一预设阈值进行比较,若所述相似度大于所述第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功;Comparing the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determining that the reference image is successfully matched with the image to be recognized;
    获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。Acquire the number of reference images that are successfully matched with the image to be recognized, and if the number exceeds half of the total number of reference images, determine that the ID of the image to be recognized and the reference image to be compared are successfully matched .
  5. 根据权利要求1或2所述的人脸识别方法,其特征在于,当所述识别请求为1比N识别请求时,所述待比对的参照图像为所述比对库中所有ID下的所有参照图像;The face recognition method according to claim 1 or 2, characterized in that, when the recognition request is a 1:N recognition request, the reference image to be compared is all IDs in the comparison library All reference images;
    所述根据所述识别请求从比对库中获取待比对的参照图像的所有特征包括:The acquiring all the features of the reference image to be compared from the comparison library according to the recognition request includes:
    根据所述识别请求从所述比对库中获取所有ID下的所有参照图像的所有特征。Obtain all features of all reference images under all IDs from the comparison library according to the identification request.
  6. 根据权利要求5所述的人脸识别方法,其特征在于,所述根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配包括:The face recognition method according to claim 5, wherein the judgment is made based on the facial features of the image to be recognized and all the features of the reference image to be compared. Whether the reference image to be compared matches includes:
    根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度;Calculating and acquiring the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
    判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。Determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, if it is satisfied, determine that the image to be recognized matches the ID with the highest similarity value, otherwise determine that the image to be recognized is an unregistered image .
  7. 一种基于权利要求1至6任一所述方法的人脸识别装置,其特征在于,所述装置包括:A face recognition device based on the method of any one of claims 1 to 6, wherein the device comprises:
    数据获取模块,用于获取识别请求以及待识别图像;The data acquisition module is used to acquire the recognition request and the image to be recognized;
    第一特征获取模块,用于根据所述待识别图像获取所述待识别图像的人脸特征;The first feature acquisition module is configured to acquire the facial features of the image to be identified according to the image to be identified;
    第二特征获取模块,用于根据所述识别请求从比对库中获取待比对的参照 图像的所有特征,所述比对库中每一个ID均包括多个不同场景下的不同姿态的参照图像;The second feature acquisition module is configured to acquire all the features of the reference image to be compared from the comparison library according to the recognition request, and each ID in the comparison library includes references of different poses in multiple different scenarios image;
    图像识别模块,用于根据所述待识别图像的人脸特征以及所述待比对的参照图像的所有特征,判断所述待识别图像与所述待比对的参照图像是否匹配。The image recognition module is configured to determine whether the image to be recognized matches the reference image to be compared based on the facial features of the image to be recognized and all the features of the reference image to be compared.
  8. 根据权利要求7所述的人脸识别装置,其特征在于,所述第一特征获取模块包括:The face recognition device according to claim 7, wherein the first feature acquisition module comprises:
    图像检测单元,用于对所述待识别图像进行人脸框检测以及人脸关键点检测,获取所述待识别图像对应的人脸图像以及关键点位置;An image detection unit, configured to perform face frame detection and face key point detection on the to-be-recognized image, and obtain a face image and key point positions corresponding to the to-be-recognized image;
    归一化处理单元,用于根据所述关键点位置对所述人脸图像进行归一化处理,获取处理后人脸图像;A normalization processing unit, configured to perform normalization processing on the face image according to the position of the key point to obtain a processed face image;
    特征提取单元,用于对所述处理后人脸图像进行特征提取,获取所述待识别图像对应的人脸特征。The feature extraction unit is configured to perform feature extraction on the processed face image, and obtain the face feature corresponding to the image to be recognized.
  9. 根据权利要求7或8所述的人脸识别装置,其特征在于,所述图像识别模块包括:The face recognition device according to claim 7 or 8, wherein the image recognition module comprises:
    第一计算单元,用于根据所述待比对的参照图像的ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算所述每一参照图像与所述待识别图像的相似度;The first calculation unit is configured to calculate each reference image and the image to be recognized according to all the features of each reference image under the ID of the reference image to be compared and the facial features of the image to be recognized The similarity;
    第一比较单元,用于将所述相似度与第一预设阈值进行比较,若所述相似度大于所述第一预设阈值,则判定所述参照图像与所述待识别图像匹配成功;A first comparison unit, configured to compare the similarity with a first preset threshold, and if the similarity is greater than the first preset threshold, determine that the reference image matches the image to be recognized successfully;
    第二比较单元,用于获取与所述待识别图像匹配成功的参照图像的数量,若所述数量超过所述参照图像的总数量的一半,则判定所述待识别图像与所述待比对的参照图像的ID匹配成功。The second comparison unit is configured to obtain the number of reference images that are successfully matched with the image to be identified, and if the number exceeds half of the total number of the reference images, determine that the image to be identified is compared with the image to be identified The ID of the reference image matches successfully.
  10. 根据权利要求7或8所述的人脸识别装置,其特征在于,所述图像识别模块还包括:The face recognition device according to claim 7 or 8, wherein the image recognition module further comprises:
    第二计算单元,用于根据每一ID下的每一参照图像的所有特征与所述待识别图像的人脸特征计算获取所述待识别图像与所述每一ID的相似度;The second calculation unit is configured to calculate and obtain the similarity between the image to be recognized and each ID according to all the features of each reference image under each ID and the facial features of the image to be recognized;
    第三比较单元,用于判断相似度值最高的ID的相似度是否满足第二预设阈值,若满足,则判定所述待识别图像与所述相似度值最高的ID匹配,否则判定所述待识别图像为未注册图像。The third comparison unit is used to determine whether the similarity of the ID with the highest similarity value meets the second preset threshold, and if so, it is determined that the image to be recognized matches the ID with the highest similarity value, otherwise it is determined that the The image to be recognized is an unregistered image.
PCT/CN2020/096992 2019-08-26 2020-06-19 Facial recognition method and apparatus WO2021036436A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CA3152812A CA3152812A1 (en) 2019-08-26 2020-06-19 Facial recognition method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910793283.2A CN110688901A (en) 2019-08-26 2019-08-26 Face recognition method and device
CN201910793283.2 2019-08-26

Publications (1)

Publication Number Publication Date
WO2021036436A1 true WO2021036436A1 (en) 2021-03-04

Family

ID=69108460

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/096992 WO2021036436A1 (en) 2019-08-26 2020-06-19 Facial recognition method and apparatus

Country Status (3)

Country Link
CN (1) CN110688901A (en)
CA (1) CA3152812A1 (en)
WO (1) WO2021036436A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033476A (en) * 2021-04-19 2021-06-25 清华大学 Cross-posture face recognition method
CN113542348A (en) * 2021-05-27 2021-10-22 武汉旷视金智科技有限公司 Image data transmission method and device
CN113536270A (en) * 2021-07-26 2021-10-22 网易(杭州)网络有限公司 Information verification method and device, computer equipment and storage medium
CN113569676A (en) * 2021-07-16 2021-10-29 北京市商汤科技开发有限公司 Image processing method, image processing device, electronic equipment and storage medium

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688901A (en) * 2019-08-26 2020-01-14 苏宁云计算有限公司 Face recognition method and device
CN111368721B (en) * 2020-03-03 2023-05-05 深圳市腾讯计算机系统有限公司 Identity recognition processing method and device, electronic equipment and storage medium
CN111694979A (en) * 2020-06-11 2020-09-22 重庆中科云从科技有限公司 Archive management method, system, equipment and medium based on image
CN112084903A (en) * 2020-08-26 2020-12-15 武汉普利商用机器有限公司 Method and system for updating face recognition base photo
CN112016508B (en) * 2020-09-07 2023-08-29 杭州海康威视数字技术股份有限公司 Face recognition method, device, system, computing device and storage medium
CN112667840B (en) * 2020-12-22 2024-05-28 中国银联股份有限公司 Feature sample library construction method, traffic identification method, device and storage medium
CN113362324B (en) * 2021-07-21 2023-02-24 上海脊合医疗科技有限公司 Bone health detection method and system based on video image
CN113688764A (en) * 2021-08-31 2021-11-23 瓴盛科技有限公司 Training method and device for face optimization model and computer readable medium
CN115880761B (en) * 2023-02-09 2023-05-05 数据空间研究院 Face recognition method, system, storage medium and application based on policy optimization

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101770613A (en) * 2010-01-19 2010-07-07 北京智慧眼科技发展有限公司 Social insurance identity authentication method based on face recognition and living body detection
CN102004908A (en) * 2010-11-30 2011-04-06 汉王科技股份有限公司 Self-adapting face identification method and device
GB2499449A (en) * 2012-02-20 2013-08-21 Taiwan Colour And Imaging Technology Corp Surveillance by face recognition using colour display of images
US20140079297A1 (en) * 2012-09-17 2014-03-20 Saied Tadayon Application of Z-Webs and Z-factors to Analytics, Search Engine, Learning, Recognition, Natural Language, and Other Utilities
CN104463237A (en) * 2014-12-18 2015-03-25 中科创达软件股份有限公司 Human face verification method and device based on multi-posture recognition
CN110688901A (en) * 2019-08-26 2020-01-14 苏宁云计算有限公司 Face recognition method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102542299B (en) * 2011-12-07 2015-03-25 惠州Tcl移动通信有限公司 Face recognition method, device and mobile terminal capable of recognizing face

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101770613A (en) * 2010-01-19 2010-07-07 北京智慧眼科技发展有限公司 Social insurance identity authentication method based on face recognition and living body detection
CN102004908A (en) * 2010-11-30 2011-04-06 汉王科技股份有限公司 Self-adapting face identification method and device
GB2499449A (en) * 2012-02-20 2013-08-21 Taiwan Colour And Imaging Technology Corp Surveillance by face recognition using colour display of images
US20140079297A1 (en) * 2012-09-17 2014-03-20 Saied Tadayon Application of Z-Webs and Z-factors to Analytics, Search Engine, Learning, Recognition, Natural Language, and Other Utilities
CN104463237A (en) * 2014-12-18 2015-03-25 中科创达软件股份有限公司 Human face verification method and device based on multi-posture recognition
CN110688901A (en) * 2019-08-26 2020-01-14 苏宁云计算有限公司 Face recognition method and device

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113033476A (en) * 2021-04-19 2021-06-25 清华大学 Cross-posture face recognition method
CN113033476B (en) * 2021-04-19 2022-08-12 清华大学 Cross-posture face recognition method
CN113542348A (en) * 2021-05-27 2021-10-22 武汉旷视金智科技有限公司 Image data transmission method and device
CN113542348B (en) * 2021-05-27 2022-09-06 武汉旷视金智科技有限公司 Image data transmission method and device
CN113569676A (en) * 2021-07-16 2021-10-29 北京市商汤科技开发有限公司 Image processing method, image processing device, electronic equipment and storage medium
CN113569676B (en) * 2021-07-16 2024-06-11 北京市商汤科技开发有限公司 Image processing method, device, electronic equipment and storage medium
CN113536270A (en) * 2021-07-26 2021-10-22 网易(杭州)网络有限公司 Information verification method and device, computer equipment and storage medium
CN113536270B (en) * 2021-07-26 2023-08-08 网易(杭州)网络有限公司 Information verification method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110688901A (en) 2020-01-14
CA3152812A1 (en) 2021-03-04

Similar Documents

Publication Publication Date Title
WO2021036436A1 (en) Facial recognition method and apparatus
US11288504B2 (en) Iris liveness detection for mobile devices
EP1629415B1 (en) Face identification verification using frontal and side views
JP4156430B2 (en) Face verification method and system using automatic database update method
KR102554391B1 (en) Iris recognition based user authentication apparatus and method thereof
Kukharev et al. Visitor identification-elaborating real time face recognition system
CN106529414A (en) Method for realizing result authentication through image comparison
US11804071B2 (en) Method for selecting images in video of faces in the wild
US10922399B2 (en) Authentication verification using soft biometric traits
US9449217B1 (en) Image authentication
KR20170006355A (en) Method of motion vector and feature vector based fake face detection and apparatus for the same
Kose et al. Shape and texture based countermeasure to protect face recognition systems against mask attacks
KR101821144B1 (en) Access Control System using Depth Information based Face Recognition
CN112232323A (en) Face verification method and device, computer equipment and storage medium
CN114463828A (en) Invigilation method and system based on testimony unification, electronic equipment and storage medium
KR20200109977A (en) Smartphone-based identity verification method using fingerprints and facial images
WO2021025954A1 (en) Techniques for detecting a three-dimensional face during facial recognition
US11335123B2 (en) Live facial recognition system and method
WO2023109551A1 (en) Living body detection method and apparatus, and computer device
KR102529513B1 (en) Identity verification system using smart phone
Lee et al. Ocular and iris recognition baseline algorithm
KR20210085408A (en) Dual biometric device

Legal Events

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

Ref document number: 20858061

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 3152812

Country of ref document: CA

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20858061

Country of ref document: EP

Kind code of ref document: A1

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 26/07/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20858061

Country of ref document: EP

Kind code of ref document: A1