Liveness detection model training method, device, electronic device and storage medium

By extracting feature information from source and target domain image samples, generating live and non-live migration image samples, and training the liveness detection model, the domain migration problem of the liveness detection model in the target domain is solved, and high-accuracy liveness detection is achieved.

CN116704617BActive Publication Date: 2025-10-03HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210161679.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-22
Publication Date
2025-10-03
Estimated Expiration
2042-02-22

AI Technical Summary

Technical Problem

Due to the large domain differences between the source domain and the target domain, the different data distributions lead to a significant drop in the detection accuracy of the liveness detection model in the target domain, or even complete failure. In addition, it is expensive to obtain target domain samples, especially non-live samples. How to solve the domain migration problem with only a small number of target domain samples has become an urgent problem that needs to be solved.

Method used

By extracting live and non-live feature information from source domain image samples and domain feature information from target domain image samples, live migration and non-live migration image samples of the target domain are generated. Based on these feature information, the preset liveness detection model is trained to generate a liveness detection model for the target domain.

Benefits of technology

With only a small number of target domain samples, a liveness detection model with high detection accuracy is trained, which solves the domain migration problem of the liveness detection model and improves the adaptability and accuracy of the detection model in the target domain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116704617B_ABST
    Figure CN116704617B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention provide a method, device, electronic device, and storage medium for training a liveness detection model. The method includes: obtaining source domain image samples and target domain image samples, extracting liveness feature information from the source domain liveness image samples, extracting non-liveness feature information from the source domain non-liveness image samples, and extracting domain feature information from the target domain image samples. Based on the liveness feature information and the domain feature information, liveness migration image samples of the target domain are generated, and based on the non-liveness feature information and the domain feature information, non-liveness migration image samples of the target domain are generated. Based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples, a preset liveness detection model is trained to obtain a liveness detection model of the target domain. In the case of only a small number of target domain samples, the domain migration problem of the liveness detection model is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a training method, device, electronic equipment and storage medium for a living body detection model. Background Art

[0002] With the rapid development of deep learning and identity recognition technologies, identity recognition systems are widely used in scenarios such as banks, train stations, and airports. To ensure the stability and security of identity recognition systems, liveness detection is often used to identify illegal attacks and prevent potential losses.

[0003] The trained liveness detection model can determine whether the detected object is a real live person. However, the scenarios in which the liveness detection model is trained and used may be different. That is, the model is trained using a dataset from the source domain, but the model is applied to a dataset from the target domain. The inventors found that due to the large differences between the source and target domains, the different data distributions lead to domain migration problems, which causes the liveness detection model's detection accuracy for the target domain to drop significantly, or even become completely ineffective. The liveness detection model needs to be trained using both live and non-live samples, but the acquisition cost of target domain samples is relatively expensive, and non-live samples are even more difficult to obtain. Therefore, when there are only a small number of target domain samples, how to solve the domain migration problem becomes an urgent problem that needs to be solved. Summary of the Invention

[0004] The present invention provides a method, apparatus, electronic device, and storage medium for training a liveness detection model, which can solve the domain migration problem when only a small number of target domain samples are available. The specific technical solution is as follows:

[0005] In a first aspect, an embodiment of the present invention provides a method for training a liveness detection model, the method comprising:

[0006] Acquire source domain image samples and target domain image samples, wherein the source domain image samples include source domain living body image samples and source domain non-living body image samples;

[0007] Extracting live feature information from the source domain live image samples, and extracting non-live feature information from the source domain non-live image samples;

[0008] extracting domain feature information from the target domain image sample, wherein the domain feature information is used to identify acquisition-related information of the target domain image sample;

[0009] generating a live body migration image sample of the target domain based on the live body feature information and the domain feature information, and generating a non-live body migration image sample of the target domain based on the non-live body feature information and the domain feature information;

[0010] Based on the source domain image samples, the living body migration image samples and the non-living body migration image samples, a preset living body detection model is trained to obtain a living body detection model of the target domain.

[0011] Optionally, the step of extracting liveness feature information from the source domain liveness image samples and extracting non-liveness feature information from the source domain non-liveness image samples includes:

[0012] Performing frequency domain transformation on the source domain image samples to obtain a source domain spectrum graph corresponding to each source domain image sample;

[0013] Extracting a high-frequency region in the spectrum graph corresponding to the source domain living body image sample as living body feature information;

[0014] Extracting a high-frequency region in the spectrum graph corresponding to the source domain non-living body image sample as non-living body feature information;

[0015] The step of extracting domain feature information from the target domain image sample includes:

[0016] Performing frequency domain transformation on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample;

[0017] The low-frequency region in the spectrum graph corresponding to each target domain image sample is extracted as domain feature information.

[0018] Optionally, the step of generating a liveness migration image sample of the target domain based on the liveness feature information and the domain feature information, and generating a non-liveness migration image sample of the target domain based on the non-liveness feature information and the domain feature information includes:

[0019] Mixing the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum graph;

[0020] Mixing the non-living feature information with the domain feature information to obtain a second mixed spectrum;

[0021] The first mixed spectrum is subjected to an inverse frequency domain transformation to obtain a living body migration image sample of the target domain, and the second mixed spectrum is subjected to an inverse frequency domain transformation to obtain a non-living body migration image sample of the target domain.

[0022] Optionally, the step of training a preset liveness detection model based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples includes:

[0023] Acquire training samples, wherein the training samples include source domain image samples and target domain migration image samples in a preset ratio, and the target domain migration image samples include the living body migration image samples and the non-living body migration image samples;

[0024] The training samples are input into a preset liveness detection model, and based on the output results of the preset liveness detection model and the labels of the training samples, the parameters of the preset liveness detection model are adjusted until the preset liveness detection model converges, wherein the labels of the target domain migrated image samples are the same as the labels of their corresponding source domain image samples.

[0025] Optionally, the step of obtaining training samples includes:

[0026] Mixing the source domain image samples and the target domain migrated image samples in a preset ratio to obtain training samples; or,

[0027] Part of the image samples in the source domain image samples are replaced with the target domain migrated image samples to obtain training samples including source domain image samples and target domain migrated image samples in a preset ratio.

[0028] Optionally, the method further includes:

[0029] Acquire an image to be detected in the target domain, wherein the image to be detected includes a target to be detected;

[0030] Performing liveness detection on the image to be detected based on the liveness detection model of the target domain to determine whether the target to be detected is a live target.

[0031] Optionally, the target domain image sample is a target domain living image sample.

[0032] In a second aspect, an embodiment of the present invention provides a training device for a liveness detection model, the device comprising:

