A face recognition method, device, equipment and medium
By partitioning the image to be recognized and using feature extraction and detection models to determine whether a complete human face is contained in the partition, the problem of slow speed and low efficiency in existing face recognition technologies is solved, achieving faster recognition speed and higher efficiency.
Patent Information
- Application Number
- CN202210778518.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Current face recognition technology is slow and inefficient, especially when the image to be recognized contains multiple faces.
The image to be recognized is divided into a preset number of partitions, and features are extracted and detected in each partition in a preset order. The feature extraction model and the face detection model are used to determine whether the partition contains a complete face. If so, face recognition is performed to improve the efficiency of parallel processing.
By using partitioned processing, the speed and efficiency of face recognition are improved, eliminating the need to wait for the detection results of other partitions and thus increasing the overall recognition speed and efficiency.
Smart Images

Figure CN117392713B_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, device, and medium. Background Technology
[0002] With the development of various information technologies, how to effectively utilize technologies such as electronics, information processing, computers, network communication, and artificial intelligence to conveniently, accurately, and reliably identify user identities has become an important issue that needs to be addressed.
[0003] Compared to other biometric technologies, facial recognition has the following unique characteristics: it does not require certain voluntary actions from the person, such as fingerprinting or signing.
[0004] In existing technologies, an image to be recognized may contain one or more faces. Current face recognition processes require identifying each face in the image, determining the location of each face, and then performing face recognition based on the detected locations. This results in slow face recognition speed and low efficiency. Summary of the Invention
[0005] This application provides a face recognition method, apparatus, device, and medium to solve the problems of slow face recognition speed and low face recognition efficiency in the prior art.
[0006] In a first aspect, embodiments of this application provide a face recognition method, the method comprising:
[0007] The acquired image to be recognized is divided into a first preset number of partitions;
[0008] For each partition in a preset order, the partition is input into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; the first feature histogram is input into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; based on the probability and a preset range, it is determined whether the partition contains a complete face; if the partition contains a complete face, the partition is input into the face recognition model to obtain the user information output by the face recognition model.
[0009] Secondly, embodiments of this application also provide a face recognition device, the device comprising:
[0010] The partitioning module is used to divide the acquired image to be recognized into a first preset number of partitions;
[0011] The processing module is configured to sequentially process each partition in a preset order, inputting the partition into a first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; inputting the first feature histogram into a face detection model to obtain the probability that the partition output by the face detection model contains a complete face; determining whether the partition contains a complete face based on the probability and a preset range; and if the partition contains a complete face, inputting the partition into a face recognition model to obtain the user information output by the face recognition model.
[0012] Thirdly, embodiments of this application also provide an electronic device, the electronic device including a processor, the processor being configured to execute a computer program stored in a memory to implement the steps of any of the face recognition methods described above.
[0013] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of any of the face recognition methods described above.
[0014] In this embodiment, the electronic device divides the acquired image to be recognized into a first preset number of partitions. Following a preset order, it sequentially inputs each partition into a first feature extraction model to obtain a first feature histogram corresponding to that partition, output by the first feature extraction model. The first feature histogram is then input into a face detection model to obtain the probability, output by the face detection model, that the partition contains a complete face. Based on the probability and a preset range, it determines whether the partition contains a complete face. If the partition contains a complete face, it is then input into a face recognition model to obtain user information output by the face recognition model. That is, in this embodiment, the electronic device divides the image to be recognized into a preset number of partitions and sequentially, following a preset order, determines whether each partition contains a complete face based on the first feature extraction model and the face detection model. If a complete face is determined to be present in the partition, face recognition is performed on that partition without waiting for face detection results from other partitions, thus improving the speed and efficiency of face recognition. Attached Figure Description
[0015] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a schematic diagram illustrating the process of a face recognition method provided in an embodiment of this application;
[0017] Figure 2 This is a schematic diagram of the partitioning of the image to be identified provided in an embodiment of this application;
[0018] Figure 3 This is a schematic diagram of the detection process of the face detection model provided in the embodiments of this application;
[0019] Figure 4 A schematic diagram of a face recognition process provided for an embodiment of this application;
[0020] Figure 5 An input diagram of the first feature extraction model provided in the embodiments of this application;
[0021] Figure 6 A schematic diagram of the target sub-partition provided in an embodiment of this application;
[0022] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application;
[0023] Figure 8 A schematic diagram of the recognition process of the face recognition model provided in the embodiments of this application;
[0024] Figure 9 This is a schematic diagram of the structure of a face recognition device provided in an embodiment of this application;
[0025] Figure 10 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0027] In this embodiment, the acquired image to be recognized is divided into a first preset number of partitions. For each partition, in a preset order, the partition is input into a first feature extraction model to obtain the first feature histogram corresponding to that partition output by the first feature extraction model. The first feature histogram is then input into a face detection model to obtain the probability that the partition output by the face detection model contains a complete face. Based on this probability and a preset range, it is determined whether the partition contains a complete face. If the partition contains a complete face, the partition is input into a face recognition model to obtain the user information output by the face recognition model.
[0028] To improve the speed and efficiency of face recognition, embodiments of this application provide a face recognition method, apparatus, device, and medium.
[0029] Figure 1 This application provides a schematic diagram of a face recognition method, which includes the following steps:
[0030] S101: Divide the acquired image to be recognized into a first preset number of partitions.
[0031] The face recognition method provided in this application is applied to an electronic device, which may be a server, PC, image acquisition device, etc.
[0032] In this embodiment of the application, in order to improve the efficiency of face recognition, the electronic device divides the acquired image to be recognized into partitions, and the electronic device can perform face detection and face recognition for each partition.
[0033] Specifically, in this embodiment, after the electronic device acquires the image to be recognized, it acquires a pre-saved number of partitions, i.e., a first preset number, and divides the image to be recognized into the first preset number of partitions. The size of each partition can be the same or different. For ease of recognition, each partition is generally rectangular and of equal size.
[0034] Figure 2 This is a schematic diagram of the partitioning of the image to be identified provided in the embodiments of this application, as shown below. Figure 2 As shown, the image to be identified is divided into 8*8 partitions.
[0035] S102: For each partition in a preset order, input the partition into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; input the first feature histogram into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; determine whether the partition contains a complete face based on the probability and a preset range; if the partition contains a complete face, input the partition into the face recognition model to obtain the user information output by the face recognition model.
[0036] In this embodiment, the electronic device stores the order in which face recognition is performed on each partition of the image to be recognized. Generally, the order is to start face recognition from the partition closest to the center of the image to be recognized.
[0037] Specifically, in this embodiment of the application, the electronic device sequentially targets each partition in a preset order, inputs the partition into a first feature extraction model, the first feature extraction model can extract features from the partition, and output the first feature histogram corresponding to the partition.
[0038] The parameters of images captured by mobile phones and other terminals differ from those captured by professional image acquisition devices such as cameras. For example, the clarity and quality of images captured by mobile phones are far lower than those captured by cameras. Therefore, a single first feature extraction model cannot extract the first feature histogram of both the images captured by the terminal and those captured by the image acquisition device. To enable the electronic device to perform face recognition on both images captured by the terminal and those captured by the image acquisition device, in this embodiment, the electronic device stores at least two first feature extraction models. At least one first feature extraction model is trained on images captured by the terminal and is used to extract the first feature histogram of those images. The other at least one first feature extraction model is trained on images captured by the image acquisition device and is used to extract the first feature histogram of those images. When the electronic device extracts the first feature histogram of each region of the image to be recognized, it can determine which first feature extraction model to use based on the device type of the device that captured the image. Furthermore, in the embodiments of this application, the first feature histogram output by each first feature extraction model contains the same dimensions, and each dimension represents the same meaning.
[0039] After acquiring the first feature histogram output by the first feature extraction model, the electronic device inputs this first feature histogram into the face detection model. This face detection model stores standard first feature histograms corresponding to partitions containing complete faces. The electronic device compares the first feature histogram with these standard first feature histograms and outputs the probability that the partition contains a complete face. This probability is the similarity between the first feature histogram and the standard first feature histogram.
[0040] Furthermore, the electronic device stores a preset range, which can be used to determine whether a partition contains a complete face. Specifically, in this embodiment, the electronic device obtains the probability output by the face detection model that the partition contains a complete face. The electronic device determines whether the partition contains a complete face based on whether this probability is greater than the maximum value of the stored preset range. If the electronic device determines that the partition contains a complete face, it inputs the partition into the face recognition model, which then identifies the face contained in the partition and obtains the user information output by the face recognition model.
[0041] In this embodiment, after the face detection model outputs the probability that a partition contains a complete face, the electronic device can input the first feature histogram corresponding to the next partition into the face detection model. That is, this embodiment achieves parallel processing of face detection and face recognition, improving the efficiency and speed of face recognition.
[0042] Figure 3 This is a schematic diagram of the detection process of the face detection model provided in the embodiments of this application. Figure 3 As shown, the process includes:
[0043] S301: The first feature histogram corresponding to the input partition.
[0044] S302: Obtain the pre-saved standard first feature histogram corresponding to the partition containing the complete face.
[0045] S303: Determine the similarity between the first feature histogram and the standard first feature histogram.
[0046] S304: Determine the similarity as the probability that the partition contains a complete face image, and output the probability.
[0047] In this embodiment, the electronic device divides the image to be recognized into a preset number of partitions, and sequentially determines whether the partition contains a complete face based on the first feature extraction model and the face detection model in a preset order. If the partition is determined to contain a complete face, face recognition is performed on the partition without waiting for the face detection results of other partitions, thereby improving the speed and efficiency of face recognition.
[0048] To improve the speed of face detection, based on the above embodiments, in this embodiment, determining whether the partition contains a complete face according to the probability and the preset range includes:
[0049] If the probability is not lower than the maximum value of the preset range, then it is determined that the partition contains a complete face;
[0050] If the probability is lower than the minimum value of the preset range, then it is determined that the partition does not contain a face;
[0051] If the probability is within the preset range, then it is determined that the partition contains a portion of human faces.
[0052] In this embodiment of the application, the electronic device stores a preset range, and the electronic device can determine whether the partition contains a complete human face based on the preset range.
[0053] Specifically, in this application embodiment, the partition containing a face includes, but is not limited to, the following situations:
[0054] Scenario 1: The partition contains a complete human face.
[0055] In this embodiment, if the probability output by the face detection model is not lower than the maximum value of a preset range stored in the electronic device, then the partition is determined to contain a complete face. For example, if the probability output by the face detection model is 95%, and the preset range stored in the electronic device is 80%-90%, then the electronic device determines that the partition contains a complete face.
[0056] Scenario 2: The partition does not contain human faces.
[0057] In this embodiment, if the probability output by the face detection model is lower than the minimum value of a preset range stored in the electronic device, then the partition is determined not to contain a face. For example, if the probability output by the face detection model is 15%, and the preset range stored in the electronic device is 80%-90%, then the electronic device determines that the partition does not contain a face.
[0058] Scenario 3: The partition contains some human faces.
[0059] In this embodiment, if the probability output by the face detection model is within a preset range stored in the electronic device, then the electronic device determines that the partition contains a portion of faces. For example, if the probability output by the face detection model is 85%, and the preset range stored in the electronic device is 80%-90%, then the electronic device determines that the partition contains a portion of faces.
[0060] In order to detect complete faces in the image to be recognized and improve the efficiency of face detection, based on the above embodiments, in this embodiment of the application, after determining that the partition contains a portion of a face, the method further includes:
[0061] The partition is identified as a candidate partition;
[0062] Determine whether there are other target candidate partitions adjacent to the candidate partition;
[0063] If it exists, the candidate partition is combined with the other candidate partitions of the target, the combined partition is used as a new partition, and the new partition is input into the first feature extraction model.
[0064] In this embodiment of the application, if the electronic device determines that a partition contains a portion of the face based on the probability output by the face detection model and a preset range, the electronic device will combine other partitions that contain both partial and partial faces with the partition, so that the combined partition contains the complete face.
[0065] Specifically, in this embodiment, after determining that a partition contains a portion of a face, the electronic device designates that partition as a candidate partition. The electronic device also determines whether other candidate partitions exist. If so, it determines whether any of these other candidate partitions are adjacent to the candidate partition in the image to be recognized. If the electronic device determines that other target candidate partitions exist, it combines the candidate partition with these other target candidate partitions according to their positional relationship in the image to be recognized, and inputs the combined partition as a new partition into the first feature extraction model for subsequent face detection and face recognition. In this embodiment, if the probability that the combined partition contains a complete face is still within a preset range, this step continues.
[0066] Furthermore, in this embodiment, if there are no other candidate partitions currently, or if there are no other target candidate partitions adjacent to the candidate partition among other candidate partitions, the electronic device saves the candidate partition to a preset storage location and processes the next partition in a preset order.
[0067] It should be noted that, in this embodiment of the application, since the size of the partition input into the first feature extraction model is fixed, in this embodiment of the application, before inputting the combined partition into the first feature extraction model, it is necessary to adjust the size of the combined partition using a bilinear interpolation algorithm.
[0068] Figure 4 This is a schematic diagram of a face recognition process provided in an embodiment of this application, as shown below. Figure 4 As shown, the process includes:
[0069] S401: Input the partition into the first feature extraction model and obtain the first feature histogram corresponding to the partition output by the first feature extraction model.
[0070] S402: Input the first feature histogram into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face.
[0071] S403: If, based on the probability and the preset range, it is determined that the partition contains some faces, then the partition is determined as a candidate partition.
[0072] S404: Determine if there are other candidate partitions. If yes, execute S405; otherwise, execute S407.
[0073] S405: Determine whether there are other target candidate partitions adjacent to the current candidate partition among the other candidate partitions. If yes, execute S406; otherwise, execute S407.
[0074] S406: Combine the candidate partition with other candidate partitions of the target, use the combined partition as the new partition, and execute S401.
[0075] S407: Save the candidate partition to the preset storage location.
[0076] To improve the efficiency of face detection, based on the above embodiments, in this embodiment, before inputting each partition into the first feature extraction model in a preset order, the method further includes:
[0077] Determine the center of the image to be identified, and using the center as the starting point, determine each partition that is not located at the edge of the image to be identified;
[0078] The step of sequentially inputting each partition into the first feature extraction model in a preset order includes:
[0079] Each partition not located at the edge of the image to be identified is input into the first feature extraction model in sequence from the inside out.
[0080] In this embodiment of the application, the electronic device needs to determine the preset order before inputting each partition into the first feature extraction model in a preset order.
[0081] Specifically, in this embodiment, the electronic device determines the center of the image to be identified, and uses this center as the starting point to determine each partition that is not located on the outermost ring. When the electronic device inputs each partition into the first feature extraction model in a preset order, it inputs each partition that is not located on the outermost ring into the first feature extraction model in an order from the inside out.
[0082] To further improve the speed of face detection and face recognition, based on the above embodiments, in this embodiment, after determining each partition that is not located at the outermost ring, the method further includes:
[0083] For each partition located in the outermost ring, determine whether there is at least one candidate partition containing a portion of a face; if so, input the partition into the first feature extraction model; if not, do not process the partition further.
[0084] To accelerate face detection, in this embodiment, when detecting whether the outermost partition contains a face, the electronic device first determines whether there is at least one candidate partition containing a partial face. If not, the electronic device assumes that the outermost partition does not contain a face and does not process it further. If the electronic device determines that there is at least one candidate partition containing a partial face, it performs face detection and face recognition for each outermost partition.
[0085] Figure 5 This is a schematic diagram of the input of the first feature extraction model provided in the embodiments of this application, as shown below. Figure 5 As shown, the electronic device establishes a coordinate system centered on the midpoint of the image to be recognized, using partitions as units. Figure 5 The image to be identified is divided into 8*8 partitions. The electronic device first inputs the four partitions around the origin into the first feature extraction model in sequence. The coordinates of the four partitions are (1,1), (-1,1), (1,-1) and (-1,-1) in sequence.
[0086] To improve face recognition, based on the above embodiments, in this embodiment of the application, before inputting the partition into the face recognition model, the method further includes:
[0087] The partition is divided into a second preset number of sub-partitions, and a third preset number of target sub-partitions at preset positions are sequentially input into the second feature extraction model; wherein, the third preset number does not exceed the second preset number;
[0088] Obtain the second feature histogram of each target sub-partition output by the second feature extraction model;
[0089] The partition is input into the face recognition model, and the user information output by the face recognition model is obtained, including:
[0090] The second feature histogram of each target sub-partition is input into the face recognition model;
[0091] For each user, the face recognition model obtains the standard feature histogram corresponding to each target sub-partition of the user that is saved in advance; compares the content of the second feature histogram of each target sub-partition with the content of the corresponding standard feature histogram, and counts the number of target sub-partitions with the same content; if the number reaches a fourth preset number, the user information of the user is output.
[0092] In this embodiment, once the electronic device determines that a partition contains a complete face, it inputs the partition into a face recognition model, enabling the model to identify the user information corresponding to the contained face. Specifically, in this embodiment, after determining that a partition contains a complete face, the electronic device adds the partition to the face image pipeline. The face recognition model, upon detecting the partition in the face image pipeline, identifies the user information corresponding to the contained face based on that partition.
[0093] Furthermore, in this embodiment, the input to the face recognition model can be a partition. However, in order to improve the efficiency and accuracy of face recognition, in this embodiment, the partition can be further divided, and the second feature histogram of the sub-partition can be used as the input to the face recognition model.
[0094] Specifically, in this embodiment, the electronic device divides the partition containing the complete face into a second preset number of sub-partitions. Considering the position of the face within the partitions and to reduce the load on the electronic device, the electronic device sequentially inputs a third preset number of target sub-partitions at preset positions into a second feature extraction model, and obtains the second feature histogram of each target sub-partition output by the second feature extraction model. The difference between the second feature extraction model and the first feature extraction model lies in the size of the input partitions. In this embodiment, the preset position is the location in the partition most likely to contain a face image, pre-defined by the technician. Generally, the partition is divided into 4*4 sub-partitions, and the preset position includes all sub-partitions in the second row from top to bottom, the two middle sub-partitions in the third row, and the two middle sub-partitions in the fourth row.
[0095] Figure 6 This is a schematic diagram of the target sub-partition provided in an embodiment of this application, as shown below. Figure 6 As shown, the partition is divided into 4*4 sub-partitions. The electronic device constructs a rectangular coordinate system with the upper left corner of the partition as the origin and the sub-partition as the unit length. The target sub-partition is the sub-partition with coordinates (1,2), (2,2), (3,2), (4,2), (2,3), (3,3), (2,4) and (3,4).
[0096] Furthermore, similar to the first feature extraction model, since the image quality and sharpness parameters of the terminal-acquired image differ from those of the image acquired by the image acquisition device, the same second feature extraction model cannot extract the first feature histogram of both the terminal-acquired image and the image acquired by the image acquisition device. Therefore, to enable the electronic device to perform face recognition on both the terminal-acquired image and the image acquired by the image acquisition device (specifically, its partitions), in this embodiment, the electronic device stores at least two second feature extraction models. At least one second feature extraction model is used to extract the second feature histogram of the partitions of the terminal-acquired image, and the other at least one second feature extraction model is used to extract the second feature histogram of the partitions of the image acquired by the image acquisition device. Furthermore, in this embodiment, the second feature histogram output by each second feature extraction model contains the same dimensions, and each dimension represents the same meaning.
[0097] In this embodiment, the electronic device stores a standard second feature histogram corresponding to each target sub-partition for each user. When the electronic device inputs the second feature histogram corresponding to each target sub-partition into the face recognition model, the face recognition model obtains the stored standard second feature histogram for each target sub-partition of each user. For each user, the face recognition model compares the content of the input second feature histogram of each target sub-partition with the content of the standard second feature histogram corresponding to that user, and counts the number of target sub-partitions with matching content. If this number reaches a fourth preset number, it is determined that the face contained in the partition belongs to that user, and the user's information is output.
[0098] In this embodiment of the application, the standard second feature histogram corresponding to each target sub-partition of each user stored in the electronic device is obtained from the face image input by the user for registration.
[0099] Furthermore, in this embodiment, if the face recognition model fails to identify the user corresponding to the face in each target sub-partition of each user after traversing the standard second feature histograms corresponding to each target sub-partition of each user, the face recognition model outputs a recognition failure message. After receiving the recognition failure message, the electronic device outputs a message indicating that the user information has not been entered.
[0100] Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, as shown below. Figure 7 As shown, the electronic device includes a face detection model, a face recognition model, a first feature extraction model, a second feature extraction model, and a face image pipeline. Figure 7In the process, the electronic device inputs a partition of the image to be recognized into a first feature extraction model, which outputs a first feature histogram of the partition; the electronic device inputs the first feature histogram into a face detection model, which outputs the probability of whether the partition contains a complete face; if the probability reaches the maximum value of a preset range, the electronic device saves the partition into a face image pipeline; the electronic device divides the partition in the face image pipeline and inputs a third preset number of target sub-partitions into a second feature extraction model in sequence; the electronic device inputs each second feature histogram output by the second feature extraction model into a face recognition model.
[0101] Figure 8 This is a schematic diagram of the recognition process of the face recognition model provided in the embodiments of this application. Figure 8 As shown, the process includes:
[0102] S801: Receives the second feature histogram of each target sub-partition as input.
[0103] S802: For each user, the face recognition model obtains the standard second feature histogram corresponding to each target sub-partition of the user that is saved in advance.
[0104] S803: Compare the content of the second feature histogram of each target sub-partition with the content of the corresponding standard second feature histogram, and count the number of target sub-partitions with the same content.
[0105] S804: If the number reaches the fourth preset number, output the user's information.
[0106] In order to identify user information about faces contained in the image to be identified, based on the above embodiments, in this embodiment of the application, before dividing the acquired image to be identified into a first preset number of partitions, the method further includes:
[0107] The image to be identified is adjusted to a first preset size using a bilinear interpolation algorithm.
[0108] If user information of the user contained in the image to be identified is not detected, the method further includes:
[0109] According to the bilinear interpolation algorithm, the image to be processed is adjusted to a second preset size, wherein the second preset size is smaller than the first preset size;
[0110] The step of dividing the acquired image to be identified into a first preset number of partitions is performed.
[0111] In this embodiment of the application, in order to make the subsequent face recognition process based on partitions applicable to all images, the electronic device may adjust the size of the image to be recognized before dividing the acquired image to be recognized into a first preset number of partitions.
[0112] Specifically, in this embodiment, the electronic device adjusts the image to be recognized to a first preset size using a bilinear interpolation algorithm. Furthermore, in this embodiment, the electronic device divides the image to be recognized into different fractions for images of different sizes. After adjusting the image to the first preset size, the electronic device determines and stores a first preset number of fractions corresponding to the first preset size, and then partitions the image to be recognized according to these first preset number of fractions.
[0113] If the user is too close to the camera, the electronic device cannot recognize the user's face based on the image to be recognized of the first preset size. Therefore, in this embodiment, if the electronic device fails to recognize the user information contained in the image to be recognized of the first preset size, the electronic device adjusts the image to be processed to a second preset size according to the bilinear interpolation algorithm, wherein the second preset size is smaller than the first preset size. The electronic device then re-executes the step of dividing the acquired image to be recognized into a first preset number of partitions.
[0114] Generally, to improve image clarity, the first preset size is typically 1028*1028, and the second preset size is typically 512*512. If the electronic device cannot recognize the user's face based on the image of the second preset size, the electronic device will then adjust the image to a third preset size, which is 256*256.
[0115] In this embodiment of the application, if the image to be identified is 128*128, it is divided into 32*32 partitions; if the image to be identified is 512*512, it is divided into 16*16 partitions; if the image to be identified is 256*256, it is divided into 8*8 partitions.
[0116] Figure 9 This application provides a schematic diagram of a face recognition device, which includes:
[0117] The partitioning module 901 is used to divide the acquired image to be recognized into a first preset number of partitions;
[0118] The processing module 902 is configured to sequentially process each partition in a preset order, input the partition into a first feature extraction model, obtain the first feature histogram corresponding to the partition output by the first feature extraction model; input the first feature histogram into a face detection model, obtain the probability that the partition output by the face detection model contains a complete face; determine whether the partition contains a complete face based on the probability and a preset range; if the partition contains a complete face, input the partition into a face recognition model, obtain the user information output by the face recognition model.
[0119] In one possible implementation, the processing module 902 is specifically configured to determine that the partition contains a complete face if the probability is not lower than the maximum value of the preset range; determine that the partition does not contain a face if the probability is lower than the minimum value of the preset range; and determine that the partition contains a partial face if the probability is within the preset range.
[0120] In one possible implementation, the processing module 902 is further configured to determine the partition as a candidate partition; determine whether there are other candidate partitions; if so, determine whether there are other target candidate partitions adjacent to the candidate partition; if so, combine the candidate partition and the other target candidate partitions, take the combined partition as a new partition, and input the partition into the first feature extraction model.
[0121] In one possible implementation, the processing module 902 is specifically used to determine the center of the image to be identified, and using the center as the starting point, determine each partition that is not located on the outermost ring; and input each partition that is not located on the outermost ring into the first feature extraction model in a sequential order from the inside to the outside.
[0122] In one possible implementation, the processing module 902 is specifically used to determine whether there is at least one candidate partition containing a portion of a face for each partition located in the outermost ring; if there is, the partition is input into the first feature extraction model; if there is not, the partition is no longer processed.
[0123] In one possible implementation, the partitioning module 901 is further configured to divide the partition into a second preset number of sub-partitions;
[0124] The processing module 902 is further configured to sequentially input a third preset number of target sub-partitions at preset positions into the second feature extraction model; wherein the third preset number does not exceed the second preset number; and to obtain the second feature histogram of each target sub-partition output by the second feature extraction model.
[0125] The processing module 902 is specifically used to input the second feature histogram of each target sub-partition into the face recognition model; for each user, the face recognition model obtains the pre-saved standard second feature histogram corresponding to each target sub-partition of the user; compares the content of the second feature histogram of each target sub-partition with the content of the corresponding standard second feature histogram, and counts the number of target sub-partitions with the same content; if the number reaches a fourth preset number, the user information of the user is output.
[0126] In one possible implementation, the processing module 902 is further configured to adjust the image to be identified to a first preset size according to a bilinear interpolation algorithm; if user information of the user contained in the image to be identified is not identified, then adjust the image to be processed to a second preset size according to the bilinear interpolation algorithm, wherein the second preset size is smaller than the first preset size; and perform the step of dividing the acquired image to be identified into a first preset number of partitions.
[0127] Based on the above embodiments, this application also provides an electronic device. Figure 10 This application provides a schematic diagram of an electronic device structure, such as... Figure 10 As shown, it includes: processor 1001, communication interface 1002, memory 1003 and communication bus 1004, wherein processor 1001, communication interface 1002 and memory 1003 communicate with each other through communication bus 1004.
[0128] The memory 1003 stores a computer program. When the program is executed by the processor 1001, the processor 1001 performs the following steps:
[0129] The acquired image to be recognized is divided into a first preset number of partitions;
[0130] For each partition in a preset order, the partition is input into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; the first feature histogram is input into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; based on the probability and a preset range, it is determined whether the partition contains a complete face; if the partition contains a complete face, the partition is input into the face recognition model to obtain the user information output by the face recognition model.
[0131] Furthermore, the processor 1001 is also used for:
[0132] If the probability is not lower than the maximum value of the preset range, then it is determined that the partition contains a complete face;
[0133] If the probability is lower than the minimum value of the preset range, then it is determined that the partition does not contain a face;
[0134] If the probability is within the preset range, then it is determined that the partition contains a portion of human faces.
[0135] Furthermore, the processor 1001 is also used for:
[0136] The partition is identified as a candidate partition;
[0137] Determine whether there are other candidate partitions. If so, determine whether there are other target candidate partitions that are adjacent to the candidate partition.
[0138] If it exists, the candidate partition is combined with the other candidate partitions of the target, the combined partition is used as a new partition, and the partition is input into the first feature extraction model.
[0139] Furthermore, the processor 1001 is also used for:
[0140] Determine the center of the image to be identified, and using the center as the starting point, determine each partition that is not located on the outermost ring;
[0141] The step of sequentially inputting each partition into the first feature extraction model in a preset order includes:
[0142] Each partition not located on the outermost ring is input into the first feature extraction model in sequence from the inside out.
[0143] Furthermore, the processor 1001 is also used for:
[0144] For each partition located in the outermost ring, determine whether there is at least one candidate partition containing a portion of a face; if so, input the partition into the first feature extraction model; if not, do not process the partition further.
[0145] Furthermore, the processor 1001 is also used for:
[0146] The partition is divided into a second preset number of sub-partitions, and a third preset number of target sub-partitions at preset positions are sequentially input into the second feature extraction model; wherein, the third preset number does not exceed the second preset number;
[0147] Obtain the second feature histogram of each target sub-partition output by the second feature extraction model;
[0148] The partition is input into the face recognition model, and the user information output by the face recognition model is obtained, including:
[0149] The second feature histogram of each target sub-partition is input into the face recognition model;
[0150] For each user, the face recognition model obtains the pre-saved standard second feature histogram corresponding to each target sub-partition of the user; compares the content of the second feature histogram of each target sub-partition with the content of the corresponding standard second feature histogram, and counts the number of target sub-partitions with the same content; if the number reaches a fourth preset number, the user information of the user is output.
[0151] Furthermore, the processor 1001 is also used for:
[0152] The image to be identified is adjusted to a first preset size using a bilinear interpolation algorithm.
[0153] If user information of the user contained in the image to be identified is not detected, the method further includes:
[0154] According to the bilinear interpolation algorithm, the image to be processed is adjusted to a second preset size, wherein the second preset size is smaller than the first preset size;
[0155] The step of dividing the acquired image to be identified into a first preset number of partitions is performed.
[0156] Since the principle of the above-mentioned electronic device in solving the problem is similar to that of the face recognition method, the implementation of the above-mentioned electronic device can be found in the embodiments of the method, and the repeated parts will not be described again.
[0157] The communication bus mentioned in the aforementioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 1002 is used for communication between the aforementioned electronic device and other devices. The memory can include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.
[0158] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0159] Based on the above embodiments, this invention also provides a computer-readable storage medium storing a computer program executable by a processor. When the program runs on the processor, it causes the processor to perform the following steps:
[0160] The acquired image to be recognized is divided into a first preset number of partitions;
[0161] For each partition in a preset order, the partition is input into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; the first feature histogram is input into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; based on the probability and a preset range, it is determined whether the partition contains a complete face; if the partition contains a complete face, the partition is input into the face recognition model to obtain the user information output by the face recognition model.
[0162] In one possible implementation, determining whether the partition contains a complete face based on the probability and a preset range includes:
[0163] If the probability is not lower than the maximum value of the preset range, then it is determined that the partition contains a complete face;
[0164] If the probability is lower than the minimum value of the preset range, then it is determined that the partition does not contain a face;
[0165] If the probability is within the preset range, then it is determined that the partition contains a portion of human faces.
[0166] In one possible implementation, after determining that the partition contains a portion of the faces, the method further includes:
[0167] The partition is identified as a candidate partition;
[0168] Determine whether there are other candidate partitions. If so, determine whether there are other target candidate partitions that are adjacent to the candidate partition.
[0169] If it exists, the candidate partition is combined with the other candidate partitions of the target, the combined partition is used as a new partition, and the partition is input into the first feature extraction model.
[0170] In one possible implementation, before inputting each partition into the first feature extraction model in a preset order, the method further includes:
[0171] Determine the center of the image to be identified, and using the center as the starting point, determine each partition that is not located on the outermost ring;
[0172] The step of sequentially inputting each partition into the first feature extraction model in a preset order includes:
[0173] Each partition not located on the outermost ring is input into the first feature extraction model in sequence from the inside out.
[0174] In one possible implementation, after determining each partition that is not located on the outermost ring, the method further includes:
[0175] For each partition located in the outermost ring, determine whether there is at least one candidate partition containing a portion of a face; if so, input the partition into the first feature extraction model; if not, do not process the partition further.
[0176] In one possible implementation, before inputting the partition into the face recognition model, the method further includes:
[0177] The partition is divided into a second preset number of sub-partitions, and a third preset number of target sub-partitions at preset positions are sequentially input into the second feature extraction model; wherein, the third preset number does not exceed the second preset number;
[0178] Obtain the second feature histogram of each target sub-partition output by the second feature extraction model;
[0179] The partition is input into the face recognition model, and the user information output by the face recognition model is obtained, including:
[0180] The second feature histogram of each target sub-partition is input into the face recognition model;
[0181] For each user, the face recognition model obtains the pre-saved standard second feature histogram corresponding to each target sub-partition of the user; compares the content of the second feature histogram of each target sub-partition with the content of the corresponding standard second feature histogram, and counts the number of target sub-partitions with the same content; if the number reaches a fourth preset number, the user information of the user is output.
[0182] In one possible implementation, before dividing the acquired image to be identified into a first preset number of partitions, the method further includes:
[0183] The image to be identified is adjusted to a first preset size using a bilinear interpolation algorithm.
[0184] If user information of the user contained in the image to be identified is not detected, the method further includes:
[0185] According to the bilinear interpolation algorithm, the image to be processed is adjusted to a second preset size, wherein the second preset size is smaller than the first preset size;
[0186] The step of dividing the acquired image to be identified into a first preset number of partitions is performed.
[0187] Since the principle of the computer-readable storage medium in solving the problem is similar to that of the face recognition method, the implementation of the computer-readable storage medium can be found in the embodiments of the method, and repeated details will not be described again.
[0188] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0189] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0190] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0191] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0192] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A face recognition method, characterized in that, The method includes: The acquired image to be recognized is divided into a first preset number of partitions; The center of the image to be identified is determined. Starting from the center, each partition not located on the outermost ring is determined. For each partition located on the outermost ring, it is determined whether there is at least one candidate partition containing a part of a face. If there is, the partition is input into the first feature extraction model. If there is no, the partition is not processed. For each partition in a preset order, the partition is input into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; the first feature histogram is input into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; based on the probability and a preset range, it is determined whether the partition contains a complete face; if the partition contains a complete face, the partition is input into the face recognition model to obtain the user information output by the face recognition model. The step of inputting each partition into the first feature extraction model in a preset order includes: inputting each partition that is not located on the outermost ring into the first feature extraction model in a sequence from the inside out. The step of determining whether the partition contains a complete face based on the probability and the preset range includes: If the probability is not lower than the maximum value of the preset range, then it is determined that the partition contains a complete face; If the probability is lower than the minimum value of the preset range, then it is determined that the partition does not contain a face; If the probability is within the preset range, then it is determined that the partition contains a portion of human faces; The partition is identified as a candidate partition; Determine whether there are other candidate partitions. If so, determine whether there are other target candidate partitions that are adjacent to the candidate partition. If it exists, the candidate partition is combined with the other candidate partitions of the target, the combined partition is used as a new partition, and the partition is input into the first feature extraction model.
2. The method according to claim 1, characterized in that, Before inputting the partition into the face recognition model, the method further includes: The partition is divided into a second preset number of sub-partitions, and a third preset number of target sub-partitions at preset positions are sequentially input into the second feature extraction model; wherein, the third preset number does not exceed the second preset number; Obtain the second feature histogram of each target sub-partition output by the second feature extraction model; The partition is input into the face recognition model, and the user information output by the face recognition model is obtained, including: The second feature histogram of each target sub-partition is input into the face recognition model; For each user, the face recognition model obtains the pre-saved standard second feature histogram corresponding to each target sub-partition of the user; compares the content of the second feature histogram of each target sub-partition with the content of the corresponding standard second feature histogram, and counts the number of target sub-partitions with the same content; if the number reaches a fourth preset number, the user information of the user is output.
3. The method according to claim 1, characterized in that, Before dividing the acquired image to be identified into a first preset number of partitions, the method further includes: The image to be identified is adjusted to a first preset size using a bilinear interpolation algorithm. If user information of the user contained in the image to be identified is not detected, the method further includes: According to the bilinear interpolation algorithm, the image to be recognized is adjusted to a second preset size, wherein the second preset size is smaller than the first preset size; The step of dividing the acquired image to be identified into a first preset number of partitions is performed.
4. A face recognition device, characterized in that, The device includes: The partitioning module is used to divide the acquired image to be recognized into a first preset number of partitions; The processing module is used to determine the center of the image to be identified, and using the center as the starting point, determine each partition that is not located on the outermost ring; for each partition located on the outermost ring, determine whether there is at least one candidate partition containing a part of a face; if there is, input the partition into the first feature extraction model; if there is not, do not process the partition. For each partition in a preset order, the partition is input into the first feature extraction model to obtain the first feature histogram corresponding to the partition output by the first feature extraction model; the first feature histogram is input into the face detection model to obtain the probability that the partition output by the face detection model contains a complete face; based on the probability and a preset range, it is determined whether the partition contains a complete face; if the partition contains a complete face, the partition is input into the face recognition model to obtain the user information output by the face recognition model. The step of inputting each partition into the first feature extraction model in a preset order includes: inputting each partition that is not located on the outermost ring into the first feature extraction model in a sequence from the inside out. The step of determining whether the partition contains a complete face based on the probability and the preset range includes: If the probability is not lower than the maximum value of the preset range, then it is determined that the partition contains a complete face; If the probability is lower than the minimum value of the preset range, then it is determined that the partition does not contain a face; If the probability is within the preset range, then it is determined that the partition contains a portion of human faces; The partition is identified as a candidate partition; Determine whether there are other candidate partitions. If so, determine whether there are other target candidate partitions that are adjacent to the candidate partition. If it exists, the candidate partition is combined with the other candidate partitions of the target, the combined partition is used as a new partition, and the partition is input into the first feature extraction model.
5. An electronic device, characterized in that, The electronic device includes a processor for executing a computer program stored in a memory to implement the steps of the face recognition method as described in any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the face recognition method as described in any one of claims 1-3.
Citation Information
Patent Citations
Image recognition method and system
CN108154116A
Human face detecting method and human face detecting device
CN108319937A
Photographing method, device, storage medium and terminal for human face image
CN109040588A
Face recognition method, device, computer device and storage medium
CN109241868A
