WO2022099989A1 - Liveness identification and access control device control methods, apparatus, electronic device, storage medium, and computer program - Google Patents

Liveness identification and access control device control methods, apparatus, electronic device, storage medium, and computer program Download PDF

Info

Publication number
WO2022099989A1
WO2022099989A1 PCT/CN2021/086219 CN2021086219W WO2022099989A1 WO 2022099989 A1 WO2022099989 A1 WO 2022099989A1 CN 2021086219 W CN2021086219 W CN 2021086219W WO 2022099989 A1 WO2022099989 A1 WO 2022099989A1
Authority
WO
WIPO (PCT)
Prior art keywords
living body
image
sample image
recognition
face
Prior art date
Application number
PCT/CN2021/086219
Other languages
French (fr)
Chinese (zh)
Inventor
滕家宁
黄耿石
邵婧
Original Assignee
深圳市商汤科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市商汤科技有限公司 filed Critical 深圳市商汤科技有限公司
Publication of WO2022099989A1 publication Critical patent/WO2022099989A1/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/40Spoof detection, e.g. liveness detection
    • G06V40/45Detection of the body part being alive
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • G06F18/2431Multiple classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • G06N20/20Ensemble learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • 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/172Classification, e.g. identification

Definitions

  • the present disclosure relates to the field of computer technologies, and in particular, to a method and device for identification of living bodies, access control equipment, electronic equipment, storage media, and computer programs.
  • Living body recognition is to identify whether the face image detected on the image acquisition device (eg, camera, mobile phone, etc.) is from a real face, or some form of attack or camouflage.
  • the main attack forms include photos, videos, masks, face models, etc. Liveness detection can be applied to security prevention and control in unattended scenarios. Therefore, improving the recognition accuracy of living body recognition plays a vital role in security prevention and control.
  • the present disclosure proposes a technical scheme of a living body identification, an access control device control method and device, an electronic device, a storage medium, and a computer program.
  • a method for identifying a living body comprising: performing a first living body recognition on a target image corresponding to an object to be identified to obtain a first identification result, where the first living body recognition is used to identify the object to be identified Whether it is a living body or a 2D non-living body; when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, which is used for the second living body recognition. for identifying whether the object to be identified is a living body or a 3D non-living body.
  • the first recognition result obtained in the first living body recognition indicates that the to-be-identified object is a living body
  • the second-stage second living body recognition is performed on the target image to identify whether the object to be identified is a living body or a 3D non-living body, and an accurate second recognition result can be obtained.
  • the two-stage living body recognition method can effectively improve the recognition accuracy of living bodies.
  • performing the first living body recognition on the target image corresponding to the object to be identified, and obtaining the first recognition result includes: performing the first living body recognition on the target image through the first living body recognition network, and obtaining For the first recognition result, the first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
  • the first living body recognition network trained based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body can improve the recognition accuracy of the 2D non-living body, so that the object to be recognized through the first living body recognition network corresponds to After the first living body recognition is performed on the target image of , a first recognition result with higher recognition accuracy can be obtained.
  • the first sample image includes a first label
  • the first label is used to indicate that the first sample image is an image corresponding to a living body
  • the method further includes: classifying the first sample image and the second sample image through a first initial network to obtain a first classification result; The first label included in the first sample image and the first classification result determine the first classification loss corresponding to the first initial network; according to the first classification loss, the first classification loss is trained. an initial network to obtain the trained first living body recognition network.
  • the first initial network is trained by using the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body. Since the first sample image includes the first label, it can be classified according to the first label and the first classification. As a result, the classification accuracy of the first initial network, that is, the first classification loss corresponding to the first initial network, is determined, so that the first initial network can be effectively trained according to the first classification loss, so as to obtain a trained 2D non-living body The first living body recognition network with higher recognition accuracy.
  • the classifying the first sample image and the second sample image through a first initial network to obtain a first classification result includes: classifying the first sample image performing face detection to obtain a first face frame, and performing face detection on the second sample image to obtain a second face frame; cropping the first sample image according to the first face frame cutting to obtain a first face image, and cutting the second sample image according to the second face frame to obtain a second face image; The image and the second face image are classified to obtain the first classification result.
  • classifying the cropped first face image and the second face image can effectively improve the classification efficiency.
  • the first sample image is cropped according to the first face frame to obtain a first face image
  • the Cropping the second sample image to obtain a second face image includes: adjusting the size of the first face frame to obtain a third face frame, and adjusting the size of the second face frame to obtain a fourth face frame face frame; according to the third face frame, the first sample image is cropped to obtain the first face image, and the second sample image is processed according to the fourth face frame crop to obtain the second face image.
  • the adjusted third face frame and the fourth face frame can be obtained by cropping from the first sample image and the second sample image.
  • the first face image and the second face image have more effective information, so that the classification efficiency can be effectively improved when the first face image and the second face image obtained by cutting are subsequently classified.
  • performing a second living body recognition on the target image to obtain a second recognition result includes: performing a second living body recognition on the target image through a second living body recognition network, and obtaining the second living body recognition The second recognition result, the second living body recognition network is obtained by training based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
  • the second living body recognition network trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body can improve the recognition accuracy of the 3D non-living body, so that the second living body After the second living body recognition is performed on the target image, a second recognition result with higher recognition accuracy can be obtained.
  • the third sample image includes a second label
  • the second label is used to indicate that the third sample image is an image corresponding to a living body
  • the method further includes: classifying the third sample image and the fourth sample image through a second initial network to obtain a second classification result;
  • the second label and the second classification result included in the three-sample images determine the second classification loss corresponding to the second initial network; and according to the second classification loss, the second initial network is trained to The trained second living body recognition network is obtained.
  • the second initial network is trained by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body. Since the third sample image includes the second label, according to the second label and the second classification result, Determine the classification accuracy of the second initial network, that is, the second classification loss corresponding to the second initial network, so that the second initial network can be effectively trained according to the second classification loss, so as to obtain the recognition of 3D non-living bodies after training The second living body recognition network with higher accuracy.
  • the classifying the third sample image and the fourth sample image by using a second initial network to obtain a second classification result includes: performing a human analysis on the third sample image. face detection to obtain a fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame; cutting the third sample image according to the fifth face frame to obtain a third face image, and cutting the fourth sample image according to the sixth face frame to obtain a fourth face image; The fourth face image is classified to obtain the second classification result.
  • classifying the cropped third face image and the fourth face image can effectively improve the classification efficiency.
  • the third sample image is cropped according to the fifth face frame to obtain a third face image
  • the third face image is cut according to the sixth face frame.
  • Four sample images are cropped to obtain a fourth face image, including: adjusting the size of the fifth face frame to obtain a seventh face frame, and adjusting the size of the sixth face frame to obtain an eighth face frame face frame; trimming the third sample image according to the seventh face frame to obtain the third face image, and trimming the fourth sample image according to the eighth face frame , to obtain the fourth face image.
  • the third sample image and the fourth sample image can be cropped to obtain
  • the third face image and the fourth face image with more effective information can effectively improve the classification efficiency when the third face image and the fourth face image obtained by cutting are subsequently classified.
  • a method for controlling an access control device including: collecting a target image corresponding to an object to be identified that needs to pass through the access control device; using the above-mentioned method for in vivo identification, performing in vivo identification on the target image, and obtaining the in vivo identification Result: in the case that the living body identification result indicates that the object to be identified is a living body, the access control device is controlled to be turned on.
  • the living body recognition is performed on the object to be identified that needs to pass through the access control device, so that both 2D non-living bodies (for example, photos, images) can be effectively identified, and 3D non-living bodies can be effectively identified, Further, the access control device is controlled to be turned on only when the living body recognition result indicates that the object to be recognized is a living body, so that the security of the access control device can be effectively improved.
  • 2D non-living bodies for example, photos, images
  • 3D non-living bodies can be effectively identified
  • the access control device is controlled to be turned on only when the living body recognition result indicates that the object to be recognized is a living body, so that the security of the access control device can be effectively improved.
  • the collecting the target image corresponding to the object to be identified that needs to pass through the access control device includes: using a dual infrared camera module to collect the target image corresponding to the object to be identified.
  • the clear target image corresponding to the object to be recognized that needs to pass through the access control device is collected by using the dual infrared camera module, and then the target image corresponding to the object to be recognized is recognized by the above-mentioned two-stage living body recognition method, so that the access control equipment can be improved.
  • the accuracy of living body recognition in dark light scenes can effectively improve the security of access control equipment.
  • a living body recognition device comprising: a first recognition module configured to perform a first living body recognition on a target image corresponding to an object to be recognized, and obtain a first recognition result, the first living body recognition using for recognizing whether the object to be recognized is a living body or a 2D non-living body; a second recognition module is used to perform second living body recognition on the target image when the first recognition result indicates that the object to be recognized is a living body , to obtain a second identification result, where the second living body identification is used to identify whether the object to be identified is a living body or a 3D non-living body.
  • an access control device control device comprising: an image acquisition module for collecting target images corresponding to objects to be recognized that need to pass through the access control device; a living body recognition module for the above living body recognition method, for The target image is subjected to living body recognition to obtain a living body recognition result; the control module is configured to control the opening of the access control device when the living body recognition result indicates that the object to be identified is a living body.
  • an electronic device comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above A living body identification method, or, performing the above-mentioned access control device control method.
  • a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above-mentioned living body identification method or the above-mentioned access control device control method is implemented.
  • a computer program comprising computer-readable code, when the computer code is executed in an electronic device, a processor in the electronic device executes the method for realizing the above-mentioned living body identification, or , to realize the above access control device control method.
  • FIG. 1 shows an interactive schematic diagram of a method for identifying a living body according to an embodiment of the present disclosure
  • FIG. 2 shows a flowchart of a method for identifying a living body according to an embodiment of the present disclosure
  • FIG. 3 shows a schematic diagram of a living body recognition network according to an embodiment of the present disclosure
  • FIG. 4 shows a flowchart of a method for controlling an access control device according to an embodiment of the present disclosure
  • FIG. 5 shows a block diagram of a living body recognition apparatus according to an embodiment of the present disclosure
  • FIG. 6 shows a block diagram of an access control device control apparatus according to an embodiment of the present disclosure
  • FIG. 7 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • Face recognition is a biometric recognition technology based on human facial feature information.
  • living body recognition technology has gradually become the core technology of face recognition systems.
  • the living body identification method of the embodiment of the present disclosure can be applied to scenarios such as security, finance, and e-commerce that require identity verification, for example, access control equipment, remote transactions, and the like.
  • identity verification for example, access control equipment, remote transactions, and the like.
  • it can be determined whether the object to be identified is a living body, not a non-living body such as photos, videos, masks, and face models, so that malicious attacks can be effectively reduced.
  • FIG. 1 shows an interactive schematic diagram of a method for identifying a living body according to an embodiment of the present disclosure.
  • the electronic device 11 is used to execute the living body recognition method.
  • the electronic device 11 may be an access control device (eg, door lock 13, gate 14, etc.), may be a user device (eg, mobile phone 15) used for remote transactions, or may be other devices that need to be authenticated by living body recognition , which is not specifically limited in the present disclosure.
  • the image acquisition component included in the electronic device 11 acquires a target image of the object to be recognized 12 that needs to be recognized by the electronic device 11 .
  • the electronic device 11 performs the first-stage first living body recognition on the target image, and identifies whether the object 12 to be identified is a living body or a 2D non-living body. In the case where the first recognition result obtained from the first living body recognition indicates that the object to be recognized 12 is a 2D non-living body, the process of living body recognition is ended, the first recognition result is output, and the object 12 to be recognized has failed the living body recognition for the electronic device 11 .
  • the electronic device 11 performs the second-stage second living body recognition on the target image.
  • the second living body identification is used to identify whether the object 12 to be identified is a living body or a 3D non-living body.
  • the process of living body recognition is ended, the second recognition result is output, and the object 12 to be recognized has failed the living body recognition for the electronic device 11 .
  • the living body identification process is ended, the second identification result is output, and the object 12 to be identified is prompted to pass the living body identification of the electronic device 11 .
  • the electronic device 11 After the electronic device 11 passes the living body recognition of the object 12 to be recognized, the electronic device 11 can perform corresponding operations. For example, in the case where the electronic device 11 is an access control device (eg, a door lock, a gate, etc.) Object 12 enters or passes; when electronic device 11 is a user device for conducting a remote transaction, the remote transaction is performed.
  • the embodiment of the present disclosure adopts a two-stage living body identification method, which can effectively improve the identification accuracy of living bodies, thereby improving the security defense performance.
  • FIG. 2 shows a flowchart of a method for identifying a living body according to an embodiment of the present disclosure.
  • the method can be executed by electronic equipment such as terminal equipment or server, and the terminal equipment can be user equipment (User Equipment, UE), mobile equipment, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA) , handheld device, computing device, vehicle-mounted device, wearable device, etc.
  • the method can be implemented by the processor calling the computer-readable instructions stored in the memory.
  • the method may be performed by a server, and the server may be a local server, a cloud server, or the like.
  • the method includes:
  • step S21 a first living body recognition is performed on the target image corresponding to the object to be recognized to obtain a first recognition result, and the first living body recognition is used to identify whether the object to be recognized is a living body or a 2D non-living body.
  • the first in vivo recognition can be performed on the target image corresponding to the object to be recognized to identify whether the object to be recognized is a living body or 2D In vivo, the first identification result is obtained.
  • the living body recognition process can be directly ended (for example, the door lock is controlled not to be opened); when the first recognition result indicates that the object to be recognized is a living body, in order to further treat the recognized object For identification, the following step S22 is performed on the target image corresponding to the object to be identified.
  • step S22 when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, and the second living body recognition is used to identify whether the object to be recognized is a living body or a 3D non-living body. living body.
  • a second living body recognition is performed on the target image corresponding to the object to be recognized, so as to identify whether the object to be recognized is a living body or a 3D non-living body, and a second recognition result is obtained. Then, a corresponding operation can be performed according to the second recognition result.
  • the object to be recognized is an object that needs to be unlocked, and when the second recognition result indicates that the object to be recognized is a 3D non-living body, the door lock is controlled not to be opened; When it is indicated that the object to be identified is a living body, the door lock is controlled to open.
  • a first-stage first living body recognition is performed on the target image corresponding to the recognized object to be recognized, to identify whether the to-be-identified object is a living body or a 2D non-living body, and the first recognition result obtained from the first living body recognition indicates that the to-be-identified object is to be recognized.
  • a second-stage second living body recognition is performed on the target image to identify whether the object to be recognized is a living body or a 3D non-living body, and an accurate second recognition result can be obtained.
  • performing the first living body recognition on the target image corresponding to the object to be recognized, and obtaining the first recognition result includes: performing the first living body recognition on the target image through the first living body recognition network, and obtaining the first recognition result , the first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
  • the first living body recognition network trained based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body can improve the recognition accuracy of the 2D non-living body, so that the object to be recognized through the first living body recognition network corresponds to After the first living body recognition is performed on the target image of , a first recognition result with higher recognition accuracy can be obtained.
  • the function of the first living body recognition network is to identify the image input to the network and determine whether it is an image corresponding to a living body or an image corresponding to a 2D non-living body.
  • the first sample image includes a first label
  • the first label is used to indicate that the first sample image is an image corresponding to a living body
  • the method further includes: classifying the first sample image and the second sample image through the first initial network to obtain a first classification result; according to the first label and the first classification included in the first sample image As a result, the first classification loss corresponding to the first initial network is determined; according to the first classification loss, the first initial network is trained to obtain the trained first living body recognition network.
  • the first initial network is trained by using the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body. Since the first sample image includes the first label, it can be classified according to the first label and the first classification. As a result, the classification accuracy of the first initial network is determined, that is, the first classification loss corresponding to the first initial network is determined, so that the first initial network can be effectively trained according to the first classification loss, so as to obtain a A first living body recognition network with high recognition accuracy of living bodies.
  • the method before classifying the first sample image and the second sample image through the first initial network, the method further includes: using a public image data set to train the first original network to obtain The first initial network after training.
  • the public image data set can be ImageNet.
  • ImageNet is an image classification data set containing about 15 million images, including more than 1,000 categories. Using ImageNet to train the first original network, you can get the classification function after training. Then, the first initial network corresponding to the living body and the second sample image corresponding to the 2D non-living body can be used to train the first initial network to obtain the trained first living body recognition network.
  • the public image dataset may also be other public image datasets used for classification training, which is not specifically limited in the present disclosure.
  • the process of obtaining the first living body recognition network using the first initial network training firstly, based on the first sample image corresponding to the living body including the first label, and the second sample image corresponding to the 2D non-living body without the first label , construct the first training sample set, and input the first training sample set into the first initial network.
  • the first initial network identifies whether the first sample image is an image corresponding to a living body or an image corresponding to a 2D non-living body, and classifies the first sample image according to the recognition result to obtain a first classification result corresponding to the first sample image. For example, when the recognition result of the first sample image is that the first sample image is an image corresponding to a living body, the first classification result corresponding to the first sample image is a living body category; When the first sample image is an image corresponding to a 2D non-living body, the first classification result corresponding to the first sample image is a 2D non-living body category.
  • the first initial network identifies whether the second sample image is an image corresponding to a living body or an image corresponding to a 2D non-living body, and classifies the second sample image according to the recognition result to obtain a first classification result corresponding to the second sample image. For example, when the recognition result is that the second sample image is an image corresponding to a living body, the first classification result corresponding to the second sample image is a living body category; when the recognition result is that the second sample image is an image corresponding to a 2D non-living body, the second The first classification result corresponding to the sample image is a 2D non-living class.
  • the first classification loss corresponding to the first initial network can be determined.
  • the first initial network successfully classifies the first sample image; if the first sample image including the first label corresponds to When the first classification result is a 2D non-living category, the first initial network fails to classify the first sample image; or, when the first classification result corresponding to the second sample image that does not include the first label is a 2D non-living category When the first initial network successfully classifies the second sample image; when the first classification result corresponding to the second sample image that does not include the first label is a living body category, the first initial network fails to classify the second sample image.
  • the first classification loss corresponding to the first initial network can be determined, and then according to the first initial network A classification loss is used to train the first initial network to obtain the trained first living body recognition network.
  • training the first initial network according to the first classification loss to obtain the trained first living body recognition network includes: constructing a first loss function according to the first classification loss; according to the first loss function and the first recognition threshold, and train the first initial network to obtain the trained first living body recognition network.
  • the network parameters corresponding to the first initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the first initial network is used to iteratively train the intermediate network until the recognition accuracy corresponding to the network is reached. If it is greater than the first recognition threshold, it is determined that a trained first living body recognition network that meets the conditions is obtained.
  • the first loss function may be a cross-entropy loss function or other loss functions, and the specific value of the first identification threshold may be determined according to the actual situation, which is not specifically limited in the present disclosure.
  • training the first initial network according to the first classification loss to obtain the trained first living body recognition network includes: constructing a first loss function according to the first classification loss; A loss function and a first number of iterations are used to train a first initial network to obtain a trained first living body recognition network.
  • the network parameters corresponding to the first initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the first initial network is used to iteratively train the intermediate network until the number of iterative training reaches the third For one iteration, it is determined to obtain the first trained living body recognition network that meets the conditions.
  • classifying the first sample image and the second sample image through the first initial network to obtain the first classification result includes: performing face detection on the first sample image to obtain the first classification result. face frame, and performing face detection on the second sample image to obtain a second face frame; cropping the first sample image according to the first face frame to obtain a first face image, and according to the second person The face frame cuts the second sample image to obtain a second face image; the first initial network is used to classify the first face image and the second face image to obtain a first classification result.
  • the first sample image is cut according to the first face frame to obtain the first face image
  • the second sample image is cut according to the second face frame to obtain the first face image.
  • Two face images including: adjusting the size of the first face frame to obtain a third face frame, and adjusting the size of the second face frame to obtain a fourth face frame; This image is cropped to obtain a first face image, and the second sample image is cropped according to the fourth face frame to obtain a second face image.
  • the adjusted third face frame and the fourth face frame can be obtained by cropping from the first sample image and the second sample image.
  • the first face image and the second face image have more effective information, so that the classification efficiency can be effectively improved when the first face image and the second face image obtained by cutting are subsequently classified.
  • the one-person face frame is expanded by the first preset ratio threshold (for example, 0.2 times upwards, leftwards, and rightwards, and 0.4 times downwards) to obtain a third face frame
  • the second The face frame is expanded outward by the second preset ratio threshold (for example, 0.3 times upward, leftward, and rightward outward expansion, and 0.5 times downward outward expansion) to obtain a fourth face frame.
  • the specific values of the first preset ratio threshold and the second preset ratio threshold may be determined according to actual conditions, which are not specifically limited in the present disclosure.
  • the expanded third face frame and the fourth face frame contain more information around the face, making it easier to analyze the inside of the third face frame.
  • the first face image and the second face image within the fourth face frame are classified.
  • the second sample image is an image corresponding to a photo
  • a second face frame is obtained by performing face detection on the second sample image, wherein the second face frame corresponds to the face part in the photo.
  • the fourth face frame is obtained by expanding the second face frame, so that the fourth face frame includes not only the face part in the photo, but also the border part of the photo.
  • the first classification result corresponding to the face image is a 2D non-living class.
  • the method for adjusting the size of the first face frame and the second face frame may include, in addition to the above-mentioned outward expansion method, a shrinking method, which is not specifically limited in the present disclosure.
  • the first sample image is obtained by cropping the first sample image according to the third face frame, and after the second sample image is obtained by cropping the second sample image according to the fourth face frame, It is also possible to adjust the first face image and the second face image to images with a first target size (for example, a length and a width of 224 pixels), so that the first living body recognition network can recognize the first face image and the second face image of the same size.
  • the second image is classified to improve classification accuracy.
  • the specific value of the first target size may be determined according to actual conditions, which is not specifically limited in the present disclosure.
  • performing a second living body recognition on the target image to obtain a second recognition result includes: performing a second living body recognition on the target image through a second living body recognition network to obtain a second recognition result, the second living body The recognition network is trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
  • the second living body recognition network trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body can improve the recognition accuracy of the 3D non-living body, so that the second living body After the second living body recognition is performed on the target image, a second recognition result with higher recognition accuracy can be obtained.
  • the second living body recognition network In order to recognize living bodies and 3D non-living bodies (for example, masks, head models, etc.), before performing the second living body recognition on the target image corresponding to the object to be identified, it is necessary to base on the third sample image corresponding to the living body and the 3D non-living body corresponding to The fourth sample image is pre-trained to obtain the second living body recognition network.
  • the function of the second living body recognition network is to identify the image input to the network, and determine whether it is an image corresponding to a living body or an image corresponding to a 3D non-living body.
  • the following describes the process of obtaining the second living body recognition network by training based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
  • the third sample image includes a second label
  • the second label is used to indicate that the third sample image is an image corresponding to a living body
  • the second living body recognition is performed on the target image through the second living body recognition network.
  • the method further includes: classifying the third sample image and the fourth sample image through the second initial network to obtain a second classification result; and determining the first classification result according to the second label included in the third sample image and the second classification result
  • the second classification loss corresponding to the second initial network; according to the second classification loss, the second initial network is trained to obtain the trained second living body recognition network.
  • the second initial network is trained by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body. Since the third sample image includes the second label, according to the second label and the second classification result, Determine the classification accuracy of the second initial network, that is, determine the second classification loss corresponding to the second initial network, so that the second initial network can be effectively trained according to the second classification loss, so as to obtain the trained 3D non-living body.
  • the method before classifying the third sample image and the fourth sample image through the second initial network, the method further includes: using the public image data set to train the second original network to obtain the training After the second initial network.
  • the public image data set can be ImageNet.
  • ImageNet is an image classification data set containing about 15 million images, including more than 1,000 categories. Using ImageNet to train the second original network, you can get the classification function after training.
  • the second initial network can be used to train the second initial network by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body to obtain the trained second living body recognition network.
  • the public image dataset may also be other public image datasets used for classification training, which is not specifically limited in the present disclosure.
  • the second initial network identifies whether the third sample image is an image corresponding to a living body or an image corresponding to a 3D non-living body, and classifies the third sample image according to the recognition result to obtain a second classification result corresponding to the third sample image. For example, when the recognition result of the third sample image is that the third sample image is an image corresponding to a living body, the second classification result corresponding to the third sample image is a living body category; when the recognition result of the third sample image is the third sample When the image is an image corresponding to a 3D non-living body, the second classification result corresponding to the third sample image is a 3D non-living body category.
  • the second initial network identifies whether the fourth sample image is an image corresponding to a living body or an image corresponding to a 3D non-living body, and classifies the fourth sample image according to the recognition result to obtain a second classification result corresponding to the fourth sample image. For example, when the recognition result of the fourth sample image is that the fourth sample image is an image corresponding to a living body, the second classification result corresponding to the fourth sample image is a living body category; when the recognition result of the fourth sample image is the fourth sample When the image is an image corresponding to a 3D non-living body, the second classification result corresponding to the fourth sample image is a 3D non-living body category.
  • the second classification loss corresponding to the second initial network can be determined. For example, when the second classification result corresponding to the third sample image including the second label is a living body category, the second initial network successfully classifies the third sample image; When the classification result is a 3D non-living category, the second initial network fails to classify the third sample image; or, when the second classification result corresponding to the fourth sample image that does not include the second label is a 3D non-living category, then the third sample image fails to be classified. 2.
  • the initial network successfully classifies the fourth sample image; when the second classification result corresponding to the fourth sample image that does not include the second label is a living body category, the second initial network fails to classify the fourth sample image.
  • the classification success rate of the third sample image and/or the fourth sample image by the second initial network that is, the recognition accuracy of the second initial network
  • the second classification loss corresponding to the second initial network can be determined, and then according to the second initial network
  • the classification loss is used to train the second initial network to obtain the trained second living body recognition network.
  • training the second initial network according to the second classification loss to obtain the trained second living body recognition network includes: constructing a second loss function according to the second classification loss; according to the second loss function and the second recognition threshold, and train the second initial network to obtain the trained second living body recognition network.
  • the network parameters corresponding to the second initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the second initial network is used to iteratively train the intermediate network until the recognition accuracy rate corresponding to the network is reached. If the value is greater than the second recognition threshold, it is determined that a qualified trained second living body recognition network is obtained.
  • the second loss function may be a cross-entropy loss function or other loss functions, and the specific value of the second identification threshold may be determined according to the actual situation, which is not specifically limited in the present disclosure.
  • the first identification threshold and the second identification threshold are different. Compared with using the same recognition threshold to train the first initial network and the second initial network, different recognition thresholds are used to train the first initial network and the second initial network, so that the trained first living body recognition network can be guaranteed. and the trained second living body recognition network both have high recognition accuracy.
  • training the second initial network according to the second classification loss to obtain the trained second living body recognition network includes: constructing a second loss function according to the second classification loss; The second loss function and the second number of iterations are used to train the second initial network to obtain the trained second living body recognition network.
  • the network parameters corresponding to the second initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the second initial network is used to iteratively train the intermediate network until the number of iterative training reaches the third
  • the number of iterations is two, and it is determined that a qualified second living body recognition network after training is obtained.
  • the number of first iterations and the number of second iterations are different. Compared with using the same number of iterations to train the first initial network and the second initial network, different iterations are used to train the first initial network and the second initial network, so that the trained first living body recognition network can be guaranteed. and the trained second living body recognition network both have high recognition accuracy.
  • classifying the third sample image and the fourth sample image through the second initial network to obtain the second classification result includes: performing face detection on the third sample image to obtain the fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame; cropping the third sample image according to the fifth face frame to obtain a third face image, and according to the sixth face frame The fourth sample image is cut to obtain a fourth face image; the third face image and the fourth face image are classified through the second initial network to obtain a second classification result.
  • the third sample image is cut according to the fifth face frame to obtain the third face image
  • the fourth sample image is cut according to the sixth face frame to obtain the fourth A face image, including: adjusting the size of the fifth face frame to obtain the seventh face frame, and adjusting the size of the sixth face frame to obtain the eighth face frame; and adjusting the third sample image according to the seventh face frame Cutting is performed to obtain a third face image
  • the fourth sample image is cut according to the eighth face frame to obtain a fourth face image.
  • the third sample image and the fourth sample image can be cropped to obtain
  • the third face image and the fourth face image with more effective information can effectively improve the classification efficiency when the third face image and the fourth face image obtained by cutting are subsequently classified.
  • the face frame is expanded by a third preset ratio threshold (for example, 0.2 times upward, leftward and rightward, and 0.3 times downward) to obtain a seventh face frame
  • the sixth face frame is Carry out the outward expansion of the fourth preset ratio threshold (for example, 0.3 times upward, leftward, and rightward outward expansion, and 0.3 times downward outward expansion) to obtain the eighth face frame.
  • the specific values of the third preset ratio threshold and the fourth preset ratio threshold may be determined according to actual conditions, which are not specifically limited in the present disclosure.
  • the expanded seventh face frame and the eighth face frame contain more information around the face, which makes it easier to compare the inside of the seventh face frame.
  • the third face image and the fourth face image within the eighth face frame are classified.
  • the fourth sample image is an image corresponding to a mask
  • a sixth face frame is obtained by performing face detection on the fourth sample image, wherein the sixth face frame corresponds to the face part in the mask.
  • the eighth face frame is obtained by externally expanding the sixth face frame, so that the eighth face frame includes not only the face part in the mask, but also the boundary part of the mask. Therefore, when classifying the fourth face image cropped from the fourth sample image according to the eighth face frame, since the fourth face image includes the boundary part of the mask, it is easy to determine the fourth person
  • the second classification result corresponding to the face image is the 3D non-living category.
  • the method for adjusting the size of the fifth face frame and the sixth face frame may include, in addition to the above-mentioned outward expansion, methods such as shrinkage, which are not specifically limited in this disclosure.
  • the third sample image is cut according to the seventh face frame to obtain the third face image
  • the fourth sample image is cut according to the eighth face frame to obtain the fourth face image
  • the The third face image and the fourth face image can be adjusted to images of the second target size (for example, the length and width are 224 pixels), so that the second living body recognition network can be used for the third face image and the third face image of the same size.
  • Four images are classified to improve classification accuracy.
  • the specific value of the second target size may be determined according to the actual situation, which is not specifically limited in the present disclosure.
  • two-stage living body recognition can be performed on the object to be recognized.
  • FIG. 3 shows a schematic diagram of a living body recognition network according to an embodiment of the present disclosure. As shown in Figure 3:
  • the first step is to input the target image corresponding to the object to be recognized into the first living body recognition network, and according to the first living body recognition network, identify whether the object to be recognized is a living body or a 2D non-living body.
  • the process of living body recognition is ended, and the first recognition result is output; the first recognition result output by the first living body recognition network indicates that the object to be recognized is When alive, perform the second step.
  • the target image corresponding to the object to be recognized is input into the second living body recognition network, and according to the second living body recognition network, whether the object to be recognized is a living body or a 3D non-living body is identified.
  • the third step is to output the second identification result of the second network identification network.
  • a first-stage first living body recognition is performed on the target image corresponding to the recognized object to be recognized, to identify whether the to-be-identified object is a living body or a 2D non-living body, and the first recognition result obtained from the first living body recognition indicates that the to-be-identified object is to be recognized.
  • a second-stage second living body recognition is performed on the target image to identify whether the object to be recognized is a living body or a 3D non-living body, and an accurate second recognition result can be obtained.
  • FIG. 4 shows a flowchart of a method for controlling an access control device according to a disclosed embodiment.
  • the access control device in the method may include door locks, gates, and other terminal devices that need to control access, which is not specifically limited in the present disclosure.
  • the method includes:
  • step S41 a target image corresponding to an object to be identified that needs to pass through the access control device is collected.
  • step S42 a first living body recognition is performed on the target image to obtain a first recognition result, and the first living body recognition is used to identify whether the object to be recognized is a living body or a 2D non-living body.
  • step S43 when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, and the second living body recognition is used to identify whether the object to be recognized is a living body or a 3D non-living body living body.
  • step S44 when the second living body identification result indicates that the object to be identified is a living body, the access control device is controlled to be turned on.
  • the above-mentioned two-stage living body recognition method can effectively identify both 2D non-living bodies (for example, photos, images) and 3D non-living bodies
  • the above two-stage method is performed on the objects to be identified that need to pass through the access control equipment. and control the access control device to open only when the first and second living body recognition results indicate that the object to be identified is a living body, thereby effectively improving the security of the access control device.
  • collecting the target image corresponding to the object to be identified that needs to pass through the access control device includes: using a dual infrared camera module to collect the target image corresponding to the object to be identified.
  • the dual-infrared camera module can be used to collect the image of the object to be identified that needs to pass through the access control device, and the target image of the object to be identified can be obtained.
  • the dual-infrared camera module is integrated with the access control device, or the dual-infrared camera module is separately set near the access control device, so that the dual-infrared camera module can be used to capture images of objects to be identified that need to pass through the access control device.
  • the clear target image corresponding to the object to be recognized that needs to pass through the access control device is collected by using the dual infrared camera module, and then the target image corresponding to the object to be recognized is recognized by the above-mentioned two-stage living body recognition method, so that the access control equipment can be improved.
  • the accuracy of living body recognition in dark light scenes can effectively improve the security of access control equipment.
  • the present disclosure also provides living body recognition/access control equipment control devices, electronic equipment, computer-readable storage media, and programs, all of which can be used to implement any of the living body recognition/access control equipment control methods provided by the present disclosure, and the corresponding technical solutions and The description and reference to the corresponding records in the method section will not be repeated.
  • FIG. 5 shows a block diagram of a living body recognition apparatus according to an embodiment of the present disclosure.
  • the living body identification device 50 includes:
  • the first identification module 51 is used to perform first living body identification on the target image corresponding to the object to be identified, to obtain a first identification result, and the first living body identification is used to identify whether the object to be identified is a living body or a 2D non-living body;
  • the second recognition module 52 is configured to perform second in vivo recognition on the target image when the first recognition result indicates that the object to be recognized is a living body to obtain a second recognition result, and the second in vivo recognition is used to recognize that the object to be recognized is a living body Still 3D non-living.
  • the first identification module 51 is specifically used for:
  • a first living body recognition is performed on the target image through a first living body recognition network to obtain a first recognition result.
  • the first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
  • the first sample image includes a first label, where the first label is used to indicate that the first sample image is an image corresponding to a living body;
  • the living body identification device 50 further includes:
  • a first classification module configured to classify the first sample image and the second sample image through the first initial network before performing the first living body recognition on the target image through the first living body recognition network to obtain a first classification result
  • a first determination module configured to determine the first classification loss corresponding to the first initial network according to the first label included in the first sample image and the first classification result
  • the first training module is used for training the first initial network according to the first classification loss, so as to obtain the trained first living body recognition network.
  • the first classification module includes:
  • a first detection submodule configured to perform face detection on the first sample image to obtain a first face frame, and perform face detection on the second sample image to obtain a second face frame;
  • the first cropping submodule is used for cropping the first sample image according to the first face frame to obtain the first face image, and for cropping the second sample image according to the second face frame to obtain the second face image;
  • the first classification submodule is used for classifying the first face image and the second face image through the first initial network to obtain a first classification result.
  • the first cutting sub-module includes:
  • a first size adjustment unit for adjusting the size of the first face frame to obtain a third face frame, and for adjusting the size of the second face frame to obtain a fourth face frame;
  • the first cropping unit is used for cropping the first sample image according to the third face frame to obtain the first face image, and for cropping the second sample image according to the fourth face frame to obtain the second face image.
  • the second identification module 52 is specifically used for:
  • the second living body recognition network is used to perform second living body recognition on the target image to obtain a second recognition result.
  • the second living body recognition network is trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
  • the third sample image includes a second label, and the second label is used to indicate that the third sample image is an image corresponding to a living body;
  • the living body identification device 50 further includes:
  • the second classification module is configured to classify the third sample image and the fourth sample image through the second initial network before performing the second living body recognition on the target image through the second living body recognition network to obtain a second classification result;
  • a second determination module configured to determine the second classification loss corresponding to the second initial network according to the second label included in the third sample image and the second classification result
  • the second training module is used for training the second initial network according to the second classification loss, so as to obtain the trained second living body recognition network.
  • the second classification module includes:
  • the second detection submodule is used for performing face detection on the third sample image to obtain a fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame;
  • the second cropping submodule is used for cropping the third sample image according to the fifth face frame to obtain the third face image, and for cropping the fourth sample image according to the sixth face frame to obtain the fourth person face image;
  • the second classification submodule is configured to classify the third face image and the fourth face image through the second initial network to obtain a second classification result.
  • the second cutting sub-module includes:
  • the second size adjustment unit is used to adjust the size of the fifth face frame to obtain the seventh face frame, and adjust the size of the sixth face frame to obtain the eighth face frame;
  • the second cropping unit is used for cropping the third sample image according to the seventh face frame to obtain the third face image, and for cropping the fourth sample image according to the eighth face frame to obtain the fourth person face image.
  • FIG. 6 shows a block diagram of an access control device control apparatus according to an embodiment of the present disclosure.
  • the access control device control device 60 includes:
  • the image acquisition module 61 is used to collect the target image corresponding to the object to be identified that needs to pass through the access control device;
  • the living body recognition module 62 is configured to use the above-mentioned living body recognition method to perform living body recognition on the target image to obtain a living body recognition result;
  • the control module 63 is configured to control the access control device to open when the living body identification result indicates that the object to be identified is a living body.
  • the image acquisition module 61 is specifically used for:
  • the target image corresponding to the object to be recognized is collected.
  • the functions or modules included in the apparatuses provided in the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above-mentioned method for living body identification , or execute the above access control device control method.
  • Embodiments of the present disclosure also provide a computer program product, including computer-readable codes.
  • a processor in the device executes the method for realizing the living body identification/access control provided by any of the above embodiments. Instructions for device control methods.
  • Embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to perform the operations of the living body recognition/access control device control method provided by any of the foregoing embodiments.
  • the electronic device may be provided as a terminal, server or other form of device.
  • FIG. 7 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 800 may be a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and other terminals.
  • an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814 , and the communication component 816 .
  • the processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above.
  • processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components.
  • processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. Memory 804 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk Magnetic Disk
  • Power supply assembly 806 provides power to various components of electronic device 800 .
  • Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
  • Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user.
  • the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 810 is configured to output and/or input audio signals.
  • audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 800 is in operating modes, such as calling mode, recording mode, and voice recognition mode.
  • the received audio signal may be further stored in memory 804 or transmitted via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 .
  • the sensor assembly 814 can detect the open/closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the electronic device 800 or the electronic device 800.
  • the position of a component changes, the presence or absence of user contact with the electronic device 800, the orientation or acceleration/deceleration of the electronic device 800, and the temperature of the electronic device 800 changes.
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, for use in imaging applications.
  • CMOS complementary metal oxide semiconductor
  • CCD charge coupled device
  • the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices.
  • the electronic device 800 may access a wireless network based on a communication standard, such as wireless network (WiFi), second generation mobile communication technology (2G) or third generation mobile communication technology (3G), or a combination thereof.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A programmed gate array
  • controller microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
  • a non-volatile computer-readable storage medium such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
  • FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
  • the electronic device 1900 may be provided as a server.
  • electronic device 1900 includes processing component 1922, which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922, such as applications.
  • An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions.
  • the processing component 1922 is configured to execute instructions to perform the above-described methods.
  • the electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input output (I/O) interface 1958 .
  • the electronic device 1900 can operate based on an operating system stored in the memory 1932, such as a Microsoft server operating system (Windows Server TM ), a graphical user interface based operating system (Mac OS X TM ) introduced by Apple, a multi-user multi-process computer operating system (Unix TM ), Free and Open Source Unix-like Operating System (Linux TM ), Open Source Unix-like Operating System (FreeBSD TM ) or the like.
  • Microsoft server operating system Windows Server TM
  • Mac OS X TM graphical user interface based operating system
  • Uniix TM multi-user multi-process computer operating system
  • Free and Open Source Unix-like Operating System Linux TM
  • FreeBSD TM Open Source Unix-like Operating System
  • a non-volatile computer-readable storage medium such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
  • the present disclosure may be a system, method and/or computer program product.
  • the computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
  • a computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device.
  • the computer-readable storage medium may be a volatile storage medium or a non-volatile storage medium.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Non-exhaustive list of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM) or flash memory), static random access memory (SRAM), portable compact disk read only memory (CD-ROM), digital versatile disk (DVD), memory sticks, floppy disks, mechanically coded devices, such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • flash memory static random access memory
  • SRAM static random access memory
  • CD-ROM compact disk read only memory
  • DVD digital versatile disk
  • memory sticks floppy disks
  • mechanically coded devices such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above.
  • Computer-readable storage media are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
  • the computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • a network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
  • Computer program instructions for carrying out operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages.
  • Source or object code written in any combination, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as the "C" language or similar programming languages.
  • the computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through the Internet connect).
  • LAN local area network
  • WAN wide area network
  • custom electronic circuits such as programmable logic circuits, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) can be personalized by utilizing state information of computer readable program instructions.
  • Computer readable program instructions are executed to implement various aspects of the present disclosure.
  • These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the computer program product can be specifically implemented by hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
  • a software development kit Software Development Kit, SDK

