Face image recognition method, device, electronic device and storage medium

By obtaining the global and local features of the face image, adjusting the feature weights according to the occlusion ratio, and combining global and local features for identity recognition, the problem of low facial recognition accuracy in the occlusion scene is solved, and the recognition accuracy and lunarity are improved Great.

CN113657195BActive Publication Date: 2024-11-05ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110851821.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-27
Publication Date
2024-11-05
Estimated Expiration
2041-07-27

AI Technical Summary

Technical Problem

The prior art has low accuracy in occlusion scenarios, and has failed to effectively solve the problem of recognition accuracy when face recognition is recognized by the entire face image.

Method used

By acquiring the global and local features of the face image, the local face feature weight is determined based on the occlusion ratio of the local image, and identity recognition is performed by combining global and local features. Convolutional neural network model training is used to adjust the feature weights to improve the recognition accuracy .

Benefits of technology

It improves the accuracy of face recognition in occlusion scenarios, enhances the robustness of recognition, and solves the problem of low recognition accuracy under the influence of occlusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113657195B_ABST
    Figure CN113657195B_ABST
Patent Text Reader

Abstract

The present application relates to a facial image recognition method, equipment, electronic device and storage medium, wherein the facial image recognition method comprises: obtaining a first facial image, extracting global facial features and multiple local facial features of the first facial image, wherein the multiple local facial features correspond to multiple local images of the first facial image respectively; determining the local facial feature weights of the local facial features corresponding to each local image according to the occlusion ratio of each local image; identifying the identity corresponding to the first facial image according to the global facial features, multiple local facial features and multiple local facial feature weights. Through the present application, the problem of low recognition accuracy in occlusion scenes when performing facial recognition through the entire facial image in the related art is solved, and the accuracy of facial image recognition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a facial image recognition method, equipment, electronic device and storage medium. Background Art

[0002] Face recognition technology is a biometric technology that extracts features from a person's face and identifies the person. Early face recognition technology extracted feature information from a person's face through artificially designed features combined with machine learning and image processing methods, and obtained face similarity by comparing facial feature information, but this method is difficult to use in complex and unrestricted scenarios. In recent years, with the rise of deep learning technology, face recognition technology has made great progress and development. The emergence of convolutional neural networks (CNNs) enables the model to extract more abstract feature information from the face, so face recognition methods based on deep learning can greatly improve the accuracy of face recognition.

[0003] In related technologies, features are extracted from the entire face image through a trained model, and then face recognition is achieved based on the extracted features. This method has a high recognition rate in scenes where the face is not obstructed, but if the face is obstructed, some facial information will be lost, thus affecting the recognition result. Therefore, the recognition rate of this method will decrease in scenes where the face is obstructed.

[0004] Currently, no effective solution has been proposed for the problem of low recognition accuracy in occluded scenes for face recognition using the entire face image in related technologies. Summary of the invention

[0005] The embodiments of the present application provide a facial image recognition method, device, electronic device and storage medium to at least solve the problem in the related art of performing facial recognition through the entire facial image and having low recognition accuracy in occluded scenes.

[0006] In a first aspect, an embodiment of the present application provides a facial image recognition method, comprising:

[0007] Acquire a first facial image, and extract global facial features and a plurality of local facial features of the first facial image, wherein the plurality of local facial features respectively correspond to a plurality of local images of the first facial image;

[0008] Determining the local facial feature weights of the local facial features corresponding to the local images according to the occlusion ratios of the local images;

[0009] The identity corresponding to the first facial image is identified according to the global facial feature, the multiple local facial features, and the multiple local facial feature weights.

[0010] In some embodiments, extracting the global facial features and the plurality of local facial features of the first facial image comprises:

[0011] Extracting facial key points from the first facial image, and cropping the first facial image into a plurality of partial images according to the facial key points corresponding to a preset facial recognition area;

[0012] For each of the partial images, the corresponding local facial features are extracted by using a local feature model corresponding to the partial image.

[0013] In some embodiments, determining the local facial feature weight of the local facial feature corresponding to each of the local images according to the occlusion ratio of each of the local images includes:

[0014] For each of the local images, obtaining the occlusion ratio of the local image through the corresponding local feature model;

[0015] Determining an occlusion confidence corresponding to the partial image according to the occlusion ratio;

[0016] The local facial feature weight is determined according to the occlusion confidence.

[0017] In some embodiments, identifying the identity corresponding to the first facial image according to the global facial feature, the plurality of local facial features, and the plurality of local facial feature weights includes:

[0018] Calculating a local similarity weight of a local facial feature group according to the local facial feature weights in the first facial image and the corresponding local facial feature weights in the second facial image and a preset local similarity coefficient;

[0019] Calculating the similarity between the first facial image and the second facial image according to the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights, and the local similarity weights;

[0020] It is determined based on the similarity whether the identity corresponding to the first facial image and the identity corresponding to the second facial image are consistent.

[0021] In some embodiments, the calculating the similarity between the first facial image and the second facial image according to the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights and the local similarity weights comprises:

[0022] Determining the local similarity corresponding to the local facial feature group according to the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, and the local similarity weight;

[0023] Determining global similarity based on a cosine distance between a global facial feature in the first facial image and a global facial feature in the second facial image, and a weight of the global facial feature;

[0024] The global similarity is superimposed with the multiple local similarities and normalized to obtain the similarity between the face in the first face image and the second face image.

[0025] In some embodiments, before acquiring the first facial image, the method includes training a facial image recognition model, wherein the training facial image recognition model includes:

