Method and device for face recognition

By obtaining and matching the features of the detection frame and predicted detection frame of the face object in the face recognition method, combined with the historical trajectory information of the face object, the problem of low matching accuracy of a single face feature is solved and the recognition accuracy is improved. .

CN113762013BActive Publication Date: 2024-09-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011389216.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-02
Publication Date
2024-09-24
Estimated Expiration
2040-12-02

AI Technical Summary

Technical Problem

Existing face recognition methods have low accuracy when matching individual facial features, resulting in low recognition accuracy.

Method used

By obtaining the detection frame and features of the face object in each frame of the video to be processed, and predicting the trajectory information of the face object based on the historical trajectory, the face features are added to the corresponding collection based on the matching degree between the detection frame and the predicted detection frame. In response to the disappearance of the face object, it is matched with the preset feature library and associated to avoid the problem of low accuracy when matching a single face feature.

Benefits of technology

It improves the accuracy of face recognition and enhances the stability and accuracy of the recognition system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113762013B
    Figure CN113762013B
Patent Text Reader

Abstract

The present application discloses a method and device for face recognition. A specific implementation of the method includes: for each frame of the image to be processed, obtaining the detection frame and face features of the face object in the image to be processed; predicting the predicted detection frame of the face object in the image to be processed according to the historical trajectory of the face object that has appeared in the video to be processed; for each face object in the image to be processed, based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed, adding the face features of the face object to the face feature set of the face object corresponding to the matched predicted detection frame; in response to determining that the face object disappears in the image to be processed, matching the face feature set of the disappeared face object with the face feature set in the preset feature library, and associating the matched face feature sets, thereby improving the recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a method and device for face recognition. Background Art

[0002] At present, mainstream face recognition methods generally match the feature information of a currently acquired face object with multiple face feature information under each face object in the feature library. When the feature library contains a face object that matches the feature information of the current face object, the feature information of the current face image is associated with the matching face object. Summary of the invention

[0003] The embodiments of the present application provide a method and device for face recognition.

[0004] In a first aspect, an embodiment of the present application provides a method for face recognition, comprising: for each frame of an image to be processed in a video to be processed, obtaining a detection frame and facial features of a face object in the image to be processed; predicting the trajectory information of the face object that has appeared in the video to be processed before the image to be processed based on the historical trajectory of the face object that has appeared in the image to be processed, and obtaining a predicted detection frame; for each face object in the image to be processed, based on the degree of matching between the detection frame of the face object and the predicted detection frame in the image to be processed, adding the facial features of the face object to a facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object; in response to determining that a face object has disappeared in the image to be processed, matching the facial feature set of the disappeared face object with the facial feature set in a preset feature library, and associating the matched facial feature sets, wherein each facial feature set in the preset feature library is provided with a face identifier.

[0005] In some embodiments, the above method also includes: in response to determining that there is no predicted detection frame in the predicted detection frame of the image to be processed that matches the detection frame of the facial object, creating a corresponding facial feature set for the facial object, and adding the facial features of the facial object to the facial feature set corresponding to the facial object.

[0006] In some embodiments, in response to determining that a facial object has disappeared in the image to be processed, the facial feature set of the disappeared facial object is matched with the facial feature set in a preset feature library, and the matched facial feature sets are associated, wherein each facial feature set in the preset feature library corresponds to a facial identifier, including: in response to determining that a facial object has disappeared in the image to be processed, selecting a preset number of personal facial features from the facial feature set of the disappeared facial object; matching the preset number of personal facial features with the facial feature set in the preset feature library, and associating the matched facial feature sets.

[0007] In some embodiments, the above method also includes: in response to determining that there is no facial feature set in the preset feature library that matches the facial feature set of the disappeared facial object, adding the facial feature set of the disappeared facial object to the preset feature library, and adding a corresponding facial identifier for the disappeared facial object.

[0008] In some embodiments, the above method further includes: determining attribute information of the target person represented by each facial object based on a set of facial features corresponding to each facial object.

[0009] In some embodiments, the above method further includes: performing data statistics on the attribute information of the target person represented by each face object to obtain preset data.

[0010] In some embodiments, the above method also includes: performing image acquisition on the video to be processed based on a preset time interval through the edge device to obtain multiple frames of images to be processed; performing face detection and facial feature extraction on each frame of the image to be processed through the edge device to obtain the detection frame and facial features of the face object in each frame of the image to be processed.

