In an embodiment, the extracting background feature data from an extended facial image includes: determining a facial region in the target image; extending the facial region to obtain an extended facial region; obtaining an extended facial image in the target image along the extended facial region; and inputting the extended facial image into a second recognition model, and extracting background feature data of the extended facial image through the second recognition model.
In an embodiment, the inputting the extended facial image into a second recognition model and extracting background feature data of the extended facial image through the second recognition model include: inputting the extended facial image into the second recognition model; and extracting background feature data of the extended facial image through a convolution layer of the second recognition model. The performing face liveness recognition according to the background feature data to obtain a second confidence level includes: classifying the target image through a fully connected layer of the second recognition model according to the extracted background feature data to obtain a second confidence level of the target image being a live facial image.
In an embodiment, when executed by a processor, the computer program further causes the processor to perform the following operations: obtaining an image sample set, where the image sample set includes a live facial image and a non-live facial image; obtaining an extended facial image in a corresponding image sample along an extended facial region of each image sample in the image sample set to obtain a second training sample; and training the second recognition model according to the second training sample.