Face recognition method, face interaction method, device and electronic device

By obtaining the first target face and candidate face in the image to be recognized in the face recognition technology, and using deflection information to determine the second target face, the system loss problem caused by restarting the face recognition process in traditional technology is solved, and the system is improved System performance and interaction efficiency are achieved.

CN114267075BActive Publication Date: 2024-11-22BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210067841.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-20
Publication Date
2024-11-22
Estimated Expiration
2042-01-20

AI Technical Summary

Technical Problem

In traditional face recognition technology, the face recognition process needs to be restarted every time the target face is determined, resulting in large system losses and affecting system performance.

Method used

By obtaining the first target face and the candidate face in the image to be identified, the deflection information of the first target face is obtained, and the second target face is determined from the candidate face based on the deflection information and the position relationship of the candidate face. , avoid multiple facial recognition.

Benefits of technology

It reduces terminal losses, improves terminal performance, avoids the loss of multiple face recognition required for multiple face recognition when detecting faces of different targets, and enhances the efficiency and fun of face interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114267075B_ABST
    Figure CN114267075B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a face recognition method, a face interaction method, a device, an electronic device, a computer-readable storage medium, and a computer program product, wherein the method obtains an image to be recognized including multiple faces, determines a first target face and a candidate face from the image to be recognized, and obtains deflection information of the first target face, and then determines a second target face from the candidate face according to the deflection information of the first target face and the positional relationship between the first target face and the candidate face. Since the present disclosure re-determines a new target face based on the deflection information of the original target face and the positional relationship between the original target face and the candidate face in the image to be recognized, there is no need to perform face recognition multiple times. Compared with the solution in the traditional technology that multiple face recognitions are required for multiple detections of different target faces, the solution of the present disclosure can reduce terminal loss and improve terminal performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of face recognition technology, and in particular to a face recognition method, a face interaction method, a device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the rapid development of computer vision technology, the application of face recognition is becoming more and more widespread. Face recognition is a way to identify people in an image to determine the target face.

[0003] In the related art, recognition is performed based on the facial feature information of multiple people in an image to determine the face with the most and most complete facial feature information as the target face. When it is detected that the facial feature information of the target face in the image has changed, the face recognition process needs to be restarted to determine the new target face.

[0004] However, in traditional technologies, since the face recognition process needs to be restarted each time the target face is determined, the system loss is large, thus affecting the system performance. Summary of the invention

[0005] The present disclosure provides a face recognition method, a face interaction method, a device, an electronic device, a computer-readable storage medium, and a computer program product, to at least solve the problem in the related art that the face recognition process needs to be restarted each time a target face is determined, resulting in large system loss and affecting system performance. The technical solution of the present disclosure is as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a face recognition method is provided, comprising:

[0007] Acquire an image to be recognized including multiple faces, and determine a first target face and candidate faces from the image to be recognized, wherein the candidate faces are faces other than the first target face in the image to be recognized;

[0008] Obtaining deflection information of the first target face;

[0009] A second target face is determined from the candidate faces according to the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

[0010] In one of the embodiments, determining a second target face from the candidate faces based on the deflection information of the first target face and the positional relationship between the first target face and the candidate faces includes: determining a target area in the image to be identified based on the deflection information of the first target face; acquiring the candidate faces in the target area, and determining a second target face from the candidate faces in the target area.

[0011] In one of the embodiments, the step of obtaining candidate human faces in the target area and determining a second target human face from the candidate human faces in the target area includes: obtaining the distance between each candidate human face in the target area and the first target human face; and selecting the candidate human face with the smallest distance as the second target human face.

[0012] In one of the embodiments, the step of obtaining candidate faces in the target area and determining a second target face from the candidate faces in the target area further includes: when there are multiple candidate faces with the smallest distance, determining the second target face based on the angle between each candidate face and the first target face in the coordinate system where the first target face is located; wherein the coordinate system where the first target face is located is a coordinate system with the key point of the first target face as the origin, the angle is the angle between the line between each candidate face and the first target face and the coordinate axis in the coordinate system, and the second target face is the candidate face with the smallest angle.

[0013] In one embodiment, obtaining the deflection information of the first target face includes: when it is detected that the position of the key point of the first target face changes, obtaining the rotation angle of the key point position in the coordinate system where the first target face is located, the coordinate system where the first target face is located is a coordinate system with the initial position of the key point of the first target face as the origin; determining the deflection information of the first target face according to the rotation angle.

[0014] In one embodiment, the deflection information of the first target face is determined according to the rotation angle, including: when the rotation angle is a pitch angle and the pitch angle is less than zero, determining that the deflection information of the first target face is a downward deflection; when the rotation angle is a pitch angle and the pitch angle is greater than zero, determining that the deflection information of the first target face is an upward deflection; when the rotation angle is a yaw angle and the yaw angle is less than zero, determining that the deflection information of the first target face is a right deflection; when the rotation angle is a yaw angle and the yaw angle is greater than zero, determining that the deflection information of the first target face is a left deflection.

[0015] In one embodiment, determining the target area in the image to be identified based on the deflection information of the first target face includes: when the deflection information of the first target face is determined to be a downward deflection, determining the area in the image to be identified whose first coordinate is less than zero as the target area; when the deflection information of the first target face is determined to be an upward deflection, determining the area in the image to be identified whose first coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a left deflection, determining the area in the image to be identified whose second coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a right deflection, determining the area in the image to be identified whose second coordinate is less than zero as the target area.

[0016] In one of the embodiments, determining the first target face from the image to be identified includes: obtaining the number of facial features displayed by each face in the image to be identified based on preset facial features; and determining the face displaying the largest number of facial features as the first target face.

[0017] In one of the embodiments, the method further includes: when there are multiple faces displaying the largest number of facial features, obtaining multiple frames of images to be identified that are continuously acquired; determining the number of times each face in the multiple frames of images to be identified displays the target facial features; and determining the face displaying the largest number of times as the first target face.

[0018] According to a second aspect of an embodiment of the present disclosure, a face interaction method is provided, the method comprising:

[0019] In response to the interactive instruction, an interactive interface is displayed, and the image to be recognized is displayed in the interactive interface;

[0020] Determine a first target face from the image to be recognized, and display a preset effect on the first target face;

[0021] A second target face is determined in the image to be recognized, and a preset effect on the first target face is transferred to the second target face, wherein the second target face is recognized by the face recognition method described in the first aspect.

