Image processing method, device, apparatus and storage medium

By decoupling and mixing sample image features from the liveness detection model, a new liveness detection model is constructed, which solves the problem of insufficient accuracy in liveness recognition of existing models and achieves higher liveness detection accuracy and generalization ability.

CN117011947BActive Publication Date: 2025-12-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210894727.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2025-12-23
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

Existing liveness detection models are not accurate enough in face recognition and are unable to effectively distinguish between live and non-live individuals.

Method used

By decoupling the liveness features and domain features of sample images and performing multi-domain hybrid processing, a liveness detection model is constructed by training the feature extraction and liveness discrimination modules, reducing domain feature interference and improving discrimination accuracy.

Benefits of technology

It improves the accuracy of liveness detection, enhances the model's image recognition capabilities under different environments and attack methods, and improves the generalization ability of liveness detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117011947B_ABST
    Figure CN117011947B_ABST
Patent Text Reader

Abstract

The application discloses an image processing method, device and equipment and a storage medium, and related embodiments thereof can be applied to artificial intelligence and the like. The method comprises: extracting living body features and domain features of each first sample image through a feature extraction module; generating a reference image based on the mixed domain features and the living body features of the first sample image obtained through multi-domain mixed processing, and extracting living body features of the reference image; obtaining a living body discrimination result through living body discrimination processing of the living body features by a living body discrimination module; and constructing a living body detection model by using the differences between the living body discrimination result of each first sample image and the corresponding original living body label, and the differences between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and training the feature extraction module and the living body discrimination module to obtain a trained feature extraction module and a trained living body discrimination module. The accuracy of the living body detection model in living body detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of artificial intelligence, and in particular to an image processing method and device, equipment and a storage medium. BACKGROUND

[0002] In the field of computer vision, face recognition is widely used in resource transfer, access control verification and other scenarios, and live body detection is an extremely important part of the face recognition process. Live body detection can be regarded as a binary classification task, that is, to determine whether the face object in the image is a live body or a non-live body. The live body detection model is a common method for live body detection. Therefore, how to improve the accuracy of live body detection, that is, how to improve the accuracy of live body detection by the live body detection model has become a research hotspot. SUMMARY

[0003] The embodiments of the present application provide an image processing method, device, equipment, storage medium and computer program product, which can improve the accuracy of live body detection by the live body detection model.

[0004] In one aspect, the embodiments of the present application provide an image processing method, comprising:

[0005] Obtaining a plurality of first sample images and original live body labels of target objects in each first sample image; the original live body label is used to indicate whether the target object is a live body or a non-live body when imaging;

[0006] Extracting live body features of the plurality of first sample images and domain features of the plurality of first sample images by a feature extraction module in a live body detection training model; the live body feature is used to represent a feature for determining whether the target object is a live body or a non-live body when imaging, and the domain feature is used to represent a feature that causes misjudgment of whether the target object is a live body or a non-live body when imaging;

[0007] Performing multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain a mixed domain feature of the any first sample image;

[0008] Generating a reference image corresponding to the any first sample image based on the live body feature and the mixed domain feature of the any first sample image;

[0009] Extracting a live body feature of the reference image corresponding to the any first sample image by the feature extraction module;

[0010] The processing unit is further configured to perform living body discrimination processing on the living body features of any first sample image and the living body features of the corresponding reference image respectively by using a living body discrimination module in the living body detection training model, to obtain a living body discrimination result of the any first sample image and a living body discrimination result of the corresponding reference image.

[0011] The feature extraction module and the living body discrimination module are trained based on differences between the living body discrimination results of the first sample images and the original living body labels, and differences between the living body discrimination results of the first sample images and the living body discrimination results of the corresponding reference images, and a living body detection model is constructed based on the trained feature extraction module and the trained living body discrimination module. The living body detection model is used for living body detection on a target image to be detected.

[0012] In one aspect, an image processing apparatus is provided, comprising:

[0013] The acquisition unit is configured to acquire a plurality of first sample images and original living body labels of target objects in the first sample images. The original living body label is used to indicate whether the target object is a living body or a non-living body when imaging.

[0014] The processing unit is configured to extract living body features of the first sample images and domain features of the first sample images respectively by using a feature extraction module in a living body detection training model. The living body features are used to represent features for determining whether the target object is a living body or a non-living body when imaging, and the domain features are used to represent features that cause misjudgment of whether the target object is a living body or a non-living body when imaging.

[0015] The processing unit is further configured to perform multi-domain mixing processing on the domain features of any first sample image and the domain features of other first sample images in the plurality of first sample images, to obtain mixed domain features of the any first sample image.

[0016] The processing unit is further configured to generate a reference image corresponding to the any first sample image based on the living body features and the mixed domain features of the any first sample image.

[0017] The processing unit is further configured to extract living body features of the reference image corresponding to the any first sample image by using the feature extraction module.

[0018] The processing unit is further configured to perform living body discrimination processing on the living body features of any first sample image and the living body features of the corresponding reference image respectively by using a living body discrimination module in the living body detection training model, to obtain a living body discrimination result of the any first sample image and a living body discrimination result of the corresponding reference image.

[0019] The processing unit is further configured to train the feature extraction module and the living body discrimination module based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, and a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and construct a living body detection model based on the trained feature extraction module and the trained living body discrimination module; the living body detection model is configured to perform living body detection on a target image to be subjected to living body detection.

[0020] In an aspect, an embodiment of the present application provides an image processing device, characterized in that the image processing device comprises an input interface and an output interface, and further comprises:

[0021] a processor adapted to implement one or more instructions; and

[0022] a computer storage medium storing one or more instructions, the one or more instructions being adapted to be loaded and executed by the processor to implement the image processing method.

[0023] In an aspect, an embodiment of the present application provides a computer storage medium, characterized in that the computer storage medium stores computer program instructions, and the computer program instructions are executed by a processor to implement the image processing method.

[0024] In an aspect, an embodiment of the present application provides a computer program product, which comprises a computer program stored in a computer storage medium; a processor of an image processing device reads the computer program from the computer storage medium, and the processor executes the computer program to enable the image processing device to implement the image processing method.

[0025] In the embodiment of the present application, the first sample image used for training is decoupled into a living body feature used for determining whether the target object in the first sample image is a living body or a non-living body when imaged, and a domain feature that causes misjudgment of the target object as a living body or a non-living body when imaged, to train the feature extraction module and the living body discrimination module in the living body detection training model, so that the living body detection model constructed based on the trained feature extraction module and the trained living body discrimination module can predict the living body discrimination result of the target image based on the living body feature of the decoupled target image when performing living body detection on the target image, can reduce the interference of the domain feature, and improve the accuracy of the living body discrimination result of the target image, that is, improve the accuracy of living body detection; by performing multi-domain mixed processing on the domain feature of the first sample image, and generating a corresponding reference image based on the mixed domain feature obtained after the multi-domain mixed processing and the living body feature, the diversity of the training samples (that is, the reference images that can be used for training are increased) can be increased without introducing domain labels, and then the feature extraction module and the living body discrimination module can be trained based on the difference between the living body discrimination result of the first sample image and the corresponding original living body label, and the difference between the living body discrimination result of the first sample image and the living body discrimination result of the corresponding reference image, so that the training effect of the feature extraction module and the living body detection module can be improved, that is, the accuracy of the living body detection model when performing living body detection can be improved. BRIEF DESCRIPTION OF DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0027] Figure 1 is a structural schematic diagram of a living body detection training model provided by an embodiment of the present application;

[0028] Figure 2 is a structural schematic diagram of a depth estimation network provided by an embodiment of the present application;

[0029] Figure 3 is a flowchart of an image processing method provided by an embodiment of the present application;

[0030] Figure 4 is a schematic diagram of cropping an image region containing a face in a video frame provided by an embodiment of the present application;

[0031] Figure 5 is a schematic diagram of multi-domain mixed processing provided by an embodiment of the present application;

[0032] Figure 6 is a schematic diagram of processing a first sample image by a living body detection training model provided by an embodiment of the present application;

[0033] Figure 7 is a flowchart of another image processing method provided by an embodiment of the present application;

[0034] Figure 8 is a schematic diagram of processing a first sample image by a living body detection training model provided by another embodiment of the present application;

[0035] Figure 9 is a structural schematic diagram of an image processing device provided by an embodiment of the present application;

[0036] Figure 10 is a structural schematic diagram of an image processing device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0037] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0038] Artificial intelligence (AI) is to use digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0039] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology (CV), speech processing technology, natural language processing technology, and machine learning (ML) / deep learning (DL) and other major directions.

