Face recognition method, apparatus and electronic device
By occluding faces in the face recognition results and combining motion information to optimize the recognition process, the problem of wasted face recognition model resources and missed detections in densely populated scenes is solved, achieving efficient recognition results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JINAN YUSHI INTELLIGENT TECH CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-29
AI Technical Summary
In crowded scenarios, existing facial recognition models struggle to effectively identify all faces without improving recognition standards, leading to resource waste and missed detections.
When the number of faces in the face recognition results reaches the limit that the model can recognize, the faces in the image are occluded based on the recognition results. This process is repeated until the number of faces in the recognition results is less than the model limit. The occlusion is performed by combining the motion speed and direction to predict the position. The occluded image is then used for recognition. Finally, the optimal face is determined based on the multiple recognition results.
Without improving the recognition specifications of existing face recognition models, this method effectively reduces missed face detections and improves the accuracy of face recognition in crowded scenes.
Smart Images

Figure CN122116433A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a face recognition method, apparatus and electronic device. Background Technology
[0002] Facial recognition technology is a technique that uses computer technology to extract facial features from an image of a person to be identified and compares them with facial features stored in a database to determine the person's identity. Currently, it has been widely used in various scenarios, such as office building entrances and community entrances, to improve the security of people entering.
[0003] Taking office building entrances as an example, there is usually a large flow of people during working hours. In order to better identify faces in densely populated scenes, existing technologies typically improve the recognition specifications of existing face recognition models, that is, the maximum number of faces that can be recognized at one time, in order to reduce missed faces in densely populated scenes. However, the density of people is variable. Outside of working hours, the flow of people is relatively sparse. If a high-specification face recognition model is still used for face recognition, it will result in a waste of resources.
[0004] Therefore, how to better recognize faces in crowded scenes without improving the recognition specifications of existing face recognition models is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] This application provides a face recognition method, apparatus, and electronic device that can solve the problem of missed face detection without improving the recognition specifications of existing face recognition models, thereby enabling better face recognition in crowded scenes.
[0006] This application provides a face recognition method, which may include:
[0007] The first image captured for the target scene is input into the face recognition model to obtain the first face recognition result of the first image;
[0008] If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the first image are occluded based on the first face recognition result, and the occluded images are input into the face recognition model. The above steps are repeated until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize.
[0009] Based on the first face recognition result and the face recognition results after each occlusion, the face recognition result of the target scene is determined.
[0010] According to a face recognition method provided in this application, the method involves occluding faces in images acquired after the first image based on the face recognition result, inputting the occluded image into the face recognition model, and repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model, including:
[0011] Based on the first face recognition result, the face in the second image acquired after the first image is occluded to obtain the occluded image;
[0012] Repeat the following steps:
[0013] The occluded image is input into the face recognition model to obtain a second face recognition result of the occluded image;
[0014] If the number of faces in the second face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the second image are occluded based on the latest preset number of face recognition results. The occluded images are then input into the face recognition model as new occluded images, until the number of faces in the face recognition results of the occluded images is less than the number of faces that the face recognition model can recognize.
[0015] According to the face recognition method provided in this application, the method further includes:
[0016] Determine the flow speed of people in each object within the target scenario;
[0017] The preset quantity is determined based on the personnel flow speed of each object.
[0018] According to a face recognition method provided in this application, when the number of faces in the first face recognition result is equal to the number of recognizable faces of the face recognition model, occluding the occlusion of faces in images subsequently acquired based on the first face recognition result includes:
[0019] If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the first image are occluded based on the first face recognition result to obtain the occluded first image.
[0020] The occluded first image is input into the face recognition model to obtain the face recognition result of the occluded first image;
[0021] If a face is present in the face recognition result of the first image after occlusion, the faces in images subsequently acquired based on the first face recognition result are occluded.
[0022] According to a face recognition method provided in this application, the step of occluding faces in images acquired after the first image based on the first face recognition result includes:
[0023] Determine the speed and direction of motion of the target object corresponding to the first face recognition result;
[0024] Based on the motion speed and the motion direction, predict the position of the target object in the image acquired after the first image;
[0025] Based on the position of the target object in the image acquired after the first image, the face in the image acquired after the first image is occluded.
[0026] According to a face recognition method provided in this application, determining the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion includes:
[0027] Determine the face quality score corresponding to the same face in the first face recognition result and each of the occluded face recognition results;
[0028] The face corresponding to the highest face quality score is identified as the face recognition result of the same face;
[0029] The face recognition results of the same face and the face recognition results of other faces besides the same face are determined as the face recognition results of the target scene.
[0030] This application also provides a face recognition device, which may include:
[0031] The first processing unit is used to input the first image collected for the target scene into the face recognition model to obtain the first face recognition result of the first image;
[0032] The second processing unit is configured to, when the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, occlude the faces in the images acquired after the first image based on the first face recognition result, and input the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize.
[0033] The first determining unit is used to determine the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion.
[0034] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the face recognition method as described above.
[0035] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the face recognition method as described above.
[0036] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the face recognition method as described above.
[0037] The face recognition method, apparatus, and electronic device provided in this application, when recognizing faces in a target scene, input a first image acquired for the target scene into a face recognition model to obtain a first face recognition result for the first image; if the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, then based on the first face recognition result, the faces in images acquired after the first image are occluded, and the occluded images are input into the face recognition model. The above steps are repeated until the number of faces in the face recognition result of the occluded images is less than the number of faces that the face recognition model can recognize; based on the first face recognition result and each occluded face recognition result, the face recognition result of the target scene is determined. By occluding faces in images acquired after the first image based on the first face recognition result, the number of faces in the occluded images can be effectively reduced. Repeating the above occlusion operation and inputting the occluded images into the face recognition model for face recognition can solve the problem of missed face detection without improving the recognition specifications of the existing face recognition model, thus enabling better face recognition in crowded scenes. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] Figure 1 This is a flowchart illustrating a face recognition method provided in an embodiment of this application.
[0040] Figure 2 This is a schematic flowchart illustrating a method for occluding faces in images subsequently acquired based on a first face recognition result, provided in an embodiment of this application.
[0041] Figure 3 This is a flowchart illustrating a method provided in this application for a face recognition result where the number of faces in the occluded image is less than the number of recognizable faces in the face recognition model.
[0042] Figure 4 This is a flowchart illustrating a method for determining the face recognition result of a target scene based on a first face recognition result and face recognition results after each occlusion, as provided in an embodiment of this application.
[0043] Figure 5 This is a schematic diagram of the structure of a face recognition device provided in an embodiment of this application.
[0044] Figure 6 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0045] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0046] In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone, where A and B can be singular or plural. In the textual description of this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0047] The technical solutions in the embodiments of this specification, if involving the processing of personal information, will all be processed under the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for the performance of a contract), and will only be processed within the scope stipulated or agreed. A user's refusal to process personal information other than that necessary for basic functions will not affect the user's use of basic functions. The collection, storage, use, processing, transmission, provision, and presentation of related information all comply with the provisions of relevant laws and regulations, do not infringe on the privacy of others, and do not violate public order and good morals.
[0048] The technical solutions provided in this application can be adapted to facial recognition scenarios. Currently, facial recognition technology has been widely used in various scenarios, such as office building entrances and community entrances, to improve the security of people entering.
[0049] Taking office building entrances as an example, there is usually a large flow of people during working hours, such as a flow density of more than 10 people. In order to better identify faces in densely populated scenes, considering that existing face recognition models can usually only identify a maximum of 10 faces at a time, it is necessary to improve the recognition specifications of existing face recognition models, that is, the number of faces that can be identified at one time, in order to reduce the missed detection of faces in densely populated scenes.
[0050] However, the density of people is variable. Usually, outside of working hours, the flow of people is relatively sparse. If a high-resolution facial recognition model is still used for facial recognition, it will result in a waste of resources.
[0051] To achieve better face recognition in crowded scenes without improving the recognition specifications of existing face recognition models, this application provides a face recognition method. The following specific embodiments will describe the face recognition method provided in detail. It is understood that these specific embodiments can be combined with each other, and similar concepts or processes may not be repeated in some embodiments.
[0052] Figure 1 This is a flowchart illustrating a face recognition method provided in an embodiment of this application. For example, please refer to... Figure 1 As shown, the face recognition method may include:
[0053] S101. Input the first image collected for the target scene into the face recognition model to obtain the first face recognition result of the first image.
[0054] For example, the target scenario could be an office building entrance, a community entrance, etc., and the specific settings can be configured according to actual needs.
[0055] For example, the face recognition model can be a deep learning-based face recognition model, such as a Convolutional Neural Network (CNN) model, a FaceNet face recognition model, or a DeepFace face recognition model, etc. The specific configuration can be set according to actual needs. Here, this application embodiment does not further limit the specific structure of the face recognition model.
[0056] After inputting the first image into the face recognition model and obtaining the first face recognition result, the number of faces in the first face recognition result can be further determined. If the number of faces in the first face recognition result is less than the number of faces that the face recognition model can recognize, it indicates that the crowd in the target scene is relatively sparse, and the first recognition result has recognized all the faces in the first image. Conversely, if the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, it indicates that the crowd in the target scene is dense, and the first face recognition has not recognized all the faces in the first image. Then, the following S102 is executed.
[0057] S102. If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the first image are occluded based on the first face recognition result, and the occluded images are input into the face recognition model. The above steps are repeated until the number of faces in the face recognition result of the occluded images is less than the number of faces that the face recognition model can recognize.
[0058] The number of recognizable faces is determined based on the specifications of the face recognition model. It usually refers to the maximum number of faces that the face recognition model can recognize. Its specific value can be set according to actual needs. Here, this application embodiment does not impose further restrictions.
[0059] Taking a face recognition model with 5 recognizable faces as an example, assuming the first image includes face 1, face 2, face 3, face 4, face 5, face 6, and face 7, inputting the first image into the face recognition model, the resulting face recognition result includes face 1, face 2, face 3, face 4, and face 5. That is, the number of faces in the first face recognition result is equal to the model's recognizable face count of 5. However, the first face recognition result does not recognize all faces in the first image. To avoid increasing the recognizable face count of the model, further steps are needed. With five faces, the model can perform face recognition well in the target scene. It can further occlude faces in subsequent images based on the first face recognition result, i.e., face 1, face 2, face 3, face 4, and face 5, in order to reduce the number of faces in the occluded image. The occluded image is then input into the face recognition model. The above steps are repeated until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize.
[0060] After repeatedly performing the above occlusion operation and inputting the occluded image into the face recognition model for face recognition, the face recognition results after each occlusion can be obtained. In this way, the face recognition result of the target scene can be determined based on the first face recognition result and the face recognition results after each occlusion, that is, the following S103 is executed.
[0061] S103. Based on the first face recognition result and the face recognition results after each occlusion, determine the face recognition result of the target scene.
[0062] As can be seen, in this embodiment, when recognizing faces in a target scene, a first image captured for the target scene is input into a face recognition model to obtain a first face recognition result for the first image. If the number of faces in the first face recognition result is equal to the number of faces recognizable by the face recognition model, faces in images captured after the first image are occluded based on the first face recognition result, and the occluded images are input into the face recognition model. This process is repeated until the number of faces in the face recognition result of the occluded images is less than the number of faces recognizable by the face recognition model. Based on the first face recognition result and each occluded face recognition result, the face recognition result for the target scene is determined. This method of occluding faces in images captured after the first image based on the first face recognition result effectively reduces the number of faces in the occluded images. By repeatedly performing the occlusion operation and inputting the occluded images into the face recognition model for face recognition, the problem of missed face detection can be solved without improving the recognition specifications of existing face recognition models, thus enabling better face recognition in densely populated scenes.
[0063] Based on the above Figure 1 The illustrated embodiment, to facilitate understanding of how, in S102 above, when the number of faces in the first face recognition result equals the number of recognizable faces of the face recognition model, faces in images subsequently acquired based on the first face recognition result are occluded, will be explained below. Figure 2 The embodiments shown are described in detail below.
[0064] Figure 2 This application provides a schematic flowchart of a method for occluding faces in images acquired after a first image based on a first face recognition result, as illustrated in the embodiments of this application. For example, please refer to... Figure 2 As shown, the method may include:
[0065] S201. If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the first image are occluded based on the first face recognition result to obtain the occluded first image.
[0066] Assuming the first image includes face 1, face 2, face 3, face 4, face 5, face 6, and face 7, inputting the first image into a face recognition model yields a first face recognition result including face 1, face 2, face 3, face 4, and face 5. Based on this result, face 1, face 2, face 3, face 4, and face 5 in the first image can be occluded, resulting in an occluded first image. The occluded image then includes face 6 and face 7.
[0067] S202. Input the occluded first image into the face recognition model to obtain the face recognition result of the occluded first image.
[0068] Based on the description in S201 above, when the first image including face 6 and face 7 is occluded and input into the face recognition model, the face recognition result of the occluded first image is obtained, which includes face 6 and face 7.
[0069] S203. If a face is present in the face recognition result of the first image after occlusion, the face in the image acquired after the first image is occluded based on the first face recognition result.
[0070] For example, assuming the first image is the Mth frame, the images captured after the first image can be the M+1th frame, the M+2nd frame, or the M+3rd frame, etc., which can be set according to actual needs.
[0071] If faces are present in the face recognition results of the first image after occlusion, it indicates that the number of faces in the first image is greater than the number of faces that the face recognition model can recognize, and the target scene is crowded. In order to perform face recognition in the target scene better without increasing the number of faces that the face recognition model can recognize, faces in subsequent images can be occluded based on the first face recognition results. This can effectively reduce the number of faces in the occluded images.
[0072] For example, in this embodiment of the application, when occluding faces in images acquired after the first image based on the first face recognition result, the movement speed and direction of the target object corresponding to the first face recognition result can be determined first; and based on the movement speed and direction, the position of the target object in images acquired after the first image can be predicted; then, based on the position of the target object in images acquired after the first image, the faces in images acquired after the first image can be occluded. In this way, by occluding faces in images acquired after the first image, the number of faces in the occluded images can be effectively reduced, so as to solve the problem of missed face detection without improving the recognition specifications of existing face recognition models, thereby enabling better face recognition in crowded scenes.
[0073] For example, when determining the motion speed and direction of the target object corresponding to the first face recognition result, a coordinate system can be established using motion detection macroblocks. The face coordinates of the target object corresponding to the first face recognition result can be converted into the corresponding macroblock coordinates. Combined with at least two frames of images, such as the first image and one or more frames preceding the first image, the positional change of the macroblock coordinates obtained from the face coordinate conversion of the target object can be determined. In this way, the motion speed and direction of the target object can be determined based on the positional change of the macroblock coordinates.
[0074] Based on the above Figure 1 The illustrated embodiment, to facilitate understanding of how, in S102 above, faces in images acquired after the first image are occluded based on the face recognition result, and the occluded image is input into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model, will be explained below. Figure 3 The embodiments shown are described in detail below.
[0075] Figure 3 This application provides a flowchart illustrating a method for determining the number of faces in a face recognition result of an occluded image that is less than the number of recognizable faces in the face recognition model. For example, please refer to [link to relevant documentation]. Figure 3 As shown, the method may include:
[0076] S301. Based on the first face recognition result, the face in the second image acquired after the first image is occluded to obtain the occluded image.
[0077] For example, assuming the first image is the Mth frame, the second image can be the M+1th frame. That is, based on the first face recognition result of the Mth frame, the face in the M+1th frame can be occluded. In this way, by occluding every other frame, the number of faces in the M+1th frame can be effectively reduced.
[0078] For example, assuming the second image can be an M+1 frame image, then the corresponding occluded image can be denoted as an N+1 frame image.
[0079] After obtaining the occluded image, the following step S302 can be executed: repeatedly perform the above occlusion operation and input the occluded image into the face recognition model for face recognition until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize. This is to solve the problem of missed face detection without improving the recognition specifications of the existing face recognition model, so as to better recognize faces in crowded scenes.
[0080] S302. Repeat the following steps: Input the occluded image into the face recognition model to obtain the second face recognition result of the occluded image; if the number of faces in the second face recognition result is equal to the number of faces that the face recognition model can recognize, based on the latest preset number of face recognition results, occlude the faces in the images acquired after the second image, and input the occluded image as a new occluded image into the face recognition model, until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize.
[0081] It is understandable that if the preset number is too large, the accuracy of the predicted position of the target object in the image captured after the second image will be low based on the preset number of face recognition results. Therefore, when occluding the face in the image captured after the second image based on the latest preset number of face recognition results, there will be a problem of inaccurate occlusion.
[0082] To effectively address the issue of inaccurate occlusion, for example, in this embodiment, when determining the preset quantity, the flow speed of people in each object in the target scene can be determined; and the preset quantity is determined based on the flow speed of people in each object. In this way, the preset quantity is determined in a targeted manner by combining the flow speed of people in each object. For example, when the flow speed of people is fast, the value of the preset quantity can be set relatively smaller; conversely, when the flow speed of people is slow, the value of the preset quantity can be set relatively smaller, which can effectively improve the accuracy of the preset quantity.
[0083] Taking the occluded image as frame N+1 as an example, assuming the face recognition model can recognize 5 faces, the N+1 frames are input into the face recognition model. After obtaining the second face recognition result of the N+1 frames, the number of faces in the second face recognition result can be determined. If the number of faces in the second face recognition result is less than the number of faces that the face recognition model can recognize (5), it means that the number of faces in the first image is 5-10. In this case, the M+2 frames of the target scene are input into the face recognition model for face recognition, and the above operation is repeated until the face recognition result of the new image is less than the number of faces that can be recognized (5). In this way, the face recognition result of the target scene can be obtained based on the face recognition results obtained multiple times.
[0084] If the number of faces in the second face recognition result is equal to the number of faces that the face recognition model can recognize (5), it means that the number of faces in the first image is greater than or equal to 10. In this case, for the M+2 frame image captured in the target scene, the faces in the M+2 frame image can be occluded based on the first recognition result of the M frame image and the second face recognition result of the N+1 frame image. Assuming the occluded image is recorded as the N+2 frame image, the N+2 frame image is then used as a new image and input into the face recognition model to obtain the face recognition result of the N+2 frame image.
[0085] Continue to determine the number of faces in the face recognition results of the N+2 frame image. If the number of faces in the face recognition results of the N+2 frame image is less than the number of faces that the face recognition model can recognize (5), it means that there are 10-15 faces in the first image. In this case, the M+3 frame image acquired for the target scene is input into the face recognition model for face recognition, and the above operation is repeated until the face recognition results of several consecutive new M frame images are all less than the number of faces that can be recognized (5). In this way, the face recognition result of the target scene can be obtained.
[0086] If the number of faces in the face recognition results of the N+2 frames is equal to the number of faces that the face recognition model can recognize (5), it means that the number of faces in the first image is greater than or equal to 15. In this case, for the M+3 frame image acquired for the target scene, the faces in the M+3 frame image can be occluded based on the first recognition result of the M frame image, the second face recognition result of the N+1 frame image, and the face recognition result of the N+2 frame image. Assuming the occluded image is recorded as the N+3 frame image, the N+3 frame image is used as the new N+1 frame image and input into the face recognition model until the number of faces in the face recognition result of the occluded image is less than the number of faces that can be recognized (5). In this way, the face recognition result of the target scene can be obtained based on the face recognition results obtained multiple times.
[0087] For example, in this embodiment of the application, a frame-by-frame occlusion method can also be used for face recognition of the target scene. For instance, the first frame image captured for the target scene can be input into the face recognition model to obtain the face recognition result of the first frame image; and based on the face recognition result of the first frame image, the second frame image captured for the target scene can be occluded to obtain the occluded image, and the occluded image can be input into the face recognition model to obtain the face recognition result of the occluded image; then the third frame image captured for the target scene can be input into the face recognition model to obtain the face recognition result of the third frame image; and based on the face recognition result of the third frame image, the fourth frame image captured for the target scene can be occluded to obtain the occluded image again, and the occluded image again can be input into the face recognition model to obtain the face recognition result of the occluded image again, and the above operations can be repeated until the obtained face recognition result no longer includes new faces, where the new faces refer to faces that have not appeared in the aforementioned face recognition results. In this way, the face recognition result of the target scene can be obtained based on all the aforementioned face recognition results.
[0088] It is understood that in the embodiments of this application, the above-mentioned frame-by-frame occlusion method is used for face recognition in the target scene, that is, the recognition result of the previous frame image is used to occlude the next frame image. Since the previous frame image and the next frame image are two consecutive frames, the position of the target object in the next frame image can be accurately predicted based on the recognition result of the previous frame image. This makes it possible to effectively improve the accuracy of occlusion processing when the recognition result of the previous frame image is used to occlude the next frame image, thereby improving the accuracy of face recognition in the target scene to a certain extent.
[0089] Of course, in this embodiment, the third frame image can also be occluded based on the face recognition results of the first frame image and the face recognition results obtained after the second frame image is occluded. The specific settings can be made according to actual needs.
[0090] As can be seen, in this embodiment of the application, by repeatedly performing the above-mentioned occlusion operation and inputting the occluded image into the face recognition model for face recognition, until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize, the problem of missed face detection can be solved without improving the recognition specifications of the existing face recognition model, so as to better recognize faces in crowded scenes.
[0091] Based on the above Figure 1 The illustrated embodiment, in order to facilitate understanding of how the face recognition result of the target scene is determined based on the first face recognition result and the face recognition results after each occlusion in S103, will be explained below. Figure 4The embodiments shown are described in detail below.
[0092] Figure 4 This application provides a flowchart illustrating a method for determining the face recognition result of a target scene based on a first face recognition result and face recognition results after each occlusion, as illustrated in the embodiments of this application. For example, please refer to... Figure 4 As shown, the method may include:
[0093] S401. Determine the face quality score corresponding to the same face in the first face recognition result and the face recognition results after each occlusion.
[0094] For example, in the embodiments of this application, the face quality score can also be output by the face recognition model, or it can be combined with an additional face quality score model, etc., which can be set according to actual needs.
[0095] S402. The face corresponding to the highest face quality score is identified as the face recognition result of the same face.
[0096] For the same face, by comparing the face quality scores of the same face in different face recognition results, when there are multiple face quality scores for the same face, the face quality score with the highest score among the multiple face quality scores is determined as the face recognition result for that face. That is, the face with the best face quality is selected as the face recognition result for the same face, which can effectively improve the face recognition result for the same face.
[0097] S403. The face recognition results of the same face and the face recognition results of other faces besides the same face are determined as the face recognition results of the target scene.
[0098] Among them, other faces besides the same face can be understood as faces that are only identified by one face recognition result, and that face recognition result is the face recognition result of other faces.
[0099] As can be seen, in this embodiment of the application, when determining the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion, for the same face, the face with the best face quality can be selected as the face recognition result of the same face. Then, combined with the face recognition results of other faces besides the same face, the face recognition result of the target scene can be obtained. This can effectively solve the problem of missed face detection, and thus can better recognize faces in crowded scenes.
[0100] The face recognition device provided in this application is described below. The face recognition device described below can be referred to in correspondence with the face recognition method described above.
[0101] Figure 5 This is a schematic diagram of the structure of a face recognition device provided in an embodiment of this application. For example, please refer to [link / reference]. Figure 5 As shown, the face recognition device 50 may include:
[0102] The first processing unit 501 is used to input the first image collected for the target scene into the face recognition model to obtain the first face recognition result of the first image;
[0103] The second processing unit 502 is used to, when the number of faces in the first face recognition result is equal to the number of faces that can be recognized by the face recognition model, occlude the faces in the images acquired after the first image based on the first face recognition result, and input the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of faces that can be recognized by the face recognition model.
[0104] The first determining unit 503 is used to determine the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion.
[0105] For example, in this embodiment of the application, the second processing unit 502 is used to occlude faces in images acquired after the first image based on the face recognition result, and input the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model, including:
[0106] Based on the first face recognition result, the face in the second image acquired after the first image is occluded to obtain the occluded image;
[0107] Repeat the following steps:
[0108] The occluded image is input into the face recognition model to obtain a second face recognition result of the occluded image;
[0109] If the number of faces in the second face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the second image are occluded based on the latest preset number of face recognition results. The occluded images are then input into the face recognition model as new occluded images, until the number of faces in the face recognition results of the occluded images is less than the number of faces that the face recognition model can recognize.
[0110] For example, in an embodiment of this application, the face recognition device 50 further includes:
[0111] The second determining unit is used to determine the personnel flow speed of each object in the target scene;
[0112] The third determining unit is used to determine the preset quantity based on the personnel flow speed of each object.
[0113] For example, in an embodiment of this application, the second processing unit 502 is configured to occlude faces in images acquired after the first image based on the first face recognition result, when the number of faces in the first face recognition result is equal to the number of recognizable faces of the face recognition model, including:
[0114] If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the first image are occluded based on the first face recognition result to obtain the occluded first image.
[0115] The occluded first image is input into the face recognition model to obtain the face recognition result of the occluded first image;
[0116] If a face is present in the face recognition result of the first image after occlusion, the faces in images subsequently acquired based on the first face recognition result are occluded.
[0117] For example, in an embodiment of this application, the second processing unit 502 is used to occlude faces in images acquired after the first image based on the first face recognition result, including:
[0118] Determine the speed and direction of motion of the target object corresponding to the first face recognition result;
[0119] Based on the motion speed and the motion direction, predict the position of the target object in the image acquired after the first image;
[0120] Based on the position of the target object in the image acquired after the first image, the face in the image acquired after the first image is occluded.
[0121] For example, in this embodiment of the application, the first determining unit 503 is used to determine the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion, including:
[0122] Determine the face quality score corresponding to the same face in the first face recognition result and each of the occluded face recognition results;
[0123] The face corresponding to the highest face quality score is identified as the face recognition result of the same face;
[0124] The face recognition results of the same face and the face recognition results of other faces besides the same face are determined as the face recognition results of the target scene.
[0125] The face recognition device 50 provided in this application embodiment can execute the technical solution of the face recognition method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the face recognition method. Please refer to the implementation principle and beneficial effects of the face recognition method. It will not be repeated here.
[0126] Figure 6 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute a face recognition method. This method includes: inputting a first image acquired for a target scene into a face recognition model to obtain a first face recognition result for the first image; if the number of faces in the first face recognition result is equal to the number of recognizable faces in the face recognition model, occluding faces in images acquired after the first image based on the first face recognition result, and inputting the occluded images into the face recognition model; repeating the above steps until the number of faces in the face recognition result of the occluded images is less than the number of recognizable faces in the face recognition model; and determining the face recognition result for the target scene based on the first face recognition result and each of the occluded face recognition results.
[0127] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0128] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the face recognition method provided by the above methods. The method includes: inputting a first image acquired for a target scene into a face recognition model to obtain a first face recognition result of the first image; if the number of faces in the first face recognition result is equal to the number of recognizable faces of the face recognition model, occluding faces in images acquired after the first image based on the first face recognition result, and inputting the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model; and determining the face recognition result of the target scene based on the first face recognition result and each of the occluded face recognition results.
[0129] Furthermore, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the face recognition method provided by the above methods. The method includes: inputting a first image acquired for a target scene into a face recognition model to obtain a first face recognition result of the first image; if the number of faces in the first face recognition result is equal to the number of recognizable faces of the face recognition model, occluding faces in images acquired after the first image based on the first face recognition result, and inputting the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model; and determining the face recognition result of the target scene based on the first face recognition result and each of the occluded face recognition results.
[0130] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0131] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A face recognition method, characterized in that, include: The first image captured for the target scene is input into the face recognition model to obtain the first face recognition result of the first image; If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the first image are occluded based on the first face recognition result, and the occluded images are input into the face recognition model. The above steps are repeated until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize. Based on the first face recognition result and the face recognition results after each occlusion, the face recognition result of the target scene is determined.
2. The face recognition method according to claim 1, characterized in that, The step of occluding faces in images acquired after the first image based on the face recognition result, and inputting the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of recognizable faces of the face recognition model, includes: Based on the first face recognition result, the face in the second image acquired after the first image is occluded to obtain the occluded image; Repeat the following steps: The occluded image is input into the face recognition model to obtain a second face recognition result of the occluded image; If the number of faces in the second face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the images acquired after the second image are occluded based on the latest preset number of face recognition results. The occluded images are then input into the face recognition model as new occluded images, until the number of faces in the face recognition results of the occluded images is less than the number of faces that the face recognition model can recognize.
3. The face recognition method according to claim 2, characterized in that, The method further includes: Determine the flow speed of people in each object within the target scenario; The preset quantity is determined based on the personnel flow speed of each object.
4. The face recognition method according to any one of claims 1-3, characterized in that, When the number of faces in the first face recognition result is equal to the number of recognizable faces of the face recognition model, occluding the occlusion of faces in images acquired after the first image based on the first face recognition result includes: If the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, the faces in the first image are occluded based on the first face recognition result to obtain the occluded first image. The occluded first image is input into the face recognition model to obtain the face recognition result of the occluded first image; If a face is present in the face recognition result of the first image after occlusion, the faces in images subsequently acquired based on the first face recognition result are occluded.
5. The face recognition method according to any one of claims 1-3, characterized in that, The step of occluding faces in images acquired after the first image based on the first face recognition result includes: Determine the movement speed and direction of the target object corresponding to the first face recognition result; Based on the motion speed and the motion direction, predict the position of the target object in the image acquired after the first image; Based on the position of the target object in the image acquired after the first image, the face in the image acquired after the first image is occluded.
6. The face recognition method according to any one of claims 1-3, characterized in that, The step of determining the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion includes: Determine the face quality score corresponding to the same face in the first face recognition result and each of the occluded face recognition results; The face corresponding to the highest face quality score is identified as the face recognition result of the same face; The face recognition results of the same face and the face recognition results of other faces besides the same face are determined as the face recognition results of the target scene.
7. A face recognition device, characterized in that, include: The first processing unit is used to input the first image collected for the target scene into the face recognition model to obtain the first face recognition result of the first image; The second processing unit is configured to, when the number of faces in the first face recognition result is equal to the number of faces that the face recognition model can recognize, occlude the faces in the images acquired after the first image based on the first face recognition result, and input the occluded image into the face recognition model, repeating the above steps until the number of faces in the face recognition result of the occluded image is less than the number of faces that the face recognition model can recognize. The first determining unit is used to determine the face recognition result of the target scene based on the first face recognition result and the face recognition results after each occlusion.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the face recognition method as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the face recognition method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the face recognition method as described in any one of claims 1 to 6.