[0026] Acquire a training image, extract global facial features of the training image through a global sub-model, and extract multiple local facial features through a local sub-model, wherein the multiple local facial features correspond to multiple local images of the first facial image respectively;

[0027] Based on the local sub-model, according to the occlusion ratio in the local image, determining the local facial feature weights of the local facial features corresponding to each of the local images;

[0028] The global facial feature weights in the global sub-model are adjusted until the loss value of the global sub-model converges, and the local facial feature weights of the local sub-model are adjusted until the loss value of the local sub-model converges.

[0029] In some embodiments, determining the local facial feature weight of the local facial feature corresponding to each of the local images according to the occlusion ratio of each of the local images includes:

[0030] The local facial feature weights of the local facial features corresponding to each of the local images are determined according to the occlusion ratio of each of the local images and at least one of the occlusion color and the occlusion shape.

[0031] In a second aspect, an embodiment of the present application provides a face image recognition device, including an acquisition module, a determination module and a judgment module:

[0032] The acquisition module is used to acquire a first facial image, and extract global facial features and a plurality of local facial features of the first facial image, wherein the plurality of local facial features respectively correspond to a plurality of local images of the first facial image;

[0033] The determination module is used to determine the local facial feature weights of the local facial features corresponding to each of the local images according to the occlusion ratio of each of the local images;

[0034] The judgment module is used to identify the identity corresponding to the first facial image according to the global facial features, the multiple local facial features and the multiple local facial feature weights.

[0035] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the facial image recognition method as described in the first aspect above is implemented.

[0036] In a fourth aspect, an embodiment of the present application provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the facial image recognition method as described in the first aspect above is implemented.

[0037] Compared with the related art, the face image recognition method provided in the embodiment of the present application obtains a first face image, extracts global face features and multiple local face features of the first face image, wherein the multiple local face features respectively correspond to multiple local images of the first face image; determines the local face feature weights of the local face features corresponding to each local image according to the occlusion ratio of each local image; identifies the identity corresponding to the first face image according to the global face features, multiple local face features and multiple local face feature weights, thereby solving the problem of low recognition accuracy in occlusion scenarios when performing face recognition through the entire face image in the related art, and improving the accuracy of face image recognition.

[0038] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0040] Figure 1 is a flow chart of a facial image recognition method according to an embodiment of the present application;

[0041] Figure 2 is a flow chart of a method for obtaining local facial features according to an embodiment of the present application;

[0042] Figure 3 is a flow chart of a method for similarity calculation according to an embodiment of the present application;

[0043] Figure 4 A flowchart of a method for training a face image recognition model according to an embodiment of the present application;

[0044] Figure 5 is a structural schematic diagram of a face recognition model according to an embodiment of the present application;

[0045] Figure 6 is a structural schematic diagram of face image recognition according to a preferred embodiment of the present application;

[0046] Figure 7 This is a hardware structure block diagram of a terminal of the face image recognition method according to an embodiment of the present application;

[0047] Figure 8 It is a structural block diagram of a face image recognition device according to an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0049] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0050] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0051] In different scenarios, parts of a person's face are often blocked by glasses, masks, or even bangs. If target recognition is only based on the entire face and the impact of the blocked part on the similarity calculation is ignored, the accuracy of facial image recognition will be greatly reduced.

[0052] This embodiment provides a facial image recognition method. Figure 1 is a flowchart of a face image recognition method according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0053] Step S110, obtaining a first facial image, extracting global facial features and multiple local facial features of the first facial image, wherein the multiple local facial features correspond to multiple local images of the first facial image respectively.

[0054] The first facial image in this embodiment can be obtained from a surveillance image captured by a camera, or can be obtained through a surveillance video of a camera, or can be a facial image pre-stored in a facial database. After obtaining the first facial image, the global facial features and local facial features of the first facial image are extracted through different convolutional neural networks. Among them, the global facial features are obtained based on the entire first facial image, integrating all facial information of the entire first facial image, and the local facial features are obtained based on a partial area of ​​the first facial image, and more detailed facial information can be extracted. In this embodiment, the first facial image will be divided into multiple local images, and a corresponding local facial feature will be extracted for each local image. Therefore, for multiple local images, multiple local facial features can be obtained.

[0055] Specifically, the local image in this embodiment may be the forehead, eyebrows, eyes, nose, mouth, chin, etc. For example, if the forehead, eyes, nose and mouth are selected as the local images, then in the forehead, eyes, nose and mouth regions of the face image, local face features corresponding to the forehead, local face features corresponding to the eyes, and local face features corresponding to the nose and mouth are extracted accordingly.

[0056] Step S120, determining the local facial feature weights of the local facial features corresponding to each local image according to the occlusion ratio of each local image.

[0057] Among them, the occlusion ratio is the ratio of the area of ​​the occluded part of the local image to the area of ​​the entire local image. The higher the occlusion ratio, the lower the corresponding local face feature weight, that is, the occlusion ratio is inversely proportional to the local face feature weight. The specific proportional relationship can be adjusted according to different scenes to obtain the optimal similarity calculation result. The process of determining the local face feature weight according to the occlusion ratio can be obtained through training of the convolutional neural network model.

[0058] For example, when the face recognition area is set to the forehead, eyes, nose and mouth, the forehead partial image, the eye partial image, and the nose and mouth partial image can be obtained based on the face image. For each partial image, its occlusion ratio is calculated. Finally, the local face feature weights of the forehead, the eyes, and the nose and mouth are determined according to the occlusion ratio in each partial image, so as to obtain multiple local face feature weights.