[0040] Among them, computer vision is a science that studies how to make machines "see", and further refers to using cameras and computers to replace human eyes to identify, determine and measure targets and other machine vision, and further do image processing, so that the computer processing becomes more suitable for human eye observation or image transmission to instrument detection. As a scientific discipline, computer vision studies related theories and technologies, trying to establish artificial intelligence systems that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, face recognition, image semantic understanding, image retrieval, optical character recognition (Optical Character Recognition, OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional (3-dimensional, 3D) technology, three-dimensional object reconstruction, virtual reality, augmented reality, simultaneous localization and mapping, etc.

[0041] Based on the above-mentioned computer vision technology, the embodiment of the application provides an image processing scheme; after obtaining a plurality of first sample images and original living body labels of target objects in each first sample image, the living body feature and the domain feature of each first sample image are extracted through the feature extraction module in the living body detection training model, the domain feature of any first sample image is multi-domain mixed with the domain feature of other first sample images in the plurality of first sample images, the mixed domain feature of the any first sample image is obtained, and the reference image corresponding to the any first sample image is generated based on the living body feature and the mixed domain feature of the any first sample image; the living body feature of the reference image corresponding to the any first sample image is extracted through the feature extraction module, and the living body discrimination module in the living body detection training model is used to respectively perform living body discrimination processing on the living body feature of the any first sample image and the living body feature of the corresponding reference image, to obtain the living body discrimination result of the any first sample image and the living body discrimination result of the corresponding reference image; and then the feature extraction module and the living body discrimination module can be trained based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the living body detection model is constructed based on the trained feature extraction module and the trained living body discrimination module; wherein the living body detection model can be used for living body detection on a target image to be detected.

[0042] The target object can be a face object. Alternatively, the target object can be any kind of biological object, for example, the target object can be a cat, a dog, a horse, or the like. The live body detection model trained by using the first sample images including the target objects of different kinds of biological objects is used to perform live body detection on a target image including a target object of a corresponding kind of biological object. For example, the live body detection model trained by using the first sample images including the target objects of face objects is used to perform live body detection on a target image including a target object of a face object. The live body detection model trained by using the first sample images including the target objects of cats is used to perform live body detection on a target image including a target object of a cat. For ease of description, the target object is a face object in the following description of the embodiments of the present application. That is, the target object in any image can refer to a face object in the corresponding image.

[0043] The original living body label is used to indicate whether the target object is a living body or a non-living body when the target object is imaged. That is, the original living body label of the target object in any first sample image is used to indicate whether the target object is a living body or a non-living body when the target object is imaged in the first sample image, wherein the imaging time of the target object in the first sample image is also the imaging time of the first sample image. For example, if the target object in the first sample image A1 is a face object, the face object is obtained by directly shooting the face of the object a, and the target object in the first sample image A1 is a living body when imaged. For another example, if the target object in the first sample image A2 is a face object, the face object is obtained by shooting a face photo containing the face of the object a, and the target object in the first sample image A2 is a non-living body when imaged. For another example, if the target object in the first sample image A3 is a face object, the face object is obtained by shooting a face video containing the face of the object a, and the target object in the first sample image A3 is a non-living body when imaged. Further, the object imaged as a living body can be referred to as a living body object, and the object imaged as a non-living body can be referred to as an attack object. For example, the target object in the first sample image A1, i.e. the face object in the first sample image A1, can be referred to as a living body object, the target object in the first sample image A2, i.e. the face object in the first sample image A2, can be referred to as an attack object, and the target object in the first sample image A3, i.e. the face object in the first sample image A3, can be referred to as an attack object. Further, the attack object can be divided into different types of attack objects due to different attack methods. For example, the first sample image A2 collected (i.e. shot) by shooting a photo is a photo attack, and the attack object is a photo type attack object. The first sample image A3 collected (i.e. shot) by shooting a video is a video attack, and the attack object is a video type attack object.

[0044] The living body feature is used to represent: a feature used to determine whether the target object is a living body or a non-living body when the target object is imaged. The domain feature is used to represent: a feature that causes a misjudgment of whether the target object is a living body or a non-living body when the target object is imaged. That is, the living body feature is used to represent: a feature related to living body determination, and the domain feature is used to represent: a feature unrelated to living body determination. Generally, due to different types of attack objects (i.e., different attack methods) or different environments (e.g., different lighting, different camera performance, etc.) when the target object is imaged, the images collected will be different. For example, the first sample image A1, the second sample image A2, and the third sample image A3 are all images including the face of the object a, but due to different influencing factors when imaging, there are differences between the first sample image A1, the second sample image A2, and the third sample image A3. Further, the differences between the images due to different types of attack objects and different environments when the target object is imaged can be collectively referred to as the domain of the images, and the related features can be domain features.

[0045] The living body detection model trained based on the image processing scheme proposed in the present application can be used for living body detection of a target image to be detected, that is, can be used to determine whether the target object in the target image is a living body or a non-living body when the target object is imaged. When the target object is a face object, the living body detection model can be applied to various application scenarios that require face living body verification, for example, the living body detection model can be applied to resource transfer scenarios, object verification scenarios, and access control verification scenarios. For example, in a resource transfer scenario, if an object submits a resource transfer request, the living body detection model can be called to perform living body detection on the collected target image including the face, to obtain a living body determination result of the target image. If the living body determination result of the target image indicates that the target object in the target image is a living body, face recognition processing can be performed on the target object in the target image to obtain a face recognition result. If the face recognition result indicates that the target object in the target image is the object that submitted the resource transfer request, the resource transfer request submitted by the object can be responded to, and the resource can be transferred. For another example, in an access control verification scenario, when an object has a door opening demand, the living body detection model can be called to perform living body detection on the collected target image including the face, to obtain a living body determination result of the target image. If the living body determination result of the target image indicates that the target object in the target image is a living body, face recognition processing can be performed on the target object in the target image to obtain a face recognition result. If the face recognition result indicates that the target object in the target image is the object that has the door opening demand, the door can be opened for the object.

[0046] In an embodiment, the living body detection model is constructed based on a trained feature extraction module and a trained living body discrimination module, the trained feature extraction module and the trained living body discrimination module are obtained by training the feature extraction module and the living body discrimination module in the living body detection training model, the trained feature extraction module has the same model structure as the feature extraction module but different model parameters, and the trained living body discrimination module has the same model structure as the living body discrimination module but different model parameters. See Figure 1 A structural diagram of a living body detection training model provided by an embodiment of the present application can include a feature extraction module and a living body discrimination module. The feature extraction module can be used to extract living body features and domain features of an image. The living body discrimination module can be used to perform living body discrimination processing on the living body features of the image to obtain a living body discrimination result of the image. Optionally, the living body detection training model can further include an image generation module and a multi-domain mixing module. The image generation module can be used to generate images, including generating a reference image corresponding to any first sample image. The multi-domain mixing module can be used to perform multi-domain mixing processing on any first sample image to generate mixed domain features of the first sample image. Optionally, the feature extraction module, the living body discrimination module, the image generation module, and the multi-domain mixing module can be any neural network model that can realize the corresponding functions, which can be adaptively selected and designed according to specific requirements, and the embodiments of the present application do not make any limitation. For example, the feature extraction module can be an encoder, and the image generation module can be a decoder. The encoder and the decoder can use a deep convolutional network model with good performance in the industry (for example, a depth estimation network, i.e., DepthNet). The living body discrimination module can be a binary classification model. The multi-domain mixing module can include an attention weight determination sub-module, which is used to determine the attention weight required for generating the mixed domain features of any first sample image. Optionally, the attention weight determination sub-module can be a graph attention network (GAT), a graph neural network (GCN), or a self-attention mechanism (Self-Attention) network. See Figure 2 A structural diagram of a depth estimation network provided by an embodiment of the present application.

[0047] In specific implementations, the image processing scheme proposed in the present application can be executed by an image processing device, which can be a terminal device or a server. The terminal device can include, but is not limited to, a computer, a smartphone, a tablet computer, a notebook computer, a smart home appliance, a vehicle-mounted terminal, a smart wearable device, etc. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0048] It should be particularly noted that in the specific embodiments of the present application, data related to objects are involved, for example, the first sample image including a target object of a face object, the target image including a target object of a face object, etc. When the embodiments of the present application are applied to specific products or technologies, the permission or consent of the object needs to be obtained, and the collection, use and processing of the related data need to comply with the local laws, regulations and standards.

[0049] Based on the above image processing scheme, the embodiments of the present application provide an image processing method. Referring to Figure 3 , a flowchart of an image processing method provided by the embodiments of the present application is shown. Figure 3 The image processing method shown can be executed by an image processing device or any electronic device with computing power. The embodiments of the present application are described based on the execution by the image processing device. Figure 3 The image processing method shown can include the following steps:

[0050] S301, a plurality of first sample images and original living body labels of target objects in each first sample image are obtained.

[0051] The original living body label is used to indicate whether the target object is a living body or a non-living body when imaging.

[0052] In an embodiment, if the target object is a face object, the first sample image is an image including the face object; optionally, the first sample image can be an image based on a red-green-blue color mode (i.e., an RGB image), or an image based on a hue, saturation, and value color mode (i.e., an HSV image), and the like, and the present embodiment is not limited thereto. For ease of description, the present embodiment is described below with the first sample image being an RGB image. Further, the image sizes of the first sample images are the same, and the image size can be set according to specific requirements, for example, the image size of the first sample image can be set to 256 pixels * 256 pixels, 512 pixels * 512 pixels, and the like.

[0053] Further, the first sample image can be obtained from any suitable channel, for example, the face can be directly photographed to obtain the first sample image including the face object, or a video frame containing the face can be extracted from a video to obtain the first sample image including the face object. In a specific implementation, the manner of obtaining the first sample image from the sample video can include: extracting a video frame from the sample video, performing face detection processing on any video frame extracted, cropping the image region containing the face in the detected video frame, scaling the cropped image region to obtain a face image of a preset image size, and taking the face image of the preset image size as the first sample image. The video frame can be extracted from the sample video according to a preset extraction rule, which can be set according to specific requirements. For example, the preset extraction rule can indicate that the preset video frame of the sample video is the starting video frame, and the video frame is extracted every preset number of video frames, and the preset video frame and the preset number of video frames can be set according to specific requirements. If the preset video frame is the first video frame and the preset number of video frames is 4, the preset extraction rule can indicate that the first video frame of the sample video is the starting video frame, and the video frame is extracted every 4 frames. If the sample video includes 20 video frames, the extracted video frames can be the first video frame, the sixth video frame, the eleventh video frame, and the sixteenth video frame. Figure 4 A schematic diagram of cropping an image region containing a face in a video frame provided by the present embodiment is shown in FIG. 4. If one video frame extracted from a sample video is shown as indicated by 401, the image region containing the face in the detected video frame can be shown as indicated by 402, and the cropped image region can be shown as indicated by 403.

[0054] In S302, the feature extraction module in the living body detection model is used to extract the living body features of each first sample image and the domain features of each first sample image, respectively.

[0055] The living body feature is used to represent a feature for determining whether the target object is a living body or a non-living body in imaging, and the domain feature is used to represent a feature that causes misjudgment of whether the target object is a living body or a non-living body in imaging.

[0056] In an embodiment, taking extracting the living body feature and the domain feature of any sample image as an example, the image processing device extracts the living body feature and the domain feature of any first sample image through the feature extraction module, which can include: performing image feature extraction processing on the any first sample image through the feature extraction module to obtain the image feature of the any first sample image; performing living body feature extraction processing on the image feature of the any first sample image to obtain the living body feature of the any first sample image; and performing domain feature extraction processing on the image feature of the any first sample image to obtain the domain feature of the any first sample image. In a feasible implementation, the image feature of the any first sample image can be extracted by an encoder included in the feature extraction module, and then the living body feature and the domain feature of the any first sample image can be extracted from the image feature of the any first sample image by two independent deep encoders, respectively. In another feasible implementation, after the image feature of the any first sample image is extracted, the image feature of the any first sample image can be divided into two features with equal dimensions according to the dimensions, and one of the two features can be taken as the living body feature of the any first sample image, and the other feature can be taken as the domain feature of the any first sample image.

[0057] In an embodiment, taking extracting the living body feature and the domain feature of any sample image as an example, the image processing device extracts the living body feature and the domain feature of any first sample image through the feature extraction module, which can include: performing image feature extraction processing on the any first sample image through the feature extraction module to obtain the image feature of the any first sample image; performing living body feature extraction processing on the image feature of the any first sample image to obtain the living body feature of the any first sample image; and performing domain feature extraction processing on the image feature of the any first sample image to obtain the domain feature of the any first sample image. In a feasible implementation, the image feature of the any first sample image can be extracted by an encoder included in the feature extraction module, and then the living body feature and the domain feature of the any first sample image can be extracted from the image feature of the any first sample image by two independent deep encoders, respectively. In another feasible implementation, after the image feature of the any first sample image is extracted, the image feature of the any first sample image can be divided into two features with equal dimensions according to the dimensions, and one of the two features can be taken as the living body feature of the any first sample image, and the other feature can be taken as the domain feature of the any first sample image.

[0058] In an embodiment, the image processing device performs multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain the mixed domain feature of the any first sample image, which can include: determining a target neighbor image of the any first sample image from the other first sample images, the similarity between the domain feature of any target neighbor image and the domain feature of the any first sample image being greater than the similarity between the domain feature of each of the remaining first sample images and the domain feature of the any first sample image; adjusting the domain feature of the any first sample image by using the attention weight of the any first sample image to obtain the adjusted domain feature of the any first sample image, and adjusting the domain features of the respective target neighbor images by using the attention weights of the respective target neighbor images to obtain the adjusted domain features of the respective target neighbor images; and determining the mixed domain feature of the any first sample image based on the adjusted domain feature of the any first sample image and the adjusted domain features of the respective target neighbor images.

[0059] In specific implementations, the image processing device can first determine the similarity between the domain feature of any one of the first sample images and the domain feature of other first sample images, and then determine the target neighbor image of the any one of the first sample images from the other first sample images based on the similarity. The similarity between the domain feature of any one of the first sample images and the domain feature of other first sample images can be a cosine similarity, or a similarity determined based on a feature distance between the domain feature of any one of the first sample images and the domain feature of other first sample images. The feature distance can be an Euclidean distance, a Manhattan distance, a Hamming distance, etc., which is not limited in the embodiments of the present application.

