Face recognition method, device and system and electronic equipment

By dynamically adjusting the camera focal length, collecting face images of different proportions, and distinguishing injection attacks from normal behaviors based on the proportion changes of face images, the security risks of injection attacks in the face recognition system are solved and the security and reliability of the system are improved.

CN119919977APending Publication Date: 2025-05-02ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411998501.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

There is a security risk of injection attacks in facial recognition technology. How to effectively prevent injection attacks is the key to improving the security of facial recognition systems.

Method used

By dynamically adjusting the focal length of the camera, different proportions of face images are collected, and video injection attacks and normal user behavior are distinguished according to the proportional changes of the face images. The server generates and sends a zoom parameter sequence, and the client collects face images in turn and sends them to the server. The server determines the face recognition result based on the changes in the face proportion in the face image sequence.

Benefits of technology

Effectively distinguish video injection attacks from normal user behavior, improve the security of the face recognition system, and reduce the risk of injection attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119919977A_ABST
    Figure CN119919977A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a face recognition method, device and system and electronic equipment, and the method comprises the steps that in the face recognition process, a server side generates a zoom parameter sequence and sends the zoom parameter sequence to a client side, and the client side sequentially collects face images according to the focal length value of the zoom parameter sequence to obtain a face image sequence; and the server determines a face recognition result according to the face proportion change of the face image sequence. By dynamically adjusting the focal length of the camera, the face images of different proportions are collected, video injection attacks and normal user behaviors are effectively distinguished according to the proportion change of the face images, and the safety of face recognition is improved. And moreover, a zooming parameter sequence of face recognition is generated by using the server, so that illegal attackers are prevented from breaking through the client, and the injection attack risk is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of image processing technology, and in particular, to a face recognition method, device, system and electronic device. Background Art

[0002] Nowadays, face recognition technology provides a lot of convenience for people's production and life. It is widely used in many scenarios such as payment systems, access control systems, attendance systems, etc. However, at the same time, face recognition technology also has its own unique security risks, which has limited its development. Among them, injection attacks are the most dangerous attack method in face recognition technology. How to effectively prevent injection attacks is the key to improving the security of face recognition systems. Summary of the invention

[0003] To improve the security and reliability of face recognition, the embodiments of this specification provide a face recognition method, device, system, electronic device and computer program product.

[0004] In a first aspect, an embodiment of the present specification provides a face recognition method, which is applied to a client, and the method includes:

[0005] During the face recognition process, receiving a zoom parameter sequence sent by a server, wherein the zoom parameter sequence includes a plurality of ordered focal length values;

[0006] Collecting facial images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a facial image sequence;

[0007] The facial image sequence is sent to a server, and a facial recognition result returned by the server is received, wherein the facial recognition result is determined by the server according to a change in facial proportion in the facial image sequence.

[0008] In some implementations, during the face recognition process, receiving a zoom parameter sequence sent by a server includes:

[0009] During the face recognition process, a control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request;

[0010] Receive the zoom parameter sequence sent by the server.

[0011] In some implementations, the control parameter request includes a zoom range corresponding to the client; and sending the control parameter request to the server so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request, comprises:

[0012] A control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the zoom range included in the control parameter request.

[0013] In some embodiments, the method further comprises:

[0014] In response to detecting that face recognition is turned on, displaying a preview interface on the client, the preview interface is used to display a liveness detection instruction, and collecting a first image sequence during the display of the liveness detection instruction;

[0015] The step of sequentially acquiring face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence comprises: closing the display of the preview interface on the client, and sequentially acquiring face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0016] The sending the facial image sequence to the server includes: sending the first image sequence and the facial image sequence to the server.

[0017] In a second aspect, an embodiment of the present specification provides a face recognition method, which is applied to a server, and the method includes:

[0018] During the face recognition process, a zoom parameter sequence is sent to a client, the zoom parameter sequence including a plurality of ordered focal length values, so that the client sequentially collects face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0019] Receiving the facial image sequence sent by the client, and determining a facial recognition result according to a change in facial proportion in the facial image sequence;

[0020] Send the face recognition result to the client.

[0021] In some implementations, the zoom parameter sequence is determined by:

[0022] K focal length values ​​are randomly selected from a preset focal length set, and the k focal length values ​​are ordered or randomly sorted to obtain the zoom parameter sequence, where k is an integer and k≥2.

[0023] In some implementations, during the face recognition process, sending a zoom parameter sequence to the client includes:

[0024] During the face recognition process, receiving a control parameter request sent by the client, wherein the control parameter request includes a zoom range corresponding to the client;

[0025] Determining the preset focal length set according to the zoom range, and determining the zoom parameter sequence based on the preset focal length set;

[0026] The zoom parameter sequence is sent to the client.

[0027] In some implementations, during the face recognition process, sending a zoom parameter sequence to the client includes:

[0028] During the face recognition process, receiving a control parameter request sent by the client, and determining a risk level corresponding to the client according to the control parameter request;

[0029] Determining a value of k according to the risk level, and determining the zoom parameter sequence, wherein the value of k is positively correlated with the risk level;

[0030] The zoom parameter sequence is sent to the client.

[0031] In some implementations, the process of determining the risk level corresponding to the client includes at least one of the following:

[0032] Determining the risk level based on the time of face recognition;

[0033] Determine the risk level based on the number of face recognitions within a preset historical period;

[0034] Determining the risk level according to the location information of the client;

[0035] The risk level is determined according to the login status of the client.

[0036] In some implementations, determining a face recognition result based on a change in face ratio in the face image sequence includes:

[0037] For any two adjacent images in the facial image sequence, obtaining a first facial region on the first image and a second facial region on the second image;

[0038] Determining a face ratio change parameter based on the first face area and the second face area, and determining that the first image and the second image have been verified in response to the face ratio change parameter matching a focal length ratio of the first image and the second image;

[0039] In response to any two adjacent images in the facial image sequence being verified, it is determined that the facial recognition result is successfully verified.

[0040] In a third aspect, the embodiments of this specification provide a face recognition device, which is applied to a client, and the device includes:

[0041] A parameter receiving module is configured to receive a zoom parameter sequence sent by a server during face recognition, wherein the zoom parameter sequence includes a plurality of ordered focal length values;

[0042] An image acquisition module is configured to sequentially acquire facial images according to the focal length values ​​included in the zoom parameter sequence to obtain a facial image sequence;

[0043] The image sending module is configured to send the face image sequence to the server and receive the face recognition result returned by the server, wherein the face recognition result is determined by the server according to the change of face proportion in the face image sequence.

[0044] In some implementations, the parameter receiving module is configured to:

[0045] During the face recognition process, a control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request;

[0046] Receive the zoom parameter sequence sent by the server.

[0047] In some implementations, the control parameter request includes a zoom range corresponding to the client, and the parameter receiving module is configured to:

[0048] A control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the zoom range included in the control parameter request.

[0049] In some implementations, the parameter receiving module is configured to:

[0050] In response to detecting that face recognition is turned on, displaying a preview interface on the client, the preview interface is used to display a liveness detection instruction, and collecting a first image sequence during the display of the liveness detection instruction;