[0059] Step S130, identifying the identity corresponding to the first facial image according to the global facial features, the multiple local facial features and the multiple local facial feature weights.

[0060] When performing identity recognition on the first facial image, it is necessary to compare it with the second facial image used as a reference. If the second facial image is obtained from a surveillance image or surveillance video, it is necessary to extract global facial features and local facial features, and calculate the weights of the local facial features. If the second facial image is obtained from a face database, its global facial features, local facial features and local facial feature weights can be obtained from the face database at the same time. This is because the global facial features, local facial features and local facial feature weights of the face images in the face image library have been calculated in advance, so they can be directly obtained.

[0061] In this embodiment, the similarity can be calculated based on the global facial features, multiple local facial features, and multiple local facial feature weights in the first facial image, and the global facial features, multiple local facial features, and multiple local facial feature weights in the second facial image, and whether the identities corresponding to the faces in the first facial image and the second facial image are consistent can be determined based on the similarity.

[0062] Furthermore, when comparing the identities in the first face image and the second face image, the global face feature weights may also be considered. The global face feature weights may be set according to different scenarios to obtain the best similarity calculation effect. Specifically, the higher the similarity, the higher the consistency between the identity corresponding to the first face image and the identity corresponding to the second face image. The different scenarios may be the intensity of light, the angle between the human body and the camera or video camera, the density of the crowd, etc.

[0063] Furthermore, multiple local facial features and multiple local facial feature weights correspond one to one. For example, the local facial features corresponding to the forehead area have the local facial feature weights of the forehead area, and the local facial features corresponding to the eye area have the local facial feature weights of the eye area. Different local facial features have different local facial feature weights.

[0064] Through the above steps S110 to S130, the present embodiment evaluates the occlusion ratio of the local image and can flexibly give the local facial feature weights of the local image, making facial image recognition more robust. Therefore, the face recognition method in the present embodiment solves the problem of low recognition accuracy in occlusion scenarios when performing face recognition through the entire face image in the related art, thereby improving the accuracy of facial image recognition.

[0065] Preferably, before extracting the global facial features of the facial image, the facial image needs to be preprocessed, such as scaling, alignment, etc., and grayscale transformation can be performed if necessary to unify the format of the facial image and improve the processing speed and similarity calculation accuracy of the facial image.

[0066] In some of the embodiments, the local facial feature weights of the local facial features corresponding to each local image are determined based on the occlusion ratio of each local image and at least one of the occlusion color and the occlusion shape.

[0067] Specifically, considering that human faces are usually obstructed by bangs, sunglasses, masks and other obstructions, these obstructions have differences in size, color, degree of reflectivity, etc., which will affect the similarity calculation. Ignoring the occlusion situation and directly calculating the similarity between different face images will reduce the accuracy. Therefore, in this embodiment, the occlusion attribute is taken into consideration, where the occlusion attribute is used to represent the occlusion situation in the local image. Specifically, the occlusion attribute includes the occlusion ratio and / or the occlusion object characteristics. In each local image, the local face feature weight of the local face feature corresponding to the local image is determined according to the occlusion ratio and / or the occlusion object characteristics of the local image. In the case of different occlusion attributes, for example, the occlusion ratio increases or decreases, the occlusion object characteristics change, and the local face feature weight will also change accordingly.

[0068] The occluder characteristics are the characteristics of the occluder itself, such as shape, color, etc. The influence of the occluder characteristics on the weights of local facial features needs to be set according to the actual scene. For example, the local facial feature weights corresponding to round glasses are usually greater than those corresponding to square glasses, and the local facial feature weights corresponding to dark lenses are usually smaller than those corresponding to light lenses. The specific correspondence between the occluder characteristics and the local facial feature weights needs to be set according to the actual scene. Furthermore, when considering the occlusion ratio and occluder characteristics at the same time, the influence coefficients of the occlusion ratio and occluder characteristics on the local facial features need to be set according to the specific actual scene. The process of determining the weights of local facial features based on the occlusion ratio and occluder characteristics can be obtained through training of the convolutional neural network model.

[0069] In this embodiment, multiple factors are taken into consideration to flexibly adjust the weights of local facial features to obtain more accurate recognition results.

[0070] In some of these embodiments, Figure 2 is a flow chart of a method for obtaining local facial features according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0071] Step S210, extracting facial key points from the first facial image, and cropping the first facial image into a plurality of partial images according to the facial key points corresponding to the preset facial recognition areas.

[0072] In this embodiment, multiple face recognition areas are preset, and local images are obtained based on the face recognition areas. Specifically, the face recognition areas in this embodiment can be set to the forehead, eyebrows, eyes, nose, mouth, chin, etc. After the face recognition areas are set, the corresponding local images can be obtained in the first face image based on the face recognition areas. For example, if the face recognition areas are the forehead, eyes, and nose, the first face image is divided into local areas corresponding to the forehead, eyes, and nose, respectively.

[0073] After acquiring the face image, the key points in the face image are extracted by a face key point detection algorithm. Specifically, the face key point detection algorithm can be 21-point key point detection, 68-point key point detection, or 81-point key point detection. Then, based on the face alignment technology, the key points corresponding to the preset face recognition area are detected from the key points of the face image, and the face image is cropped according to the detected key points to obtain multiple partial images.

[0074] For example, the key points corresponding to the forehead, eyes, nose and mouth are extracted from all the key points of the face image, and then the forehead area, eye area and nose and mouth area in the face image are identified. Finally, the forehead area, eye area and nose and mouth area in the face image are cropped to obtain multiple local images.

