Face matching method, device and terminal equipment
By simultaneously collecting RGB and infrared images for face detection and alignment, combined with feature parameter comparison, the problem of face comparison being greatly affected by illumination is solved and accuracy is improved.
Patent Information
- Application Number
- CN201910008568.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-01-04
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2039-01-04
AI Technical Summary
In the existing technology, the face ratio is greatly affected by the lighting environment and the accuracy is low.
By collecting RGB images and infrared images at the same time, the face detection network is used to analyze the face collection area, face alignment and feature parameter fusion analysis are performed, and the preset feature parameters are combined for comparison, and registered images whose similarity exceeds the threshold are output as comparisons. to the results.
It improves the accuracy of face comparison and reduces the impact of lighting environment contrast on the results.
Smart Images

Figure CN109948420B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing technology, and in particular relates to a face comparison method, an apparatus, a terminal device and a computer-readable storage medium. Background Art
[0002] With the development of information technology and computer technology, face recognition has become a hot research direction today and is widely used in scenes such as access control and photo taking. Face matching is a branch of face recognition. Its main idea is to compare the acquired user image with the registered base map. If the user image is similar to the base map, the base map is used as the comparison result.
[0003] In the prior art, face comparison is usually performed based on RGB (i.e., red, green, and blue) visible light. Specifically, an RGB camera is used to collect RGB images, and then the RGB images are compared with a registered base map. However, since RGB images are greatly affected by the surrounding lighting environment, for example, RGB images collected under side lighting environments are prone to "yin-yang faces", resulting in inaccurate results of face comparison based on RGB images. In summary, the accuracy of face comparison in the prior art is low. Summary of the invention
[0004] In view of this, the embodiments of the present invention provide a face comparison method, an apparatus, a terminal device, and a computer-readable storage medium to solve the problem in the prior art that face comparison is greatly affected by the lighting environment and has low accuracy.
[0005] A first aspect of an embodiment of the present invention provides a face comparison method, comprising:
[0006] Acquire a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network;
[0007] Performing face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, performing face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and performing face alignment on the first face image and the second face image respectively, determining the aligned first face image as a first aligned image, and determining the aligned second face image as a second aligned image;
[0008] Performing a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0009] If the similarity with the largest value exceeds a preset threshold, the registered image corresponding to the similarity with the largest value is output as a result of face comparison.
[0010] A second aspect of an embodiment of the present invention provides a face comparison device, comprising:
[0011] A detection unit, used to obtain a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network;
[0012] an alignment unit, configured to perform face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, perform face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and perform face alignment on the first face image and the second face image respectively, determine the aligned first face image as a first aligned image, and determine the aligned second face image as a second aligned image;
[0013] a comparing unit, configured to perform a fusion analysis on the first aligned image and the second aligned image to obtain a facial feature parameter, and compare the facial feature parameter with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0014] The output unit is used to output the registered image corresponding to the similarity with the largest value as the result of face comparison if the similarity with the largest value exceeds a preset threshold.
[0015] A third aspect of an embodiment of the present invention provides a terminal device, the terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0016] Acquire a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network;
[0017] Performing face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, performing face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and performing face alignment on the first face image and the second face image respectively, determining the aligned first face image as a first aligned image, and determining the aligned second face image as a second aligned image;
[0018] Performing a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0019] If the similarity with the largest value exceeds a preset threshold, the registered image corresponding to the similarity with the largest value is output as a result of face comparison.
[0020] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0021] Acquire a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network;
[0022] Performing face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, performing face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and performing face alignment on the first face image and the second face image respectively, determining the aligned first face image as a first aligned image, and determining the aligned second face image as a second aligned image;
[0023] Performing a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0024] If the similarity with the largest value exceeds a preset threshold, the registered image corresponding to the similarity with the largest value is output as a result of face comparison.
[0025] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0026] The embodiment of the present invention obtains the RGB image and the infrared image collected at the same time, obtains the corresponding first aligned image and the second aligned image through face collection and alignment operations, then performs fusion analysis on the first aligned image and the second aligned image to obtain face feature parameters, compares the face feature parameters with at least two existing preset feature parameters to obtain at least two similarities, and if the largest similarity exceeds a preset threshold, outputs the registered image corresponding to the similarity as the result of face comparison. The embodiment of the present invention comprehensively analyzes the RGB image (corresponding to visible light) and the infrared image (corresponding to invisible light), reduces the influence of the surrounding lighting environment on the image and feature parameters, and improves the accuracy of face comparison. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0028] Figure 1 is a flow chart of the implementation of the face comparison method provided in the first embodiment of the present invention;
[0029] Figure 2 is a flow chart of the implementation of the face comparison method provided in the second embodiment of the present invention;
[0030] Figure 3 is a flow chart of the implementation of the face comparison method provided in the third embodiment of the present invention;
[0031] Figure 4 is a flow chart of the implementation of the face comparison method provided in the fourth embodiment of the present invention;
[0032] Figure 5 is a flowchart of the implementation of the face comparison method provided in Embodiment 5 of the present invention;
[0033] Figure 6 is a structural diagram of a face comparison method provided in Embodiment 6 of the present invention;
[0034] Figure 7 is a structural block diagram of a face comparison device provided in Embodiment 7 of the present invention;
[0035] Figure 8 It is a schematic diagram of a terminal device provided in Embodiment 8 of the present invention. DETAILED DESCRIPTION
[0036] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0037] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.
[0038] Figure 1 The implementation process of the face comparison method provided by the embodiment of the present invention is shown, and is described in detail as follows:
[0039] In S101, a user RGB image and a user infrared image collected simultaneously are obtained, the user RGB image and the user infrared image are input into a preset face detection network, and a face collection area is analyzed according to an output result of the face detection network.
[0040] The RGB color mode is a universal color standard, which mainly obtains a variety of colors by superimposing the three color channels of red, green and blue. The RGB color mode includes all colors that can be perceived by human vision to the greatest extent, and is one of the most widely used color modes. Compared with the traditional method of only collecting RGB images for face comparison, in the embodiment of the present invention, the RGB image and infrared image of the target user are collected at the same time, and the collected RGB image is used as the user RGB image, and the collected infrared image is used as the user infrared image, so as to perform face comparison based on the dual images, wherein the infrared image is a thermal infrared image, which is an image formed based on the thermal radiation energy emitted by the target user. In order to realize the simultaneous collection of the user RGB image and the user infrared image, the target user can be photographed by a binocular camera with RGB shooting function and infrared shooting function. In addition, the embodiment of the present invention does not limit the number of faces in the RGB image and the infrared image, that is, the number of faces in the RGB image and the infrared image can be one or at least two.
[0041] After obtaining the user RGB image and the user infrared image, the user RGB image and the user infrared image are input into a preset face detection network. Among them, the open source face detection network can be called to perform face detection. For example, the face detection network in the embodiment of the present invention can be implemented based on the single neural network detector (Single Shot MultiBox Detector, SSD) in the open source deep learning framework. In order to make the face detection network have a good detection effect on both the user RGB image and the user infrared image, when training the face detection network, at least two RGB images and at least two infrared images in the open source face image library are input into the SSD as a training parameter set. After performing face detection on the user RGB image and the user infrared image respectively through the face detection network, the face collection area is analyzed according to the output result of the face detection network (i.e., the detection area of the face). When analyzing the face collection area, the union of all the detection areas of the face detection network can be used as the face collection area. Of course, other analysis methods can also be applied according to different actual application scenarios, and the embodiment of the present invention does not limit this.
[0042] Optionally, if only the user RGB image is obtained, the user RGB image is gray-scaled, and the gray-scaled user RGB image is determined as the user infrared image. Since the actual shooting environment may be limited, such as only an RGB camera, when acquiring an image, only the user RGB image may be obtained. For the above situation, in an embodiment of the present invention, the user RGB image is gray-scaled, and the gray-scaled user RGB image is determined as the user infrared image, thereby ensuring that the face comparison based on the dual images can be carried out normally, and improving the applicability of face comparison in different application scenarios.
[0043] In S102, face acquisition is performed on the user RGB image based on the face acquisition area to obtain a first face image, face acquisition is performed on the user infrared image based on the face acquisition area to obtain a second face image, and face alignment is performed on the first face image and the second face image respectively, and the aligned first face image is determined as a first aligned image, and the aligned second face image is determined as a second aligned image.
[0044] After obtaining the face acquisition area, the user RGB image is intercepted according to the face acquisition area, and the intercepted part of the image is determined as the first face image. At the same time, the user infrared image is intercepted according to the face acquisition area, and the intercepted part of the image is determined as the second face image. Then, the first face image and the second face image are respectively aligned. In the embodiment of the present invention, face alignment is to locate the key points of the image, correct the image according to the coordinates of the key points, and normalize the image to a preset image size for subsequent analysis. The types of key points include but are not limited to eyes, nose tips, mouth corners and eyebrows. When performing face alignment, an open source face alignment algorithm can be called to locate the key points, such as the Active Appearance Model (AMM) or the Constrained Local Model (CLM). After completing the face alignment of the first face image and the second face image, the aligned first face image is determined as the first alignment image, and the aligned second face image is determined as the second alignment image.
[0045] In S103, a fusion analysis is performed on the first aligned image and the second aligned image to obtain facial feature parameters, and the facial feature parameters are compared with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image.
[0046] In an embodiment of the present invention, the first aligned image and the second aligned image are fused with information using the cross-domain idea so that the information of the two images are mutually enhanced. The specific content is described in detail later. For the newly formed image after information fusion, feature points are extracted to obtain facial feature parameters, wherein feature points can be extracted by using a neural network, a scale-invariant feature transform (SIFT) algorithm, or a speed up robust features (SURF) algorithm. It is worth mentioning that the feature points determined in this step may be the same as or different from the key points determined in step S102, and may be adjusted according to the actual application scenario.
[0047] After obtaining the facial feature parameters, the facial feature parameters are compared one by one with at least two existing preset feature parameters to obtain the similarity corresponding to each preset feature parameter. The similarity can be obtained by calculating the Euclidean distance between the facial feature parameters and the preset feature parameters (the smaller the Euclidean distance, the greater the similarity. In the specific calculation process, the numerical correspondence between the Euclidean distance and the similarity can be set) or by applying other calculation methods, wherein the preset feature parameters are obtained by subjecting the registered image to the same face detection, face alignment and feature point extraction operations as in the above steps, that is, they are equivalent to the facial feature parameters corresponding to the registered image. The registered image is an image already existing in the database, and the calculated similarity indicates the degree of similarity between the image after information fusion corresponding to the facial feature parameters and the registered image corresponding to the preset feature parameters.
[0048] In S104, if the similarity with the largest value exceeds a preset threshold, the registered image corresponding to the similarity with the largest value is output as a result of face comparison.
[0049] For at least two similarities obtained, if the similarity with the largest value does not exceed the preset threshold (such as set to 80%), a prompt of failed comparison is output; if the similarity with the largest value exceeds the preset threshold, it proves that the target user is relatively similar to the registered image corresponding to the similarity, then the registered image corresponding to the similarity with the largest value is output as the result of face comparison.
[0050] Optionally, a feature matrix is constructed based on all preset feature parameters, and the facial feature parameters are similarly calculated with the feature matrix to obtain a similarity vector. If the element with the largest value in the similarity vector exceeds a preset threshold, the registered image corresponding to the element is output as the result of face comparison. When calculating the similarity, it is necessary to continuously call different preset feature parameters and facial feature parameters for calculation. Since the calling operation is relatively time-consuming, in order to improve the calculation speed, in an embodiment of the present invention, a feature matrix is constructed based on all existing preset feature parameters, and the facial feature parameters are similarly calculated with the feature matrix to obtain a similarity vector. Each element in the similarity vector is a similarity. If the element with the largest value (similarity) in the similarity vector exceeds the preset threshold, the registered image corresponding to the element is output as the result of face comparison. For the sake of convenience, it is assumed that the facial feature parameters and the preset feature parameters are both 128-dimensional, and there are N registered images. The constructed feature matrix is an N*128-dimensional matrix. When calculating the similarity, the facial feature parameters and each row element in the feature matrix are calculated separately, and the calculated result is used as a similarity. Finally, a 1*N-dimensional similarity vector can be obtained. Each element in the similarity vector is the similarity corresponding to a preset feature parameter. Then, it is determined whether the element with the largest value in the similarity vector exceeds the preset threshold. If it exceeds the preset threshold, the preset feature parameter corresponding to the element is found, and then the corresponding registered image is found, and the registered image is output. Since the speed of matrix operations is fast and only the feature matrix needs to be retrieved during calculation, the efficiency of similarity calculation is improved by the above method. In addition, in the embodiment of the present invention, a cloud service can be built to realize the rapid uploading of preset feature parameters and the rapid construction of feature matrices. The embodiment of the present invention provides such Figure 6 The architecture diagram of the face comparison method shown in Figure 6In the process, the cloud service establishes a connection with the terminal device for face comparison and the registration terminal of the user registration image. For the registration terminal, since it is a terminal held by the user, it is usually only equipped with an RGB camera, that is, the registered image is usually an RGB image, so only the registered image is input into the face detection network for face detection, and the preset feature parameters are obtained after the subsequent face alignment and feature value extraction operations, and the preset feature parameters are uploaded to the cloud server; for the terminal device for face comparison, the preset feature parameters uploaded by at least one registration terminal are received from the cloud server, and a feature matrix is constructed based on all the preset feature parameters obtained. After obtaining the user RGB image and the user infrared image, face detection and face alignment are performed on the user RGB image and the user infrared image respectively, and after information fusion, the face feature parameters of the fused image are obtained, and the similarity vector is calculated based on the face feature parameters and the feature matrix. When the element with the largest value in the similarity vector exceeds the preset threshold, the registered image corresponding to the element with the largest value is output as the result of face comparison.
[0051] pass Figure 1 It can be seen from the illustrated embodiment that in the embodiment of the present invention, by acquiring the user RGB image and the user infrared image acquired simultaneously, face detection is performed on the user RGB image and the user infrared image to obtain a face acquisition area, face acquisition is performed on the user RGB image based on the face acquisition area to obtain a first face image, face acquisition is performed on the user infrared image based on the face acquisition area to obtain a second face image, and face alignment is performed on the first face image and the second face image respectively, and the aligned first face image and the second face image are fused and analyzed to obtain face feature parameters, and the face feature parameters are compared with at least two preset feature parameters to obtain at least two similarities, and if the similarity with the largest value exceeds a preset threshold, the registered image corresponding to the similarity with the largest value is output as the result of face comparison. The embodiment of the present invention obtains the user RGB image derived from visible light and the user infrared image derived from invisible light for joint analysis, and since the user infrared image is basically not affected by the lighting conditions, the influence of the surrounding lighting environment on face comparison is avoided to the greatest extent, thereby improving the accuracy of face comparison.
[0052] Figure 2 As shown in FIG. 1 , a method is obtained by refining the process of inputting the user RGB image and the user infrared image into a preset face detection network and analyzing the face collection area according to the output result of the face detection network based on the first embodiment of the present invention. The embodiment of the present invention provides a flow chart for implementing the face comparison method, as shown in FIG. Figure 2 As shown, the face comparison method may include the following steps:
[0053] In S201, an RGB acquisition area corresponding to the user's RGB image output by the face detection network is obtained, and an infrared acquisition area corresponding to the user's infrared image output by the face detection network is obtained, wherein the number of the RGB acquisition area and the number of the infrared acquisition area are both at least one.
[0054] After the user RGB image and the user infrared image are input into a preset face detection network, the RGB acquisition area corresponding to the user RGB image output by the face detection network is obtained, and the infrared acquisition area corresponding to the user infrared image output by the face detection network is obtained, wherein the RGB acquisition area and the infrared acquisition area are face detection areas of the face detection network for the user RGB image and the user infrared image, respectively, and are usually embodied in a matrix box format, and the number of the RGB acquisition area and the infrared acquisition area is at least one, and the specific number depends on the network architecture of the face detection network in the actual application scenario.
[0055] In S202, the RGB acquisition area and the infrared acquisition area are combined to obtain at least one combined area, and the combined area with the largest area is determined as the face acquisition area.
[0056] For any RGB acquisition area and any infrared acquisition area obtained, a union process is performed to obtain a union area. For all possible union areas, the union area with the largest area is determined as the face acquisition area to prevent missing face data.
[0057] For ease of understanding, the content of the embodiment of the present invention is described with a formula:
[0058] Assume that the face detection network is net det , the user RGB image is I rgb , the user's infrared image is I ir , then the RGB acquisition area bbox obtained by inputting the user RGB image into the face detection network rgb The formula is:
[0059] bbox rgb =net det (I rgb )
[0060] The infrared acquisition area bbox obtained after the user's infrared image is input into the face detection network ir The formula is:
[0061] bbox ir =net det (I ir )
[0062] The above bboxrgb and bbox ir The number of is at least one, and the face collection area bbox is calculated based on the above formula max The formula is:
[0063] bbox max =max{bbox rgb ∪bbox ir}
[0064] The above-mentioned max() function is used in the embodiment of the present invention to determine the union region with the largest area.
[0065] pass Figure 2 It can be seen from the illustrated embodiment that in the embodiment of the present invention, by obtaining the RGB acquisition area and the infrared acquisition area output by the face detection network, the RGB acquisition area and the infrared acquisition area are combined to obtain at least one combined area, and the combined area with the largest area is determined as the face acquisition area. The embodiment of the present invention avoids the loss of face data as much as possible by determining the combined area with the largest area as the face acquisition area, thereby improving the accuracy of subsequent analysis.
[0066] Figure 3 As shown in FIG. 1 , a method is obtained by expanding the process before determining the largest union area as the face collection area based on the second embodiment of the present invention. The embodiment of the present invention provides a flow chart for implementing the face comparison method, as shown in FIG. Figure 3 As shown, the face comparison method may include the following steps:
[0067] In S301, an intersection area corresponding to each of the union areas is analyzed, where the intersection area is obtained by performing intersection processing on the RGB acquisition area and the infrared acquisition area.
[0068] After the RGB acquisition area and the infrared acquisition area are unioned to obtain at least one union area, for each union area, the RGB acquisition area and the infrared acquisition area constituting the union area are intersection-processed to obtain an intersection area corresponding to the union area, and the intersection area is the overlapping area of the RGB acquisition area and the infrared acquisition area.
[0069] In S302, if the area ratios between all the intersection regions and the corresponding union regions are greater than a preset offset threshold, the operation of determining the union region with the largest area as the face collection region is performed.
[0070] Although the user RGB image and the user infrared image are collected at the same time, there may be a certain offset between the user RGB image and the user infrared image due to the different imaging speeds of the RGB image and the infrared image or the different shooting angles of the binocular camera. Therefore, in the embodiment of the present invention, the area ratio between each union area and the corresponding intersection area is calculated. If all the obtained area ratios are greater than the preset offset threshold, it proves that the offset between the user RGB image and the user infrared image is small, and then the subsequent operation of determining the union area with the largest area as the face collection area is performed. Among them, the offset threshold can be set according to the actual application scenario. The higher the accuracy requirement for face comparison, the larger the offset threshold is set. For example, the offset threshold can be set to 50%.
[0071] In S303, if the area ratio between any of the intersection regions and the corresponding union region is less than or equal to the offset threshold, a prompt for re-collection is output.
[0072] If there is any area ratio that is less than or equal to the offset threshold, it proves that the offset between the user RGB image and the user infrared image is large, which may affect the result of face comparison. Therefore, a prompt for re-collection is output to prevent face comparison errors.
[0073] pass Figure 3 It can be seen from the illustrated embodiment that in the embodiment of the present invention, by analyzing the intersection area corresponding to each union area, if the area ratio between all the intersection areas and the corresponding union area is greater than the preset offset threshold, the operation of determining the union area with the largest area as the face collection area is performed; if the area ratio between any intersection area and the corresponding union area is less than or equal to the offset threshold, a prompt for re-collection is output. The embodiment of the present invention performs different operations according to the offset between the user RGB image and the user infrared image, thereby ensuring the validity of the image and preventing errors in face comparison.
[0074] Figure 4 As shown in FIG. 1 , a method is obtained by refining the process of aligning the first face image and the second face image based on the first embodiment of the present invention. The embodiment of the present invention provides a flow chart for implementing the face comparison method, as shown in FIG. Figure 4 As shown, the face comparison method may include the following steps:
[0075] In S401, key points are extracted from the first facial image to obtain at least two corresponding first key points, and key points are extracted from the second facial image to obtain at least two corresponding second key points.
[0076] In an embodiment of the present invention, face alignment of a first face image and a second face image is achieved based on key points. First, key points are extracted from the first face image to obtain at least two corresponding first key points, and key points are extracted from the second face image to obtain at least two corresponding second key points. The types of key points can be specifically customized. For ease of explanation, in the embodiment of the present invention, it is assumed that three key points are included, and their types are left eye, right eye and mouth. After key point extraction, three first key points corresponding to the left eye, right eye and mouth identified in the first face image can be obtained, and three second key points corresponding to the left eye, right eye and mouth identified in the second face image can be obtained. Among them, the first key point and the second key point are both the image coordinates of the key points identified in the image, and the key point extraction method for the first face image and the second face image is the same. In order to achieve key point extraction, a key point network can be pre-trained. The embodiment of the present invention does not limit the specific type of the key point network. For example, the key point network can be implemented based on the visual geometry group (Visual Geometry Group, VGG) structure. For ease of explanation, it is assumed that the key point network is net landmark , the first face image is face rgb , the second face image is face ir , then calculate the first key point keypoint rgb The formula is:
[0077] keypoint rgb =net landmark (face rgb )
[0078] Calculate the second keypoint ir The formula is:
[0079] keypoint ir =net landmark (face ir )
[0080] In S402, at least two preset template points are obtained, and a first affine transformation matrix is calculated according to all the first key points and all the template points, and a second affine transformation matrix is calculated according to all the second key points and all the template points.
[0081] Corresponding to the first key point and the second key point, at least two template points corresponding to the preset template points are obtained. The key points are of the same type as the template points, that is, when the types of key points include left eye, right eye and mouth, the types of template points also include left eye, right eye and mouth. For the sake of convenience, the following text also describes the situation where the types of template points include left eye, right eye and mouth. When obtaining the template points, at least two RGB images and at least two infrared images in the open source face image library are uniformly normalized to a preset image size (for example, the preset image size is set to 1024×768), and the template points in all normalized images are identified, and the average value of the image coordinates where the template points are located is used as the final template point. For example, the image coordinates of the left eye in all normalized images are first calculated, and then the image coordinates corresponding to all left eyes are averaged to obtain the template point corresponding to the left eye, and so on. Among them, when the image coordinates of the normalized image at the template point are calculated, the key point network can be called or other methods can be used for identification. It is worth mentioning that in order to improve the accuracy of the determined template points, after normalizing the images in the open source face image library to a preset image size, the normalized images can also be adjusted so that the contour center of the face in the normalized image is the same as the image center. The adjustment can be achieved by manual adjustment or other methods, and the embodiments of the present invention are not limited to this.
[0082] After all template points are acquired, the first affine transformation matrix is calculated based on all first key points and all template points, and the second affine transformation matrix is calculated based on all second key points and all template points, wherein the affine transformation is a linear transformation from one two-dimensional coordinate to another two-dimensional coordinate, and the affine transformation matrix is the transformation basis of the affine transformation. In an embodiment of the present invention, the first affine transformation matrix and the second affine transformation matrix are calculated by the getAffineTransform() function by taking all first key points or all second key points as the original coordinates and all template points as the target coordinates. For ease of explanation, assume that keypoints rgb is the set of all first key points, keypoints ir is the set of all second key points, keypoints template is the set of all template points, then calculate the first affine transformation matrix M rgb The formula is:
[0083] M rgb =getAffineTransform(keypoints rgb ,keypoints template )
[0084] Calculate the second affine transformation matrix Mir The formula is:
[0085] M ir =getAffineTransform(keypoints ir ,keypoints template )
[0086] In S403, an affine transformation is performed on the first facial image according to the first affine transformation matrix to obtain the first aligned image, and an affine transformation is performed on the second facial image according to the second affine transformation matrix to obtain the second aligned image.
[0087] In the embodiment of the present invention, the warpAffine() function is used to implement affine transformation based on the affine transformation matrix. Specifically, the first face image is affine transformed according to the obtained first affine transformation matrix to obtain a first aligned image. Assume that the first aligned image is std_face rgb , then the formula is:
[0088] std_face rgb =warpAffine(face rgb ,M rgb )
[0089] Assume the second aligned image is std_face ir , then the formula is:
[0090] std_face ir =warpAffine(face ir ,M ir )
[0091] Among them, since the template points are obtained based on the normalized image, the sizes of the first aligned image and the second aligned image finally obtained are both preset image sizes, which is convenient for subsequent standardized and unified feature point extraction.
[0092] pass Figure 4It can be seen from the illustrated embodiment that in the embodiment of the present invention, at least two first key points are obtained by extracting key points from the first face image, and at least two second key points are obtained by extracting key points from the second face image, at least two preset template points are obtained, and a first affine transformation matrix is calculated based on all first key points and all template points, a second affine transformation matrix is calculated based on all second key points and all template points, an affine transformation is performed on the first face image according to the first affine transformation matrix to obtain a first aligned image, and an affine transformation is performed on the second face image according to the second affine transformation matrix to obtain a second aligned image. The embodiment of the present invention achieves image correction by performing affine transformation on the first face image and the second face image, and makes the sizes of the first aligned image and the second aligned image both fixed preset image sizes, thereby improving the accuracy of subsequent feature point extraction.
[0093] Figure 5 As shown in FIG. 1 , a method is obtained by refining the process of obtaining facial feature parameters by fusing and analyzing the first aligned image and the second aligned image based on the first embodiment of the present invention. The embodiment of the present invention provides a flow chart for implementing the facial comparison method, as shown in FIG. Figure 5 As shown, the face comparison method may include the following steps:
[0094] In S501, a fused image is constructed based on the first aligned image and the second aligned image, wherein the fused image includes four image channels, pixel values of the first image channel are the same as pixel values of the second aligned image, pixel values of the second image channel are the same as pixel values of the first aligned image on a blue channel, pixel values of the third image channel are the same as pixel values of the first aligned image on a green channel, and pixel values of the fourth image channel are the same as pixel values of the first aligned image on a red channel.
[0095] In an embodiment of the present invention, information fusion may be to construct a fused image based on the first aligned image and the second aligned image, so that the fused image covers all information of the first aligned image and the second aligned image. Compared with the first aligned image which only contains three image channels of red, green and blue, the constructed fused image includes four image channels, wherein the pixel value of the first image channel of the fused image is the same as the pixel value of the second aligned image, the pixel value of the second image channel of the fused image is the same as the pixel value of the first aligned image on the blue channel, the pixel value of the third image channel of the fused image is the same as the pixel value of the first aligned image on the green channel, and the pixel value of the fourth image channel of the fused image is the same as the pixel value of the first aligned image on the red channel.
[0096] In S502, the fused image is subjected to mean subtraction, and feature value extraction is performed on the fused image after mean subtraction to obtain the facial feature parameters.
[0097] After the fusion image is constructed, the fusion image is subjected to a mean subtraction operation to improve the uniformity of the fusion image. Then, feature value extraction is performed on the fusion image after mean subtraction to obtain facial feature parameters. Similarly, feature value extraction can be achieved through neural networks, scale-invariant feature transform (SIFT) algorithm or stable feature acceleration (SURF) algorithm.
[0098] pass Figure 5 It can be seen from the shown embodiment that in the embodiment of the present invention, a fused image is constructed based on the first aligned image and the second aligned image, the mean is subtracted from the fused image, and feature value extraction is performed on the fused image after the mean is subtracted to obtain facial feature parameters, and by performing information fusion on the first aligned image and the second aligned image, the feature value extraction process is oriented to both RGB data and infrared data, thereby improving the accuracy of feature value extraction.
[0099] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0100] Corresponding to the face comparison method described in the above embodiment, Figure 7 FIG. 1 shows a structural block diagram of a face comparison device provided by an embodiment of the present invention, referring to FIG. Figure 7 , the face comparison device comprises:
[0101] The detection unit 71 is used to obtain the user RGB image and the user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze the face collection area according to the output result of the face detection network;
[0102] an alignment unit 72, configured to perform face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, perform face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and perform face alignment on the first face image and the second face image respectively, determine the aligned first face image as a first aligned image, and determine the aligned second face image as a second aligned image;
[0103] A comparison unit 73 is used to perform a fusion analysis on the first aligned image and the second aligned image to obtain a facial feature parameter, and compare the facial feature parameter with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0104] The output unit 74 is configured to output the registered image corresponding to the similarity with the largest value as a result of face comparison if the similarity with the largest value exceeds a preset threshold.
[0105] Optionally, the detection unit 71 includes:
[0106] an area acquisition unit, configured to acquire an RGB acquisition area corresponding to the user's RGB image output by the face detection network, and acquire an infrared acquisition area corresponding to the user's infrared image output by the face detection network, wherein the number of each of the RGB acquisition area and the infrared acquisition area is at least one;
[0107] A union processing unit is used to perform union processing on the RGB acquisition area and the infrared acquisition area to obtain at least one union area, and determine the union area with the largest area as the face acquisition area.
[0108] Optionally, the union processing unit further includes:
[0109] An analysis unit, used for analyzing an intersection area corresponding to each of the union areas, wherein the intersection area is obtained by performing intersection processing on the RGB acquisition area and the infrared acquisition area;
[0110] an execution unit, configured to, if the area ratios between all the intersection areas and the corresponding union areas are greater than a preset offset threshold, execute the operation of determining the union area with the largest area as the face collection area;
[0111] The re-collection unit is configured to output a re-collection prompt if the area ratio between any of the intersection regions and the corresponding union region is less than or equal to the offset threshold.
[0112] Optionally, the alignment unit 72 includes:
[0113] A key point extraction unit, configured to extract key points from the first face image to obtain at least two corresponding first key points, and to extract key points from the second face image to obtain at least two corresponding second key points;
[0114] A matrix calculation unit, used for obtaining at least two preset template points, and calculating a first affine transformation matrix according to all the first key points and all the template points, and calculating a second affine transformation matrix according to all the second key points and all the template points;
[0115] An affine transformation unit is used to perform an affine transformation on the first face image according to the first affine transformation matrix to obtain the first aligned image, and to perform an affine transformation on the second face image according to the second affine transformation matrix to obtain the second aligned image.
[0116] Optionally, the comparison unit 73 includes:
[0117] a construction unit, configured to construct a fused image based on the first aligned image and the second aligned image, wherein the fused image comprises four image channels, a pixel value of a first image channel is the same as a pixel value of the second aligned image, a pixel value of a second image channel is the same as a pixel value of the first aligned image on a blue channel, a pixel value of a third image channel is the same as a pixel value of the first aligned image on a green channel, and a pixel value of a fourth image channel is the same as a pixel value of the first aligned image on a red channel;
[0118] The mean subtraction unit is used to perform mean subtraction on the fused image, and perform feature value extraction on the fused image after mean subtraction to obtain the facial feature parameters.
[0119] Optionally, if only the user RGB image is acquired, the detection unit 71 includes:
[0120] The grayscale processing unit is used to perform grayscale processing on the user RGB image, and determine the user RGB image after grayscale processing as the user infrared image.
[0121] Therefore, the face comparison device provided in the embodiment of the present invention reduces the influence of the lighting environment on the face comparison and improves the accuracy of the face comparison by comprehensively analyzing the RGB image and the infrared image.
[0122] Figure 8 Schematic diagram of a terminal device provided by an embodiment of the present invention. Figure 8 As shown, the terminal device 8 of this embodiment includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80, such as a face comparison program. When the processor 80 executes the computer program 82, the steps in the above-mentioned face comparison method embodiments are implemented, such as Figure 1Alternatively, when the processor 80 executes the computer program 82, the functions of each unit in the above-mentioned face comparison device embodiments are realized, for example, Figure 7 The functions of the units 71 to 74 are shown.
[0123] Exemplarily, the computer program 82 may be divided into one or more units, which are stored in the memory 81 and executed by the processor 80 to complete the present invention. The one or more units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 82 in the terminal device 8. For example, the computer program 82 may be divided into a detection unit, an alignment unit, a comparison unit, and an output unit, and the specific functions of each unit are as follows:
[0124] A detection unit, used to obtain a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network;
[0125] an alignment unit, configured to perform face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, perform face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and perform face alignment on the first face image and the second face image respectively, determine the aligned first face image as a first aligned image, and determine the aligned second face image as a second aligned image;
[0126] a comparing unit, configured to perform a fusion analysis on the first aligned image and the second aligned image to obtain a facial feature parameter, and compare the facial feature parameter with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image;
[0127] The output unit is used to output the registered image corresponding to the similarity with the largest value as the result of face comparison if the similarity with the largest value exceeds a preset threshold.
[0128] The terminal device 8 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 80 and a memory 81. Those skilled in the art will appreciate that Figure 8 It is only an example of the terminal device 8 and does not constitute a limitation of the terminal device 8. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0129] The processor 80 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0130] The memory 81 may be an internal storage unit of the terminal device 8, such as a hard disk or memory of the terminal device 8. The memory 81 may also be an external storage device of the terminal device 8, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 8. Further, the memory 81 may also include both an internal storage unit and an external storage device of the terminal device 8. The memory 81 is used to store the computer program and other programs and data required by the terminal device. The memory 81 may also be used to temporarily store data that has been output or is to be output.
[0131] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units as needed, that is, the internal structure of the terminal device can be divided into different functional units to complete all or part of the functions described above. The functional units in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0132] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0133] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0134] In the embodiments provided by the present invention, it should be understood that the disclosed terminal device and method can be implemented in other ways. For example, the terminal device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0135] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0136] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0137] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0138] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A face comparison method, characterized in that: include: Acquire a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network; Performing face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, performing face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and performing face alignment on the first face image and the second face image respectively, determining the aligned first face image as a first aligned image, and determining the aligned second face image as a second aligned image; Performing a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image; If the similarity with the largest value exceeds a preset threshold, outputting the registered image corresponding to the similarity with the largest value as a result of face comparison; The step of comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities includes: constructing a feature matrix based on all preset feature parameters, and performing similarity calculation between the facial feature parameters and the feature matrix to obtain a similarity vector, and if the element with the largest value in the similarity vector exceeds the preset threshold, outputting the registered image corresponding to the element as the result of the facial comparison; The performing face alignment on the first face image and the second face image respectively includes: Extracting key points from the first face image to obtain at least two corresponding first key points, and extracting key points from the second face image to obtain at least two corresponding second key points; Acquire at least two preset template points, and calculate a first affine transformation matrix according to all the first key points and all the template points, and calculate a second affine transformation matrix according to all the second key points and all the template points; wherein the key points and the template points are of the same type; The first facial image is affine transformed according to the first affine transformation matrix to obtain the first aligned image, and the second facial image is affine transformed according to the second affine transformation matrix to obtain the second aligned image.
2. The face comparison method according to claim 1, characterized in that: The step of inputting the user RGB image and the user infrared image into a preset face detection network, and analyzing the face collection area according to the output result of the face detection network, comprises: Obtaining an RGB acquisition area corresponding to the user's RGB image output by the face detection network, and obtaining an infrared acquisition area corresponding to the user's infrared image output by the face detection network, wherein the number of each of the RGB acquisition area and the infrared acquisition area is at least one; The RGB acquisition area and the infrared acquisition area are combined to obtain at least one combined area, and the combined area with the largest area is determined as the face acquisition area.
3. The face comparison method according to claim 2, characterized in that: Before determining the largest union area as the face collection area, the method further includes: Analyze the intersection area corresponding to each of the union areas, where the intersection area is obtained by performing intersection processing on the RGB acquisition area and the infrared acquisition area; If the area ratios between all the intersection regions and the corresponding union regions are greater than a preset offset threshold, the operation of determining the union region with the largest area as the face collection region is performed; If the area ratio between any of the intersection regions and the corresponding union region is less than or equal to the offset threshold, a prompt for re-collection is output.
4. The face comparison method according to claim 1, characterized in that: The step of fusing and analyzing the first aligned image and the second aligned image to obtain facial feature parameters includes: constructing a fused image based on the first aligned image and the second aligned image, wherein the fused image includes four image channels, a pixel value of a first image channel is the same as a pixel value of the second aligned image, a pixel value of a second image channel is the same as a pixel value of the first aligned image on a blue channel, a pixel value of a third image channel is the same as a pixel value of the first aligned image on a green channel, and a pixel value of a fourth image channel is the same as a pixel value of the first aligned image on a red channel; The fused image is subjected to mean subtraction, and feature value extraction is performed on the fused image after mean subtraction to obtain the facial feature parameters.
5. The face comparison method according to claim 1, characterized in that: If only the user RGB image is acquired, the step of acquiring the simultaneously acquired user RGB image and user infrared image includes: Grayscale processing is performed on the user RGB image, and the user RGB image after the grayscale processing is determined as the user infrared image.
6. A face comparison device, characterized in that: include: A detection unit, used to obtain a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network; an alignment unit, configured to perform face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, perform face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and perform face alignment on the first face image and the second face image respectively, determine the aligned first face image as a first aligned image, and determine the aligned second face image as a second aligned image; a comparison unit, configured to perform a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and compare the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image; the comparison of the facial feature parameters with at least two preset feature parameters to obtain at least two similarities comprises: constructing a feature matrix based on all preset feature parameters, and performing similarity calculation on the facial feature parameters and the feature matrix to obtain a similarity vector, and if the element with the largest value in the similarity vector exceeds a preset threshold, outputting the registered image corresponding to the element as the result of the face comparison an output unit, configured to output the registered image corresponding to the similarity with the largest value as a result of face comparison if the similarity with the largest value exceeds a preset threshold; The alignment unit comprises: A key point extraction unit, configured to extract key points from the first face image to obtain at least two corresponding first key points, and to extract key points from the second face image to obtain at least two corresponding second key points; A matrix calculation unit, used to obtain at least two preset template points, and calculate a first affine transformation matrix according to all the first key points and all the template points, and calculate a second affine transformation matrix according to all the second key points and all the template points; wherein the key points and the template points are of the same type; An affine transformation unit is used to perform an affine transformation on the first face image according to the first affine transformation matrix to obtain the first aligned image, and to perform an affine transformation on the second face image according to the second affine transformation matrix to obtain the second aligned image.
7. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the following steps when executing the computer program: Acquire a user RGB image and a user infrared image collected simultaneously, input the user RGB image and the user infrared image into a preset face detection network, and analyze a face collection area according to an output result of the face detection network; Performing face acquisition on the user RGB image based on the face acquisition area to obtain a first face image, performing face acquisition on the user infrared image based on the face acquisition area to obtain a second face image, and performing face alignment on the first face image and the second face image respectively, determining the aligned first face image as a first aligned image, and determining the aligned second face image as a second aligned image; Performing a fusion analysis on the first aligned image and the second aligned image to obtain facial feature parameters, and comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities, wherein each preset feature parameter corresponds to a registered image; If the similarity with the largest value exceeds a preset threshold, outputting the registered image corresponding to the similarity with the largest value as a result of face comparison; The step of comparing the facial feature parameters with at least two preset feature parameters to obtain at least two similarities includes: constructing a feature matrix based on all preset feature parameters, and performing similarity calculation between the facial feature parameters and the feature matrix to obtain a similarity vector, and if the element with the largest value in the similarity vector exceeds the preset threshold, outputting the registered image corresponding to the element as the result of the facial comparison; The performing face alignment on the first face image and the second face image respectively includes: Extracting key points from the first face image to obtain at least two corresponding first key points, and extracting key points from the second face image to obtain at least two corresponding second key points; Acquire at least two preset template points, and calculate a first affine transformation matrix according to all the first key points and all the template points, and calculate a second affine transformation matrix according to all the second key points and all the template points; wherein the key points and the template points are of the same type; The first facial image is affine transformed according to the first affine transformation matrix to obtain the first aligned image, and the second facial image is affine transformed according to the second affine transformation matrix to obtain the second aligned image.
8. The terminal device according to claim 7, characterized in that: The step of fusing and analyzing the first aligned image and the second aligned image to obtain facial feature parameters includes: constructing a fused image based on the first aligned image and the second aligned image, wherein the fused image includes four image channels, a pixel value of a first image channel is the same as a pixel value of the second aligned image, a pixel value of a second image channel is the same as a pixel value of the first aligned image on a blue channel, a pixel value of a third image channel is the same as a pixel value of the first aligned image on a green channel, and a pixel value of a fourth image channel is the same as a pixel value of the first aligned image on a red channel; The fused image is subjected to mean subtraction, and feature value extraction is performed on the fused image after mean subtraction to obtain the facial feature parameters.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the face comparison method according to any one of claims 1 to 5 are implemented.