[0033] An image sample acquisition module, configured to acquire source domain image samples and target domain image samples, wherein the source domain image samples include source domain living body image samples and source domain non-living body image samples;

[0034] a first extraction module, configured to extract liveness feature information from the source domain liveness image samples, and extract non-liveness feature information from the source domain non-liveness image samples;

[0035] a second extraction module, configured to extract domain feature information from the target domain image sample, wherein the domain feature information is used to identify acquisition-related information of the target domain image sample;

[0036] a sample generation module, configured to generate a live body migration image sample of the target domain based on the live body feature information and the domain feature information, and to generate a non-live body migration image sample of the target domain based on the non-live body feature information and the domain feature information;

[0037] A model training module is used to train a preset liveness detection model based on the source domain image samples, the liveness migration image samples and the non-liveness migration image samples to obtain a liveness detection model of the target domain.

[0038] Optionally, the first extraction module includes:

[0039] A first frequency domain transform unit is configured to perform frequency domain transform on the source domain image samples to obtain a source domain spectrum corresponding to each source domain image sample;

[0040] A living body feature extraction unit, configured to extract a high-frequency region in the spectrum graph corresponding to the source domain living body image sample as living body feature information;

[0041] a non-living feature extraction unit, configured to extract a high-frequency region in the spectrum graph corresponding to the source domain non-living image sample as non-living feature information;

[0042] The second extraction module includes:

[0043] a second frequency domain transform unit, configured to perform frequency domain transform on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample;

[0044] The domain feature extraction unit is used to extract the low-frequency area in the spectrum graph corresponding to each target domain image sample as domain feature information.

[0045] Optionally, the sample generation module includes:

[0046] a first mixing unit, configured to mix the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum;

[0047] a second mixing unit, configured to mix the non-living feature information with the domain feature information to obtain a second mixed spectrum;

[0048] The frequency domain inverse transformation unit is used to perform frequency domain inverse transformation on the first mixed spectrum to obtain living body migration image samples in the target domain, and to perform frequency domain inverse transformation on the second mixed spectrum to obtain non-living body migration image samples in the target domain.

[0049] Optionally, the model training module includes:

[0050] a training sample acquisition unit, configured to acquire training samples, wherein the training samples include source domain image samples and target domain migration image samples in a preset ratio, and the target domain migration image samples include the living body migration image samples and the non-living body migration image samples;

[0051] A model training unit is used to input the training samples into a preset liveness detection model, and adjust the parameters of the preset liveness detection model based on the output results of the preset liveness detection model and the labels of the training samples until the preset liveness detection model converges, wherein the labels of the target domain migrated image samples are the same as the labels of their corresponding source domain image samples.

[0052] Optionally, the training sample acquisition unit includes:

[0053] a training sample acquisition subunit, configured to mix the source domain image samples and the target domain migrated image samples in a preset ratio to obtain training samples; or

[0054] Part of the image samples in the source domain image samples are replaced with the target domain migrated image samples to obtain training samples including source domain image samples and target domain migrated image samples in a preset ratio.

[0055] Optionally, the device further includes:

[0056] An image acquisition module to be detected is used to acquire an image to be detected in the target domain, wherein the image to be detected includes a target to be detected;

[0057] A liveness detection module is used to perform liveness detection on the image to be detected based on the liveness detection model of the target domain to determine whether the target to be detected is a live target.

[0058] Optionally, the target domain image sample is a target domain living image sample.

[0059] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0060] Memory for storing computer programs;

[0061] The processor is configured to implement any of the method steps described in the first aspect when executing a program stored in the memory.

[0062] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of the first aspects are implemented.

[0063] Beneficial effects of the embodiments of the present invention:

[0064] In the solution provided by an embodiment of the present invention, an electronic device can obtain source domain image samples and target domain image samples, wherein the source domain image samples include source domain live image samples and source domain non-live image samples; extract live feature information from the source domain live image samples, and extract non-live feature information from the source domain non-live image samples; and extract domain feature information from the target domain image samples, wherein the domain feature information is used to identify acquisition-related information of the target domain image samples. The electronic device can generate live transfer image samples of the target domain based on the live feature information and domain feature information, and generate non-live transfer image samples of the target domain based on the non-live feature information and domain feature information. Furthermore, based on the source domain image samples, live transfer image samples, and non-live transfer image samples, a preset liveness detection model is trained to obtain a liveness detection model of the target domain. Based on the extracted live feature information, non-live feature information, and domain feature information, the electronic device can generate a large number of live migration image samples and non-live migration image samples of the target domain. Then, the source domain image samples, live migration image samples, and non-live migration image samples are used to train a liveness detection model. The liveness detection model can accurately determine whether the target to be detected included in the target domain's image to be detected is a live target. In the case of only a small number of target domain samples, a liveness detection model with high detection accuracy for the target domain can be trained, solving the domain migration problem of the liveness detection model. Of course, implementing any product or method of the present invention does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0066] Figure 1 A flowchart of a method for training a liveness detection model provided by an embodiment of the present invention;

[0067] Figure 2 Based on Figure 1 A specific flow chart of step S102 in the embodiment shown;

[0068] Figure 3Based on Figure 1 A specific flow chart of step S103 in the embodiment shown;

[0069] Figure 4 Based on Figure 1 A specific flow chart of step S104 in the embodiment shown;

[0070] Figure 5 Based on Figure 4 A schematic diagram of a process for obtaining a sample of a live migration image according to the embodiment shown;

[0071] Figure 6 Based on Figure 1 A specific flow chart of step S105 in the embodiment shown;

[0072] Figure 7 Based on Figure 1 A flow chart of performing liveness detection on an image to be detected according to the embodiment shown;

[0073] Figure 8 A schematic diagram of the structure of a training device for a liveness detection model provided by an embodiment of the present invention;

[0074] Figure 9 Based on Figure 8 A schematic structural diagram of the model training module of the illustrated embodiment;

[0075] Figure 10 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0076] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on the present invention are within the scope of protection of the present invention.

[0077] To address the domain migration problem of liveness detection models when only a small number of target domain samples are available, thereby improving the detection capability and accuracy of liveness detection models, embodiments of the present invention provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for training liveness detection models. The following first introduces a liveness detection model training method provided by embodiments of the present invention. The liveness detection model can be a deep learning or neural network model.

[0078] The liveness detection model training method provided in the embodiments of the present invention can be applied to any electronic device capable of training a liveness detection model, such as various computing devices, processing devices, and servers used for model training, without specific limitation herein. For clarity, the electronic device will be referred to as such.

[0079] like Figure 1 As shown, a training method for a living body detection model includes:

[0080] S101: Acquire source domain image samples and target domain image samples.

