Face recognition method, device and electronic equipment

By generating facial contour images through facial key point detection, and combining the facial image and the contour image to determine whether they are the same face, the problem of low recognition accuracy in existing technologies is solved, and accurate recognition of differences in shape details is achieved.

CN115937924BActive Publication Date: 2026-01-02DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211246767.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2026-01-02
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

Existing face recognition methods only consider the overall differences between two face images, resulting in low recognition accuracy, especially for face images that are generally similar but have differences in facial features and other shape details.

Method used

By acquiring face images and performing facial landmark detection, a face contour image is generated. The face image and the contour image are combined to determine whether they are the same face, taking into account the overall differences between the face images and the shape details of facial features.

Benefits of technology

It improves the ability to recognize facial images that are similar overall but differ in the shape details of facial features, thereby enhancing the accuracy of facial recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937924B_ABST
    Figure CN115937924B_ABST
Patent Text Reader

Abstract

The present application provides a face recognition method, device and electronic equipment, comprising: acquiring a first face image and a second face image; performing face key point detection on the first face image and the second face image respectively, and obtaining at least one first face key point coordinate and at least one second face key point coordinate respectively; generating a first face contour image according to the at least one first face key point coordinate, and generating a second face contour image according to the at least one second face key point coordinate; and judging whether the face in the first face image and the face in the second face image are the same face according to the first face image, the second face image, the first face contour image and the second face contour image. The recognition ability of face images that are similar in general but different in shape details such as facial features is improved, and the precision of face recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the field of artificial intelligence (AI) technology, and in particular, to a face recognition method and device and electronic equipment. BACKGROUND

[0002] At present, deep learning is often used for face recognition: first, a deep neural network is used to extract face features from two face images respectively, then the feature distance between the two face features is calculated, and finally, whether the faces in the two face images belong to the same person is determined according to whether the feature distance is greater than a preset threshold. In the above face recognition method based on deep learning, the deep neural network is generally optimized by a stochastic gradient descent method, which has strong global perception ability and can better distinguish the overall difference between two face images.

[0003] However, since the above face recognition method only considers the overall difference between two face images, the face recognition accuracy is not high. SUMMARY

[0004] The present application provides a face recognition method, device and electronic equipment, which can improve the recognition ability of face images that are similar in overall shape but different in facial feature details, and improve the accuracy of face recognition.

[0005] In a first aspect, the present application provides a face recognition method, which comprises: obtaining a first face image and a second face image; performing face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate respectively; generating a first face contour image according to the at least one first face key point coordinate, and generating a second face contour image according to the at least one second face key point coordinate; and determining whether the face in the first face image and the face in the second face image are the same person according to the first face image, the second face image, the first face contour image and the second face contour image.

[0006] In a second aspect, the present application provides a face recognition device, comprising: a first obtaining module, a detecting module, a generating module, and a judging module, wherein the first obtaining module is configured to obtain a first face image and a second face image; the detecting module is configured to perform face key point detection on the first face image and the second face image respectively, and obtain at least one first face key point coordinate and at least one second face key point coordinate respectively; the generating module is configured to generate a first face contour image according to the at least one first face key point coordinate, and generate a second face contour image according to the at least one second face key point coordinate; and the judging module is configured to judge whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image, and the second face contour image.

[0007] In a third aspect, an electronic device is provided, comprising: a processor and a memory, the memory being configured to store a computer program, and the processor being configured to invoke and run the computer program stored in the memory to execute the method in the first aspect or the implementation manners thereof.

[0008] In a fourth aspect, a computer readable storage medium is provided, configured to store a computer program, and the computer program causes a computer to execute the method in the first aspect or the implementation manners thereof.

[0009] In a fifth aspect, a computer program product is provided, comprising computer program instructions, and the computer program instructions cause a computer to execute the method in the first aspect or the implementation manners thereof.

[0010] In a sixth aspect, a computer program is provided, and the computer program causes a computer to execute the method in the first aspect or the implementation manners thereof.

[0011] By the technical scheme of the present application, the electronic device can first acquire the first face image and the second face image, then perform face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate, then the electronic device can generate a first face contour image according to the at least one first face key point coordinate and generate a second face contour image according to the at least one second face key point coordinate, and finally the electronic device can determine whether the face in the first face image and the face in the second face image are the same face according to the first face image, the second face image, the first face contour image and the second face contour image. It can be understood that the face key point coordinates can accurately reflect the positions of the facial features and the facial contour in the face image, and the face contour image generated from the face key point coordinates can reflect the shape details of the face image, such as the thickness of the lips, the width of the eyebrows and other facial feature shape details. Therefore, compared with the face recognition method in the prior art which only considers the difference between two face images in the whole, the technical scheme provided in the present application not only considers the difference between two face images in the whole, but also considers the shape details such as facial features, so the technical scheme of the present application can improve the recognition ability of face images that are similar in the whole but different in shape details such as facial features, and improve the accuracy of face recognition. BRIEF DESCRIPTION OF DRAWINGS

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

[0013] Figure 1 A system architecture diagram is provided for the embodiments of the present application.

[0014] Figure 2 A flowchart of a face recognition method is provided for the embodiments of the present application.

[0015] Figure 3 A schematic diagram of a face recognition method is provided for the embodiments of the present application.

[0016] Figure 4 A flowchart of another face recognition method is provided for the embodiments of the present application.

[0017] Figure 5 A flowchart of another face recognition method is provided for the embodiments of the present application.

[0018] Figure 6 A flowchart of another face recognition method is provided for the embodiments of the present application.

[0019] Figure 7 FIG. 4 is a schematic diagram of another face recognition method provided by an embodiment of the present application;

[0020] Figure 8 FIG. 5 is a flowchart of yet another face recognition method provided by an embodiment of the present application;

[0021] Figure 9 FIG. 6 is a schematic diagram of still another face recognition method provided by an embodiment of the present application;