[0051] The image acquisition module is configured to: close the display of the preview interface on the client, and sequentially acquire face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0052] The image sending module is configured to send the first image sequence and the face image sequence to the server.

[0053] In a fourth aspect, the embodiments of this specification provide a face recognition device, which is applied to a server, and the device includes:

[0054] A parameter sending module is configured to send a zoom parameter sequence to a client during face recognition, wherein the zoom parameter sequence includes a plurality of ordered focal length values, so that the client sequentially collects face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0055] An image receiving module is configured to receive the facial image sequence sent by the client, and determine a facial recognition result according to a change in facial proportion in the facial image sequence;

[0056] The result sending module is configured to send the face recognition result to the client.

[0057] In some implementations, the parameter sending module is configured to:

[0058] K focal length values ​​are randomly selected from a preset focal length set, and the k focal length values ​​are ordered or randomly sorted to obtain the zoom parameter sequence, where k is an integer and k≥2.

[0059] In some implementations, the parameter sending module is configured to:

[0060] During the face recognition process, receiving a control parameter request sent by the client, wherein the control parameter request includes a zoom range corresponding to the client;

[0061] Determining the preset focal length set according to the zoom range, and determining the zoom parameter sequence based on the preset focal length set;

[0062] The zoom parameter sequence is sent to the client.

[0063] In some implementations, the parameter sending module is configured to:

[0064] During the face recognition process, receiving a control parameter request sent by the client, and determining a risk level corresponding to the client according to the control parameter request;

[0065] Determining a value of k according to the risk level, and determining the zoom parameter sequence, wherein the value of k is positively correlated with the risk level;

[0066] The zoom parameter sequence is sent to the client.

[0067] In some implementations, the parameter sending module is configured to:

[0068] Determining the risk level based on the time of face recognition;

[0069] Determine the risk level based on the number of face recognitions within a preset historical period;

[0070] Determining the risk level according to the location information of the client;

[0071] The risk level is determined according to the login status of the client.

[0072] In some embodiments, the image receiving module is configured to:

[0073] For any two adjacent images in the facial image sequence, obtaining a first facial region on the first image and a second facial region on the second image;

[0074] Determining a face ratio change parameter based on the first face area and the second face area, and determining that the first image and the second image have been verified in response to the face ratio change parameter matching a focal length ratio of the first image and the second image;

[0075] In response to any two adjacent images in the facial image sequence being verified, it is determined that the facial recognition result is successfully verified.

[0076] In a fifth aspect, the embodiments of this specification provide a face recognition system, including a client and a server.

[0077] During the face recognition process, the server sends a zoom parameter sequence to the client, where the zoom parameter sequence includes a plurality of ordered focal length values;

[0078] The client collects face images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence, and sends the face image sequence to the server;

[0079] The server determines a face recognition result according to a change in face ratio in the face image sequence, and sends the face recognition result to the client.

[0080] In a sixth aspect, an embodiment of the present specification provides an electronic device, including:

[0081] processor;

[0082] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any of the above embodiments.

[0083] In a seventh aspect, an embodiment of this specification provides a storage medium storing computer instructions, wherein the computer instructions are used to implement the method described in any of the above embodiments.

[0084] In an eighth aspect, an embodiment of this specification provides a computer program product, and the computer program product is used to implement the method described in any of the above embodiments.

[0085] The face recognition method implemented in the present specification includes, during the face recognition process, the server generates a zoom parameter sequence and sends it to the client, the client collects face images in sequence according to the focal length value of the zoom parameter sequence to obtain a face image sequence, and the server determines the face recognition result according to the face ratio change of the face image sequence. By dynamically adjusting the focal length of the camera, face images of different proportions are collected, and the video injection attack and normal user behavior are effectively distinguished according to the change in the proportion of the face image, thereby improving the security of face recognition. In addition, the server generates a zoom parameter sequence for face recognition to prevent illegal attackers from breaking into the client, effectively reducing the risk of injection attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] Figure 1 It is a schematic diagram of the structure of a face recognition system in an exemplary embodiment of this specification.

[0087] Figure 2 It is an interactive flow chart of a face recognition method in an exemplary embodiment of this specification.

[0088] Figure 3 Schematic diagram of a facial image sequence in an exemplary embodiment of this specification.

[0089] Figure 4 It is a client flow chart of a face recognition method in an exemplary embodiment of this specification.

[0090] Figure 5 It is a server-side flow chart of a face recognition method in an exemplary embodiment of this specification.

[0091] Figure 6 It is an interactive flow chart of a face recognition method in an exemplary embodiment of this specification.

[0092] Figure 7 It is a schematic diagram of a preview interface of an electronic device in an exemplary implementation manner of this specification.

[0093] Figure 8 It is a schematic diagram of a waiting interface of an electronic device in an exemplary implementation manner of this specification.

[0094] Fig. 9 It is a principle diagram of a face recognition method in an exemplary embodiment of this specification.

[0095] Fig.10 It is a schematic diagram of an injection attack in an exemplary embodiment of this specification.

[0096] Fig.11 1 is a structural block diagram of a face recognition device in an exemplary embodiment of this specification.

[0097] Fig.121 is a structural block diagram of a face recognition device in an exemplary embodiment of this specification.

[0098] Fig.13 is a structural block diagram of an electronic device in an exemplary embodiment of this specification. DETAILED DESCRIPTION

[0099] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0100] In recent years, face recognition technology has provided a lot of convenience for people's production and life. It has been widely used in scenarios such as payment systems, access control systems, and identity recognition systems. However, while providing convenience for people's production and life, face recognition technology is also limited in development due to its unique security risks. Among them, liveness attack is the most common and most dangerous attack method in face recognition technology.

[0101] Live attacks can be mainly divided into presentation attacks and injection attacks. Presentation attacks refer to attacks in which illegal attackers use mobile phone photos, printed images, and high-precision masks to display and impersonate verification. Injection attacks refer to attacks in which illegal attackers control the camera data link of the face recognition system through hacker software, directly replace the camera-collected image with the attack image, and then input the replaced attack image into the face recognition system.

[0102] For face recognition systems, the injected attack images are no different from the real collected user images, and there are no obvious features of presentation attacks (such as screen reflections, abnormal facial deformation, etc.). Therefore, injection attacks have greater security risks than presentation attacks, and defense against injection attacks is also a key research direction for anti-live attacks.

[0103] In related technologies, the defense against injection attacks is generally to perform liveness verification through a combination of human body movements, such as asking the user to blink, open their mouth, turn their head, etc. in a preset sequence of movements. However, this liveness verification method can be easily hacked by a pre-recorded video injection system, threatening the security of the face recognition system.

[0104] Based on this, the embodiments of this specification provide a face recognition method, device, system, electronic device, storage medium and computer program product, which aim to collect face images of different proportions by dynamically adjusting the focal length of the camera, effectively distinguish between video injection attacks and normal user behaviors according to the changes in the proportion of the face images, and improve the security of face recognition.

[0105] The solutions of the embodiments of this specification can be applied to various face recognition scenarios, such as identity authentication, mobile payment, door unlocking, attendance system, self-service vending, etc. For example, in an example, the face recognition scenario takes the payment scenario of the financial service platform as an example. Figure 1 The system architecture diagram on which the financial service platform relies is shown in the figure below. Figure 1 The face recognition system according to the embodiment of this specification is described.