[0011] In a second aspect, an embodiment of the present application provides a device for face recognition, comprising: an acquisition unit, configured to acquire, for each frame of an image to be processed in a video to be processed, a detection frame and facial features of a face object in the image to be processed; a prediction unit, configured to predict the trajectory information of the face object that has appeared in the image to be processed based on the historical trajectory of the face object that has appeared in the video to be processed before the image to be processed, and obtain a predicted detection frame; a first matching unit, configured to, for each face object in the image to be processed, add the facial features of the face object to a facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed; a second matching unit, configured to, in response to determining that a face object has disappeared in the image to be processed, match the facial feature set of the disappeared face object with the facial feature set in a preset feature library, and associate the matched facial feature sets, wherein each facial feature set in the preset feature library is correspondingly provided with a face identifier.

[0012] In some embodiments, the above-mentioned device also includes: a creation unit, which is configured to create a corresponding facial feature set for the facial object in response to determining that there is no predicted detection frame in the predicted detection frame of the image to be processed that matches the detection frame of the facial object, and add the facial features of the facial object to the facial feature set corresponding to the facial object.

[0013] In some embodiments, the second matching unit is further configured to: in response to determining that a facial object has disappeared in the image to be processed, select a preset number of facial features from the facial feature set of the disappeared facial object; match the preset number of facial features with the facial feature set in a preset feature library, and associate the matching facial feature sets.

[0014] In some embodiments, the above-mentioned device also includes: an adding unit, which is configured to add the facial feature set of the disappeared facial object to the preset feature library in response to determining that there is no facial feature set matching the facial feature set of the disappeared facial object in the preset feature library, and add a corresponding facial identifier for the disappeared facial object.

[0015] In some embodiments, the above-mentioned device also includes: a determination unit configured to determine the attribute information of the target person represented by each facial object based on the facial feature set corresponding to each facial object.

[0016] In some embodiments, the above-mentioned device further includes: a statistical unit configured to perform data statistics on the attribute information of the target person represented by each face object to obtain preset data.

[0017] In some embodiments, the above-mentioned device also includes: an acquisition unit, which is configured to perform image acquisition on the video to be processed based on a preset time interval through an edge device to obtain multiple frames of images to be processed; an acquisition unit, which is configured to perform face detection and facial feature extraction on each frame of the image to be processed through the edge device to obtain the detection frame and facial features of the face object in each frame of the image to be processed.

[0018] In a third aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the first aspect is implemented.

[0019] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner of the first aspect.

[0020] The method and device for face recognition provided by the embodiment of the present application obtain the detection frame and face features of the face object in each frame of the image to be processed in the video to be processed; predict the trajectory information of the face object that has appeared in the image to be processed according to the historical trajectory of the face object that has appeared in the video to be processed before the image to be processed, and obtain the predicted detection frame; for each face object in the image to be processed, based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed, add the face features of the face object to the face feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object; in response to determining that the face object disappears in the image to be processed, match the face feature set of the disappeared face object with the face feature set in the preset feature library, and associate the matched face feature sets, wherein each face feature set in the preset feature library is correspondingly provided with a face identifier, thereby avoiding the problem of low accuracy when matching a single face feature, and improving the recognition accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0022] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present application may be applied;

[0023] Figure 2 is a flow chart of an embodiment of a method for face recognition according to the present application;

[0024] Figure 3is a schematic diagram of an application scenario of the method for face recognition according to this embodiment;

[0025] Figure 4 is a flow chart of another embodiment of a method for face recognition according to the present application;

[0026] Figure 5 is a structural diagram of an embodiment of a device for face recognition according to the present application;

[0027] Figure 6 It is a structural diagram of a computer system suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION

[0028] The present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It should also be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0029] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0030] Figure 1 An exemplary architecture 100 to which the method and apparatus for face recognition of the present application can be applied is shown.

[0031] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The communication connection between the terminal devices 101, 102, 103 constitutes a topological network, and the network 104 is used to provide a medium for the communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0032] Terminal devices 101, 102, 103 may be hardware devices or software that support network connection for data interaction and data processing. When terminal devices 101, 102, 103 are hardware, they may be various electronic devices that support network connection, information acquisition, interaction, display, processing and other functions, including but not limited to cameras, smart phones, tablet computers, e-book readers, laptop computers and desktop computers, etc. When terminal devices 101, 102, 103 are software, they may be installed in the electronic devices listed above. They may be implemented as multiple software or software modules for providing distributed services, for example, or they may be implemented as a single software or software module. No specific limitation is made here.