[0075] Step S220: for each partial image, extract the corresponding local facial features through the local feature model corresponding to the partial image.

[0076] In this embodiment, each local image corresponds to a local feature model. When extracting local facial features, it is implemented through the corresponding local feature model, that is, the forehead local image has a specific forehead feature model, the eye local image has a specific glasses feature model, and the nose and mouth local image has a specific nose and mouth feature model.

[0077] Through the above-mentioned steps S210 and S220, this embodiment crops the face image into multiple local images based on facial key point detection and alignment, and then uses different local feature models to extract corresponding local facial features. Since the local feature model is trained for a specific face recognition area, it can better identify the corresponding local facial features. Therefore, this embodiment extracts the corresponding local facial features based on multiple local feature models, and the recognition result based on the fusion of multiple local feature models can improve the recognition accuracy of the facial identity in the first face image.

[0078] In some of the embodiments, the method for determining the weight of the local facial feature is specifically as follows: for each local image, the occlusion ratio of the local image is obtained through the corresponding local feature model, wherein the occlusion ratio is the ratio of the area of ​​the occluded part of the local image to the area of ​​the entire local image. Specifically, the occluded part can be identified by the color features of the pixels in the local image and the area of ​​the connected domain, and then the occluded area in the local image and the area of ​​the entire local image are calculated, and finally the occlusion ratio is obtained; then the occlusion confidence corresponding to the local image is determined according to the occlusion ratio, and the local facial feature weight is determined according to the occlusion confidence and the characteristics of the occluder. Among them, the occlusion confidence is used to indicate the credibility of the local image under occlusion. The higher the occlusion ratio, the lower the occlusion confidence. The corresponding relationship between the occlusion ratio and the occlusion confidence can be set by an engineer or obtained through training of a convolutional neural network model. Furthermore, when only the occlusion ratio is considered, the occlusion confidence can be directly used as the local face feature weight. When the occlusion attributes need to be considered, the coefficient of the occlusion confidence can be set again, and then the local face feature weight can be determined together with the occlusion attributes.

[0079] In this embodiment, the weights of local facial features are determined specifically by the occlusion ratio, and the weights of local facial features can be flexibly adjusted according to the severity of the occlusion in the local image. When the occlusion in the local image is more serious, for example, the nose and mouth are completely blocked by the mask, the weight of the local facial feature of this part can be set to 0, and it does not participate in the similarity calculation to avoid affecting the overall similarity calculation result. Therefore, the method of determining the weights of local facial features by the occlusion ratio in this embodiment can further improve the accuracy of facial image recognition.

[0080] This embodiment also provides a method for calculating similarity. In the case where the different face images include a first face image and a second face image, Figure 3 is a flow chart of a method for calculating similarity according to an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:

[0081] Step S310, calculating the local similarity weight of the local facial feature group according to the local facial feature weight in the first facial image and the corresponding local facial feature weight in the second facial image and a preset local similarity coefficient.

[0082] In this embodiment, the local facial feature group includes a group of local facial features corresponding to the first facial image and the second facial image. Both the first facial image and the second facial image have multiple local facial features. For example, when the preset facial recognition area is the forehead, eyes, nose and mouth, for each local facial feature, due to the different occlusion conditions in the first facial image and the second facial image, the first facial image and the second facial image have their own local facial feature weights. At this time, it is necessary to first calculate the weights of the corresponding local facial features in different facial images in the entire similarity calculation process, which are recorded as local similarity weights. Specifically, the local similarity weight is obtained by multiplying the local facial feature weights in the first facial image, the corresponding local facial feature weights in the second facial image, and the preset local similarity coefficient.

[0083] Specifically, taking the forehead region as an example, the local facial features corresponding to the forehead region in the first face image and the local facial features corresponding to the forehead region in the second face image are a group of local facial features. According to the weights of the local facial features corresponding to the forehead region in the first face image, the weights of the local facial features corresponding to the forehead region in the second face image, and the preset local similarity coefficient, the local similarity weight corresponding to the forehead region is calculated, wherein the local similarity coefficient is a preset value and can be adjusted according to the actual scene.

[0084] Step S320, calculates the similarity between the first facial image and the second facial image based on the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights and the local similarity weights.

[0085] After obtaining the local similarity weight, the cosine distance is used to calculate the similarity in this embodiment. In other embodiments, the Euclidean distance or the Mahalanobis distance may also be used to calculate the similarity, wherein the cosine distance is to calculate the cosine angle between two features.

[0086] Specifically, in this embodiment, the cosine distances between all corresponding local facial features in the first face image and the second face image are calculated to obtain a plurality of cosine distances corresponding to the local facial feature groups, and the similarity between the first face image and the second face image is obtained based on the plurality of cosine distances corresponding to the local facial feature groups and the cosine distance of the global facial feature. Furthermore, the preset global facial feature weights and the local similarity weights are coefficients of the respective cosine distances.

[0087] Step S330 , judging whether the identity corresponding to the first face image and the identity corresponding to the second face image are consistent based on the similarity.

[0088] In this embodiment, a similarity threshold can be set, and when the similarity between the first face image and the second face image is greater than or equal to the similarity threshold, it is considered that the faces of the first face image and the second face image are the same. Specifically, the similarity threshold can be obtained by training a convolutional neural network model, and can also be adjusted according to actual scenarios.

[0089] Through the above steps S310 to S330, in this embodiment, similarity is calculated based on the cosine distance, which can effectively improve the accuracy of similarity calculation.