[0060] In a possible implementation, when the image processing device determines the target neighbor image of the any one of the first sample images from the other first sample images based on the similarity, the image processing device can determine the first sample image with a similarity greater than a preset similarity as the target neighbor image of the any one of the first sample images from the other first sample images. The preset similarity can be set according to specific requirements. For example, if there are four first sample images, i.e., a first sample image A1, a first sample image A2, a first sample image A3, and a first sample image A4, and the similarity between the domain features of the four first sample images is shown in Table 1:

[0061] A1 A2 A3 A4 A1 0 0.2 0.6 0.5 A2 0.2 0 1.0 0.9 A3 0.6 1.0 0 1.1 A4 0.5 0.9 1.1 0

[0062] The similarity between the domain feature of the first sample image A2 and the domain feature of the first sample image A1 is 0.2, the similarity between the domain feature of the first sample image A3 and the domain feature of the first sample image A1 is 0.6, and the similarity between the domain feature of the first sample image A4 and the domain feature of the first sample image A1 is 0.5; the similarity between the domain feature of A1 and the domain feature of A2 is 0.2, the similarity between the domain feature of A3 and the domain feature of A2 is 1.0, and the similarity between the domain feature of A4 and the domain feature of A2 is 0.9; the similarity between the domain feature of A1 and the domain feature of A3 is 0.6, the similarity between the domain feature of A2 and the domain feature of A3 is 1.0, and the similarity between the domain feature of A4 and the domain feature of A3 is 1.1; the similarity between the domain feature of A1 and the domain feature of A4 is 0.5, the similarity between the domain feature of A2 and the domain feature of A4 is 0.9, and the similarity between the domain feature of A3 and the domain feature of A4 is 1.1; for the first sample image A1, if the preset similarity is 0.4, the target neighbor image of the first sample image A1 is the first sample image A3 and the first sample image A4; for the first sample image A2, if the preset similarity is 0.6, the target neighbor image of the first sample image A2 is the first sample image A3 and the first sample image A4; for the first sample image A3, if the preset similarity is 0.6, the target neighbor image of the first sample image A3 is the first sample image A2 and the first sample image A4; for the first sample image A4, if the preset similarity is 0.6, the target neighbor image of the first sample image A4 is the first sample image A2 and the first sample image A3.

[0063] In another possible implementation, when the image processing device determines the target neighbor image of the any first sample image from other first sample images based on the similarity, the other first sample images can be arranged in order of similarity from high to low, and a first sample image at a preset arrangement position is selected as the target neighbor image of the any first sample image, where the preset arrangement position can be set according to specific requirements; for example, if there are four first sample images as described above, namely, the first sample image A1, the first sample image A2, the first sample image A3, and the first sample image A4, the similarities between the domain features of the four first sample images can be as shown in Table 1, and if the preset arrangement position is the first two arrangement positions, the target neighbor image of the first sample image A1 is the first sample image A3 and the first sample image A4; the target neighbor image of the first sample image A2 is the first sample image A3 and the first sample image A4; the target neighbor image of the first sample image A3 is the first sample image A2 and the first sample image A4; and the target neighbor image of the first sample image A4 is the first sample image A2 and the first sample image A3.

[0064] Further, the attention weight of any first sample image and the attention weight of each target neighbor image can be determined by the attention weight determination sub-module in the multi-domain mixing module. In a feasible implementation, the image processing device determines the mixed domain feature of any first sample image based on the adjusted domain feature of any first sample image and the adjusted domain feature of each target neighbor image, which can be summing processing the adjusted domain feature of any first sample image and the adjusted domain feature of each target neighbor image to obtain the mixed domain feature of any first sample image.

[0065] In an embodiment, the domain feature of any first sample image is subjected to multi-domain mixing processing with the domain feature of other first sample images in the plurality of first sample images to obtain the mixed domain feature of any first sample image, in order to aggregate the domain features of other first sample images into the domain feature of any first sample image, so that the mixed domain feature of any first sample image has the relevant characteristics of the domain features of other first sample images, and further, based on the mixed domain feature obtained after the multi-domain mixing processing and the living body feature of any first sample image, a corresponding reference image is generated, which has not only the relevant characteristics of the domain feature of any sample image, but also the relevant characteristics of the domain features of other first sample images. Further, based on the generated reference image, the feature extraction module and the living body discrimination module are trained, which can improve the extraction capability of the feature extraction module for the domain feature, so that the trained feature extraction module can accurately extract the domain feature of the target image with different domain features, i.e. the generalization of the model can be improved. See Figure 5 A schematic diagram of multi-domain mixing processing is provided for the embodiments of the present application. If there are four first sample images as described above, i.e. first sample image A1, first sample image A2, first sample image A3 and first sample image A4, the target neighbor images of first sample image A1 are first sample image A3 and first sample image A4; the target neighbor images of first sample image A2 are first sample image A3 and first sample image A4; the target neighbor images of first sample image A3 are first sample image A2 and first sample image A4; and the target neighbor images of first sample image A4 are first sample image A2 and first sample image A3. As shown by the mark 501, the domain feature of first sample image A3 and the domain feature of first sample image A4 are aggregated to the domain feature of first sample image A1. As shown by the mark 502, first sample image A3 and first sample image A4 are aggregated to the domain feature of first sample image A2. As shown by the mark 503, first sample image A2 and first sample image A4 are aggregated to the domain feature of first sample image A3. As shown by the mark 504, first sample image A2 and first sample image A3 are aggregated to the domain feature of first sample image A4.

[0066] S304, generating, based on the living body feature and the mixed domain feature of any first sample image, a reference image corresponding to the any first sample image.

[0067] In an embodiment, the image processing device generates, based on the living body feature and the mixed domain feature of any first sample image, a reference image corresponding to the any first sample image, which can include: performing splicing processing on the living body feature and the mixed domain feature of the any first sample image to obtain spliced image features of the any first sample image; and performing image generation processing based on the spliced image features of the any first sample image to obtain the reference image corresponding to the any first sample image; wherein the process of generating the reference image corresponding to the any first sample image can be implemented by an image generation module.

[0068] S305, extracting, by a feature extraction module, the living body feature of the reference image corresponding to the any first sample image.

[0069] In an embodiment, the image processing device extracts, by the feature extraction module, the living body feature of the reference image corresponding to the any first sample image, and the process is similar to that of extracting the living body feature of the first sample image by the feature extraction module in the living body detection training model, which will not be described again.

[0070] S306, performing, by a living body discrimination module in the living body detection training model, living body discrimination processing on the living body feature of any first sample image and the living body feature of the corresponding reference image respectively to obtain a living body discrimination result of the any first sample image and a living body discrimination result of the corresponding reference image.

[0071] In an embodiment, the living body discrimination result of the any first sample image obtained by the living body discrimination module in the living body detection training model can be a predicted probability that the target object in the any first sample image is imaged as a living body; and the living body discrimination result of the reference image obtained by the living body discrimination module in the living body detection training model can be a predicted probability that the target object in the reference image is imaged as a living body.

[0072] S307, training the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and constructing a living body detection model based on the trained feature extraction module and the trained living body discrimination module.

[0073] In one embodiment, the difference between the living body discrimination result of each first sample image and the corresponding original living body label can be embodied by an original living body discrimination loss value, which can be determined by the living body discrimination result of each first sample image and the corresponding original living body label, and specifically can be determined based on an original living body discrimination loss function, which can be a cross-entropy loss function, and specifically can be shown by the following formula 1:

[0074]

[0075] wherein N represents the number of first sample images, i represents an independent variable, y i represents the original living body label of the i-th first sample image, represents the living body discrimination result of the i-th first sample image, represents the living body discrimination loss value corresponding to the i-th first sample image, that is, when the image processing device determines the original living body discrimination loss value, it can first determine the living body discrimination loss value corresponding to each first sample image based on the living body discrimination result of each first sample image and the corresponding original living body label, and then average process the living body discrimination loss value corresponding to each first sample image to obtain the original living body discrimination loss value. Further, N lr represents the number of first sample images in which the original living body label indicates that the target object is imaged as a living body, that is, the number of positive example first sample images, N lf represents the number of first sample images in which the original living body label indicates that the target object is imaged as a non-living body, that is, the number of negative example first sample images.

[0076] In one embodiment, the difference between the living body discrimination result of each first sample image and the corresponding reference image living body discrimination result can be embodied by a comparison living body discrimination loss value, which can be determined by the living body discrimination result of each first sample image and the corresponding reference image living body discrimination result, and specifically can be determined based on a comparison living body discrimination loss function, which can be a loss function based on KL divergence, and specifically can be shown by the following formula 2:

[0077]

[0078] wherein N represents the number of first sample images, i represents an independent variable, represents the living body discrimination result of the i-th first sample image, represents the living body discrimination result of the reference image corresponding to the i-th first sample image, represents the distribution of the living body discrimination result of the i-th first sample image, a distribution representing a living body discrimination result of a reference image corresponding to the i-th first sample image, a KL divergence value determined based on the living body discrimination result of the i-th first sample image and the living body discrimination result of the corresponding reference image.

[0079] In a specific implementation, the image processing device trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, which can include: training the feature extraction module and the living body discrimination module in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image. Since the difference between the living body discrimination result of each first sample image and the corresponding original living body label can be reflected by the original living body discrimination loss value, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image can be reflected by the contrast living body discrimination loss value, the image processing device can train the feature extraction module and the living body discrimination module in a direction of reducing the original living body discrimination loss value and reducing the contrast living body discrimination loss value. In a feasible implementation, when the living body detection model is constructed based on the trained feature extraction module and the trained living body discrimination module, the trained feature extraction module and the trained living body discrimination module can also be the trained feature extraction module and the trained living body discrimination module included in the trained living body detection training model, that is, the trained living body detection training model can be trained based on the obtained multiple first sample images and the original living body label of the target object in each first sample image, to obtain the trained living body detection training model, and the living body detection model is constructed based on the trained feature extraction module and the trained living body discrimination module included in the trained living body detection training model; when the living body detection training model includes the feature extraction module, the living body discrimination module, the image generation module, and the multi-domain hybrid module, the included feature extraction module, the living body discrimination module, the image generation module, and the multi-domain hybrid module need to be trained.

[0080] In an embodiment, the image processing device can further extract the domain feature of the reference image corresponding to any first sample image through the feature extraction module; at this time, the image processing device can train the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image; wherein the related process of the image processing device for extracting the domain feature of the reference image corresponding to any first sample image through the feature extraction module is similar to the related process of the image processing device for extracting the domain feature of the first sample image through the feature extraction module, and will not be repeated here. Referring to Figure 6 An embodiment of the present application provides a schematic diagram of processing a first sample image through a living body detection training model; first, the living body feature of each first sample image and the domain feature of each first sample image can be extracted through the feature extraction module in the living body detection training model; the domain feature of any first sample image and the domain feature of other first sample images in the plurality of first sample images can be subjected to multi-domain mixed processing through the multi-domain mixed module in the living body detection training model to obtain the mixed domain feature of the any first sample image; the reference image corresponding to the any first sample image can be generated based on the living body feature of the any first sample image and the mixed domain feature through the image generation module in the living body detection training model; the living body feature of the reference image corresponding to the any first sample image and the domain feature of the reference image corresponding to the any first sample image can be extracted through the feature extraction module again; the living body discrimination result of the any first sample image and the living body discrimination result of the corresponding reference image can be obtained by respectively performing living body discrimination processing on the living body feature of the any first sample image and the living body feature of the corresponding reference image through the living body discrimination module in the living body detection training model.