Abstract

Liveness identification and access control device control methods, an apparatus, an electronic device, a storage medium, and a computer program. A method comprises: performing first liveness identification on a target image corresponding to an object to be identified, and obtaining a first identification result, first liveness identification being used for identifying whether the object to be identified is a living body or is a 2D non-living body (S21); in the circumstance that the first identification result indicates that the object to be identified is a living body, performing second liveness identification on the target image, and obtaining a second identification result, second liveness identification being used for identifying whether the object to be identified is a living body or a 3D non-living body (S22).

Description

活体识别、门禁设备控制方法和装置、电子设备和存储介质、计算机程序Living body recognition, access control device control method and device, electronic device and storage medium, computer program
本申请要求在2020年11月10日提交中国专利局、申请号为202011248985.1、申请名称为“活体识别、门禁设备控制方法和装置、电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 10, 2020 with the application number 202011248985.1 and the application title is "living body recognition, access control equipment control method and device, electronic equipment", the entire contents of which are by reference Incorporated in this application.
技术领域technical field
本公开涉及计算机技术领域,尤其涉及一种活体识别、门禁设备控制方法及装置、电子设备和存储介质、计算机程序。The present disclosure relates to the field of computer technologies, and in particular, to a method and device for identification of living bodies, access control equipment, electronic equipment, storage media, and computer programs.
背景技术Background technique
活体识别就是要识别出图像采集设备(例如,摄像头、手机等)上检测到的人脸图像是来自真实的人脸,还是某种形式的攻击或伪装。目前主要的攻击形式包括照片、视频、面具、人脸模型等。活体检测可以应用于无人值守场景下的安全防控,因此,提高活体识别的识别精度,对安全防控有着至关重要的作用。Living body recognition is to identify whether the face image detected on the image acquisition device (eg, camera, mobile phone, etc.) is from a real face, or some form of attack or camouflage. At present, the main attack forms include photos, videos, masks, face models, etc. Liveness detection can be applied to security prevention and control in unattended scenarios. Therefore, improving the recognition accuracy of living body recognition plays a vital role in security prevention and control.
发明内容SUMMARY OF THE INVENTION
本公开提出了一种活体识别、门禁设备控制方法及装置、电子设备和存储介质、计算机程序的技术方案。The present disclosure proposes a technical scheme of a living body identification, an access control device control method and device, an electronic device, a storage medium, and a computer program.
根据本公开的一方面,提供了一种活体识别方法,包括:对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,所述第一活体识别用于识别所述待识别对象是活体还是2D非活体;在所述第一识别结果指示所述待识别对象为活体的情况下,对所述目标图像进行第二活体识别,得到第二识别结果,所述第二活体识别用于识别所述待识别对象是活体还是3D非活体。According to an aspect of the present disclosure, there is provided a method for identifying a living body, comprising: performing a first living body recognition on a target image corresponding to an object to be identified to obtain a first identification result, where the first living body recognition is used to identify the object to be identified Whether it is a living body or a 2D non-living body; when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, which is used for the second living body recognition. for identifying whether the object to be identified is a living body or a 3D non-living body.
通过对识别待识别对象对应的目标图像进行第一阶段的第一活体识别,识别待识别对象是活体还是2D非活体,在第一活体识别得到的第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二阶段的第二活体识别,识别待识别对象是活体还是3D非活体,可以得到识别准确的第二识别结果。采用两阶段的活体识别方法,可以有效提高对活体的识别精度。By performing the first-stage first living body recognition on the target image corresponding to the recognized object to be recognized, whether the to-be-identified object is a living body or a 2D non-living body, the first recognition result obtained in the first living body recognition indicates that the to-be-identified object is a living body Next, the second-stage second living body recognition is performed on the target image to identify whether the object to be identified is a living body or a 3D non-living body, and an accurate second recognition result can be obtained. The two-stage living body recognition method can effectively improve the recognition accuracy of living bodies.
在一种可能的实现方式中,所述对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,包括:通过第一活体识别网络对所述目标图像进行第一活体识别,得到所述第一识别结果,所述第一活体识别网络是基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的。In a possible implementation manner, performing the first living body recognition on the target image corresponding to the object to be identified, and obtaining the first recognition result, includes: performing the first living body recognition on the target image through the first living body recognition network, and obtaining For the first recognition result, the first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的第一活体识别网络,可以提高对2D非活体的识别精度,从而使得通过第一活体识别网络对待识别对象对应的目标图像进行第一活体识别之后,可以得到识别精度较高的第一识别结果。The first living body recognition network trained based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body can improve the recognition accuracy of the 2D non-living body, so that the object to be recognized through the first living body recognition network corresponds to After the first living body recognition is performed on the target image of , a first recognition result with higher recognition accuracy can be obtained.
在一种可能的实现方式中,所述第一样本图像中包括第一标签,所述第一标签用于指示所述第一样本图像为活体对应的图像;在通过所述第一活体识别网络对所述目标图像进行第一活体识别之前,所述方法还包括:通过第一初始网络对所述第一样本图像和所述第二样本图像进行分类,得到第一分类结果;根据所述第一样本图像中包括的所述第一标签以及所述第一分类结果,确定所述第一初始网络对应的第一分类损失;根据所述第一分类损失,训练所述第一初始网络,以得到训练后的所述第一 活体识别网络。In a possible implementation manner, the first sample image includes a first label, and the first label is used to indicate that the first sample image is an image corresponding to a living body; Before the recognition network performs the first living body recognition on the target image, the method further includes: classifying the first sample image and the second sample image through a first initial network to obtain a first classification result; The first label included in the first sample image and the first classification result determine the first classification loss corresponding to the first initial network; according to the first classification loss, the first classification loss is trained. an initial network to obtain the trained first living body recognition network.
利用活体对应的第一样本图像以及2D非活体对应的第二样本图像对第一初始网络进行训练,由于第一样本图像中包括第一标签,因此,可以根据第一标签和第一分类结果,确定第一初始网络的分类准确性,即第一初始网络对应的第一分类损失,以使得根据第一分类损失可以对第一初始网络进行有效训练,以得到训练后的对2D非活体的识别精度较高的第一活体识别网络。The first initial network is trained by using the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body. Since the first sample image includes the first label, it can be classified according to the first label and the first classification. As a result, the classification accuracy of the first initial network, that is, the first classification loss corresponding to the first initial network, is determined, so that the first initial network can be effectively trained according to the first classification loss, so as to obtain a trained 2D non-living body The first living body recognition network with higher recognition accuracy.
在一种可能的实现方式中,所述通过第一初始网络对所述第一样本图像和所述第二样本图像进行分类,得到第一分类结果,包括:对所述第一样本图像进行人脸检测,得到第一人脸框,以及对所述第二样本图像进行人脸检测,得到第二人脸框;根据所述第一人脸框对所述第一样本图像进行裁切,得到第一人脸图像,以及根据所述第二人脸框对所述第二样本图像进行裁切,得到第二人脸图像;通过所述第一初始网络对所述第一人脸图像和所述第二人脸图像进行分类,得到所述第一分类结果。In a possible implementation manner, the classifying the first sample image and the second sample image through a first initial network to obtain a first classification result includes: classifying the first sample image performing face detection to obtain a first face frame, and performing face detection on the second sample image to obtain a second face frame; cropping the first sample image according to the first face frame cutting to obtain a first face image, and cutting the second sample image according to the second face frame to obtain a second face image; The image and the second face image are classified to obtain the first classification result.
相比于对第一样本图像和第二样本图像直接进行分类,对裁切得到的第一人脸图像和第二人脸图像进行分类,可以有效提高分类效率。Compared with directly classifying the first sample image and the second sample image, classifying the cropped first face image and the second face image can effectively improve the classification efficiency.
在一种可能的实现方式中,所述根据所述第一人脸框对所述第一样本图像进行裁切,得到第一人脸图像,以及根据所述第二人脸框对所述第二样本图像进行裁切,得到第二人脸图像,包括:调整所述第一人脸框的尺寸,得到第三人脸框,以及调整所述第二人脸框的尺寸,得到第四人脸框;根据所述第三人脸框对所述第一样本图像进行裁切,得到所述第一人脸图像,以及根据所述第四人脸框对所述第二样本图像进行裁切,得到所述第二人脸图像。In a possible implementation manner, the first sample image is cropped according to the first face frame to obtain a first face image, and the Cropping the second sample image to obtain a second face image includes: adjusting the size of the first face frame to obtain a third face frame, and adjusting the size of the second face frame to obtain a fourth face frame face frame; according to the third face frame, the first sample image is cropped to obtain the first face image, and the second sample image is processed according to the fourth face frame crop to obtain the second face image.
通过调整第一人脸框和第二人脸框的尺寸,使得根据调整后的第三人脸框和第四人脸框,可以从第一样本图像和第二样本图像中,裁切得到具备更多有效信息的第一人脸图像和第二人脸图像,从而使得后续对裁切得到的第一人脸图像和第二人脸图像进行分类时,可以有效提高分类效率。By adjusting the sizes of the first face frame and the second face frame, the adjusted third face frame and the fourth face frame can be obtained by cropping from the first sample image and the second sample image. The first face image and the second face image have more effective information, so that the classification efficiency can be effectively improved when the first face image and the second face image obtained by cutting are subsequently classified.
在一种可能的实现方式中,所述对所述目标图像进行第二活体识别,得到第二识别结果,包括:通过第二活体识别网络对所述目标图像进行第二活体识别,得到所述第二识别结果,所述第二活体识别网络是基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的。In a possible implementation manner, performing a second living body recognition on the target image to obtain a second recognition result includes: performing a second living body recognition on the target image through a second living body recognition network, and obtaining the second living body recognition The second recognition result, the second living body recognition network is obtained by training based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的第二活体识别网络,可以提高对3D非活体的识别精度,从而使得通过第二活体识别网络对待识别对象对应的目标图像进行第二活体识别之后,可以得到识别精度较高的第二识别结果。The second living body recognition network trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body can improve the recognition accuracy of the 3D non-living body, so that the second living body After the second living body recognition is performed on the target image, a second recognition result with higher recognition accuracy can be obtained.
在一种可能的实现方式中,所述第三样本图像中包括第二标签,所述第二标签用于指示所述第三样本图像为活体对应的图像;在通过所述第二活体识别网络对所述目标图像进行第二活体识别之前,所述方法还包括:通过第二初始网络对所述第三样本图像和所述第四样本图像进行分类,得到第二分类结果;根据所述第三样本图像中包括的所述第二标签以及所述第二分类结果,确定所述第二初始网络对应的第二分类损失;根据所述第二分类损失,训练所述第二初始网络,以得到训练后的所述第二活体识别网络。In a possible implementation manner, the third sample image includes a second label, and the second label is used to indicate that the third sample image is an image corresponding to a living body; Before performing the second living body recognition on the target image, the method further includes: classifying the third sample image and the fourth sample image through a second initial network to obtain a second classification result; The second label and the second classification result included in the three-sample images determine the second classification loss corresponding to the second initial network; and according to the second classification loss, the second initial network is trained to The trained second living body recognition network is obtained.
利用活体对应的第三样本图像以及3D非活体对应的第四样本图像对第二初始网络进行训练,由于第三样本图像中包括第二标签,因此,可以根据第二标签和第二分类结果,确定第二初始网络的分类准确性,即第二初始网络对应的第二分类损失,以使得根据第二分类损失可以对第二初始网络进行有效训练,以得到训练后的对3D非活体的识别精度较高的第二活体识别网络。The second initial network is trained by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body. Since the third sample image includes the second label, according to the second label and the second classification result, Determine the classification accuracy of the second initial network, that is, the second classification loss corresponding to the second initial network, so that the second initial network can be effectively trained according to the second classification loss, so as to obtain the recognition of 3D non-living bodies after training The second living body recognition network with higher accuracy.
在一种可能的实现方式中,所述通过第二初始网络对所述第三样本图像和所述第四样本图像进行分类,得到第二分类结果,包括:对所述第三样本图像进行人脸检测,得到第五人脸框,以及对所述第四样本图像进行人脸检测,得到第六人脸框;根据所述第五人脸框对所述第三样本图像进行裁切,得到第三人脸图像,以及根据所述第六人脸框对所述第四样本图像进行裁切,得到第四人脸图像;通过所述第二初始网络对所述第三人脸图像和所述第四人脸图像进行分类,得到所述第二分类结果。In a possible implementation manner, the classifying the third sample image and the fourth sample image by using a second initial network to obtain a second classification result includes: performing a human analysis on the third sample image. face detection to obtain a fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame; cutting the third sample image according to the fifth face frame to obtain a third face image, and cutting the fourth sample image according to the sixth face frame to obtain a fourth face image; The fourth face image is classified to obtain the second classification result.
相比于对第三样本图像和第四样本图像直接进行分类,对裁切得到的第三人脸图像和第四人脸图像进行分类,可以有效提高分类效率。Compared with directly classifying the third sample image and the fourth sample image, classifying the cropped third face image and the fourth face image can effectively improve the classification efficiency.
在一种可能的实现方式中,所述根据所述第五人脸框对所述第三样本图像进行裁切,得到第三人脸图像,以及根据所述第六人脸框对所述第四样本图像进行裁切,得到第四人脸图像,包括:调整所述第五人脸框的尺寸,得到第七人脸框,以及调整所述第六人脸框的尺寸,得到第八人脸框;根据所述第七人脸框对所述第三样本图像进行裁切,得到所述第三人脸图像,以及根据所述第八人脸框对所述第四样本图像进行裁切,得到所述第四人脸图像。In a possible implementation manner, the third sample image is cropped according to the fifth face frame to obtain a third face image, and the third face image is cut according to the sixth face frame. Four sample images are cropped to obtain a fourth face image, including: adjusting the size of the fifth face frame to obtain a seventh face frame, and adjusting the size of the sixth face frame to obtain an eighth face frame face frame; trimming the third sample image according to the seventh face frame to obtain the third face image, and trimming the fourth sample image according to the eighth face frame , to obtain the fourth face image.
通过调整第五人脸框和第六人脸框的尺寸,使得根据调整后的第七人脸框和第八人脸框,可以从第三样本图像和第四样本图像中,裁切得到具备更多有效信息的第三人脸图像和第四人脸图像,从而使得后续对裁切得到的第三人脸图像和第四人脸图像进行分类时,可以有效提高分类效率。By adjusting the size of the fifth face frame and the sixth face frame, according to the adjusted seventh face frame and the eighth face frame, the third sample image and the fourth sample image can be cropped to obtain The third face image and the fourth face image with more effective information can effectively improve the classification efficiency when the third face image and the fourth face image obtained by cutting are subsequently classified.
根据本公开的一方面,提供了一种门禁设备控制方法,包括:采集需要通过门禁设备的待识别对象对应的目标图像;采用上述活体识别方法,对所述目标图像进行活体识别,得到活体识别结果;在所述活体识别结果指示所述待识别对象为活体的情况下,控制所述门禁设备开启。According to an aspect of the present disclosure, there is provided a method for controlling an access control device, including: collecting a target image corresponding to an object to be identified that needs to pass through the access control device; using the above-mentioned method for in vivo identification, performing in vivo identification on the target image, and obtaining the in vivo identification Result: in the case that the living body identification result indicates that the object to be identified is a living body, the access control device is controlled to be turned on.
通过上述两阶段的活体识别方法,对需要通过门禁设备的待识别对象进行活体识别,使得既可以对2D非活体(例如,照片、图像)进行有效识别,也可以对3D非活体进行有效识别,进而仅在活体识别结果指示待识别对象为活体的情况下控制门禁设备开启,从而可以有效提高门禁设备的安全性。Through the above-mentioned two-stage living body recognition method, the living body recognition is performed on the object to be identified that needs to pass through the access control device, so that both 2D non-living bodies (for example, photos, images) can be effectively identified, and 3D non-living bodies can be effectively identified, Further, the access control device is controlled to be turned on only when the living body recognition result indicates that the object to be recognized is a living body, so that the security of the access control device can be effectively improved.
在一种可能的实现方式中,所述采集需要通过门禁设备的待识别对象对应的目标图像,包括:利用双红外摄像头模组,采集所述待识别对象对应的所述目标图像。In a possible implementation manner, the collecting the target image corresponding to the object to be identified that needs to pass through the access control device includes: using a dual infrared camera module to collect the target image corresponding to the object to be identified.
利用双红外摄像头模组采集得到需要通过门禁设备的待识别对象对应的清晰的目标图像,进而通过上述两阶段的活体识别方法,对待识别对象对应的目标图像进行活体识别,使得可以提高门禁设备在暗光场景下的活体识别准确度,从而可以有效提高门禁设备的安全性。The clear target image corresponding to the object to be recognized that needs to pass through the access control device is collected by using the dual infrared camera module, and then the target image corresponding to the object to be recognized is recognized by the above-mentioned two-stage living body recognition method, so that the access control equipment can be improved. The accuracy of living body recognition in dark light scenes can effectively improve the security of access control equipment.
根据本公开的一方面,提供了一种活体识别装置,包括:第一识别模块,用于对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,所述第一活体识别用于识别所述待识别对象是活体还是2D非活体;第二识别模块,用于在所述第一识别结果指示所述待识别对象为活体的情况下,对所述目标图像进行第二活体识别,得到第二识别结果,所述第二活体识别用于识别所述待识别对象是活体还是3D非活体。According to an aspect of the present disclosure, there is provided a living body recognition device, comprising: a first recognition module configured to perform a first living body recognition on a target image corresponding to an object to be recognized, and obtain a first recognition result, the first living body recognition using for recognizing whether the object to be recognized is a living body or a 2D non-living body; a second recognition module is used to perform second living body recognition on the target image when the first recognition result indicates that the object to be recognized is a living body , to obtain a second identification result, where the second living body identification is used to identify whether the object to be identified is a living body or a 3D non-living body.
根据本公开的一方面,提供了一种门禁设备控制装置,包括:图像采集模块,用于采集需要通过门禁设备的待识别对象对应的目标图像;活体识别模块,用于上述活体识别方法,对所述目标图像进行活体识别,得到活体识别结果;控制模块,用于在所述活体识别结果指示所述待识别对象为活体的情况下,控制所述门禁设备开启。According to an aspect of the present disclosure, there is provided an access control device control device, comprising: an image acquisition module for collecting target images corresponding to objects to be recognized that need to pass through the access control device; a living body recognition module for the above living body recognition method, for The target image is subjected to living body recognition to obtain a living body recognition result; the control module is configured to control the opening of the access control device when the living body recognition result indicates that the object to be identified is a living body.
根据本公开的一方面,提供了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储 器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述活体识别方法,或,执行上述门禁设备控制方法。According to an aspect of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above A living body identification method, or, performing the above-mentioned access control device control method.
根据本公开的一方面,提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述活体识别方法,或,执行上述门禁设备控制方法。According to an aspect of the present disclosure, there is provided a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above-mentioned living body identification method or the above-mentioned access control device control method is implemented.
根据本公开的一方面,提供了一种计算机程序,包括计算机可读代码,当所述计算机代码在电子设备中运行时,所述电子设备中的处理器执行用于实现上述活体识别方法,或,实现上述门禁设备控制方法。According to an aspect of the present disclosure, there is provided a computer program, comprising computer-readable code, when the computer code is executed in an electronic device, a processor in the electronic device executes the method for realizing the above-mentioned living body identification, or , to realize the above access control device control method.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the technical solutions of the present disclosure.
图1示出根据本公开实施例的一种活体识别方法的交互示意图;FIG. 1 shows an interactive schematic diagram of a method for identifying a living body according to an embodiment of the present disclosure;
图2示出根据本公开实施例的一种活体识别方法的流程图;2 shows a flowchart of a method for identifying a living body according to an embodiment of the present disclosure;
图3示出根据本公开实施例的一种活体识别网络的示意图;FIG. 3 shows a schematic diagram of a living body recognition network according to an embodiment of the present disclosure;
图4示出根据本公开实施例的一种门禁设备控制方法的流程图;4 shows a flowchart of a method for controlling an access control device according to an embodiment of the present disclosure;
图5示出根据本公开实施例的一种活体识别装置的框图;FIG. 5 shows a block diagram of a living body recognition apparatus according to an embodiment of the present disclosure;
图6示出根据本公开实施例的一种门禁设备控制装置的框图;6 shows a block diagram of an access control device control apparatus according to an embodiment of the present disclosure;
图7示出根据本公开实施例的一种电子设备的框图;7 shows a block diagram of an electronic device according to an embodiment of the present disclosure;
图8示出根据本公开实施例的一种电子设备的框图。FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure.
具体实施方式Detailed ways
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures denote elements that have the same or similar functions. While various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and A and B exist independently B these three cases. In addition, the term "at least one" herein refers to any combination of any one of the plurality or at least two of the plurality, for example, including at least one of A, B, and C, and may mean including from A, B, and C. Any one or more elements selected from the set of B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are set forth in the following detailed description. It will be understood by those skilled in the art that the present disclosure may be practiced without certain specific details. In some instances, methods, means, components and circuits well known to those skilled in the art have not been described in detail so as not to obscure the subject matter of the present disclosure.
人脸识别是基于人的脸部特征信息进行身份识别的一种生物识别技术,为了提高人脸识别的安全 性和可靠性,活体识别技术逐渐成为人脸识别系统的核心技术。本公开实施例的活体识别方法可以应用安防、金融、电子商务等需要身份验证的场景,例如,门禁设备、远程交易等。根据本公开的活体识别方法,可以确定待识别对象是否为有生命的活体,而非照片、视频、面具、人脸模型等非活体,从而可以有效减少恶意攻击。Face recognition is a biometric recognition technology based on human facial feature information. In order to improve the security and reliability of face recognition, living body recognition technology has gradually become the core technology of face recognition systems. The living body identification method of the embodiment of the present disclosure can be applied to scenarios such as security, finance, and e-commerce that require identity verification, for example, access control equipment, remote transactions, and the like. According to the living body identification method of the present disclosure, it can be determined whether the object to be identified is a living body, not a non-living body such as photos, videos, masks, and face models, so that malicious attacks can be effectively reduced.
图1示出根据本公开实施例的一种活体识别方法的交互示意图。如图1所示,电子设备11用于执行该活体识别方法。电子设备11可以为门禁设备(例如,门锁13、闸机14等),可以为用于进行远程交易的用户设备(例如,手机15),还可以为其它需要通过活体识别进行身份验证的设备,本公开对此不做具体限定。FIG. 1 shows an interactive schematic diagram of a method for identifying a living body according to an embodiment of the present disclosure. As shown in FIG. 1 , the electronic device 11 is used to execute the living body recognition method. The electronic device 11 may be an access control device (eg, door lock 13, gate 14, etc.), may be a user device (eg, mobile phone 15) used for remote transactions, or may be other devices that need to be authenticated by living body recognition , which is not specifically limited in the present disclosure.
电子设备11中包括的图像采集部件(例如,摄像头),采集需要通过电子设备11进行活体识别的待识别对象12的目标图像。电子设备11对目标图像进行第一阶段的第一活体识别,识别待识别对象12是活体还是2D非活体。在第一活体识别得到的第一识别结果指示待识别对象12为2D非活体的情况下,结束活体识别流程,输出第一识别结果,并提示待识别对象12针对电子设备11的活体识别未通过;在第一活体识别得到的第一识别结果指示待识别对象12为活体的情况下,电子设备11对目标图像进行第二阶段的第二活体识别。第二活体识别用于识别待识别对象12是活体还是3D非活体。在第二活体识别得到的第二识别结果指示待识别对象12为3D非活体的情况下,结束活体识别流程,输出第二识别结果,并提示待识别对象12针对电子设备11的活体识别未通过;在第二活体识别得到的第二识别结果指示待识别对象12为活体的情况下,结束活体识别流程,输出第二识别结果,并提示待识别对象12针对电子设备11的活体识别通过。The image acquisition component (eg, camera) included in the electronic device 11 acquires a target image of the object to be recognized 12 that needs to be recognized by the electronic device 11 . The electronic device 11 performs the first-stage first living body recognition on the target image, and identifies whether the object 12 to be identified is a living body or a 2D non-living body. In the case where the first recognition result obtained from the first living body recognition indicates that the object to be recognized 12 is a 2D non-living body, the process of living body recognition is ended, the first recognition result is output, and the object 12 to be recognized has failed the living body recognition for the electronic device 11 . ; When the first recognition result obtained by the first living body recognition indicates that the object to be identified 12 is a living body, the electronic device 11 performs the second-stage second living body recognition on the target image. The second living body identification is used to identify whether the object 12 to be identified is a living body or a 3D non-living body. In the case where the second recognition result obtained by the second living body recognition indicates that the object to be recognized 12 is a 3D non-living body, the process of living body recognition is ended, the second recognition result is output, and the object 12 to be recognized has failed the living body recognition for the electronic device 11 . When the second recognition result obtained by the second living body identification indicates that the object 12 to be identified is a living body, the living body identification process is ended, the second identification result is output, and the object 12 to be identified is prompted to pass the living body identification of the electronic device 11 .
电子设备11对待识别对象12的活体识别通过之后,电子设备11可以执行相应操作,例如,在电子设备11为门禁设备(例如,门锁、闸机等)的情况下,启动门禁设备使得待识别对象12进入或通过;在电子设备11为用于进行远程交易的用户设备时,执行该远程交易。本公开实施例采用两阶段的活体识别方法,可以有效提高对活体的识别精度,进而提高安全防御性能。After the electronic device 11 passes the living body recognition of the object 12 to be recognized, the electronic device 11 can perform corresponding operations. For example, in the case where the electronic device 11 is an access control device (eg, a door lock, a gate, etc.) Object 12 enters or passes; when electronic device 11 is a user device for conducting a remote transaction, the remote transaction is performed. The embodiment of the present disclosure adopts a two-stage living body identification method, which can effectively improve the identification accuracy of living bodies, thereby improving the security defense performance.
下面对根据本公开实施例的活体识别方法进行详细说明。The living body identification method according to the embodiment of the present disclosure will be described in detail below.
图2示出根据本公开实施例的一种活体识别方法的流程图。该方法可以由终端设备或服务器等电子设备执行,终端设备可以为用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字处理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备、可穿戴设备等,该方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。或者,可以通过服务器执行该方法,服务器可以为本地服务器、云端服务器等。如图2所示,该方法包括:FIG. 2 shows a flowchart of a method for identifying a living body according to an embodiment of the present disclosure. The method can be executed by electronic equipment such as terminal equipment or server, and the terminal equipment can be user equipment (User Equipment, UE), mobile equipment, user terminal, terminal, cellular phone, cordless phone, personal digital assistant (Personal Digital Assistant, PDA) , handheld device, computing device, vehicle-mounted device, wearable device, etc., the method can be implemented by the processor calling the computer-readable instructions stored in the memory. Alternatively, the method may be performed by a server, and the server may be a local server, a cloud server, or the like. As shown in Figure 2, the method includes:
在步骤S21中,对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,第一活体识别用于识别待识别对象是活体还是2D非活体。In step S21, a first living body recognition is performed on the target image corresponding to the object to be recognized to obtain a first recognition result, and the first living body recognition is used to identify whether the object to be recognized is a living body or a 2D non-living body.
在需要对待识别对象进行活体识别时(例如,对需要开启门锁的待识别对象进行活体识别),可以先对待识别对象对应的目标图像进行第一活体识别,以识别待识别对象是活体还是2D非活体,得到第一识别结果。当第一识别结果指示待识别对象为2D非活体时,可以直接结束活体识别流程(例如,控制门锁不开启);当第一识别结果指示待识别对象是活体时,为了进一步对待识别对象进行识别,对待识别对象对应的目标图像执行下述步骤S22。When the object to be recognized needs to be recognized in vivo (for example, the object to be recognized whose door lock needs to be unlocked), the first in vivo recognition can be performed on the target image corresponding to the object to be recognized to identify whether the object to be recognized is a living body or 2D In vivo, the first identification result is obtained. When the first recognition result indicates that the object to be recognized is a 2D non-living body, the living body recognition process can be directly ended (for example, the door lock is controlled not to be opened); when the first recognition result indicates that the object to be recognized is a living body, in order to further treat the recognized object For identification, the following step S22 is performed on the target image corresponding to the object to be identified.
在步骤S22中,在第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二活体识别, 得到第二识别结果,第二活体识别用于识别待识别对象是活体还是3D非活体。In step S22, when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, and the second living body recognition is used to identify whether the object to be recognized is a living body or a 3D non-living body. living body.
对待识别对象对应的目标图像进行第二活体识别,以识别待识别对象是活体还是3D非活体,得到第二识别结果。进而可以根据第二识别结果执行相应操作,例如,待识别对象为需要开启门锁的对象,当第二识别结果指示待识别对象为3D非活体时,控制门锁不开启;当第二识别结果指示待识别对象是活体时,控制门锁开启。A second living body recognition is performed on the target image corresponding to the object to be recognized, so as to identify whether the object to be recognized is a living body or a 3D non-living body, and a second recognition result is obtained. Then, a corresponding operation can be performed according to the second recognition result. For example, the object to be recognized is an object that needs to be unlocked, and when the second recognition result indicates that the object to be recognized is a 3D non-living body, the door lock is controlled not to be opened; When it is indicated that the object to be identified is a living body, the door lock is controlled to open.
在本公开实施例中,对识别待识别对象对应的目标图像进行第一阶段的第一活体识别,识别待识别对象是活体还是2D非活体,在第一活体识别得到的第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二阶段的第二活体识别,识别待识别对象是活体还是3D非活体,可以得到识别准确的第二识别结果。采用本公开提供的技术方案,通过两阶段的活体识别,可以有效提高对活体的识别精度。In the embodiment of the present disclosure, a first-stage first living body recognition is performed on the target image corresponding to the recognized object to be recognized, to identify whether the to-be-identified object is a living body or a 2D non-living body, and the first recognition result obtained from the first living body recognition indicates that the to-be-identified object is to be recognized. When the recognized object is a living body, a second-stage second living body recognition is performed on the target image to identify whether the object to be recognized is a living body or a 3D non-living body, and an accurate second recognition result can be obtained. By adopting the technical solution provided by the present disclosure, the recognition accuracy of the living body can be effectively improved through the two-stage living body recognition.
在一种可能的实现方式中,对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,包括:通过第一活体识别网络对目标图像进行第一活体识别,得到第一识别结果,第一活体识别网络是基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的。In a possible implementation manner, performing the first living body recognition on the target image corresponding to the object to be recognized, and obtaining the first recognition result, includes: performing the first living body recognition on the target image through the first living body recognition network, and obtaining the first recognition result , the first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的第一活体识别网络,可以提高对2D非活体的识别精度,从而使得通过第一活体识别网络对待识别对象对应的目标图像进行第一活体识别之后,可以得到识别精度较高的第一识别结果。The first living body recognition network trained based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body can improve the recognition accuracy of the 2D non-living body, so that the object to be recognized through the first living body recognition network corresponds to After the first living body recognition is performed on the target image of , a first recognition result with higher recognition accuracy can be obtained.
为了对活体和2D非活体(例如,照片、图像等)进行识别,在对待识别对象对应的目标图像进行第一活体识别之前,需要基于活体对应的第一样本图像和2D非活体对应的第二样本图像,预先训练得到第一活体识别网络。第一活体识别网络的作用是对输入网络的图像进行识别,判断其是活体对应的图像,还是2D非活体对应的图像。In order to recognize a living body and a 2D non-living body (eg, photos, images, etc.), before performing the first living body recognition on the target image corresponding to the object to be recognized, it is necessary to base on the first sample image corresponding to the living body and the first sample image corresponding to the 2D non-living body. Two-sample images, pre-trained to obtain the first living body recognition network. The function of the first living body recognition network is to identify the image input to the network and determine whether it is an image corresponding to a living body or an image corresponding to a 2D non-living body.
下面对基于活体对应的第一样本图像和2D非活体对应的第二样本图像,训练得到第一活体识别网络的过程进行详细说明。The process of obtaining the first living body recognition network by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body will be described in detail below.
在一种可能的实现方式中,第一样本图像中包括第一标签,第一标签用于指示第一样本图像为活体对应的图像;在通过第一活体识别网络对目标图像进行第一活体识别之前,该方法还包括:通过第一初始网络对第一样本图像和第二样本图像进行分类,得到第一分类结果;根据第一样本图像中包括的第一标签以及第一分类结果,确定第一初始网络对应的第一分类损失;根据第一分类损失,训练第一初始网络,以得到训练后的第一活体识别网络。In a possible implementation manner, the first sample image includes a first label, and the first label is used to indicate that the first sample image is an image corresponding to a living body; Before the living body recognition, the method further includes: classifying the first sample image and the second sample image through the first initial network to obtain a first classification result; according to the first label and the first classification included in the first sample image As a result, the first classification loss corresponding to the first initial network is determined; according to the first classification loss, the first initial network is trained to obtain the trained first living body recognition network.
利用活体对应的第一样本图像以及2D非活体对应的第二样本图像对第一初始网络进行训练,由于第一样本图像中包括第一标签,因此,可以根据第一标签和第一分类结果,确定第一初始网络的分类准确性,即确定第一初始网络对应的第一分类损失,以使得根据第一分类损失可以对第一初始网络进行有效训练,以得到训练后的对2D非活体的识别精度较高的第一活体识别网络。The first initial network is trained by using the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body. Since the first sample image includes the first label, it can be classified according to the first label and the first classification. As a result, the classification accuracy of the first initial network is determined, that is, the first classification loss corresponding to the first initial network is determined, so that the first initial network can be effectively trained according to the first classification loss, so as to obtain a A first living body recognition network with high recognition accuracy of living bodies.
在一种可能的实现方式中,在通过第一初始网络对第一样本图像和第二样本图像进行分类之前,该方法还包括:利用公共图像数据集对第一原始网络进行训练,以得到训练后的第一初始网络。In a possible implementation manner, before classifying the first sample image and the second sample image through the first initial network, the method further includes: using a public image data set to train the first original network to obtain The first initial network after training.
其中,公共图像数据集可以是ImageNet,ImageNet是一个约包含1500万张图像的图像分类数据集,共包含1000多个类别,利用ImageNet对第一原始网络进行训练,可以得到训练后的具备分类功能的第一初始网络,进而可以利用活体对应的第一样本图像以及2D非活体对应的第二样本图像,对第一初始 网络进行训练,以得到训练后的第一活体识别网络。公共图像数据集除了可以是ImageNet之外,还可以是其它用于进行分类训练的公共图像数据集,本公开对此不做具体限定。Among them, the public image data set can be ImageNet. ImageNet is an image classification data set containing about 15 million images, including more than 1,000 categories. Using ImageNet to train the first original network, you can get the classification function after training. Then, the first initial network corresponding to the living body and the second sample image corresponding to the 2D non-living body can be used to train the first initial network to obtain the trained first living body recognition network. In addition to ImageNet, the public image dataset may also be other public image datasets used for classification training, which is not specifically limited in the present disclosure.
在利用第一初始网络训练得到第一活体识别网络的过程中,首先,基于活体对应的包括第一标签的第一样本图像,和2D非活体对应的不包括第一标签的第二样本图像,构建第一训练样本集,将第一训练样本集输入第一初始网络。In the process of obtaining the first living body recognition network using the first initial network training, firstly, based on the first sample image corresponding to the living body including the first label, and the second sample image corresponding to the 2D non-living body without the first label , construct the first training sample set, and input the first training sample set into the first initial network.
第一初始网络识别第一样本图像是活体对应的图像还是2D非活体对应的图像,以及根据识别结果,对第一样本图像进行分类,得到第一样本图像对应的第一分类结果。例如,在对第一样本图像的识别结果为第一样本图像是活体对应的图像时,第一样本图像对应的第一分类结果为活体类别;在对第一样本图像的识别结果为第一样本图像是2D非活体对应的图像时,第一样本图像对应的第一分类结果为2D非活体类别。The first initial network identifies whether the first sample image is an image corresponding to a living body or an image corresponding to a 2D non-living body, and classifies the first sample image according to the recognition result to obtain a first classification result corresponding to the first sample image. For example, when the recognition result of the first sample image is that the first sample image is an image corresponding to a living body, the first classification result corresponding to the first sample image is a living body category; When the first sample image is an image corresponding to a 2D non-living body, the first classification result corresponding to the first sample image is a 2D non-living body category.
此外,第一初始网络识别第二样本图像是活体对应的图像还是2D非活体对应的图像,以及根据识别结果,对第二样本图像进行分类,得到第二样本图像对应的第一分类结果。例如,在识别结果为第二样本图像是活体对应的图像时,第二样本图像对应的第一分类结果为活体类别;在识别结果为第二样本图像是2D非活体对应的图像时,第二样本图像对应的第一分类结果为2D非活体类别。In addition, the first initial network identifies whether the second sample image is an image corresponding to a living body or an image corresponding to a 2D non-living body, and classifies the second sample image according to the recognition result to obtain a first classification result corresponding to the second sample image. For example, when the recognition result is that the second sample image is an image corresponding to a living body, the first classification result corresponding to the second sample image is a living body category; when the recognition result is that the second sample image is an image corresponding to a 2D non-living body, the second The first classification result corresponding to the sample image is a 2D non-living class.
在得到第一分类结果之后,由于第一样本图像中包括用于指示第一样本图像为活体对应的图像的第一标签,因此,根据第一样本图像中包括的第一标签以及第一分类结果,可以确定第一初始网络对应的第一分类损失。例如,在包括第一标签的第一样本图像对应的第一分类结果为活体类别时,则第一初始网络对第一样本图像分类成功;在包括第一标签的第一样本图像对应的第一分类结果为2D非活体类别时,则第一初始网络对第一样本图像分类失败;或者,在不包括第一标签的第二样本图像对应的第一分类结果为2D非活体类别时,则第一初始网络对第二样本图像分类成功;在不包括第一标签的第二样本图像对应的第一分类结果为活体类别时,则第一初始网络对第二样本图像分类失败。根据第一初始网络对第一样本图像和/或第二样本图像的分类成功率,也即第一初始网络的识别准确率,可以确定第一初始网络对应的第一分类损失,进而根据第一分类损失,训练第一初始网络,以得到训练后的第一活体识别网络。After the first classification result is obtained, since the first sample image includes a first label used to indicate that the first sample image is an image corresponding to a living body, according to the first label and the first label included in the first sample image With a classification result, the first classification loss corresponding to the first initial network can be determined. For example, when the first classification result corresponding to the first sample image including the first label is a living body category, the first initial network successfully classifies the first sample image; if the first sample image including the first label corresponds to When the first classification result is a 2D non-living category, the first initial network fails to classify the first sample image; or, when the first classification result corresponding to the second sample image that does not include the first label is a 2D non-living category When the first initial network successfully classifies the second sample image; when the first classification result corresponding to the second sample image that does not include the first label is a living body category, the first initial network fails to classify the second sample image. According to the classification success rate of the first sample image and/or the second sample image by the first initial network, that is, the recognition accuracy of the first initial network, the first classification loss corresponding to the first initial network can be determined, and then according to the first initial network A classification loss is used to train the first initial network to obtain the trained first living body recognition network.
在一种可能的实现方式中,根据第一分类损失,训练第一初始网络,以得到训练后的第一活体识别网络,包括:根据第一分类损失,构建第一损失函数;根据第一损失函数和第一识别阈值,训练第一初始网络,以得到训练后的第一活体识别网络。In a possible implementation manner, training the first initial network according to the first classification loss to obtain the trained first living body recognition network includes: constructing a first loss function according to the first classification loss; according to the first loss function and the first recognition threshold, and train the first initial network to obtain the trained first living body recognition network.
例如,根据第一损失函数,调整第一初始网络对应的网络参数,得到中间网络,并采用与上述训练第一初始网络相同的网络训练方法对中间网络进行迭代训练,直至网络对应的识别准确率大于第一识别阈值,确定得到符合条件的训练后的第一活体识别网络。For example, according to the first loss function, the network parameters corresponding to the first initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the first initial network is used to iteratively train the intermediate network until the recognition accuracy corresponding to the network is reached. If it is greater than the first recognition threshold, it is determined that a trained first living body recognition network that meets the conditions is obtained.
其中,第一损失函数可以为交叉熵损失函数,还可以为其它损失函数,第一识别阈值的具体取值可以根据实际情况确定,本公开对此不做具体限定。The first loss function may be a cross-entropy loss function or other loss functions, and the specific value of the first identification threshold may be determined according to the actual situation, which is not specifically limited in the present disclosure.
在一种可能的实现方式中,根据第一分类损失,对第一初始网络进行训练,以得到训练后的第一活体识别网络,包括:根据第一分类损失,构建第一损失函数;根据第一损失函数和第一迭代次数,训练第一初始网络,以得到训练后的第一活体识别网络。In a possible implementation manner, training the first initial network according to the first classification loss to obtain the trained first living body recognition network includes: constructing a first loss function according to the first classification loss; A loss function and a first number of iterations are used to train a first initial network to obtain a trained first living body recognition network.
例如,根据第一损失函数,调整第一初始网络对应的网络参数,得到中间网络,并采用与上述训 练第一初始网络相同的网络训练方法对中间网络进行迭代训练,直至迭代训练的次数达到第一迭代次数,确定得到符合条件的训练后的第一活体识别网络。For example, according to the first loss function, the network parameters corresponding to the first initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the first initial network is used to iteratively train the intermediate network until the number of iterative training reaches the third For one iteration, it is determined to obtain the first trained living body recognition network that meets the conditions.
在一种可能的实现方式中,通过第一初始网络对第一样本图像和第二样本图像进行分类,得到第一分类结果,包括:对第一样本图像进行人脸检测,得到第一人脸框,以及对第二样本图像进行人脸检测,得到第二人脸框;根据第一人脸框对第一样本图像进行裁切,得到第一人脸图像,以及根据第二人脸框对第二样本图像进行裁切,得到第二人脸图像;通过第一初始网络对第一人脸图像和第二人脸图像进行分类,得到第一分类结果。In a possible implementation manner, classifying the first sample image and the second sample image through the first initial network to obtain the first classification result includes: performing face detection on the first sample image to obtain the first classification result. face frame, and performing face detection on the second sample image to obtain a second face frame; cropping the first sample image according to the first face frame to obtain a first face image, and according to the second person The face frame cuts the second sample image to obtain a second face image; the first initial network is used to classify the first face image and the second face image to obtain a first classification result.
分别对第一样本图像和第二样本图像进行人脸检测,得到第一样本图像中的第一人脸框,以及第二样本图像中的第二人脸框,使得可以根据第一人脸框在第一样本图像中裁切得到第一人脸图像,以及根据第二人脸框在第二样本图像裁切得到第二人脸图像,进而通过第一初始网络对第一人脸图像和第二人脸图像进行分类,得到第一分类结果。相比于对第一样本图像和第二样本图像整体进行分类,对裁切得到的第一人脸图像和第二人脸图像进行分类,可以有效提高分类效率。Perform face detection on the first sample image and the second sample image, respectively, to obtain the first face frame in the first sample image and the second face frame in the second sample image, so that according to the first face frame The face frame is cut from the first sample image to obtain the first face image, and the second face image is obtained by cutting the second sample image according to the second face frame, and then the first face image is obtained by the first initial network. The image and the second face image are classified to obtain a first classification result. Compared with classifying the first sample image and the second sample image as a whole, classifying the cropped first face image and the second face image can effectively improve the classification efficiency.
在一种可能的实现方式中,根据第一人脸框对第一样本图像进行裁切,得到第一人脸图像,以及根据第二人脸框对第二样本图像进行裁切,得到第二人脸图像,包括:调整第一人脸框的尺寸,得到第三人脸框,以及调整第二人脸框的尺寸,得到第四人脸框;根据第三人脸框对第一样本图像进行裁切,得到第一人脸图像,以及根据第四人脸框对第二样本图像进行裁切,得到第二人脸图像。In a possible implementation manner, the first sample image is cut according to the first face frame to obtain the first face image, and the second sample image is cut according to the second face frame to obtain the first face image. Two face images, including: adjusting the size of the first face frame to obtain a third face frame, and adjusting the size of the second face frame to obtain a fourth face frame; This image is cropped to obtain a first face image, and the second sample image is cropped according to the fourth face frame to obtain a second face image.
通过调整第一人脸框和第二人脸框的尺寸,使得根据调整后的第三人脸框和第四人脸框,可以从第一样本图像和第二样本图像中,裁切得到具备更多有效信息的第一人脸图像和第二人脸图像,从而使得后续对裁切得到的第一人脸图像和第二人脸图像进行分类时,可以有效提高分类效率。By adjusting the sizes of the first face frame and the second face frame, the adjusted third face frame and the fourth face frame can be obtained by cropping from the first sample image and the second sample image. The first face image and the second face image have more effective information, so that the classification efficiency can be effectively improved when the first face image and the second face image obtained by cutting are subsequently classified.
例如,在对第一样本图像和第二样本图像进行人脸检测,得到第一样本图像中的第一人脸框,以及第二样本图像中的第二人脸框之后,通过对第一人脸框进行第一预设比例阈值的外扩(例如,向上、向左、向右外扩0.2倍,向下外扩0.4倍),得到第三人脸框,以及通过对第二人脸框进行第二预设比例阈值的外扩(例如,向上、向左、向右外扩0.3倍,向下外扩0.5倍),得到第四人脸框。其中,第一预设比例阈值和第二预设比例阈值的具体取值可以根据实际情况确定,本公开对此不做具体限定。For example, after performing face detection on the first sample image and the second sample image to obtain the first face frame in the first sample image and the second face frame in the second sample image, The one-person face frame is expanded by the first preset ratio threshold (for example, 0.2 times upwards, leftwards, and rightwards, and 0.4 times downwards) to obtain a third face frame, and the second The face frame is expanded outward by the second preset ratio threshold (for example, 0.3 times upward, leftward, and rightward outward expansion, and 0.5 times downward outward expansion) to obtain a fourth face frame. The specific values of the first preset ratio threshold and the second preset ratio threshold may be determined according to actual conditions, which are not specifically limited in the present disclosure.
通过对第一人脸框和第二人脸框进行外扩,外扩后的第三人脸框和第四人脸框包含更多人脸周围信息,使得更易于对第三人脸框内的第一人脸图像和第四人脸框内的第二人脸图像进行分类。例如,第二样本图像为照片对应的图像,通过对第二样本图像进行人脸检测得到第二人脸框,其中,第二人脸框中对应照片中的人脸部分。通过对第二人脸框进行外扩得到第四人脸框,使得第四人脸框中除了包括照片中的人脸部分,还包括照片的边界部分。因此,在对根据第四人脸框从第二样本图像中裁切得到的第二人脸图像进行分类时,由于第二人脸图像中包括照片的边界部分,很容易即可确定第二人脸图像对应的第一分类结果为2D非活体类别。By expanding the first face frame and the second face frame, the expanded third face frame and the fourth face frame contain more information around the face, making it easier to analyze the inside of the third face frame. The first face image and the second face image within the fourth face frame are classified. For example, the second sample image is an image corresponding to a photo, and a second face frame is obtained by performing face detection on the second sample image, wherein the second face frame corresponds to the face part in the photo. The fourth face frame is obtained by expanding the second face frame, so that the fourth face frame includes not only the face part in the photo, but also the border part of the photo. Therefore, when classifying the second face image cropped from the second sample image according to the fourth face frame, since the second face image includes the border portion of the photo, it is easy to determine the second person The first classification result corresponding to the face image is a 2D non-living class.
本公开实施例中,调整第一人脸框和第二人脸框的尺寸方式除了可以包括上述外扩方式以外,还可以包括收缩等方式,本公开对此不做具体限定。In the embodiment of the present disclosure, the method for adjusting the size of the first face frame and the second face frame may include, in addition to the above-mentioned outward expansion method, a shrinking method, which is not specifically limited in the present disclosure.
在一示例中,根据第三人脸框对第一样本图像进行裁切得到第一人脸图像,以及根据第四人脸框对第二样本图像进行裁切得到第二人脸图像之后,还可以将第一人脸图像和第二人脸图像分别调整为第一目标尺寸(例如,长宽为224像素)的图像,以使得第一活体识别网络对相同尺寸的第一人脸图 像和第二图像进行分类,以提高分类准确度。其中,第一目标尺寸的具体取值可以根据实际情况确定,本公开对此不做具体限定。In an example, the first sample image is obtained by cropping the first sample image according to the third face frame, and after the second sample image is obtained by cropping the second sample image according to the fourth face frame, It is also possible to adjust the first face image and the second face image to images with a first target size (for example, a length and a width of 224 pixels), so that the first living body recognition network can recognize the first face image and the second face image of the same size. The second image is classified to improve classification accuracy. The specific value of the first target size may be determined according to actual conditions, which is not specifically limited in the present disclosure.
在一种可能的实现方式中,对目标图像进行第二活体识别,得到第二识别结果,包括:通过第二活体识别网络对目标图像进行第二活体识别,得到第二识别结果,第二活体识别网络是基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的。In a possible implementation manner, performing a second living body recognition on the target image to obtain a second recognition result includes: performing a second living body recognition on the target image through a second living body recognition network to obtain a second recognition result, the second living body The recognition network is trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的第二活体识别网络,可以提高对3D非活体的识别精度,从而使得通过第二活体识别网络对待识别对象对应的目标图像进行第二活体识别之后,可以得到识别精度较高的第二识别结果。The second living body recognition network trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body can improve the recognition accuracy of the 3D non-living body, so that the second living body After the second living body recognition is performed on the target image, a second recognition result with higher recognition accuracy can be obtained.
为了对活体和3D非活体(例如,面具、头部模型等)进行识别,再对待识别对象对应的目标图像进行第二活体识别之前,需要基于活体对应的第三样本图像和3D非活体对应的第四样本图像,预先训练得到第二活体识别网络。第二活体识别网络的作用是对输入网络的图像进行识别,判断其是活体对应的图像,还是3D非活体对应的图像。In order to recognize living bodies and 3D non-living bodies (for example, masks, head models, etc.), before performing the second living body recognition on the target image corresponding to the object to be identified, it is necessary to base on the third sample image corresponding to the living body and the 3D non-living body corresponding to The fourth sample image is pre-trained to obtain the second living body recognition network. The function of the second living body recognition network is to identify the image input to the network, and determine whether it is an image corresponding to a living body or an image corresponding to a 3D non-living body.
下面对基于活体对应的第三样本图像和3D非活体对应的第四样本图像,训练得到第二活体识别网络的过程进行详细说明。The following describes the process of obtaining the second living body recognition network by training based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
在一种可能的实现方式中,第三样本图像中包括第二标签,第二标签用于指示第三样本图像为活体对应的图像;在通过第二活体识别网络对目标图像进行第二活体识别之前,该方法还包括:通过第二初始网络对第三样本图像和第四样本图像进行分类,得到第二分类结果;根据第三样本图像中包括的第二标签以及第二分类结果,确定第二初始网络对应的第二分类损失;根据第二分类损失,训练第二初始网络,以得到训练后的第二活体识别网络。In a possible implementation manner, the third sample image includes a second label, and the second label is used to indicate that the third sample image is an image corresponding to a living body; the second living body recognition is performed on the target image through the second living body recognition network. Before, the method further includes: classifying the third sample image and the fourth sample image through the second initial network to obtain a second classification result; and determining the first classification result according to the second label included in the third sample image and the second classification result The second classification loss corresponding to the second initial network; according to the second classification loss, the second initial network is trained to obtain the trained second living body recognition network.
利用活体对应的第三样本图像以及3D非活体对应的第四样本图像对第二初始网络进行训练,由于第三样本图像中包括第二标签,因此,可以根据第二标签和第二分类结果,确定第二初始网络的分类准确性,即确定第二初始网络对应的第二分类损失,以使得根据第二分类损失可以对第二初始网络进行有效训练,以得到训练后的对3D非活体的识别精度较高的第二活体识别网络。The second initial network is trained by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body. Since the third sample image includes the second label, according to the second label and the second classification result, Determine the classification accuracy of the second initial network, that is, determine the second classification loss corresponding to the second initial network, so that the second initial network can be effectively trained according to the second classification loss, so as to obtain the trained 3D non-living body. A second living body recognition network with higher recognition accuracy.
在一种可能的实现方式中,在通过第二初始网络对第三样本图像和第四样本图像进行分类之前,该方法还包括:利用公共图像数据集对第二原始网络进行训练,以得到训练后的第二初始网络。In a possible implementation manner, before classifying the third sample image and the fourth sample image through the second initial network, the method further includes: using the public image data set to train the second original network to obtain the training After the second initial network.
其中,公共图像数据集可以是ImageNet,ImageNet是一个约包含1500万张图像的图像分类数据集,共包含1000多个类别,利用ImageNet对第二原始网络进行训练,可以得到训练后的具备分类功能的第二初始网络,进而可以利用活体对应的第三样本图像以及3D非活体对应的第四样本图像,对第二初始网络进行训练,以得到训练后的第二活体识别网络。公共图像数据集除了可以是ImageNet之外,还可以是其它用于进行分类训练的公共图像数据集,本公开对此不做具体限定。Among them, the public image data set can be ImageNet. ImageNet is an image classification data set containing about 15 million images, including more than 1,000 categories. Using ImageNet to train the second original network, you can get the classification function after training. The second initial network can be used to train the second initial network by using the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body to obtain the trained second living body recognition network. In addition to ImageNet, the public image dataset may also be other public image datasets used for classification training, which is not specifically limited in the present disclosure.
在利用第二初始网络训练得到第二活体识别网络的过程中,首先,基于活体对应的包括第二标签的第三样本图像,和3D非活体对应的不包括第二标签的第四样本图像,构建第二训练样本集,将第二训练样本集输入第二初始网络。In the process of obtaining the second living body recognition network using the second initial network training, first, based on the third sample image corresponding to the living body including the second label, and the fourth sample image corresponding to the 3D non-living body and not including the second label, A second training sample set is constructed, and the second training sample set is input into the second initial network.
第二初始网络识别第三样本图像是活体对应的图像还是3D非活体对应的图像,以及根据识别结果,对第三样本图像进行分类,得到第三样本图像对应的第二分类结果。例如,在对第三样本图像的识别结果为第三样本图像是活体对应的图像时,第三样本图像对应的第二分类结果为活体类别;在对 第三样本图像的识别结果为第三样本图像是3D非活体对应的图像时,第三样本图像对应的第二分类结果为3D非活体类别。The second initial network identifies whether the third sample image is an image corresponding to a living body or an image corresponding to a 3D non-living body, and classifies the third sample image according to the recognition result to obtain a second classification result corresponding to the third sample image. For example, when the recognition result of the third sample image is that the third sample image is an image corresponding to a living body, the second classification result corresponding to the third sample image is a living body category; when the recognition result of the third sample image is the third sample When the image is an image corresponding to a 3D non-living body, the second classification result corresponding to the third sample image is a 3D non-living body category.
此外,第二初始网络识别第四样本图像是活体对应的图像还是3D非活体对应的图像,以及根据识别结果,对第四样本图像进行分类,得到第四样本图像对应的第二分类结果。例如,在对第四样本图像的识别结果为第四样本图像是活体对应的图像时,第四样本图像对应的第二分类结果为活体类别;在对第四样本图像的识别结果为第四样本图像是3D非活体对应的图像时,第四样本图像对应的第二分类结果为3D非活体类别。In addition, the second initial network identifies whether the fourth sample image is an image corresponding to a living body or an image corresponding to a 3D non-living body, and classifies the fourth sample image according to the recognition result to obtain a second classification result corresponding to the fourth sample image. For example, when the recognition result of the fourth sample image is that the fourth sample image is an image corresponding to a living body, the second classification result corresponding to the fourth sample image is a living body category; when the recognition result of the fourth sample image is the fourth sample When the image is an image corresponding to a 3D non-living body, the second classification result corresponding to the fourth sample image is a 3D non-living body category.
在得到第二分类结果之后,由于第三样本图像中包括用于指示第三样本图像为活体对应的图像的第二标签,因此,根据第三样本图像中包括的第二标签以及第二分类结果,可以确定第二初始网络对应的第二分类损失。例如,在包括第二标签的第三样本图像对应的第二分类结果为活体类别时,则第二初始网络对第三样本图像分类成功;在包括第二标签的第三样本图像对应的第二分类结果为3D非活体类别时,则第二初始网络对第三样本图像分类失败;或者,在不包括第二标签的第四样本图像对应的第二分类结果为3D非活体类别时,则第二初始网络对第四样本图像分类成功;在不包括第二标签的第四样本图像对应的第二分类结果为活体类别时,则第二初始网络对第四样本图像分类失败。根据第二初始网络对第三样本图像和/或第四样本图像的分类成功率,也即第二初始网络的识别准确率,可以确定第二初始网络对应的第二分类损失,进而根据第二分类损失,训练第二初始网络,以得到训练后的第二活体识别网络。After the second classification result is obtained, since the third sample image includes a second label for indicating that the third sample image is an image corresponding to a living body, according to the second label included in the third sample image and the second classification result , the second classification loss corresponding to the second initial network can be determined. For example, when the second classification result corresponding to the third sample image including the second label is a living body category, the second initial network successfully classifies the third sample image; When the classification result is a 3D non-living category, the second initial network fails to classify the third sample image; or, when the second classification result corresponding to the fourth sample image that does not include the second label is a 3D non-living category, then the third sample image fails to be classified. 2. The initial network successfully classifies the fourth sample image; when the second classification result corresponding to the fourth sample image that does not include the second label is a living body category, the second initial network fails to classify the fourth sample image. According to the classification success rate of the third sample image and/or the fourth sample image by the second initial network, that is, the recognition accuracy of the second initial network, the second classification loss corresponding to the second initial network can be determined, and then according to the second initial network The classification loss is used to train the second initial network to obtain the trained second living body recognition network.
在一种可能的实现方式中,根据第二分类损失,训练第二初始网络,以得到训练后的第二活体识别网络,包括:根据第二分类损失,构建第二损失函数;根据第二损失函数和第二识别阈值,训练第二初始网络,以得到训练后的第二活体识别网络。In a possible implementation manner, training the second initial network according to the second classification loss to obtain the trained second living body recognition network includes: constructing a second loss function according to the second classification loss; according to the second loss function and the second recognition threshold, and train the second initial network to obtain the trained second living body recognition network.
例如,根据第二损失函数,调整第二初始网络对应的网络参数,得到中间网络,并采用与上述训练第二初始网络相同的网络训练方法对中间网络进行迭代训练,直至网络对应的识别准确率大于第二识别阈值,确定得到符合条件的训练后的第二活体识别网络。For example, according to the second loss function, the network parameters corresponding to the second initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the second initial network is used to iteratively train the intermediate network until the recognition accuracy rate corresponding to the network is reached. If the value is greater than the second recognition threshold, it is determined that a qualified trained second living body recognition network is obtained.
其中,第二损失函数可以为交叉熵损失函数,还可以为其它损失函数,第二识别阈值的具体取值可以根据实际情况确定,本公开对此不做具体限定。The second loss function may be a cross-entropy loss function or other loss functions, and the specific value of the second identification threshold may be determined according to the actual situation, which is not specifically limited in the present disclosure.
第一识别阈值和第二识别阈值不同。相比于采用相同的识别阈值对第一初始网络和第二初始网络进行训练,采用不同的识别阈值对第一初始网络和第二初始网络进行训练,使得可以确保训练后的第一活体识别网络和训练后的第二活体识别网络均具有较高的识别精度。The first identification threshold and the second identification threshold are different. Compared with using the same recognition threshold to train the first initial network and the second initial network, different recognition thresholds are used to train the first initial network and the second initial network, so that the trained first living body recognition network can be guaranteed. and the trained second living body recognition network both have high recognition accuracy.
在一种可能的实现方式中,根据第二分类损失,对第二初始网络进行训练,以得到训练后的第二活体识别网络,包括:根据第二分类损失,构建第二损失函数;根据第二损失函数和第二迭代次数,训练第二初始网络,以得到训练后的第二活体识别网络。In a possible implementation manner, training the second initial network according to the second classification loss to obtain the trained second living body recognition network includes: constructing a second loss function according to the second classification loss; The second loss function and the second number of iterations are used to train the second initial network to obtain the trained second living body recognition network.
例如,根据第二损失函数,调整第二初始网络对应的网络参数,得到中间网络,并采用与上述训练第二初始网络相同的网络训练方法对中间网络进行迭代训练,直至迭代训练的次数达到第二迭代次数,确定得到符合条件的训练后的第二活体识别网络。For example, according to the second loss function, the network parameters corresponding to the second initial network are adjusted to obtain an intermediate network, and the same network training method as the above-mentioned training of the second initial network is used to iteratively train the intermediate network until the number of iterative training reaches the third The number of iterations is two, and it is determined that a qualified second living body recognition network after training is obtained.
第一迭代次数和第二迭代次数不同。相比于采用相同的迭代次数对第一初始网络和第二初始网络进行训练,采用不同的迭代次数对第一初始网络和第二初始网络进行训练,使得可以确保训练后的第 一活体识别网络和训练后的第二活体识别网络均具有较高的识别精度。The number of first iterations and the number of second iterations are different. Compared with using the same number of iterations to train the first initial network and the second initial network, different iterations are used to train the first initial network and the second initial network, so that the trained first living body recognition network can be guaranteed. and the trained second living body recognition network both have high recognition accuracy.
在一种可能的实现方式中,通过第二初始网络对第三样本图像和第四样本图像进行分类,得到第二分类结果,包括:对第三样本图像进行人脸检测,得到第五人脸框,以及对第四样本图像进行人脸检测,得到第六人脸框;根据第五人脸框对第三样本图像进行裁切,得到第三人脸图像,以及根据第六人脸框对第四样本图像进行裁切,得到第四人脸图像;通过第二初始网络对第三人脸图像和第四人脸图像进行分类,得到第二分类结果。In a possible implementation manner, classifying the third sample image and the fourth sample image through the second initial network to obtain the second classification result includes: performing face detection on the third sample image to obtain the fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame; cropping the third sample image according to the fifth face frame to obtain a third face image, and according to the sixth face frame The fourth sample image is cut to obtain a fourth face image; the third face image and the fourth face image are classified through the second initial network to obtain a second classification result.
分别对第三样本图像和第四样本图像进行人脸检测,得到第三样本图像中的第五人脸框,以及第四样本图像中的第六人脸框,使得可以根据第五人脸框在第三样本图像中裁切得到第三人脸图像,以及根据第六人脸框在第四样本图像裁切得到第四人脸图像,进而通过第二初始网络对第三人脸图像和第四人脸图像进行分类,得到第二分类结果。相比于对第三样本图像和第四样本图像整体进行分类,对裁切得到的第三人脸图像和第四人脸图像进行分类,可以有效提高分类效率。Perform face detection on the third sample image and the fourth sample image respectively to obtain the fifth face frame in the third sample image and the sixth face frame in the fourth sample image, so that the fifth face frame can be A third face image is obtained by cropping the third sample image, and a fourth face image is obtained by cropping the fourth sample image according to the sixth face frame, and then the third face image and the third face image are obtained through the second initial network. Four face images are classified to obtain a second classification result. Compared with classifying the third sample image and the fourth sample image as a whole, classifying the cropped third face image and the fourth face image can effectively improve the classification efficiency.
在一种可能的实现方式中,根据第五人脸框对第三样本图像进行裁切,得到第三人脸图像,以及根据第六人脸框对第四样本图像进行裁切,得到第四人脸图像,包括:调整第五人脸框的尺寸,得到第七人脸框,以及调整第六人脸框的尺寸,得到第八人脸框;根据第七人脸框对第三样本图像进行裁切,得到第三人脸图像,以及根据第八人脸框对第四样本图像进行裁切,得到第四人脸图像。In a possible implementation manner, the third sample image is cut according to the fifth face frame to obtain the third face image, and the fourth sample image is cut according to the sixth face frame to obtain the fourth A face image, including: adjusting the size of the fifth face frame to obtain the seventh face frame, and adjusting the size of the sixth face frame to obtain the eighth face frame; and adjusting the third sample image according to the seventh face frame Cutting is performed to obtain a third face image, and the fourth sample image is cut according to the eighth face frame to obtain a fourth face image.
通过调整第五人脸框和第六人脸框的尺寸,使得根据调整后的第七人脸框和第八人脸框,可以从第三样本图像和第四样本图像中,裁切得到具备更多有效信息的第三人脸图像和第四人脸图像,从而使得后续对裁切得到的第三人脸图像和第四人脸图像进行分类时,可以有效提高分类效率。By adjusting the size of the fifth face frame and the sixth face frame, according to the adjusted seventh face frame and the eighth face frame, the third sample image and the fourth sample image can be cropped to obtain The third face image and the fourth face image with more effective information can effectively improve the classification efficiency when the third face image and the fourth face image obtained by cutting are subsequently classified.
例如,在对第三样本图像和第四样本图像进行人脸检测,得到第三样本图像中的第五人脸框,以及第四样本图像中的第六人脸框之后,通过对第五人脸框进行第三预设比例阈值的外扩(例如,向上、向左、向右外扩0.2倍,向下外扩0.3倍),得到第七人脸框,以及通过对第六人脸框进行第四预设比例阈值的外扩(例如,向上、向左、向右外扩0.3倍,向下外扩0.3倍),得到第八人脸框。其中,第三预设比例阈值和第四预设比例阈值的具体取值可以根据实际情况确定,本公开对此不做具体限定。For example, after performing face detection on the third sample image and the fourth sample image to obtain the fifth face frame in the third sample image and the sixth face frame in the fourth sample image, The face frame is expanded by a third preset ratio threshold (for example, 0.2 times upward, leftward and rightward, and 0.3 times downward) to obtain a seventh face frame, and the sixth face frame is Carry out the outward expansion of the fourth preset ratio threshold (for example, 0.3 times upward, leftward, and rightward outward expansion, and 0.3 times downward outward expansion) to obtain the eighth face frame. The specific values of the third preset ratio threshold and the fourth preset ratio threshold may be determined according to actual conditions, which are not specifically limited in the present disclosure.
通过对第五人脸框和第六人脸框进行外扩,外扩后的第七人脸框和第八人脸框包含更多人脸周围信息,使得更易于对第七人脸框内的第三人脸图像和第八人脸框内的第四人脸图像进行分类。例如,第四样本图像为面具对应的图像,通过对第四样本图像进行人脸检测得到第六人脸框,其中,第六人脸框中对应面具中的人脸部分。通过对第六人脸框进行外扩得到第八人脸框,使得第八人脸框中除了包括面具中的人脸部分,还包括面具的边界部分。因此,在对根据第八人脸框从第四样本图像中裁切得到的第四人脸图像进行分类时,由于第四人脸图像中包括面具的边界部分,很容易即可确定第四人脸图像对应的第二分类结果为3D非活体类别。By expanding the fifth face frame and the sixth face frame, the expanded seventh face frame and the eighth face frame contain more information around the face, which makes it easier to compare the inside of the seventh face frame. The third face image and the fourth face image within the eighth face frame are classified. For example, the fourth sample image is an image corresponding to a mask, and a sixth face frame is obtained by performing face detection on the fourth sample image, wherein the sixth face frame corresponds to the face part in the mask. The eighth face frame is obtained by externally expanding the sixth face frame, so that the eighth face frame includes not only the face part in the mask, but also the boundary part of the mask. Therefore, when classifying the fourth face image cropped from the fourth sample image according to the eighth face frame, since the fourth face image includes the boundary part of the mask, it is easy to determine the fourth person The second classification result corresponding to the face image is the 3D non-living category.
本公开实施例中,调整第五人脸框和第六人脸框的尺寸方式除了可以包括上述外扩方式以外,还可以包括收缩等方式,本公开对此不做具体限定。In this embodiment of the present disclosure, the method for adjusting the size of the fifth face frame and the sixth face frame may include, in addition to the above-mentioned outward expansion, methods such as shrinkage, which are not specifically limited in this disclosure.
在一示例中,根据第七人脸框对第三样本图像进行裁切得到第三人脸图像,以及根据第八人脸框对第四样本图像进行裁切得到第四人脸图像之后,还可以将第三人脸图像和第四人脸图像分别调整为第二目标尺寸(例如,长宽为224像素)的图像,以使得第二活体识别网络对相同尺寸的第三人脸图像和第四图像进行分类,以提高分类准确度。其中,第二目标尺寸的具体取值可以根据实际情况确定, 本公开对此不做具体限定。In an example, the third sample image is cut according to the seventh face frame to obtain the third face image, and after the fourth sample image is cut according to the eighth face frame to obtain the fourth face image, the The third face image and the fourth face image can be adjusted to images of the second target size (for example, the length and width are 224 pixels), so that the second living body recognition network can be used for the third face image and the third face image of the same size. Four images are classified to improve classification accuracy. The specific value of the second target size may be determined according to the actual situation, which is not specifically limited in the present disclosure.
在训练得到第一活体识别网络和第二活体识别网络之后,可以对待识别对象进行二阶段的活体识别。After the first living body recognition network and the second living body recognition network are obtained by training, two-stage living body recognition can be performed on the object to be recognized.
图3示出根据本公开实施例的一种活体识别网络的示意图。如图3所示:FIG. 3 shows a schematic diagram of a living body recognition network according to an embodiment of the present disclosure. As shown in Figure 3:
第一步,将待识别对象对应的目标图像输入第一活体识别网络,根据第一活体识别网络,识别待识别对象是活体还是2D非活体。The first step is to input the target image corresponding to the object to be recognized into the first living body recognition network, and according to the first living body recognition network, identify whether the object to be recognized is a living body or a 2D non-living body.
在第一活体识别网络输出的第一识别结果指示待识别对象是2D非活体时,结束活体识别流程,输出第一识别结果;在第一活体识别网络输出的第一识别结果指示待识别对象是活体时,执行第二步。When the first recognition result output by the first living body recognition network indicates that the object to be recognized is a 2D non-living body, the process of living body recognition is ended, and the first recognition result is output; the first recognition result output by the first living body recognition network indicates that the object to be recognized is When alive, perform the second step.
第二步,将待识别对象对应的目标图像输入第二活体识别网络,根据第二活体识别网络,识别待识别对象是活体还是3D非活体。In the second step, the target image corresponding to the object to be recognized is input into the second living body recognition network, and according to the second living body recognition network, whether the object to be recognized is a living body or a 3D non-living body is identified.
第三步,输出第二网络识别网络的第二识别结果。The third step is to output the second identification result of the second network identification network.
在本公开实施例中,对识别待识别对象对应的目标图像进行第一阶段的第一活体识别,识别待识别对象是活体还是2D非活体,在第一活体识别得到的第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二阶段的第二活体识别,识别待识别对象是活体还是3D非活体,可以得到识别准确的第二识别结果。采用本公开提供的技术方案,通过两阶段的活体识别,可以有效提高对活体的识别精度。In the embodiment of the present disclosure, a first-stage first living body recognition is performed on the target image corresponding to the recognized object to be recognized, to identify whether the to-be-identified object is a living body or a 2D non-living body, and the first recognition result obtained from the first living body recognition indicates that the to-be-identified object is to be recognized. When the recognized object is a living body, a second-stage second living body recognition is performed on the target image to identify whether the object to be recognized is a living body or a 3D non-living body, and an accurate second recognition result can be obtained. By adopting the technical solution provided by the present disclosure, the recognition accuracy of the living body can be effectively improved through the two-stage living body recognition.
图4示出根据公开实施例的一种门禁设备控制方法的流程图。该方法中的门禁设备可以包括门锁、闸机,以及其它需要控制通行的终端设备,本公开不做具体限定。如图4所示,该方法包括:FIG. 4 shows a flowchart of a method for controlling an access control device according to a disclosed embodiment. The access control device in the method may include door locks, gates, and other terminal devices that need to control access, which is not specifically limited in the present disclosure. As shown in Figure 4, the method includes:
在步骤S41中,采集需要通过门禁设备的待识别对象对应的目标图像。In step S41, a target image corresponding to an object to be identified that needs to pass through the access control device is collected.
在步骤S42中,对目标图像进行第一活体识别,得到第一识别结果,第一活体识别用于识别待识别对象是活体还是2D非活体。In step S42, a first living body recognition is performed on the target image to obtain a first recognition result, and the first living body recognition is used to identify whether the object to be recognized is a living body or a 2D non-living body.
在步骤S43中,在第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二活体识别,得到第二识别结果,第二活体识别用于识别待识别对象是活体还是3D非活体。In step S43, when the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, and the second living body recognition is used to identify whether the object to be recognized is a living body or a 3D non-living body living body.
在步骤S44中,在第二活体识别结果指示待识别对象为活体的情况下,控制门禁设备开启。In step S44, when the second living body identification result indicates that the object to be identified is a living body, the access control device is controlled to be turned on.
由于上述两阶段的活体识别方法既可以对2D非活体(例如,照片、图像)进行有效识别,也可以对3D非活体进行有效识别,因此,对需要通过门禁设备的待识别对象进行上述两阶段的活体识别,以及仅在第一活体识别结果以及第二活体识别结果均指示待识别对象为活体的情况下控制门禁设备开启,从而可以有效提高门禁设备的安全性。Since the above-mentioned two-stage living body recognition method can effectively identify both 2D non-living bodies (for example, photos, images) and 3D non-living bodies, the above two-stage method is performed on the objects to be identified that need to pass through the access control equipment. and control the access control device to open only when the first and second living body recognition results indicate that the object to be identified is a living body, thereby effectively improving the security of the access control device.
在一种可能的实现方式中,采集需要通过门禁设备的待识别对象对应的目标图像,包括:利用双红外摄像头模组,采集待识别对象对应的目标图像。In a possible implementation manner, collecting the target image corresponding to the object to be identified that needs to pass through the access control device includes: using a dual infrared camera module to collect the target image corresponding to the object to be identified.
由于门禁设备的应用场景可能包括暗光场景,例如,夜间的闸机,或者安装在楼道、走廊等暗光场景的门锁等,为了采集到需要通过门禁设备的待识别对象的清晰的目标图像,可以采用双红外摄像头模组对需要通过门禁设备的待识别对象进行图像采集,得到待识别对象的目标图像。例如,将双红外摄像头模组与门禁设备集成设置在一起,或在门禁设备附近单独设置双红外摄像头模组,以实现利用双红外摄像头模组对需要通过门禁设备的待识别对象进行图像采集。Since the application scenarios of access control equipment may include dark light scenes, such as gates at night, or door locks installed in dark light scenes such as corridors and corridors, in order to collect clear target images of objects to be identified that need to pass through the access control equipment , the dual-infrared camera module can be used to collect the image of the object to be identified that needs to pass through the access control device, and the target image of the object to be identified can be obtained. For example, the dual-infrared camera module is integrated with the access control device, or the dual-infrared camera module is separately set near the access control device, so that the dual-infrared camera module can be used to capture images of objects to be identified that need to pass through the access control device.
利用双红外摄像头模组采集得到需要通过门禁设备的待识别对象对应的清晰的目标图像,进而通 过上述两阶段的活体识别方法,对待识别对象对应的目标图像进行活体识别,使得可以提高门禁设备在暗光场景下的活体识别准确度,从而可以有效提高门禁设备的安全性。The clear target image corresponding to the object to be recognized that needs to pass through the access control device is collected by using the dual infrared camera module, and then the target image corresponding to the object to be recognized is recognized by the above-mentioned two-stage living body recognition method, so that the access control equipment can be improved. The accuracy of living body recognition in dark light scenes can effectively improve the security of access control equipment.
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例,限于篇幅,本公开不再赘述。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。It can be understood that the above-mentioned method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle and logic. Those skilled in the art can understand that, in the above method of the specific embodiment, the specific execution order of each step should be determined by its function and possible internal logic.
此外,本公开还提供了活体识别/门禁设备控制装置、电子设备、计算机可读存储介质、程序,上述均可用来实现本公开提供的任一种活体识别/门禁设备控制方法,相应技术方案和描述和参见方法部分的相应记载,不再赘述。In addition, the present disclosure also provides living body recognition/access control equipment control devices, electronic equipment, computer-readable storage media, and programs, all of which can be used to implement any of the living body recognition/access control equipment control methods provided by the present disclosure, and the corresponding technical solutions and The description and reference to the corresponding records in the method section will not be repeated.
图5示出根据本公开实施例的一种活体识别装置的框图。如图5所示,活体识别装置50包括:FIG. 5 shows a block diagram of a living body recognition apparatus according to an embodiment of the present disclosure. As shown in FIG. 5, the living body identification device 50 includes:
第一识别模块51,用于对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,第一活体识别用于识别待识别对象是活体还是2D非活体;The first identification module 51 is used to perform first living body identification on the target image corresponding to the object to be identified, to obtain a first identification result, and the first living body identification is used to identify whether the object to be identified is a living body or a 2D non-living body;
第二识别模块52,用于在第一识别结果指示待识别对象为活体的情况下,对目标图像进行第二活体识别,得到第二识别结果,第二活体识别用于识别待识别对象是活体还是3D非活体。The second recognition module 52 is configured to perform second in vivo recognition on the target image when the first recognition result indicates that the object to be recognized is a living body to obtain a second recognition result, and the second in vivo recognition is used to recognize that the object to be recognized is a living body Still 3D non-living.
在一种可能的实现方式中,第一识别模块51,具体用于:In a possible implementation manner, the first identification module 51 is specifically used for:
通过第一活体识别网络对目标图像进行第一活体识别,得到第一识别结果,第一活体识别网络是基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的。A first living body recognition is performed on the target image through a first living body recognition network to obtain a first recognition result. The first living body recognition network is obtained by training based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body.
在一种可能的实现方式中,第一样本图像中包括第一标签,所述第一标签用于指示第一样本图像为活体对应的图像;In a possible implementation manner, the first sample image includes a first label, where the first label is used to indicate that the first sample image is an image corresponding to a living body;
活体识别装置50,还包括:The living body identification device 50 further includes:
第一分类模块,用于在通过第一活体识别网络对目标图像进行第一活体识别之前,通过第一初始网络对第一样本图像和第二样本图像进行分类,得到第一分类结果;a first classification module, configured to classify the first sample image and the second sample image through the first initial network before performing the first living body recognition on the target image through the first living body recognition network to obtain a first classification result;
第一确定模块,用于根据第一样本图像中包括的第一标签以及第一分类结果,确定第一初始网络对应的第一分类损失;a first determination module, configured to determine the first classification loss corresponding to the first initial network according to the first label included in the first sample image and the first classification result;
第一训练模块,用于根据第一分类损失,训练第一初始网络,以得到训练后的第一活体识别网络。The first training module is used for training the first initial network according to the first classification loss, so as to obtain the trained first living body recognition network.
在一种可能的实现方式中,第一分类模块,包括:In a possible implementation manner, the first classification module includes:
第一检测子模块,用于对第一样本图像进行人脸检测,得到第一人脸框,以及对第二样本图像进行人脸检测,得到第二人脸框;a first detection submodule, configured to perform face detection on the first sample image to obtain a first face frame, and perform face detection on the second sample image to obtain a second face frame;
第一裁切子模块,用于根据第一人脸框对第一样本图像进行裁切,得到第一人脸图像,以及根据第二人脸框对第二样本图像进行裁切,得到第二人脸图像;The first cropping submodule is used for cropping the first sample image according to the first face frame to obtain the first face image, and for cropping the second sample image according to the second face frame to obtain the second face image;
第一分类子模块,用于通过第一初始网络对第一人脸图像和第二人脸图像进行分类,得到第一分类结果。The first classification submodule is used for classifying the first face image and the second face image through the first initial network to obtain a first classification result.
在一种可能的实现方式中,第一裁切子模块,包括:In a possible implementation manner, the first cutting sub-module includes:
第一尺寸调整单元,用于调整第一人脸框的尺寸,得到第三人脸框,以及调整第二人脸框的尺寸,得到第四人脸框;a first size adjustment unit for adjusting the size of the first face frame to obtain a third face frame, and for adjusting the size of the second face frame to obtain a fourth face frame;
第一裁切单元,用于根据第三人脸框对第一样本图像进行裁切,得到第一人脸图像,以及根据第四人脸框对第二样本图像进行裁切,得到第二人脸图像。The first cropping unit is used for cropping the first sample image according to the third face frame to obtain the first face image, and for cropping the second sample image according to the fourth face frame to obtain the second face image.
在一种可能的实现方式中,第二识别模块52,具体用于:In a possible implementation manner, the second identification module 52 is specifically used for:
通过第二活体识别网络对目标图像进行第二活体识别,得到第二识别结果,第二活体识别网络是基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的。The second living body recognition network is used to perform second living body recognition on the target image to obtain a second recognition result. The second living body recognition network is trained based on the third sample image corresponding to the living body and the fourth sample image corresponding to the 3D non-living body.
在一种可能的实现方式中,第三样本图像中包括第二标签,第二标签用于指示第三样本图像为活体对应的图像;In a possible implementation manner, the third sample image includes a second label, and the second label is used to indicate that the third sample image is an image corresponding to a living body;
活体识别装置50,还包括:The living body identification device 50 further includes:
第二分类模块,用于在通过第二活体识别网络对目标图像进行第二活体识别之前,通过第二初始网络对第三样本图像和第四样本图像进行分类,得到第二分类结果;The second classification module is configured to classify the third sample image and the fourth sample image through the second initial network before performing the second living body recognition on the target image through the second living body recognition network to obtain a second classification result;
第二确定模块,用于根据第三样本图像中包括的第二标签以及第二分类结果,确定第二初始网络对应的第二分类损失;a second determination module, configured to determine the second classification loss corresponding to the second initial network according to the second label included in the third sample image and the second classification result;
第二训练模块,用于根据第二分类损失,训练第二初始网络,以得到训练后的第二活体识别网络。The second training module is used for training the second initial network according to the second classification loss, so as to obtain the trained second living body recognition network.
在一种可能的实现方式中,第二分类模块,包括:In a possible implementation manner, the second classification module includes:
第二检测子模块,用于对第三样本图像进行人脸检测,得到第五人脸框,以及对第四样本图像进行人脸检测,得到第六人脸框;The second detection submodule is used for performing face detection on the third sample image to obtain a fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame;
第二裁切子模块,用于根据第五人脸框对第三样本图像进行裁切,得到第三人脸图像,以及根据第六人脸框对第四样本图像进行裁切,得到第四人脸图像;The second cropping submodule is used for cropping the third sample image according to the fifth face frame to obtain the third face image, and for cropping the fourth sample image according to the sixth face frame to obtain the fourth person face image;
第二分类子模块,用于通过第二初始网络对第三人脸图像和第四人脸图像进行分类,得到第二分类结果。The second classification submodule is configured to classify the third face image and the fourth face image through the second initial network to obtain a second classification result.
在一种可能的实现方式中,第二裁切子模块,包括:In a possible implementation manner, the second cutting sub-module includes:
第二尺寸调整单元,用于调整第五人脸框的尺寸,得到第七人脸框,以及调整第六人脸框的尺寸,得到第八人脸框;The second size adjustment unit is used to adjust the size of the fifth face frame to obtain the seventh face frame, and adjust the size of the sixth face frame to obtain the eighth face frame;
第二裁切单元,用于根据第七人脸框对第三样本图像进行裁切,得到第三人脸图像,以及根据第八人脸框对第四样本图像进行裁切,得到第四人脸图像。The second cropping unit is used for cropping the third sample image according to the seventh face frame to obtain the third face image, and for cropping the fourth sample image according to the eighth face frame to obtain the fourth person face image.
图6示出根据本公开实施例的一种门禁设备控制装置的框图。如图6所示,门禁设备控制装置60包括:FIG. 6 shows a block diagram of an access control device control apparatus according to an embodiment of the present disclosure. As shown in Figure 6, the access control device control device 60 includes:
图像采集模块61,用于采集需要通过门禁设备的待识别对象对应的目标图像;The image acquisition module 61 is used to collect the target image corresponding to the object to be identified that needs to pass through the access control device;
活体识别模块62,用于采用上述活体识别方法,对目标图像进行活体识别,得到活体识别结果;The living body recognition module 62 is configured to use the above-mentioned living body recognition method to perform living body recognition on the target image to obtain a living body recognition result;
控制模块63,用于在活体识别结果指示待识别对象为活体的情况下,控制门禁设备开启。The control module 63 is configured to control the access control device to open when the living body identification result indicates that the object to be identified is a living body.
在一种可能的实现方式中,图像采集模块61,具体用于:In a possible implementation manner, the image acquisition module 61 is specifically used for:
利用双红外摄像头模组,采集待识别对象对应的目标图像。Using the dual infrared camera module, the target image corresponding to the object to be recognized is collected.
在一些实施例中,本公开实施例提供的装置具有的功能或包含的模块可以用于执行上文方法实施例描述的方法,其具体实现可以参照上文方法实施例的描述,为了简洁,这里不再赘述。In some embodiments, the functions or modules included in the apparatuses provided in the embodiments of the present disclosure may be used to execute the methods described in the above method embodiments. For specific implementation, reference may be made to the descriptions of the above method embodiments. For brevity, here No longer.
本公开实施例还提出一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述方法。计算机可读存储介质可以是非易失性计算机可读存储介质。Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented. The computer-readable storage medium may be a non-volatile computer-readable storage medium.
本公开实施例还提出一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为调用所述存储器存储的指令,以执行上述活体识别方法,或执行上述门禁设备控 制方法。An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to invoke the instructions stored in the memory to execute the above-mentioned method for living body identification , or execute the above access control device control method.
本公开实施例还提供了一种计算机程序产品,包括计算机可读代码,当计算机可读代码在设备上运行时,设备中的处理器执行用于实现如上任一实施例提供的活体识别/门禁设备控制方法的指令。Embodiments of the present disclosure also provide a computer program product, including computer-readable codes. When the computer-readable codes are run on a device, a processor in the device executes the method for realizing the living body identification/access control provided by any of the above embodiments. Instructions for device control methods.
本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的活体识别/门禁设备控制方法的操作。Embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to perform the operations of the living body recognition/access control device control method provided by any of the foregoing embodiments.
电子设备可以被提供为终端、服务器或其它形态的设备。The electronic device may be provided as a terminal, server or other form of device.
图7示出根据本公开实施例的一种电子设备的框图。如图7所示,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。FIG. 7 shows a block diagram of an electronic device according to an embodiment of the present disclosure. As shown in FIG. 7, the electronic device 800 may be a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and other terminals.
参照图7,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(I/O)的接口812,传感器组件814,以及通信组件816。7, an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an input/output (I/O) interface 812, a sensor component 814 , and the communication component 816 .
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. Memory 804 may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。 Power supply assembly 806 provides power to various components of electronic device 800 . Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。 Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。 Audio component 810 is configured to output and/or input audio signals. For example, audio component 810 includes a microphone (MIC) that is configured to receive external audio signals when electronic device 800 is in operating modes, such as calling mode, recording mode, and voice recognition mode. The received audio signal may be further stored in memory 804 or transmitted via communication component 816 . In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800的一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如互补金属氧化物半导体(CMOS)或电荷耦合装置(CCD)图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。 Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 . For example, the sensor assembly 814 can detect the open/closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the electronic device 800 or the electronic device 800. The position of a component changes, the presence or absence of user contact with the electronic device 800, the orientation or acceleration/deceleration of the electronic device 800, and the temperature of the electronic device 800 changes. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 814 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如无线网络(WiFi),第二代移动通信技术(2G)或第三代移动通信技术(3G),或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。 Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as wireless network (WiFi), second generation mobile communication technology (2G) or third generation mobile communication technology (3G), or a combination thereof. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A programmed gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation is used to perform the above method.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium, such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
图8示出根据本公开实施例的一种电子设备的框图。如图8所示,电子设备1900可以被提供为一服务器。参照图8,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。FIG. 8 shows a block diagram of an electronic device according to an embodiment of the present disclosure. As shown in FIG. 8, the electronic device 1900 may be provided as a server. 8, electronic device 1900 includes processing component 1922, which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922, such as applications. An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Additionally, the processing component 1922 is configured to execute instructions to perform the above-described methods.
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出(I/O)接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如微软服务器操作系统(Windows Server TM),苹果公司推出的基于图形用户界面操作系统(Mac OS X TM),多用户多进程的计算机操作系统(Unix TM),自由和开放原代码的类Unix操作系统(Linux TM),开放原代码的类Unix操作系统(FreeBSD TM)或类似。 The electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input output (I/O) interface 1958 . The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as a Microsoft server operating system (Windows Server ), a graphical user interface based operating system (Mac OS X ) introduced by Apple, a multi-user multi-process computer operating system (Unix ), Free and Open Source Unix-like Operating System (Linux ), Open Source Unix-like Operating System (FreeBSD ) or the like.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质,其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。The present disclosure may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质可以是易失性存储介质,也可以是非易失性存储介质。计算机可读存储介质例如可以是(但 不限于)电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、静态随机存取存储器(SRAM)、便携式压缩盘只读存储器(CD-ROM)、数字多功能盘(DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。A computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device. The computer-readable storage medium may be a volatile storage medium or a non-volatile storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (non-exhaustive list) of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM) or flash memory), static random access memory (SRAM), portable compact disk read only memory (CD-ROM), digital versatile disk (DVD), memory sticks, floppy disks, mechanically coded devices, such as printers with instructions stored thereon Hole cards or raised structures in grooves, and any suitable combination of the above. Computer-readable storage media, as used herein, are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。The computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(FPGA)或可编程逻辑阵列(PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。Computer program instructions for carrying out operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or instructions in one or more programming languages. Source or object code, written in any combination, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as the "C" language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through the Internet connect). In some embodiments, custom electronic circuits, such as programmable logic circuits, field programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), can be personalized by utilizing state information of computer readable program instructions. Computer readable program instructions are executed to implement various aspects of the present disclosure.
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。Aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams. These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
附图中的流程图和框图显示了根据本公开的多个实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The computer program product can be specifically implemented by hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Various embodiments of the present disclosure have been described above, and the foregoing descriptions are exemplary, not exhaustive, and not limiting of the disclosed embodiments. Numerous modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the various embodiments, the practical application or improvement over the technology in the marketplace, or to enable others of ordinary skill in the art to understand the various embodiments disclosed herein.