[0090] Furthermore, the similarity between the first face image and the second face image can be obtained by the following method: according to the cosine distance between the local face features in the first face image and the corresponding local face features in the second face image, and the local similarity weight, determine the local similarity corresponding to the local face feature group, preferably, determine the local similarity by the product of the cosine distance between the local face features and the local similarity, and when the first face image and the second face image have multiple local face feature groups, this embodiment will also obtain multiple local similarities; then determine the global similarity according to the cosine distance between the global face features in the first face image and the global face features in the second face image, and the global face feature weight, specifically, determine the local similarity by the product of the cosine distance between the global face features and the local similarity; finally, superimpose the global similarity with the multiple local similarities and normalize them to obtain the similarity between the face in the first face image and the second face image.

[0091] For example, the feature extracted from a face image is represented by f, f 1 、f 2 The features in the first face image and the second face image are respectively represented, and the features include global face features and local face features. In this embodiment, f represents the global face feature with subscript 1. When the preset face recognition area includes the forehead, eyes, nose and mouth, subscript 2 represents the local face feature corresponding to the forehead, subscript 3 represents the local face feature corresponding to the eyes, and subscript 4 represents the local face feature corresponding to the nose and mouth. Therefore, the following features can be obtained for the first face image and the second face image: f1 1 , f1 2 ,

[0092] The local face feature weight of each local face feature is represented by P. Similarly, superscript 1 represents the local face feature weight corresponding to the first face image, superscript 2 represents the local face feature weight corresponding to the second face image, subscript 2 represents the local face feature weight corresponding to the forehead, subscript 3 represents the local face feature weight corresponding to the eyes, and subscript 4 represents the local face feature weight corresponding to the nose and mouth. Therefore, P2 1 、P3 1 、P4 1 、P2 2 、P3 2 、P4 2 .P i j It is determined by the occlusion confidence obtained by the face attribute algorithm, and its value range is [0,1], which can be adjusted dynamically, where i = 1, 2, 3, 4, j = 1, 2. For example, if the face in the second face image is wearing sunglasses, the face attribute algorithm gives a specific P3 based on the size, shape, and color of the sunglasses. 2 The more serious the occlusion, the lower the occlusion confidence, which reduces the proportion of local facial features in the local image in the recognition; for example, if the face in the first face image is not wearing a mask, the face attribute algorithm gives a relatively high occlusion confidence P4 1 , indicating that the local facial features in the local image account for a large proportion in the recognition.

[0093] β1 is the preset global face feature weight, β2, β3, and β4 are preset local similarity coefficients, corresponding to the forehead, eyes, nose, and mouth, respectively. i ∈(0,1), where i=1, 2, 3, 4, β i The value can be adjusted according to the application scenario.

[0094] For example, and That is, a group of local face features, β2, P2 1 With P2 2 The product of is the local similarity weight corresponding to the forehead area. In this embodiment, it can be calculated by the following formula 1 and The cosine distance between

[0095]

[0096] The local similarity weights of each local face feature group are calculated using the following formulas 2 to 4:

[0097]

[0098]

[0099]

[0100] Among them, α2 represents the local similarity weight corresponding to the local facial feature group of the forehead area, α3 represents the local similarity weight corresponding to the local facial feature group of the eye area, and α4 represents the local similarity weight corresponding to the local facial feature group of the nose and mouth area.

[0101] Finally, the similarity between the face in the first face image and the second face image can be calculated by the following formula 5:

[0102]

[0103] In Formula 5, sim represents the similarity between the face in the first face image and the second face image, and the value of α1 is the value of β1, that is, α1=β1, which represents the preset global face feature weight. Specifically, represents the global similarity, represents the local similarity corresponding to the forehead area, represents the local similarity corresponding to the eye region, Indicates the local similarity corresponding to the nose and mouth area.

[0104] In this embodiment, the global similarity is superimposed with multiple local similarities and then normalized, that is, the similarity is calculated by splicing. The dimension of the feature after splicing is equal to the sum of the dimensions of each feature before splicing. The local face feature is not fused with the global face feature, and the independence of each local image in the overall similarity judgment is retained. Compared with calculating the similarity after feature fusion, it can more accurately and intuitively reflect the proportion of each local face feature's contribution to the overall similarity, thereby improving the accuracy of the similarity calculation.

[0105] This application also provides a training method for a face image recognition model. Figure 4 The flowchart of the training method of the face image recognition model according to the embodiment of the present application is as follows: Figure 4 As shown, the method comprises the following steps:

[0106] Step S410, obtaining a training image, extracting global facial features of the training image through a global sub-model, and extracting multiple local facial features through a local sub-model, wherein the multiple local facial features correspond to multiple local images of the first facial image respectively; wherein the training image may be derived from a captured image of a monitoring process or a frame of an image in a monitoring video;

[0107] Step S420, based on the local sub-model and according to the occlusion ratio in the local image, determining the local facial feature weights of the local facial features corresponding to each local image;

[0108] Step S430, adjust the global facial feature weights in the global sub-model until the loss value of the global sub-model converges, and adjust the local facial feature weights of the local sub-model until the loss value of the local sub-model converges.

[0109] The face image recognition model in this embodiment includes a global sub-model and multiple local sub-models. The global sub-model is used to extract features of the entire face, and the loss value includes a recognition loss value. The local sub-model only extracts facial features of specific areas, and the loss value includes a recognition loss value and an occlusion loss value. The losses between different local sub-models do not affect each other.