[0081] In an embodiment, the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image can be embodied by a domain feature loss value, which can be determined by the domain feature of each first sample image and the domain feature of the corresponding reference image, and specifically can be determined based on a domain feature loss function, which can be a cosine loss function, and specifically can be shown by the following formula 3:

[0082]

[0083] Wherein, N represents the number of first sample images, i represents an independent variable, d i represents the domain feature of the i-th first sample image, d mix;i represents the domain feature of the reference image corresponding to the i-th first sample image, cos(d i ,d′ mix;i) represents a cosine value between the domain feature of the i-th first sample image and the domain feature of the corresponding reference image.

[0084] In specific implementations, the image processing device trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image, which can include: training the feature extraction module and the living body discrimination module in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and increasing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image. Since the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image can be reflected by the domain feature loss value, and the domain feature loss value can be determined by the cosine value between the domain feature of each first sample image and the domain feature of the corresponding reference image, when the difference between the domain feature of the first sample image and the domain feature of the corresponding reference image is greater, the cosine value between the domain feature of the first sample image and the domain feature of the corresponding reference image is smaller, so the image processing device can train the feature extraction module and the living body discrimination module in a direction of reducing the original living body discrimination loss value, reducing the contrast living body discrimination loss value, and reducing the domain feature loss value. In the process of training the feature extraction module and the living body discrimination module, further introducing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image and training in a direction of increasing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image can achieve the purpose of domain feature diversification and further improve the training effect of the model.

[0085] In an embodiment, the image processing device can further generate, by the image generation module, a reconstructed image corresponding to any first sample image based on the living body feature and the domain feature of the first sample image; at this time, the image processing device can train the feature extraction module and the living body discrimination module based on a difference between the living body discrimination result of each first sample image and the corresponding original living body label, a difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and a difference between each first sample image and the corresponding reconstructed image; wherein the image processing device generates, by the image generation module, the reconstructed image corresponding to any first sample image based on the living body feature and the domain feature of the first sample image, and the process is similar to the process of generating, by the image generation module, the reference image corresponding to any first sample image based on the living body feature and the mixed domain feature of the first sample image, and will not be repeated here.

[0086] In an embodiment, the difference between each first sample image and the corresponding reconstructed image can be embodied by an image reconstruction loss value, which can be determined by each first sample image and the corresponding reconstructed image, and can be determined based on an image reconstruction loss function, which can be specifically shown by the following formula 4:

[0087]

[0088] wherein N represents the number of first sample images, i represents an independent variable, I i represents the i-th first sample image, represents the reconstructed image corresponding to the i-th first sample image, represents the L1 norm of the difference between the pixel value of the reconstructed image corresponding to the i-th first sample image and the pixel value of the i-th first sample image, i.e., the sum of the pixel difference values between the reconstructed image corresponding to the i-th first sample image and the i-th first sample image at the corresponding positions.

[0089] In a specific implementation, the image processing device trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the difference between each first sample image and the corresponding reconstructed image, which can include: training the feature extraction module and the living body discrimination module in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and reducing the difference between each first sample image and the corresponding reconstructed image. Since the difference between each first sample image and the corresponding reconstructed image can be reflected by the image reconstruction loss value, the image processing device can train the feature extraction module and the living body discrimination module in a direction of reducing the original living body discrimination loss value, reducing the contrast living body discrimination loss value, and reducing the image reconstruction loss value. Further introducing the difference between each first sample image and the corresponding reconstructed image and training in a direction of reducing the difference between each first sample image and the corresponding reconstructed image can further improve the training effect of the image generation module, so that the image generation module has stronger image generation capability, that is, the first sample image generated by the image generation module corresponds to a better reference image, and then the feature extraction module and the living body discrimination module are trained based on the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, so that the training effect is better.

[0090] In an embodiment, during the training of the feature extraction module and the living body discrimination module (or the living body detection training model), the image processing device can adaptively introduce one or more of the following differences based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image: the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image, and the difference between each first sample image and the corresponding reconstructed image, to jointly train the feature extraction module and the living body discrimination module (or the living body detection training model). In a feasible implementation, the selected corresponding loss function value can be calculated based on the forward propagation of the first sample image, and then the model parameters can be iteratively updated by an optimization algorithm such as a stochastic gradient descent algorithm (i.e., SGD) or an adaptive random optimization algorithm (i.e., Adam); further optionally, model verification can be performed based on a pre-constructed verification sample set, which includes images different from the first sample images. In an optional implementation, when the domain feature of any first sample image is subjected to multi-domain mixing processing to obtain the mixed domain feature of the any first sample image, the domain feature of the any first sample image can also be subjected to multi-domain mixing processing with the domain features of other first sample images in the plurality of first sample images to obtain the mixed domain feature of the any first sample image; further optionally, the first sample image and the part of the images subjected to multi-domain mixing processing can be referred to as mini-batch first sample images (i.e., mini-batch first sample images), and any first sample image in the mini-batch can be subjected to multi-domain mixing with other first sample images in the mini-batch.

[0091] In an embodiment, the living body detection model can be used for living body detection on a target image to be detected, i.e., can be used for determining whether a target object in the target image is a living body or a non-living body when imaged; when the target object is a face object, the living body detection model can be applied to various application scenarios requiring living body verification on a face, for example, the living body detection model can be applied to a resource transfer scenario, an object verification scenario, and an access control verification scenario. In a feasible implementation, the image processing device can output a target image acquisition interface; acquire a target image to be detected; extract a living body feature of the target image through a trained feature extraction module in the living body detection model; perform living body discrimination processing on the living body feature of the target image through a trained living body discrimination module in the living body detection model to obtain a living body discrimination result of the target image; if the living body discrimination result of the target image indicates that the target object in the target image is a living body when imaged, perform face recognition processing on the target object in the target image to obtain a face recognition result; and perform a corresponding operation based on the face recognition result.

[0092] The target image acquisition interface can be an interface output by the image processing device, used for interacting with an object and acquiring a face of the object; the target image acquisition interface can include prompt information used for prompting an image to be acquired, which can be text prompt information, voice prompt information, etc. The specific format and specific content of the prompt information are not limited in the embodiment of the present application. For example, the prompt information can be text prompt information “Please look straight at the camera” or “Please place the front face in the face acquisition frame”. Further, the image size of the target image is the same as the image size of the first sample image; generally, when the face of the object is acquired through the target image acquisition interface, the camera will continuously acquire, at this time, a video frame can be extracted from the continuously acquired video of the camera, and face detection processing is performed on the extracted video frame; if it is detected that the video frame does not contain a face, the video frame is repeatedly extracted; if it is detected that the video frame contains a face, the image region containing the face in the detected video frame is cropped, the cropped image region is scaled to obtain a face image of a preset image size, and the face image of the preset image size is taken as the target image.

[0093] Further, the process of extracting the live body feature of the target image and obtaining the live body discrimination result of the target image through the live body detection model is similar to the process of extracting the live body feature of the first sample image and obtaining the live body discrimination result of the first sample image through the live body detection training model, and will not be repeated here. Since the live body discrimination result of the target image can be the probability that the target object in the target image is imaged as a live body, the live body discrimination result of the target image can be further judged to indicate whether the target object in the target image is imaged as a live body or a non-live body by setting a live body discrimination threshold. Optionally, when the live body discrimination result of the target image is greater than the live body discrimination threshold, the live body discrimination result of the target image indicates that the target object in the target image is imaged as a live body; when the live body discrimination result of the target image is less than or equal to the live body discrimination threshold, the live body discrimination result of the target image indicates that the target object in the target image is imaged as a non-live body. Further optionally, when it is necessary to ensure the pass rate of live body objects, a smaller live body discrimination threshold can be set; when it is necessary to ensure the detection rate of attack objects, a larger live body discrimination threshold can be set.

[0094] Further, if the live body discrimination result of the target image indicates that the target object in the target image is imaged as a live body, the face recognition process is performed on the target object in the target image to obtain a face recognition result, and a corresponding operation is performed based on the face recognition result. The corresponding operation performed based on the face recognition result in different application scenarios can be different, and is specifically adapted to the application scenario; for example, in a resource transfer scenario, identity verification can be performed based on the face recognition result, and when the identity verification is passed, the resource is transferred, which can effectively detect and intercept illegal transactions to protect the interests of the object; for example, in a door access verification scenario, identity verification can be performed based on the face recognition result, and when the identity verification is passed, the door is opened and the person is allowed to pass, which can ensure the safety of the community.

[0095] In the embodiment of the present application, the feature extraction module and the living body discrimination module in the living body detection training model are trained by decoupling the first sample image used for training into a living body feature used for determining whether the target object is a living body or a non-living body when imaged, and a domain feature causing misjudgment of whether the target object is a living body or a non-living body when imaged, so that the living body detection model constructed based on the trained feature extraction module and the trained living body discrimination module can predict the living body discrimination result of the target image based on the living body feature of the decoupled target image when performing living body detection on the target image, can reduce the interference of the domain feature, and improve the accuracy of the living body discrimination result of the target image, that is, improve the accuracy of living body detection; by performing multi-domain mixed processing on the domain feature of the first sample image, and generating a corresponding reference image based on the mixed domain feature obtained after the multi-domain mixed processing and the living body feature, the diversity of the training samples (that is, the reference images that can be used for training are increased) can be increased without introducing domain labels, and then the feature extraction module and the living body discrimination module can be trained based on the difference between the living body discrimination result of the first sample image and the corresponding original living body label, and the difference between the living body discrimination result of the first sample image and the living body discrimination result of the corresponding reference image, so that the training effect of the feature extraction module and the living body detection module can be improved, that is, the accuracy of the living body detection model when performing living body detection can be improved.

[0096] Based on the related embodiments of the above image processing method, the embodiment of the present application provides another image processing method. Referring to Figure 7 , the flowchart of another image processing method provided by the embodiment of the present application is shown. Figure 7 The image processing method shown can be executed by an image processing device, or can be executed by any electronic device with computing power, and the embodiment of the present application is described by execution by an image processing device. Figure 7 The image processing method shown can include the following steps:

[0097] S701, obtaining a plurality of first sample images, and an original living body label of a target object in each first sample image.

[0098] The original living body label is used to indicate whether the target object is a living body or a non-living body when imaged.

[0099] S702, extracting the living body feature of each first sample image and the domain feature of each first sample image by the feature extraction module in the living body detection training model.

[0100] The living body feature is used to represent the feature used to determine whether the target object is a living body or a non-living body when imaged, and the domain feature is used to represent the feature causing misjudgment of whether the target object is a living body or a non-living body when imaged.

[0101] S703, performing multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images, to obtain a mixed domain feature of any first sample image.

[0102] S704, generating a reference image corresponding to any first sample image based on the liveness feature and the mixed domain feature of any first sample image.

[0103] S705, extracting, by the feature extraction module, the liveness feature of the reference image corresponding to any first sample image.

[0104] S706, performing liveness discrimination processing on the liveness feature of any first sample image and the liveness feature of the corresponding reference image by the liveness discrimination module in the liveness detection training model, to obtain the liveness discrimination result of any first sample image and the liveness discrimination result of the corresponding reference image.