[0033] The server 105 may be a server that provides various services, such as a background processing server that receives the detection frame and face features of the face object in the image to be processed sent by the terminal devices 101, 102, and 103, and performs face recognition. The background processing server matches the face feature set of the face object with the face feature set in the preset feature library, and associates the matched face feature sets. As an example, the server 105 may be a cloud server.

[0034] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.

[0035] It should also be noted that the method for face recognition provided by the embodiments of the present disclosure can be executed by a server, or by a terminal device, or by a server and a terminal device in cooperation with each other. Accordingly, the various parts (such as various units, subunits, modules, and submodules) included in the apparatus for face recognition can be all arranged in the server, or all arranged in the terminal device, or respectively arranged in the server and the terminal device.

[0036] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the system is only illustrative. Depending on the implementation requirements, there may be any number of terminal devices, networks, and servers. When the electronic device on which the method for face recognition is running does not need to transmit data with other electronic devices, the system architecture may only include the electronic device (such as a server or terminal device) on which the method for face recognition is running.

[0037] Continue to refer Figure 2 , a process 200 of an embodiment of a method for face recognition is shown, comprising the following steps:

[0038] Step 201, for each frame of an image to be processed in a video to be processed, obtain a detection frame and facial features of a face object in the image to be processed.

[0039] In this embodiment, for each frame of the image to be processed in the video to be processed, the execution subject of the method for face recognition (for example Figure 1 The server in the image) can obtain the detection frame and facial features of the facial object in the image to be processed remotely or locally through a wired connection or a wireless connection.

[0040] The video to be processed may be a video including any content. As an example, the video to be processed may be a surveillance video of a specific scene acquired by a surveillance device. Specifically, the video to be processed may be a video acquired by a camera in real time, representing the flow of people at the entrance and exit of a supermarket. The image to be processed may be a video frame included in the video to be processed. The detection frame of the face object represents the face area of ​​the face object in the image to be processed, and the face feature is used to represent the feature information of the face object in the detection frame. It can be understood that each face object in the image to be processed corresponds to the detection frame and the face feature.

[0041] In some optional implementations of the present embodiment, the above-mentioned execution subject performs image acquisition on the video to be processed based on a preset time interval through an edge device to obtain multiple frames of images to be processed; performs face detection and facial feature extraction on each frame of the image to be processed through the edge device to obtain a detection frame and facial features of the face object in each frame of the image to be processed.

[0042] As an example, the edge device can determine the detection frame of the face object in the image to be processed based on the face detection model, and determine the face features of the face object in the detection frame based on the feature extraction model. The face detection model and the face recognition model can be, for example, a convolutional neural network model, a recurrent neural network model, a residual network model, etc.

[0043] Among them, the edge device can be such as Figure 1 The computing power and storage space of the terminal device shown are relatively small. Compared with the edge device, the computing power and storage space of the above-mentioned execution subject are relatively large. The preset time interval can be set according to the actual situation. For example, the preset time interval can be 500 milliseconds. In this implementation, the edge device and the above-mentioned execution subject each perform their respective duties and cooperate with each other to improve the information processing efficiency of the face recognition method.

[0044] Moreover, the edge device is responsible for processing the image to be processed and obtaining the detection frame and facial features of each face object included in the image to be processed, so that the data transmitted between the edge device and the above-mentioned execution subject is the detection frame and facial features of the face object, not the original image to be processed. It can be understood that compared with information transmission based on the image to be processed, information transmission based on the detection frame and facial features of the face object improves the security of information interaction between the edge device and the above-mentioned execution subject.

[0045] Step 202, predicting the trajectory information of the facial objects that have appeared in the image to be processed based on the historical trajectory of the facial objects that have appeared in the video to be processed before the image to be processed, and obtaining a predicted detection frame.

[0046] In this embodiment, the above-mentioned execution subject can predict the trajectory information of the facial objects that have appeared in the image to be processed based on the historical trajectory of the facial objects that have appeared in the video to be processed before the image to be processed, and obtain the predicted detection frame.

[0047] For each frame of the video to be processed from the initial frame to the image to be processed, the above-mentioned execution subject will detect the included face objects and obtain the corresponding detection frame. It can be understood that the same face object has different detection frames in different images to be processed. For each face object in the video to be processed, starting from the image to be processed of the video to be processed where the target person appears, the detection frame information corresponding to the face object of the same target person can be combined into a historical trajectory representing the movement trajectory of the face object of the target person.