[0022] Figure 10 FIG. 7 is a schematic diagram of a face recognition device 1000 provided by an embodiment of the present application;

[0023] Figure 11 FIG. 8 is a schematic block diagram of an electronic device 1100 provided by an embodiment of the present application. DETAILED DESCRIPTION

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

[0025] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server including a series of steps or units does not necessarily have to include only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.

[0026] As described above, the face recognition method in the prior art only considers the difference between two face images as a whole, resulting in low face recognition accuracy.

[0027] To address the aforementioned technical problems, the technical solution provided in this application can determine whether the faces in two face images are the same by combining a face image and a face contour image generated from the coordinates of facial key points. This solution considers not only the overall differences between the two face images but also their shape details. The coordinates of facial key points can accurately reflect the position of facial features and contours in a face image, while the face contour image generated from the coordinates of facial key points can reflect the shape details of facial features and contours. Therefore, the technical solution of this application can improve the recognition ability of face images that are similar overall but differ in the shape details of facial features, thereby improving the accuracy of face recognition.

[0028] It should be understood that the technical solution of this application can be applied to the following scenarios, but is not limited to:

[0029] The technical solution of this application can be applied to various facial recognition scenarios. For example, it can be applied to commodity transaction scenarios that require confirmation of commodity transaction information based on the user's own facial image, as well as to access scenarios such as subways and airports, and to attendance scenarios such as clocking in and out of get off work.

[0030] The following will describe a system architecture involved in an embodiment of this application:

[0031] Figure 1 This is a schematic diagram of a system architecture provided for an embodiment of this application. Figure 1 As shown, the system architecture may include: user equipment 101, data acquisition equipment 102, training equipment 103, execution equipment 104, database 105, and content library 106.

[0032] The data acquisition device 102 is used to read training samples from the content library 106 and store the read training samples in the database 105. The training samples include: multiple pairs of face images belonging to the same face image, multiple pairs of face images belonging to different face images, multiple pairs of face contour images belonging to the same face image, multiple pairs of face contour images belonging to different face images, multiple pairs of merged face images belonging to the same face image, and multiple pairs of merged face images belonging to different face images. The merged face image is obtained by merging the face image and the face contour image.

[0033] The training device 103 trains the first feature extractor, the second feature extractor, the third feature extractor, and the fully connected layer based on the training samples maintained in the database 105. Specifically, the training device 103 can train the first feature extractor based on multiple pairs of merged face images belonging to the same face image and multiple pairs of merged face images belonging to different face images. This results in the first feature extractor outputting a smaller feature distance between the facial feature vectors of merged face images belonging to the same face image and a larger feature distance between the facial feature vectors of merged face images belonging to different face images. Similarly, the training device 103 can train the second feature extractor, the third feature extractor, and the fully connected layer based on multiple pairs of face images belonging to the same face image and multiple pairs of face images belonging to different face images, as well as multiple pairs of face contour images belonging to the same face image and multiple pairs of face contour images belonging to different face images. This results in the fully connected layer outputting a smaller feature distance between the facial feature vectors of merged face images belonging to the same face image and a larger feature distance between the facial feature vectors of merged face images belonging to different face images. The first feature extractor, second feature extractor, third feature extractor, and fully connected layer obtained from training device 103 can be applied to different systems or devices.

[0034] In addition, such as Figure 1 As shown, the execution device 104 is configured with an I / O interface 107 for data interaction with external devices. For example, it receives a first face image and a second face image sent by the user device 101 through the I / O interface. The calculation module 109 in the execution device 104 can use a trained first feature extractor to process the input first face image and the second face image, outputting a first face feature vector corresponding to the first face image and a second face feature vector corresponding to the second face image, and sends the output first face feature vector and second face feature vector to the user device 101 through the I / O interface. The user device 101 can determine whether the face in the first face image and the face in the second face image are the same face based on the first face feature vector and the second face feature vector. Alternatively, the computation module 109 in execution device 104 can use a trained second feature extractor, a third feature extractor, and a fully connected layer to process the input first and second face images, outputting a seventh face feature vector corresponding to the first face image and an eighth face feature vector corresponding to the second face image. The output seventh and eighth face feature vectors are then sent to user device 101 via an I / O interface. User device 101 can then determine whether the face in the first face image and the face in the second face image are the same face based on the seventh and eighth face feature vectors.

[0035] The user equipment 101 can include a mobile phone, a tablet computer, a notebook computer, a palm computer, a mobile internet device (MID), or other terminal equipment with a browser function.

[0036] The execution device 104 can be a server. Optionally, the server can be a rack server, a blade server, a tower server, or a cabinet server, etc. The server can be a standalone test server, or a test server cluster composed of multiple test servers.

[0037] The execution device 104 can be connected with the user equipment 101 through a network. The network can be an intranet, the Internet, a global system for mobile communication (GSM), wideband code division multiple access (WCDMA), a 4G network, a 5G network, Bluetooth, Wi-Fi, a telecommunication network, or other wireless or wired networks.

[0038] It should be noted that, Figure 1 The positional relationship between the devices, apparatuses, modules, etc. shown in the above embodiments does not constitute any limitation. Optionally, the data acquisition device 102, the user equipment 101, the training device 103, and the execution device 104 can be the same device, the database 105 can be distributed on one server or multiple servers, and the content library 106 can be distributed on one server or multiple servers, which are not limited in the present application.

[0039] The technical solutions of the present application will be described in detail as follows:

[0040] Figure 2 A flowchart of a face recognition method provided by an embodiment of the present application, which can be executed by an electronic device, for example, the execution device in the above embodiments. In addition, the electronic device can also be a processor, etc., which are not limited in the present application. As shown in the above embodiments, the method can include the following steps. Figure 1 Figure 2

[0041] S201: Obtain a first face image and a second face image.

[0042] S202: Perform face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate respectively.

[0043] ​​S203: generate a first face contour image according to the at least one first face key point coordinate, and generate a second face contour image according to the at least one second face key point coordinate;