[0106] like Figure 1 As shown, the face recognition system includes a server 11, a network 12, and several electronic devices, such as (Personal Computer) 13, a mobile phone 14, etc.

[0107] The server 11 may be a physical server including an independent host, or the server 11 may be a virtual server carried by a host cluster. During operation, the server 11 may run a program on the server side of the financial service platform to realize the server side of the financial service platform.

[0108] PC 13 and mobile phone 14 are only some types of electronic devices that can be used by users. In fact, users can obviously also use electronic devices such as tablet devices, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), etc., and one or more embodiments of this specification do not limit this. During operation, the electronic device can run the client-side program of the financial service platform to implement the client of the financial service platform.

[0109] Among them, the client application of the above-mentioned financial service platform can be started and run on the electronic device. The client-side program can be a native application installed on the electronic device, or the client-side program can be a small program, a quick application or other similar forms. Of course, when using web technologies such as HTML5 or similar, the relevant functions can be implemented through the page displayed by the browser. The browser here can be an independent browser application or a browser module embedded in certain applications.

[0110] As for the network 12 for interaction between electronic devices such as PC 13 and mobile phone 14 and server 11, it is possible to select a wired or wireless network to achieve communication based on the communication mode supported by the corresponding electronic device, and this specification does not limit this. For example, PC 13 can support both wired and wireless communication, so it can use a wired or wireless network to achieve communication as needed, while mobile phone 14 usually only supports wireless communication, so it can use a wireless network to achieve communication.

[0111] In the implementation manner of this specification, the electronic device needs to include an image acquisition device, and the image acquisition device can be a camera set in the electronic device. For example, the electronic device takes a mobile phone as an example, and the image acquisition device can include one or more cameras on the mobile phone, such as the front camera and rear camera of the mobile phone, etc. This specification does not limit this.

[0112] During face recognition, the client application of the financial service platform can call one or more cameras through the mobile phone system to collect the user's face image or video stream through the camera, and then the client can send the collected face image or video stream to the server through the network 12. The server can perform image processing on the received face image or video stream by executing one or more method steps under this specification, and return the obtained face recognition result to the client.

[0113] In one example, the electronic device takes an Android phone as an example. When the App installed on the phone starts face recognition, the App can call the underlying camera API (Application Programming Interface) through the system framework layer (Framework) to start the camera, and then collect face images or video streams through one or more cameras on the phone. As for the method and process of the application calling the mobile phone camera through the system, those skilled in the art can undoubtedly understand and fully implement it by referring to the relevant technology, and this specification will not repeat it.

[0114] Zoom refers to the technology of adjusting the viewing angle and image size by changing the focal length of the camera. Zoom can be divided into digital zoom and optical zoom. Digital zoom does not change the physical focal length of the lens, but uses electronic technology to magnify a part of the image, that is, to magnify and crop the original image. Optical zoom refers to magnifying and reducing the object being photographed by adjusting the physical focal length of the lens.

[0115] For cameras, whether digital zoom or optical zoom, the goal is to change the scale of the object being photographed in the picture, and to enlarge or reduce the object being photographed by changing different focal length values. Optical zoom depends on the hardware capabilities of the camera itself, while digital zoom does not depend on the camera hardware. In theory, any camera can achieve zooming of the object being photographed through digital zoom.

[0116] In addition, some electronic devices will be equipped with multiple cameras with different focal lengths. Taking mobile phones as an example, the front camera modules of some mobile phones include two cameras, such as a wide-angle camera and a standard focal length camera. The wide-angle camera can achieve a zoom capability of less than 1x (1 times), such as 0.8x, and the standard focal length camera can achieve a zoom capability of 1x and above, such as 1x, 1.2x, 1.5x, etc.

[0117] Therefore, in the case of including multiple cameras with different focal lengths, the electronic device can also change the proportion of the photographed object by switching different cameras. For example, switching a 1x standard camera to a 0.8x wide-angle camera can reduce the proportion of the photographed object.

[0118] In the implementation manner of this specification, during the face recognition process, the focal length of the camera can be dynamically adjusted to collect face images at different focal lengths. It can be understood that the proportion of the face in the image is different in different focal lengths. If it is an injected video, since the video is pre-recorded, the face ratio will not change. Therefore, based on the change in the proportion of the face in the collected image sequence, the injected video and normal user behavior can be effectively distinguished, thereby improving the security of face recognition.

[0119] Figure 2 A flowchart of a face recognition method in an exemplary embodiment of this specification is shown. Figure 2 The method flow of the example includes the data interaction process between the client and the server. Figure 2 The method of this manual is described.

[0120] S101. During face recognition, the server sends a zoom parameter sequence to the client.

[0121] It is worth noting that the face recognition algorithm process on the server side includes multiple links, such as face existence detection, face quality detection, liveness detection, face matching, etc. Face existence detection refers to detecting whether there is a face in the image. Face quality detection refers to whether there are quality problems such as occlusion, yin-yang face, blur, etc. in the face on the image. Liveness detection refers to detecting whether the face is alive through facial features or head movements. Face matching refers to determining whether the face in the image matches the face base stored in the database.

[0122] This manual Figure 2 The method process of the implementation method is mainly used as a link in the face recognition algorithm process, which is used to detect the change of face proportions, so as to determine whether the image or video stream received by the server is an injection attack. Figure 2 In the implementation, only the process of detecting the change in face ratio is described. For other detection links, if no special description is given in this specification, those skilled in the art can undoubtedly understand and fully implement them by referring to the relevant technology, and there is no need to elaborate on them in this specification. Figure 2 The method process of the implementation method can be set before or after any link of the multiple links of the aforementioned face recognition without conflict, and this specification does not impose any restrictions on this.

[0123] In one example, taking the face-scanning payment scenario of a financial services application as an example, when the client detects that the user has initiated face-scanning payment, it can send a face recognition request to the server, and then implement the face recognition process including one or more of the above-mentioned face presence detection, face quality detection, liveness detection, face matching, etc. through the interaction between the server and the client.

[0124] In this process, the server sends a zoom parameter sequence to the client, and the zoom parameter sequence includes multiple focal length values, and the multiple focal length values ​​are arranged in order. For example, in one example, the zoom parameter sequence is represented as {1.2, 1.4, 1}, which means that the zoom parameter sequence includes 3 focal length values, namely 1.2x, 1.4x and 1x, and the zoom parameter sequence is an ordered sequence, which means that the focal length values ​​in the sequence have a sequence, that is, the image sequence collected according to the zoom parameter sequence should also be an image sequence collected in the order of 1.2x, 1.4x, and 1x.

[0125] In the implementation mode of this specification, the zoom parameter sequence is determined by the server and then sent to the client by the server. The purpose of this is to prevent illegal attackers from breaking into the client system, thereby obtaining the zoom parameter sequence and pre-recording the corresponding video for injection attack. Since the zoom parameter sequence is sent by the server, the client cannot know the specific focal length value and order of the zoom parameter sequence before each face recognition, and illegal attackers cannot obtain the zoom parameter sequence by attacking the client, thereby effectively reducing the risk of injection attack.