[0048] As an example, the above-mentioned execution entity can determine the offset information of the detection frame of the face object between adjacent images to be processed, and determine the trajectory information of the face object in the image to be processed based on the time interval between adjacent images to be processed and the historical trajectory, that is, the predicted detection frame of the face object in the image to be processed.

[0049] As another example, the execution subject may determine the predicted detection frame of the face object in the image to be processed by a trajectory prediction model, wherein the trajectory prediction model is used to predict the predicted detection frame of the face object in the image to be processed according to the historical trajectory of the target object.

[0050] For each face object in the image to be processed, the execution subject predicts the predicted detection frame of the face object in the image to be processed according to the historical trajectory of the face object, thereby obtaining the predicted detection frames of all face objects included in the image to be processed.

[0051] Step 203, for each face object in the image to be processed, based on the degree of matching between the detection frame of the face object and the predicted detection frame in the image to be processed, the facial features of the face object are added to the facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object.

[0052] In this embodiment, for each facial object in the image to be processed, the above-mentioned execution entity adds the facial features of the facial object to the facial feature set of the facial object corresponding to the predicted detection frame that matches the detection frame of the facial object based on the degree of matching between the detection frame of the facial object and the predicted detection frame in the image to be processed.

[0053] As an example, for each face object in the image to be processed, the above-mentioned execution subject can determine the degree of match between the detection frame of the face image and the predicted detection frame in the image to be processed based on the IoU (Intersection over Union) between the two. When the IoU between the detection frame of the face object and a predicted detection frame is greater than a preset threshold, it can be determined that the detection frame of the face object matches the predicted detection frame, and then it is determined that the face objects corresponding to the matched detection frame and the predicted detection frame are the face objects of the same target person. It can be understood that when the IoU between the detection frame of the face object and a predicted detection frame is not greater than the preset threshold, it can be determined that the detection frame of the face object does not match the predicted detection frame.

[0054] The preset threshold value may be set according to actual conditions. For example, the preset threshold value may be 0.8.

[0055] By matching the detection frame of each face object included in the image to be processed with the multiple predicted detection frames in the image to be processed, the matching detection frames and predicted detection frames are determined, and the facial features of the face object are added to the facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object. It can be understood that for each face object, the facial feature set of the face object includes multiple facial features, and the multiple facial features are the facial features of the face object in the multiple images to be processed up to the image to be processed.

[0056] In this embodiment, for each face object, the execution subject may also add the detection frame of the face object to the historical track of the face object corresponding to the predicted detection frame that matches the detection frame of the face object.

[0057] In some optional implementations of the present embodiment, in response to determining that there is no predicted detection frame in the predicted detection frame of the image to be processed that matches the detection frame of the facial object, a corresponding facial feature set is created for the facial object, and the facial features of the facial object are added to the facial feature set corresponding to the facial object.

[0058] When there is no predicted detection box in the predicted detection box of the image to be processed that matches the detection box of the facial object, it indicates that the image to be processed includes a facial image that has not appeared in the previous image to be processed. It is necessary to create a corresponding facial feature set for the facial object that has not appeared, and add the facial features of the facial object to the facial feature set corresponding to the facial object.

[0059] Step 204, in response to determining that a facial object has disappeared in the image to be processed, matching a facial feature set of the disappeared facial object with a facial feature set in a preset feature library, and associating the matching facial feature sets.

[0060] In this embodiment, in response to determining that a facial object has disappeared in the image to be processed, the above-mentioned execution entity matches the facial feature set of the disappeared facial object with the facial feature set in a preset feature library, and associates the matching facial feature sets, wherein each facial feature set in the preset feature library is provided with a corresponding facial identifier.

[0061] The disappearance of the face object indicates that the image to be processed does not include the face object that has appeared in the video to be processed before the image to be processed. As an example, if the face object of the target person A is included in the previous frame of the image to be processed, and the face object of the target person A is not included in the image to be processed, it is determined that the face object in the image to be processed has disappeared.

[0062] In this embodiment, in order to avoid inaccuracy in monitoring the face object information situation in a single frame of the image to be processed, the above-mentioned execution subject responds to determining that as of the image to be processed, there are a certain number of consecutive frames of the image to be processed that do not include the face object that has appeared, and determines that the face object has disappeared in the image to be processed. The specific number can be set according to actual conditions. For example, the specific number can be 5.