[0044] S204: determine whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image and the second face contour image.

[0045] In some embodiments, in a commodity transaction scenario in which commodity transaction information needs to be confirmed through face recognition, the first face image can be a face image of a user 1 stored by an electronic device. When the user 1 performs a commodity transaction through the electronic device, the electronic device can acquire a real-time face image of the user 1 as a second face image. Thus, the electronic device can perform face recognition based on the technical solution of the present application to determine whether the face in the first face image and the face in the second face image are faces of the same person, thereby confirming the commodity transaction information.

[0046] For example, the first face image and the second face image can be grayscale images or color images, and the present application does not limit this.

[0047] In some embodiments, the electronic device can perform face key point detection on the first face image and the second face image based on a key point detector to obtain at least one first face key point coordinate and at least one second face key point coordinate, respectively. For example, the key point detector can be a face key point detection network, which can include a convolutional neural network (CNN), and the present application does not limit this.

[0048] For example, Figure 3 A schematic diagram of a face recognition method provided by an embodiment of the present application is shown in FIG. 1. As shown in FIG. 1, the face recognition method includes the following steps. Figure 3As shown, the present application takes the first face image as an example to introduce the method for the electronic device to obtain the first face key point coordinates, and the method for the electronic device to obtain the second face key point coordinates from the second face image is similar to this, which will not be repeated here. The electronic device can input the first face image into the key point detector, and the key point detector can identify 98 key points in the first face image. The key points can accurately mark the facial features, facial contours, etc. in the face image, such as eyebrows, eyes, nose, mouth, face shape, etc. Then the key point detector can output 98 first face key point coordinates: [11.24, 38.32], [11.09, 47.62], [11.52, 66.05], [13.41, 84.43], …, [15.36, 93.30] according to the 98 key points. The 98 first face key point coordinates can represent the coordinates of the above-mentioned 98 key points in the first face image. Therefore, the face key point coordinates can accurately reflect the positions of the facial features, facial contours, etc. in the face image.

[0049] It should be noted that the present application does not limit the number of key points identified by the key point detector. For example, the electronic device can identify 68 key points based on the key point detector to generate first face key point coordinates based on the 68 key points.

[0050] Figure 4 Another flowchart of the face recognition method provided by the embodiment of the present application is based on Figure 2 As shown in the above S203, it further includes: Figure 4

[0051] S401: Obtain a first background image and a second background image.

[0052] As shown in the above S203, it can include: Figure 4

[0053] S402: Draw a first graph at each first face key point coordinate of the first background image to obtain a first face contour image, and draw a second graph at each second face key point coordinate of the second background image to obtain a second face contour image.

[0054] Illustratively, the first background image can be a black single-channel grayscale image or a white single-channel grayscale image, which is not limited herein. The first graph can be a circle or a triangle, which is not limited herein.

[0055] Illustratively, as shown in the above S203, it can include: Figure 3 ​​As shown, after the electronic device obtains the first face key point coordinates, the electronic device can obtain a first background image, which is a black single-channel grayscale image, i.e., a black background image. Then, the electronic device can draw a first figure at each first face key point coordinate of the black background image, the first figure being a circle, to obtain a first face contour image.

[0056] In some implementable manners, after the electronic device identifies at least one key point in the first face image based on the key point detector, the electronic device can mark the at least one key point in the first face image. Then, the electronic device can remove the face image in the first face image, and retain the at least one marked key point in the first face image, to obtain the first face contour image.

[0057] It can be understood that the key points can accurately mark the facial features and the facial contour in the face image, such as the eyebrows, the eyes, the nose, the mouth, and the face shape. Therefore, the face key point coordinates can accurately reflect the positions of the facial features and the facial contour in the face image. Then, the face contour image generated based on the face key point coordinates can reflect the shape details of the face image, such as the thickness of the lips, the width of the eyebrows, and other facial shape details. Of course, the method of generating the face contour image based on the face key point coordinates is only exemplary. The electronic device can also generate the face contour image based on other methods. For example, the electronic device can extract an edge image of the first face image based on an edge detection method. The edge image can reflect the shape information of the face contour and the facial features in the first face image, which can better represent the shape details of the face image. Then, the electronic device can use the edge image as the first face contour image to reflect the shape details of the face image. The edge detection method can be a Sobel edge detection algorithm or a Canny edge detection algorithm, which is not limited in the present application.

[0058] It should be noted that the method of generating the second face contour image is similar to the method of generating the first face contour image. The second background image is similar to the first background image, and the second figure is similar to the first figure, which is not described herein again.

[0059] In some implementations, the at least one first facial key point coordinate is a facial key point coordinate corresponding to a partial face image in the first face image, and the at least one second facial key point coordinate is a facial key point coordinate corresponding to a partial face image in the second face image. That is, the first face contour image can be a contour image of a partial face image in the first face image, and the second face contour image can be a contour image of a partial face image in the second face image. For example, the at least one first facial key point coordinate can be a facial key point coordinate corresponding to a face contour in the first face image, and the first face contour image can be a contour image corresponding to the face contour in the first face image; the at least one first facial key point coordinate can be a facial key point coordinate corresponding to a facial feature such as an eyebrow, an eye, a nose, a mouth, etc. in the first face image, and the first face contour image can be a contour image corresponding to the facial feature such as the eyebrow, the eye, the nose, the mouth, etc. in the first face image. The second face contour image is similar to the first face contour image, and details are not repeated here.

[0060] It can be understood that, due to the influence of a shooting angle, etc., the shape of the face contour or the partial facial feature in the first face image or the second face image can be less accurate. Therefore, when the shape of the face contour in the first face image or the second face image is less accurate, only the first face contour image and the second face contour image including the facial feature shape information are used, or when the shape of the partial facial feature in the first face image or the second face image is less accurate, the first face contour image and the second face contour image including the shape of the face contour and the shape of the other partial facial feature are used, which can more accurately perform face recognition and further improve the accuracy of face recognition.