[0126] In some embodiments, any one or more of the number of focal length values ​​k (k ≥ 2), focal length values ​​fi (i = 1, 2, ..., k), and the order of focal length values ​​included in the zoom parameter sequence may be dynamically changed. For example, in one example, the number of focal length values ​​k may be determined based on the current risk level of the client, and the higher the risk level, the larger the value of k, and vice versa. For example, in one example, the value of the focal length value fi may be randomly selected within a preset zoom range. For example, in one example, the order of the selected multiple focal length values ​​fi in the zoom parameter sequence may be an ordered arrangement or a random arrangement, such as from small to large, from large to small, or completely random.

[0127] It can be understood that in some embodiments, the zoom parameter sequence of the server changes dynamically, so the zoom parameter sequence corresponding to each face recognition is different. Not only can illegal attackers not break into the client, but even if they obtain the zoom parameter sequence by intercepting the communication link between the server and the client, they cannot produce a valid injection video, because the zoom parameter sequence corresponding to the next face recognition will change, and the produced injection video will become invalid.

[0128] In the implementation manner of this specification, after the server generates the zoom parameter sequence, the zoom parameter sequence can be sent to the client through the network.

[0129] S102: The client collects face images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence.

[0130] In the implementation manner of this specification, after receiving the zoom parameter sequence sent by the server, the client can parse the zoom parameter sequence to obtain the multiple focal length values ​​fi included therein and the order between the focal length values ​​fi.

[0131] For example, in one example, the zoom parameter sequence is {1.2, 1.4, 1}, and the client parses the zoom parameter sequence to obtain focal length values ​​1.2x, 1.4x, and 1x. Then, the client needs to configure the focal length value of the camera in sequence according to the focal length value sequence specified in the zoom parameter sequence, collect the corresponding face image under the focal length value, and combine multiple frames of face images in the order of focal length values ​​to obtain a face image sequence.

[0132] Specifically, in this example, the client can first configure the camera parameters according to the focal length value of 1.2x, that is, control the camera to collect face images at a focal length value of 1.2x, and obtain face image a. Then, the client configures the focal length value in the camera parameters to 1.4x and collects face images to obtain face image b. After that, the client configures the focal length value in the camera parameters to 1x and collects face images to obtain face image c. Finally, the face image sequence {image a, image b, image c} is obtained by combining face image a, face image b, and face image c in order.

[0133] For example Figure 3 In the example, image a, image b, and image c are shown in the figure, where image a refers to a face image captured when the camera focal length is 1.2x, image b refers to a face image captured when the camera focal length is 1.4x, and image c refers to a face image captured when the camera focal length is 1x. The face image sequence {image a, image b, image c} is obtained by combining image a, image b, and image c in order.

[0134] S103: The client sends the facial image sequence to the server.

[0135] After acquiring the facial image sequence, the client can send the facial image sequence to the server.

[0136] S104: The server determines a face recognition result according to a change in face proportion in a face image sequence.

[0137] Combined with the above, it can be seen that if the detected face is a living face, then the face ratio in the face images collected at different focal length values ​​should also be different. Therefore, the server can determine whether it is an injected video based on the change in the face ratio in the face image sequence.

[0138] For example Figure 3 In the example, image a is an image captured at a focal length of 1.2x, and image b is an image captured at a focal length of 1.4x. Therefore, the ratio of the face size in image b to the face size in image a should be equal to or close to 1.4 / 1.2. Similarly, image c is an image captured at a focal length of 1x, so the ratio of the face size in image c to the face size in image b should be equal to or close to 1 / 1.4. Based on this principle, face detection can be performed on images in a face image sequence, and then the face recognition result can be determined based on the change in face ratio between two adjacent images.

[0139] It can be understood that if the face ratio changes of any two adjacent images in the face image sequence are in line with expectations, it can be said that the detected face is alive. Conversely, if the face ratio changes of any two images in the face image sequence are not in line with expectations, it can be said that the detected face is an injection attack.

[0140] In addition, according to the above, the face recognition process on the server side can further include other links, and generate face recognition results based on the above-mentioned face ratio change detection results and the detection results of other links. For example, if the detection result of any link is not passed, the face recognition result is a verification failure. On the contrary, if the detection results of all links are verified, the face recognition result is a verification success.

[0141] S105: The server sends the face recognition result to the client.

[0142] After obtaining the face recognition result, the server can return the face recognition result to the client, and the client can display the face recognition result to the user. For example, if the face recognition result is a verification failure, a failure prompt can be displayed to the user, or the user can be prompted to re-identify. If the face recognition result is a verification success, the subsequent payment process can be initiated. Those skilled in the art can understand this, and this manual will not elaborate on it.

[0143] From the above, it can be seen that in the implementation of this specification, by dynamically adjusting the focal length of the camera, collecting face images of different proportions, effectively distinguishing video injection attacks from normal user behaviors according to the changes in the proportion of face images, and improving the security of face recognition. In addition, the server generates a zoom parameter sequence for face recognition to prevent illegal attackers from breaking into the client, effectively reducing the risk of injection attacks.

[0144] exist Figure 2 Based on the implementation method, Figure 4 and Figure 5 The method flow on the client and server sides is shown separately. Figure 4 and Figure 5 Provide explanation.

[0145] like Figure 4 As shown, in some embodiments, the face recognition method exemplified in this specification, the method process on the client side includes:

[0146] S410: During the face recognition process, receiving a zoom parameter sequence sent by a server.

[0147] Combined with the foregoing, it can be seen that during the face recognition process, the server can generate a zoom parameter sequence and send it to the client. The zoom parameter sequence includes multiple ordered focal length values. For example, in one example, the zoom parameter sequence is {1.2, 1.4, 1}, indicating that the zoom parameter sequence includes a total of 3 focal length values, and the order is 1.2x, 1.4x and 1x.

[0148] S420 , sequentially collecting face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence.

[0149] Combined with the above, it can be known that after receiving the zoom parameter sequence sent by the server, the client can parse the zoom parameter sequence to obtain the multiple focal length values ​​fi included therein, as well as the order between the focal length values ​​fi. Then, the client needs to configure the focal length values ​​of the camera in sequence according to the focal length value sequence specified by the zoom parameter sequence, collect the corresponding face images under the focal length value, and combine multiple frames of face images in the order of the focal length values ​​to obtain a face image sequence.

[0150] For example Figure 3 In the example, the facial image sequence collected by the client is {image a, image b, image c}, where image a refers to the facial image collected when the camera focal length is 1.2x, image b refers to the facial image collected when the camera focal length is 1.4x, and image c refers to the facial image collected when the camera focal length is 1x.

[0151] S430: Send the facial image sequence to the server.

[0152] After acquiring the facial image sequence, the client can send the facial image sequence to the server.

[0153] like Figure 5 As shown, in some implementations, the face recognition method exemplified in this specification, the method process on the server side includes:

[0154] S510: During the face recognition process, a zoom parameter sequence is sent to the client.