[0063] As an example, in response to determining that a face object has disappeared in the image to be processed, the execution subject determines, based on the Euclidean distance, that each face feature in the face feature set of the disappeared face object is matched with each face feature in multiple face feature sets in the preset feature library, and determines the two face features with the smallest Euclidean distance as the matched face features, thereby determining the face features that match each face feature in the face feature set of the disappeared face object in the preset feature library. For each face feature of the disappeared face object, the execution subject determines the face identifier corresponding to the face feature in the preset feature set that matches the face feature as the face identifier corresponding to the face feature. Furthermore, the execution subject can weight the face distance and the number of face identifiers of the face object based on the preset weight to obtain a comprehensive score, and determine the face object in the preset feature library corresponding to the face object. Wherein, the face distance is the Euclidean distance between the face feature in the face feature set of the face object and the face feature in the matching preset feature library. By matching between sets of facial features, the problem of low accuracy when matching a single facial feature is avoided, and the recognition accuracy is improved.

[0064] In some optional implementations of this embodiment, in response to determining that a facial object has disappeared in the image to be processed, the execution subject selects a preset number of facial features from the facial feature set of the disappeared facial object; matches the preset number of facial features with the facial feature set in the preset feature library, and associates the matched facial feature set. The execution subject may associate the matched facial feature set in any manner. As an example, the execution subject may add the facial feature set of the facial object in the image to be processed to the facial feature set of the facial object that matches it in the preset feature library.

[0065] The preset number can be set according to actual conditions. As an example, the preset number is 10. For each face object, the execution subject can select the first frame image and the last frame image of the face object in the video to be processed, and randomly select 8 frames of images to be processed between the first frame image and the last frame image of the face object.

[0066] In some optional implementations of this embodiment, in response to determining that there is no facial feature set matching the facial feature set of the disappeared facial object in the preset feature library, the execution subject adds the facial feature set of the disappeared facial object to the preset feature library and adds a corresponding facial identifier for the disappeared facial object. Through this implementation, the preset feature library can be enriched.

[0067] Continue to see Figure 3 , Figure 3 FIG. 3 is a schematic diagram 300 of an application scenario of the method for face recognition according to this embodiment. Figure 3In the application scenario, the edge device 301 performs face detection and facial feature extraction on each frame of the image to be processed, obtains the detection frame and facial features of the face object in each frame of the image to be processed, and sends the detection frame and facial features of the face object in each frame of the image to be processed to the server 302. The server 302 obtains the detection frames 30311, 30312 and facial features 30321, 30322 of the face object in the image to be processed 303 for each frame of the image to be processed in the video to be processed. Among them, the detection frames 30311, 30312 and the facial features 30321, 30322 correspond one to one. Then, according to the historical trajectory of the facial objects that have appeared in the video to be processed before the image to be processed, the trajectory information of the facial objects that have appeared in the image to be processed is predicted to obtain the predicted detection frames 30331 and 30332; for each facial object in the image to be processed, based on the matching degree between the detection frame of the facial object and the predicted detection frame in the image to be processed, the facial features of the facial object are added to the facial feature set of the facial object corresponding to the predicted detection frame that matches the detection frame of the facial object. Specifically, the detection frame 30311 matches the predicted detection frame 30331, and the server 302 adds the facial feature 30321 corresponding to the detection frame 30311 to the facial feature set 304 of the facial object corresponding to the predicted detection frame 30331; the detection frame 30312 matches the predicted detection frame 30332, and the server 302 adds the facial feature 30322 corresponding to the detection frame 30312 to the facial feature set 305 of the facial object corresponding to the predicted detection frame 30332. In response to determining that a face object has disappeared in the image to be processed, where the disappeared face object is face object 3061 in the previous frame of image to be processed 306, server 302 matches face feature set 307 of the disappeared face object with multiple face feature sets 308, 309, and 310 in a preset feature library, and associates the matched face feature sets 307 and 308.

[0068] The method provided by the above-mentioned embodiment of the present disclosure obtains the detection frame and facial features of the face object in each frame of the image to be processed in the video to be processed; predicts the trajectory information of the face object that has appeared in the image to be processed according to the historical trajectory of the face object that has appeared in the video to be processed before the image to be processed, and obtains the predicted detection frame; for each face object in the image to be processed, based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed, adds the facial features of the face object to the facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object; in response to determining that the face object disappears in the image to be processed, matches the facial feature set of the disappeared face object with the facial feature set in the preset feature library, and associates the matched facial feature sets, wherein each facial feature set in the preset feature library is correspondingly provided with a facial identifier, thereby avoiding the problem of low accuracy when matching a single facial feature, and improving the recognition accuracy.

