In an embodiment, the inputting the facial image into a first recognition model and extracting facial feature data of the facial image through the first recognition model include: inputting the facial image into the first recognition model; and extracting facial feature data of the facial image through a convolution layer of the first recognition model. The performing face liveness recognition according to the facial feature data to obtain a first confidence level includes: classifying the target image through a fully connected layer of the first recognition model according to the extracted facial feature data to obtain a first 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 a facial image in a corresponding image sample along a facial region of each image sample in the image sample set to obtain a first training sample; and training the first recognition model according to the first training sample.
In an embodiment, the training the first recognition model according to the first training sample includes: obtaining an initialized first recognition model; determining a first training label corresponding to the first training sample; inputting the first training sample into the first recognition model to obtain a first recognition result; and adjusting model parameters of the first recognition model according to a difference between the first recognition result and the first training label, and continuing training until satisfaction of a training stop condition.