[0022] According to a third aspect of an embodiment of the present disclosure, there is provided a face recognition device, including:

[0023] The module for acquiring an image to be recognized is configured to acquire an image to be recognized including a plurality of faces, and determine a first target face and candidate faces from the image to be recognized, wherein the candidate faces are faces other than the first target face in the image to be recognized;

[0024] a deflection information acquisition module, configured to acquire the deflection information of the first target face;

[0025] The second target face determination module is configured to determine a second target face from the candidate faces based on the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

[0026] In one of the embodiments, the second target face determination module includes: a target area determination unit, configured to determine the target area in the image to be identified based on the deflection information of the first target face; a second target face determination unit, configured to obtain candidate human faces in the target area, and determine the second target face from the candidate human faces in the target area.

[0027] In one of the embodiments, the second target face determination unit is configured to execute: obtaining the distance between each candidate face in the target area and the first target face; and taking the candidate face with the smallest distance as the second target face.

[0028] In one of the embodiments, the second target face determination unit is further configured to perform: when there are multiple candidate face with the smallest distance, determining the second target face based on the angle between each candidate face in the coordinate system where the first target face is located; wherein the coordinate system where the first target face is located is a coordinate system with the key point of the first target face as the origin, the angle is the angle between the line between each candidate face and the first target face and the coordinate axis in the coordinate system, and the second target face is the candidate face with the smallest angle.

[0029] In one embodiment, the deflection information acquisition module includes: a rotation angle acquisition unit, configured to execute, when a change in the position of the key point of the first target face is detected, to obtain the rotation angle of the key point position in the coordinate system where the first target face is located, the coordinate system where the first target face is located is a coordinate system with the initial position of the key point of the first target face as the origin; a deflection information determination unit, configured to execute determination of the deflection information of the first target face based on the rotation angle.

[0030] In one of the embodiments, the deflection information determination unit is configured to perform: when the rotation angle is a pitch angle and the pitch angle is less than zero, determining that the deflection information of the first target face is a downward deflection; when the rotation angle is a pitch angle and the pitch angle is greater than zero, determining that the deflection information of the first target face is an upward deflection; when the rotation angle is a yaw angle and the yaw angle is less than zero, determining that the deflection information of the first target face is a right deflection; when the rotation angle is a yaw angle and the yaw angle is greater than zero, determining that the deflection information of the first target face is a left deflection.

[0031] In one of the embodiments, the target area determination unit is configured to perform: when the deflection information of the first target face is determined to be a downward deflection, determining the area in the image to be identified whose first coordinate is less than zero as the target area; when the deflection information of the first target face is determined to be an upward deflection, determining the area in the image to be identified whose first coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a left deflection, determining the area in the image to be identified whose second coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a right deflection, determining the area in the image to be identified whose second coordinate is less than zero as the target area.

[0032] In one of the embodiments, the module for acquiring the image to be identified is further configured to execute: based on preset facial features, obtaining the number of facial features displayed by each face in the image to be identified; and determining the face displaying the largest number of facial features as the first target face.

[0033] In one of the embodiments, the module for acquiring images to be identified is further configured to execute: when there are multiple faces that display the largest number of facial features, acquiring multiple frames of images to be identified that are continuously acquired; determining the number of times each face in the multiple frames of images to be identified displays the target facial features; and determining the face with the largest number of displays as the first target face.

[0034] According to a fourth aspect of an embodiment of the present disclosure, a face interaction device is provided, the device comprising:

[0035] An instruction response module is configured to execute in response to the interactive instruction, display an interactive interface, and display the image to be recognized in the interactive interface;

[0036] The display module is configured to determine a first target face from the image to be recognized and display a preset effect on the first target face; determine a second target face in the image to be recognized and transfer the preset effect on the first target face to the second target face, wherein the second target face is recognized by the face recognition method described in any one of the first aspects above.

[0037] According to a fifth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the face recognition method as described in any one of the first aspect and the face interaction method as described in the second aspect.

[0038] According to the sixth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the face recognition method as described in any one of the first aspect and the face interaction method as described in the second aspect.

[0039] According to the seventh aspect of an embodiment of the present disclosure, a computer program product is provided, which includes instructions. When the instructions are executed by a processor of an electronic device, the electronic device is capable of executing the face recognition method described in any one of the first aspect and the face interaction method described in the second aspect.

[0040] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: by obtaining an image to be identified including multiple faces, determining a first target face and a candidate face from the image to be identified, and obtaining the deflection information of the first target face, and then determining a second target face from the candidate face according to the deflection information of the first target face and the positional relationship between the first target face and the candidate face. Since the present disclosure re-determines a new target face based on the deflection information of the original target face and the positional relationship between the original target face and the candidate face in the image to be identified, there is no need to perform face recognition multiple times. Compared with the solution in the traditional technology that requires multiple face recognitions for multiple detections of different target faces, the solution of the present disclosure can reduce terminal loss and improve terminal performance.

[0041] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0043] Figure 1 The figure is a flow chart of a face recognition method according to an exemplary embodiment.

[0044] Figure 2 The figure is a flowchart showing the step of determining a second target face according to an exemplary embodiment.

[0045] Figure 3 The figure is a schematic diagram showing a method of determining a second target face according to an exemplary embodiment.

[0046] Figure 4 is a flowchart showing steps of obtaining deflection information according to an exemplary embodiment.

[0047] Figure 5is a coordinate diagram of Euler angles according to an exemplary embodiment.

[0048] Figure 6 The present invention is a flowchart of a face interaction method according to an exemplary embodiment.

[0049] Figure 7 is a schematic diagram showing a face interaction effect according to an exemplary embodiment.

[0050] Figure 8 The figure is a block diagram of a face recognition device according to an exemplary embodiment.

[0051] Fig. 9 The figure is a block diagram of a face interaction device according to an exemplary embodiment.

[0052] Fig.10 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0053] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0054] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0055] It should also be noted that 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 display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0056] Figure 1 is a flow chart of a face recognition method according to an exemplary embodiment. Figure 1 As shown, this embodiment is illustrated by applying the method to a terminal. Specifically, the terminal may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, etc. In this embodiment, the method includes the following steps:

[0057] In step S110, an image to be recognized including multiple faces is acquired, and a first target face and candidate faces are determined from the image to be recognized.

[0058] The image to be identified is an image collected by the terminal to be subjected to face recognition to determine the target face. The first target face can be the face with the most and most complete facial feature information in the image to be identified, or it can be the face located at the center of the image to be identified, or it can be a face with specific meaning determined in other ways. The candidate faces are the remaining faces in the image to be identified except the first target face.