[0061] Figure 5 Another flowchart of a face recognition method provided by an embodiment of the present application is based on Figure 2 As shown in Figure 5 S204 can include the following steps:

[0062] S501: merge the first face image and the first face contour image to obtain a first merged image;

[0063] S502: merge the second face image and the second face contour image to obtain a second merged image;

[0064] S503: determine whether the face in the first face image and the face in the second face image are faces of the same person based on the first merged image and the second merged image.

[0065] Exemplarily, when the electronic device merges the first face image and the first face contour image, the merging manner adopted by the electronic device can be a merging manner of combining channel dimensions. For example, assuming that the first face image is a three-channel color image and the first face contour image is a single-channel image, when the electronic device merges the first face image and the first face contour image, the electronic device can merge the three channels corresponding to the first face image and the one channel corresponding to the first face contour image to obtain a first merged image including four-channel data, where the four-channel data includes data of the three channels corresponding to the first face image and data of the one channel corresponding to the first face contour image.

[0066] Exemplarily, when the electronic device merges the first face image and the first face contour image, the merging manner adopted by the electronic device can be a merging manner of image splicing. For example, the electronic device can splice the first face image and the first face contour image left and right to obtain the first merged image.

[0067] It should be noted that the present application does not limit the manner in which the electronic device obtains the first merged image, and the manner in which the electronic device obtains the second merged image is similar to the manner in which the electronic device obtains the first merged image, which will not be described herein.

[0068] Figure 6 A flowchart of another face recognition method provided by an embodiment of the present application is based on Figure 5 As shown in Figure 6 S503 can include the following steps:

[0069] S601: determining whether the face in the first face image and the face in the second face image are the same person according to the similarity between the first merged image and the second merged image.

[0070] In some implementable manners, S601 can be implemented in any of the following manners, but is not limited thereto:

[0071] Manner one: the electronic device can first perform feature extraction on the first merged image and the second merged image by using the first feature extractor to obtain a first face feature vector and a second face feature vector respectively, then the electronic device can calculate the distance between the first face feature vector and the second face feature vector to obtain a first feature distance, if the first feature distance is greater than a first preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are not the same person; if the first feature distance is less than or equal to the first preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are the same person.

[0072] Exemplarily, Figure 7 A schematic diagram of another face recognition method provided by an embodiment of the present application is shown inFigure 7 As shown, the present application takes the first merged image as an example to introduce the method for the electronic device to obtain the first face feature vector, and the method for the electronic device to obtain the second face feature vector from the second merged image is similar to this, which will not be described here. The electronic device can first extract the shape details of the first face image according to the method in the above embodiment, obtain the first face contour image, and merge the first face contour image and the first face image to obtain the first merged image. Then, the electronic device can input the first merged image into the first feature extractor to obtain the 512-dimensional first face feature vector: [x0, x1, …, x511]. The first feature extractor can be a deep neural network, such as MobileFaceNet, Residual Neural Network (ResNet), which is not limited by the present application.

[0073] For example, the distance between the first face feature vector and the second face feature vector can be the Euclidean distance between the first face feature vector and the second face feature vector, or the cosine distance, or the Hamming distance, but is not limited to this.

[0074] In the above embodiment, the first face feature vector and the second face feature vector are determined according to the first merged image and the second merged image respectively, and the first merged image and the second merged image both contain information in the face contour image, and the information in the face contour image can reflect the shape detail information of the face image, such as the shape of the five organs and the face shape. Therefore, the first face feature vector and the second face feature vector contain the shape detail information of the face image, such as the shape of the five organs and the face shape. Therefore, the above technical solution can realize more accurate face recognition. That is, taking the first merged image or the second merged image as the input of the deep neural network can enhance the perception ability of the deep neural network to the shape information, so that the deep neural network can better capture the detail information such as the shape of the five organs and the face shape, thereby realizing more accurate face recognition.

[0075] Method two: the electronic device can first calculate the square of the difference between the RGB value of each pixel point in the first merged image and the RGB value of the corresponding pixel point in the second merged image, and then determine the first difference according to the square of the above difference. If the first difference is greater than the first preset difference, the electronic device can determine that the face in the first face image and the face in the second face image are not the same person; if the first difference is less than or equal to the first preset difference, the electronic device can determine that the face in the first face image and the face in the second face image are the same person. Of course, the first difference can also be determined according to the absolute value of the difference between the RGB value of each pixel point in the first merged image and the RGB value of the corresponding pixel point in the second merged image, but is not limited to this.

[0076] It can be understood that the color of each pixel in an image is formed by superimposing red, green and blue three primary colors, and each color of the three primary colors has 256 brightness levels. The RGB value of a pixel point can represent the brightness of red, green and blue in the color of the pixel point, for example, the RGB value of a certain pixel point=(10, 20, 30) represents that the brightness of red, green and blue in the color of the pixel point is 10, 20 and 30 respectively. For two different images, there will be at least one pair of corresponding pixel points with different RGB values. Then the electronic device can determine the similarity of the first merged image and the second merged image, i.e. the first difference, according to the difference, such as the square of the difference, between the RGB value of each pixel point in the first merged image and the RGB value of the corresponding pixel point in the second merged image, so as to determine whether the face in the first face image and the face in the second face image are the same face according to the first difference.