[0155] Combined with the above, it can be known that during the face recognition process, the server can generate a zoom parameter sequence for this face recognition, and the zoom parameter sequence includes multiple ordered focal length values. For example, in one example, the zoom parameter sequence is {1.2, 1.4, 1}, indicating that the zoom parameter sequence includes 3 focal length values ​​in total, and the order is 1.2x, 1.4x and 1x. The server can send the zoom parameter sequence to the client through the network.

[0156] S520: Receive a facial image sequence sent by the client, and determine a facial recognition result according to a change in facial proportion in the facial image sequence.

[0157] Based on the foregoing, after receiving the zoom parameter sequence sent by the server, the client can collect face images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence, and then the client sends the face image sequence to the server.

[0158] After receiving the facial image sequence, the server can determine whether it is an injection attack based on the change in the facial ratio of two adjacent images in the facial image sequence. If the facial ratio change of any two adjacent images in the facial image sequence is in line with expectations, it can be said that the detected face is alive. On the contrary, if the facial ratio change of any two images in the facial image sequence is not in line with expectations, it means that the detected face is an injection attack. In addition, the detection results of other links are combined to generate the face recognition result.

[0159] S530: Send the face recognition result to the client.

[0160] After obtaining the face recognition result, the server can return the face recognition result to the client.

[0161] From the above, it can be seen that in the implementation of this specification, by dynamically adjusting the focal length of the camera, collecting face images of different proportions, effectively distinguishing video injection attacks from normal user behaviors according to the changes in the proportion of face images, and improving the security of face recognition. In addition, the server generates a zoom parameter sequence for face recognition to prevent illegal attackers from breaking into the client, effectively reducing the risk of injection attacks.

[0162] Figure 6 The interactive process of the face recognition method in some embodiments of this specification is shown below. Figure 6 The method process of this manual is further explained.

[0163] like Figure 6 As shown, in some embodiments, the face recognition method exemplified in this specification includes:

[0164] S601: In response to detecting that face recognition is turned on, the client displays a preview interface.

[0165] S602: The client sends a control parameter request to the server.

[0166] In the implementation manner of this specification, the face recognition scenario takes the face payment scenario of the financial service application installed on the client as an example.

[0167] The user can choose to pay by face recognition in the financial service application on the client. When the financial service application detects that face recognition is turned on, it can display a preview interface to the user on the client. For example, in an example, the preview interface is as follows Figure 7As shown, the preview interface includes a preview window 20. At the same time, the financial service application turns on the camera by calling the system camera API, and the preview window 20 can display the preview image collected by the camera in real time.

[0168] In some implementations, face recognition includes a liveness detection step, and liveness detection instructions may be displayed to the user on the preview interface of the client. Figure 7 In the example, the liveness detection instruction may be prompt information such as "Please shake your head left and right", "Please open your mouth", "Please blink", etc. The purpose of these prompt information is to prompt the user to follow the instructions of the liveness detection instruction. Figure 7 In the example, when the user sees the liveness detection instruction "Please shake your head left and right", he or she can shake his or her head left and right.

[0169] At the same time, when the client turns on face detection, the client sends a control parameter request to the server. Specifically, the client turns on the aforementioned zoom detection link and first determines the control parameter request. The function of the control parameter request is to tell the server that the zoom detection link can be started, so that the server can generate and send a zoom parameter sequence according to the control parameter request.

[0170] In some embodiments, the control request parameter carries the zoom range FT corresponding to the client, and the zoom range FT represents the focal range supported by the client's camera. It is understandable that different electronic devices have different hardware specifications, so the focal ranges supported by the cameras will also be different. In order to be compatible with all electronic devices, the focal length value selected by the server can only be selected within a smaller range. However, if the electronic device can send the focal range supported by itself to the server, the server can select the focal length value within the larger focal range supported by the electronic device.

[0171] For example, in an example, the electronic device takes a mobile phone as an example. The focal range supported by the front camera module of the electronic device is 1x to 3x. Therefore, when face recognition is turned on, the client can obtain that the zoom range supported by the electronic device is 1x to 3x.

[0172] S603: The server generates a zoom parameter sequence according to the control parameter request.

[0173] After receiving the control parameter request, the server needs to generate the corresponding zoom parameter sequence for this face recognition. Combined with the above, it can be seen that the zoom parameter sequence includes the following three dimensions: one is the number of focal length values ​​k included in the zoom parameter sequence; the second is the value of each focal length value fi; the third is the order of the k focal length values. Therefore, the server needs to determine the zoom parameter sequence from these three dimensions, which are explained below.

[0174] 1) The number of focal length values ​​k

[0175] In some implementations, k may be set to a fixed value, for example, k=3, that is, the zoom parameter sequence includes 3 focal length values.

[0176] In other implementations, the value of k can be determined according to the risk level RL of the client. It can be understood that the larger the value of k, the more images the client needs to collect, and the higher the security of face recognition, but at the same time, the server has a larger amount of calculation to detect changes in face ratios, and the efficiency of face recognition is lower, and vice versa.

[0177] Therefore, when the risk level RL is high, a larger k value can be used, that is, the server selects a larger number of focal length values ​​to prioritize safety. Conversely, when the risk level RL is low, a smaller k value can be used, that is, the server selects a smaller number of focal length values ​​to prioritize detection efficiency.

[0178] In the implementation manner of this specification, the risk level RL can be determined in a variety of ways, and some examples are given below:

[0179] In one example, the server can determine the risk level RL based on the time of face recognition. For example, the financial service platform can count the time when the user has made transactions in the past one month, so as to determine the time period when the user most frequently makes transactions in a day, and determine the time period as a safe time period. For example, the safe time period determined by the financial service platform is 07:00-22:00. When face recognition is turned on, the server can obtain the current time. If the current time is in the safe time period (for example, 14:00), it is determined that the risk level RL currently in which the client is located is low risk. Conversely, if the current time is not in the safe time period (for example, 02:00), it is determined that the risk level RL currently described by the client is high risk.

[0180] In one example, the server can determine the risk level RL based on the number of face recognitions performed in a preset historical period. For example, the financial service platform can count the number of face recognitions performed on the day n. When face recognition is turned on, if the number of face recognitions performed on the day n is greater than or equal to the upper limit, the risk level RL of the client is determined to be high risk. On the contrary, if the number of face recognitions performed on the day n is less than the upper limit, the risk level RL of the client is determined to be low risk.

[0181] In one example, the server can determine the risk level based on the location information of the client. For example, the financial service platform can determine the safe location range based on the user's permanent location information. When face recognition is turned on, the client sends a control parameter request to the server, and the control parameter request can carry the client's current location information. If the location information is within the safe location range, the risk level RL of the client is determined to be low risk. On the contrary, if the client's current location information is not within the safe location range, the risk level RL of the client is determined to be high risk.

[0182] In one example, the server can determine the risk level based on the client's login status. For example, the financial service platform can bind commonly used devices to the user account and maintain a commonly used device list for the user account. When face recognition is turned on, the client sends a control parameter request to the server, and the control parameter request can carry the client's device identifier. If the device identifier matches the device identifier in the commonly used device list, the client's current risk level RL is determined to be low risk. Conversely, if the device identifier does not match the device identifier in the commonly used device list, the client's current risk level RL is determined to be high risk.