[0059] Specifically, the terminal collects an image to be identified that includes multiple faces, and determines a first target face and candidate faces from the image to be identified.

[0060] In step S120, deflection information of the first target face is obtained.

[0061] The deflection information refers to the direction information of the first target face deviating from the original position when the position of the first target face changes. For example, the deflection information may be the direction of the new position of the first target face collected by the terminal relative to the original position when the position of the first target face changes. For example, the new position deflects downward, upward, leftward, or rightward relative to the original position.

[0062] Specifically, taking AR (Augmented Reality, a technology that adds a virtual world created by computer programs to the real world captured by a camera) shooting scene as an example, when a terminal is used for AR shooting, an AR effect is usually added to the target face in the terminal capture screen. When the position of the target face changes, or the facial feature points of the target face in the captured screen change, face recognition will be performed again to re-determine the new target face with the AR effect added, resulting in greater losses in the terminal during frequent face recognition, which in turn affects performance.

[0063] Based on this, in this embodiment, when the terminal detects that the position of the first target face in the image to be recognized has changed, the corresponding deflection information is obtained based on the position change of the first target face. Then, the second target face is determined from the candidate faces in the image to be recognized through subsequent steps, that is, a new target face is determined, thereby avoiding the performance loss of multiple detections of different target faces.

[0064] In step S130, a second target face is determined from the candidate faces based on the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

[0065] The second target face is the new target face in the re-determined image to be identified. The positional relationship between the first target face and the candidate faces refers to the relative positional relationship between the first target face and each candidate face in the image to be identified, for example, based on the position of the first target face in the image to be identified, the positional relationship of each candidate face is whether it is located above, below, to the left or to the right of the first target face.

[0066] Since the deflection information is the direction information of the first target face deviating from its original position when the position changes, this direction information can be used to determine the direction in which the first target face deflects, for example, whether it deflects upward, downward, leftward or rightward.

[0067] Furthermore, since the positional relationship between the first target face and the candidate face can be obtained based on the image to be identified, after the deflection information of the first target face is obtained, the second target face can be determined from the candidate face based on the deflection direction of the first target face and the positional relationship between the first target face and the candidate face. For example, when the deflection direction of the first target face is upward, the second target face can be determined from the candidate face located above the first target face in the image to be identified; and when the deflection direction of the first target face is leftward, the second target face can be determined from the candidate face located to the left of the first target face in the image to be identified, and so on.

[0068] In the above-mentioned face recognition method, by obtaining an image to be recognized including multiple faces, determining a first target face and a candidate face from the image to be recognized, and obtaining the deflection information of the first target face, and then determining a second target face from the candidate face according to the deflection information of the first target face and the positional relationship between the first target face and the candidate face. Since the present disclosure re-determines a new target face based on the deflection information of the original target face and the positional relationship between the original target face and the candidate face in the image to be recognized, there is no need to perform face recognition multiple times. Compared with the solution in the traditional technology that requires multiple face recognitions for multiple detections of different target faces, the solution of the present disclosure can reduce terminal loss and improve terminal performance.

[0069] In an exemplary embodiment, if Figure 2 As shown, in step S130, according to the deflection information of the first target face and the positional relationship between the first target face and the candidate face, the second target face is determined from the candidate face, which can be specifically achieved by the following steps:

[0070] In step S210, a target area in the image to be recognized is determined according to the deflection information of the first target face.

[0071] The target area refers to the area where the new target face, i.e., the second target face, is located in the image to be recognized. Since the deflection information is the direction information of the first target face deviating from the original position when the position changes, the direction in which the first target face deflects can be determined through this direction information, for example, whether it deflects upward, downward, leftward, or rightward.

[0072] Therefore, when it is determined according to the deflection information of the first target face that the first target face is deflected upward, the area above the first target face in the image to be identified can be determined as the target area; when it is determined according to the deflection information of the first target face that the first target face is deflected downward, the area below the first target face in the image to be identified can be determined as the target area; when it is determined according to the deflection information of the first target face that the first target face is deflected to the left, the area to the left of the first target face in the image to be identified can be determined as the target area; when it is determined according to the deflection information of the first target face that the first target face is deflected to the right, the area to the right of the first target face in the image to be identified can be determined as the target area.

[0073] In step S220, candidate human faces in the target area are obtained, and a second target human face is determined from the candidate human faces in the target area.

[0074] Specifically, based on the position of each face in the image to be identified, that is, the positional relationship between the first target face and the candidate face in the image to be identified, the second target face can be determined from the candidate faces in the target area. For example, when the area above the first target face in the image to be identified is determined as the target area, based on the positional relationship between the first target face and the candidate face in the image to be identified, it is determined whether there is a candidate face in the area above the first target face. If there is a candidate face in the area, the candidate face in the area is obtained, and the second target face is determined from the candidate faces in the area.

[0075] In the above embodiment, the target area in the image to be recognized is determined based on the deflection information of the first target face, and the candidate faces in the target area are obtained, and the second target face is determined from the candidate faces in the target area. Since the present embodiment determines the area where the new target face is located based on the deflection information of the first target face, the area range for determining the new target face is narrowed, and the new target face can be quickly determined from the area, which not only improves the efficiency of determining the new target face, but also avoids the loss of multiple face recognitions required for multiple detections of different target faces.

[0076] In an exemplary embodiment, in step S220, candidate faces in the target area are obtained, and a second target face is determined from the candidate faces in the target area, which may specifically include: when there is only one candidate face in the target area, the candidate face is used as the second target face.

[0077] When there are multiple candidate faces in the target area, the distance between each candidate face and the first target face in the target area is obtained, and the candidate face with the smallest distance is used as the second target face. The distance between each candidate face and the first target face can be determined based on the pixel interval between the two, or based on the coordinate system, or based on the straight-line distance between the two.

[0078] For example, the terminal can call a measurement tool to measure the straight-line distance between the center point of the candidate face in the image to be identified and the center point of the first target face, and based on the straight-line distance between each candidate face and the first target face, the candidate face with the smallest straight-line distance is used as the second target face.