Claims (16)

  1. 一种活体识别方法,包括:A living body identification method, comprising:
    对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,所述第一活体识别用于识别所述待识别对象是活体还是2D非活体;performing a first living body recognition on the target image corresponding to the object to be identified, to obtain a first identification result, where the first living body recognition is used to identify whether the object to be identified is a living body or a 2D non-living body;
    在所述第一识别结果指示所述待识别对象为活体的情况下,对所述目标图像进行第二活体识别,得到第二识别结果,所述第二活体识别用于识别所述待识别对象是活体还是3D非活体。In the case where the first recognition result indicates that the object to be recognized is a living body, a second living body recognition is performed on the target image to obtain a second recognition result, and the second living body recognition is used to identify the object to be recognized Live or 3D non-live.
  2. 根据权利要求1所述的方法,其中,所述对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,包括:The method according to claim 1, wherein the first living body recognition is performed on the target image corresponding to the object to be recognized to obtain a first recognition result, comprising:
    通过第一活体识别网络对所述目标图像进行第一活体识别,得到所述第一识别结果,所述第一活体识别网络是基于活体对应的第一样本图像和2D非活体对应的第二样本图像训练得到的。A first living body recognition is performed on the target image through a first living body recognition network to obtain the first recognition result. The first living body recognition network is based on the first sample image corresponding to the living body and the second sample image corresponding to the 2D non-living body. sample image training.
  3. 根据权利要求2所述的方法,其中,所述第一样本图像中包括第一标签,所述第一标签用于指示所述第一样本图像为活体对应的图像;The method according to claim 2, wherein the first sample image includes a first label, and the first label is used to indicate that the first sample image is an image corresponding to a living body;
    在通过所述第一活体识别网络对所述目标图像进行第一活体识别之前,所述方法还包括:Before performing the first living body recognition on the target image through the first living body recognition network, the method further includes:
    通过第一初始网络对所述第一样本图像和所述第二样本图像进行分类,得到第一分类结果;Classify the first sample image and the second sample image through a first initial network to obtain a first classification result;
    根据所述第一样本图像中包括的所述第一标签以及所述第一分类结果,确定所述第一初始网络对应的第一分类损失;determining a first classification loss corresponding to the first initial network according to the first label included in the first sample image and the first classification result;
    根据所述第一分类损失,训练所述第一初始网络,以得到训练后的所述第一活体识别网络。According to the first classification loss, the first initial network is trained to obtain the trained first living body recognition network.
  4. 根据权利要求3所述的方法,其中,所述通过第一初始网络对所述第一样本图像和所述第二样本图像进行分类,得到第一分类结果,包括:The method according to claim 3, wherein the classifying the first sample image and the second sample image through a first initial network to obtain a first classification result, comprising:
    对所述第一样本图像进行人脸检测,得到第一人脸框,以及对所述第二样本图像进行人脸检测,得到第二人脸框;performing face detection on the first sample image to obtain a first face frame, and performing face detection on the second sample image to obtain a second face frame;
    根据所述第一人脸框对所述第一样本图像进行裁切,得到第一人脸图像,以及根据所述第二人脸框对所述第二样本图像进行裁切,得到第二人脸图像;Cut the first sample image according to the first face frame to obtain a first face image, and cut the second sample image according to the second face frame to obtain a second face image face image;
    通过所述第一初始网络对所述第一人脸图像和所述第二人脸图像进行分类,得到所述第一分类结果。The first classification result is obtained by classifying the first face image and the second face image through the first initial network.
  5. 根据权利要求4所述的方法,其中,所述根据所述第一人脸框对所述第一样本图像进行裁切,得到第一人脸图像,以及根据所述第二人脸框对所述第二样本图像进行裁切,得到第二人脸图像,包括:The method according to claim 4, wherein the first sample image is cropped according to the first face frame to obtain a first face image, and the The second sample image is cropped to obtain a second face image, including:
    调整所述第一人脸框的尺寸,得到第三人脸框,以及调整所述第二人脸框的尺寸,得到第四人脸框;Adjust the size of the first face frame to obtain a third face frame, and adjust the size of the second face frame to obtain a fourth face frame;
    根据所述第三人脸框对所述第一样本图像进行裁切,得到所述第一人脸图像,以及根据所述第四人脸框对所述第二样本图像进行裁切,得到所述第二人脸图像。The first sample image is cropped according to the third face frame to obtain the first face image, and the second sample image is cropped according to the fourth face frame to obtain the second face image.
  6. 根据权利要求1至5中任意一项所述的方法,其中,所述对所述目标图像进行第二活体识别,得到第二识别结果,包括:The method according to any one of claims 1 to 5, wherein the performing a second living body recognition on the target image to obtain a second recognition result, comprising:
    通过第二活体识别网络对所述目标图像进行第二活体识别,得到所述第二识别结果,所述第二活体识别网络是基于活体对应的第三样本图像和3D非活体对应的第四样本图像训练得到的。A second living body recognition is performed on the target image through a second living body recognition network to obtain the second recognition result, and the second living body recognition network is based on the third sample image corresponding to the living body and the fourth sample corresponding to the 3D non-living body. image training.
  7. 根据权利要求6所述的方法,其中,所述第三样本图像中包括第二标签,所述第二标签用于指 示所述第三样本图像为活体对应的图像;The method according to claim 6, wherein the third sample image includes a second label, and the second label is used to indicate that the third sample image is an image corresponding to a living body;
    在通过所述第二活体识别网络对所述目标图像进行第二活体识别之前,所述方法还包括:Before performing the second living body recognition on the target image through the second living body recognition network, the method further includes:
    通过第二初始网络对所述第三样本图像和所述第四样本图像进行分类,得到第二分类结果;Classify the third sample image and the fourth sample image through the second initial network to obtain a second classification result;
    根据所述第三样本图像中包括的所述第二标签以及所述第二分类结果,确定所述第二初始网络对应的第二分类损失;determining a second classification loss corresponding to the second initial network according to the second label included in the third sample image and the second classification result;
    根据所述第二分类损失,训练所述第二初始网络,以得到训练后的所述第二活体识别网络。According to the second classification loss, the second initial network is trained to obtain the trained second living body recognition network.
  8. 根据权利要求7所述的方法,其中,所述通过第二初始网络对所述第三样本图像和所述第四样本图像进行分类,得到第二分类结果,包括:The method according to claim 7, wherein the classifying the third sample image and the fourth sample image through a second initial network to obtain a second classification result, comprising:
    对所述第三样本图像进行人脸检测,得到第五人脸框,以及对所述第四样本图像进行人脸检测,得到第六人脸框;performing face detection on the third sample image to obtain a fifth face frame, and performing face detection on the fourth sample image to obtain a sixth face frame;
    根据所述第五人脸框对所述第三样本图像进行裁切,得到第三人脸图像,以及根据所述第六人脸框对所述第四样本图像进行裁切,得到第四人脸图像;The third sample image is cropped according to the fifth face frame to obtain a third face image, and the fourth sample image is cropped according to the sixth face frame to obtain a fourth person face image;
    通过所述第二初始网络对所述第三人脸图像和所述第四人脸图像进行分类,得到所述第二分类结果。The third face image and the fourth face image are classified by the second initial network to obtain the second classification result.
  9. 根据权利要求8所述的方法,其中,所述根据所述第五人脸框对所述第三样本图像进行裁切,得到第三人脸图像,以及根据所述第六人脸框对所述第四样本图像进行裁切,得到第四人脸图像,包括:The method according to claim 8, wherein the third sample image is cropped according to the fifth face frame to obtain a third face image, and the third face image is obtained according to the sixth face frame. The fourth sample image is cropped to obtain a fourth face image, including:
    调整所述第五人脸框的尺寸,得到第七人脸框,以及调整所述第六人脸框的尺寸,得到第八人脸框;Adjust the size of the fifth face frame to obtain the seventh face frame, and adjust the size of the sixth face frame to obtain the eighth face frame;
    根据所述第七人脸框对所述第三样本图像进行裁切,得到所述第三人脸图像,以及根据所述第八人脸框对所述第四样本图像进行裁切,得到所述第四人脸图像。The third sample image is cropped according to the seventh face frame to obtain the third face image, and the fourth sample image is cropped according to the eighth face frame to obtain the Describe the fourth face image.
  10. 一种门禁设备控制方法,包括:An access control device control method, comprising:
    采集需要通过门禁设备的待识别对象对应的目标图像;Collect the target image corresponding to the object to be identified that needs to pass through the access control device;
    采用权利要求1至9中任意一项的活体识别方法,对所述目标图像进行活体识别,得到活体识别结果;Using the living body recognition method according to any one of claims 1 to 9, the target image is subjected to living body recognition to obtain a living body recognition result;
    在所述活体识别结果指示所述待识别对象为活体的情况下,控制所述门禁设备开启。In the case that the living body identification result indicates that the object to be identified is a living body, the access control device is controlled to be turned on.
  11. 根据权利要求10所述的方法,其中,所述采集需要通过门禁设备的待识别对象对应的目标图像,包括:The method according to claim 10, wherein the collecting the target image corresponding to the object to be identified that needs to pass through the access control device comprises:
    利用双红外摄像头模组,采集所述待识别对象对应的所述目标图像。The target image corresponding to the object to be identified is collected by using a dual infrared camera module.
  12. 一种活体识别装置,包括:A living body identification device, comprising:
    第一识别模块,用于对待识别对象对应的目标图像进行第一活体识别,得到第一识别结果,所述第一活体识别用于识别所述待识别对象是活体还是2D非活体;a first recognition module, configured to perform a first in vivo recognition on the target image corresponding to the object to be recognized, to obtain a first recognition result, and the first recognition module is used for recognizing whether the object to be recognized is a living body or a 2D non-living body;
    第二识别模块,用于在所述第一识别结果指示所述待识别对象为活体的情况下,对所述目标图像进行第二活体识别,得到第二识别结果,所述第二活体识别用于识别所述待识别对象是活体还是3D非活体。The second recognition module is configured to perform a second in vivo recognition on the target image when the first recognition result indicates that the object to be recognized is a living body, and obtain a second recognition result, which is used for the second in vivo recognition. for identifying whether the object to be identified is a living body or a 3D non-living body.
  13. 一种门禁设备控制装置,包括:An access control device control device, comprising:
    图像采集模块,用于采集需要通过门禁设备的待识别对象对应的目标图像;The image acquisition module is used to collect the target image corresponding to the object to be identified that needs to pass through the access control device;
    活体识别模块,用于采用权利要求1至9中任意一项的活体识别方法,对所述目标图像进行活体识别,得到活体识别结果;A living body recognition module, configured to use the living body recognition method of any one of claims 1 to 9 to perform living body recognition on the target image to obtain a living body recognition result;
    控制模块,用于在所述活体识别结果指示所述待识别对象为活体的情况下,控制所述门禁设备开启。A control module, configured to control the access control device to open when the living body recognition result indicates that the object to be identified is a living body.
  14. 一种电子设备,包括:An electronic device comprising:
    处理器;processor;
    用于存储处理器可执行指令的存储器;memory for storing processor-executable instructions;
    其中,所述处理器被配置为调用所述存储器存储的指令,以执行权利要求1至9中任意一项所述的活体识别方法,或,执行权利要求10或11所述的门禁设备控制方法。Wherein, the processor is configured to call the instructions stored in the memory to execute the living body identification method according to any one of claims 1 to 9, or to execute the access control device control method according to claim 10 or 11 .
  15. 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现权利要求1至9中任意一项所述的活体识别方法,或,执行权利要求10或11所述的门禁设备控制方法。A computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, realize the living body identification method described in any one of claims 1 to 9, or, execute claim 10 or The access control device control method described in 11.
  16. 一种计算机程序,包括计算机可读代码,当所述计算机代码在电子设备中运行时,所述电子设备中的处理器执行用于实现权利要求1至9中任意一项所述的活体识别方法,或,实现权利要求10或11所述的门禁设备控制方法。A computer program, comprising computer-readable codes, when the computer codes are executed in an electronic device, a processor in the electronic device executes the method for realizing the living body identification according to any one of claims 1 to 9 , or, realize the access control device control method of claim 10 or 11.