[0183] It is understandable that the above process of determining the risk level RL is only a few examples of the schemes in this specification, and the schemes in this specification are not limited to this. Moreover, the various schemes in the above examples can be implemented in combination with any two or more of them, which can be understood by those skilled in the art, and this specification will not elaborate on them. In addition, in the above examples, the risk level RL is only illustrated by the two risk levels of "high risk" and "low risk". In other implementations, the risk level RL can also be divided into more levels, which can be understood by those skilled in the art, and this specification will not elaborate on them.

[0184] For example, in one example, the server determines the risk level RL of the client. If the risk level RL is high risk, k = 5 can be determined; if the risk level RL is low risk, k = 3 can be determined. Of course, the values ​​in this example are only used as examples, and the solution of this specification is not limited to this.

[0185] From the above, it can be seen that in the implementation of this specification, the number of focal length values ​​can be selected according to the risk level in the face recognition process, so as to take into account the face recognition efficiency while ensuring security and improve the user experience.

[0186] 2) The value of focal length fi

[0187] In some implementations, the server may pre-set a preset focal length set, which includes m focal length values, m>k. Thus, when it is necessary to determine the specific values ​​fi of the k focal length values, k focal length values ​​may be randomly selected from the preset focal length set.

[0188] For example, in one example, the preset focal length set is {1, 1.1, 1.2, 1.3, 1.4, 1.5}, and the number of focal length values ​​k=3, so that the server can randomly select 3 focal length values ​​from the preset focal length set, such as focal length values ​​f1=1, f2=1.4, f3=1.1.

[0189] In other implementations, the server may parse the control parameter request sent by the client, obtain the zoom range FT carried therein, and determine the preset focal length set according to the zoom range FT. It can be understood that the zoom range FT is the focal length range supported by the electronic device, and the zoom range FT corresponding to different electronic devices may be different, so the server can generate the corresponding preset focal length set according to the zoom range FT sent by the client.

[0190] For example, in one example, the camera module of the electronic device includes wide-angle and standard focal length cameras, and the supported zoom range FT is 0.8x to 3x, so the server can determine the preset focal length set as [0.8,3], and then randomly select k focal length values ​​from the preset focal length set [0.8,3]. For example, when k=5, the focal length values ​​randomly selected from the preset focal length set [0.8,3] are f1=1.2, f2=1.5, f3=0.8, f4=2, and f5=1. It can be seen that the range of elements in the preset focal length set is wider, so the range of selected focal length values ​​is wider.

[0191] In addition, it is worth mentioning that the 1x focal length is called the standard focal length, that is, the focal length value used when collecting the face template. Therefore, in order to better perform face recognition, in some embodiments, when selecting the k focal length values ​​mentioned above, one of the focal length values ​​f1=1 is given, and the remaining k-1 focal length values ​​are randomly selected from the preset focal length set. Those skilled in the art can understand this and this specification will not go into details.

[0192] 3) Focal length sorting

[0193] In some implementations, after k focal length values ​​are selected, the k focal length values ​​may be sorted in an orderly or random manner to obtain the order of the k focal length values.

[0194] For example, in an example, k=3, and the three focal length values ​​selected are 1.2, 1, and 1.4, respectively. Then, the three focal length values ​​can be sorted from small to large, and the resulting sorting order is {1, 1.2, 1.4}, or they can be sorted from large to small, and the resulting sorting order is {1.4, 1.2, 1}.

[0195] For example, in another example, k=3, and the three focal length values ​​selected are 1.2, 1, and 1.4, respectively. Then, the selection order of the three focal length values ​​can be determined as the sorting order, and the resulting sorting order is {1.2, 1, 1.4}, or it can be randomly sorted, for example, the resulting sorting order is {1, 1.4, 1.2}.

[0196] Through the above method process, after determining the number k of focal length values, the values ​​of focal length values ​​fi and the sorting order, the server can generate a corresponding zoom parameter sequence. For example, in one example, the zoom parameter sequence is {1.2, 1.4, 1}.

[0197] S604: The server sends a zoom parameter sequence to the client.

[0198] After the server generates the zoom parameter sequence through the above method, it can send the zoom parameter sequence to the client. For example, in the above example, the zoom parameter sequence is {1.2, 1.4, 1}.

[0199] S605: The client captures a first image sequence and closes the preview interface.

[0200] S606: The client collects a facial image sequence according to the zoom parameter sequence.

[0201] In the example of this specification, when the client displays the liveness detection instruction on the preview interface, the camera collects a video sequence of the user's face in real time. The video sequence represents the video stream collected during the user's actions following the liveness detection instruction, and the first image sequence is a specific frame in the video sequence.

[0202] It can be understood that the purpose of acquiring the first image sequence is to perform the liveness detection link. In some embodiments, the zoom detection link of the implementation mode of this specification can be performed after the liveness detection, that is, after acquiring the first image sequence, the face image sequence is acquired according to the zoom parameter sequence.

[0203] For example, in some implementations, after acquiring the first image sequence, the client may close the display of the preview interface. For example, in one example, the preview interface may be displayed on the screen of the electronic device. Figure 8 The waiting interface shown. During the display of the waiting interface, the client can execute the process of collecting a facial image sequence according to the zoom parameter sequence.

[0204] For example, the previous Figure 3 In the example, the zoom parameter sequence is {1.2, 1.4, 1}. The client can first configure the camera parameters according to the focal length value of 1.2x, that is, control the camera to capture a face image at a focal length value of 1.2x, and obtain image a. Then, the client configures the focal length value in the camera parameters to 1.4x and captures a face image, and obtains image b. After that, the client configures the focal length value in the camera parameters to 1x and captures a face image, and obtains image c. Finally, the face image sequence {image a, image b, image c} is obtained by combining the images a, b, and c in order.

[0205] It is worth noting that in this exemplary embodiment, during the process of collecting the facial image sequence, the display interface of the client can continuously display Figure 8 The waiting interface shown, that is, when the client collects the facial image sequence, the preview window 20 will not be displayed to the user. The purpose of doing so is as follows: first, to prevent the real user from perceiving the zoom process of the camera. Frequent zooming and collecting images will reduce the user experience, so closing the preview window can achieve the user-unaware image collection; second, to prevent illegal attackers from perceiving the zoom detection link of the method of this specification. Since illegal attackers cannot perceive the zoom detection process through the client, the risk of injection attack is also reduced.

[0206] S607: The client sends the first image sequence and the face image sequence to the server.

[0207] Combined with the above, we can see that on the client side Figure 7 After the living body detection process shown collects the first image sequence and collects the face image sequence through the above method process, the first image sequence and the face image sequence can be sent to the server.

[0208] S608: The server performs living body detection according to the first image sequence.

[0209] After receiving the first image sequence, the server may perform liveness detection according to the first image sequence. The liveness detection may be implemented by using algorithms in related technologies, which will not be described in detail in this specification.

[0210] S609: The server determines a face recognition result according to a change in face proportion in the face image sequence.