[0079] The terminal can also establish a coordinate system based on the image to be identified, for example, using the center point of the image to be identified as the origin to establish a coordinate system, or using the center point or key point (such as the position of the nose tip) of the first target face in the image to be identified as the origin to establish a coordinate system. Then, the first coordinate of the center point of the first target face in the image to be identified is obtained, and the second coordinate of the center point of each candidate face in the image to be identified is obtained, and the coordinate distance between the second coordinate of each candidate face and the first coordinate of the first target face is calculated, and the candidate face with the smallest coordinate distance is used as the second target face. It can be understood that in the process of determining the first coordinate and the second coordinate, the corresponding coordinate systems should be the same, that is, the origin of the coordinate system should be the same point in the image to be identified.

[0080] Similarly, the method for determining the interval pixels between each candidate face and the first target face is substantially the same as the above method. For example, the number of interval pixels between the center point of each candidate face and the center point of the first target face in the horizontal direction and the number of interval pixels in the vertical direction are obtained respectively, and the interval pixels between each candidate face and the first target face are calculated based on the number of interval pixels in the horizontal direction and the number of interval pixels in the vertical direction (such as calculating the square root of the sum of the squares of the two), and the candidate face with the smallest interval pixels is used as the second target face.

[0081] In the above embodiment, by obtaining candidate faces in the target area, when there is only one candidate face in the target area, the candidate face is used as the second target face; and when there are multiple candidate faces in the target area, the distance between each candidate face in the target area and the first target face is obtained, and the candidate face with the smallest distance is used as the second target face. This embodiment determines a new target face based on the candidate faces in the target area, thereby narrowing the area for determining the new target face, which not only improves the efficiency of determining the new target face, but also avoids the loss of multiple face recognition required for multiple detections of different target faces, and is also conducive to improving terminal performance.

[0082] In an exemplary embodiment, in step S220, candidate faces in the target area are obtained, and a second target face is determined from the candidate faces in the target area. Specifically, the method may also include: when there are multiple candidate faces with the smallest distance in the target area, the second target face is determined based on the angle between each candidate face and the coordinate system where the first target face is located, and the candidate face with the smallest angle is used as the second target face.

[0083] The coordinate system where the first target face is located may be a coordinate system with the key points of the first target face as the origin, such as Figure 3 As shown, specifically, the key point can be the location of the center point of the first target face, or the location of the feature point of the first target face (such as the nose tip). The angle is the angle between the line between each candidate face and the first target face and the coordinate axis in the corresponding coordinate system.

[0084] For example, if the first target face in the image to be recognized is face A, the coordinate system established with the center point of the first target face as the origin is as follows: Figure 3 When the deflection information of face A is determined to be upward deflection according to the above steps, the area above face A in the image to be identified can be determined as the target area. Figure 3It can be seen that in the area above face A, there are candidate face B, candidate face D and candidate face E. And the candidate faces with the smallest distance from face A obtained by the above distance calculation method include candidate face B and candidate face D. Therefore, the first angle between the line between candidate face B and face A and the coordinate axis in the corresponding coordinate system is further obtained, and the second angle between the line between candidate face D and face A and the coordinate axis in the corresponding coordinate system is obtained. Among them, the line between candidate face B and face A can be the line between the center point of candidate face B and the center point of face A, and similarly, the line between candidate face D and face A can be the line between the center point of candidate face D and the center point of face A. In addition, since the target area is the area above face A in the image to be identified, and the upper or lower part can be divided based on the horizontal axis of the coordinate system, when determining the angle, the angle between each line and the horizontal axis in the coordinate system can be used as the corresponding angle.

[0085] For example, the first angle BA between the line connecting candidate face B and face A and the horizontal axis is obtained, and the second angle DA between the line connecting candidate face D and face A and the horizontal axis is obtained, and then the size between the first angle BA and the second angle DA is determined, and the candidate face with the smallest angle is used as the second target face. Figure 3 As shown, since the first angle BA is smaller than the second angle DA, it can be determined that the face B in the target area is the second target face.

[0086] Similarly, when the target area is to the left or right of the first target face, the corresponding angle can be determined based on the vertical axis of the coordinate system. The specific determination method is basically the same as that in the above embodiment, and will not be described in detail in this embodiment.

[0087] In the above embodiment, when there are multiple candidate faces with the smallest distance in the target area, the second target face is determined based on the angle between each candidate face and the coordinate system where the first target face is located, and the candidate face with the smallest angle is used as the second target face. This avoids the loss of multiple face recognitions required for multiple detections of different target faces, which is conducive to improving terminal performance.

[0088] In an exemplary embodiment, if Figure 4 As shown, in step S120, obtaining the deflection information of the first target face may specifically include:

[0089] In step S410, when it is detected that the key point position of the first target face changes, the rotation angle of the key point position in the coordinate system where the first target face is located is obtained.

[0090] The coordinate system where the first target face is located is a coordinate system with the initial position of the key point of the first target face in the image to be recognized as the origin. In this embodiment, in order to more accurately obtain the position change information of the first target face, the key point can be defined as the feature point of the first target face, such as the tip of the nose of the first target face.

[0091] Specifically, a coordinate system can be established based on the initial position of the nose tip of the first target face in the image to be identified as the origin, and then the first target face is tracked and detected. When it is detected that the position of the nose tip of the first target face has changed, the rotation angle of the key point position in the coordinate system where the first target face is located is obtained.

[0092] like Figure 5 As shown, a fixed coordinate system Oxyz and a coordinate system Ox'y'z' fixed to the rigid body are made from the origin O. Taking the rotation angle as the Euler angle as an example, the corresponding coordinate system can be established based on the initial position of the nose tip of the first target face in the image to be identified as the origin, in which x, y, and z correspond to the three coordinate axes of the coordinate system. The Euler angle is the angular parameter of the rotation position of the nose tip of the first target face relative to the three coordinate axes when it is displaced, including pitch (i.e., the pitch angle, the rotation angle φ relative to the y-axis), such as the rotation angle of the nose tip displacement relative to the y-axis when the first target face lowers or raises its head, yaw (i.e., the yaw angle, the rotation angle ψ relative to the x-axis), such as the rotation angle of the nose tip displacement relative to the x-axis when the first target face turns left or right, and roll (i.e., the roll angle, the rotation angle θ relative to the z-axis), such as the rotation angle of the nose tip displacement relative to the z-axis when the first target face turns left or right. Since only two-dimensional information is needed in face recognition, that is, it is only necessary to determine whether the first target face is lowering its head, raising its head, or turning left or right. Therefore, in this embodiment, it is only necessary to obtain the rotation angle of the first target face's nose tip relative to the x-axis or the rotation angle relative to the y-axis when the face is displaced, that is, it is only necessary to obtain the corresponding pitch angle or yaw angle.