[0069] In some optional implementations of this embodiment, the above-mentioned execution subject can also determine the attribute information of the target person represented by each face object according to the face feature set corresponding to each face object.

[0070] Among them, the attribute information may be, for example, age, gender, whether a mask is worn, the length of time that the target person corresponding to the face object appears in the video to be processed, and other information. For each face object, the above-mentioned execution subject may perform attribute recognition on each face feature in the face feature set of the face object to obtain the attribute information corresponding to each face feature, and then, for the multiple attribute information corresponding to the face object, determine the attribute information of the face object based on the average value, weighted average, quantity percentage, and the like. As an example, the above-mentioned execution subject may determine the age of the face object based on the average value, and determine the gender of the face object based on the information representing the gender that has a relatively large quantity percentage.

[0071] In some optional implementations of this embodiment, the above-mentioned execution subject may also perform data statistics on the attribute information of the target person represented by each face object to obtain preset data.

[0072] The preset data may be any information obtained by statistically analyzing the attribute information. For example, the video to be processed may be a surveillance video of a supermarket acquired by a surveillance device, and the preset data may be data representing the flow of people in the supermarket at different time periods, age distribution data of supermarket customers, etc.

[0073] Continue to refer Figure 4 , shows a schematic process 400 of an embodiment of a training method for a face detection and recognition model according to the present application, comprising the following steps:

[0074] Step 401: The edge device collects images of the video to be processed based on a preset time interval to obtain multiple frames of images to be processed.

[0075] Among them, the face recognition model is used to characterize the correspondence between the face object in the face detection frame and the face feature information.

[0076] Step 402: Perform face detection and face feature extraction on each frame of the image to be processed through the edge device to obtain the detection frame and face features of the face object in each frame of the image to be processed.

[0077] Step 403, for each frame of the image to be processed in the video to be processed, obtain the detection frame and facial features of the face object in the image to be processed.

[0078] Step 404 , predicting the trajectory information of the facial objects that have appeared in the image to be processed based on the historical trajectory of the facial objects that have appeared in the video to be processed before the image to be processed, and obtaining a predicted detection frame.

[0079] Step 405, for each facial object in the image to be processed, based on the degree of matching between the detection frame of the facial object and the predicted detection frame in the image to be processed, the facial features of the facial object are added to the facial feature set of the facial object corresponding to the predicted detection frame that matches the detection frame of the facial object.

[0080] Step 406, in response to determining that a facial object has disappeared in the image to be processed, matching a facial feature set of the disappeared facial object with a facial feature set in a preset feature library, and associating the matching facial feature sets.

[0081] It can be seen from this embodiment that Figure 2 Compared with the corresponding embodiments, the process 400 of the method for face recognition in this embodiment specifically illustrates the face detection and face feature extraction through the edge device. The data sent by the edge device to the execution subject is the detection frame and face features. The edge device is responsible for face detection and feature extraction, and the execution subject is responsible for face recognition. The edge device and the execution subject each perform their respective duties, which improves the efficiency of information processing and also improves the security of data transmission.

[0082] Continue to refer Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for face recognition, and the device embodiment is Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0083] like Figure 5As shown, the apparatus for face recognition includes: including: an acquisition unit 501, configured to acquire the detection frame and face features of the face object in each frame of the image to be processed in the video to be processed; a prediction unit 502, configured to predict the trajectory information of the face object that has appeared in the image to be processed according to the historical trajectory of the face object that has appeared in the video to be processed before the image to be processed, and obtain the predicted detection frame; a first matching unit 503, configured to, for each face object in the image to be processed, add the face features of the face object to the face feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed; a second matching unit 504, configured to match the face feature set of the disappeared face object with the face feature set in the preset feature library in response to determining that the face object has disappeared in the image to be processed, and associate the matched face feature sets, wherein each face feature set in the preset feature library is correspondingly provided with a face identifier.

[0084] In some optional implementations of the present embodiment, the above-mentioned device also includes: a creation unit (not shown in the figure), which is configured to create a corresponding facial feature set for the facial object in response to determining that there is no predicted detection frame matching the detection frame of the facial object in the predicted detection frame of the image to be processed, and add the facial features of the facial object to the facial feature set corresponding to the facial object.