[0077] For example, the present application introduces a method for calculating the square of the difference between the RGB value of the first pixel point in the upper left corner of the first merged image and the RGB value of the first pixel point in the upper left corner of the second merged image. The method for calculating the square of the difference between other pixel points in the first merged image and the second merged image is similar to this, and the present application will not be repeated here. Assuming that the RGB value of the first pixel point in the upper left corner of the first merged image is (1, 1, 2), and the RGB value of the first pixel point in the upper left corner of the second merged image is (2, 2, 3), then the square of the difference is [(1, 1, 2)-(2, 2, 3)]*[(1, 1, 2)-(2, 2, 3)]=(1, 1, 1). The first difference can be the sum of the squares of the respective differences of all the pixel points, or the maximum, minimum, median or average of the squares of the differences, which is not limited by the present application. For example, assuming that the first merged image and the second merged image have 3 pixel points, the electronic device can calculate that the square of the difference of the RGB value of the first pair of corresponding pixel points is (1, 1, 1), the square of the difference of the RGB value of the second pair of corresponding pixel points is (2, 2, 2), and the square of the difference of the RGB value of the third pair of corresponding pixel points is (3, 3, 3). Then the electronic device can determine that the maximum, minimum, median, average and sum of the squares of the above three differences are (3, 3, 3), (1, 1, 1), (2, 2, 2), (2, 2, 2), (6, 6, 6) respectively. The electronic device can determine that the first difference is any one of (3, 3, 3), (1, 1, 1), (2, 2, 2), (2, 2, 2), (6, 6, 6).

[0078] In the above embodiment, the first merged image and the second merged image both contain information in the face contour image, and the information in the face contour image can reflect shape detail information of the face image, such as facial feature shape, face shape, and the like. Therefore, when the above technical solution considers the difference between the RGB values of the pixel points corresponding to the first merged image and the second merged image, the difference between the shape detail information of the face image, such as the facial feature shape, the face shape, and the like, is considered. Therefore, the above technical solution can achieve more accurate face recognition.

[0079] Method three: the electronic device can first calculate the square of the difference between the pixel value of each pixel point in the first merged image and the pixel value of the corresponding pixel point in the second merged image, and then determine the second difference according to the square of the above difference. If the second difference is greater than the first preset difference, the electronic device can determine that the face in the first face image and the face in the second face image are not the same person. If the second difference is less than or equal to the first preset difference, the electronic device can determine that the face in the first face image and the face in the second face image are the same person. Of course, the second difference can also be determined according to the absolute value of the difference between the pixel value of each pixel point in the first merged image and the pixel value of the corresponding pixel point in the second merged image, but is not limited thereto.

[0080] It can be understood that the pixel value of a pixel point represents the average brightness information of the pixel. For different two images, there will be at least one pair of corresponding pixel points with different pixel values. Then the electronic device can determine the similarity of the first merged image and the second merged image, i.e., the second difference, according to the difference between the pixel value of each pixel point in the first merged image and the pixel value of the corresponding pixel point in the second merged image, such as the square of the difference, so as to determine whether the face in the first face image and the face in the second face image are the same person according to the second difference.

[0081] For example, the first pixel point in the top left corner of the first merged image has a pixel value of 73, and the first pixel point in the top left corner of the second merged image has a pixel value of 72. The square of the difference between the two pixel values is [73-72]*[73-72]=1. The second difference can be the sum of the squares of the differences between the respective pixel values of all the pixel points, or the maximum, minimum, median, or average of the squares of the differences, and the application does not limit this. For example, assuming that the first merged image and the second merged image each have three pixel points, the electronic device can calculate the square of the difference between the pixel values of the first pair of corresponding pixel points as 1, the square of the difference between the pixel values of the second pair of corresponding pixel points as 2, and the square of the difference between the pixel values of the third pair of corresponding pixel points as 3. Then, the electronic device can determine the maximum, minimum, median, average, and sum of the squares of the three differences as 3, 1, 2, 2, and 6, respectively. The electronic device can then determine the second difference as any one of 3, 1, 2, 2, and 6.

[0082] In the above embodiment, the first merged image and the second merged image both contain information in the face contour image, and the information in the face contour image can reflect the shape detail information of the face image, such as the shape of the facial features and the face shape. Therefore, when the above technical solution considers the difference between the pixel values of the corresponding pixel points of the first merged image and the second merged image, it considers the difference in the shape detail information of the face image, such as the shape of the facial features and the face shape, which is contained in the first merged image and the second merged image. Therefore, the above technical solution can achieve more accurate face recognition.

[0083] Figure 8 Another flowchart of a face recognition method provided by an embodiment of the application is based on Figure 2 As shown in FIG. 8, S204 can include the following steps. Figure 8

[0084] S801: performing feature extraction on the first face image and the second face image using a second feature extractor to obtain a third face feature vector and a fourth face feature vector, respectively;

[0085] S802: performing feature extraction on the first face contour image and the second face contour image using a third feature extractor to obtain a first face shape feature vector and a second face shape feature vector, respectively;

[0086] ​S803: combine the third face feature vector and the first face shape feature vector to obtain a fifth face feature vector;

[0087] S804: combine the fourth face feature vector and the second face shape feature vector to obtain a sixth face feature vector;

[0088] S805: determine whether the face in the first face image and the face in the second face image are the same person according to the fifth face feature vector and the sixth face feature vector.

[0089] In some implementations, the second feature extractor and the third feature extractor can be a deep neural network structure, such as MobileFaceNet, ResNet, which is not limited in the present application. The second feature extractor and the third feature extractor can use the same network structure, or can use different network structures, such as the network width of the third feature extractor, such as the number of convolution kernels, can be 25% of the network width of the second feature extractor, which is not limited in the present application.

[0090] In some implementations, S805 above can be implemented in any of the following ways, but is not limited to this:

[0091] Method one: the electronic device can input the fifth face feature vector and the sixth face feature vector into a fully connected layer respectively to obtain a seventh face feature vector and an eighth face feature vector respectively, and then the electronic device can calculate the distance between the seventh face feature vector and the eighth face feature vector to obtain a second feature distance, if the second feature distance is greater than a second preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are not the same person; if the second feature distance is less than or equal to the second preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are the same person.