[0093] In step S420, deflection information of the first target face is determined according to the rotation angle.

[0094] Since the pitch angle is the rotation angle of the nose tip displacement relative to the y-axis when the first target face lowers or raises its head, it can be determined whether the first target face is deflected upward or downward based on the size of the pitch. Specifically, when the pitch is greater than 0, it corresponds to the first target face raising its head, indicating that the first target face is deflected upward; when the pitch is less than 0, it corresponds to the first target face lowering its head, indicating that the first target face is deflected downward.

[0095] Similarly, since the yaw angle is the rotation angle of the nose tip displacement relative to the x-axis when the first target face turns left or right, it can be determined whether the first target face is deflected to the left or right based on the size of yaw. Specifically, when yaw is greater than 0, it corresponds to the left turn state of the first target face, indicating that the first target face is deflected to the left; when yaw is less than 0, it corresponds to the right turn state of the first target face, indicating that the first target face is deflected to the right.

[0096] Therefore, in this embodiment, when it is detected that the key point position of the first target face changes, the rotation angle of the key point position in the coordinate system where the first target face is located can be obtained, and the deflection information of the first target face can be determined according to the rotation angle, and then the second target face can be determined from the candidate faces according to the deflection information and the positional relationship between the faces in the image to be identified. In this way, based on one face recognition, the new target face in the image to be identified is determined based on the intention of the original target face in the image to be identified, which not only avoids the loss of multiple face recognitions required for multiple detections of different target faces, but also improves the terminal performance and enhances the fun of face interaction.

[0097] In an exemplary embodiment, in step S420, the deflection information of the first target face is determined according to the rotation angle, which may specifically include: when the rotation angle of the key point position in the coordinate system where the first target face is located is obtained, further identifying whether the rotation angle is a pitch angle or a yaw angle. Specifically, when the rotation angle is a pitch angle, and the pitch angle is less than zero, it can be determined that the deflection information of the first target face is a downward deflection. When the rotation angle is a pitch angle, and the pitch angle is greater than zero, it can be determined that the deflection information of the first target face is an upward deflection. When the rotation angle is a yaw angle, and the yaw angle is less than zero, it can be determined that the deflection information of the first target face is a rightward deflection. When the rotation angle is a yaw angle, and the yaw angle is less than zero, it can be determined that the deflection information of the first target face is a leftward deflection. This embodiment is based on the rotation angle of the key point position obtained in the coordinate system where the first target face is located, and determines the deflection information of the first target face according to the type and size of the rotation angle. Then, the second target face can be determined from the candidate faces according to the deflection information of the first target face, that is, a new target face is determined, thereby avoiding the loss of multiple face recognitions required for multiple detections of different target faces and improving terminal performance.

[0098] In an exemplary embodiment, in step S210, according to the deflection information of the first target face, the target area in the image to be identified is determined, which may specifically include: when the deflection information of the first target face is determined to be downward deflection, the area in the image to be identified whose first coordinate is less than zero is determined as the target area; when the deflection information of the first target face is determined to be upward deflection, the area in the image to be identified whose first coordinate is greater than zero is determined as the target area; when the deflection information of the first target face is determined to be leftward deflection, the area in the image to be identified whose second coordinate is greater than zero is determined as the target area; when the deflection information of the first target face is determined to be rightward deflection, the area in the image to be identified whose second coordinate is less than zero is determined as the target area. The first coordinate refers to the vertical coordinate, i.e., the ordinate or y coordinate, and the second coordinate is the horizontal coordinate, i.e., the abscissa or x coordinate. Therefore, the area in which the first coordinate is less than zero is the area in the coordinate system where the y coordinate is less than 0, i.e., the negative image area of ​​the Y axis. The area in which the first coordinate is greater than zero is the area in the coordinate system where the y coordinate is greater than 0, i.e., the positive image area of ​​the Y axis. The area where the second coordinate is less than zero is the area where the x coordinate is less than 0 in the coordinate system, that is, the negative image area of ​​the x axis. The area where the second coordinate is greater than zero is the area where the x coordinate is greater than 0 in the coordinate system, that is, the positive image area of ​​the x axis. It can be understood that when the deflection information of the first target face is deflected to the left or to the right, the target area is determined based on the mirror image relationship of the first target face in the image to be identified.

[0099] In the above embodiment, the deflection direction corresponding to the deflection information of the first target face is determined, and then the target area in the image to be identified is determined according to the deflection direction, thereby improving the efficiency of identifying the target area, which in turn is conducive to improving the efficiency of identifying the second target face. Since the deflection information expresses the behavior of the first target face to a certain extent, the fun of face interaction is also enhanced.

[0100] In an exemplary embodiment, in step S110, determining the first target face from the image to be identified may specifically include: obtaining the number of facial features displayed by each face in the image to be identified based on preset facial features, and determining the face with the largest number of facial features displayed as the first target face.

[0101] Among them, the preset facial features may refer to key feature points in the face, for example, facial features such as the tip of the nose, lips, eyes, the center of the forehead, the center of the left face, and the center of the right face. Specifically, based on the preset facial features, the number of facial features displayed by each face in the image to be identified is obtained, and the face with the largest number of facial features is determined as the first target face. For example, if there are two faces in the image to be identified, and the facial features displayed by one of the faces only include the left eye and the center of the left face, then the number of facial features displayed is 2. If the facial features displayed by the other face include the left eye, the right eye, the lips, the center of the left face, and the center of the right face, then the number of facial features displayed is 5. It can be seen that the face with 5 facial features is the face with the largest number of facial features displayed in the image to be identified, and therefore, the face with 5 facial features displayed can be determined as the first target face.

[0102] In the above embodiment, based on preset facial features, the number of facial features displayed by each face in the image to be identified is obtained, and the face displaying the largest number of facial features is determined as the first target face, thereby improving the confidence of the first target face and improving the accuracy of identifying the first target face.

[0103] In an exemplary embodiment, in step S110, determining the first target face from the image to be identified may specifically include: when there are multiple faces that display the largest number of facial features, acquiring multiple frames of images to be identified that are continuously acquired; determining the number of times each face in the multiple frames of images to be identified displays the target facial features; and determining the face with the largest number of displays as the first target face.

