IP Library Granted Patent US 12676027
Granted Patent B2
US 12676027 · App. 18/624,724 · Granted Jul 7, 2026

Image liveness detection method and device

Inventors: Liang Gao (Chongqing, CN); Xunyi Zhou (Chongqing, CN); Dingheng Zeng (Chongqing, CN)
Assignee: MaShang Consumer Finance Co., Ltd.
G06V40/40G06T7/12G06V10/44G06V10/806G06V20/70
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12676027
App. No.
18/624,724
Granted
Jul 7, 2026
Kind
B2
Abstract

Embodiments of the disclosure provide an image liveness detection method and device. The method includes: performing semantic segmentation processing on a to-be-detected image to obtain a first masked image corresponding to a medium image block in the to-be-detected image; performing a biometric recognition on the to-be-detected image to obtain boundary information of a biometric image block in the to-be-detected image; performing pixel processing on the to-be-detected image based on the boundary information to obtain a second masked image corresponding to the biometric image block; obtaining, through calculation, a degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image; determining a liveness detection result of the to-be-detected image according to the degree of overlap.

Claims (74)

1 . An image liveness detection method, comprising:

performing semantic segmentation processing on a to-be-detected image to obtain a first masked image corresponding to a medium image block in the to-be-detected image;

performing a biometric recognition on the to-be-detected image to obtain boundary information of a biometric image block in the to-be-detected image;

processing pixels of the to-be-detected image based on the boundary information to obtain a second masked image corresponding to the biometric image block;

obtaining, through calculation, a degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image; and

determining a liveness detection result of the to-be-detected image according to the degree of overlap,

wherein the performing the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image comprises: inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a first encoder and a first decoder; and wherein the first encoder performs feature extraction on a spoofing medium in the to-be-detected image to obtain a medium feature corresponding to the spoofing medium, and the first decoder performs semantic segmentation on the to-be-detected image based on the medium feature to obtain the first masked image, or wherein the performing the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image comprises:

inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a second encoder, a second decoder and an image processor; and

wherein the second encoder is configured to perform layer-wise feature extraction and down-sampling on a spoofing medium in the to-be-detected image to obtain semantic features of respective layers; the second decoder is configured to fuse the semantic features of the respective layers and perform up-sampling, to obtain an up-sampled image having a same size as the to-be-detected image; the image processor is configured to perform discretization processing on the up-sampled image to obtain a grayscale image, and perform binarization processing on the grayscale image to obtain the first masked image.

2 . The method according to claim 1 , wherein the obtaining, through the calculation, the degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image comprises:

determining an intersection image block and a union image block between the medium image block and the biometric image block;

calculating a first image block area of the intersection image block, and calculating a second image block area of the union image block; and

calculating a ratio of the first image block area to the second image block area as the degree of overlap.

3 . The method according to claim 1 , wherein, the obtaining, through the calculation, the degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image comprises:

determining an intersection image block and a union image block between the medium image block and the biometric image block;

calculating a number of intersection pixels in the intersection image block, and calculating a number of union pixels in the union image block; and

calculating a ratio of the number of intersection pixels to the number of union pixels as the degree of overlap.

4 . The method according to claim 1 , wherein the determining the liveness detection result of the to-be-detected image according to the degree of overlap comprises:

in response that the degree of overlap is greater than or equal to a preset degree-of-overlap threshold, determining the to-be-detected image as a spoofing image; and

in response that the degree of overlap is less than the preset degree-of-overlap threshold, determining the to-be-detected image as a live image.

5 . The method according to claim 1 , wherein the determining the liveness detection result of the to-be-detected image according to the degree of overlap comprises:

in response that the degree of overlap is greater than or equal to a preset degree-of-overlap threshold, calculating an area of the medium image block and an area of the biometric image block;

in response that the area of the biometric image block is greater than or equal to the area of the medium image block, determining the to-be-detected image as a live image; and

in response that the area of the biometric image block is less than the area of the medium image block, determining the to-be-detected image as a spoofing image.

6 . The method according to claim 1 , wherein the performing the biometric recognition on the to-be-detected image to obtain the boundary information of the biometric image block in the to-be-detected image comprises:

inputting the to-be-detected image into a biometric recognition module for performing the biometric recognition to obtain the biometric image block; and

constructing the boundary information according to position information of a boundary pixel of the biometric image block in the to-be-detected image.

7 . The method according to claim 6 , wherein the processing the pixels of the to-be-detected image based on the boundary information to obtain the second masked image corresponding to the biometric image block comprises:

determining a target image block in the to-be-detected image based on the boundary information, wherein the to-be-detected image comprises the target image block and the biometric image block;

binarizing pixels in the biometric image block in terms of their pixel values and pixels in the target image block in terms of their pixel values to obtain the second masked image; and

wherein the pixels in the biometric image block that are binarized in terms of their pixel values are determined to be of a first pixel value, and the pixels in the target image block that are binarized in terms of their pixel values are determined to be of a second pixel value.

8 . The method according to claim 1 , wherein the feature extraction comprises: N times of down-sampling processing, N≥1, 2, 3 . . . , and N is a positive integer; and

the semantic segmentation comprises: N times of up-sampling processing, and discretization processing on a result of the up-sampling processing to obtain a grayscale image, and binarization processing on the grayscale image.

9 . The method according to claim 1 , wherein the semantic segmentation model is trained in a mode comprising:

constructing an image sample dataset according to a spoofing medium image;