[0110] For example, when the preset face recognition areas are forehead, eyes, nose and mouth, Figure 5 is a schematic diagram of the structure of a face recognition model according to an embodiment of the present application, such as Figure 5 As shown in the figure, for the face image aligned by the face key points, on the one hand, the complete face image is sent to the global sub-model for feature extraction, and the corresponding convolutional neural network is CNN1. The extracted global face features are sent to the fully connected layer, and after the dimension transformation of the fully connected layer, the loss value is finally calculated through the loss function. The loss value of the global sub-model is represented by Loss1, and the loss value of the global sub-model is used to evaluate the recognition accuracy of the complete face image. On the other hand, the complete face image is cropped according to the face key points to obtain multiple local images, which correspond to the forehead area, eye area, and nose and mouth area respectively. Each local image is sent to the corresponding local sub-model for separate training. The local sub-model of the forehead area is represented by CNN2, the local sub-model of the eye area is represented by CNN3, and the local sub-model of the nose and mouth area is represented by CNN4. For each local sub-model, after extracting the local face features and calculating through the fully connected layer, its recognition loss value and occlusion loss value are calculated respectively, wherein the recognition loss value of the local sub-model is used to evaluate the recognition accuracy in the local image, and the occlusion loss value of the local sub-model is used to evaluate the accuracy of the occlusion attribute calculation in the local image. The recognition loss value and occlusion loss value of each local sub-model are represented by Loss2, Loss2', Loss3, Loss3', Loss4, and Loss4' respectively. Therefore, the face image recognition model in this embodiment includes 1 global sub-model and 3 local sub-models.

[0111] Specifically, during the training process, all the training images in the training set need to be annotated with corresponding labels, including occlusion position, area, color, shape and other factors, where 1 represents complete occlusion, 0 represents no occlusion, and the occlusion coefficient in other cases is between 0 and 1. Then, the label of each aligned face image is determined. In the process of training the local sub-model, the recognition model and the occlusion attribute model are trained at the same time. During training, each loss value updates the parameters of the corresponding local sub-model separately, and the loss values ​​of different local sub-models do not affect each other.

[0112] Through the above steps S410 to S430, the occlusion ratio of the local image is evaluated based on the local sub-model, and the local face feature weights of the local image are flexibly given, so that the face image recognition model is more robust. Furthermore, in this embodiment, when recognizing face images, the number of models required to be trained is small, and the training cost, time cost and storage cost are greatly reduced.

[0113] The embodiments of the present application are described and illustrated below through preferred embodiments.

[0114] Due to strong lighting, occlusion, blur, and large angles between the face and the camera, the accuracy of face recognition is low, especially in the case of occlusion, such as sunglasses occluding the face, which causes the face to lose part of the information of the eye area; masks occluding the face, which causes the face to lose the information of the nose and mouth area; bangs occluding the face, which causes part of the information of the forehead area to be lost. In practical applications, when comparing the captured image and the image in the face image library of the same person, if the face in the captured image is wearing a mask, and the image in the face image library is not wearing a mask, the similarity of the two images after comparison will be lower than the real result, which may cause misjudgment. Therefore, a model is used to extract features from the entire face image. The extracted features are a representation of the entire facial information, and some details are often ignored.

[0115] The preferred embodiment of the present application crops the complete face image into some local images that can represent local facial information, and performs classification training on them separately. Finally, similarity calculation is performed based on global face features and multiple local face features. This can not only improve the recognition accuracy, but also has good robustness for some common occlusion scenarios, such as whether the person is wearing a mask, whether he is wearing sunglasses, and whether he has bangs on his forehead.

[0116] Figure 6 is a schematic diagram of the structure of face image recognition according to the preferred embodiment of the present application, such as Figure 6As shown in the figure, before feature extraction, it is possible to determine whether there are occluders such as bangs, masks, and sunglasses in the face image. If so, the information of the occluders is recorded and saved. Then, key point alignment and cropping are performed on each face image, and three local images are mainly cropped, corresponding to the forehead area, eye area, nose and mouth area, because these three parts contain the largest amount of face information. For the complete face image and the three local images, a set of global face features, represented by feature1, and three sets of local face features, represented by feature2, feature3, and feature4, are obtained after the corresponding sub-models. During the comparison, the feature vectors of the corresponding parts are compared respectively, and finally the weighted summation of the comparison results is performed in combination with the occlusion attribute to obtain the final similarity.

[0117] Taking the first face image and the second face image as an example, the first face image is the face image to be compared and needs to be retrieved, and the second face image is the face image in the face database. The specific recognition and comparison process is: the first face image and the second face image are both sent to CNN1 to obtain two global face features; each cropped local image is input into the corresponding CNN module to obtain the respective local face features and occlusion attributes, and the recognition is performed based on the local face features, and the local face feature weights are determined based on the occlusion attributes; finally, the similarity between the first face image and the second face image is calculated. In this embodiment, the same operation is performed on the first face image and the second face image, that is, global face features and local face features are extracted. Optionally, when the global face features, local face features and local face feature weights corresponding to the second face image are stored in the face database, only the first face image can be subjected to feature extraction and local face feature weight calculation, and the relevant parameters of the second face image can be directly obtained from the face database.