[0081] The source domain image samples include source domain living body image samples and source domain non-living body image samples.

[0082] S102 : extracting liveness feature information from the source domain liveness image samples, and extracting non-liveness feature information from the source domain non-liveness image samples.

[0083] S103: extracting domain feature information from the target domain image sample.

[0084] The domain feature information is used to identify acquisition-related information of the target domain image sample.

[0085] S104 : generating living body transition image samples of the target domain based on the living body feature information and the domain feature information, and generating non-living body transition image samples of the target domain based on the non-living body feature information and the domain feature information.

[0086] S105 , training a preset liveness detection model based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples to obtain a liveness detection model of the target domain.

[0087] It can be seen that in the solution provided by the embodiment of the present invention, the electronic device can obtain source domain image samples and target domain image samples, wherein the source domain image samples include source domain live image samples and source domain non-live image samples; extract live feature information from the source domain live image samples, and extract non-live feature information from the source domain non-live image samples; extract domain feature information from the target domain image samples, wherein the domain feature information is used to identify the acquisition-related information of the target domain image samples. The electronic device can generate live migration image samples of the target domain based on the live feature information and domain feature information, and generate non-live migration image samples of the target domain based on the non-live feature information and domain feature information. Furthermore, based on the source domain image samples, the live migration image samples, and the non-live migration image samples, a preset liveness detection model is trained to obtain a liveness detection model of the target domain. Based on the extracted liveness feature information, non-liveness feature information, and domain feature information, the electronic device can generate a large number of liveness and non-liveness transfer image samples for the target domain. Furthermore, the source domain image samples, liveness transfer image samples, and non-liveness transfer image samples are used to train a liveness detection model. This liveness detection model can accurately determine whether the target object included in the target domain image is live. Even with only a small number of target domain samples, a liveness detection model with highly accurate detection results for the target domain can be trained, solving the domain transfer problem of the liveness detection model.

[0088] Liveness detection is a technology used to determine whether an object in an image is a live person. It is commonly used in identity recognition systems. Liveness detection can identify non-liveness attacks, ensuring system stability and security. The training and use of liveness detection models can occur in different scenarios. For example, a liveness detection model may be trained using a dataset from the source domain, but then applied to a dataset from the target domain. The different data distributions lead to domain migration issues, significantly reducing the accuracy of the liveness detection model in the target domain, or even completely failing.

[0089] In order for the liveness detection model to accurately determine whether the target to be detected is a live target, it needs to be trained using live samples and non-live samples. For example, live samples are real human bodies, and non-live samples are paper photos of human bodies. For another example, live samples are real human face samples, and non-live samples can be face images printed on color paper, face images on electronic device screens, 3D (3-Dimension) face model images, etc. Therefore, the cost of obtaining target domain samples is relatively expensive, and non-live samples are even more difficult to obtain. When there are only a small number of target domain samples, the domain migration problem of the liveness detection model is difficult to solve.

[0090] For the case where the number of samples in the target domain is small, in order to accurately determine whether the target to be detected is a living target, the electronic device can train the liveness detection model through the method of few-sample domain migration. In an embodiment of the present invention, the image samples used to train the liveness detection model can be divided into source domain image samples and target domain image samples, wherein the source domain is the scene corresponding to the data set of the original training of the liveness detection model, and the source domain image samples include living and non-living image samples with known labels, that is, source domain living image samples and source domain non-living image samples; the target domain is the scene where the liveness detection model is applied. In the solution provided by the embodiment of the present invention, the problem of domain differences caused by cross-device or cross-scenario when training and applying the liveness detection model can be solved by the method of few-sample domain migration.

[0091] In the above step S101, the electronic device can obtain source domain image samples and target domain image samples. The source domain image samples include source domain living body image samples and source domain non-living body image samples. The labels of the source domain image samples are known, that is, the labels of the source domain image samples as living body or non-living body are known. The target domain image samples are image samples collected in the target domain. Since it is relatively easy to obtain target domain living body image samples, the target domain image samples can be living body image samples, that is, target domain living body image samples, or of course, non-living body image samples, which are all reasonable. The target domain image samples can be collected by the electronic device or input into the electronic device by an external device, which is not limited here.

[0092] In one embodiment, before obtaining the above-mentioned image samples, the domain migration scenario of liveness detection can be determined first. For example, liveness detection can be face liveness detection, iris liveness detection, etc., and the domain migration scenario can be cross-device or cross-scene, etc., which is not specifically limited here. If the domain migration scenario of liveness detection is cross-scene iris liveness detection, the electronic device can obtain source domain image samples, including live iris image samples of the source domain and non-live iris image samples of the source domain. And obtain target domain image samples, that is, iris image samples of the target domain. The number of source domain image samples can be determined based on actual conditions such as storage space size and detection accuracy requirements. The number of target domain image samples can be smaller, for example, 5, 10, 15, etc., which is not limited here.

[0093] Image samples can include a large amount of feature information, including liveness feature information or non-liveness feature information that can indicate whether the target included in the image sample is live. Domain feature information can be used to identify acquisition-related information of the target domain image sample, that is, it can characterize the acquisition domain of the image sample, that is, the style of the image sample, and can include feature information that can reflect characteristics of the acquisition device and environment of the image sample. Therefore, for each acquired source domain liveness image sample, the electronic device can extract the liveness feature information therein, and for each source domain non-liveness image sample, the electronic device can extract the non-liveness feature information therein, that is, execute the above-mentioned step S102.

[0094] In step S103, the electronic device may extract domain feature information from the target domain image sample. The domain feature information corresponds to the acquisition domain of the target domain image sample and may reflect characteristics of the target domain acquisition scene, such as illumination and acquisition equipment.

[0095] Furthermore, in the above step S104, the electronic device may generate live body migration image samples of the target domain based on the live body feature information and the domain feature information, and generate non-live body migration image samples of the target domain based on the non-live body feature information and the domain feature information.

[0096] After obtaining live feature information, non-live feature information and domain feature information, for each live feature information, the electronic device can fuse it with multiple domain feature information respectively to generate a live migration image sample. For each non-live feature information, the electronic device can fuse it with multiple domain feature information respectively to generate a non-live migration image sample.

[0097] Since the labels of the source domain image samples are known, the live migration image samples of the generated target domain have the same labels as their corresponding source domain image samples, that is, live, and the non-live migration image samples of the generated target domain have the same labels as their corresponding source domain image samples, that is, non-live. In this way, a large number of live migration image samples and non-live migration image samples with the characteristics of samples collected in the target domain scene are obtained.