[0104] Specifically, the target facial feature may refer to the same facial feature, or may be a key facial feature, such as the tip of the nose, lips, eyes, etc. For example, by counting the number of times that each face that displays the largest number of facial features in the continuously acquired multiple frames of images to be identified displays the same facial feature or displays the key facial feature, the number of times each face displays the target facial feature is obtained, and the face with the largest number of displays is determined as the first target face. In this embodiment, when there are multiple faces that display the largest number of facial features, by acquiring the continuously acquired multiple frames of images to be identified, and determining the number of times each face in the multiple frames of images to be identified displays the target facial feature, the face with the largest number of displays is determined as the first target face. This improves the confidence level of the first target face and the accuracy of identifying the first target face.

[0105] In some scenarios, such as multi-person AR shooting scenarios, AR effects are usually added to the target face in the terminal capture screen. When the position of the target face changes or the target face disappears from the screen, face recognition will be performed again to re-determine the new target face with the AR effect added, which causes the terminal to lose a lot in frequent face recognition, and thus affects the performance. Or in a multi-person live broadcast scenario, special effects can be displayed for the target face in the live broadcast screen, but the special effects cannot be delivered according to the user's wishes. For example, if the target face wants to pass the special effects to other users of the live broadcast, it is necessary to change its position in the live broadcast screen, such as reducing the facial features displayed in the live broadcast screen, so that the terminal can re-perform face recognition to determine the new target face, and display special effects for the new target face, or achieve it by operating the terminal. The former also has the problem of frequent face recognition by the terminal, and the new target face is not necessarily the user that the original target face wants to pass on. The latter is extremely unfriendly to live broadcast users in the live broadcast scenario, resulting in a poor user interaction experience.

[0106] Based on this, this embodiment also provides a face interaction method, such as Figure 6 As shown, the following steps may be included:

[0107] In step S610, in response to the interaction instruction, an interaction interface is displayed, and the image to be identified is displayed in the interaction interface.

[0108] The interaction instruction may be an interaction instruction or an interaction command between the user and the terminal. For example, in an AR shooting scenario, the interaction instruction may be a specific operation process of the user operating the terminal to start AR shooting.

[0109] The interactive interface is a human-machine interface displayed on the terminal based on the interactive instructions. For example, taking the AR shooting scene as an example, the corresponding interactive interface can be the display screen when the terminal performs AR shooting. The image to be identified is the image to be subjected to face recognition to determine the target face. In this embodiment, in the AR shooting scene, the image to be identified is the captured screen when the terminal performs AR shooting.

[0110] Specifically, the terminal responds to the interaction instruction initiated by the user and displays an interaction interface to display the image to be recognized in the interaction interface.

[0111] In step S620, a first target face is determined from the image to be recognized, and a preset effect is displayed to the first target face.

[0112] The first target face may be a face showing the most and most complete facial feature information in the image to be identified, or may be a face located at the center of the image to be identified, or may be a face with a specific meaning determined in other ways. The preset effect may be a special effect, or may be a display element with a specific meaning, such as a pendant.

[0113] In this embodiment, when the image to be recognized includes multiple faces, the terminal can determine a first target face from the image to be recognized and display a preset effect for the first target face.

[0114] In step S630, a second target face is determined in the image to be recognized, and the preset effect on the first target face is transferred to the second target face.

[0115] The second target face refers to a new target face showing the preset effect, that is, a new target face to which the original target face in the image to be recognized wants to deliver the preset effect. Figures 1 to 5 The embodiment shown is defined.

[0116] like Figure 7 As shown, if the original target face showing the preset effect in the image to be recognized is face A, and the new target face determined by the terminal based on the above method is face B, the preset effect on face A is transferred to face B for display.

[0117] Since the second target face is determined based on the deflection information of the first target face, and the deflection information reflects the user behavior of the first target face to a certain extent, this embodiment realizes the display of transferring the preset effect based on the user behavior of the original target face, which not only improves the fun of user interaction, but also eliminates the need for multiple face recognition in the process. Compared with the traditional technology that requires multiple face recognitions to detect different target faces multiple times, the solution disclosed in the present invention can also reduce terminal losses and improve terminal performance.

[0118] It should be understood that although Figure 1-Figure 7 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 7 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0119] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.

[0120] Figure 8 FIG. 1 is a block diagram of a face recognition device according to an exemplary embodiment. Figure 8 The device includes a to-be-recognized image acquisition module 802, a deflection information acquisition module 804, and a second target face determination module 806. Wherein:

[0121] The to-be-recognized image acquisition module 802 is configured to acquire an to-be-recognized image including a plurality of human faces, and determine a first target human face and candidate human faces from the to-be-recognized image, wherein the candidate human faces are other human faces in the to-be-recognized image except the first target human face;

[0122] The deflection information acquisition module 804 is configured to acquire the deflection information of the first target face;

[0123] The second target face determination module 806 is configured to determine the second target face from the candidate faces according to the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

[0124] In an exemplary embodiment, the second target face determination module includes: a target area determination unit, configured to determine the target area in the image to be identified based on the deflection information of the first target face; a second target face determination unit, configured to obtain candidate human faces in the target area and determine the second target face from the candidate human faces in the target area.

[0125] In an exemplary embodiment, the second target face determination unit is configured to execute: obtaining the distance between each candidate face in the target area and the first target face; and taking the candidate face with the smallest distance as the second target face.

[0126] In an exemplary embodiment, the second target face determination unit is further configured to perform: when there are multiple candidate face images with the smallest distance, determining the second target face based on the angle between each candidate face image in the coordinate system where the first target face image is located; wherein the coordinate system where the first target face image is located is a coordinate system with the key points of the first target face as the origin, the angle is the angle between the line between each candidate face image and the first target face and the coordinate axis in the coordinate system, and the second target face is the candidate face image with the smallest angle.

[0127] In an exemplary embodiment, the deflection information acquisition module includes: a rotation angle acquisition unit, configured to execute, when a change in the position of the key point of the first target face is detected, to obtain the rotation angle of the key point position in the coordinate system where the first target face is located, the coordinate system where the first target face is located is a coordinate system with the initial position of the key point of the first target face as the origin; a deflection information determination unit, configured to execute determination of the deflection information of the first target face based on the rotation angle.

[0128] In an exemplary embodiment, the deflection information determination unit is configured to perform: when the rotation angle is a pitch angle, and the pitch angle is less than zero, determining that the deflection information of the first target face is a downward deflection; when the rotation angle is a pitch angle, and the pitch angle is greater than zero, determining that the deflection information of the first target face is an upward deflection; when the rotation angle is a yaw angle, and the yaw angle is less than zero, determining that the deflection information of the first target face is a right deflection; when the rotation angle is a yaw angle, and the yaw angle is greater than zero, determining that the deflection information of the first target face is a left deflection.