[0105] S707, training the feature extraction module and the liveness discrimination module based on the difference between the liveness discrimination result of each first sample image and the corresponding original liveness label, and the difference between the liveness discrimination result of each first sample image and the liveness discrimination result of the corresponding reference image.

[0106] The related processes of steps S701 to S707 are similar to the related processes of steps S301 to S307 described above, and will not be repeated here.

[0107] In an embodiment, the liveness detection training model can further include an image discrimination module. The image discrimination module can be used to perform image discrimination processing on an image input to the image discrimination module to obtain an image discrimination result. The image discrimination result can be used to indicate that the image input to the image discrimination module is of a sample image type or a reference image type. That is, the image discrimination result can be used to indicate that the image input to the image discrimination module is an image generated by the image generation module (i.e., an image of a reference image type) or is not an image generated by the image generation module (i.e., an image of a sample image type). The image discrimination module can be any neural network model that can realize the corresponding function, which can be adaptively selected and designed according to specific needs, and the embodiments of the present application do not limit this. For example, when the feature extraction module is an encoder, the image generation module is a decoder, and the image discrimination module is a discriminator, a Cycle GAN (Cycle Generative Adversarial Network) with good performance in the industry can be used.

[0108] In the case of introducing the image discrimination module, the liveness detection training model constitutes a generative adversarial network, as shown in Figure 8As another example of processing the first sample images by the living body detection training model, the living body features of each first sample image and the domain features of each first sample image can be extracted by the feature extraction module in the living body detection training model; the domain features of any first sample image and the domain features of other first sample images in the plurality of first sample images can be mixed by the multi-domain mixing module in the living body detection training model to obtain the mixed domain features of the any first sample image; the reference image corresponding to the any first sample image can be generated based on the living body features of the any first sample image and the mixed domain features by the image generation module in the living body detection training model; the living body features of the reference image corresponding to the any first sample image and the domain features of the reference image corresponding to the any first sample image can be extracted by the feature extraction module again; the living body features of the any first sample image and the living body features of the reference image corresponding to the any first sample image can be distinguished by the living body distinguishing module in the living body detection training model to obtain the living body distinguishing result of the any first sample image and the living body distinguishing result of the reference image corresponding to the any first sample image; and the first sample images and the reference images corresponding to the first sample images can be distinguished by the image distinguishing module in the living body detection training model to obtain the image distinguishing result.

[0109] In an embodiment, the trained feature extraction module and the trained living body distinguishing module can be obtained by alternately training the image distinguishing module, the feature extraction module and the living body distinguishing module for multiple times. The model parameters of the image distinguishing module obtained in the current training are fixed and used to train the feature extraction module and the living body distinguishing module obtained in the last training. Further, the model parameters of the image distinguishing module obtained in the current training can also be used to train the multi-domain mixing module and the image generation module obtained in the last training. In a specific implementation, the feature extraction module and the living body distinguishing module obtained in the last training can be trained based on the difference between the living body distinguishing results of each first sample image determined by the living body distinguishing module obtained in the last training and the original living body labels, the difference between the living body distinguishing results of each first sample image determined by the living body distinguishing module obtained in the last training and the living body distinguishing results of the reference images corresponding to the first sample images, and the difference between the image distinguishing results of the reference images corresponding to each first sample image determined by the image distinguishing module obtained in the current training and the image type labels of the reference images corresponding to the first sample images. The image type label of the reference image corresponding to each first sample image is used to indicate the image type of the reference image corresponding to each first sample image.

[0110] In an embodiment, the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training and the corresponding original living body label can be embodied by a loss value determined by the original living body discrimination loss function shown in formula 1, the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training, and the corresponding original living body label. Embodiments of the present application will not be described again; the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training and the living body discrimination result of the corresponding reference image can be embodied by a loss value determined by the comparison living body discrimination loss function shown in formula 2, the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training, and the living body discrimination result of the corresponding reference image. Embodiments of the present application will not be described again; the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained through the current training and the image type label of the corresponding reference image can be embodied by the first image discrimination loss value. The first image discrimination loss value can be determined by the image discrimination result of the reference image corresponding to each first sample image and the image type label of the corresponding reference image. Specifically, it can be determined based on the first image discrimination loss function. The first image discrimination loss function can be a loss function based on cross entropy, and specifically can be shown by the following formula 5.1:

[0111]