[0098] For example, the electronic device acquires 100 source domain image samples, including 50 source domain live image samples and 50 source domain non-live image samples, and the target domain image samples are 10. The electronic device can then extract liveness feature information corresponding to the 50 source domain live image samples and non-liveness feature information corresponding to the 50 source domain non-live image samples, and can also extract domain feature information corresponding to the 10 target domain image samples. The liveness feature information corresponding to the 50 source domain live image samples can then be fused with the domain feature information corresponding to the 10 target domain image samples, generating 50 × 10 = 500 live transfer image samples in the target domain. Similarly, the number of non-live transfer image samples in the target domain that can be generated is 50 × 10 = 500.

[0099] In the above step S105, the electronic device can train a preset liveness detection model based on the above source domain image samples, liveness migration image samples and non-liveness migration image samples to obtain a liveness detection model of the target domain.

[0100] The electronic device can use source domain image samples, liveness transfer image samples, and non-liveness transfer image samples as training samples for a preset liveness detection model and input them into the preset liveness detection model. Because the training samples include liveness samples and non-liveness samples, and their labels are known, the electronic device can adjust the parameters of the preset liveness detection model based on the output results of the preset liveness detection model and the labels of the training samples until the preset liveness detection model converges, thereby obtaining a liveness detection model for the target domain. This liveness detection model for the target domain can accurately determine whether the target to be detected in the target domain is a live target.

[0101] By adopting the solution provided by the embodiments of the present invention, electronic devices can extract liveness or non-liveness feature information from source domain image samples and domain feature information from target domain image samples. Based on the liveness or non-liveness feature information and domain feature information, they can generate a large number of liveness and non-liveness migration image samples with source domain labels and target domain features, and train a preset liveness detection model. The trained liveness detection model in the target domain has good adaptability in the target domain and can determine whether the target to be detected in the target domain is live. This alleviates the dependence of domain migration on large-scale liveness and non-liveness image samples in the target domain. When only a small number of target domain samples are available, the domain migration problem of the liveness detection model is solved at a very low cost.

[0102] As an implementation method of the embodiment of the present invention, Figure 2 As shown, the steps of extracting liveness feature information from the source domain liveness image samples and extracting non-liveness feature information from the source domain non-liveness image samples may include:

[0103] S201 : Perform frequency domain transformation on the source domain image samples to obtain a source domain frequency spectrum corresponding to each source domain image sample.

[0104] In image processing, frequency domain transformation is the process of transforming an image from pixel coordinates in the spatial domain to spectral coordinates in the frequency domain, thereby obtaining the image's spectrogram. The image's spectrogram consists of high-frequency and low-frequency regions. Regions of the image with slow brightness changes can generate low-frequency signals, which contribute to the low-frequency region of the spectrogram after the frequency domain transformation. Regions of the image with fast brightness changes can generate high-frequency signals, which contribute to the high-frequency region of the spectrogram after the frequency domain transformation.

[0105] In the liveness detection scenario, the image sample includes a large amount of feature information. The liveness feature information and non-liveness feature information of the image sample correspond to the area with fast brightness change in the image, that is, the high-frequency area in the spectrum diagram; the domain feature information of the image sample corresponds to the area with slow brightness change in the image, that is, the low-frequency area in the spectrum diagram. Therefore, for each source domain image sample, the electronic device can obtain the source domain spectrum diagram corresponding to each source domain image sample through frequency domain transformation, and then extract the liveness feature information or non-liveness feature information from the source domain spectrum diagram. The frequency domain transformation method of the source domain image sample can be Fourier transform or discrete cosine transform, etc., which is not limited here. When the frequency domain transformation method is discrete cosine transform, the electronic device can obtain the source domain spectrum diagram corresponding to the source domain image sample; when the frequency domain transformation method is Fourier transform, the electronic device can obtain the amplitude spectrum and phase spectrum corresponding to the source domain image sample as the source domain spectrum diagram.

[0106] S202 : Extracting a high-frequency region in the spectrum graph corresponding to the source domain living body image sample as living body feature information.

[0107] Since the high-frequency region in the spectrum graph corresponding to the source domain living image sample has a strong correlation with the living feature information in the source domain living image sample, the electronic device can extract the high-frequency region in the spectrum graph as the living feature information.

[0108] In one embodiment, when the frequency domain transformation method is discrete cosine transform, the electronic device may extract regions in the spectrum graph with frequencies above a preset frequency threshold as living body signature information. The preset frequency threshold can be set based on historical image processing experience and the effectiveness of feature extraction, and is not limited here.

[0109] In another embodiment, when the frequency domain transformation method is Fourier transform, since the area closer to the center of the amplitude spectrum corresponds to a lower frequency, and the area closer to the edge of the amplitude spectrum corresponds to a higher frequency, the electronic device can extract the part outside the rectangular area of ​​a preset size with the center of the amplitude spectrum as the center point in the amplitude spectrum as living body feature information, where the preset size can be set based on factors such as amplitude spectrum processing experience and actual high and low frequency division requirements, and is not specifically limited here.

[0110] S203 , extracting a high-frequency region in the spectrum graph corresponding to the source domain non-living body image sample as non-living body feature information.

[0111] Since the high-frequency region in the spectrum graph corresponding to the source domain non-living image sample has a strong correlation with the non-living feature information in the source domain living image sample, the electronic device can extract the high-frequency region in the spectrum graph as the non-living feature information.

[0112] In one embodiment, when the frequency domain transformation method is discrete cosine transform, the electronic device may extract regions in the spectrum graph with frequencies above a preset frequency threshold as non-living feature information. The preset frequency threshold can be set based on historical image processing experience and feature extraction results, and is not limited here.

[0113] In another embodiment, when the frequency domain transformation method is Fourier transform, since the area closer to the center of the amplitude spectrum corresponds to a lower frequency, and the area closer to the edge of the amplitude spectrum corresponds to a higher frequency, the electronic device can extract the part outside the rectangular area of ​​a preset size with the center of the amplitude spectrum as the center point in the amplitude spectrum as non-living feature information, where the preset size can be set based on factors such as amplitude spectrum processing experience and actual high and low frequency division requirements, and is not specifically limited here.

[0114] Correspondingly, such as Figure 3 As shown, the above step of extracting domain feature information from the target domain image sample may include:

[0115] S301 : Perform frequency domain transformation on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample.