[0211] In the implementation manner of this specification, after receiving the facial image sequence sent by the client, the server can determine the face recognition result according to the change of the face proportion of the facial image sequence.

[0212] Specifically, for any two adjacent images in a face image sequence, when the face being measured is alive, the ratio of the face sizes on the images should be equal to or close to the ratio of the focal length values. Based on this principle, the server can make a proportion judgment on any two adjacent images in the face image sequence.

[0213] For example, Figure 3 Taking the face image sequence {image a, image b, image c} shown in the figure as an example, for adjacent images a and b, face region detection can be performed on images a and b respectively. Fig. 9 As shown, the face area is represented by the smallest circumscribed rectangle of the face on the image. The first face area corresponding to image a and the second face area on image b are shown in Fig. 9 shown.

[0214] Then, the diagonal length of the rectangular frame can be used to represent the size of the face area. For example, the size of the first face area corresponding to image a is line segment AC, and the size of the second face area corresponding to image b is line segment BD. The length values ​​of AC and BD can be calculated respectively through image detection technology.

[0215] It can be understood that image a is an image captured at a focal length of 1.2x, and image b is an image captured at a focal length of 1.4x. Theoretically, the ratio of BD / AC should be equal to or close to 1.4 / 1.2. Therefore, in the implementation of this specification, the ratio of the first face area to the second face area is defined as the face ratio change parameter, and the face ratio change parameter is matched with the ratio of the focal lengths of the two images to determine whether the two images have passed the verification.

[0216] Continue to refer to Fig. 9 As shown, the ratio of the size AC of the first face area to the size BD of the second face area is the face ratio transformation parameter AC / BD, and the focal length ratio of the first image a and the second image b is 1.2 / 1.4. Then, the face ratio transformation parameter AC / BD is matched with the focal length ratio 1.2 / 1.4. If the two are equal or close, it can be determined that the face ratio change of image a and image b meets expectations, thereby determining that image a and image b have passed verification.

[0217] exist Fig. 9 In the example, only the verification process of image a and image b is used as an example for explanation. The verification process of image b and image c is similar to it. Those skilled in the art can undoubtedly understand and fully implement it, and this specification will not elaborate on it.

[0218] In the implementation mode of this specification, the server can determine whether every two adjacent images in the face image sequence have been verified through the above method process. If any two adjacent images have been verified, it means that the current object under test is not an injection attack, but a real face. On the contrary, if there are any two adjacent images that have not been verified, it means that the current object under test has an injection attack risk.

[0219] After the server determines that the facial image sequence has passed the verification, it can further combine the aforementioned one or more links such as face existence detection, face quality detection, liveness detection, face matching, etc. for further detection. If all links are verified, the face recognition result can be determined to be a successful verification. On the contrary, if a link fails to be verified, the face recognition result can be determined to be a failed verification.

[0220] S610: The server returns the face recognition result to the client.

[0221] After obtaining the face recognition result, the server can return the face recognition result to the client. The client can display the face recognition result to the user. For example, if the face recognition result is a verification failure, a failure prompt can be displayed to the user, or the user can be prompted to re-identify. If the face recognition result is a verification success, the subsequent payment process can be initiated. Those skilled in the art can understand this, and this manual will not elaborate on it.

[0222] Fig.10 A schematic diagram of the facial image sequence when using a pre-recorded video for injection attack is shown. Figure 3 and Fig.10 It can be seen that since the injection attack uses video frame images to replace the camera captured images, and the face injected into the video does not have a change in face ratio caused by zooming, the server can easily identify that the face ratio change does not meet expectations during the above detection process, thereby effectively blocking illegal attacks injected into the video.

[0223] From the above, it can be seen that in the implementation mode of this specification, by dynamically adjusting the focal length of the camera, face images of different proportions are collected, and video injection attacks and normal user behaviors are effectively distinguished according to the changes in the proportion of the face images, thereby improving the security of face recognition. In addition, the zoom parameter sequence of face recognition is dynamically generated by the server to prevent illegal attackers from breaking into the client, effectively reducing the risk of injection attacks. The number of focal length values ​​is selected according to the risk level in the face recognition process, thereby taking into account the efficiency of face recognition while ensuring security and improving the user experience. The preset focal length set is determined based on the zoom range supported by the electronic device, so that the range of selected focal length values ​​is wider, and the recognition effect of illegal attacks is better.

[0224] In some implementations, the present specification provides a face recognition device, which is applied to a client, such as Fig.11 As shown, the device comprises:

[0225] The parameter receiving module 100 is configured to receive a zoom parameter sequence sent by the server during the face recognition process, wherein the zoom parameter sequence includes a plurality of ordered focal length values;

[0226] The image acquisition module 200 is configured to sequentially acquire face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0227] The image sending module 300 is configured to send the face image sequence to the server and receive the face recognition result returned by the server, wherein the face recognition result is determined by the server according to the change of face proportion in the face image sequence.

[0228] In some implementations, the parameter receiving module 100 is configured to:

[0229] During the face recognition process, a control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request;

[0230] Receive the zoom parameter sequence sent by the server.

[0231] In some implementations, the control parameter request includes a zoom range corresponding to the client, and the parameter receiving module 100 is configured to:

[0232] A control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the zoom range included in the control parameter request.

[0233] In some implementations, the parameter receiving module 100 is configured to:

[0234] In response to detecting that face recognition is turned on, displaying a preview interface on the client, the preview interface is used to display a liveness detection instruction, and collecting a first image sequence during the display of the liveness detection instruction;

[0235] The image acquisition module is configured to: close the display of the preview interface on the client, and sequentially acquire face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0236] The image sending module is configured to send the first image sequence and the face image sequence to the server.

[0237] In some implementations, the embodiments of this specification provide a face recognition device, which is applied to a server, such as Fig.12 As shown, the device comprises:

[0238] The parameter sending module 400 is configured to send a zoom parameter sequence to the client during the face recognition process, wherein the zoom parameter sequence includes a plurality of ordered focal length values, so that the client sequentially collects face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence;

[0239] The image receiving module 500 is configured to receive the facial image sequence sent by the client, and determine the facial recognition result according to the facial proportion change in the facial image sequence;

[0240] The result sending module 600 is configured to send the face recognition result to the client.

[0241] In some implementations, the parameter sending module 400 is configured to:

[0242] K focal length values ​​are randomly selected from a preset focal length set, and the k focal length values ​​are ordered or randomly sorted to obtain the zoom parameter sequence, where k is an integer and k≥2.

[0243] In some implementations, the parameter sending module 400 is configured to:

[0244] During the face recognition process, receiving a control parameter request sent by the client, wherein the control parameter request includes a zoom range corresponding to the client;

[0245] Determining the preset focal length set according to the zoom range, and determining the zoom parameter sequence based on the preset focal length set;

[0246] The zoom parameter sequence is sent to the client.

[0247] In some implementations, the parameter sending module 400 is configured to:

[0248] During the face recognition process, receiving a control parameter request sent by the client, and determining a risk level corresponding to the client according to the control parameter request;

[0249] Determining a value of k according to the risk level, and determining the zoom parameter sequence, wherein the value of k is positively correlated with the risk level;

[0250] The zoom parameter sequence is sent to the client.

