Living body detection method, device, storage medium and computer equipment
By using a pre-configured live detection model to extract and predict the original image of the object to be tested, the problem of greater differences in prosthetic characteristics in the prior art is solved, and the accuracy of live detection and the robustness of the model are improved.
Patent Information
- Application Number
- CN202210453246.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-24
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-04-24
AI Technical Summary
In the prior art, the prosthetic features are mapped to the same feature space, resulting in larger differences in feature between prostheses, thereby reducing the accuracy of live detection.
The pre-configured live detection model is used to extract the original image of the object to be tested, and the live classification results are predicted based on the extracted features. This model performs network training on prostheses of different materials, extracts prosthetic feature maps separately, retains the prosthetic's own characteristics, and avoids feature mapping.
It improves the accuracy of live detection, effectively distinguishes live from different types of prostheses, and enhances the robustness and stability of the model.
Smart Images

Figure CN114724258B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of biometric identification technology, and in particular to a living body detection method, device, storage medium and computer equipment. Background Art
[0002] With the continuous development of science and technology, biometric technology has also been applied to various fields. For example, when using attendance equipment for attendance, the attendance equipment can identify features such as palms and faces through liveness detection, so that legitimate users can obtain corresponding permissions and record the attendance of legitimate users.
[0003] For the liveness detection task, since there is a small inter-class difference and a large intra-class difference between the live body and the prosthesis, once the prosthesis is mistakenly detected as a live body, the entire anti-counterfeiting function will be invalid.
[0004] Existing liveness detection algorithms usually map the extracted prosthesis features to the same feature space and then perform liveness detection on the object to be detected. This will cause the feature differences between the prostheses to become larger, resulting in low detection accuracy of the final detection result. Summary of the invention
[0005] The purpose of the present invention is to solve at least one of the above-mentioned technical defects, especially the technical defect that the extracted prosthesis features are mapped to the same feature space in the prior art, and then the liveness detection is performed on the object to be tested, which will cause the feature differences between the prostheses to become larger, thereby making the final detection result have low detection accuracy.
[0006] The present invention provides a living body detection method, the method comprising:
[0007] Acquire the original image of the object to be tested;
[0008] Extracting features from the original image based on a preconfigured liveness detection model, and predicting a liveness classification result of the object to be detected based on the extracted features;
[0009] The liveness detection model is configured to perform feature extraction and fusion on a set of input training images respectively, and predict the liveness classification result of each training image in the set of training images based on the fused features, wherein the set of training images includes a liveness training image and a prosthesis training image.
[0010] Optionally, the step of extracting features from the original image based on a preconfigured liveness detection model, and predicting a liveness classification result of the object to be detected based on the extracted features, comprises:
[0011] Performing global feature extraction and local feature extraction on the original image based on a preconfigured living body detection model to obtain a global feature map and a local feature map of the original image;
[0012] The global feature map and the local feature map of the original image are concatenated, and the concatenated feature map is used to predict the living body classification result of the object to be detected.
[0013] Optionally, the step of performing global feature extraction and local feature extraction on the original image based on a preconfigured living body detection model to obtain a global feature map and a local feature map of the original image includes:
[0014] Using the living body detection model, perform at least one global maximum pooling upsampling operation on the original image to obtain a corresponding first feature map;
[0015] Performing feature extraction on the first feature map to obtain a global feature map of the original image;
[0016] After downsampling the original image using the living body detection model, a corresponding second feature map is obtained;
[0017] Extracting a region of interest of the second feature map to obtain a plurality of response feature region images of different scales and confidence scores corresponding to the response feature region images;
[0018] Screening at least two groups of response feature region images of different scales according to the confidence scores corresponding to the response feature region images;
[0019] The response feature area images obtained after screening are concatenated and convolved to obtain a local feature map of the original image.
[0020] Optionally, the liveness detection method further includes:
[0021] After performing center area cropping on the original image, a center area cropped image is obtained;
[0022] After performing a light brightness change on the original image, a light brightness change image is obtained;
[0023] The central region cropped image and the light brightness variation image are sequentially input into the living body detection model to obtain a living body classification result of the central region cropped image and a living body classification result of the light brightness variation image.
[0024] Optionally, the object to be measured includes a palm, and the original image of the object to be measured includes an original palm image;
[0025] The step of obtaining a center area cropped image after the center area of the original palm image is cropped comprises:
[0026] Input the original palm image into a palm detection model, and obtain the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image output by the palm detection model;
[0027] According to the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image, the center area of the original palm image is cropped to obtain a center area cropped image;
[0028] The center area cropped image is the smallest circumscribed square image of the palm area in the original palm image.
[0029] Optionally, the liveness detection method further includes:
[0030] The final prediction result of the live body detection model is determined according to the live body classification result of the original image, the live body classification result of the central area cropped image, and the live body classification result of the light illumination change image.
[0031] Optionally, the step of determining a final prediction result of the liveness detection model according to the liveness classification result of the original image, the liveness classification result of the central area cropped image, and the liveness classification result of the light illumination change image includes:
[0032] Performing weighted summation on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a first prediction result;
[0033] and voting on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a second prediction result;
[0034] Based on the first prediction result and the second prediction result, a final prediction result of the living body detection model is determined.
[0035] Optionally, the step of determining a final prediction result of the living body detection model based on the first prediction result and the second prediction result includes:
[0036] Comparing the first prediction result with the second prediction result;
[0037] If the first prediction result is the same as the second prediction result, taking the first prediction result or the second prediction result as the final prediction result of the living body detection model;
[0038] If the first prediction result is different from the second prediction result, the living body classification result of the original image is used as the final prediction result of the living body detection model.
[0039] The present invention also provides a living body detection device, comprising:
[0040] An image acquisition module is used to acquire an original image of the object to be tested;
[0041] A liveness detection module, used to extract features from the original image based on a preconfigured liveness detection model, and predict a liveness classification result of the object to be detected based on the extracted features;
[0042] The liveness detection model is configured to perform feature extraction and fusion on a set of input training images respectively, and predict the liveness classification result of each training image in the set of training images based on the fused features, wherein the set of training images includes a liveness training image and a prosthesis training image.
[0043] The present invention also provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method as described in any one of the above embodiments.
[0044] The present invention also provides a computer device, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method as described in any one of the above embodiments.
[0045] It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:
[0046] The liveness detection method, device, storage medium and computer equipment provided by the present invention input the acquired original image of the object to be detected into the liveness detection model. Since the liveness detection model of the present application treats prostheses of different materials as prostheses of different categories for network training and extracts corresponding prosthesis feature maps for different prostheses, the characteristics of each type of prosthesis itself can be effectively retained, and there is no need to forcibly map prosthesis features with very different characteristics to the same feature space, so that the trained liveness detection model has the ability to effectively distinguish between live bodies and prostheses of different categories. At this time, after the original image of the object to be detected is input into the liveness detection model, the predicted liveness classification result of the object to be detected has a high detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0048] Figure 1 A schematic diagram of a flow chart of a living body detection method provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of the training process of a liveness detection model provided in an embodiment of the present invention;
[0050] Figure 3 A flowchart of palm liveness detection by test image reasoning and augmentation provided by an embodiment of the present invention;
[0051] Figure 4 A schematic diagram of the structure of a living body detection device provided by an embodiment of the present invention;
[0052] Figure 5 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] With the continuous development of science and technology, biometric technology has also been applied to various fields. For example, when using attendance equipment for attendance, the attendance equipment can identify features such as palms and faces through liveness detection, so that legitimate users can obtain corresponding permissions and record the attendance of legitimate users.
[0055] For the liveness detection task, since there is a small inter-class difference and a large intra-class difference between the live body and the prosthesis, once the prosthesis is mistakenly detected as a live body, the entire anti-counterfeiting function will be invalid.
[0056] Existing liveness detection algorithms usually map the extracted prosthesis features to the same feature space and then perform liveness detection on the object to be detected. This will cause the feature differences between the prostheses to become larger, resulting in low detection accuracy of the final detection result.
[0057] Therefore, the purpose of the present invention is to solve the technical problem that in the prior art, the extracted prosthesis features are mapped to the same feature space, and then the liveness detection is performed on the object to be detected, which will cause the feature differences between the prostheses to become larger, thereby making the detection accuracy of the final detection result low, and the following technical solutions are proposed:
[0058] In one embodiment, Figure 1 As shown, Figure 1 A flow chart of a liveness detection method provided by an embodiment of the present invention; the present invention provides a liveness detection method, the method comprising:
[0059] S110: Acquire an original image of the object to be measured.
[0060] In this step, before performing liveness detection, the original image of the object to be tested can be obtained. The object to be tested here can be a living object or a prosthesis with identifiable features such as a palm or a face. When obtaining the original image of the object to be tested, it can be obtained through a device with an image acquisition function, including but not limited to a handheld device with a camera, a mobile device, etc.
[0061] For example, when the object to be tested is a palm, the original image of the palm to be tested can be extracted through the identity recognition device; when the object to be tested is a face, the designated area of the face to be tested can be captured through the face image acquisition device.
[0062] Furthermore, the captured images may include both live images and prosthetic images; wherein, live images refer to a collection of images of users in various human postures captured using a device under various lighting and background conditions, and prosthetic images refer to a collection of images of users in various human postures captured using a device under various lighting and background conditions when performing liveness detection using printed palm and face images, videos, and molds.
[0063] In practical applications, the lighting conditions used when capturing images may include natural light, office lighting, street lighting, and other lighting conditions; the background of the captured images may include streets, offices, shopping malls, and other scenes; human body postures may include hands hanging down, fingers together, fingers open, tense face, or relaxed face, and other postures.
[0064] S120: Extract features from the original image based on a preconfigured liveness detection model, and predict a liveness classification result of the object to be detected based on the extracted features.
[0065] In this step, after the original image of the object to be detected is obtained in step S110, the preconfigured living body detection model can be used to extract features from the original image, and the living body classification result of the object to be detected is predicted based on the extracted features.
[0066] It should be noted that the liveness detection model in the present application is configured to perform feature extraction and fusion on a set of input training images respectively, and to predict the liveness classification result of each training image in a set of training images based on the fused features, wherein a set of training images includes a liveness training image and a prosthesis training image.
[0067] Specifically, when training the liveness detection model in the present application, the model adopts a tree-shaped network multi-branch processing unit, and through different network branches, it learns the feature differences between the live body and a specific prosthesis respectively, and then through multi-branch combined training, it learns the feature representation between the live body and various prostheses separately, so as to effectively distinguish between the live body and different prostheses.
[0068] Therefore, the liveness detection model obtained after training through the above training process can not only extract features from the original image of the object to be tested, but also predict the liveness classification result of the object to be tested based on the extracted features, and then determine whether the object to be tested is alive.
[0069] Furthermore, since the liveness detection model in the present application uses a set of training images as input data during the training process, the liveness detection model can automatically copy a copy of the original image before performing feature extraction on the original image of the object to be detected during the inference stage, so that the liveness detection model inputs two identical original images into the model at the same time during the processing process, thereby obtaining a prediction result.
[0070] In addition, the liveness classification result in the present application may include a liveness prediction score output by the model. After comparing the liveness prediction score with a preset liveness detection threshold, the final liveness detection result can be obtained.
[0071] In the above embodiment, the acquired original image of the object to be tested is input into the liveness detection model. Since the liveness detection model of the present application treats prostheses of different materials as prostheses of different categories for network training and extracts corresponding prosthesis feature maps for different prostheses, the characteristics of each type of prosthesis itself can be effectively retained, and there is no need to forcibly map prosthesis features with very different characteristics to the same feature space. As a result, the trained liveness detection model has the ability to effectively distinguish between live bodies and prostheses of different categories. At this time, after the original image of the object to be tested is input into the liveness detection model, the predicted liveness classification result of the object to be tested has a high detection accuracy.
[0072] The above embodiments describe the liveness detection method in the present application. The following describes in detail how to extract features from the original image and predict the liveness classification result in the present application.
[0073] In one embodiment, the step of extracting features from the original image based on a preconfigured liveness detection model in step S120, and predicting the liveness classification result of the object to be detected based on the extracted features, may include:
[0074] S121: Perform global feature extraction and local feature extraction on the original image based on a preconfigured living body detection model to obtain a global feature map and a local feature map of the original image.
[0075] S122: Concatenating the global feature map and the local feature map of the original image, and using the concatenated feature map to predict the living body classification result of the object to be detected.
[0076] In this embodiment, when extracting features from the original image, a liveness detection model can be used to extract the global and local features of the original image, and then the extracted global feature map is concatenated with the local feature map so that the concatenated feature map can be used to predict the liveness classification result of the object to be tested.
[0077] Specifically, when the liveness detection model is used to extract the global features and local features of the original image, the present application can use the FPN feature pyramid to construct feature pyramids of different scales. This network structure can connect the high-level features with low resolution and high semantic information with the low-level features with high resolution and low semantic information from top to bottom, so that the features at all scales have rich semantic information. The general structure of the network includes a bottom-up line, a top-down line, and a lateral connection.
[0078] The bottom-up process is the normal forward propagation process of the neural network. In the forward process, the size of the feature map will change after passing through some layers, but will not change when passing through other layers. The layers that do not change the size of the feature map are grouped into one stage, so each extracted feature is the output of the last layer of each stage, thus forming a feature pyramid.
[0079] The top-down process is to upsample the high-level feature map (such as nearest neighbor upsampling), and then connect the feature laterally to the previous layer feature, which strengthens the high-level features.
[0080] The horizontal connection refers to the process of convolving the feature map of the previous layer with a 1×1 convolution kernel, the purpose of which is to change the number of channels, because the number of channels of the feature map upsampled in the next layer must be the same.
[0081] After the liveness detection model extracts the global features and local features of the original image, the global feature map and the local feature map can be concatenated, and the concatenated feature map is input into a batch normalization layer and an adaptive average pooling layer. After the average pooling layer, the processing unit includes two fully connected layers, and the liveness classification result of the object to be tested is predicted through the two fully connected layers.
[0082] Furthermore, if Figure 2 As shown, Figure 2 A schematic diagram of the training process of a liveness detection model provided in an embodiment of the present invention; Figure 2 In the liveness detection model training, the live body and any kind of prosthesis can be input into the liveness detection model as a set of training images. Moreover, before using the FPN feature pyramid to obtain feature maps of different scales, the live body image and the prosthesis image can be concat operated in the channel dimension, so that the number of channels of the input image increases, and the information under each feature does not increase.
[0083] For example, the present application can obtain a 112*112 scale square area image of the palm, and then randomly select a live palm and a prosthetic palm image (live + prosthetic i) as a set of data and simultaneously input them into the liveness detection model. First, the image input feature map is obtained by 3*3 convolution processing. and Then concatenate the two feature maps in the channel dimension c to get a new feature map
[0084] Next, the corresponding global features and local features are extracted through the FPN feature pyramid and feature extractor. After the global features and local features are spliced, they are input into a batch normalization layer and an adaptive average pooling layer. After the average pooling layer, the processing unit includes two fully connected layers, and the living classification results of the object to be tested are predicted through the two fully connected layers.
[0085] Among them, the first fully connected layer outputs the predicted categories and category scores of the live body and any type of prosthesis respectively. Among them, FC_layer_1 performs softmax activation output for the live body and prosthesis No. 1, and FC_layer_2 performs softmax activation output for the live body and prosthesis No. 2. The activation outputs of other types of prostheses are similar. By combining the live body with different types of prostheses to obtain different prediction output results, the second fully connected layer is used to activate and output all the prediction results of the first fully connected layer to obtain the final multi-branch combined training results, and the final liveness detection model is built.
[0086] Through the above-mentioned network multi-branch processing unit design, it is possible to retain the original feature information of the image and to mine deeper feature semantic information by learning local features of the image. The corresponding feature representation is learned for each prosthesis separately, without forcibly mapping the features of prostheses of multiple different materials into the same feature space. Through multi-branch combined training, the feature representation between the living body and various prostheses is learned separately, so that the model can effectively prevent attacks from different types of prostheses, thereby making the model more robust and stable.
[0087] The above embodiment describes in detail how to extract features from the original image and predict the living body classification result in the present application. The following describes how to extract global features and local features in the present application.
[0088] In one embodiment, the step of performing global feature extraction and local feature extraction on the original image based on the preconfigured living body detection model in step S121 to obtain a global feature map and a local feature map of the original image may include:
[0089] S211: Use the living body detection model to perform at least one global maximum pooling upsampling operation on the original image to obtain a corresponding first feature map.
[0090] S212: Perform feature extraction on the first feature map to obtain a global feature map of the original image.
[0091] S213: After downsampling the original image using the living body detection model, a corresponding second feature map is obtained.
[0092] S214: extracting the region of interest of the second feature map, obtaining a plurality of response feature region images of different scales and confidence scores corresponding to the response feature region images.
[0093] S215: Screening at least two groups of response feature region images of different scales according to the confidence scores corresponding to the response feature region images.
[0094] S216: Concatenate and convolve the response feature region images obtained after screening to obtain a local feature map of the original image.
[0095] In this embodiment, Figure 2 As shown, the present application can use the bottom-up architecture and lateral connection method in the FPN feature pyramid network to extract feature maps of different scales of the original palm image. When extracting global features from the original image, the FPN feature pyramid can be used to perform three global maximum pooling upsampling operations on the original image, which is represented as f gmp (·) operation, the feature map X generated after 3 maximum pooling operationsp The feature extractor uses a fully convolutional network, represented by ω here, and the extracted palm image is based on the global feature X of the semantic content. global_feature It can be expressed as the following formula:
[0096] X global_feature =ω(f gmp (X)
[0097] For a set of feature maps corresponding to the original palm images, a feature map restored to the original resolution after downsampling can be obtained by horizontal connection. The RPN network combined with the ROIAlign method is used on the feature map to extract the ROI area as the local palm image. This method can generate several response feature areas of different scales and corresponding confidence scores on the feature map. In this application, the palm area with the top-3 confidence scores can be selected as the ROI area, and the feature map scale {12×12, 6×6, 3×3} is set to correspond to the original palm map area {28×28, 56×56, 112×112}. The process of extracting the ROI area of interest on the feature map X can be expressed as follows:
[0098]
[0099] Among them, x roi Represents the ROI region of interest extracted on the feature map, f ROIAlign (·) indicates ROIAlign operation, (h * ,w * ) represents the height and width of the ROI area.
[0100] After obtaining the ROI region on the feature map, according to the relationship between the feature map scale {12×12, 6×6, 3×3} and the original palm map area {28×28, 56×56, 112×112}, the original palm image is cropped and resized according to the ROI region to obtain the final three square-scale ROI palm local images. The FPN feature pyramid is continued to be used to generate feature maps for the palm local images, and the feature extractor is used to extract the corresponding regional features. For each palm image i, the local features Xlocal_fea_i1, Xlocal_fea_i2, and Xlocal_fea_i3 of the three ROI region images can be obtained. The local features are connected in series and then processed through a convolution layer to obtain the overall local features Xlocal_fea_i of the ROI region image, where Xlocal_fea_i can be expressed as the following formula (3):
[0101] X local_fea_i =f conv [X local_fea_i1 ,X local_fea_i2,X local_fea_i3 ]
[0102] Finally, the fused palm feature map Xfeature_fusion_i is input into a batch normalization layer and an adaptive average pooling layer. After the average pooling layer, the processing unit contains two fully connected layers, and the living classification results of the object to be tested are predicted through the fully connected layers.
[0103] The above-mentioned set of original palm images refers to a live training image and a prosthesis training image during model training, and refers to an original image and an image obtained by copying the original image during the model application stage.
[0104] The above embodiments illustrate the process of how to extract global features and local features in the present application. The process of the living body detection method in the present application will be further expanded below.
[0105] In one embodiment, Figure 3 As shown, Figure 3 A flowchart of palm liveness detection by test image reasoning and augmentation provided by an embodiment of the present invention; the liveness detection method may also include:
[0106] A11: After performing center region cropping on the original image, a center region cropped image is obtained.
[0107] A12: After performing light brightness change on the original image, a light brightness change image is obtained.
[0108] A13: Input the central area cropped image and the light brightness change image into the living body detection model in sequence to obtain the living body classification result of the central area cropped image and the living body classification result of the light brightness change image.
[0109] In this embodiment, since the liveness detection algorithm is highly sensitive to the scale, rotation angle, and illumination changes of the object to be detected, a series of data augmentation methods such as rotation, scaling, and brightness changes are usually used on the training data when training the liveness detection model to better mine the low-response feature information of the image that is insensitive to scale, rotation angle, and illumination, thereby learning more robust model parameters and making the model have better generalization performance.
[0110] In the inference stage of existing liveness detection algorithms, usually only a single frame image detected during prediction is considered, and the authenticity of the frame image is inferred through the liveness detection model. However, in actual applications, due to the influence of uncertain usage scenarios, lighting and other external factors, it is inevitable that there will be certain interference to the liveness detection algorithm, resulting in foreseeable accidental errors in the liveness prediction results, especially when the prosthesis is mistakenly detected as live, which will eventually lead to anti-counterfeiting failure and affect product performance.
[0111] In this application, if Figure 3 As shown, by performing two methods of center region cropping and light brightness change on the single frame image detected during inference, three images to be input are obtained, namely the original image, the center region cropped image, and the light brightness change image. Here, the center region cropping factor δ can be set to 0.9, and the brightness change factor θ can be set between 0.8 and 1.2.
[0112] The above three images are simultaneously input into the trained liveness detection model, and the model is used to predict the above three images respectively to obtain the corresponding liveness classification results.
[0113] The above-mentioned embodiment further expands the process of the living body detection method in the present application. The following will describe the cropping process of the original image in the present application.
[0114] In one embodiment, the object to be measured may include a palm, and the original image of the object to be measured may include an original palm image; after performing a center area cropping on the original image in step A11, the step of obtaining a center area cropped image may include:
[0115] A111: Input the original palm image into a palm detection model, and obtain the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image output by the palm detection model.
[0116] A112: Crop the center area of the original palm image according to the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image to obtain a center area cropped image;
[0117] The center area cropped image is the smallest circumscribed square image of the palm area in the original palm image.
[0118] In this embodiment, for the collected original palm image, it is necessary to extract the palm area of interest from it. When the original palm image is detected by the palm detection model, the detected palm area is not directly cropped, but the position of the center point of the palm area and the width and height scales are recorded. According to the width and height scales, the palm area is randomly expanded to a square scale on the original image. If the palm area appears at the corner of the original image, the square palm area image is obtained by cropping its minimum circumscribed square on the original palm image.
[0119] The palm region image obtained by this method has two advantages: (1) directly performing an external rectangular cropping of the palm region on the original palm image can effectively retain the contextual semantic information of the palm region; (2) randomly expanding the rectangular region of the palm region can effectively increase the diversity of sample data and the randomness of the palm position.
[0120] Furthermore, the position coordinates of the center point of the palm region in the original palm image are regressed by a pre-trained palm detection model. While the model regresses the center point of the palm, it can also detect the width and height of the palm.
[0121] Among them, the width refers to the width of the circumscribed rectangle of the palm region detected by the model, and the height refers to the height of the circumscribed rectangle of the palm region detected by the model; according to the detected width w and height h of the palm region, if h > w, then expand (h - w) / 2 on both the left and right of the palm region, if h < w, then expand (w - h) / 2 on both the top and bottom of the palm region, ensure that the long side of the palm region is fixed, and expand the short side to the length of the long side before cropping the original image, ensure that the cropped palm region is the minimum circumscribed square image of the palm, and this region completely contains the palm within it.
[0122] The above embodiments illustrate the cropping process of the original image in this application. Next, the determination process of the final prediction result of the live detection model in this application will be described.
[0123] In one embodiment, the live detection method may further include:
[0124] A14: Determine the final prediction result of the live detection model according to the live classification result of the original image, the live classification result of the center region cropped image, and the live classification result of the illumination brightness change image.
[0125] In this embodiment, since the live detection model performs live prediction on the original image, the center region cropped image, and the illumination brightness change image respectively, and obtains their respective live classification results. Since the original image, the center region cropped image, and the illumination brightness change image are all images obtained based on the object to be tested. Therefore, the final prediction result of the object to be tested can be determined by combining the live classification result of the original image, the live classification result of the center region cropped image, and the live classification result of the illumination brightness change image. This final prediction result considers the prediction outputs of the center region and the image after illumination change while paying attention to the prediction output of the original image. Through this amplification method, the interference of the test environment can be effectively reduced, the problem of occasional prediction errors can be reduced, and the robustness of the model can be improved.
[0126] The above embodiment describes the process of determining the final prediction result of the liveness detection model in the present application. The following will explain the process of how to obtain the final prediction result of the liveness detection model in the present application.
[0127] In one embodiment, the step of determining the final prediction result of the liveness detection model according to the liveness classification result of the original image, the liveness classification result of the central area cropped image, and the liveness classification result of the light illumination change image in step A14 may include:
[0128] A141: Perform weighted summation on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a first prediction result.
[0129] A142: Voting on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a second prediction result.
[0130] A143: Determine a final prediction result of the living body detection model based on the first prediction result and the second prediction result.
[0131] In this embodiment, when determining the final prediction result of the liveness detection model, the liveness classification result of the original image, the liveness classification result of the center area cropped image, and the liveness classification result of the light brightness change image can be weighted and summed to obtain a first prediction result; in addition, the liveness classification result of the original image, the liveness classification result of the center area cropped image, and the liveness classification result of the light brightness change image can be voted to obtain a second prediction result, and finally, based on the first prediction result and the second prediction result, the final prediction result of the liveness detection model is determined.
[0132] like Figure 3 As shown in the figure, assuming that liveness detection is performed on the palm, the liveness prediction score of the original test image is score1, the liveness prediction score of the central area cropped image is score2, and the liveness prediction score of the light illumination change image is score3. The corresponding weighted threshold is selected according to the application scenario. The final prediction score calculation process is as follows:
[0133] Score=α*score1+β*score2+γ*score3
[0134] The weighted thresholds here can be customized according to the scene, such as factors such as light intensity, brightness, background complexity, etc. in the application scene. The weighted thresholds in this application can be set to α=0.6, β=0.2, and γ=0.2.
[0135] Furthermore, on the one hand, the present application determines whether the object to be tested is alive based on the relationship between the final score of the three images and the liveness detection threshold η; on the other hand, the predicted liveness detection threshold μ for a single image can also be set. If the value of score1 is greater than μ, the original test image is considered to be alive, and the test results of the other two images are similar. In this way, the three palm images can be judged separately whether they are alive, and then voted according to the predicted results of the three images. If two or more images are classified as alive, the object to be tested is voted as alive, otherwise it is a fake.
[0136] The above embodiment illustrates the process of how to obtain the final prediction result of the liveness detection model in the present application. The following will describe in detail how to determine the final prediction result based on the first prediction result and the second prediction result in the present application.
[0137] In one embodiment, the step of determining the final prediction result of the living body detection model based on the first prediction result and the second prediction result in step A143 may include:
[0138] A1431: Compare the first prediction result and the second prediction result.
[0139] A1432: If the first prediction result is the same as the second prediction result, use the first prediction result or the second prediction result as the final prediction result of the living body detection model.
[0140] A1433: If the first prediction result is different from the second prediction result, the living body classification result of the original image is used as the final prediction result of the living body detection model.
[0141] In this embodiment, after weighted summing up the liveness classification result of the original image, the liveness classification result of the center area cropped image, and the liveness classification result of the light brightness change image to obtain a first prediction result, and voting on the liveness classification result of the original image, the liveness classification result of the center area cropped image, and the liveness classification result of the light brightness change image to obtain a second prediction result, the first prediction result can be compared with the second prediction result to determine the final prediction result.
[0142] Specifically, if the first prediction result is the same as the second prediction result, the first prediction result or the second prediction result is used as the final prediction result of the liveness detection model; if the first prediction result is different from the second prediction result, the liveness classification result of the original image is used as the final prediction result of the liveness detection model.
[0143] For example, when judging the authenticity of a palm image, the two aspects can be used to make a joint judgment. If both methods judge it to be alive, the palm is classified as a live palm; if both methods judge it to be a prosthesis, the palm is classified as a prosthesis palm; if one method judges it to be alive and the other method judges it to be a prosthesis, the authenticity of the final palm is determined based on the authenticity of a single original test image.
[0144] The following is a description of a liveness detection device provided in an embodiment of the present application. The liveness detection device described below and the text processing method described above can be referenced to each other.
[0145] In one embodiment, Figure 4 As shown, Figure 4 A schematic diagram of the structure of a liveness detection device provided by an embodiment of the present invention; the present invention also provides a liveness detection device, including an image acquisition model 210 and a liveness detection module 220, which specifically includes the following:
[0146] An image acquisition module 210 is used to acquire an original image of the object to be measured;
[0147] A liveness detection module 220, configured to extract features from the original image based on a preconfigured liveness detection model, and predict a liveness classification result of the object to be detected based on the extracted features;
[0148] The liveness detection model is configured to perform feature extraction and fusion on a set of input training images respectively, and predict the liveness classification result of each training image in the set of training images based on the fused features, wherein the set of training images includes a liveness training image and a prosthesis training image.
[0149] In the above embodiment, the acquired original image of the object to be tested is input into the liveness detection model. Since the liveness detection model of the present application treats prostheses of different materials as prostheses of different categories for network training and extracts corresponding prosthesis feature maps for different prostheses, the characteristics of each type of prosthesis itself can be effectively retained, and there is no need to forcibly map prosthesis features with very different characteristics to the same feature space. As a result, the trained liveness detection model has the ability to effectively distinguish between live bodies and prostheses of different categories. At this time, after the original image of the object to be tested is input into the liveness detection model, the predicted liveness classification result of the object to be tested has a high detection accuracy.
[0150] In one embodiment, the living body detection module 220 may include:
[0151] The feature extraction module is used to perform global feature extraction and local feature extraction on the original image based on a preconfigured living body detection model to obtain a global feature map and a local feature map of the original image.
[0152] The concatenation module is used to concatenate the global feature map and the local feature map of the original image, and use the concatenated feature map to predict the living body classification result of the object to be detected.
[0153] In one embodiment, the feature extraction module may include:
[0154] An upsampling module is used to perform at least one global maximum pooling upsampling operation on the original image using the living body detection model to obtain a corresponding first feature map.
[0155] The first extraction module is used to perform feature extraction on the first feature map to obtain a global feature map of the original image.
[0156] A downsampling module is used to downsample the original image using the living body detection model to obtain a corresponding second feature map.
[0157] The second extraction module is used to extract the region of interest of the second feature map, and obtain a plurality of response feature region images of different scales and confidence scores corresponding to the response feature region images.
[0158] The screening module is used to screen at least two groups of response feature region images of different scales according to the confidence scores corresponding to the response feature region images.
[0159] The convolution module is used to concatenate and convolve the response feature area images obtained after screening to obtain a local feature map of the original image.
[0160] In one embodiment, the living body detection device may further include:
[0161] The cropping module is used to crop the central area of the original image to obtain a central area cropped image.
[0162] The illumination change module is used to change the illumination brightness of the original image to obtain an illumination brightness change image.
[0163] The prediction result module is used to input the central area cropped image and the light brightness change image into the living body detection model in sequence to obtain the living body classification result of the central area cropped image and the living body classification result of the light brightness change image.
[0164] In one embodiment, the object to be measured may include a palm, and the original image of the object to be measured may include an original palm image; the cropping module may include:
[0165] The cropping data determination module is used to input the original palm image into the palm detection model to obtain the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image output by the palm detection model.
[0166] A center area cropping module, used to crop the center area of the original palm image according to the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image to obtain a center area cropped image;
[0167] The center area cropped image is the smallest circumscribed square image of the palm area in the original palm image.
[0168] In one embodiment, the living body detection device may further include:
[0169] The final result determination module is used to determine the final prediction result of the liveness detection model according to the liveness classification result of the original image, the liveness classification result of the central area cropped image, and the liveness classification result of the light illumination change image.
[0170] In one embodiment, the final result determination module may include:
[0171] The weighted summation module is used to perform weighted summation on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light brightness change image to obtain a first prediction result.
[0172] The voting module is used to vote on the living body classification result of the original image, the living body classification result of the central area cropped image and the living body classification result of the light brightness change image to obtain a second prediction result.
[0173] A determination module is used to determine a final prediction result of the living body detection model based on the first prediction result and the second prediction result.
[0174] In one embodiment, the determining module may include:
[0175] A comparison module is used to compare the first prediction result with the second prediction result.
[0176] The first prediction module is used to use the first prediction result or the second prediction result as the final prediction result of the living body detection model if the first prediction result is the same as the second prediction result.
[0177] The second prediction module is used to use the living body classification result of the original image as the final prediction result of the living body detection model if the first prediction result is different from the second prediction result.
[0178] In one embodiment, the present invention further provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method as described in any one of the above embodiments.
[0179] In one embodiment, the present invention further provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method as described in any one of the above embodiments.
[0180] Indicatively, if Figure 5 As shown, Figure 5 The internal structure diagram of a computer device provided in an embodiment of the present invention is shown in FIG. 300 . The computer device 300 may be provided as a server. Figure 5 The computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by a memory 301, for storing instructions executable by the processing component 302, such as an application. The application stored in the memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 302 is configured to execute instructions to perform the liveness detection method of any of the above embodiments.
[0181] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0182] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0183] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0184] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0185] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for detecting a living body, characterized in that: The method comprises: Acquire the original image of the object to be tested; Extracting features from the original image based on a preconfigured liveness detection model, and predicting a liveness classification result of the object to be detected based on the extracted features; The liveness detection model is configured to extract and fuse features of a set of input training images respectively, and predict the ability of the liveness classification result of each training image in the set of training images based on the fused features, wherein the set of training images includes a liveness training image and a prosthesis training image; The method further comprises: After performing center area cropping on the original image, a center area cropped image is obtained; After performing a light brightness change on the original image, a light brightness change image is obtained; Inputting the central region cropped image and the light brightness variation image into the living body detection model in sequence, and obtaining a living body classification result of the central region cropped image and a living body classification result of the light brightness variation image; The method further comprises: Performing weighted summation on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a first prediction result; and voting on the living body classification result of the original image, the living body classification result of the central area cropped image, and the living body classification result of the light illumination change image to obtain a second prediction result; Comparing the first prediction result with the second prediction result; If the first prediction result is the same as the second prediction result, taking the first prediction result or the second prediction result as the final prediction result of the living body detection model; If the first prediction result is different from the second prediction result, the living body classification result of the original image is used as the final prediction result of the living body detection model.
2. The method for detecting living body according to claim 1, characterized in that: The step of extracting features from the original image based on a preconfigured liveness detection model and predicting a liveness classification result of the object to be detected based on the extracted features comprises: Performing global feature extraction and local feature extraction on the original image based on a preconfigured living body detection model to obtain a global feature map and a local feature map of the original image; The global feature map and the local feature map of the original image are concatenated, and the concatenated feature map is used to predict the living body classification result of the object to be detected.
3. The method for liveness detection according to claim 2, characterized in that: The step of performing global feature extraction and local feature extraction on the original image based on the preconfigured living body detection model to obtain a global feature map and a local feature map of the original image includes: Using the living body detection model, perform at least one global maximum pooling upsampling operation on the original image to obtain a corresponding first feature map; Performing feature extraction on the first feature map to obtain a global feature map of the original image; After downsampling the original image using the living body detection model, a corresponding second feature map is obtained; Extracting a region of interest of the second feature map to obtain a plurality of response feature region images of different scales and confidence scores corresponding to the response feature region images; Screening at least two groups of response feature region images of different scales according to the confidence scores corresponding to the response feature region images; The response feature area images obtained after screening are concatenated and convolved to obtain a local feature map of the original image.
4. The method for detecting living body according to claim 1, characterized in that: The object to be measured includes a palm, and the original image of the object to be measured includes an original palm image; The step of obtaining a center area cropped image after the center area of the original palm image is cropped comprises: Input the original palm image into a palm detection model, and obtain the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image output by the palm detection model; According to the palm center point of the original palm image and the width and height of the circumscribed rectangle of the palm area of the original palm image, the center area of the original palm image is cropped to obtain a center area cropped image; The center area cropped image is the smallest circumscribed square image of the palm area in the original palm image.
5. A living body detection device, characterized in that: include: An image acquisition module is used to acquire an original image of the object to be tested; A liveness detection module, used to extract features from the original image based on a preconfigured liveness detection model, and predict a liveness classification result of the object to be detected based on the extracted features; The liveness detection model is configured to extract and fuse features of a set of input training images respectively, and predict the ability of the liveness classification result of each training image in the set of training images based on the fused features, wherein the set of training images includes a liveness training image and a prosthesis training image; The device also includes: A cropping module, used for cropping the central area of the original image to obtain a central area cropped image; An illumination change module, used for performing illumination change on the original image to obtain an illumination change image; A prediction result module, used for inputting the central area cropped image and the light brightness change image into the living body detection model in sequence, and obtaining the living body classification result of the central area cropped image and the living body classification result of the light brightness change image; The device also includes: A weighted summation module, configured to perform weighted summation on the living body classification result of the original image, the living body classification result of the central region cropped image, and the living body classification result of the light illumination variation image to obtain a first prediction result; A voting module, used for voting on the living body classification result of the original image, the living body classification result of the central area cropped image and the living body classification result of the light illumination change image to obtain a second prediction result; A comparison module, used for comparing the first prediction result with the second prediction result; a first prediction module, configured to use the first prediction result or the second prediction result as a final prediction result of the living body detection model if the first prediction result is the same as the second prediction result; The second prediction module is used to use the living body classification result of the original image as the final prediction result of the living body detection model if the first prediction result is different from the second prediction result.
6. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method according to any one of claims 1 to 4.
7. A computer device, characterized in that: The computer device stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the liveness detection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Human face living body detection method, system and device, computer equipment and storage medium
CN111680675A
Infrared image processing and living body detection method and device
CN114155580A
Illumination scene self-adaptive palm anti-counterfeiting method, device and equipment and storage medium
CN114373195A