[0116] The domain feature information of the image sample corresponds to the area in the image where the brightness changes slowly, that is, the low-frequency area in the spectrum graph. Therefore, for each target domain image sample, the electronic device can obtain the spectrum graph corresponding to each target domain image sample through frequency domain transformation, and then extract the domain feature information from the spectrum graph. Accordingly, the frequency domain transformation method of the target domain image sample can be Fourier transform or discrete cosine transform, etc., which can be the same as the frequency domain transformation method of the source domain image sample, and is not specifically limited here. When the frequency domain transformation method is discrete cosine transform, the electronic device can obtain the target domain spectrum graph corresponding to the target domain image sample; when the frequency domain transformation method is Fourier transform, the electronic device can obtain the amplitude spectrum and phase spectrum corresponding to the target domain image sample as the target domain spectrum graph.

[0117] S302 : Extracting a low-frequency region in the spectrum graph corresponding to each target domain image sample as domain feature information.

[0118] Since the low-frequency region in the spectrum graph corresponding to the target domain image sample has a strong correlation with the domain feature information in the target domain image sample, the electronic device can extract the low-frequency region in the spectrum graph as the domain feature information.

[0119] In one embodiment, when the frequency domain transformation method is discrete cosine transform, the electronic device may extract regions in the spectrum graph whose frequencies are below a preset frequency threshold as domain feature information. The preset frequency threshold can be set based on historical image processing experience and feature information extraction results, and is not limited here.

[0120] In another embodiment, when the frequency domain transformation method is Fourier transform, since the area closer to the center of the amplitude spectrum corresponds to a lower frequency, and the area closer to the edge of the amplitude spectrum corresponds to a higher frequency, the electronic device can extract a rectangular area of ​​a preset size with the center of the amplitude spectrum as the center point in the amplitude spectrum as field feature information, where the preset size can be set based on factors such as amplitude spectrum processing experience and actual high and low frequency division requirements, and is not specifically limited here.

[0121] In this embodiment, the electronic device can perform a frequency domain transform on the source domain image samples, extracting high-frequency regions containing liveness characteristics from the resulting spectrum as liveness characteristic information, extracting high-frequency regions containing non-liveness characteristics as non-liveness characteristic information, and perform a frequency domain transform on the target domain image samples, extracting low-frequency regions containing domain characteristics from the resulting spectrum as domain characteristic information. In this way, the electronic device can extract accurate liveness characteristic information, non-liveness characteristic information, and domain characteristic information, ensuring that accurate liveness migration image samples and non-liveness migration image samples in the target domain can be obtained, thereby improving the detection accuracy of the liveness detection model.

[0122] As an implementation method of the embodiment of the present invention, Figure 4 As shown, the steps of generating liveness migration image samples of the target domain based on the liveness feature information and the domain feature information, and generating non-liveness migration image samples of the target domain based on the non-liveness feature information and the domain feature information may include:

[0123] S401: Mix the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum.

[0124] To obtain a target domain live migration image sample having source domain liveness features and target domain domain features, the electronic device may mix the extracted liveness feature information with the domain feature information to obtain a first mixed spectrum. In one embodiment, the spectrum corresponding to the liveness feature information and the spectrum corresponding to the domain feature information may be superimposed to obtain the first mixed spectrum.

[0125] S402: Mix the non-living feature information with the domain feature information to obtain a second mixed spectrum.

[0126] To obtain a target domain non-liveness migration image sample having source domain non-liveness features and target domain domain features, the electronic device may mix the extracted non-liveness feature information with the domain feature information to obtain a second mixed spectrum. In one embodiment, the spectrum corresponding to the non-liveness feature information and the spectrum corresponding to the domain feature information may be superimposed to obtain the second mixed spectrum.

[0127] S403 , performing an inverse frequency domain transformation on the first mixed spectrum to obtain living body migration image samples in the target domain, and performing an inverse frequency domain transformation on the second mixed spectrum to obtain non-living body migration image samples in the target domain.

[0128] After obtaining the first mixed spectrogram, the electronic device can perform an inverse frequency domain transform on the first mixed spectrogram to obtain a live migration image sample in the target domain. Since the first mixed spectrogram is obtained by mixing live feature information from the source domain with domain feature information from the target domain, the live migration image sample includes both live features from the source domain and domain features from the target domain, thus simulating an image sample of the live target collected in the target domain. Its label is consistent with the corresponding live image sample in the source domain.

[0129] After obtaining the second mixed spectrogram, the electronic device can perform an inverse frequency domain transform on the second mixed spectrogram to obtain a non-live object migration image sample in the target domain. Since the second mixed spectrogram is obtained by mixing the non-live object feature information in the source domain with the domain feature information in the target domain, the non-live object migration image sample includes both the source domain non-live object features and the target domain features, and can thus simulate an image sample of the non-live object collected in the target domain. Its label is consistent with the corresponding source domain non-live object image sample.

[0130] The frequency domain inverse transformation method may be an inverse Fourier transform or an inverse discrete cosine transform, etc., which are inverse processes of the frequency domain transformation methods of the source domain image samples and the target domain image samples, and are not specifically limited here.

[0131] In one embodiment, when the frequency domain transformation method is discrete cosine transform, the frequency domain inverse transformation method is inverse discrete cosine transform. The electronic device can perform inverse discrete cosine transform on the first mixed spectrum to obtain a living migration image sample of the target domain, and perform inverse discrete cosine transform on the second mixed spectrum to obtain a non-living migration image sample of the target domain.

[0132] In another embodiment, when the frequency domain transformation method is Fourier transform, the frequency domain inverse transformation method is inverse Fourier transform. The electronic device can perform inverse Fourier transform on the first mixed spectrum graph and the phase spectrum of the source domain image sample to obtain a living migration image sample of the target domain, and perform inverse Fourier transform on the second mixed spectrum graph and the phase spectrum of the source domain image sample to obtain a non-living migration image sample of the target domain.

[0133] In this embodiment, the electronic device can mix liveness feature information with domain feature information to obtain a first spectrum diagram, and obtain liveness migration image samples through inverse frequency domain transformation; and mix non-liveness feature information with domain feature information to obtain a second spectrum diagram, and obtain non-liveness migration image samples through inverse frequency domain transformation. The liveness migration image samples and non-liveness migration image samples obtained in this manner can have a high degree of similarity with liveness image samples and non-liveness image samples actually collected in the target domain. In other words, the liveness migration image samples and non-liveness migration image samples have high authenticity. Therefore, based on the liveness migration image samples and non-liveness migration image samples, a preset liveness detection model is trained. The liveness detection model of the target domain obtained by training has good adaptability in the target domain and can effectively solve the domain migration problem of the liveness detection model.

[0134] The following combination Figure 5 The process of obtaining a living body migration image sample based on a frequency domain transformation method provided in an embodiment of the present invention is introduced by way of example, wherein the frequency domain transformation method is discrete cosine transform, and the inverse frequency domain transformation method is inverse discrete cosine transform.