PCT/CN2021/086219 2020-11-10 2021-04-09 Liveness identification and access control device control methods, apparatus, electronic device, storage medium, and computer program WO2022099989A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011248985.1A CN112270288A (en) 2020-11-10 2020-11-10 Living body identification method, access control device control method, living body identification device, access control device and electronic device
CN202011248985.1 2020-11-10

Publications (1)

Publication Number Publication Date
WO2022099989A1 true WO2022099989A1 (en) 2022-05-19

Family

ID=74339723

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/086219 WO2022099989A1 (en) 2020-11-10 2021-04-09 Liveness identification and access control device control methods, apparatus, electronic device, storage medium, and computer program

Country Status (2)

Country Link
CN (1) CN112270288A (en)
WO (1) WO2022099989A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112270288A (en) * 2020-11-10 2021-01-26 深圳市商汤科技有限公司 Living body identification method, access control device control method, living body identification device, access control device and electronic device
CN113657154A (en) * 2021-07-08 2021-11-16 浙江大华技术股份有限公司 Living body detection method, living body detection device, electronic device, and storage medium
CN115690918A (en) * 2021-07-22 2023-02-03 京东科技控股股份有限公司 Method, device, equipment and medium for constructing living body identification model and living body identification

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109034102A (en) * 2018-08-14 2018-12-18 腾讯科技(深圳)有限公司 Human face in-vivo detection method, device, equipment and storage medium
CN110909693A (en) * 2019-11-27 2020-03-24 深圳市华付信息技术有限公司 3D face living body detection method and device, computer equipment and storage medium
US20200257914A1 (en) * 2017-11-20 2020-08-13 Tencent Technology (Shenzhen) Company Limited Living body recognition method, storage medium, and computer device
CN111582045A (en) * 2020-04-15 2020-08-25 深圳市爱深盈通信息技术有限公司 Living body detection method and device and electronic equipment
CN112270288A (en) * 2020-11-10 2021-01-26 深圳市商汤科技有限公司 Living body identification method, access control device control method, living body identification device, access control device and electronic device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106203235B (en) * 2015-04-30 2020-06-30 腾讯科技(深圳)有限公司 Living body identification method and apparatus
CN109784148A (en) * 2018-12-06 2019-05-21 北京飞搜科技有限公司 Biopsy method and device
CN111860055B (en) * 2019-04-29 2023-10-24 北京眼神智能科技有限公司 Face silence living body detection method, device, readable storage medium and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200257914A1 (en) * 2017-11-20 2020-08-13 Tencent Technology (Shenzhen) Company Limited Living body recognition method, storage medium, and computer device
CN109034102A (en) * 2018-08-14 2018-12-18 腾讯科技(深圳)有限公司 Human face in-vivo detection method, device, equipment and storage medium
CN110909693A (en) * 2019-11-27 2020-03-24 深圳市华付信息技术有限公司 3D face living body detection method and device, computer equipment and storage medium
CN111582045A (en) * 2020-04-15 2020-08-25 深圳市爱深盈通信息技术有限公司 Living body detection method and device and electronic equipment
CN112270288A (en) * 2020-11-10 2021-01-26 深圳市商汤科技有限公司 Living body identification method, access control device control method, living body identification device, access control device and electronic device