[0092] An exemplary, Figure 9 Another face recognition method provided by the embodiment of the present application is shown in the schematic diagram of Figure 9As shown, the present application takes the first face image and the first face contour image as an example to introduce the method of obtaining the seventh face feature vector by the electronic device, and the method of obtaining the eighth face feature vector by the electronic device according to the second face image and the second face contour image is similar to this, and the present application will not be repeated here. The electronic device can first extract the shape details of the first face image according to the method in the above embodiment to obtain the first face contour image, then the electronic device can input the first face image into the second feature extractor to obtain a 512-dimensional third face feature vector: [a0, a1, …, a511], and input the first face contour image into the third feature extractor to obtain a 128-dimensional first face shape feature vector: [b0, b1, …, b127], then the electronic device can concatenate the third face feature vector [a0, a1, …, a511] and the first face shape feature vector [b0, b1, …, b127] to obtain a 640-dimensional fifth feature vector: [a0, a1, …, a511, b0, b1, …, b127], and then the electronic device can input the fifth feature vector into the fully connected layer to obtain a 512-dimensional seventh face feature vector: [y0, y1, …, y511].

[0093] For example, the distance between the seventh face feature vector and the eighth face feature vector can be the Euclidean distance of the distance between the seventh face feature vector and the eighth face feature vector, or can be the cosine distance, or can be the Hamming distance, but is not limited to this.

[0094] In the above embodiment, the fully connected layer can perform weight redistribution on the fifth face feature vector or the sixth face feature vector, so as to assign a higher weight to the feature vector corresponding to the first face image or the second face image when the contour information corresponding to the first face contour image or the second face contour image is inaccurate, reduce or avoid the negative impact of inaccurate shape information on face recognition, or can assign a higher weight to the feature vector corresponding to the first face contour image or the second face contour image when the data information corresponding to the first face image or the second face image is inaccurate, reduce or avoid the negative impact of inaccurate data information on face recognition, and improve the robustness.

[0095] Method two: the electronic device can directly calculate the distance between the fifth face feature vector and the sixth face feature vector to obtain a third feature distance, if the third feature distance is greater than a third preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are not the same person; if the third feature distance is less than or equal to the third preset threshold, the electronic device can determine that the face in the first face image and the face in the second face image are the same person.

[0096] Exemplarily, the distance between the fifth face feature vector and the sixth face feature vector can be an Euclidean distance of the distance between the fifth face feature vector and the sixth face feature vector, can be a cosine distance, can be a Hamming distance, and is not limited thereto.

[0097] To sum up, the technical solutions provided by the above embodiments at least bring the following beneficial effects: through the technical solutions of the present application, the electronic device can first acquire a first face image and a second face image, then perform face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate, then the electronic device can generate a first face contour image according to the at least one first face key point coordinate and generate a second face contour image according to the at least one second face key point coordinate, and finally the electronic device can determine whether the face in the first face image and the face in the second face image are the same face according to the first face image, the second face image, the first face contour image and the second face contour image. It can be understood that the face key point coordinates can accurately reflect the positions of the facial features, facial contours, etc. in the face image, and the face contour image generated from the face key point coordinates can reflect the shape details of the face image, such as the thickness of the lips, the width of the eyebrows, and other facial feature shape details. Therefore, compared with the face recognition method in the prior art which only considers the difference between two face images in the whole, the technical solutions provided by the present application not only consider the difference between two face images in the whole, but also consider the shape details such as facial features of two face images. Therefore, the technical solutions of the present application can improve the recognition ability of face images that are similar in the whole but different in shape details such as facial features, and improve the accuracy of face recognition.

[0098] Further, the electronic device can use the second feature extractor to extract features from the face image and use the third feature extractor to extract features from the face contour image, so that the obtained feature vectors can better represent the information reflected by the face image and the face contour image respectively, and further improve the accuracy of face recognition. That is, the present application can further improve the accuracy of face recognition through the design of the double-branch network structure.

[0099] In some implementations, the electronic device can train the first feature extractor before feature extraction using the first feature extractor. The sample data can be a plurality of pairs of merged face images belonging to the same face image, a plurality of pairs of merged face images belonging to different face images, and the merged face images being obtained by merging the face image and the face contour image. The electronic device can input the sample data into the first feature extractor for training, can substitute the feature vector output by the first feature extractor into the loss function to obtain a loss value, and update each parameter of the first feature extractor according to the loss value, so that the feature distance of the face feature vectors of the merged face images belonging to the same face image output by the trained first feature extractor is less than a preset threshold, and the feature distance of the face feature vectors of the merged face images belonging to different face images is greater than or equal to the preset threshold. The electronic device can also optimize the loss function using an optimization algorithm to train a better first feature extractor. Alternatively, the training of the first feature extractor can be completed when the number of training times of the first feature extractor reaches a preset number. Of course, the training method of the first feature extractor is not limited in the present application.

[0100] For example, the loss function can be an AdaFace loss function, and the optimization algorithm can be a stochastic gradient descent (SGD), but is not limited thereto.

[0101] It should be understood that the first feature extractor can be used to implement the above-mentioned face recognition method, and the content and effect thereof can be referred to the above-mentioned face recognition method, and the content and effect thereof will not be repeated in the present application.

[0102] It should be understood that the training method of the second feature extractor, the third feature extractor and the full connection layer is similar to the training method of the first feature extractor, which will not be repeated herein. In addition, the second feature extractor, the third feature extractor and the full connection layer can be used to implement the above-mentioned face recognition method, and the content and effect thereof can be referred to the above-mentioned face recognition method, and the content and effect thereof will not be repeated in the present application.

[0103] The technical solutions provided by the present application will be described below by experimental data: the effect of the technical solution shown in Figure 6 is 97.8% in the face recognition test set; the effect of the technical solution shown in Figure 8 is 98.6% in the face recognition test set.

[0104] Figure 10 A schematic diagram of a face recognition device 1000 provided by an embodiment of the present application is shown in FIG. 1, which includes a first acquisition module 1001, a detection module 1002, a generation module 1003, and a judgment module 1004. Figure 10

[0105] The first acquisition module 1001 is configured to acquire a first face image and a second face image.

[0106] The detection module 1002 is configured to perform face key point detection on the first face image and the second face image respectively, and obtain at least one first face key point coordinate and at least one second face key point coordinate respectively.