[0112] Wherein, N represents the number of reference images corresponding to the first sample image, that is, the number of first sample images, i represents an independent variable, I' represents the reference image corresponding to the first sample image, D(I' represents the image discrimination result of the reference image corresponding to the first sample image, and P(I') represents the reference image set composed of the reference image corresponding to the first sample image. i i

[0113] ​​In a specific implementation, the image processing device trains the feature extraction module and the living body discrimination module obtained in the last training based on the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the corresponding original living body label, the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the living body discrimination result of the corresponding reference image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the current training and the image type label of the corresponding reference image. The training can include: training the feature extraction module and the living body discrimination module obtained in the last training in a direction of reducing the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the living body discrimination result of the corresponding reference image, and increasing the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the current training and the image type label of the corresponding reference image. Since the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the current training and the image type label of the corresponding reference image can be reflected by the first image discrimination loss value, and the first image discrimination loss value is determined by the first image discrimination loss function, the first image discrimination loss function indicates that the first image discrimination loss value is smaller when the difference between the image discrimination result of the reference image corresponding to each first sample image and the image type label of the corresponding reference image is larger, so the image processing device can train the feature extraction module and the living body discrimination module obtained in the last training in a direction of reducing the first image discrimination loss value.

[0114] In one embodiment, since the trained feature extraction module and the trained living body discrimination module can be obtained by multiple times of alternating training of the image discrimination module, the feature extraction module and the living body discrimination module, the model parameters of the feature extraction module, the living body discrimination module, the multi-domain hybrid module and the image generation module obtained in the current training are fixed, and are used to train the image discrimination module obtained in the last training. In a specific implementation, the way of training the image discrimination module obtained in the last training includes training the image discrimination module obtained in the last training based on the difference between the image discrimination result of each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding first sample image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding reference image.

[0115] In an embodiment, the difference between the image discrimination result of each first sample image determined by the image discrimination module obtained by the last training and the image type label of the corresponding first sample image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained by the last training and the image type label of the corresponding reference image, can be reflected by a second image discrimination loss value, which can be determined by the image discrimination result of each first sample image and the image type label of the corresponding first sample image, and the image discrimination result of the reference image corresponding to each first sample image and the image type label of the corresponding reference image, and can be specifically determined based on a second image discrimination loss function, which can be a cross-entropy-based loss function, and can be specifically shown by the following formula 5.2:

[0116]

[0117] wherein N represents the number of first sample images, i.e. the number of reference images corresponding to the first sample images, i represents an independent variable, I represents the i-th first sample image, D(I) represents the image discrimination result of the i-th first sample image, I' represents the reference image corresponding to the i-th first sample image, D(I') represents the image discrimination result of the reference image corresponding to the i-th first sample image; P(I) represents a first sample image set composed of first sample images, and P(I') represents a reference image set composed of reference images corresponding to the first sample images. i i i i

[0118] ​​​​In a specific implementation, the image processing device trains the image discrimination module obtained in the last training based on the difference between the image discrimination result of each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding first sample image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding reference image. The training can include: training the image discrimination module obtained in the last training in a direction of reducing the difference between the image discrimination result of each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding first sample image, and reducing the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding reference image. Since the difference between the image discrimination result of each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding first sample image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the last training and the image type label of the corresponding reference image can be reflected by the second image discrimination loss value, and the second image discrimination loss value is determined by the second image discrimination loss function, the second image discrimination loss function indicates that the smaller the difference between the image discrimination result of each first sample image and the image type label of the corresponding first sample image, and the difference between the image discrimination result of the reference image corresponding to each first sample image and the image type label of the corresponding reference image, the larger the second image discrimination loss value, so the image processing device can train the image discrimination module obtained in the last training in a direction of increasing the second image discrimination loss value.

[0119] Further, formula 5.1 and formula 5.2 can be uniformly represented as the following formula 5.3:

[0120] L adv =min G max D {E I∈P(I) [log(D(I))]+E I′∈P(I′) [log(1-D(I′))]} (5.3)

[0121] Further, the image discrimination module is introduced, so that the living body detection training model constitutes a generative adversarial network, and the image discrimination module, the feature extraction module, the living body discrimination module, the multi-domain hybrid module and the image generation module are alternately trained multiple times based on the idea of the generative adversarial network, so that the model performance of the trained feature extraction module, the trained living body discrimination module, the trained multi-domain hybrid module and the trained image generation module is better.

[0122] In an embodiment, in the process of training the feature extraction module and the living body discrimination module (or the living body detection training model), the image processing device can adaptively introduce one or more of the following differences on the basis of introducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image: the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image, and the difference between each first sample image and the corresponding reconstructed image, to jointly train the feature extraction module and the living body discrimination module (or the living body detection training model).

[0123] S708, obtaining a plurality of second sample images.

[0124] Any second sample image includes a target object, and the image size of the second sample image is the same as that of the first sample image. The related process of obtaining the second sample image is similar to the above-mentioned related process of obtaining the first sample image, and will not be repeated here.

[0125] S709, predicting a predicted living body label of each second sample image by using the trained feature extraction module and the trained living body discrimination module.

[0126] In an embodiment, predicting a predicted living body label of each second sample image by using the trained feature extraction module and the trained living body discrimination module can include: for any second sample image, extracting a living body feature of the any second sample image by using the trained feature extraction module; performing living body discrimination processing on the living body feature of the any second sample image by using the trained living body discrimination module to obtain a living body discrimination result of the any second sample image, and taking the living body discrimination result of the any second sample image as the predicted living body label of the any second sample image; wherein the related process of extracting the living body feature of the any second sample image and obtaining the living body discrimination result of the any second sample image is similar to the above-mentioned related process of extracting the living body feature of the first sample image and obtaining the living body discrimination result of the first sample image, and will not be repeated here.

[0127] S710, determining the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image by using the trained living body detection training model.

[0128] The trained live body detection training model can be obtained by training the live body detection training model based on the difference between the live body discrimination result of each first sample image and the corresponding original live body label, and the difference between the live body discrimination result of each first sample image and the live body discrimination result of the corresponding reference image. In the case of introducing different loss functions, the trained live body detection training model is obtained by training the live body detection model based on the plurality of first sample images, the original live body label of the target object in each first sample image, and the corresponding loss function. Through the trained live body detection training model, the related process of obtaining the live body discrimination result of each second sample image and the live body discrimination result of the corresponding reference image is similar to the related process of obtaining the live body discrimination result of each first sample image and the live body discrimination result of the corresponding reference image by the live body detection training model, and will not be repeated here.

[0129] S711, based on the difference between the live body discrimination result of each second sample image and the corresponding predicted live body label, and the difference between the live body discrimination result of each second sample image and the live body discrimination result of the corresponding reference image, the trained feature extraction module and the trained live body discrimination module are optimized.

[0130] In one embodiment, the related process of optimizing the trained feature extraction module and the trained live body discrimination module is similar to the related process of training the feature extraction module and the live body discrimination module. However, in the process of optimizing the trained feature extraction module and the trained live body discrimination module based on the difference between the live body discrimination result of each second sample image and the corresponding predicted live body label, the difference between the live body discrimination result of each second sample image and the corresponding predicted live body label can be reflected by the target live body discrimination loss value, which can be determined by the live body discrimination result of each second sample image and the corresponding predicted live body label. Specifically, it can be determined based on the target live body discrimination loss function, and the target live body discrimination loss function can be a loss function based on weighted cross-entropy, which can be shown by the following formula 6.1:

[0131]

[0132] Wherein M represents the number of second sample images, i represents the independent variable, z i represents the predicted live body label of the i-th second sample image, represents the live body discrimination result of the i-th second sample image, represents the live body discrimination loss value corresponding to the i-th second sample image, β ia confidence of the predicted living body label of the i-th second sample image; M ur denotes the number of second sample images in the M second sample images for which the predicted living body label indicates that the target object is a living body when imaged, i.e., the number of positive example second sample images, M uf denotes the number of second sample images in the M second sample images for which the predicted living body label indicates that the target object is a non-living body when imaged, i.e., the number of negative example second sample images. The confidence of the predicted living body label of the i-th second sample image can be shown by the following formula 6.2:

[0133]

[0134] wherein, denotes the living body discrimination result of the reference image corresponding to the i-th second sample image, denotes the distribution of the living body discrimination result of the i-th second sample image, denotes the distribution of the living body discrimination result of the reference image corresponding to the i-th second sample image, denotes the KL divergence value determined based on the living body discrimination result of the i-th second sample image and the living body discrimination result of the corresponding reference image.

[0135] It can be seen that the manner in which the image processing device determines the target living body discrimination loss value can include: determining the living body discrimination loss value corresponding to each second sample image based on the living body discrimination result of each second sample image and the corresponding predicted living body label; determining the confidence of the predicted living body label of each second sample image based on the distribution difference between the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image; determining the target living body discrimination loss value based on the confidence of the predicted living body label of each second sample image and the living body discrimination loss value corresponding to the corresponding second sample image; in a specific implementation, the confidence of the predicted living body label of each second sample image can be used to perform weighted average processing on the living body discrimination loss value corresponding to the corresponding second sample image to obtain the target living body discrimination loss value.

[0136] S712, constructing a living body detection model based on the optimized feature extraction module and the optimized living body discrimination module.

[0137] wherein, the living body detection model is used for performing living body detection on a target image to be detected.

[0138] In the embodiment of the present application, the image discrimination module is further introduced into the living body detection training model, so that the living body detection training model constitutes a generative adversarial network. Based on the idea of the generative adversarial network, the image discrimination module, the feature extraction module, the living body discrimination module, the multi-domain mixing module and the image generation module are alternately trained multiple times, so that the model performance of the trained feature extraction module, the trained living body discrimination module, the trained multi-domain mixing module and the trained image generation module is better. Further, the second sample images without original living body labels can be introduced, and based on each second sample image and the predicted living body label of each second sample image obtained by the trained feature extraction module and the trained living body discrimination module, the trained feature extraction module and the trained living body discrimination module can be optimized. A large amount of unlabeled data can be used for model optimization, so that the model performance of the living body detection model constructed based on the optimized feature extraction module and the optimized living body discrimination module is better, that is, the accuracy of the living body detection model in living body detection can be further improved.

[0139] Based on the above-mentioned image processing method embodiment, an image processing device is provided in the embodiment of the present application. Referring to Figure 9 The structure schematic diagram of the image processing device provided in the embodiment of the present application can include an acquisition unit 901 and a processing unit 902. Figure 9 The image processing device shown can run the following units:

[0140] The acquisition unit 901 is configured to acquire a plurality of first sample images and original living body labels of target objects in each first sample image. The original living body label is used to indicate whether the target object is a living body or a non-living body when imaging.

[0141] The processing unit 902 is configured to extract living body features of the plurality of first sample images and domain features of the plurality of first sample images by a feature extraction module in a living body detection training model. The living body feature is used to represent a feature for determining whether the target object is a living body or a non-living body when imaging, and the domain feature is used to represent a feature that causes misjudgment when imaging the target object as a living body or a non-living body.

[0142] The processing unit 902 is further configured to perform multi-domain mixing processing on the domain features of any first sample image and the domain features of other first sample images in the plurality of first sample images, to obtain mixed domain features of the any first sample image.

[0143] The processing unit 902 is further configured to generate a reference image corresponding to the any first sample image based on the living body features and the mixed domain features of the any first sample image.

[0144] The processing unit 902 is further configured to extract, by the feature extraction module, the living body feature of the reference image corresponding to any first sample image.

[0145] The processing unit 902 is further configured to perform, by a living body discrimination module in the living body detection training model, living body discrimination processing on the living body feature of any first sample image and the living body feature of the corresponding reference image respectively, to obtain the living body discrimination result of the first sample image and the living body discrimination result of the corresponding reference image.

[0146] The processing unit 902 is further configured to train the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and to construct a living body detection model based on the trained feature extraction module and the trained living body discrimination module; the living body detection model is used for living body detection on a target image to be detected.

[0147] In one embodiment, when the processing unit 902 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, the processing unit 902 specifically performs the following operations:

[0148] The feature extraction module and the living body discrimination module are trained in the direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image.

[0149] In one embodiment, the processing unit 902 is further configured to extract, by the feature extraction module, the domain feature of the reference image corresponding to any first sample image.

[0150] The processing unit 902 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and specifically performs the following operations:

[0151] The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between a domain feature of each first sample image and a domain feature of a corresponding reference image.

[0152] In one embodiment, when the processing unit 902 trains the feature extraction module and the living body discrimination module based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between a domain feature of each first sample image and a domain feature of a corresponding reference image, the processing unit 902 specifically performs the following operations:

[0153] The feature extraction module and the living body discrimination module are trained in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and increasing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image.

[0154] In one embodiment, the living body detection training model further includes an image generation module, and the image generation module is configured to generate a reference image corresponding to any first sample image.

[0155] The processing unit 902 is further configured to generate, by the image generation module, a reconstructed image corresponding to any first sample image based on a living body feature and a domain feature of the first sample image.

[0156] When the processing unit 902 trains the feature extraction module and the living body discrimination module based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, and a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, the processing unit 902 specifically performs the following operations:

[0157] The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between each first sample image and a corresponding reconstructed image.

[0158] In an embodiment, the living body detection training model further comprises an image discrimination module, the image discrimination module is configured to perform image discrimination processing on an image input to the image discrimination module to obtain an image discrimination result, the image discrimination result is used to indicate that the image type of the image input to the image discrimination module is a sample image type or a reference image type; the trained feature extraction module and the trained living body discrimination module are obtained by alternately training the image discrimination module, the feature extraction module and the living body discrimination module multiple times, and the model parameters of the image discrimination module obtained in the current training are fixed and used to train the feature extraction module and the living body discrimination module obtained in the last training;

[0159] When the processing unit 902 trains the feature extraction module and the living body discrimination module obtained in the last training, the following operations are performed:

[0160] The feature extraction module and the living body discrimination module obtained in the last training are trained based on the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the corresponding original living body label, the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the last training and the living body discrimination result of the corresponding reference image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the current training and the image type label of the corresponding reference image; the image type label of the reference image corresponding to each first sample image is used to indicate the image type of the reference image corresponding to each first sample image.

[0161] In an embodiment, the obtaining unit 901 is further configured to obtain a plurality of second sample images; any second sample image comprises a target object.

[0162] The processing unit 902 is further configured to predict a predicted living body label of each second sample image by using the trained feature extraction module and the trained living body discrimination module.

[0163] The processing unit 902 is further configured to determine the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image by using the trained living body detection training model, wherein the trained living body detection training model is obtained by training the living body detection training model based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image.

[0164] The processing unit 902 is further configured to optimize the trained feature extraction module and the trained live body discrimination module based on a difference between the live body discrimination result of each second sample image and the corresponding predicted live body label, and a difference between the live body discrimination result of each second sample image and the live body discrimination result of the corresponding reference image.

[0165] When the processing unit 902 constructs the live body detection model based on the trained feature extraction module and the trained live body discrimination module, the following operations are specifically performed:

[0166] The live body detection model is constructed based on the optimized feature extraction module and the optimized live body discrimination module.

[0167] In an embodiment, the difference between the live body discrimination result of each second sample image and the corresponding predicted live body label is reflected by a target live body discrimination loss value, which is determined by the live body discrimination result of each second sample image and the corresponding predicted live body label.

[0168] When the processing unit 902 determines the target live body discrimination loss value, the following operations are specifically performed:

[0169] Based on the live body discrimination result of each second sample image and the corresponding predicted live body label, a live body discrimination loss value corresponding to each second sample image is determined respectively.

[0170] Based on the distribution difference between the live body discrimination result of each second sample image and the live body discrimination result of the corresponding reference image, a confidence degree of the predicted live body label of each second sample image is determined respectively.

[0171] Based on the confidence degree of the predicted live body label of each second sample image and the live body discrimination loss value corresponding to the corresponding second sample image, the target live body discrimination loss value is determined.

[0172] In an embodiment, the image processing apparatus can further include an output unit 903, configured to output a target image acquisition interface; the target image acquisition interface includes prompt information, and the prompt information is used to prompt a to-be-acquired image.

[0173] The acquisition unit 901 is further configured to acquire a target image to be acquired for live body detection.

[0174] The processing unit 902 is further configured to extract a live body feature of the target image by using the trained feature extraction module in the live body detection model.

[0175] The processing unit 902 is further configured to perform living body discrimination processing on the living body feature of the target image by using a trained living body discrimination module in the living body detection model, to obtain a living body discrimination result of the target image.

[0176] The processing unit 902 is further configured to perform face recognition processing on the target object in the target image if the living body discrimination result of the target image indicates that the target object in the target image is a living body when being imaged, to obtain a face recognition result.

[0177] The processing unit 902 is further configured to perform a corresponding operation based on the face recognition result.

[0178] In one embodiment, when the processing unit 902 performs multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain a mixed domain feature of the any first sample image, the following operations are specifically performed:

[0179] Target neighbor images of the any first sample image are determined from the other first sample images, and the similarity between the domain feature of any target neighbor image and the domain feature of the any first sample image is greater than the similarity between the domain feature of the remaining first sample images and the domain feature of the any first sample image.

[0180] The domain feature of the any first sample image is adjusted using the attention weight of the any first sample image to obtain an adjusted domain feature of the any first sample image, and the domain features of the target neighbor images are adjusted using the attention weights of the target neighbor images to obtain adjusted domain features of the target neighbor images.

[0181] The mixed domain feature of the any first sample image is determined based on the adjusted domain feature of the any first sample image and the adjusted domain features of the target neighbor images.

[0182] In one embodiment, when the processing unit 902 extracts the living body feature and the domain feature of the any first sample image by using the feature extraction module, the following operations are specifically performed:

[0183] The image feature of the any first sample image is extracted by using the feature extraction module to obtain the image feature of the any first sample image.

[0184] The living body feature of the any first sample image is extracted from the image feature of the any first sample image to obtain the living body feature of the any first sample image, and the domain feature of the any first sample image is extracted from the image feature of the any first sample image to obtain the domain feature of the any first sample image.

[0185] In one embodiment, when the processing unit 902 generates a reference image corresponding to any first sample image based on the liveness features and mixed domain features of any first sample image, it specifically performs the following operations:

[0186] The liveness features and mixed domain features of any first sample image are stitched together to obtain the stitched image features of any first sample image.

[0187] Based on the stitched image features of any of the first sample images, image generation processing is performed to obtain a reference image corresponding to any of the first sample images.

[0188] According to one embodiment of this application, Figure 3 as well as Figure 7 The image processing method shown can involve various steps that can be derived from... Figure 9 This is performed by the individual units in the image processing apparatus shown. For example, Figure 3 The step S301 shown can be performed by Figure 9 The acquisition unit 901 in the image processing apparatus shown performs this operation. Figure 3 Steps S302 to S307 shown can be derived from... Figure 9 The image processing unit 902 in the illustrated image processing apparatus performs the operation. For example, Figure 7 Steps S701 and S708 shown can be derived from... Figure 9 The acquisition unit 901 in the image processing apparatus shown performs this operation. Figure 7 Steps S702 to S707 and steps S709 to S712 shown can be derived from... Figure 9 The processing unit 902 in the image processing apparatus shown performs the operation.

[0189] According to another embodiment of this application, Figure 9 The various units in the illustrated image processing apparatus can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the image processing apparatus based on logical function division may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0190] According to another embodiment of the present application, the image processing apparatus as shown in Figure 3 and Figure 7 the computer program (including program codes) involved in each step of the corresponding method as shown in Figure 9 may be constructed, and the image processing method of the embodiments of the present application can be implemented. The computer program can be recorded on, for example, a computer readable storage medium, and loaded into the above-mentioned computing device through the computer readable storage medium, and run therein.