Also Published As

Publication number Publication date
CN112270288A (en) 2021-01-26

Similar Documents

Publication Publication Date Title
US11410001B2 (en) Method and apparatus for object authentication using images, electronic device, and storage medium
TWI766286B (en) Image processing method and image processing device, electronic device and computer-readable storage medium
WO2022099989A1 (en) Liveness identification and access control device control methods, apparatus, electronic device, storage medium, and computer program
WO2021031609A1 (en) Living body detection method and device, electronic apparatus and storage medium
TWI759647B (en) Image processing method, electronic device, and computer-readable storage medium
TWI771645B (en) Text recognition method and apparatus, electronic device, storage medium
WO2021036382A9 (en) Image processing method and apparatus, electronic device and storage medium
CN109934275B (en) Image processing method and device, electronic equipment and storage medium
WO2017031901A1 (en) Human-face recognition method and apparatus, and terminal
WO2020259073A1 (en) Image processing method and apparatus, electronic device, and storage medium
TWI702544B (en) Method, electronic device for image processing and computer readable storage medium thereof
WO2020019760A1 (en) Living body detection method, apparatus and system, and electronic device and storage medium
CN110287671B (en) Verification method and device, electronic equipment and storage medium
TW202105202A (en) Video processing method and device, electronic equipment and storage medium
TWI766458B (en) Information identification method and apparatus, electronic device, and storage medium
WO2022134388A1 (en) Method and device for rider fare evasion detection, electronic device, storage medium, and computer program product
WO2021208666A1 (en) Character recognition method and apparatus, electronic device, and storage medium
WO2022160616A1 (en) Passage detection method and apparatus, electronic device, and computer readable storage medium
WO2022142330A1 (en) Identity authentication method and apparatus, and electronic device and storage medium
CN111259967A (en) Image classification and neural network training method, device, equipment and storage medium
US20220270352A1 (en) Methods, apparatuses, devices, storage media and program products for determining performance parameters
WO2023040202A1 (en) Face recognition method and apparatus, electronic device, and storage medium
CN110781842A (en) Image processing method and device, electronic equipment and storage medium
WO2022247091A1 (en) Crowd positioning method and apparatus, electronic device, and storage medium
TWI770531B (en) Face recognition method, electronic device and storage medium thereof

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: 21890524

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

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

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23/08/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21890524

Country of ref document: EP

Kind code of ref document: A1