[0118] In the related art, the ratio coefficient of local face features and global face features is a fixed value after the model is trained, and cannot be dynamically adjusted according to the occlusion attribute. For example, the height of the mask on the nose directly determines the occlusion area of ​​the face, thereby affecting the proportion of the local image in the entire face recognition process. Furthermore, the shape and color of the occlusion object will also affect the proportion of the local image in the overall similarity. Therefore, fixing the weight of the local face feature in each local image will make the recognition effect worse. In this embodiment, the face occlusion situation is more accurately judged according to the attributes of the face image, and the attribute recognition method is combined to improve the accuracy of face recognition. Among them, the face image recognition model has multiple local sub-models, which can flexibly adjust the overall and local ratio weights, thereby making the recognition effect more robust, and the parameters in each model, such as the global face feature weight, local similarity coefficient and other parameters can be flexibly set according to the scene, and the scene applicability is high.

[0119] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0120] The method embodiments provided in this application can be executed in a terminal, a computer or a similar computing device. Taking running on a terminal as an example, Figure 7 FIG. 1 is a hardware structure block diagram of a terminal of the face image recognition method of an embodiment of the present application. Figure 7 As shown, the terminal 70 may include one or more ( Figure 7 Only one is shown in the figure) a processor 702 (the processor 702 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 704 for storing data. Optionally, the terminal may also include a transmission device 706 and an input / output device 708 for communication functions. It can be understood by those skilled in the art that Figure 7 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 7 More or fewer components as shown, or with Figure 7 Different configurations are shown.

[0121] The memory 704 can be used to store control programs, for example, software programs and modules of application software, such as the control program corresponding to the face image recognition method in the embodiment of the present application. The processor 702 executes various functional applications and data processing by running the control program stored in the memory 704, that is, to implement the above method. The memory 704 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 704 may further include a memory remotely arranged relative to the processor 702, and these remote memories may be connected to the terminal 70 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0122] The transmission device 706 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by the communication provider of the terminal 70. In one example, the transmission device 706 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 706 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0123] This embodiment also provides a face image recognition device, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0124] Figure 8 is a structural block diagram of a face image recognition device according to an embodiment of the present application, such as Figure 8 As shown, the device includes: an acquisition module 81, a determination module 82 and a judgment module 83:

[0125] The acquisition module 81 is used to acquire the first facial image and extract the global facial features and multiple local facial features of the first facial image, wherein the multiple local facial features correspond to multiple local images of the first facial image respectively; the determination module 82 is used to determine the local facial feature weights of the local facial features corresponding to each local image according to the occlusion ratio of each local image; the judgment module 83 is used to identify the identity corresponding to the first facial image according to the global facial features, multiple local facial features and multiple local facial feature weights.

[0126] In this embodiment, the occlusion ratio of the local image is evaluated based on the determination module 82, and the local face feature weight of the local image is flexibly given, so that the face image recognition is more robust. Therefore, the face recognition method in this embodiment solves the problem of low recognition accuracy in occlusion scenes when performing face recognition through the entire face image in the related art, and improves the accuracy of face image recognition.

[0127] In some embodiments, the face image recognition device includes a cropping module, which is used to extract facial key points from a first face image, and crop the first face image into a plurality of partial images according to the facial key points corresponding to a preset face recognition area. For each partial image, the corresponding local face feature is extracted by a local feature model corresponding to the partial image.

[0128] In some of the embodiments, the facial image recognition device includes a confidence module, which is used to obtain the occlusion ratio of each local image through a corresponding local feature model; determine the occlusion confidence corresponding to the local image according to the occlusion ratio; and determine the local facial feature weight according to the occlusion confidence.

[0129] In some of the embodiments, the facial image recognition device includes a similarity calculation module, which is used to calculate the local similarity weights of the local facial feature group based on the local facial feature weights in the first facial image and the corresponding local facial feature weights in the second facial image and a preset local similarity coefficient; calculate the similarity between the first facial image and the second facial image based on the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights and the local similarity weights; and determine whether the identity corresponding to the first facial image and the identity corresponding to the second facial image are consistent based on the similarity.

[0130] In some of the embodiments, the similarity calculation module of the face image recognition device includes a cosine calculation unit, which is used to determine the local similarity corresponding to the local face feature group based on the cosine distance between the local face features in the first face image and the corresponding local face features in the second face image, and the local similarity weight; determine the global similarity based on the cosine distance between the global face features in the first face image and the global face features in the second face image, and the global face feature weight; superimpose the global similarity with multiple local similarities and normalize them to obtain the similarity between the face in the first face image and the second face image.

[0131] In some of the embodiments, the face image recognition device includes a training module, which is used to obtain a training image, extract global face features of the training image through a global sub-model, and extract multiple local face features through a local sub-model, wherein the multiple local face features respectively correspond to multiple local images of the first face image; based on the local sub-model, determine the local face feature weights of the local face features corresponding to each local image according to the occlusion ratio in the local image; adjust the global face feature weights in the global sub-model until the loss value of the global sub-model converges, and adjust the local face feature weights of the local sub-model until the loss value of the local sub-model converges.

[0132] In some of the embodiments, the face image recognition device includes a preprocessing module, which is used to preprocess the face image, wherein the preprocessing includes at least one of scaling and alignment.

[0133] In some of the embodiments, the facial image recognition device includes a weight optimization module, which is used to determine the local facial feature weights of the local facial features corresponding to each local image based on the occlusion ratio of each local image and at least one of the occlusion color and the occlusion shape.

[0134] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0135] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0136] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0137] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0138] S1, obtaining a first facial image, extracting global facial features and multiple local facial features of the first facial image, wherein the multiple local facial features respectively correspond to multiple local images of the first facial image.

[0139] S2, determining the local facial feature weights of the local facial features corresponding to each local image according to the occlusion ratio of each local image.

[0140] S3, identifying the identity corresponding to the first facial image according to the global facial features, the multiple local facial features, and the multiple local facial feature weights.