[0135] In step A, the electronic device can obtain a source domain living body image sample, obtain a source domain spectrum graph through discrete cosine transform, and extract the high-frequency area in the spectrum graph that is higher than a preset frequency threshold as living body feature information.

[0136] Correspondingly, if the electronic device obtains a source domain non-living body image sample, it can obtain a source domain spectrum through discrete cosine transform, and extract the high-frequency area in the spectrum that is higher than a preset frequency threshold as non-living body feature information.

[0137] In step B, the electronic device may obtain a target domain image sample, obtain a target domain spectrum through discrete cosine transform, and extract a low-frequency region in the spectrum that is not higher than a preset frequency threshold as domain feature information.

[0138] In step C, the electronic device may mix the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum.

[0139] Correspondingly, if the electronic device obtains a source domain non-living body image sample and obtains non-living body feature information, the non-living body feature information can be mixed with the domain feature information to obtain a second mixed spectrum graph.

[0140] In step D, the electronic device may perform inverse discrete cosine transform on the first mixed spectrum to obtain a living body migration image sample.

[0141] Correspondingly, if the electronic device obtains a source domain non-living image sample, obtains non-living feature information, and then obtains a second mixed spectrum, the electronic device can obtain a non-living migration image sample by performing an inverse discrete cosine transform on the second mixed spectrum.

[0142] As an implementation method of the embodiment of the present invention, Figure 6 As shown, the step of training the preset liveness detection model based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples may include:

[0143] S601: Obtain training samples.

[0144] The training samples include source domain image samples and target domain migration image samples in a preset ratio, and the target domain migration image samples include the living body migration image samples and the non-living body migration image samples.

[0145] Target domain migration image samples include living migration image samples and non-living migration image samples. Target domain migration image samples have both living features or non-living features of the source domain and domain features of the target domain. Although their authenticity is relatively high, target domain image migration samples are generated through image processing and mixing, and are not actually collected.

[0146] Although the source domain image samples are collected in the source domain, they are real images, and the source domain image samples include feature information of living targets and non-living targets. The liveness detection model can learn the characteristics of real living targets and non-living targets from them. Therefore, in order to further improve the accuracy of the detection results of the liveness detection model, source domain image samples and target domain migration image samples with a preset ratio can be used as training samples.

[0147] The electronic device can mix the source domain image samples and the target domain migration image samples according to a preset ratio. The preset ratio can be set based on the actual situation such as the difference between the source domain and the target domain, the historical experience of image processing, etc., and is not specifically limited here. In one case, when the difference between the source domain and the target domain is small, such as both are indoor scenes, but the interiors of different buildings, then the proportion of source domain image samples in the training samples can be increased. In another case, when the difference between the source domain and the target domain is large, such as the acquisition equipment and acquisition environment of the image samples are different, then the proportion of source domain image samples can be reduced to increase the proportion of target domain migration image samples in the training samples, so as to enhance the adaptability of the trained liveness detection model in the target domain.

[0148] S602: Input the training sample into a preset liveness detection model, and adjust the parameters of the preset liveness detection model based on the output result of the preset liveness detection model and the label of the training sample until the preset liveness detection model converges.

[0149] The labels of the target domain transferred image samples are the same as the labels of their corresponding source domain image samples. The labels of the source domain image samples are known. The target domain transferred image samples include living transferred image samples and non-living transferred image samples. Their labels are the same as the labels of the corresponding source domain image samples and are also known. Therefore, the labels of all training samples are known.

[0150] The electronic device can input training samples into a preset liveness detection model. The preset liveness detection model extracts image features of the training samples based on the current model parameters, determines whether the target in the training sample is live or non-live, and outputs a result. Based on the output result of the preset liveness detection model and the difference between the labels of the training samples, the electronic device can adjust the model parameters of the preset liveness detection model to continuously reduce the classification loss until the number of iterations of the training sample reaches a preset number, or the accuracy of the output result exceeds a preset accuracy. It can be determined that the preset liveness detection model has converged, and a liveness detection model for detection in the target domain is obtained.

[0151] The specific method of adjusting the model parameters of the preset living body detection model may be a gradient descent algorithm, a stochastic gradient descent algorithm, etc., which is not specifically limited here.

[0152] In this embodiment, the electronic device may use a preset ratio of source domain image samples and target domain transferred image samples as training samples, input the training samples into a preset liveness detection model, and train the model to converge. The preset ratio can be adjusted based on actual conditions to achieve a more appropriate ratio of source domain image samples to target domain transferred image samples, further improving the adaptability of the liveness detection model in the target domain and enhancing the detection accuracy of the liveness detection model.

[0153] As an implementation of an embodiment of the present invention, the step of obtaining training samples may include:

[0154] The source domain image samples and the target domain migrated image samples are mixed in a preset ratio to obtain training samples; or, part of the image samples in the source domain image samples are replaced with the target domain migrated image samples to obtain training samples including source domain image samples and target domain migrated image samples in a preset ratio.

[0155] The electronic device may mix source domain image samples and target domain transferred image samples in at least an offline mixing method and an online mixing method. In the offline mixing method, target domain transferred image samples are generated offline before training a preset liveness detection model. The electronic device may mix the source domain image samples with the target domain transferred image samples in a preset ratio to obtain training samples. The training samples may be stored in a local storage space. The electronic device may retrieve the training samples from the local storage space and input them into the preset liveness detection model for model training.

[0156] In the online hybrid approach, during the training phase of a preset liveness detection model, the electronic device can extract liveness feature information from live source image samples and non-liveness feature information from non-live source image samples online to generate target domain migration image samples. Some of the source domain image samples are replaced with target domain migration image samples, so that the ratio of the number of source domain image samples to the number of target domain migration image samples is a preset ratio. Training samples are obtained and used as input for model training. Compared to the offline hybrid approach, the online hybrid approach can save storage space because it does not need to store all source domain image samples and target domain migration image samples at the same time.

[0157] In this embodiment, the electronic device can select either an offline hybrid or online hybrid method to obtain training samples. The appropriate method can be selected based on actual circumstances. The offline hybrid method requires more storage space to store training samples, but can reduce the training time for the preset liveness detection model and improve model training efficiency. The online hybrid method takes longer to train the model, but can save a significant amount of storage space.

[0158] As an implementation method of the embodiment of the present invention, Figure 7 As shown, the above method may further include:

[0159] S701: Acquire an image to be detected in the target domain.

[0160] The liveness detection model in the target domain can accurately determine whether the target object included in the target domain image is alive. Electronic devices can deploy this liveness detection model in actual application scenarios, namely target domain scenarios, to obtain the target domain image. The target image can include information such as the target object and background, and the liveness detection model can perform liveness detection on the target object included in the target image.