[0191] In the embodiments of the present application, the feature extraction module and the living body discrimination module in the living body detection training model are trained by decoupling the first sample image used for training into the living body feature used for determining whether the target object in the first sample image is a living body or a non-living body when imaged, and the domain feature that causes misjudgment of the living body or the non-living body when the target object is imaged, so that the living body detection model constructed based on the trained feature extraction module and the trained living body discrimination module can predict the living body discrimination result of the target image based on the living body feature of the target image obtained by decoupling when performing living body detection on the target image, can reduce the interference of the domain feature, and improve the accuracy of the living body discrimination result of the target image, i.e., improve the accuracy of the living body detection. By performing multi-domain mixed processing on the domain feature of the first sample image, and generating a corresponding reference image based on the mixed domain feature obtained after the multi-domain mixed processing and the living body feature, the diversity of the training samples can be increased (i.e., the reference images that can be used for training are increased) without introducing domain labels, and then the feature extraction module and the living body discrimination module can be trained based on the difference between the living body discrimination result of the first sample image and the corresponding original living body label, and the difference between the living body discrimination result of the first sample image and the living body discrimination result of the corresponding reference image, which can improve the training effect of the feature extraction module and the living body detection module, i.e., can improve the accuracy of the living body detection model when performing living body detection.

[0192] Based on the above-mentioned image processing method embodiments and image processing apparatus embodiments, the present application further provides an image processing device. Referring to Figure 10 , a structural schematic diagram of an image processing device provided by the embodiments of the present application. Figure 10 The image processing device as shown in may at least include a processor 1001, an input interface 1002, an output interface 1003, and a computer storage medium 1004. The processor 1001, the input interface 1002, the output interface 1003, and the computer storage medium 1004 can be connected through a bus or other means.

[0193] The computer storage medium 1004 can be stored in the memory of the image processing device, and the computer storage medium 1004 is used to store a computer program including program instructions, and the processor 1001 is used to execute the program instructions stored in the computer storage medium 1004. The processor 1001 (or CPU (Central Processing Unit, central processor)) is the computing core and control core of the image processing device, which is suitable for implementing one or more instructions, and is particularly suitable for loading and executing one or more instructions to implement the above-mentioned image processing method flow or corresponding function.

[0194] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in the image processing device, and is used to store programs and data. It can be understood that the computer storage medium herein can include a built-in storage medium in the terminal, and of course can also include an expansion storage medium supported by the terminal. The computer storage medium provides a storage space, and the storage space stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 1001 are also stored in the storage space, and the instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium herein can be a high-speed random access memory (RAM) memory, or a non-volatile memory such as at least one disk memory; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0195] In one embodiment, one or more instructions stored in the computer storage medium can be loaded and executed by the processor 1001 and the input interface 1002 to implement the corresponding steps of the method in the above-mentioned image processing method embodiment of Figure 3 and Figure 7 In a specific implementation, the input interface 1002 is used to obtain a plurality of first sample images and original living body labels of target objects in each first sample image. The original living body label is used to indicate whether the target object is a living body or a non-living body when imaging.

[0196] The input interface 1002 is used to obtain a plurality of first sample images and original living body labels of target objects in each first sample image. The original living body label is used to indicate whether the target object is a living body or a non-living body when imaging.

[0197] The processor 1001 is used to extract living body features of the plurality of first sample images and domain features of the plurality of first sample images through a feature extraction module in a living body detection training model. The living body feature is used to represent a feature for determining whether the target object is a living body or a non-living body when imaging, and the domain feature is used to represent a feature that causes misjudgment of whether the target object is a living body or a non-living body when imaging.

[0198] The processor 1001 is further configured to perform multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images, to obtain a mixed domain feature of the any first sample image.

[0199] The processor 1001 is further configured to generate a reference image corresponding to the any first sample image based on the living body feature and the mixed domain feature of the any first sample image.

[0200] The processor 1001 is further configured to extract, by the feature extraction module, a living body feature of the reference image corresponding to the any first sample image.

[0201] The processor 1001 is further configured to perform living body discrimination processing on the living body feature of the any first sample image and the living body feature of the corresponding reference image by a living body discrimination module in the living body detection training model, to obtain a living body discrimination result of the any first sample image and a living body discrimination result of the corresponding reference image.

[0202] The processor 1001 is further configured to train the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and to construct a living body detection model based on the trained feature extraction module and the trained living body discrimination module; the living body detection model is used for living body detection on a target image to be detected.

[0203] In one embodiment, when the processor 1001 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, the processor 1001 specifically performs the following operations:

[0204] The feature extraction module and the living body discrimination module are trained in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image.

[0205] In one embodiment, the processor 1001 is further configured to extract, by the feature extraction module, a domain feature of the reference image corresponding to the any first sample image.

[0206] The processor 1001 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and specifically performs the following operations:

[0207] The processor 1001 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image.

[0208] In one embodiment, when the processor 1001 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image, the processor 1001 specifically performs the following operations:

[0209] The processor 1001 trains the feature extraction module and the living body discrimination module in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and increasing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image.

[0210] In one embodiment, the living body detection training model further includes an image generation module, and the image generation module is configured to generate a reference image corresponding to any first sample image.

[0211] The processor 1001 is further configured to generate, by the image generation module, a reconstructed image corresponding to any first sample image based on the living body feature and the domain feature of the first sample image.

[0212] The processor 1001 trains the feature extraction module and the living body discrimination module based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and specifically performs the following operations:

[0213] The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between each first sample image and a corresponding reconstructed image.

[0214] In an embodiment, the living body detection training model further comprises an image discrimination module, the image discrimination module being configured to perform image discrimination processing on an image input to the image discrimination module to obtain an image discrimination result, the image discrimination result being configured to indicate that an image type of the image input to the image discrimination module is a sample image type or a reference image type; the trained feature extraction module and the trained living body discrimination module are obtained by performing multiple times of alternating training on the image discrimination module, the feature extraction module and the living body discrimination module, model parameters of the image discrimination module obtained in a current time of training being fixed, and being configured to train the feature extraction module and the living body discrimination module obtained in a previous time of training;

[0215] When the processor 1001 trains the feature extraction module and the living body discrimination module obtained in the previous time of training, the processor 1001 specifically performs the following operations:

[0216] The feature extraction module and the living body discrimination module obtained in the previous time of training are trained based on a difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the previous time of training and a corresponding original living body label, a difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained in the previous time of training and a living body discrimination result of a corresponding reference image, and a difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained in the current time of training and an image type label of the corresponding reference image; the image type label of the reference image corresponding to each first sample image is configured to indicate an image type of the reference image corresponding to each first sample image.

[0217] In an embodiment, the input interface 1002 is further configured to acquire a plurality of second sample images; any second sample image comprises a target object.

[0218] The processor 1001 is further configured to predict a predicted living body label of each second sample image by using the trained feature extraction module and the trained living body discrimination module.

[0219] The processor 1001 is further configured to determine a living body discrimination result of each second sample image and a living body discrimination result of a corresponding reference image by using the trained living body detection training model, wherein the trained living body detection training model is obtained by training the living body detection training model based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label and a difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image.

[0220] The processor 1001 is further configured to optimize the trained feature extraction module and the trained living body discrimination module based on a difference between the living body discrimination result of each second sample image and a corresponding predicted living body label and a difference between the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image.

[0221] When the processor 1001 constructs the living body detection model based on the trained feature extraction module and the trained living body discrimination module, the processor 1001 is specifically configured to perform the following operations:

[0222] The living body detection model is constructed based on the optimized feature extraction module and the optimized living body discrimination module.

[0223] In one embodiment, the difference between the living body discrimination result of each second sample image and the corresponding predicted living body label is reflected by a target living body discrimination loss value, wherein the target living body discrimination loss value is determined by the living body discrimination result of each second sample image and the corresponding predicted living body label.

[0224] When the processor 1001 determines the target living body discrimination loss value, the processor 1001 is specifically configured to perform the following operations:

[0225] Based on the living body discrimination result of each second sample image and the corresponding predicted living body label, a living body discrimination loss value corresponding to each second sample image is determined respectively.

[0226] Based on a distribution difference between the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image, a confidence degree of the predicted living body label of each second sample image is determined respectively.

[0227] Based on the confidence degree of the predicted living body label of each second sample image and the living body discrimination loss value corresponding to the corresponding second sample image, the target living body discrimination loss value is determined.

[0228] In one embodiment, the output interface 1003 is further configured to output a target image acquisition interface, wherein the target image acquisition interface includes prompt information, and the prompt information is used to prompt a to-be-acquired image.

[0229] The input interface 1002 is further configured to acquire a target image to be live body detection;

[0230] The processor 1001 is further configured to extract live body features of the target image through a trained feature extraction module in the live body detection model.

[0231] The processor 1001 is further configured to perform live body discrimination processing on the live body features of the target image through a trained live body discrimination module in the live body detection model, to obtain a live body discrimination result of the target image.

[0232] The processor 1001 is further configured to perform face recognition processing on the target object in the target image if the live body discrimination result of the target image indicates that the target object in the target image is a live body when imaging, to obtain a face recognition result.

[0233] The processor 1001 is further configured to perform corresponding operations based on the face recognition result.

[0234] In one embodiment, when the processor 1001 performs multi-domain mixing processing on the domain features of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain mixed domain features of the any first sample image, the following operations are specifically performed:

[0235] The target neighbor images of the any first sample image are determined from the other first sample images; the similarity between the domain features of any target neighbor image and the domain features of the any first sample image is greater than the similarity between the domain features of the remaining first sample images in the other first sample images and the domain features of the any first sample image.

[0236] The domain features of the any first sample image are adjusted using the attention weight of the any first sample image to obtain adjusted domain features of the any first sample image, and the domain features of each target neighbor image are adjusted using the attention weight of the corresponding target neighbor image to obtain adjusted domain features of the each target neighbor image.

[0237] The mixed domain features of the any first sample image are determined based on the adjusted domain features of the any first sample image and the adjusted domain features of the each target neighbor image.

[0238] In one embodiment, when the processor 1001 extracts live body features and domain features of the any first sample image through the feature extraction module, the following operations are specifically performed:

[0239] The feature extraction module extracts image features of the any first sample image.

[0240] The feature extraction module extracts image features of the any first sample image.

[0241] In one embodiment, when the processor 1001 generates the reference image corresponding to the any first sample image based on the living body features and the mixed domain features of the any first sample image, the processor 1001 specifically performs the following operations:

[0242] The processor 1001 splices the living body features and the mixed domain features of the any first sample image to obtain spliced image features of the any first sample image.

[0243] The processor 1001 generates the reference image corresponding to the any first sample image based on the spliced image features of the any first sample image.

[0244] The embodiment of the present application provides a computer program product, which comprises a computer program stored in a computer storage medium; a processor of an image processing device reads the computer program from the computer storage medium, and the processor executes the computer program, so that the image processing device executes the method embodiment as shown in the above. Figure 3 and Figure 7 Figure 3 Figure 7 The computer readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0245] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An image processing method, characterized by, The method comprises: obtaining a plurality of first sample images and original living body labels of target objects in each first sample image; the original living body label is used to indicate that the target object is a living body or a non-living body when imaging; extracting living body features of the each first sample image and domain features of the each first sample image through a feature extraction module in a living body detection training model; the living body feature is used to represent a feature for determining whether the target object is a living body or a non-living body when imaging, and the domain feature is used to represent a feature that causes misjudgment of whether the target object is a living body or a non-living body when imaging; performing multi-domain mixing processing on the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain mixed domain features of the any first sample image; generating a reference image corresponding to the any first sample image based on the living body feature and the mixed domain features of the any first sample image; extracting living body features of the reference image corresponding to the any first sample image through the feature extraction module; performing living body discrimination processing on the living body features of the any first sample image and the living body features of the corresponding reference image through a living body discrimination module in the living body detection training model to obtain living body discrimination results of the any first sample image and the corresponding reference image; training the feature extraction module and the living body discrimination module based on differences between the living body discrimination results of the each first sample image and the corresponding original living body labels and differences between the living body discrimination results of the each first sample image and the living body discrimination results of the corresponding reference image, and constructing a living body detection model based on the trained feature extraction module and the trained living body discrimination module; the living body detection model is used to perform living body detection on a target image to be detected.

2. The method of claim 1, wherein, The training of the feature extraction module and the living body discrimination module based on the differences between the living body discrimination results of the each first sample image and the corresponding original living body labels and the differences between the living body discrimination results of the each first sample image and the living body discrimination results of the corresponding reference image comprises: training the feature extraction module and the living body discrimination module in a direction of reducing the differences between the living body discrimination results of the each first sample image and the corresponding original living body labels and the differences between the living body discrimination results of the each first sample image and the living body discrimination results of the corresponding reference image.

3. The method of claim 1, wherein, The method further comprises: extracting domain features of the reference image corresponding to the any first sample image through the feature extraction module; the training of the feature extraction module and the living body discrimination module based on the differences between the living body discrimination results of the each first sample image and the corresponding original living body labels and the differences between the living body discrimination results of the each first sample image and the living body discrimination results of the corresponding reference image comprises: The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between a domain feature of each first sample image and a domain feature of a corresponding reference image.

4. The method of claim 3, wherein, The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between a domain feature of each first sample image and a domain feature of a corresponding reference image. The feature extraction module and the living body discrimination module are trained in a direction of reducing the difference between the living body discrimination result of each first sample image and the corresponding original living body label, reducing the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image, and increasing the difference between the domain feature of each first sample image and the domain feature of the corresponding reference image.

5. The method of claim 1, wherein, The living body detection training model further comprises an image generation module configured to generate a reference image corresponding to any first sample image. The method further comprises: The image generation module is configured to generate a reconstructed image corresponding to any first sample image based on the living body feature and the domain feature of the first sample image. The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, and a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image. The feature extraction module and the living body discrimination module are trained based on a difference between the living body discrimination result of each first sample image and a corresponding original living body label, a difference between the living body discrimination result of each first sample image and a living body discrimination result of a corresponding reference image, and a difference between each first sample image and a corresponding reconstructed image.

6. The method of claim 1, wherein, The living body detection training model further comprises an image discrimination module configured to perform image discrimination processing on an image input to the image discrimination module to obtain an image discrimination result, wherein the image discrimination result is used to indicate that the image type of the image input to the image discrimination module is a sample image type or a reference image type; the trained feature extraction module and the trained living body discrimination module are obtained by alternately training the image discrimination module, the feature extraction module and the living body discrimination module multiple times, and the model parameters of the image discrimination module obtained in the current training are fixed and used to train the feature extraction module and the living body discrimination module obtained in the last training; The manner of training the feature extraction module and the living body discrimination module obtained in the last training comprises: The difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training and the corresponding original living body label, the difference between the living body discrimination result of each first sample image determined by the living body discrimination module obtained through the last training and the living body discrimination result of the corresponding reference image, and the difference between the image discrimination result of the reference image corresponding to each first sample image determined by the image discrimination module obtained through the current training and the image type label of the corresponding reference image are used to train the feature extraction module obtained through the last training and the living body discrimination module obtained through the last training; the image type label of the reference image corresponding to each first sample image is used to indicate the image type of the reference image corresponding to each first sample image.

7. The method of claim 1, wherein, The method further comprises: obtaining a plurality of second sample images; any second sample image comprises a target object; predicting a predicted living body label of each second sample image through the trained feature extraction module and the trained living body discrimination module; determining the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image through the trained living body detection training model, wherein the trained living body detection training model is obtained by training the living body detection training model based on the difference between the living body discrimination result of each first sample image and the corresponding original living body label, and the difference between the living body discrimination result of each first sample image and the living body discrimination result of the corresponding reference image; optimizing the trained feature extraction module and the trained living body discrimination module based on the difference between the living body discrimination result of each second sample image and the corresponding predicted living body label, and the difference between the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image; constructing the living body detection model based on the optimized feature extraction module and the optimized living body discrimination module. The difference between the living body discrimination result of each second sample image and the corresponding predicted living body label is reflected by a target living body discrimination loss value, wherein the target living body discrimination loss value is determined by the living body discrimination result of each second sample image and the corresponding predicted living body label; 8. The method of claim 7, wherein, The method further comprises: determining the target living body discrimination loss value based on the living body discrimination result of each second sample image and the corresponding predicted living body label, and determining the living body discrimination loss value corresponding to each second sample image; determining the confidence of the predicted living body label of each second sample image based on the distribution difference between the living body discrimination result of each second sample image and the living body discrimination result of the corresponding reference image; determining the target living body discrimination loss value based on the confidence of the predicted living body label of each second sample image and the living body discrimination loss value corresponding to each second sample image. The method further comprises:

9. The method of claim 1, wherein, ​ Output a target image acquisition interface; the target image acquisition interface includes prompt information, and the prompt information is used for prompting a to-be-acquired image; Acquire a target image to be collected for live body detection; Extract, by a trained feature extraction module in the live body detection model, a live body feature of the target image; Perform live body discrimination processing on the live body feature of the target image by a trained live body discrimination module in the live body detection model, to obtain a live body discrimination result of the target image; If the live body discrimination result of the target image indicates that a target object in the target image is imaged as a live body, perform face recognition processing on the target object in the target image, to obtain a face recognition result; Perform a corresponding operation based on the face recognition result.

10. The method of claim 1, wherein, The multi-domain mixing processing of the domain feature of any first sample image and the domain features of other first sample images in the plurality of first sample images to obtain the mixed domain feature of the any first sample image includes: Determining a target neighbor image of the any first sample image from the other first sample images; the similarity between the domain feature of any target neighbor image and the domain feature of the any first sample image is greater than the similarity between the domain features of the remaining first sample images in the other first sample images and the domain feature of the any first sample image; Adjusting the domain feature of the any first sample image by using the attention weight of the any first sample image to obtain an adjusted domain feature of the any first sample image, and adjusting the domain features of the respective target neighbor images by using the attention weights of the respective target neighbor images to obtain adjusted domain features of the respective target neighbor images; Determining the mixed domain feature of the any first sample image based on the adjusted domain feature of the any first sample image and the adjusted domain features of the respective target neighbor images.

11. The method of claim 1, wherein, The manner in which the feature extraction module extracts the live body feature and the domain feature of the any first sample image includes: The feature extraction module extracts the image feature of the any first sample image to obtain the image feature of the any first sample image; The image feature of the any first sample image is subjected to live body feature extraction processing to obtain the live body feature of the any first sample image, and is subjected to domain feature extraction processing to obtain the domain feature of the any first sample image.

12. The method of claim 1, wherein, The manner in which the feature extraction module extracts the live body feature and the domain feature of the any first sample image includes: The image feature of the any first sample image is subjected to live body feature extraction processing to obtain the live body feature of the any first sample image, and is subjected to domain feature extraction processing to obtain the domain feature of the any first sample image. The manner in which the feature extraction module extracts the live body feature and the domain feature of the any first sample image includes:

13. An image processing apparatus characterized by comprising: The live body feature and the mixed domain feature of the any first sample image are spliced to obtain spliced image features of the any first sample image; Image generation processing is performed based on the spliced image features of the any first sample image to obtain a reference image corresponding to the any first sample image. The acquisition unit is configured to acquire a plurality of first sample images and original live body labels of target objects in the first sample images. The original living body label is used to indicate whether the target object is a living body or a non-living body when being imaged; The processing unit is configured to extract, by a feature extraction module in the living body detection training model, living body features of the first sample images and domain features of the first sample images, respectively; the living body features are used to represent features for determining whether the target object is a living body or a non-living body when being imaged, and the domain features are used to represent features that cause misjudgment of whether the target object is a living body or a non-living body when being imaged; The processing unit is further configured to perform multi-domain mixing processing on the domain features of any first sample image and the domain features of other first sample images in the plurality of first sample images, to obtain mixed domain features of the any first sample image; The processing unit is further configured to generate a reference image corresponding to the any first sample image based on the living body features and the mixed domain features of the any first sample image; The processing unit is further configured to extract, by the feature extraction module, living body features of the reference image corresponding to the any first sample image; The processing unit is further configured to perform living body discrimination processing on the living body features of the any first sample image and the living body features of the corresponding reference image by a living body discrimination module in the living body detection training model, to obtain a living body discrimination result of the any first sample image and a living body discrimination result of the corresponding reference image; The processing unit is further configured to train the feature extraction module and the living body discrimination module based on differences between the living body discrimination results of the first sample images and the corresponding original living body labels, and differences between the living body discrimination results of the first sample images and the living body discrimination results of the corresponding reference images, and to construct a living body detection model based on the trained feature extraction module and the trained living body discrimination module; the living body detection model is used to perform living body detection on a target image to be detected.

14. An image processing apparatus characterized by comprising: The image processing device comprises an input interface and an output interface, and further comprises: a processor adapted to implement one or more instructions; and a computer storage medium storing one or more instructions, the one or more instructions being adapted to be loaded and executed by the processor to implement the image processing method according to any one of claims 1-12.

15. A computer storage medium, comprising, The computer storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the image processing method according to any one of claims 1-12. The computer storage medium stores computer program instructions, and the computer program instructions are executed by the processor to implement the image processing method according to any one of claims 1-12.

Citation Information

Patent Citations

  • Method and device for detecting living body

    CN108416324A

  • Living body detection method, device, terminal equipment and storage medium

    CN113033305A