[0141] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0142] In addition, in combination with the face image recognition method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any face image recognition method in the above embodiment is implemented.

[0143] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0144] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A facial image recognition method, characterized in that: include: Acquire a first facial image, and extract global facial features and a plurality of local facial features of the first facial image, wherein the plurality of local facial features respectively correspond to a plurality of local images of the first facial image; Determining the local facial feature weights of the local facial features corresponding to the local images according to the occlusion ratios of the local images; identifying an identity corresponding to the first facial image according to the global facial feature, the plurality of local facial features, and the plurality of local facial feature weights; Before acquiring the first facial image, the method includes training a facial image recognition model, the facial image recognition model includes a global sub-model and a plurality of local sub-models, and the training facial image recognition model includes: Acquire a training image, extract global facial features of the training image through a global sub-model, and extract multiple local facial features through a local sub-model, wherein the multiple local facial features correspond to multiple local images of the training image respectively; Based on the local sub-model, according to the occlusion ratio in the local image, determining the local facial feature weights of the local facial features corresponding to each of the local images; Adjust the global sub-model until the loss value of the global sub-model converges, and adjust the local face feature weights of the local sub-model until the loss value of the local sub-model converges; wherein the loss value of the global sub-model is a recognition loss value, and the loss value of the local sub-model includes a recognition loss value and an occlusion loss value; Extracting the global facial features and multiple local facial features of the first facial image includes: extracting the global facial features of the first facial image through a global sub-model in a facial image recognition model, and extracting multiple local facial features in the first facial image through a local sub-model in the facial image recognition model.

2. The facial image recognition method according to claim 1, characterized in that: The extracting of the global facial features and the plurality of local facial features of the first facial image comprises: Extracting facial key points from the first facial image, and cropping the first facial image into a plurality of partial images according to the facial key points corresponding to a preset facial recognition area; For each of the partial images, the corresponding local facial features are extracted by using a local feature model corresponding to the partial image.

3. The facial image recognition method according to claim 1, characterized in that: Determining the local facial feature weights of the local facial features corresponding to the local images according to the occlusion ratios of the local images comprises: For each of the local images, obtaining the occlusion ratio of the local image through the corresponding local feature model; Determining an occlusion confidence corresponding to the partial image according to the occlusion ratio; The local facial feature weight is determined according to the occlusion confidence.

4. The facial image recognition method according to claim 1, characterized in that: The identifying the identity corresponding to the first face image according to the global face feature, the plurality of local face features and the plurality of local face feature weights comprises: Calculating a local similarity weight of a local facial feature group according to the local facial feature weights in the first facial image and the corresponding local facial feature weights in the second facial image and a preset local similarity coefficient; Calculating the similarity between the first facial image and the second facial image according to the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights, and the local similarity weights; It is determined based on the similarity whether the identity corresponding to the first facial image and the identity corresponding to the second facial image are consistent.

5. The facial image recognition method according to claim 4, characterized in that: Calculating the similarity between the first facial image and the second facial image according to the cosine distance between the global facial features in the first facial image and the global facial features in the second facial image, the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, the preset global facial feature weights, and the local similarity weights comprises: Determining the local similarity corresponding to the local facial feature group according to the cosine distance between the local facial features in the first facial image and the corresponding local facial features in the second facial image, and the local similarity weight; Determining global similarity based on a cosine distance between a global facial feature in the first facial image and a global facial feature in the second facial image, and a weight of the global facial feature; The global similarity is superimposed with the multiple local similarities and normalized to obtain the similarity between the face in the first face image and the second face image.

6. The facial image recognition method according to any one of claims 1 to 5, characterized in that: Determining the local facial feature weights of the local facial features corresponding to the local images according to the occlusion ratios of the local images comprises: The local facial feature weights of the local facial features corresponding to each of the local images are determined according to the occlusion ratio of each of the local images and at least one of the occlusion color and the occlusion shape.

7. A facial image recognition device, characterized in that: Including acquisition module, determination module and judgment module: The acquisition module is used to acquire a first facial image, and extract global facial features and a plurality of local facial features of the first facial image, wherein the plurality of local facial features respectively correspond to a plurality of local images of the first facial image; The determination module is used to determine the local facial feature weights of the local facial features corresponding to each of the local images according to the occlusion ratio of each of the local images; The judgment module is used to identify the identity corresponding to the first face image according to the global face feature, the multiple local face features and the multiple local face feature weights; Before acquiring the first face image, the method further includes: training a face image recognition model, wherein the face image recognition model includes a global sub-model and a plurality of local sub-models, and the training face image recognition model includes: Acquire a training image, extract global facial features of the training image through a global sub-model, and extract multiple local facial features through a local sub-model, wherein the multiple local facial features correspond to multiple local images of the training image respectively; Based on the local sub-model, according to the occlusion ratio in the local image, determining the local facial feature weights of the local facial features corresponding to each of the local images; Adjust the global sub-model until the loss value of the global sub-model converges, and adjust the local face feature weights of the local sub-model until the loss value of the local sub-model converges; wherein the loss value of the global sub-model is a recognition loss value, and the loss value of the local sub-model includes a recognition loss value and an occlusion loss value; Extracting the global facial features and multiple local facial features of the first facial image includes: extracting the global facial features of the first facial image through a global sub-model in a facial image recognition model, and extracting multiple local facial features in the first facial image through a local sub-model in the facial image recognition model.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the facial image recognition method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the steps of the facial image recognition method according to any one of claims 1 to 6 when executed.