[0161] For example, when this liveness detection model is used for identity verification in a bank's asset trading system, it demonstrates superior performance in liveness detection for identity verification. Therefore, when a person wants to complete an asset transaction, the electronic device can capture an image of the person as the target domain image to be detected.

[0162] S702: Perform liveness detection on the image to be detected based on the liveness detection model of the target domain to determine whether the target to be detected is a live target.

[0163] Furthermore, the electronic device can perform liveness detection on the image to be detected based on the liveness detection model to determine whether the target to be detected is alive. After acquiring the image to be detected, the electronic device can input the image to be detected into the liveness detection model of the target domain. The liveness detection model of the target domain can then extract the image features of the image to be detected, thereby determining whether the target to be detected in the image to be detected is alive and outputting the detection result. The electronic device can perform different operations based on the detection result. For example, the electronic device can control the asset trading system to perform actions such as proceeding to the next verification step or stopping the transaction based on whether the target to be detected is alive.

[0164] For example, if the labels corresponding to the training samples are "live" and "non-live", and the label corresponding to the target to be detected output by the liveness detection model in the target domain is "live", it can be determined that the person is a real live person and has the authority to trade funds, then the electronic device can control the asset trading system to perform the next step of verification; if the label corresponding to the target to be detected output by the liveness detection model in the target domain is "non-live", it can be determined that the detected target is not a real live person and does not have the authority to trade funds, and the asset trading system may be subject to a "non-live attack", then the electronic device can control the asset trading system to stop trading.

[0165] In this embodiment, the electronic device performs liveness detection on the target domain's image based on the target domain's liveness detection model. This accurately determines whether the image, including the target, is live. This allows the system to identify non-liveness attacks, ensuring the stability and security of the liveness detection system and preventing potential losses.

[0166] As an implementation manner of the embodiment of the present invention, the target domain image sample may be a target domain living body image sample.

[0167] The target domain image samples may include target domain live image samples and target domain non-live image samples. Compared with non-live image samples, live image samples are easier to obtain and have lower acquisition costs. Therefore, the target domain live image samples may be used as target domain image samples.

[0168] In this embodiment, the target domain image sample may be a target domain living body image sample. By using the target domain living body image sample as the target domain image sample, the target domain image sample can be obtained more conveniently and the acquisition cost can be reduced.

[0169] Corresponding to the above-mentioned training method of the liveness detection model, an embodiment of the present invention further provides a training device for a liveness detection model. The following introduces a training device for a liveness detection model provided by an embodiment of the present invention.

[0170] like Figure 8 As shown, a training device for a living body detection model, the device comprising:

[0171] The image sample acquisition module 801 is used to acquire source domain image samples and target domain image samples.

[0172] The source domain image samples include source domain living body image samples and source domain non-living body image samples.

[0173] The first extraction module 802 is configured to extract living body feature information from the source domain living body image samples, and extract non-living body feature information from the source domain non-living body image samples.

[0174] The second extraction module 803 is configured to extract domain feature information from the target domain image sample.

[0175] The domain feature information is used to identify acquisition-related information of the target domain image sample.

[0176] The sample generation module 804 is configured to generate live body migration image samples of the target domain based on the live body feature information and the domain feature information, and to generate non-live body migration image samples of the target domain based on the non-live body feature information and the domain feature information.

[0177] The model training module 805 is used to train a preset liveness detection model based on the source domain image samples, the liveness migration image samples and the non-liveness migration image samples to obtain a liveness detection model of the target domain.

[0178] It can be seen that in the solution provided by the embodiment of the present invention, the electronic device can obtain source domain image samples and target domain image samples, wherein the source domain image samples include source domain live image samples and source domain non-live image samples; extract live feature information from the source domain live image samples, and extract non-live feature information from the source domain non-live image samples; extract domain feature information from the target domain image samples, wherein the domain feature information is used to identify the acquisition-related information of the target domain image samples. The electronic device can generate live migration image samples of the target domain based on the live feature information and domain feature information, and generate non-live migration image samples of the target domain based on the non-live feature information and domain feature information. Furthermore, based on the source domain image samples, the live migration image samples, and the non-live migration image samples, a preset liveness detection model is trained to obtain a liveness detection model of the target domain. Based on the extracted liveness feature information, non-liveness feature information, and domain feature information, the electronic device can generate a large number of liveness and non-liveness transfer image samples for the target domain. Furthermore, the source domain image samples, liveness transfer image samples, and non-liveness transfer image samples are used to train a liveness detection model. This liveness detection model can accurately determine whether the target object included in the target domain image is live. Even with only a small number of target domain samples, a liveness detection model with highly accurate detection results for the target domain can be trained, solving the domain transfer problem of the liveness detection model.

[0179] As an implementation of an embodiment of the present invention, the first extraction module 802 may include:

[0180] The first frequency domain transformation unit is used to perform frequency domain transformation on the source domain image samples to obtain a source domain spectrum corresponding to each source domain image sample.

[0181] The living body feature extraction unit is used to extract the high-frequency area in the spectrum diagram corresponding to the source domain living body image sample as living body feature information.

[0182] The non-living feature extraction unit is used to extract the high-frequency area in the spectrum diagram corresponding to the source domain non-living image sample as non-living feature information.

[0183] The second extraction module 803 may include:

[0184] The second frequency domain transform unit is configured to perform frequency domain transform on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample.

[0185] The domain feature extraction unit is used to extract the low-frequency area in the spectrum graph corresponding to each target domain image sample as domain feature information.

[0186] As an implementation of an embodiment of the present invention, the sample generation module 804 may include:

[0187] The first mixing unit mixes the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum.

[0188] The second mixing unit is configured to mix the non-living feature information with the domain feature information to obtain a second mixed spectrum.

[0189] The frequency domain inverse transformation unit is used to perform frequency domain inverse transformation on the first mixed spectrum to obtain living body migration image samples in the target domain, and to perform frequency domain inverse transformation on the second mixed spectrum to obtain non-living body migration image samples in the target domain.

[0190] As an implementation method of the embodiment of the present invention, Figure 9 As shown, the above-mentioned model training module 805 may include:

[0191] The training sample acquisition unit 901 is used to acquire training samples.

[0192] The training samples include source domain image samples and target domain migration image samples in a preset ratio, and the target domain migration image samples include the living body migration image samples and the non-living body migration image samples.

[0193] The model training unit 902 is used to input the training sample into a preset liveness detection model, and adjust the parameters of the preset liveness detection model based on the output result of the preset liveness detection model and the label of the training sample until the preset liveness detection model converges.