[0107] The generation module 1003 is configured to generate a first face contour image according to the at least one first face key point coordinate, and generate a second face contour image according to the at least one second face key point coordinate.

[0108] The judgment module 1004 is configured to judge whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image, and the second face contour image.

[0109] In some possible implementation manners, the judgment module 1004 is specifically configured to: merge the first face image and the first face contour image to obtain a first merged image; merge the second face image and the second face contour image to obtain a second merged image; and judge whether the face in the first face image and the face in the second face image are faces of the same person according to the first merged image and the second merged image.

[0110] In some possible implementation manners, the judgment module 1004 is specifically configured to: judge whether the face in the first face image and the face in the second face image are faces of the same person according to the similarity of the first merged image and the second merged image.

[0111] In some possible implementation manners, the judgment module 1004 is specifically configured to: perform feature extraction on the first merged image and the second merged image respectively by using a first feature extractor to obtain a first face feature vector and a second face feature vector respectively; calculate the distance between the first face feature vector and the second face feature vector to obtain a first feature distance; if the first feature distance is greater than a first preset threshold, it is determined that the face in the first face image and the face in the second face image are not faces of the same person; and if the first feature distance is less than or equal to the first preset threshold, it is determined that the face in the first face image and the face in the second face image are faces of the same person.

[0112] ​In some implementable manners, the determining module 1004 is specifically configured to: perform feature extraction on the first face image and the second face image respectively by using a second feature extractor, to obtain a third face feature vector and a fourth face feature vector respectively; perform feature extraction on the first face contour image and the second face contour image respectively by using a third feature extractor, to obtain a first face shape feature vector and a second face shape feature vector respectively; combine the third face feature vector and the first face shape feature vector to obtain a fifth face feature vector; combine the fourth face feature vector and the second face shape feature vector to obtain a sixth face feature vector; and determine whether the face in the first face image and the face in the second face image are faces of the same person according to the fifth face feature vector and the sixth face feature vector.

[0113] In some implementable manners, the determining module 1004 is specifically configured to: input the fifth face feature vector and the sixth face feature vector into a full connection layer respectively to obtain a seventh face feature vector and an eighth face feature vector respectively; calculate a distance between the seventh face feature vector and the eighth face feature vector to obtain a second feature distance; if the second feature distance is greater than a second preset threshold, it is determined that the face in the first face image and the face in the second face image are not faces of the same person; and if the second feature distance is less than or equal to the second preset threshold, it is determined that the face in the first face image and the face in the second face image are faces of the same person.

[0114] In some implementable manners, the apparatus 1000 further includes a second acquisition module 1005, which is configured to: acquire a first background image and a second background image; and the generating module 1003 is specifically configured to: draw a first graph at each first face key point coordinate of the first background image to obtain the first face contour image, and draw a second graph at each second face key point coordinate of the second background image to obtain the second face contour image.

[0115] In some implementable manners, the at least one first face key point coordinate is a face key point coordinate corresponding to a local face image in the first face image; and the at least one second face key point coordinate is a face key point coordinate corresponding to a local face image in the second face image.

[0116] It should be understood that the apparatus embodiments and the method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, no longer described here. Specifically, Figure 10 The apparatus 1000 shown can perform the above-mentioned method embodiments, and the aforementioned and other operations and / or functions of each module in the apparatus 1000 are respectively for realizing the corresponding processes in each of the above-mentioned methods. To be brief, no longer described here.

[0117] The apparatus 1000 of the embodiments of the present application is described above from the perspective of functional modules in combination with the drawings. It should be understood that the functional modules can be implemented in the form of hardware, or in the form of instructions of software, or in the form of a combination of hardware and software modules. Specifically, each step of the method embodiments in the embodiments of the present application can be completed by integrated logic circuits of hardware in a processor and / or instructions of software. The steps of the method disclosed in the embodiments of the present application can be directly embodied as hardware code processing performed by a processor, or be executed by a combination of hardware and software modules in the processor. Alternatively, the software module can be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, and the like. The storage medium is located in a memory, and a processor reads information in the memory and combines hardware to complete the steps in the above method embodiments.

[0118] Figure 11 FIG. 11 is a schematic block diagram of an electronic device 1100 provided by the embodiments of the present application.

[0119] As shown in FIG. 11, the electronic device 1100 can include: Figure 11

[0120] The memory 1110 and the processor 1120, the memory 1110 is used to store computer programs and transmit the program codes to the processor 1120. In other words, the processor 1120 can call and run the computer program from the memory 1110 to implement the method in the embodiments of the present application.

[0121] For example, the processor 1120 can be used to execute the above method embodiments according to the instructions in the computer program.

[0122] In some embodiments of the present application, the processor 1120 can include but is not limited to:

[0123] A general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and the like.

[0124] In some embodiments of the present application, the memory 1110 includes but is not limited to:

[0125] ​The non-volatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).

[0126] In some embodiments of the present application, the computer program can be divided into one or more modules, which are stored in the memory 1110 and executed by the processor 1120 to complete the method provided by the present application. The one or more modules can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the electronic device.

[0127] As shown in Figure 11 The electronic device can further include a transceiver 1130, which can be connected to the processor 1120 or the memory 1110. The processor 1120 can control the transceiver 1130 to communicate with other devices, specifically, can send information or data to other devices, or receive information or data sent by other devices. The transceiver 1130 can include a transmitter and a receiver. The transceiver 1130 can further include an antenna, and the number of antennas can be one or more.

[0128] It should be understood that various components in the electronic device are connected through a bus system, wherein the bus system includes a data bus, a power supply bus, a control bus, and a state signal bus in addition to a data bus.

[0129] The application further provides a computer storage medium, which stores a computer program. The computer program is executed by a computer to enable the computer to perform the method of the method embodiments described above. Alternatively, the application embodiments further provide a computer program product comprising instructions, which are executed by a computer to enable the computer to perform the method of the method embodiments described above.