[0085] In some optional implementations of this embodiment, the second matching unit 504 is further configured to: in response to determining that a facial object has disappeared in the image to be processed, select a preset number of facial features from the facial feature set of the disappeared facial object; match the preset number of facial features with the facial feature set in a preset feature library, and associate the matching facial feature sets.

[0086] In some optional implementations of the present embodiment, the above-mentioned device also includes: an adding unit (not shown in the figure), which is configured to add the facial feature set of the disappeared facial object to the preset feature library in response to determining that there is no facial feature set matching the facial feature set of the disappeared facial object in the preset feature library, and add a corresponding facial identifier for the disappeared facial object.

[0087] In some optional implementations of this embodiment, the above-mentioned device also includes: a determination unit (not shown in the figure), which is configured to determine the attribute information of the target person represented by each facial object based on the facial feature set corresponding to each facial object.

[0088] In some embodiments, the above-mentioned device further includes: a statistical unit (not shown in the figure), which is configured to perform data statistics on the attribute information of the target person represented by each face object to obtain preset data.

[0089] In some optional implementations of this embodiment, the above-mentioned device also includes: an acquisition unit (not shown in the figure), which is configured to perform image acquisition on the video to be processed based on a preset time interval through an edge device to obtain multiple frames of images to be processed; an acquisition unit (not shown in the figure), which is configured to perform face detection and face feature extraction on each frame of the image to be processed through the edge device to obtain a detection frame and face features of the face object in each frame of the image to be processed.

[0090] In this embodiment, the acquisition unit in the apparatus for face recognition acquires the detection frame and face features of the face object in each frame of the image to be processed in the video to be processed; the prediction unit predicts the trajectory information of the face object that has appeared in the image to be processed according to the historical trajectory of the face object that has appeared in the video to be processed before the image to be processed, and obtains the predicted detection frame; the first matching unit adds the face features of each face object in the image to be processed to the face feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed; the second matching unit matches the face feature set of the disappeared face object with the face feature set in the preset feature library in response to determining that the face object disappears in the image to be processed, and associates the matched face feature sets, wherein each face feature set in the preset feature library is correspondingly provided with a face identifier, thereby avoiding the problem of low accuracy when matching a single face feature, and improving the recognition accuracy.

[0091] Reference below Figure 6 , which shows a device suitable for implementing the embodiments of the present application (eg Figure 1 Schematic diagram of the structure of a computer system 600 of the devices 101, 102, 103, 105 shown. Figure 6 The device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0092] like Figure 6As shown, the computer system 600 includes a processor (e.g., CPU, central processing unit) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the system 600 are also stored in the RAM 603. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0093] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0094] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 609, and / or installed from a removable medium 611. When the computer program is executed by the processor 601, the above-mentioned functions defined in the method of the present application are executed.

[0095] It should be noted that the computer-readable medium of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0096] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the client computer, partially on the client computer, as a separate software package, partially on the client computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the client computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the device, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0098] The units involved in the embodiments of the present application may be implemented by software or by hardware. The units described may also be provided in a processor, for example, may be described as: a processor comprising an acquisition unit, a prediction unit, a first matching unit, and a second matching unit. The names of these units do not, in certain cases, constitute limitations on the units themselves. For example, the second matching unit may also be described as "a unit that, in response to determining that a facial object has disappeared in the image to be processed, matches the facial feature set of the disappeared facial object with the facial feature set in a preset feature library, and associates the matched facial feature sets".

[0099] As another aspect, the present application further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the computer device: for each frame of the image to be processed in the video to be processed, obtain the detection frame and facial features of the face object in the image to be processed; predict the trajectory information of the face object that has appeared in the video to be processed before the image to be processed, and obtain the predicted detection frame; for each face object in the image to be processed, based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed, add the facial features of the face object to the facial feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object; in response to determining that the face object disappears in the image to be processed, match the facial feature set of the disappeared face object with the facial feature set in the preset feature library, and associate the matched facial feature sets, wherein each facial feature set in the preset feature library is correspondingly provided with a facial identifier.

[0100] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A method for face recognition, comprising: For each frame of the image to be processed in the video to be processed, obtain the detection frame and facial features of the face object in the image to be processed; According to the historical trajectory of the facial objects that have appeared in the video to be processed before the image to be processed, predict the trajectory information of the facial objects that have appeared in the image to be processed to obtain the predicted detection frame; For each face object in the image to be processed, based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed, the face features of the face object are added to the face feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object; In response to determining that a facial object has disappeared in the image to be processed, a facial feature set of the disappeared facial object is matched with a facial feature set in a preset feature library, and the matched facial feature sets are associated, wherein each facial feature set in the preset feature library is correspondingly provided with a facial identifier.