[0251] In some implementations, the parameter sending module is configured to:

[0252] Determining the risk level based on the time of face recognition;

[0253] Determine the risk level based on the number of face recognitions within a preset historical period;

[0254] Determining the risk level according to the location information of the client;

[0255] The risk level is determined according to the login status of the client.

[0256] In some implementations, the image receiving module 500 is configured to:

[0257] For any two adjacent images in the facial image sequence, obtaining a first facial region on the first image and a second facial region on the second image;

[0258] Determining a face ratio change parameter based on the first face area and the second face area, and determining that the first image and the second image have been verified in response to the face ratio change parameter matching a focal length ratio of the first image and the second image;

[0259] In response to any two adjacent images in the facial image sequence being verified, it is determined that the facial recognition result is successfully verified.

[0260] In some embodiments, the embodiments of this specification provide a face recognition system, which can be as described above. Figure 1 As shown, it includes a client and a server.

[0261] During the face recognition process, the server sends a zoom parameter sequence to the client, where the zoom parameter sequence includes a plurality of ordered focal length values;

[0262] The client collects face images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence, and sends the face image sequence to the server;

[0263] The server determines a face recognition result according to a change in face ratio in the face image sequence, and sends the face recognition result to the client.

[0264] In some implementations, an implementation of this specification provides an electronic device, which can be used as the above-mentioned client and / or server, and the electronic device includes:

[0265] processor;

[0266] A memory stores computer instructions, wherein the computer instructions are used to enable a processor to execute the method described in any of the above embodiments.

[0267] In some embodiments, an embodiment of this specification provides a storage medium storing computer instructions, wherein the computer instructions are used to implement the method described in any of the above embodiments.

[0268] In some implementations, the embodiments of this specification provide a computer program product, which is used to implement the method described in any of the above implementations.

[0269] Fig.13 is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Fig.13 At the hardware level, the electronic device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

Claims

1. A face recognition method, characterized in that: Applied to a client, the method comprises: During the face recognition process, receiving a zoom parameter sequence sent by a server, wherein the zoom parameter sequence includes a plurality of ordered focal length values; Collecting facial images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a facial image sequence; The facial image sequence is sent to a server, and a facial recognition result returned by the server is received, wherein the facial recognition result is determined by the server according to a change in facial proportion in the facial image sequence.

2. The method according to claim 1, characterized in that In the face recognition process, receiving the zoom parameter sequence sent by the server includes: During the face recognition process, a control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request; Receive the zoom parameter sequence sent by the server.

3. The method according to claim 2, characterized in that The control parameter request includes a zoom range corresponding to the client; and sending the control parameter request to the server so that the server determines a zoom parameter sequence corresponding to the client according to the control parameter request, comprising: A control parameter request is sent to the server, so that the server determines a zoom parameter sequence corresponding to the client according to the zoom range included in the control parameter request.

4. The method according to claim 1, characterized in that: Also includes: In response to detecting that face recognition is turned on, displaying a preview interface on the client, the preview interface is used to display a liveness detection instruction, and collecting a first image sequence during the display of the liveness detection instruction; The step of sequentially acquiring face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence comprises: closing the display of the preview interface on the client, and sequentially acquiring face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence; The sending the facial image sequence to the server includes: sending the first image sequence and the facial image sequence to the server.

5. A face recognition method, characterized in that: Applied to the server, the method includes: During the face recognition process, a zoom parameter sequence is sent to a client, the zoom parameter sequence including a plurality of ordered focal length values, so that the client sequentially collects face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence; Receiving the facial image sequence sent by the client, and determining a facial recognition result according to a change in facial proportion in the facial image sequence; Send the face recognition result to the client.

6. The method according to claim 5, characterized in that The zoom parameter sequence is determined by: K focal length values ​​are randomly selected from a preset focal length set, and the k focal length values ​​are ordered or randomly sorted to obtain the zoom parameter sequence, where k is an integer and k≥2.

7. The method according to claim 6, characterized in that During the face recognition process, a zoom parameter sequence is sent to the client, including: During the face recognition process, receiving a control parameter request sent by the client, wherein the control parameter request includes a zoom range corresponding to the client; Determining the preset focal length set according to the zoom range, and determining the zoom parameter sequence based on the preset focal length set; The zoom parameter sequence is sent to the client.

8. The method according to claim 7, characterized in that During the face recognition process, a zoom parameter sequence is sent to the client, including: During the face recognition process, receiving a control parameter request sent by the client, and determining a risk level corresponding to the client according to the control parameter request; Determining a value of k according to the risk level, and determining the zoom parameter sequence, wherein the value of k is positively correlated with the risk level; The zoom parameter sequence is sent to the client.

9. The method according to claim 8, characterized in that The process of determining the risk level corresponding to the client includes at least one of the following: Determining the risk level based on the time of face recognition; Determine the risk level based on the number of face recognitions within a preset historical period; Determining the risk level according to the location information of the client; The risk level is determined according to the login status of the client.

10. The method according to any one of claims 5 to 9, characterized in that: Determining a face recognition result according to a change in face ratio in the face image sequence includes: For any two adjacent images in the facial image sequence, obtaining a first facial region on the first image and a second facial region on the second image; Determining a face ratio change parameter based on the first face area and the second face area, and determining that the first image and the second image have been verified in response to the face ratio change parameter matching a focal length ratio of the first image and the second image; In response to any two adjacent images in the facial image sequence being verified, it is determined that the facial recognition result is successfully verified.

11. A face recognition device, characterized in that: Applied to a client, the device comprises: A parameter receiving module is configured to receive a zoom parameter sequence sent by a server during face recognition, wherein the zoom parameter sequence includes a plurality of ordered focal length values; An image acquisition module is configured to sequentially acquire facial images according to the focal length values ​​included in the zoom parameter sequence to obtain a facial image sequence; The image sending module is configured to send the face image sequence to the server and receive the face recognition result returned by the server, wherein the face recognition result is determined by the server according to the change of face proportion in the face image sequence.

12. A face recognition device, characterized in that: Applied to the server, the device comprises: A parameter sending module is configured to send a zoom parameter sequence to a client during face recognition, wherein the zoom parameter sequence includes a plurality of ordered focal length values, so that the client sequentially collects face images according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence; An image receiving module is configured to receive the facial image sequence sent by the client, and determine a facial recognition result according to a change in facial proportion in the facial image sequence; The result sending module is configured to send the face recognition result to the client.

13. A face recognition system, characterized in that: Including client and server, During the face recognition process, the server sends a zoom parameter sequence to the client, where the zoom parameter sequence includes a plurality of ordered focal length values; The client collects face images in sequence according to the focal length values ​​included in the zoom parameter sequence to obtain a face image sequence, and sends the face image sequence to the server; The server determines a face recognition result according to a change in face ratio in the face image sequence, and sends the face recognition result to the client.

14. An electronic device, characterized in that: include: processor; A memory storing computer instructions, wherein the computer instructions are used to enable a processor to execute the method according to any one of claims 1 to 10.

15. A computer program product, characterized in that The computer program product is used to implement the method according to any one of claims 1 to 10.