Light color sequence generation method, living body detection method and related equipment
By generating target light color sequences with diversity and randomness, the problem of easy identification of fixed light color detection sequences in the prior art is solved, and the reliability and accuracy of live detection are improved.
Patent Information
- Application Number
- CN202310996404.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-08
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is difficult to effectively detect and prevent injection attacks, especially in security verification in commercial applications. The fixed light color sequence of light color detection is easily recognized, affecting the reliability of live detection.
Through the identification performance requirements of different light colors based on the spacing and target scenes, N candidate light colors are determined from the light color set, and M target light colors are selected according to the principle that adjacent light colors are different, and the starting light colors are added and End the light color and generate the target light color sequence.
It improves the diversity and randomness of the light color sequence, meets the actual needs of light color in various live detection scenarios, and enhances the reliability and accuracy of live detection.
Smart Images

Figure CN119453922A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a light color sequence generation method, a living body detection method and related equipment. Background Art
[0002] As various face generation and face-changing technologies become more and more mature, security verification in commercial applications, such as face payment and identity verification, has become increasingly challenging. Among the many attack methods, injection attacks are currently more difficult to detect and prevent.
[0003] Light color detection is an important technical means to identify injection attacks. This scheme uses the absorption characteristics and polarization effect of objects to distinguish living objects from non-living objects. Therefore, how to obtain the light color sequence for liveness detection has become one of the hot issues currently studied in this field. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a light color sequence generation method, a liveness detection method and related equipment, which are used to improve the diversity and randomness of the light color sequence and meet the actual needs of various liveness detection scenarios for light color.
[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for generating a light color sequence, comprising:
[0007] Based on the class spacing of different light colors and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set;
[0008] According to the principle that adjacent light colors are different, M target light colors are selected from the N candidate light colors, where N and M are both integers greater than 1, and M is less than or equal to N;
[0009] A start light color and an end light color are added to the M target light colors to obtain a target light color sequence.
[0010] In a second aspect, an embodiment of the present application provides a light color sequence generating device, comprising:
[0011] A determination unit, used for determining N candidate light colors from the light color set based on the class spacing of different light colors and the recognition performance requirements of the target scene;
[0012] A selection unit, used to select M target light colors from the N candidate light colors according to the principle that adjacent light colors are different, where N and M are both integers greater than 1, and M is less than or equal to N;
[0013] A generating unit is used to add a start light color and an end light color to the M target light colors to obtain a target light color sequence.
[0014] In a third aspect, an embodiment of the present application provides a living body detection method, comprising:
[0015] Based on the target light color sequence, a first video is acquired, wherein the first video is obtained by shooting the object to be detected under the illumination of the target light color sequence; the target light color sequence is obtained based on the light color sequence generation method described in the first aspect;
[0016] Performing light color detection on the first video to obtain a predicted light color sequence;
[0017] Based on the predicted light color sequence and the target light color sequence, a liveness detection result of the object to be detected is determined.
[0018] In a fourth aspect, an embodiment of the present application provides a living body detection device, including:
[0019] An acquisition unit is used to acquire a first video based on a target light color sequence, wherein the first video is obtained by shooting the object to be detected under the illumination of light of the target light color sequence; the target light color sequence is obtained based on the light color sequence generation method described in the first aspect;
[0020] A detection unit, configured to perform light color detection on the first video to obtain a predicted light color sequence;
[0021] The detection unit is further used to determine a liveness detection result of the object to be detected based on the predicted light color sequence and the target light color sequence.
[0022] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the light color sequence generation method as described in the first aspect.
[0023] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the light color sequence generating method as described in the first aspect.
[0024] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: since the class spacing between different light colors in the light color sequence reflects the difference between different light colors, this difference will not only affect the detection accuracy of the light color sequence, but also affect the probability of the light color sequence being hit, thereby affecting the reliability of the living body detection result; for this reason, based on the class spacing of different light colors and the requirements of the target scene for recognition performance, N candidate light colors are determined from the light color set, so that the class spacing between the N candidate light colors can not only meet the recognition performance requirements of the target scene for the light color sequence, but also ensure that the light color sequence generated based on the N candidate light colors is not easily recognized. In particular, the randomness and diversity of light color sequence generation are realized, which can improve the reliability of liveness detection when the light color sequence is applied in liveness detection; on this basis, according to the principle that adjacent light colors are different, some or all of the light colors are selected from N candidate light colors, which can increase the randomness of the generated light color sequence, thereby further improving the reliability of liveness detection; finally, adding the starting light color and the ending light color to the selected part or all of the candidate light colors to obtain the target light color sequence can ensure that in the video collected under the illumination of the target light color sequence, the detected object will show the regularity of the start and end of the light color sequence in the imaging, which is helpful to improve the accuracy of light color detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0026] Figure 1 A schematic diagram of a flow chart of a light color sequence generation method provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of a light color set provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of a flow chart of a liveness detection method provided in an embodiment of the present application;
[0029] Figure 4 A schematic diagram of the positional relationship between a screen, a plane mirror and a test object of a terminal device provided in an embodiment of the present application;
[0030] Figure 5 A schematic diagram of the structure of a dazzling color detection model provided in an embodiment of the present application;
[0031] Figure 6 A schematic diagram of another method for detecting a living body provided in an embodiment of the present application;
[0032] Figure 7A schematic diagram of the structure of a light color sequence generating device provided in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of the structure of a living body detection device provided in an embodiment of the present application;
[0034] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0036] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0037] Injection attack means that the attacker illegally obtains the image or video data of the target face in advance and changes the data source of the verification backend during identity verification. When related technologies use light color detection for liveness detection, they often illuminate the detection object with light of a fixed light color sequence. This not only fails to meet the actual requirements of light color detection performance in various living scenes, but also because the fixed light color sequence is easy to identify, the video shot of the detection object is easy to be forged, and thus the reliability of liveness detection cannot be guaranteed.
[0038] In view of this, an embodiment of the present application proposes a method for generating a light color sequence. Since the class spacing between different light colors in the light color sequence reflects the difference between different light colors, this difference will not only affect the detection accuracy of the light color sequence, but also affect the probability of the light color sequence being hit, thereby affecting the reliability of the living body detection result; to this end, based on the class spacing of different light colors and the requirements of the target scene for recognition performance, N candidate light colors are determined from the light color set, so that the class spacing between the N candidate light colors can not only meet the requirements of the target scene for living body detection performance, but also ensure that the light color sequence generated based on the N candidate light colors is not easily hit. Identification is performed to improve the reliability of liveness detection; on this basis, according to the principle that adjacent light colors are different, some or all of the light colors are selected from N candidate light colors, which can increase the randomness of the generated light color sequence, thereby further improving the reliability of liveness detection; finally, a start light color and an end light color are added to the selected part or all of the candidate light colors to obtain a target light color sequence for liveness detection, which can ensure that in the video collected under the illumination of the target light color sequence, the detected object presents the regularity of the start and end of the light color sequence in the imaging, which helps to improve the accuracy of light color detection, thereby improving the accuracy of liveness detection.
[0039] It should be understood that the light color sequence generation method provided in the embodiment of the present application can be executed by an electronic device or software installed in the electronic device. The so-called electronic device here can include terminal devices, such as smart phones, tablet computers, laptops, desktop computers, intelligent voice interaction devices, smart home appliances, smart watches, vehicle terminals, aircraft, etc.; or, the electronic device can also include a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0040] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0041] See also Figure 1 , is a flow chart of a method for generating a light color sequence provided in an embodiment of the present application, the method may include the following steps:
[0042] S102, based on the class spacing of different light colors and the recognition performance requirements of the target scene, determine N candidate light colors from the light color set.
[0043] The inter-class distance of different light colors refers to the distance between different light colors, which reflects the difference between different light colors. For any two light colors, the larger the inter-class distance, the greater the difference between the two, and the easier it is to accurately distinguish between the two, and thus the higher the light color detection accuracy, but the greater the probability that the two can be identified by attackers, which in turn affects the reliability of subsequent liveness detection; conversely, the smaller the inter-class distance, the smaller the difference between the two, and the greater the difficulty of accurately distinguishing between the two, and thus the lower the light color detection accuracy, but the smaller the probability that the two can be identified by attackers, which in turn helps to provide the reliability of candidate liveness detection.
[0044] The target scenario refers to a business scenario that requires liveness detection, which may include, but is not limited to, access control scenarios, payment scenarios, and financial business review scenarios. The target scenario's recognition performance requirements refer to the target scenario's requirements for liveness detection performance, which may include, but is not limited to, at least one of the requirements for liveness detection reliability and liveness detection accuracy. Different scenarios have different requirements for recognition performance. For example, the access control scenario has higher requirements for liveness detection reliability and lower requirements for liveness detection accuracy; the payment scenario has higher requirements for liveness detection reliability and liveness detection accuracy, and so on.
[0045] The light color set includes a plurality of light colors arranged according to the size of the light color value. The N light colors determined from the light color set are used to generate the light color sequence required for liveness detection, where N is an integer greater than 1. Based on the class spacing of different light colors and the requirements of the target scene for recognition performance, N candidate light colors are determined from the light color set, which can ensure that the class spacing between the N candidate light colors can not only meet the requirements of the target scene for liveness detection performance, but also ensure that the light color sequence generated based on the N candidate light colors is not easy to be recognized, so as to improve the reliability of liveness detection, thereby achieving a better balance between the various requirements of the target scene for liveness detection performance.
[0046] In an optional implementation, in order to better balance the requirements of the target scene for the liveness detection performance, the above S102 may include the following steps:
[0047] S122, determining the class spacings of different light colors in the light color set based on the light color values of various light colors in the light color set.
[0048] In a specific implementation, for any two light colors in the light color set, the distance between the light color values of the two light colors can be calculated, and the distance can be used as the inter-class distance between the two light colors.
[0049] S124, determining a recognition performance score corresponding to the inter-class distance between the first light color and the second light color based on the light color detection results of the first sample video and the second sample video.
[0050] The first light color and the second light color are any two light colors in the light color set. The first sample video is obtained by shooting the sample object under the illumination of the first light color, and the second sample video is obtained by shooting the sample object under the illumination of the second light color.
[0051] In specific implementation, the first predicted light color is obtained by performing light color detection on the first sample video, and the first predicted light color is determined based on the light color value difference between the first predicted light color and the first light color; the second predicted light color can be obtained by performing light color detection on the second sample video, and the light color value difference between the second predicted light color and the second light color is obtained; further, based on the sum of the two light color value differences, the recognition performance score corresponding to the class spacing of the two light colors is determined. For example, if the sum of the two light color value differences is larger, it indicates that the accuracy of distinguishing the first light color and the second light color is higher, and thus the recognition performance score corresponding to the class spacing of the two light colors is higher; if the sum of the two light color value differences is smaller, it indicates that the accuracy of distinguishing the first light color and the second light color is lower, and thus the recognition performance score corresponding to the class spacing of the first light color and the second light color is lower.
[0052] Of course, in practical applications, the recognition performance score corresponding to the class distance between any two light colors can also be obtained by scoring by relevant personnel based on the light color detection results of the first sample video and the light color detection results of the second sample video using experience.
[0053] S126, determining N candidate light colors from the light color set based on the recognition performance scores corresponding to the class spacings of different light colors in the light color set and the recognition performance requirements of the target scene.
[0054] For example, if the target scene has higher requirements for recognition performance, different light colors corresponding to inter-class distances with higher recognition performance scores can be selected from the light color set as candidate light colors; if the target scene has lower requirements for recognition performance, different light colors corresponding to inter-class distances with lower recognition performance scores can be selected from the light color set as candidate light colors.
[0055] It can be understood that determining candidate light colors from the light color set based on the recognition performance scores corresponding to the class spacings of different light colors in the light color set and the requirements of the target scene for recognition performance can ensure that the light color sequence generated based on the candidate light colors can meet the requirements of the target scene for recognition performance.
[0056] In another optional implementation, the above S102 may include the following steps: determining the class spacing of different light colors in the light color set based on the light color values of various light colors in the light color set; determining the recognition performance score corresponding to the class spacing between the first light color and the second light color based on the light color detection result of the third sample video; determining N candidate light colors from the light color set based on the recognition performance scores corresponding to the class spacing of different light colors in the light color set and the recognition performance requirements of the target scene. The third sample video is obtained by shooting the sample object under the illumination of the light color sequence composed of the first light color and the second light color.
[0057] For example, by performing light color detection on the third sample video, a corresponding predicted light color sequence is obtained; by comparing the predicted light color sequence with the above light color sequence for consistency, the light color value difference between the two can be determined; further, based on the light color value difference, the recognition performance score corresponding to the inter-class distance between the first light color and the second light color is determined. For example, if the sum of the light color value differences is larger, it indicates that the accuracy of distinguishing the first light color and the second light color is higher, and thus the recognition performance score corresponding to the inter-class distance between the first light color and the second light color is higher; if the sum of the light color value differences is smaller, it indicates that the accuracy of distinguishing the first light color and the second light color is lower, and thus the recognition performance score corresponding to the inter-class distance between the first light color and the second light color is lower.
[0058] Of course, in practical applications, the recognition performance score corresponding to the class distance between any two light colors can also be obtained by relevant personnel using their experience to score based on the light color detection results of the third sample video.
[0059] The embodiment of the present application shows some implementations of the above S102. Of course, it should be understood that the above S102 can also be implemented in other ways.
[0060] In the embodiment of the present application, the value of N affects the number of random spaces for light color detection. The larger N is, the larger the selectable range of each light color is when the length of the number of light colors remains unchanged, and the more combination results between a fixed number of light colors are, that is, the larger the number of random spaces for light color detection is; however, this results in smaller differences between different light colors, and the greater the difficulty of distinguishing different light colors in the future. For example, in order to better balance the relationship between the size of the random space and the accuracy of liveness detection, the value of N can be 6. Figure 2 It shows 6 candidate light colors selected from the light color set when N=6, namely, light color 1 to light color 6.
[0061] In this case, assuming that 5 light colors are selected for combination to obtain a target light color sequence, then there are 6 choices for each position in the target light color sequence, and the size of the random space obtained is: 6×5+6×5×5+6×5×5×5+6×5×5×5×5+6×5×5×5×5×5=23430, which not only increases the randomness of the target light color sequence, but also avoids the difficulty of distinguishing different light colors due to excessive number of random spaces, and achieves a good balance between the size of the random space and the accuracy of liveness detection.
[0062] S104, selecting M target light colors from the N candidate light colors according to the principle that adjacent light colors are different.
[0063] N is an integer greater than 1, and M is less than or equal to N. The value of M affects the length of the target light color sequence finally generated. The larger M is, the longer the length of the target light color sequence is, and the longer the liveness detection time is, which affects the liveness detection efficiency and user experience.
[0064] The value of M can be set according to the richness of the light color space combination, the detection efficiency and the user experience, and the embodiment of the present application does not limit this. Optionally, in order to increase the random space size of the light color combination while taking into account the detection efficiency and the user experience, the value of M can be randomly selected from (2, 3, 4, 5, 6).
[0065] S106, adding a start light color and an end light color to the M target light colors to obtain a target light color sequence.
[0066] In the embodiment of the present application, the starting light color and the ending light color can be selected according to actual needs. For example, the starting light color can be the light color with the maximum light color value, and the ending light color can be the light color with the minimum light color value; or, the starting light color can be the light color with the minimum light color value, and the ending light color can be the light color with the maximum light color value, and so on. Alternatively, the starting light color and the ending light color can also be the light colors obtained after pre-setting any one or more light colors in the light color set, such as the starting light color can be the light color after performing light color averaging and other processing on any two light colors in the light color set. The specific values of the starting light color and the ending light color are not limited in the embodiment of the present application, and can be selected according to the needs of the starting light color and the ending light color in different application scenarios.
[0067] In an optional implementation, in order to further increase the randomness of the target light color sequence and increase the regularity of the start and end of the light color sequence presented in the video collected during the living body detection process, the above S106 may include the following steps:
[0068] S162, combining the M target light colors to obtain a candidate light color sequence, wherein adjacent light colors in the candidate light color sequence are different.
[0069] For example, assuming M is 4, from Figure 2 Light color 1, light color 3, light color 5 and light color 6 are selected from the 6 candidate light color sequences shown, and these light colors are combined. The combination method here is not limited, and can be a random combination of the selected light colors, or a combination from large to small or from small to large according to the light color value. For example, after combining M light colors, a candidate light color sequence {light color 1, light color 3, light color 5, light color 6} can be obtained; for another example, after combining M light colors, {light color 3, light color 5, light color 1, light color 6} can be obtained. The embodiment of the present application does not list the candidate light color sequences obtained by combination one by one.
[0070] S164, performing light color combination based on the candidate light color sequence, the starting light color and the ending light color to obtain a target light color sequence.
[0071] In the embodiment of the present application, there can be multiple combinations of candidate light color sequences, starting light colors, and ending light colors. For example, the starting light color is added before the candidate light color sequence, and the ending light color is added after the candidate light color sequence; or, the starting light color is added between the two light colors at the front of the candidate light color sequence, and the ending light color is added between the two light colors at the back of the candidate light color sequence; or, the starting light color and the ending light color are added between the two light colors with a larger class distance in the candidate light color sequence, and so on.
[0072] Optionally, the starting light color includes the light color with the maximum light color value in the light color set, and the ending light color includes the light color with the minimum light color value in the light color set. In this case, the light color with the maximum light color value can be added before the first light color in the candidate light color sequence, and the light color with the minimum light color value can be added after the last light color in the candidate light color sequence to obtain the target light color sequence.
[0073] For example, the starting light color may include white, the ending light color may include black, and the candidate light color sequence is {light color 1, light color 3, light color 5, light color 6}. Then, after combination, the target light color sequence {white, light color 1, light color 3, light color 5, light color 6, black} can be obtained. In this way, the generated target light color sequence starts with white and ends with black, so that the imaging of the object to be detected in the subsequently collected video forms a regularity of sequence start and end, which helps to improve the accuracy of liveness detection; at the same time, it is conducive to using differential images to classify the light colors presented in the video, further improving the accuracy of liveness detection.
[0074] Optionally, considering that when the starting light color is the light color with the maximum light color value, the light color change caused by directly switching from the light color with the maximum light color value to the first light color of the candidate light color sequence may have a great visual impact on the light of the object to be detected, and the sudden change of light will affect the imaging stability. To this end, based on the maximum light color value and the light color value of the first light color in the candidate light color sequence, at least one gradient light color is determined from the light color set, the light color value of the gradient light color is between the maximum light color value and the light color value of the first light color, and the light color value of the gradient light color is different from the light color values of the N candidate light colors; then, the light color with the maximum light color value is added before the first light color, and at least one gradient light color is added between the maximum light color value and the first light color, and the light color with the minimum light color value is added after the last light color of the candidate light color sequence to obtain the target light color sequence.
[0075] For example, when the initial light color is white, its chromaticity value is (255, 255, 255). Assuming that the candidate light color sequence is {light color 1, light color 3, light color 5, light color 6}, and the chromaticity value of light color 1 is (255, 0, 0), then the light color with a chromaticity value of (128, 128, 128) can be used as the gradient light color, and the target light color sequence is obtained {white, gradient light color, light color 1, light color 3, light color 5, light color 6, black}.
[0076] It can be understood that when the starting light color is the light color with the maximum light color value, by adding at least one gradient light color with a chromaticity value between the starting light color and the first light color of the candidate light color sequence, the light irradiated to the object to be detected during the living body detection process can be smoothly changed from the light color with the maximum light color value to colored light, which can not only avoid a large visual impact on the object to be detected, but also avoid the impact of sudden changes in light on imaging stability, thereby further improving user experience and living body detection accuracy.
[0077] The target light color sequence generated based on the above method can be used for living body detection in the target scene. Figure 3 As shown, the embodiment of the present application also provides a living body detection method, which may include the following steps:
[0078] S302, acquiring a first video based on a target light color sequence.
[0079] The first video is obtained by shooting the object to be detected under the illumination of the target light color sequence. The object to be detected refers to an object that needs to be detected alive, and may include, for example, a face to be detected.
[0080] In a specific implementation, light may be irradiated toward the object to be detected according to a target light color sequence, and a video of the object to be detected may be collected during the irradiation process to obtain a first video.
[0081] The light color sequence generation method provided in the embodiment of the present application can be executed by a terminal device or by a server. In the case where the light color sequence generation method is executed by a server, the server can send a collection instruction carrying a target light color sequence to the terminal device to instruct the terminal device to irradiate light to the object to be detected according to the target light color sequence and collect a first video of the object to be detected under the light irradiation, and upload the first video to the server for liveness detection.
[0082] When the light color sequence generating method is executed by a terminal device, the terminal device can emit light according to the target light color sequence through its own screen to illuminate the object to be detected with light of multiple colors, and collect a first video of the object to be detected under the light through its own front camera during the period when the object to be detected is illuminated by the light.
[0083] In practical applications, each light color in the target light color sequence has a duration. Considering that the longer the duration of each light color in the target light color sequence, the more stable the imaging of the object to be detected, and the higher the accuracy of liveness detection, but the time cost will also increase, which often means a worse user experience. Based on this, in order to achieve better imaging stability and user experience, the total duration of the target light color sequence does not exceed the preset duration (such as 2000ms), and the duration of each light color in the target light color sequence can be set to be equal, or the total duration of the target light color sequence does not exceed the preset duration, the duration of each color light color in the target light color sequence is equal, and the duration of other light colors is less than the duration of the color light color, etc.
[0084] Optionally, in order to ensure that light irradiation and video acquisition are carried out synchronously, a first thread and a second thread may be created and run in the terminal device; light is emitted on the screen according to a target light color sequence through the first thread to irradiate light of multiple colors in the target light color sequence onto the object to be detected; the terminal device is controlled to capture a first video of the object to be detected under the irradiation of light of multiple colors through the second thread.
[0085] In practical applications, the first video can be collected by the front camera of the terminal device. In order to ensure the accuracy of liveness detection, a third thread can also be created and run in the terminal device to detect whether the object to be detected in the first video is blocked, whether the object to be detected is located at a specified position in the frame image, etc.
[0086] Optionally, considering that the load of the terminal device is significantly increased under multi-threaded operation, which will lead to instability in operation, unstable operation will inevitably lead to frame offset, making the light color sequence presented by the actual light emitted by the screen inconsistent with the light color sequence that should be irradiated, which brings great challenges to subsequent light color detection and living body judgment, and even affects the final live body detection accuracy. For this reason, in the process of creating and running the first thread and the second thread in the terminal device, the consistency between the light color sequence presented by the light emitted by the screen and the light color sequence that should be irradiated is also verified.
[0087] In a specific implementation, creating and running a first thread and a second thread in a terminal device may include the following steps: emitting light through a screen according to a first sample light color sequence, and obtaining a second video of the screen during the light-emitting process; performing a consistency check on the light color presented by the imaging of the screen in the second video based on the first sample light color sequence; if the consistency check passes, creating and running the first thread and the second thread in the terminal device.
[0088] More specifically, Figure 4 As shown, a plane mirror is arranged on the back of the test object, the plane mirror is arranged opposite to the screen, and the acquisition range of the terminal device covers the imaging of the test object and the screen on the plane mirror. Accordingly, obtaining a second video of the screen in the process of emitting light includes: photographing the test object by the terminal device under the irradiation of the light of the first sample light color sequence to obtain the second video. Accordingly, based on the first sample light color sequence, the light color presented by the imaging of the screen in the second video is verified, including: determining the frame image corresponding to each light color in the second video based on the duration of each light color in the first sample light color sequence; and performing consistency verification on the light color presented by the screen imaging in each light color in the first sample light color sequence and its corresponding frame image.
[0089] The test object may be a human face for testing. The first sample light color sequence is a light color sequence for consistency verification, which may include a plurality of light colors arranged in sequence, and each light color has a duration.
[0090] Since the acquisition range of the front camera can cover the imaging of the test object and the screen on the plane mirror, the second video captured by the front camera can include not only the test object but also the imaging of the screen on the plane mirror, and the light color of the imaging is the light color of the light emitted by the screen; further, according to the light color of the screen imaging on the frame image corresponding to each light color in the first sample light color sequence, it can be judged whether the screen emits light according to the first sample light color sequence. Through this verification method, it is only necessary to set the plane mirror and adjust the position of the plane mirror and the camera without developing a robust algorithm, which is simple to implement and efficient.
[0091] More specifically, after obtaining the second video, the second video can be processed into a single frame image through OpenCV or other image processing tools; then, the light color of the screen imaging in the frame image is compared frame by frame to see if it is consistent with the light color corresponding to the frame image in the first sample light color sequence; if all light colors and the light colors of the screen imaging in the corresponding frame images are consistent, or if the light colors of the screen imaging in more than a preset number of frame images are consistent with the light colors corresponding to the frame image in the first sample light color sequence, it is determined that the consistency check has passed. Furthermore, if the consistency check fails, the scheduling strategy under multi-threaded operation is adjusted.
[0092] S304, performing light color detection on the first video to obtain a predicted light color sequence.
[0093] Specifically, the light color of the frame images in the first video can be detected frame by frame to obtain the light color presented by each frame image, and then based on the time sequence relationship between the frame images in the first video and the light color presented by each frame image, a predicted light color sequence can be obtained.
[0094] Generally, due to the influence of ambient light, and different objects may have different absorption rates of different light colors in different environments, in order to avoid the influence of these factors on the light color detection results, improve the accuracy of light color detection, and thus improve the accuracy of liveness detection, in an optional implementation method, the first video can be input into the colorful detection model for light color, and the predicted light color sequence of the first video can be obtained. Among them, the colorful detection model is trained based on the sample video and the second sample light color sequence, and the sample video is a video of the sample object under the light of the second sample light color sequence.
[0095] The dazzle detection model may have various appropriate structures, which may be set according to actual needs, and the present application embodiment does not limit this. Figure 5 As shown, the dazzling color detection model may include a feature extraction network and a decoding network, wherein the feature extraction network is used to extract the video features of the first video, and the decoding network is used to perform light color detection based on the video features to obtain a predicted light color sequence.
[0096] In practical applications, the feature extraction network can extract features from the differential image when performing feature extraction, so that the extracted video features can better reflect the temporal variation characteristics of each frame image of the first video frame, thereby eliminating the interference of factors such as ambient light and the absorption rate of light color by different objects on the light color detection results, so as to improve the accuracy of active light color detection. For example, the target light color sequence includes white light, a variety of colorful light colors, and black. The feature extraction network can obtain the differential image between the frame image corresponding to white light and the frame image corresponding to the first colorful light color, obtain the differential image between the frame images corresponding to different colorful light colors, and obtain the differential image between the frame image corresponding to the last colorful light color and the frame image corresponding to black; then, the corresponding image features are extracted from these differential images respectively as video features.
[0097] The feature extraction network in the embodiment of the present application can have any appropriate structure and can be specifically configured according to actual needs, which is not limited in the embodiment of the present application. Optionally, in order to make the extracted video features more accurately reflect the light and color features presented in the first video, thereby improving the light and color detection accuracy and the liveness detection accuracy, such as Figure 5 As shown, the feature extraction network includes N-level feature extraction modules, where N is an integer greater than 2. Among them, the first-level feature extraction module is used to extract the first-level intermediate features from the first video; the i-th-level feature extraction module is used to extract the i-th-level intermediate features to obtain the i-th-level intermediate features, 1<i<N; the N-th-level feature extraction module is used to extract the N-1-th-level intermediate features to obtain video features.
[0098] More specifically, each level of feature extraction module includes a downsampling module and an inverse residual module. The downsampling module is used to downsample the intermediate features of the previous level to obtain candidate features of this level; the inverse residual module is used to perform dimensionality reduction processing on the candidate features, and to perform convolution processing and dimension increase processing on the candidate features after dimensionality reduction processing to obtain the intermediate features of this level. Therefore, the downsampling module can play a role in reducing the dimensionality of the intermediate features of the previous level, and after convolution and dimension increase processing by the inverse residual module, more effective light and color features can be extracted from the first video, thereby improving the accuracy of light and color detection and the subsequent liveness detection accuracy.
[0099] It is worth noting that the inverted residual module can adopt various modules with convolution and dimensionality increase processing functions commonly used in the field, such as the inverted residual module in MobilenetV2. The number of levels of the feature extraction module and the number of inverted residual modules in each level of feature extraction module can also be set according to actual needs. For example, the feature extraction network can include 4 levels of feature extraction modules, and the number of inverted residual modules in each level of feature extraction modules is 3, 3, 9, and 3 respectively.
[0100] The decoding network in the embodiment of the present application may have any appropriate structure, which may be specifically configured according to actual needs, and the embodiment of the present application does not limit this. Figure 5 As shown, in order to balance the structure of the decoding network and the accuracy of light color detection, the decoding network may include a pooling layer and a fully connected layer. The pooling layer is used to downsample the video features of the first video to obtain the target features; the fully connected layer is used to perform light color detection based on the target features to obtain the predicted light color sequence of the first video.
[0101] In practical applications, the pooling layer can adopt various pooling layers commonly used in the art, such as an average pooling layer.
[0102] It is worth noting that, considering that the sizes of the first videos captured by different terminal devices are different, in order to further improve the accuracy of living body detection, the first video may be cropped to a specified size before performing light and color detection.
[0103] It is also worth mentioning that the colorful detection model can be trained using various supervised training methods commonly used in the field, which will not be described in detail. In the supervised training process, the second sample light color sequence can be used as a label to provide a supervisory signal for the training process. Secondly, warm up learning rate and cosine learning rate decay can be used in the training process. For example, in the first 10 epochs of training, the learning rate gradually increases to 1e-4; in the subsequent cosine decay stage, the cosine exponential decay formula is used to decay from 1e-4 to 1e-6. In addition, in order to further improve the accuracy of light color detection, before the first video is input into the colorful detection model, data enhancement processing can be performed on the first video. Among them, the data enhancement processing here includes other processing methods besides color contrast adjustment, such as geometric transformation processing such as cropping and stretching, thereby avoiding interference of processing methods such as color contrast adjustment with the light color presented in the first video.
[0104] S306: Determine a liveness detection result of the object to be detected based on the predicted light color sequence and the target light color sequence.
[0105] The predicted light color sequence is compared with the target light color sequence for consistency. If the two are consistent, it can be determined that the object to be detected is a living body; otherwise, it can be determined that the object to be detected is a non-living body.
[0106] The above method provided in the embodiment of the present application utilizes the principle that living and non-living objects have different absorption characteristics and polarization effects on the same light, irradiates light to the object to be detected according to the target light color sequence, and collects a video of the object to be detected under the light irradiation; further, by comparing the target light color sequence with the light color sequence presented in the video, it can be determined whether the object to be detected is a living body. The whole process does not require the user to cooperate with the corresponding actions, and has high efficiency and accuracy; on this basis, for the target light color sequence, by randomly selecting any length from the specified colorful sequence length range, and selecting multiple light colors from the light color set based on the length for combination to obtain the target light color sequence, the random space size of the light color combination and the randomness of the length of the target light color sequence can be increased, thereby enhancing the randomness of the target light color sequence, reducing the probability of the target light color sequence being hit, and further improving the safety of the liveness detection process and the liveness detection accuracy.
[0107] The light color sequence generation method provided in the embodiment of the present application can be applied to various business scenarios that require liveness detection, such as access control, payment scenarios, financial business review scenarios, etc., and the embodiment of the present application does not limit this. For different scenarios, the above light color sequence generation method can be executed by different devices. The following takes the execution of the terminal device as an example, combined with Figure 6 The light color sequence generation method provided in the embodiment of the present application is described.
[0108] First, the terminal device randomly selects any length n from the specified colorful length range, and selects a plurality of colorful light colors from the light color set based on the length n for combination to obtain a candidate light color sequence L = {L1, ..., Ln}.
[0109] Then, white Lw is inserted before the candidate light sequence, black Lb is inserted after the candidate light sequence, and gradient color L0 is inserted between white and the first light color L1 of the candidate light sequence, to obtain the target light color sequence Loriginal = {Lw2, L0, L1, …, Ln, Lb}, where the light color value of the gradient color L0 is between the light color value of white and the light color value of the first light color L1.
[0110] Next, based on the designated total duration of light emission and the length of the target light color sequence, the duration of each light color in the target light color sequence is calculated.
[0111] The above process is the generation process of the target light color sequence. Next, enter the video acquisition process.
[0112] First, based on the target light color sequence and the duration of each light color in the target light color sequence, the screen is controlled to emit light so as to illuminate the object to be detected with light of multiple colors, and the front camera is controlled to capture a first video of the object to be detected under the light.
[0113] During the acquisition process, it is also detected in real time whether the position of the object to be detected in the first video is located at the designated position, and whether the object to be detected is blocked, to obtain a detection result of whether the first video is abnormal.
[0114] If the first video is abnormal, the screen is controlled to emit light again and the front camera is controlled to collect the first video of the object to be detected under light. Of course, before re-executing the above steps, a prompt message can also be output to prompt the object to be detected to adjust its position or adjust the position of the front camera.
[0115] If the first video is normal, the first video is saved and the liveness detection process is entered.
[0116] First, the first video is input into the color detection model, the feature extraction network extracts the video features of the first video, and then the decoding network performs light color detection based on the video features to obtain a predicted light color sequence.
[0117] Then, the predicted light color sequence is compared with the target light color sequence for consistency, and based on the comparison result, it is determined whether the object to be detected is alive.
[0118] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0119] The present application also provides a light color sequence generating device. Figure 7 , is a schematic diagram of the structure of a light color sequence generating device 700 provided in an embodiment of the present application, and the device 700 may include:
[0120] A determination unit 710, configured to determine N candidate light colors from a light color set based on the class spacing of different light colors and the recognition performance requirements of the target scene;
[0121] A selection unit 720, configured to select M target light colors from the N candidate light colors according to the principle that adjacent light colors are different, where N and M are both integers greater than 1, and M is less than or equal to N;
[0122] The generating unit 730 is used to add a start light color and an end light color to the M target light colors to obtain a target light color sequence.
[0123] Optionally, when the generating unit 730 adds a start light color and an end light color to the M target light colors to obtain a target light color sequence, the generating unit 730 performs the following steps:
[0124] Combining the M target light colors to obtain a candidate light color sequence, wherein adjacent light colors in the candidate light color sequence are different;
[0125] Light colors are combined based on the candidate light color sequence, the starting light color and the ending light color to obtain a target light color sequence.
[0126] Optionally, the light color set includes a plurality of light colors sorted according to light color values; the starting light color includes the light color with the largest light color value in the light color set, and the ending light color includes the light color with the smallest light color value in the light color set;
[0127] When the generating unit 730 performs light color combination based on the candidate light color sequence, the starting light color and the ending light color to obtain the target light color sequence, the generating unit 730 performs the following steps:
[0128] The light color with the maximum light color value is added before the first light color of the candidate light color sequence, and the light color with the minimum light color value is added after the last light color of the candidate light color sequence, so as to obtain a target light color sequence.
[0129] Optionally, the generating unit 730 performs the following steps to combine light colors based on the candidate light color sequence, the starting light color and the ending light color to obtain a target light color sequence:
[0130] Based on the maximum light color value and the light color value of the first light color in the candidate light color sequence, at least one gradient light color is determined from the light color set, the light color value of the gradient light color is between the maximum light color value and the light color value of the first light color, and the light color value of the gradient light color is different from the light color values of the N candidate light colors;
[0131] A light color with a maximum light color value is added before the first light color, and at least one gradient light color is added between the maximum light color value and the first light color, and a light color with a minimum light color value is added after the last light color of the candidate light color sequence to obtain a target light color sequence.
[0132] Optionally, the determining unit 710 performs the following steps when determining N candidate light colors from the light color set based on the class spacing of different light colors and the recognition performance requirements of the target scene:
[0133] Determine the class spacing of different light colors in the light color set based on the light color values of various light colors in the light color set;
[0134] Determine, based on light color detection results of a first sample video and a second sample video, a recognition performance score corresponding to the inter-class distance between the first light color and the second light color, wherein the first light color and the second light color are any two light colors in the light color set, the first sample video is obtained by photographing a sample object under the illumination of the first light color, and the second sample video is obtained by photographing the sample object under the illumination of the second light color;
[0135] Based on the recognition performance scores corresponding to the class spacings of different light colors in the light color set and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set.
[0136] Obviously, the light color sequence generating device provided in the embodiment of the present application can be used as Figure 1 The execution body of the light color sequence generation method shown is, for example Figure 1 In the light color sequence generation method shown in FIG. 1 , step S102 can be performed by Figure 7 The determination unit 710 in the light color sequence generation device shown in FIG. 1 is executed, and step S104 can be performed by Figure 7 The selection unit 720 in the light color sequence generation device shown in FIG. 1 is executed, and step 106 can be performed by Figure 7 The generation unit 730 in the light color sequence generation device shown is executed.
[0137] According to another embodiment of the present application, Figure 7 The various units in the light color sequence generating device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In actual applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the light color sequence generating device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0138] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 1 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 7The light color sequence generating device shown in the embodiment of the present application is implemented by the light color sequence generating method. The computer program can be recorded on a computer readable storage medium, for example, and transferred to an electronic device through the computer readable storage medium and run therein.
[0139] See also Figure 8 , is a schematic diagram of the structure of a living body detection device 800 provided in an embodiment of the present application, the device 800 includes an acquisition unit 810, which acquires a first video based on the target light color sequence, wherein the first video is obtained by shooting the object to be detected under the illumination of the target light color sequence;
[0140] A detection unit 820, configured to perform light color detection on the first video to obtain a predicted light color sequence;
[0141] The detection unit 820 is further used to determine the living body detection result of the object to be detected based on the predicted light color sequence and the target light color sequence.
[0142] Optionally, when acquiring the first video based on the target light color sequence, the acquisition unit 810 performs the following steps:
[0143] Creating and running a first thread and a second thread in a terminal device;
[0144] Light is emitted on the screen according to the target light color sequence through the first thread, so that light of multiple light colors in the target light color sequence is irradiated to the object to be detected;
[0145] The terminal device is controlled to collect a first video of the object to be detected under the illumination of the light of the multiple light colors through a second thread.
[0146] Optionally, when the acquiring unit 810 creates and runs the first thread and the second thread in the terminal device, the acquiring unit 810 performs the following steps:
[0147] The screen emits light according to a first sample light color sequence, and obtains a second video of the screen during the light emission process;
[0148] Based on the first sample light color sequence, performing consistency check on the light color presented by the imaging of the screen in the second video;
[0149] If the consistency check passes, the first thread and the second thread are created and run in the terminal device.
[0150] Optionally, each light color in the target light color sequence has a duration;
[0151] When acquiring the second video of the screen in the light-emitting process, the acquisition unit performs the following steps:
[0152] Under the illumination of the first sample light color sequence, the test object is photographed by the terminal device to obtain the second video; wherein a plane mirror is arranged on the back of the test object, the plane mirror is arranged opposite to the screen, and the acquisition range of the terminal device covers the test object and the imaging of the screen on the plane mirror;
[0153] When verifying the light color presented by the imaging of the screen in the second video based on the first sample light color sequence, the acquisition unit 810 performs the following steps:
[0154] Determine, based on the duration of each light color in the first sample light color sequence, a frame image corresponding to each light color in the second video;
[0155] A consistency check is performed on each light color in the first sample light color sequence and the light color presented by the imaging in the corresponding frame image.
[0156] Optionally, when the detection unit 820 performs light color detection on the first video to obtain a predicted light color sequence, the detection unit 820 performs the following steps:
[0157] The first video is input into a color detection model, video features of the first video are extracted through a feature extraction network of the color detection model, and light color detection is performed based on the video features through a decoding network of the color detection model to obtain a predicted light color sequence.
[0158] Obviously, the living body detection device provided in the embodiment of the present application can be used as Figure 3 The execution subject of the living body detection method shown is, for example Figure 3 In the living body detection method shown in FIG. 1 , step S302 can be performed by Figure 8 The acquisition unit 810 in the living body detection device shown in FIG. 1 is executed, and steps S304 and S306 can be performed by Figure 8 The detection unit 820 in the living body detection device shown is executed.
[0159] According to another embodiment of the present application, Figure 8The various units in the liveness detection device shown can be separately or completely combined into one or several other units to form, or one (some) of the units can be further divided into multiple functionally smaller units to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the liveness detection device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0160] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 8 The liveness detection device shown in the embodiment of the present application is used to implement the liveness detection method of the embodiment of the present application. The computer program can be recorded on a computer-readable storage medium, for example, and transferred to an electronic device through the computer-readable storage medium and run therein.
[0161] Fig. 9 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Fig. 9 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0162] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig. 9 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0163] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0164] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a light color sequence generation device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0165] Based on the class spacing of different light colors and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set;
[0166] According to the principle that adjacent light colors are different, M target light colors are selected from the N candidate light colors, where N and M are both integers greater than 1, and M is less than or equal to N;
[0167] A start light color and an end light color are added to the M target light colors to obtain a target light color sequence.
[0168] Alternatively, the processor executes the program stored in the memory and is specifically configured to perform the following operations:
[0169] Based on the target light color sequence, a first video is obtained, where the first video is obtained by shooting the object to be detected under the illumination of the target light color sequence; the target light color sequence is obtained based on the light color sequence generation method provided in an embodiment of the present application;
[0170] Performing light color detection on the first video to obtain a predicted light color sequence;
[0171] Based on the predicted light color sequence and the target light color sequence, a liveness detection result of the object to be detected is determined.
[0172] The above application Figure 1The method performed by the light color sequence generating device disclosed in the embodiment shown or the method of the present application Figure 3 The method performed by the living body detection device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0173] The electronic device may also perform Figure 1 The method is to realize the light color sequence generating device in Figure 1 Alternatively, the electronic device may also perform the functions of the embodiments shown. Figure 3 The method and the living body detection device are realized in Figure 3 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0174] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0175] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0176] Based on the class spacing of different light colors and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set;
[0177] According to the principle that adjacent light colors are different, M target light colors are selected from the N candidate light colors, where N and M are both integers greater than 1, and M is less than or equal to N;
[0178] A start light color and an end light color are added to the M target light colors to obtain a target light color sequence.
[0179] Alternatively, when the instruction is executed by a portable electronic device including a plurality of application programs, the portable electronic device can execute Figure 3 The method of the embodiment shown is specifically used to perform the following operations:
[0180] Based on the target light color sequence, a first video is obtained, where the first video is obtained by shooting the object to be detected under the illumination of the target light color sequence; the target light color sequence is obtained based on the light color sequence generation method provided in an embodiment of the present application;
[0181] Performing light color detection on the first video to obtain a predicted light color sequence;
[0182] Based on the predicted light color sequence and the target light color sequence, a liveness detection result of the object to be detected is determined.
[0183] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0184] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0185] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0187] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A method for generating a light color sequence, characterized in that: include: Based on the class spacing of different light colors and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set; According to the principle that adjacent light colors are different, M target light colors are selected from the N candidate light colors, where N and M are both integers greater than 1, and M is less than or equal to N; A start light color and an end light color are added to the M target light colors to obtain a target light color sequence.
2. The method according to claim 1, characterized in that: The step of adding a start light color and an end light color to the M target light colors to obtain a target light color sequence includes: Combining the M target light colors to obtain a candidate light color sequence, wherein adjacent light colors in the candidate light color sequence are different; Light colors are combined based on the candidate light color sequence, the starting light color and the ending light color to obtain a target light color sequence.
3. The method according to claim 2, characterized in that The light color set includes a plurality of light colors sorted by light color value; the starting light color includes the light color with the maximum light color value in the light color set, and the ending light color includes the light color with the minimum light color value in the light color set; The step of combining light colors based on the candidate light color sequence, the starting light color, and the ending light color to obtain a target light color sequence includes: The light color with the maximum light color value is added before the first light color of the candidate light color sequence, and the light color with the minimum light color value is added after the last light color of the candidate light color sequence, so as to obtain a target light color sequence.
4. The method according to claim 3, characterized in that The step of combining light colors based on the candidate light color sequence, the starting light color, and the ending light color to obtain a target light color sequence includes: Based on the maximum light color value and the light color value of the first light color in the candidate light color sequence, at least one gradient light color is determined from the light color set, the light color value of the gradient light color is between the maximum light color value and the light color value of the first light color, and the light color value of the gradient light color is different from the light color values of the N candidate light colors; A light color with a maximum light color value is added before the first light color, and at least one gradient light color is added between the maximum light color value and the first light color, and a light color with a minimum light color value is added after the last light color of the candidate light color sequence to obtain a target light color sequence.
5. The method according to claim 1, characterized in that: The method of determining N candidate light colors from the light color set based on the class spacing of different light colors and the recognition performance requirements of the target scene includes: Determine the class spacing of different light colors in the light color set based on the light color values of various light colors in the light color set; Determine, based on light color detection results of a first sample video and a second sample video, a recognition performance score corresponding to the inter-class distance between the first light color and the second light color, wherein the first light color and the second light color are any two light colors in the light color set, the first sample video is obtained by photographing a sample object under the illumination of the first light color, and the second sample video is obtained by photographing the sample object under the illumination of the second light color; Based on the recognition performance scores corresponding to the class spacings of different light colors in the light color set and the recognition performance requirements of the target scene, N candidate light colors are determined from the light color set.
6. A method for detecting a living body, characterized in that: include: Based on the target light color sequence, a first video is acquired, where the first video is obtained by shooting the object to be detected under the illumination of the target light color sequence; The target light color sequence is obtained based on the light color sequence generation method according to any one of claims 1 to 5; Performing light color detection on the first video to obtain a predicted light color sequence; Based on the predicted light color sequence and the target light color sequence, a liveness detection result of the object to be detected is determined.
7. The method according to claim 6, characterized in that The step of acquiring a video to be detected based on the target light color sequence includes: Creating and running a first thread and a second thread in a terminal device; Light is emitted on the screen according to the target light color sequence through the first thread, so as to irradiate the light of multiple light colors in the target light color sequence to the object to be detected; The terminal device is controlled to collect a first video of the object to be detected under the illumination of light of multiple colors through a second thread.
8. The method according to claim 7, characterized in that The step of creating and running the first thread and the second thread in the terminal device includes: The screen emits light according to a first sample light color sequence, and obtains a second video of the screen during the light emission process; Based on the first sample light color sequence, performing consistency check on the light color presented by the screen in the second video; If the consistency check passes, the first thread and the second thread are created and run in the terminal device.
9. The method according to claim 8, characterized in that Each light color in the target light color sequence has a duration; The step of obtaining a second video of the screen during the light-emitting process includes: Under the illumination of the first sample light color sequence, the test object is photographed by the terminal device to obtain the second video; wherein a plane mirror is arranged on the back of the test object, the plane mirror is arranged opposite to the screen, and the acquisition range of the terminal device covers the test object and the imaging of the screen on the plane mirror; The verifying the light color presented by the screen in the second video based on the first sample light color sequence includes: Determine, based on the duration of each light color in the first sample light color sequence, a frame image corresponding to each light color in the second video; A consistency check is performed on each light color in the first sample light color sequence and the light color presented by the imaging in the corresponding frame image.
10. The method according to claim 6, characterized in that The performing light color detection on the first video to obtain a predicted light color sequence includes: The first video is input into a color detection model, video features of the first video are extracted through a feature extraction network of the color detection model, and light color detection is performed based on the video features through a decoding network of the color detection model to obtain a predicted light color sequence.
11. A living body detection device, characterized in that: include: An acquisition unit, configured to acquire a first video based on a target light color sequence, wherein the first video is obtained by shooting an object to be detected under the illumination of light of the target light color sequence; The target light color sequence is obtained based on the light color sequence generation method according to any one of claims 1 to 5; A detection unit, configured to perform light color detection on the first video to obtain a predicted light color sequence; The detection unit is further used to determine a liveness detection result of the object to be detected based on the predicted light color sequence and the target light color sequence.
12. A living body detection device, characterized in that: include: An acquisition unit, configured to acquire a first video based on a target light color sequence, wherein the first video is obtained by shooting an object to be detected under the illumination of light of the target light color sequence; The target light color sequence is obtained based on the light color sequence generation method according to any one of claims 1 to 5; A detection unit, configured to perform light color detection on the first video to obtain a predicted light color sequence; The detection unit is further used to determine a liveness detection result of the object to be detected based on the predicted light color sequence and the target light color sequence.
13. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the light color sequence generation method as described in any one of claims 1 to 5; or, the processor is configured to execute the instructions to implement the living body detection method as described in any one of claims 6 to 10.
14. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the light color sequence generating method as described in any one of claims 1 to 5; or, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the living body detection method as described in any one of claims 6 to 10.