[0129] In an exemplary embodiment, the target area determination unit is configured to perform: when the deflection information of the first target face is determined to be a downward deflection, determining the area in the image to be identified whose first coordinate is less than zero as the target area; when the deflection information of the first target face is determined to be an upward deflection, determining the area in the image to be identified whose first coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a left deflection, determining the area in the image to be identified whose second coordinate is greater than zero as the target area; when the deflection information of the first target face is determined to be a right deflection, determining the area in the image to be identified whose second coordinate is less than zero as the target area.

[0130] In an exemplary embodiment, the image to be identified acquisition module is further configured to execute: based on preset facial features, obtaining the number of facial features displayed by each face in the image to be identified; and determining the face displaying the largest number of facial features as the first target face.

[0131] In an exemplary embodiment, the module for acquiring images to be identified is further configured to execute: when there are multiple faces that display the largest number of facial features, acquiring multiple frames of images to be identified that are continuously acquired; determining the number of times each face in the multiple frames of images to be identified displays the target facial features; and determining the face with the largest number of displays as the first target face.

[0132] Fig. 9 is a block diagram of a face interaction device according to an exemplary embodiment. Fig. 9, the device includes an instruction response module 902 and a display module 904. Among them:

[0133] The instruction response module 902 is configured to execute in response to the interaction instruction, display an interaction interface, and display the image to be recognized in the interaction interface;

[0134] The display module 904 is configured to determine a first target face from the image to be identified and display a preset effect on the first target face; determine a second target face in the image to be identified and transfer the preset effect on the first target face to the second target face, wherein the second target face is identified by the face recognition method as described above.

[0135] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0136] Fig.10 1 is a block diagram of an electronic device Z00 for face recognition or face interaction according to an exemplary embodiment. For example, the electronic device Z00 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0137] Reference Fig.10 The electronic device Z00 may include one or more of the following components: a processing component Z02, a memory Z04, a power component Z06, a multimedia component Z08, an audio component Z10, an input / output (I / O) interface Z12, a sensor component Z14, and a communication component Z16.

[0138] The processing component Z02 generally controls the overall operation of the electronic device Z00, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component Z02 may include one or more processors Z20 to execute instructions to complete all or part of the steps of the above-described method. In addition, the processing component Z02 may include one or more modules to facilitate interaction between the processing component Z02 and other components. For example, the processing component Z02 may include a multimedia module to facilitate interaction between the multimedia component Z08 and the processing component Z02.

[0139] The memory Z04 is configured to store various types of data to support operations on the electronic device Z00. Examples of such data include instructions for any application or method operating on the electronic device Z00, contact data, phone book data, messages, pictures, videos, etc. The memory Z04 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.

[0140] The power supply assembly Z06 provides power to various components of the electronic device Z00. The power supply assembly Z06 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device Z00.

[0141] The multimedia component Z08 includes a screen that provides an output interface between the electronic device Z00 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component Z08 includes a front camera and / or a rear camera. When the electronic device Z00 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0142] The audio component Z10 is configured to output and / or input audio signals. For example, the audio component Z10 includes a microphone (MIC), and when the electronic device Z00 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory Z04 or sent via the communication component Z16. In some embodiments, the audio component Z10 also includes a speaker for outputting an audio signal.

[0143] I / O interface Z12 provides an interface between processing component Z02 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0144] The sensor assembly Z14 includes one or more sensors for providing various aspects of status assessment for the electronic device Z00. For example, the sensor assembly Z14 can detect the open / closed state of the electronic device Z00, the relative positioning of the components, such as the display and keypad of the electronic device Z00, and the sensor assembly Z14 can also detect the position change of the electronic device Z00 or the components of the electronic device Z00, the presence or absence of contact between the user and the electronic device Z00, the orientation or acceleration / deceleration of the device Z00 and the temperature change of the electronic device Z00. The sensor assembly Z14 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly Z14 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly Z14 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0145] The communication component Z16 is configured to facilitate wired or wireless communication between the electronic device Z00 and other devices. The electronic device Z00 can access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component Z16 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component Z16 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0146] In an exemplary embodiment, the electronic device Z00 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0147] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory Z04 including instructions, and the above instructions can be executed by a processor Z20 of the electronic device Z00 to complete the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0148] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor Z20 of the electronic device Z00 to implement the above method.

[0149] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.

[0150] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0151] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A face recognition method, characterized in that: The method comprises: Acquire an image to be recognized including multiple faces, and determine a first target face and candidate faces from the image to be recognized, wherein the candidate faces are faces other than the first target face in the image to be recognized; Obtaining deflection information of the first target face; A second target face is determined from the candidate faces according to the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

2. The method according to claim 1, characterized in that The step of determining a second target face from the candidate faces according to the deflection information of the first target face and the positional relationship between the first target face and the candidate faces comprises: Determining a target area in the image to be recognized according to the deflection information of the first target face; A candidate human face in the target area is obtained, and a second target human face is determined from the candidate human faces in the target area.

3. The method according to claim 2, characterized in that The step of acquiring the candidate human faces in the target area and determining the second target human face from the candidate human faces in the target area comprises: Obtaining the distance between each candidate human face in the target area and the first target human face; The candidate face with the smallest distance is taken as the second target face.

4. The method according to claim 3, characterized in that The step of acquiring the candidate human faces in the target area and determining the second target human face from the candidate human faces in the target area further comprises: When there are multiple candidate human faces with the smallest distance, determining the second target human face based on the angle between each candidate human face and the coordinate system where the first target human face is located; Among them, the coordinate system where the first target face is located is a coordinate system with the key point of the first target face as the origin, the angle is the angle between the line between each candidate face and the first target face and the coordinate axis in the coordinate system, and the second target face is the candidate face with the smallest angle.

5. The method according to claim 2, characterized in that: The obtaining of the deflection information of the first target face includes: When it is detected that the position of the key point of the first target face changes, obtaining a rotation angle of the key point position in the coordinate system where the first target face is located, the coordinate system where the first target face is located having the initial position of the key point of the first target face as the origin; Determine the deflection information of the first target face according to the rotation angle.