preprocessing an image sample data in the image sample dataset; wherein the preprocessing comprises data augmentation processing; and

performing model training on an initial semantic segmentation model based on the preprocessed image sample dataset to obtain the semantic segmentation model.

10 . The method according to claim 9 , wherein the constructing the image sample dataset according to the spoofing medium image comprises:

acquiring the spoofing medium image;

removing, from the spoofing medium image, a spoofing medium image unconformable to a preset requirement; and

labelling a medium image block and a target image block for the spoofing medium image after the removal, to generate the image sample dataset.

11 . The method according to claim 1 , wherein the processing the pixels of the to-be-detected image based on the boundary information to obtain the second masked image corresponding to the biometric image block comprises:

judging, based on the boundary information, whether the biometric image block conforms to a preset feature rule;

in a case that the biometric image block conforms to the preset feature rule, processing the pixels of the to-be-detected image based on the boundary information to obtain the second masked image corresponding to the biometric image block;

wherein the preset feature rule comprises at least one of: being greater than a reflectance threshold, there being an artifact, there being a Moiré pattern, and there being a specular reflection.

12 . The method according to claim 1 , wherein after performing the biometric recognition on the to-be-detected image to obtain the boundary information of the biometric image block in the to-be-detected image, the method further comprises:

in a case that boundary information of a plurality of biometric image blocks is detected, calculating an area of each of the biometric image blocks according to the boundary information; and

determining a biometric image block having a largest area, and removing all biometric image blocks except for the biometric image block having the largest area.

13 . The method according to claim 1 , wherein the medium image block refers to a spoofing medium area or a spoofing medium range of a spoofing medium in the to-be-detected image.

14 . The method according to claim 13 , wherein the spoofing medium refers to a medium of a biometric facsimile spoofing a real person's identity.

15 . An image liveness detection device, comprising:

a processor, and

a memory, configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor is caused to:

perform semantic segmentation processing on a to-be-detected image to obtain a first masked image corresponding to a medium image block in the to-be-detected image;

perform a biometric recognition on the to-be-detected image to obtain boundary information of a biometric image block in the to-be-detected image;

process pixels of the to-be-detected image based on the boundary information to obtain a second masked image corresponding to the biometric image block;

obtain, through calculation, a degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image; and

determine a liveness detection result of the to-be-detected image according to the degree of overlap,

wherein the processor is configured to execute the computer executable instructions to perform the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image by inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a first encoder and a first decoder; and wherein the first encoder performs feature extraction on a spoofing medium in the to-be-detected image to obtain a medium feature corresponding to the spoofing medium, and the first decoder performs semantic segmentation on the to-be-detected image based on the medium feature to obtain the first masked image, or

wherein the processor is configured to execute the computer executable instructions to perform the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image by:

inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a second encoder, a second decoder and an image processor; and

wherein the second encoder is configured to perform layer-wise feature extraction and down-sampling on a spoofing medium in the to-be-detected image to obtain semantic features of respective layers; the second decoder is configured to fuse the semantic features of the respective layers and perform up-sampling, to obtain an up-sampled image having a same size as the to-be-detected image; the image processor is configured to perform discretization processing on the up-sampled image to obtain a grayscale image, and perform binarization processing on the grayscale image to obtain the first masked image.

16 . A non-transitory computer-readable storage medium configured to store computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the following is implemented:

performing semantic segmentation processing on a to-be-detected image to obtain a first masked image corresponding to a medium image block in the to-be-detected image;

performing a biometric recognition on the to-be-detected image to obtain boundary information of a biometric image block in the to-be-detected image;

processing pixels of the to-be-detected image based on the boundary information to obtain a second masked image corresponding to the biometric image block;

obtaining, through calculation, a degree of overlap between the medium image block and the biometric image block based on the first masked image and the second masked image; and

determining a liveness detection result of the to-be-detected image according to the degree of overlap,

wherein the performing the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image comprises: inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a first encoder and a first decoder; and wherein the first encoder performs feature extraction on a spoofing medium in the to-be-detected image to obtain a medium feature corresponding to the spoofing medium, and the first decoder performs semantic segmentation on the to-be-detected image based on the medium feature to obtain the first masked image, or wherein the performing the semantic segmentation processing on the to-be-detected image to obtain the first masked image corresponding to the medium image block in the to-be-detected image comprises:

inputting the to-be-detected image into a semantic segmentation model, wherein the semantic segmentation model comprises a second encoder, a second decoder and an image processor; and

wherein the second encoder is configured to perform layer-wise feature extraction and down-sampling on a spoofing medium in the to-be-detected image to obtain semantic features of respective layers; the second decoder is configured to fuse the semantic features of the respective layers and perform up-sampling, to obtain an up-sampled image having a same size as the to-be-detected image; the image processor is configured to perform discretization processing on the up-sampled image to obtain a grayscale image, and perform binarization processing on the grayscale image to obtain the first masked image.

17 . The method according to claim 1 , wherein performing semantic segmentation processing on a to-be-detected image to obtain a first masked image corresponding to a medium image block in the to-be-detected image comprises:

performing semantic segmentation processing on the to-be-detected image to perform pixel classification on a medium image block of a spoofing medium in the to-be-detected image and remaining areas except for the medium image block to obtain the first masked image containing the medium image block,

wherein the medium image block refers to a spoofing medium area or a spoofing medium range of the spoofing medium in the to-be-detected image, and the spoofing medium refers to a medium of a biometric facsimile spoofing a real person's identity.