2. The method according to claim 1, wherein: Also includes: In response to determining that there is no predicted detection frame in the predicted detection frame of the image to be processed that matches the detection frame of the facial object, a corresponding facial feature set is created for the facial object, and the facial features of the facial object are added to the facial feature set corresponding to the facial object.

3. The method according to claim 1, wherein: In response to determining that a face object disappears in the image to be processed, a face feature set of the disappeared face object is matched with a face feature set in a preset feature library, and the matched face feature sets are associated, wherein each face feature set in the preset feature library is correspondingly provided with a face identifier, including: In response to determining that a human face object has disappeared in the image to be processed, selecting a preset number of human face features from a set of human face features of the disappeared human face object; The preset number of facial features are matched with the facial feature sets in the preset feature library, and the matching facial feature sets are associated.

4. The method according to claim 1, wherein: Also includes: In response to determining that there is no facial feature set matching the facial feature set of the disappeared facial object in the preset feature library, the facial feature set of the disappeared facial object is added to the preset feature library, and a corresponding facial identifier is added for the disappeared facial object.

5. The method according to claim 1, wherein: Also includes: According to the facial feature set corresponding to each facial object, the attribute information of the target person represented by each facial object is determined.

6. The method according to claim 5, wherein: Also includes: The attribute information of the target person represented by each face object is statistically analyzed to obtain preset data.

7. The method according to any one of claims 1 to 6, wherein: Also includes: Capturing images of the video to be processed based on a preset time interval by an edge device to obtain multiple frames of images to be processed; The edge device performs face detection and face feature extraction on each frame of the image to be processed, and obtains the detection frame and face features of the face object in each frame of the image to be processed.

8. A device for face recognition, comprising: An acquisition unit is configured to acquire, for each frame of an image to be processed in a video to be processed, a detection frame and facial features of a face object in the image to be processed; A prediction unit is configured to predict trajectory information of a facial object that has appeared in the image to be processed based on a historical trajectory of the facial object that has appeared in the video to be processed before the image to be processed, and obtain a predicted detection frame; The first matching unit is configured to, for each face object in the image to be processed, add the face features of the face object to a face feature set of the face object corresponding to the predicted detection frame that matches the detection frame of the face object based on the matching degree between the detection frame of the face object and the predicted detection frame in the image to be processed; The second matching unit is configured to, in response to determining that a facial object has disappeared in the image to be processed, match a facial feature set of the disappeared facial object with a facial feature set in a preset feature library, and associate the matched facial feature sets, wherein each facial feature set in the preset feature library corresponds to a facial identifier.

9. The device according to claim 8, wherein: Also includes: A creation unit is configured to, in response to determining that there is no predicted detection frame in the predicted detection frame of the image to be processed that matches the detection frame of the facial object, create a corresponding facial feature set for the facial object and add the facial features of the facial object to the facial feature set corresponding to the facial object.

10. The device according to claim 8, wherein: The second matching unit is further configured to: In response to determining that a facial object has disappeared in the image to be processed, a preset number of facial features are selected from the facial feature set of the disappeared facial object; the preset number of facial features are matched with the facial feature set in the preset feature library, and the matching facial feature sets are associated.

11. The device according to claim 8, wherein: Also includes: The adding unit is configured to add the facial feature set of the disappeared facial object to the preset feature library in response to determining that there is no facial feature set matching the facial feature set of the disappeared facial object in the preset feature library, and add a corresponding facial identifier for the disappeared facial object.

12. The device according to claim 8, wherein: Also includes: The determination unit is configured to determine the attribute information of the target person represented by each face object according to the face feature set corresponding to each face object.

13. The device according to claim 12, wherein: Also includes: The statistical unit is configured to perform data statistics on the attribute information of the target person represented by each face object to obtain preset data.

14. The device according to any one of claims 8 to 13, wherein: Also includes: A collection unit is configured to collect images of the video to be processed based on a preset time interval through an edge device to obtain multiple frames of images to be processed; The obtaining unit is configured to perform face detection and face feature extraction on each frame of the image to be processed through the edge device to obtain the detection frame and face features of the face object in each frame of the image to be processed.

15. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

16. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.