6. The method according to claim 5, characterized in that Determining the deflection information of the first target face according to the rotation angle includes: When the rotation angle is a pitch angle, and the pitch angle is less than zero, determining that the deflection information of the first target face is a downward deflection; When the rotation angle is a pitch angle, and the pitch angle is greater than zero, determining that the deflection information of the first target face is an upward deflection; When the rotation angle is a yaw angle, and the yaw angle is less than zero, determining that the deflection information of the first target face is a rightward deflection; When the rotation angle is a yaw angle, and the yaw angle is greater than zero, it is determined that the deflection information of the first target face is a left deflection.

7. The method according to claim 6, characterized in that The step of determining the target area in the image to be recognized according to the deflection information of the first target face includes: When it is determined that the deflection information of the first target face is downward deflection, determining a region in the image to be identified where the first coordinate is less than zero as a target region; When it is determined that the deflection information of the first target face is an upward deflection, determining a region in the image to be identified where the first coordinate is greater than zero as a target region; When it is determined that the deflection information of the first target face is deflected to the left, determining a region in the image to be identified where the second coordinate is greater than zero as a target region; When it is determined that the deflection information of the first target face is deflected to the right, a region in the image to be identified whose second coordinate is less than zero is determined as a target region.

8. The method according to any one of claims 1 to 7, characterized in that: The step of determining a first target face from the image to be recognized includes: According to the preset facial features, obtaining the number of facial features displayed by each face in the image to be identified; The human face displaying the largest number of the facial features is determined as the first target human face.

9. The method according to claim 8, characterized in that The method further comprises: When there are multiple faces showing the largest number of facial features, acquiring multiple frames of images to be recognized that are continuously acquired; Determine the number of times each face in multiple frames of images to be identified is displayed with respect to target facial features; The face that is displayed most times is determined as the first target face.

10. A face interaction method, characterized in that: The method comprises: In response to the interactive instruction, an interactive interface is displayed, and the image to be recognized is displayed in the interactive interface; Determine a first target face from the image to be recognized, and display a preset effect on the first target face; A second target face is determined in the image to be recognized, and a preset effect on the first target face is transferred to the second target face, wherein the second target face is recognized by the face recognition method according to any one of claims 1 to 9.

11. A face recognition device, characterized in that: include: The module for acquiring an image to be recognized is configured to acquire an image to be recognized including a plurality of faces, and determine a first target face and candidate faces from the image to be recognized, wherein the candidate faces are faces other than the first target face in the image to be recognized; a deflection information acquisition module, configured to acquire the deflection information of the first target face; The second target face determination module is configured to determine a second target face from the candidate faces based on the deflection information of the first target face and the positional relationship between the first target face and the candidate faces.

12. The device according to claim 11, characterized in that The second target face determination module comprises: a target region determining unit, configured to determine a target region in the image to be recognized according to the deflection information of the first target face; The second target face determining unit is configured to obtain candidate faces in the target area and determine a second target face from the candidate faces in the target area.

13. The device according to claim 12, characterized in that The second target face determination unit is configured to execute: Obtaining the distance between each candidate human face in the target area and the first target human face; The candidate face with the smallest distance is taken as the second target face.

14. The device according to claim 13, characterized in that The second target face determination unit is further configured to execute: When there are multiple candidate human faces with the smallest distance, determining the second target human face based on the angle between each candidate human face and the coordinate system where the first target human face is located; Among them, the coordinate system where the first target face is located is a coordinate system with the key point of the first target face as the origin, the angle is the angle between the line between each candidate face and the first target face and the coordinate axis in the coordinate system, and the second target face is the candidate face with the smallest angle.

15. The device according to claim 12, characterized in that The deflection information acquisition module comprises: a rotation angle acquisition unit configured to acquire a rotation angle of the key point position in a coordinate system where the first target face is located when a change in the key point position of the first target face is detected, wherein the coordinate system where the first target face is located has an initial position of the key point of the first target face as an origin; The deflection information determining unit is configured to determine the deflection information of the first target face according to the rotation angle.

16. The device according to claim 15, characterized in that The deflection information determination unit is configured to perform: When the rotation angle is a pitch angle, and the pitch angle is less than zero, determining that the deflection information of the first target face is a downward deflection; When the rotation angle is a pitch angle, and the pitch angle is greater than zero, determining that the deflection information of the first target face is an upward deflection; When the rotation angle is a yaw angle, and the yaw angle is less than zero, determining that the deflection information of the first target face is a rightward deflection; When the rotation angle is a yaw angle, and the yaw angle is greater than zero, it is determined that the deflection information of the first target face is a left deflection.

17. The device according to claim 16, characterized in that The target area determination unit is configured to execute: When it is determined that the deflection information of the first target face is downward deflection, determining a region in the image to be identified where the first coordinate is less than zero as a target region; When it is determined that the deflection information of the first target face is an upward deflection, determining a region in the image to be identified where the first coordinate is greater than zero as a target region; When it is determined that the deflection information of the first target face is deflected to the left, determining a region in the image to be identified where the second coordinate is greater than zero as a target region; When it is determined that the deflection information of the first target face is deflected to the right, a region in the image to be identified whose second coordinate is less than zero is determined as a target region.

18. The device according to any one of claims 11 to 17, characterized in that The to-be-recognized image acquisition module is further configured to execute: According to the preset facial features, obtaining the number of facial features displayed by each face in the image to be identified; The human face displaying the largest number of the facial features is determined as the first target human face.

19. The device according to claim 18, characterized in that The to-be-recognized image acquisition module is further configured to execute: When there are multiple faces showing the largest number of facial features, acquiring multiple frames of images to be recognized that are continuously acquired; Determine the number of times each face in multiple frames of images to be identified is displayed with respect to target facial features; The face that is displayed most times is determined as the first target face.

20. A face interaction device, characterized in that: The device comprises: An instruction response module is configured to execute in response to the interactive instruction, display an interactive interface, and display the image to be recognized in the interactive interface; A display module is configured to determine a first target face from the image to be recognized and display a preset effect on the first target face; determine a second target face in the image to be recognized and transfer the preset effect on the first target face to the second target face, wherein the second target face is recognized by the face recognition method described in any one of claims 1 to 9.

21. 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 face recognition method as described in any one of claims 1 to 9 and the face interaction method as described in claim 10.

22. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the face recognition method as described in any one of claims 1 to 9 and the face interaction method as described in claim 10.

23. A computer program product, comprising instructions, characterized in that: When the instruction is executed by a processor of an electronic device, the electronic device is enabled to execute the face recognition method as described in any one of claims 1 to 9 and the face interaction method as described in claim 10.