[0130] When implemented using software, the functions described above can be implemented in whole or in part using computer programs. The computer programs include one or more computer instructions. When loaded and executed by a computer, the computer programs generate the processes or functions described above in whole or in part according to the embodiments of the application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, digital video disc (DVD)), or a semiconductor medium (for example, solid state disk (SSD)), etc.

[0131] Those skilled in the art can realize that the modules and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the application.

[0132] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the division of the above-described device embodiment is merely an example, and there can be other division manners. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the modules shown or discussed can be indirect coupling or communication connection through some interface, device or module, and can be electrical, mechanical or in other forms.

[0133] The modules explained as separated components can or can not be physically separated, and the components shown as modules can or can not be physical modules, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiments. For example, the functional modules in the embodiments of the present application can be integrated in one processing module, or can be physically separated, or two or more modules can be integrated in one module.

[0134] The above is merely specific embodiments of the present application, and the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A face recognition method, characterized by, The method comprises: obtaining a first face image and a second face image; performing face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate respectively; generating a first face contour image according to the at least one first face key point coordinate and generating a second face contour image according to the at least one second face key point coordinate; determining whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image and the second face contour image; wherein the determination of whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image and the second face contour image comprises: performing feature extraction on the first face image and the second face image respectively by using a second feature extractor to obtain a third face feature vector and a fourth face feature vector respectively; performing feature extraction on the first face contour image and the second face contour image respectively by using a third feature extractor to obtain a first face shape feature vector and a second face shape feature vector respectively; combining the third face feature vector and the first face shape feature vector to obtain a fifth face feature vector; combining the fourth face feature vector and the second face shape feature vector to obtain a sixth face feature vector; inputting the fifth face feature vector and the sixth face feature vector into a full connection layer respectively to obtain a seventh face feature vector and an eighth face feature vector respectively; calculating the distance between the seventh face feature vector and the eighth face feature vector to obtain a second feature distance; if the second feature distance is greater than a second preset threshold, it is determined that the face in the first face image and the face in the second face image are not faces of the same person; if the second feature distance is less than or equal to the second preset threshold, it is determined that the face in the first face image and the face in the second face image are faces of the same person.

2. The method of claim 1, wherein, The determination of whether the face in the first face image and the face in the second face image are faces of the same person according to the first face image, the second face image, the first face contour image and the second face contour image comprises: merging the first face image and the first face contour image to obtain a first merged image; merging the second face image and the second face contour image to obtain a second merged image; determining whether the face in the first face image and the face in the second face image are faces of the same person according to the first merged image and the second merged image.

3. The method of claim 2, wherein, The determination of whether the face in the first face image and the face in the second face image are faces of the same person according to the first merged image and the second merged image comprises: According to the similarity of the first combined image and the second combined image, it is determined whether the face in the first face image and the face in the second face image are faces of the same person.

4. The method of claim 3, wherein, The determining whether the face in the first face image and the face in the second face image are faces of the same person according to the similarity of the first combined image and the second combined image comprises: performing feature extraction on the first combined image and the second combined image by using a first feature extractor, and obtaining a first face feature vector and a second face feature vector respectively; calculating the distance between the first face feature vector and the second face feature vector to obtain a first feature distance; if the first feature distance is greater than a first preset threshold, it is determined that the face in the first face image and the face in the second face image are not faces of the same person; if the first feature distance is less than or equal to the first preset threshold, it is determined that the face in the first face image and the face in the second face image are faces of the same person.

5. The method according to any one of claims 1 to 4, characterized in that, Before the generating a first face contour image according to the at least one first face key point coordinate and generating a second face contour image according to the at least one second face key point coordinate, the method further comprises: obtaining a first background image and a second background image; The generating a first face contour image according to the at least one first face key point coordinate and generating a second face contour image according to the at least one second face key point coordinate comprises: drawing a first graph at each of the first face key point coordinates of the first background image to obtain the first face contour image, and drawing a second graph at each of the second face key point coordinates of the second background image to obtain the second face contour image.

6. The method according to any one of claims 1 to 4, characterized in that, The at least one first face key point coordinate is a face key point coordinate corresponding to a local face image in the first face image; The at least one second face key point coordinate is a face key point coordinate corresponding to a local face image in the second face image.

7. A face recognition apparatus, characterized by comprising: The method comprises: a first obtaining module configured to obtain a first face image and a second face image; a detecting module configured to perform face key point detection on the first face image and the second face image respectively to obtain at least one first face key point coordinate and at least one second face key point coordinate respectively; a generating module configured to generate a first face contour image according to the at least one first face key point coordinate and generate a second face contour image according to the at least one second face key point coordinate. The judgment module is configured to: perform feature extraction on the first face image and the second face image respectively by using a second feature extractor, to obtain a third face feature vector and a fourth face feature vector respectively; perform feature extraction on the first face contour image and the second face contour image respectively by using a third feature extractor, to obtain a first face shape feature vector and a second face shape feature vector respectively; combine the third face feature vector and the first face shape feature vector to obtain a fifth face feature vector; combine the fourth face feature vector and the second face shape feature vector to obtain a sixth face feature vector; input the fifth face feature vector and the sixth face feature vector into a full connection layer respectively, to obtain a seventh face feature vector and an eighth face feature vector respectively; calculate a distance between the seventh face feature vector and the eighth face feature vector, to obtain a second feature distance; if the second feature distance is greater than a second preset threshold, it is determined that the face in the first face image and the face in the second face image are not the same person; if the second feature distance is less than or equal to the second preset threshold, it is determined that the face in the first face image and the face in the second face image are the same person.

8. An electronic device, comprising: Comprise: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of claims 1-6 via executing the executable instructions.

Citation Information

Patent Citations

  • 3D face generation control method and device, computer equipment and storage medium

    CN111476878A

  • Face recognition method and device, terminal and storage medium

    CN114821724A