[0194] The labels of the target domain migrated image samples are the same as the labels of their corresponding source domain image samples.

[0195] As an implementation of an embodiment of the present invention, the training sample acquisition unit 901 may include:

[0196] a training sample acquisition subunit, configured to mix the source domain image samples and the target domain migrated image samples in a preset ratio to obtain training samples; or

[0197] Part of the image samples in the source domain image samples are replaced with the target domain migrated image samples to obtain training samples including source domain image samples and target domain migrated image samples in a preset ratio.

[0198] As an implementation manner of the embodiment of the present invention, the above-mentioned device may further include:

[0199] The module for acquiring an image to be detected is used to acquire an image to be detected in the target domain.

[0200] Wherein, the image to be detected includes a target to be detected.

[0201] A liveness detection module is used to perform liveness detection on the image to be detected based on the liveness detection model of the target domain to determine whether the target to be detected is a live target.

[0202] As an implementation manner of the embodiment of the present invention, the target domain image sample may be a target domain living body image sample.

[0203] The embodiment of the present invention further provides an electronic device, such as Figure 10 As shown, it includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.

[0204] Memory 1003, used for storing computer programs;

[0205] The processor 1001 is configured to implement the method steps described in any of the above embodiments when executing the program stored in the memory 1003 .

[0206] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0207] The communication interface is used for communication between the above electronic device and other devices.

[0208] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0209] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0210] In another embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0211] In another embodiment of the present invention, a computer program product including instructions is provided, which, when executed on a computer, enables the computer to execute the method steps described in any one of the above embodiments.

[0212] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0213] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0214] Each embodiment in this specification is described in a related manner. Similar portions between embodiments can be referenced to each other. Each embodiment focuses on the differences between other embodiments. In particular, the device, electronic device, computer-readable storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simple. For related portions, reference can be made to the descriptions of the method embodiments.

[0215] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A training method for a liveness detection model, characterized in that: The method comprises: Acquire source domain image samples and target domain image samples, wherein the source domain image samples include source domain living body image samples and source domain non-living body image samples; Extracting live feature information from the source domain live image samples, and extracting non-live feature information from the source domain non-live image samples; extracting domain feature information from the target domain image sample, wherein the domain feature information is used to identify acquisition-related information of the target domain image sample; generating a live body migration image sample of the target domain based on the live body feature information and the domain feature information, and generating a non-live body migration image sample of the target domain based on the non-live body feature information and the domain feature information; Based on the source domain image samples, the living body migration image samples, and the non-living body migration image samples, a preset living body detection model is trained to obtain a living body detection model of the target domain; The step of extracting live feature information from the source domain live image samples and extracting non-live feature information from the source domain non-live image samples includes: Performing frequency domain transformation on the source domain image samples to obtain a source domain spectrum graph corresponding to each source domain image sample; Extracting a high-frequency region in the spectrum graph corresponding to the source domain living body image sample as living body feature information; Extracting a high-frequency region in the spectrum graph corresponding to the source domain non-living body image sample as non-living body feature information; The step of extracting domain feature information from the target domain image sample includes: Performing frequency domain transformation on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample; The low-frequency region in the spectrum graph corresponding to each target domain image sample is extracted as domain feature information.

2. The method according to claim 1, characterized in that The step of generating a live body migration image sample of the target domain based on the live body feature information and the domain feature information, and generating a non-live body migration image sample of the target domain based on the non-live body feature information and the domain feature information, comprises: Mixing the living body characteristic information with the domain characteristic information to obtain a first mixed spectrum graph; Mixing the non-living feature information with the domain feature information to obtain a second mixed spectrum; The first mixed spectrum is subjected to an inverse frequency domain transformation to obtain a living body migration image sample of the target domain, and the second mixed spectrum is subjected to an inverse frequency domain transformation to obtain a non-living body migration image sample of the target domain.

3. The method according to claim 1, characterized in that The step of training a preset liveness detection model based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples includes: Acquire training samples, wherein the training samples include source domain image samples and target domain migration image samples in a preset ratio, and the target domain migration image samples include the living body migration image samples and the non-living body migration image samples; The training samples are input into a preset liveness detection model, and based on the output results of the preset liveness detection model and the labels of the training samples, the parameters of the preset liveness detection model are adjusted until the preset liveness detection model converges, wherein the labels of the target domain migrated image samples are the same as the labels of their corresponding source domain image samples.

4. The method according to claim 3, characterized in that The step of obtaining training samples includes: Part of the image samples in the source domain image samples are replaced with the target domain migrated image samples to obtain training samples including source domain image samples and target domain migrated image samples in a preset ratio.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Acquire an image to be detected in the target domain, wherein the image to be detected includes a target to be detected; Performing liveness detection on the image to be detected based on the liveness detection model of the target domain to determine whether the target to be detected is a live target.

6. The method according to any one of claims 1 to 4, characterized in that The target domain image samples are target domain living body image samples.

7. A training device for a liveness detection model, characterized in that: The device comprises: An image sample acquisition module, configured to acquire source domain image samples and target domain image samples, wherein the source domain image samples include source domain living body image samples and source domain non-living body image samples; a first extraction module, configured to extract liveness feature information from the source domain liveness image samples, and extract non-liveness feature information from the source domain non-liveness image samples; a second extraction module, configured to extract domain feature information from the target domain image sample, wherein the domain feature information is used to identify acquisition-related information of the target domain image sample; a sample generation module, configured to generate a live body migration image sample of the target domain based on the live body feature information and the domain feature information, and to generate a non-live body migration image sample of the target domain based on the non-live body feature information and the domain feature information; a model training module, configured to train a preset liveness detection model based on the source domain image samples, the liveness migration image samples, and the non-liveness migration image samples to obtain a liveness detection model for the target domain; Wherein, the first extraction module includes: A first frequency domain transform unit is configured to perform frequency domain transform on the source domain image samples to obtain a source domain spectrum corresponding to each source domain image sample; A living body feature extraction unit, configured to extract a high-frequency region in the spectrum graph corresponding to the source domain living body image sample as living body feature information; a non-living feature extraction unit, configured to extract a high-frequency region in the spectrum graph corresponding to the source domain non-living image sample as non-living feature information; The second extraction module includes: a second frequency domain transform unit, configured to perform frequency domain transform on the target domain image samples to obtain a frequency spectrum corresponding to each target domain image sample; The domain feature extraction unit is used to extract the low-frequency area in the spectrum graph corresponding to each target domain image sample as domain feature information.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor, configured to implement the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps of any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Image recognition method and device, storage medium and electronic device

    CN113723457A