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

Processing video data through RetinaFace and KCF models, combined with parameter scoring algorithms and blacklist databases, solves the efficiency and safety problems of face recognition technology in queuing scenarios, achieves fast and accurate face recognition and alarm, and ensures the safety of public facilities. Safe and smooth traffic.

CN114898416BActive Publication Date: 2024-10-25NORTH CHINA UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202210069201.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2024-10-25
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

In queuing scenarios, existing facial recognition technology requires pedestrians to stay steadily in front of the camera, which makes queuing slow and inconvenient, and it is difficult to ensure smooth flow of people and public safety at the same time during peak hours.

Method used

The RetinaFace face detection model and the KCF face tracking model are used to preprocess the video data to obtain a continuous sequence of face images, and the face image with the highest score is selected for comparison through a parameter scoring algorithm, and a blacklist database is used to achieve rapid recognition. and call the police.

Benefits of technology

It improves the accuracy of facial information acquisition and recognition accuracy, ensuring smooth flow of people during peak hours, and at the same time, it can quickly identify and alarm abnormal situations to ensure public safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114898416B_ABST
    Figure CN114898416B_ABST
Patent Text Reader

Abstract

In the embodiment of the present application, a face recognition method, device, electronic device and readable storage medium are provided, which belong to the field of face recognition technology. The method includes: preprocessing the video data of the target area to obtain a standard picture sequence of the target area; processing the standard picture sequence based on a preset face detection model and a preset target tracking model to obtain a continuous face image sequence; selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, the target face image is the face image with the highest score in the face image sequence; searching for the target face image in a preset face image library, and when the target face image is included in the preset image database, outputting a comparison result of face recognition passing. The processing of face images by the preset face detection model and the preset target tracking model can effectively improve the accuracy of face information acquisition and the accuracy of face recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of face recognition, and in particular to a face recognition method, device, electronic equipment and readable storage medium. Background Art

[0002] As my country's urbanization continues to deepen, the demand for the development of public facilities is also increasing. Urban public facilities often face the situation of receiving a large number of people during peak hours, so people often queue up at public facilities during peak hours to wait for passage. In the queuing scenario, it is necessary to quickly handle tasks to ensure smooth flow of people, and accurately report abnormal situations to ensure public safety.

[0003] The main purpose of snapshot tasks in queueing scenes is often to identify pedestrians and report illegal identities. Existing technologies use gates to restrict the flow of people in queues, and use face recognition technology to detect pedestrian identities.

[0004] To ensure accuracy, face detection requires the person being inspected to stay in front of the camera for a period of time. It is often necessary to cooperate with the gate or security personnel to block the queue, which results in slow and inconvenient queue progress. Summary of the invention

[0005] In order to solve the above technical problems, the embodiments of the present application provide a face recognition method, device, electronic device and readable storage medium. The specific solutions are as follows:

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

[0007] Obtain video data of the target area;

[0008] Preprocessing the video data of the target area to obtain a standard picture sequence of the target area;

[0009] Processing the standard image sequence based on a preset face detection model and a preset target tracking model to obtain a continuous face image sequence;

[0010] Selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence;

[0011] The target face image is searched in a preset face image database, and when the preset image database includes the target face image, a comparison result of passing face recognition is output.

[0012] According to a specific implementation of the embodiment of the present application, the step of preprocessing the video data of the target area to obtain a standard picture sequence of the target area includes:

[0013] Performing frame slicing processing on the video data to obtain a continuous initial picture sequence;

[0014] The initial picture sequence is subjected to a preset standardization process and a preset filtering process to obtain a standard picture sequence with the same picture size.

[0015] According to a specific implementation of an embodiment of the present application, the preset face detection model is a RetinaFace face detection model, the preset target tracking model is a KCF face tracking model, and the step of processing the standard image sequence based on the preset face detection model and the preset target tracking model to obtain a continuous face image sequence includes:

[0016] Dividing every two adjacent standard image frames in the standard image sequence into a spare image combination to obtain an image combination sequence, wherein each spare image combination includes a previous image frame and a next image frame, and the next image frame of each spare image combination coincides with the previous image frame of the spare image combination adjacent to the previous image frame;

[0017] Performing a replacement processing step for each backup image combination respectively to obtain a face image sequence;

[0018] The step of performing a replacement process on each backup image combination includes:

[0019] Acquire initial face information in a first standard image and a second standard image according to the RetinaFace face detection model, wherein the initial face information includes a first face bounding box and a first face key point, the first standard image is the previous frame image, and the second standard image is the next frame image;

[0020] Performing tracking prediction in a preset image range according to a preset KCF face tracking model to obtain predicted face information corresponding to the second standard image, wherein the predicted face information includes a second face bounding box and a second face key point, and the preset image range includes a first standard image of the standard picture sequence and all images sorted before the first standard image;

[0021] fusing the predicted face information of the second standard image with the initial face information of the second standard image to obtain target face information of the second standard image;

[0022] The target face information of the second standard image is added to the face image sequence.

[0023] According to a specific implementation of the embodiment of the present application, the step of fusing and judging the predicted face information of the second standard image and the initial face information of the second standard image to obtain the target face information of the second standard image includes:

[0024] Calculating an intersection-over-union ratio of the predicted face information of the second standard image and the initial face information of the second standard image;

[0025] If the intersection-over-union ratio is greater than a preset offset threshold, adding the predicted face information of the second standard image to the face image sequence;

[0026] If the intersection-over-union ratio is less than a preset offset threshold and greater than zero, adding the initial face information of the second standard image to the face image sequence;

[0027] If the intersection-over-union ratio is zero, a new face image sequence is created, and the second standard image is tracked again.

[0028] According to a specific implementation of an embodiment of the present application, the RetinaFace face detection model is a RetinaFace single-step face detector, and the step of acquiring face information in a standard image according to a preset RetinaFace face detection model includes:

[0029] Extracting facial features in the standard image based on a preset backbone network;

[0030] Performing feature enhancement processing on the facial features based on a feature pyramid network and an SSH face detection network;

[0031] Based on three parallel prediction networks, namely, ClassHead network, BoxHead network and LandmarkHead network, the face confidence, face bounding box position and face key point position of the face features are detected respectively;

[0032] Decoding the detection of the face bounding box position and the face key point position;

[0033] The repeated detection values ​​are removed by the NMS non-maximum suppression method to obtain the face information.

[0034] According to a specific implementation of an embodiment of the present application, the step of selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence, includes:

[0035] Calculate the brightness score, clarity score, posture score, resolution score and occlusion score of all images in the face image sequence according to a preset parameter scoring algorithm;

[0036] Calculate a weighted average score of each image according to a preset importance weight, the brightness score, the clarity score, the posture score, the resolution score, and the occlusion score;

[0037] The face image with the highest weighted average score is selected as the target face image.

[0038] According to a specific implementation of an embodiment of the present application, the preset image database is a blacklist database, and the target face image is searched in a preset face image library. When the preset image database includes the target face image, the step of outputting a comparison result of face recognition passing includes:

[0039] Searching for the target face image in the blacklist database;

[0040] When the target face image is included in the blacklist database, an alarm signal is sent to a preset alarm device.

[0041] In a second aspect, an embodiment of the present application provides a face recognition device, the face recognition device comprising:

[0042] An acquisition module, used for acquiring video data of a target area;

[0043] A preprocessing module, used for preprocessing the video data of the target area to obtain a standard picture sequence of the target area;

[0044] A face extraction module, used for processing the standard picture sequence based on a preset face detection model and a preset target tracking model to obtain a face image sequence;

[0045] A face screening module, used for selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence;

[0046] The face comparison module is used to search for the target face image in a preset face image database, and when the preset image database includes the target face image, output a comparison result that passes face recognition.

[0047] In a third aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising:

[0048] at least one processor; and,

[0049] a memory communicatively connected to the at least one processor; wherein,

[0050] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the face recognition method in the aforementioned first aspect or any implementation manner of the first aspect.

[0051] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the face recognition method in the aforementioned first aspect or any implementation of the first aspect.

[0052] A face recognition method, device, electronic device and readable storage medium in the embodiment of the present application, the method includes: obtaining video data of a target area; preprocessing the video data of the target area to obtain a standard picture sequence of the target area; processing the standard picture sequence based on a preset face detection model and a preset target tracking model to obtain a continuous face image sequence; selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, the target face image being the face image with the highest score in the face image sequence; searching for the target face image in a preset face image database, and when the target face image is included in the preset image database, outputting a comparison result of face recognition passing. By processing face images with a preset face detection model and a preset target tracking model, the accuracy of face information acquisition can be effectively improved, and the accuracy of face recognition can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0054] Figure 1 A schematic diagram of a method flow of a face recognition method provided in an embodiment of the present application;

[0055] Figure 2 An interactive schematic diagram of a step of fusing and judging initial face information and predicted face information in a face recognition method provided in an embodiment of the present application;

[0056] Figure 3 A schematic diagram of device modules of a face recognition device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0058] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0059] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0060] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The drawings only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0061] In addition, it should be noted that the facial recognition technology in this application is used in legal fields.

[0062] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.

[0063] The embodiment of the present application provides a face recognition method. The face recognition method provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and can be integrated in a server, terminal device, etc.

[0064] refer to Figure 1, is a schematic diagram of a method flow of a face recognition method provided in an embodiment of the present application, a face recognition method provided in an embodiment of the present application, such as Figure 1 As shown, the face recognition method includes:

[0065] Step S101, obtaining video data of a target area;

[0066] In a specific embodiment, the target area can be selected as an area that can ensure the acquisition of facial information of human subjects in any queuing scene. For example, it can be set at any gate location in urban public facilities, and a camera device can be set at the gate location of the entrance and exit queue of a subway station to obtain the passing video data of the people queuing in and out of the gate.

[0067] The video data is video stream data obtained through any electronic device that can shoot video.

[0068] Step S102, preprocessing the video data of the target area to obtain a standard picture sequence of the target area;

[0069] In a specific embodiment, after obtaining the video data of the queue passing area, it is necessary to perform corresponding conversion processing on the video data so as to obtain a picture sequence for comparison with the face images in a preset image database.

[0070] According to a specific implementation of the embodiment of the present application, the step of preprocessing the video data of the target area to obtain a standard picture sequence of the target area includes:

[0071] Performing frame slicing processing on the video data to obtain a continuous initial picture sequence;

[0072] The initial picture sequence is subjected to a preset standardization process and a preset filtering process to obtain a standard picture sequence with the same picture size.

[0073] In a specific embodiment, the video is frame-cut to obtain a continuous initial image sequence, and all initial images in the initial image sequence are standardized to obtain initial images of the same size, wherein the size can be adaptively selected according to the actual application scenario and is not limited here.

[0074] After obtaining the initial images of the same size, Gaussian filtering is performed on all the initial images to filter out the noise influence in all the initial images, so as to obtain a standard image sequence with uniform size and smoothness.

[0075] Step S103, processing the standard image sequence based on a preset face detection model and a preset target tracking model to obtain a continuous face image sequence;

[0076] In a specific embodiment, the preset face detection model may be any existing face detection model that supports real-time and rapid detection. This embodiment adopts the RetinaFace face detection model constructed based on the RetinaFace face detection algorithm.

[0077] The preset target tracking model may be an existing target tracking model that can perform prediction quickly. This embodiment adopts a KCF face tracking model built based on a KCF tracking algorithm.

[0078] Specifically, after the facial image information in the standard image sequence is obtained respectively by the RetinaFace face detection model and the KCF face tracking model, the two facial image information are analyzed and fused to obtain a facial image that can be finally compared.

[0079] When the images in the standard image sequence are processed by the above model, some images that do not meet the preset requirements may be discarded. The number of face images in the continuous face image sequence is less than the number of images in the standard image sequence.

[0080] According to a specific implementation of an embodiment of the present application, the preset face detection model is a RetinaFace face detection model, the preset target tracking model is a KCF face tracking model, and the step of processing the standard image sequence based on the preset face detection model and the preset target tracking model to obtain a continuous face image sequence includes:

[0081] Dividing every two adjacent standard image frames in the standard image sequence into a spare image combination to obtain an image combination sequence, wherein each spare image combination includes a previous image frame and a next image frame, and the next image frame of each spare image combination coincides with the previous image frame of the spare image combination adjacent to the previous image frame;

[0082] Performing a replacement processing step for each backup image combination respectively to obtain a face image sequence;

[0083] The step of performing a replacement process on each backup image combination includes:

[0084] Acquire initial face information in a first standard image and a second standard image according to the RetinaFace face detection model, wherein the initial face information includes a first face bounding box and a first face key point, the first standard image is the previous frame image, and the second standard image is the next frame image;

[0085] Performing tracking prediction in a preset image range according to a preset KCF face tracking model to obtain predicted face information corresponding to the second standard image, wherein the predicted face information includes a second face bounding box and a second face key point, and the preset image range includes a first standard image of the standard picture sequence and all images sorted before the first standard image;

[0086] fusing the predicted face information of the second standard image with the initial face information of the second standard image to obtain target face information of the second standard image;

[0087] The target face information of the second standard image is added to the face image sequence.

[0088] In a specific embodiment, the key point positions of the first human face key points and the second human face key points are five key points: the center of the two eyes, the two ends of the mouth corners and the tip of the nose.

[0089] Before processing the images in the standard sequence based on the RetinaFace face detection model and the KCF face tracking model, the images in the standard sequence need to be preprocessed.

[0090] The standard image sequence includes a plurality of continuous standard images, the Kth frame image in the standard image sequence is selected as the initial image, and the Kth frame image and the K+1th frame image are divided into a backup image combination. The Kth frame image can be the first image in the standard image sequence, or a picture in the middle of the standard image sequence, and is adaptively transformed according to the actual application scenario, which is not specifically limited here.

[0091] After the Kth frame image and the K+1th frame image are divided into spare image combinations, the spare image combination division action is continued for the next frame image, that is, the K+1th frame image and the K+2th frame image are divided into spare image combinations. The above spare image combination division steps are continuously performed until a preset number of spare image combinations are obtained to form an image combination sequence that can be used for subsequent detection. The preset number can be selected according to the detection effect of the preset face detection model and the preset target detection model in the actual application scenario, and is not specifically limited here.

[0092] After obtaining a continuous image combination sequence, a replacement processing step is performed for each spare image combination in the image combination sequence to obtain facial image information corresponding to each spare image combination. Based on the arrangement order of the image combination sequence, the facial image sequence for face comparison analysis can be obtained.

[0093] According to a specific implementation of an embodiment of the present application, the RetinaFace face detection model is a RetinaFace single-step face detector, and the step of acquiring face information in a standard image according to a preset RetinaFace face detection model includes:

[0094] Extracting facial features in the standard image based on a preset backbone network;

[0095] Performing feature enhancement processing on the facial features based on a feature pyramid network and an SSH face detection network;

[0096] Based on three parallel prediction networks, namely, ClassHead network, BoxHead network and LandmarkHead network, the face confidence, face bounding box position and face key point position of the face features are detected respectively;

[0097] Decoding the detection of the face bounding box position and the face key point position;

[0098] The repeated detection values ​​are removed by the NMS non-maximum suppression method to obtain the face information.

[0099] In a specific embodiment, the preset backbone network may use mobilene0.25 as a backbone network to extract feature maps, and extract a preset initial face feature map from the standard image.

[0100] After obtaining the initial face feature map, the initial face feature map is enhanced using a feature pyramid network (FPN) and a SSH (Single Stage Headless) network to improve the accuracy of the acquired face feature map. The feature pyramid network and the SSH network can be set using existing neural network methods, which will not be described in detail here.

[0101] Then, the ClassHead network is used to predict the face confidence, the BoxHead network is used to predict the face bounding box position, and the LandmarkHead network is used to predict the face key point position. It should be noted that the ClassHead network, the BoxHead network, and the LandmarkHead network are parallel prediction networks, that is, the face confidence, face bounding box position, and face key point position in the standard image are obtained simultaneously. Among them, the ClassHead network, the BoxHead network, and the LandmarkHead network can all be constructed using conventional neural network construction methods, which will not be described in detail here.

[0102] Because the face bounding box position and face key point position predicted by the BoxHead network and the LandmarkHead network are obtained based on feature map encoding, it is also necessary to decode the face bounding box position and the face key point position detection. Specifically, the decoding can map the obtained face bounding box position features and face key point position features from 3D to 2D, so that specific offset analysis can be performed through the face bounding box position and face key point position after dicode decoding.

[0103] After obtaining the position of the face bounding box and the position of the face key points, it is necessary to process the multiple face bounding boxes and multiple face key points through the NMS non-maximum suppression method, wherein, for the face bounding boxes and face key points in the same area, the face bounding boxes and the face key points with the highest confidence are selected to remove duplicate detection values ​​and obtain the face information corresponding to the standard image.

[0104] The RetinaFace single-step face detector can be trained using a manually annotated face dataset.

[0105] Specifically, the overlap degree between all real frames and all prior frames is calculated first, and the prior frames whose intersection-over-union ratio (IOU) with the target real frame is greater than 0.35 are marked as being able to be used to predict the target real frame. Then, all prior frames with a relatively large overlap degree with the real frame are encoded.

[0106] The loss value Loss is calculated using the processed real frame and the prediction result of the corresponding image.

[0107] According to a specific implementation of this embodiment, the step of performing tracking prediction in a preset image range according to a preset KCF face tracking model to obtain predicted face information corresponding to the second standard image includes:

[0108] The KCF face tracking model is obtained based on the kernel correlation filter algorithm (KCF for short). The specific steps of the face tracking module are: selecting the target area coordinates that are the same as the detection target area of ​​the previous frame image in the current frame image, extracting the target area coordinates as basic candidate samples, and setting the sample size of the target area coordinates of the current frame image to an image block of w*h, where w represents width and h represents height.

[0109] Establish the target area model G i, a series of sample sets are obtained by cyclically shifting in a preset image range, wherein the preset image range includes the current frame image and all standard images sorted in the current frame image. By cyclically executing the above target area coordinate acquisition step, the target area model G can be obtained. i (i∈{0,1,2,...,w-1}x{0,1,2,...,h-1}).

[0110] The weight coefficient is calculated for each basic candidate sample in the target area model, and then the similarity between the detected sample and the candidate sample in the target area model is calculated by weighted summation to obtain the response value of the next frame. In order to improve the running speed, the conversion frequency domain is solved as shown in the following formula S = F -1 [F(k)·F(δ)].

[0111] More specifically, the use process of the KCF face tracking algorithm includes three steps, namely, a model building step, an online matching step, and a template updating step.

[0112] The model building step includes: initializing the model at frame K, using the face bounding box detected by the RetinaFace face detector in the frame as the tracking target, and its position is recorded as O k , the circulant matrix shift sampling is applied to the tracking target as the training sample, and its position set is recorded as K(O k ). A regressor can be trained from the training samples, and the training formula is The regressor can compute the response of a small window of samples.

[0113] The KCF tracking algorithm regards the training process as a ridge regression problem, or a regularized least squares problem, that is, the training is to find the regression function f(z) = w T z, so that the residual function gets the minimum value, that is, Among them, z is the sample to be tracked, w is the weight vector of the classifier, and w T Transpose it; x i is the i-th sampled image, y i is the corresponding target position, i.e. the regression value, and λ is the regularization parameter to prevent overfitting. So the training sample will be represented as {(x1,y1), x2,y2)..., (x i ,y i ), ...}, the training samples are obtained by applying circulant matrix shift sampling to the tracking target.

[0114] Find the extreme value of the residual function solution, differentiate w until the derivative is 0, and get the minimum value w = (X T X+λI) -1 X Ty, where X = [x1, x2, ..., x n ], each column represents a feature vector of a training sample, y is a column vector, and each element represents a sample label, that is, the regression value y i , I is the identity matrix, and λ is the regularization parameter to prevent overfitting.

[0115] Since the calculation of training samples needs to be performed in Fourier space, the solution under complex numbers is given here as w = (X H X+λI) -1 X H y, where X H is the conjugate transposed matrix of X.

[0116] According to the above formula, the weight vector w can be calculated, thereby calculating the value of the residual function; and when the value of the residual function is minimum, the regularized risk minimum KCF tracker (that is, the regression function corresponding to the minimum value of the residual function) is obtained.

[0117] Although the above method can obtain the regularized risk minimum KCF tracker, there are a lot of inverse operations in the solution process. Due to the large number of training samples, it consumes a lot of computing power. Therefore, the properties of the circulant matrix are used to avoid the matrix inversion operation. The process is as follows:

[0118] First, the training samples are obtained by applying the circulant matrix shift sampling to the tracking target. The circulant matrix is ​​expressed as:

[0119]

[0120] Where x={x1,x2,x3...x n} represents the first row of the circulant matrix, x i is the i-th sample image.

[0121] Then, the circulant matrix is ​​used in Fourier space to calculate the weight vector of the classifier in the KCF tracker. Since the circulant matrix X has of properties, among which is the Fourier transform of x, that is F is the Fourier transform matrix. Therefore, the solution in Fourier space can be simplified to: Among them, w * is the conjugate of w, and ⊙ is the multiplication of the corresponding elements of the vector; after the transformation, the solution of the weight vector w is transformed into the Fourier space, thereby reducing the amount of calculation.

[0122] In order to solve the nonlinear problem, the concept of high-order kernel function is introduced. The solution of nonlinear problem w in high-dimensional space can be turned into a linear problem. Let the kernel function be Then the regressor weight vector becomes Then the problem to be solved changes from solving w to solving α, where α={α1,α2,...,α n} T . Let the kernel function of the product of training samples be K ij = k(x i ,y j ). After this, the regression function is transformed into:

[0123] Continue to simplify by combining the characteristics of the circulant matrix. The regression function after the above transformation is solved to obtain its regular least squares solution: α=(K+λI) -1 y, where α represents the learning coefficient, K is a matrix composed of kernel functions of different training sample products, such as Gauss kernel function and polynomial kernel function, and y is the sample regression value y i The column vector is composed of , I is the unit matrix, and λ is the regularization parameter to prevent overfitting. Using the kernel method, we get: Among them, k xx It is the vector consisting of the first row elements of the training kernel function circulant matrix; α* is the conjugate of α.

[0124] The online matching step includes: the image of the training sample position in the previous step in the K+1 frame, that is, the K(O) in the K+1 frame k ) is taken as the sample to be tracked. The sample to be tracked is brought into the regressor to calculate its response, which should be The position with the maximum response is the position of the tracked target at the K+1 frame.

[0125] The template updating step includes: using the tracking target position at k+1 to apply circulant matrix shift sampling as training samples, retraining the regressor, and applying it to the detection of the next frame, that is, repeating the online matching step.

[0126] In this embodiment, the KCF algorithm is adopted, and the circulant matrix sampling is used to transform the high-order space and introduce the kernel function method, and finally the solution of w is transformed into the solution of α: The calculation complexity is simplified, thereby improving the operation speed of face detection. According to a specific implementation method of the embodiment of the present application, the step of fusing and judging the predicted face information of the second standard image and the initial face information of the second standard image to obtain the target face information of the second standard image includes:

[0127] Calculating an intersection-over-union ratio of the predicted face information of the second standard image and the initial face information of the second standard image;

[0128] If the intersection-over-union ratio is greater than a preset offset threshold, adding the predicted face information of the second standard image to the face image sequence;

[0129] If the intersection over union is less than the preset offset threshold and greater than zero, add the initial face information of the second standard image to the face image sequence;

[0130] If the intersection over union is equal to zero, create a new face image sequence and re-track the second standard image.

[0131] In a specific embodiment, calculate the intersection over union (IOU) between the predicted face information of the second standard image and the initial face information of the second standard image. If IOU > β, where β is the offset threshold, it is considered that the target tracking has no offset, and add the predicted face information obtained by the KCF face tracking model to the face image sequence.

[0132] If 0 < IOU < β, it is considered that the target has an offset. Add the initial face information obtained by the RetinaFace face detection model to the face image sequence, and re-initialize the KCF face tracking model with the initial face information.

[0133] If IOU = 0, it is considered that the target is lost. Create a new face image sequence and re-track the target.

[0134] Step S104, select a target face image from the face image sequence according to a preset parameter scoring algorithm, where the target face image is the face image with the highest score in the face image sequence;

[0135] In a specific embodiment, after obtaining the face image sequence, it is also necessary to perform image screening in the face image sequence to select the optimal target face image for the final image library comparison step, so as to maximize the accuracy of face recognition.

[0136] Specifically, calculate the parameter index scores of all face images in the face image sequence according to a preset parameter scoring algorithm, and obtain the scores corresponding to each face image by integrating all parameter index scores. Select the face image with the highest score among all face images as the target face image.

[0137] According to a specific implementation manner of the embodiment of the present application, the step of selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, where the target face image is the face image with the highest score in the face image sequence, includes:

[0138] Calculate the brightness score, clarity score, pose score, resolution score, and occlusion score of all images in the face image sequence respectively according to a preset parameter scoring algorithm;

[0139] Calculate a weighted average score of each image according to a preset importance weight, the brightness score, the clarity score, the posture score, the resolution score, and the occlusion score;

[0140] The face image with the highest weighted average score is selected as the target face image.

[0141] In a specific embodiment, the face quality judgment module provided in the SeetaFace6 face recognition algorithm is first used to score the face sequence. The brightness evaluation module is used to evaluate whether the brightness value in the face area is uniform and normal, and the brightness score is obtained. QB , use the clarity assessment module to evaluate whether the face image is clear by counting the degree of image information loss after secondary blurring, and get the clarity score score QC , use the posture assessment module to assess whether the posture is frontal through the coordinate values ​​of the five key points of the face, and get the posture score QP , use the resolution evaluation to calculate the face resolution and get the resolution score score QR , use the occlusion assessment module to calculate the degree of occlusion of the five key points and obtain the occlusion score QS .

[0142] By formula Calculate the total score Score.

[0143] Among them, ω QB ,ω QC ,ω QP ,ω QR With ω QS are the importance weights of the corresponding scores. Score all face images in each sequence and select the face with the highest score as the optimal face image of the face image sequence.

[0144] Step S105 , searching for the target face image in a preset face image database, and when the preset image database includes the target face image, outputting a comparison result that passes face recognition.

[0145] In a specific embodiment, the preset face image library can be adaptively set according to the actual application scenario. For example, when the camera device is set at the entrance and exit of a community, the preset face image library can be the corresponding images of the residents in the community; when the camera device is set at the entrance and exit of an office building, the preset face image library can be the corresponding images of the office staff in the office building.

[0146] In actual application scenarios, after outputting the comparison results of face recognition, you can add interactions with different terminals to achieve different functions. For example, when the preset face image library is the images of residents in the community, through interaction with the access control terminal, the function of automatically opening the access control device after face recognition is passed can be achieved.

[0147] According to a specific implementation of an embodiment of the present application, the preset image database is a blacklist database, and the target face image is searched in a preset face image library. When the preset image database includes the target face image, the step of outputting a comparison result of face recognition passing includes:

[0148] Searching for the target face image in the blacklist database;

[0149] When the target face image is included in the blacklist database, an alarm signal is sent to a preset alarm device.

[0150] In a specific embodiment, the preset image database can be set as a blacklist database, and by setting the preset image database as a blacklist database and adding an interactive program with the alarm terminal, it is possible to directly perform an alarm action through the alarm terminal when the corresponding target face image is found in the blacklist database.

[0151] Specifically, the alarm terminal can be a terminal device that directly displays alarm information, such as a buzzer or a display, or a terminal device that sends alarm information to a preset target terminal, such as a computer or a mobile phone. Specifically, the setting of the alarm terminal can be adaptively set according to the actual application scenario.

[0152] Specifically, the step of searching for the target face image in the blacklist database includes uploading the target face image of each sequence to the blacklist database, and calculating the similarity between the target face image of the sequence and the blacklist face image in the blacklist database through the face feature comparison module provided in the SeetaFace6 face recognition algorithm. When the similarity is greater than the alarm threshold th Alarm An alarm signal is generated.

[0153] The face recognition method provided in this embodiment detects face information in the same image through different algorithm detectors, and fuses and screens the two types of face information obtained, thereby obtaining a target face image for face recognition, which effectively improves the accuracy and speed of face recognition. In addition, by setting the preset image database as a blacklist database, it is possible to quickly identify the face images of people queuing in public places, and directly alarm when blacklisted people are found, accurately alarming abnormal situations while ensuring smooth flow of people, thereby ensuring the safety of public places.

[0154] refer to Figure 3 , is a schematic diagram of a device module 300 of a face recognition device provided in an embodiment of the present application. The face recognition device 300 provided in an embodiment of the present application, such as Figure 3 As shown, the face recognition device 300 includes:

[0155] An acquisition module 301 is used to acquire video data of a target area;

[0156] A preprocessing module 302 is used to preprocess the video data of the target area to obtain a standard picture sequence of the target area;

[0157] A face extraction module 303, used for processing the standard picture sequence based on a preset face detection model and a preset target tracking model to obtain a face image sequence;

[0158] A face screening module 304 is used to select a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence;

[0159] The face comparison module 305 is used to search for the target face image in a preset face image database, and output a comparison result that passes face recognition when the preset image database includes the target face image.

[0160] Figure 3 The device shown can correspondingly execute the contents of the above method embodiment. For the parts not described in detail in this embodiment, refer to the contents recorded in the above method embodiment and will not be repeated here.

[0161] In addition, an embodiment of the present application further provides an electronic device, the electronic device comprising:

[0162] at least one processor; and,

[0163] a memory communicatively connected to the at least one processor; wherein,

[0164] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the face recognition method in the aforementioned method embodiment.

[0165] An embodiment of the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the face recognition method in the aforementioned method embodiment.

[0166] In summary, the embodiments of the present application provide a face recognition method, device, electronic device and readable storage medium. The face recognition method provided by the present application is based on two face detection models that support real-time and rapid detection. The RetinaFace face detection model and the KCF face tracking model respectively predict the face information of the same standard image, and perform preset correction processing based on the two types of face information obtained to obtain the target face image for final face recognition, while ensuring the detection speed and the accuracy of face recognition. By setting up a blacklist database, the face recognition method can be applied to any public queuing scene where it is necessary to ensure smooth flow of people, and the blacklisted personnel can be accurately identified without hindering the normal passage of personnel. The efficiency of face recognition is greatly improved, and the scope of use of face recognition is expanded.

[0167] The electronic devices in the embodiments of the present application may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc.

[0168] It should be noted that the computer-readable medium disclosed above 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.

[0169] In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, 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. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A 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 combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0170] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0171] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains at least two Internet Protocol addresses; sends a node evaluation request including the at least two Internet Protocol addresses to a node evaluation device, wherein the node evaluation device selects an Internet Protocol address from the at least two Internet Protocol addresses and returns it; receives the Internet Protocol address returned by the node evaluation device; wherein the obtained Internet Protocol address indicates an edge node in a content distribution network.

[0172] Alternatively, the computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device: receives a node evaluation request including at least two Internet Protocol addresses; selects an Internet Protocol address from the at least two Internet Protocol addresses; and returns the selected Internet Protocol address; wherein the received Internet Protocol address indicates an edge node in a content distribution network.

[0173] Computer program code for performing the operations of the present disclosure 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 user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's 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).

[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square 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 implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square 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 square box in the block diagram and / or flow chart, and the combination of the square 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.

[0175] The units involved in the embodiments described in the present application may be implemented by software or hardware. The name of the unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".

[0176] It should be understood that various parts of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.

[0177] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims

1. A face recognition method, characterized in that: The face recognition method comprises: Obtain video data of the target area; Preprocessing the video data of the target area to obtain a standard picture sequence of the target area; Processing the standard image sequence based on a preset face detection model and a preset target tracking model to obtain a continuous face image sequence; Selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence; Searching for the target face image in a preset face image database, and when the preset image database includes the target face image, outputting a comparison result of face recognition passing, wherein The preset face detection model is a RetinaFace face detection model, the preset target tracking model is a KCF face tracking model, and the step of processing the standard image sequence based on the preset face detection model and the preset target tracking model to obtain a continuous face image sequence includes: Dividing every two adjacent standard image frames in the standard image sequence into a spare image combination to obtain an image combination sequence, wherein each spare image combination includes a previous image frame and a next image frame, and the next image frame of each spare image combination coincides with the previous image frame of the spare image combination adjacent to the previous image frame; Performing a replacement processing step for each backup image combination respectively to obtain a face image sequence; The step of performing a replacement process on each backup image combination includes: Acquire initial face information in a first standard image and a second standard image according to the RetinaFace face detection model, wherein the initial face information includes a first face bounding box and a first face key point, the first standard image is the previous frame image, and the second standard image is the next frame image; Performing tracking prediction in a preset image range according to a preset KCF face tracking model to obtain predicted face information corresponding to the second standard image, wherein the predicted face information includes a second face bounding box and a second face key point, and the preset image range includes a first standard image of the standard picture sequence and all images sorted before the first standard image; fusing the predicted face information of the second standard image with the initial face information of the second standard image to obtain target face information of the second standard image; The target face information of the second standard image is added to the face image sequence.

2. The face recognition method according to claim 1, characterized in that: The step of preprocessing the video data of the target area to obtain a standard picture sequence of the target area includes: Performing frame slicing processing on the video data to obtain a continuous initial picture sequence; The initial picture sequence is subjected to a preset standardization process and a preset filtering process to obtain a standard picture sequence with the same picture size.

3. The face recognition method according to claim 1, characterized in that: The step of fusing and judging the predicted face information of the second standard image and the initial face information of the second standard image to obtain the target face information of the second standard image includes: Calculating an intersection-over-union ratio between the predicted face information of the second standard image and the initial face information of the second standard image; If the intersection-over-union ratio is greater than a preset offset threshold, adding the predicted face information of the second standard image to the face image sequence; If the intersection-over-union ratio is less than a preset offset threshold and greater than zero, adding the initial face information of the second standard image to the face image sequence; If the intersection-over-union ratio is zero, a new face image sequence is created, and the second standard image is tracked again.

4. The face recognition method according to claim 1, characterized in that: The RetinaFace face detection model is a RetinaFace single-step face detector. The step of obtaining face information in a standard image according to a preset RetinaFace face detection model includes: Extracting facial features in the standard image based on a preset backbone network; Performing feature enhancement processing on the facial features based on a feature pyramid network and an SSH face detection network; Based on three parallel prediction networks, namely, ClassHead network, BoxHead network and LandmarkHead network, the face confidence, face bounding box position and face key point position of the face features are detected respectively; Decoding the detection of the face bounding box position and the face key point position; The repeated detection values ​​are removed by the NMS non-maximum suppression method to obtain the face information.

5. The face recognition method according to claim 1, characterized in that: The step of selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence, comprises: Calculate the brightness score, clarity score, posture score, resolution score and occlusion score of all images in the face image sequence according to a preset parameter scoring algorithm; Calculate a weighted average score of each image according to a preset importance weight, the brightness score, the clarity score, the posture score, the resolution score, and the occlusion score; The face image with the highest weighted average score is selected as the target face image.

6. The face recognition method according to claim 1, characterized in that: The preset image database is a blacklist database, and the step of searching for the target face image in the preset face image database, and outputting the comparison result of face recognition passing when the preset image database includes the target face image, comprises: Searching for the target face image in the blacklist database; When the target face image is included in the blacklist database, an alarm signal is sent to a preset alarm device.

7. A face recognition device, characterized in that: The device comprises: An acquisition module, used for acquiring video data of a target area; A preprocessing module, used for preprocessing the video data of the target area to obtain a standard picture sequence of the target area; A face extraction module, used for processing the standard picture sequence based on a preset face detection model and a preset target tracking model to obtain a face image sequence; A face screening module, used for selecting a target face image from the face image sequence according to a preset parameter scoring algorithm, wherein the target face image is the face image with the highest score in the face image sequence; A face comparison module is used to search for the target face image in a preset face image database, and when the preset image database includes the target face image, output a comparison result that passes face recognition, wherein The preset face detection model is a RetinaFace face detection model, the preset target tracking model is a KCF face tracking model, and the step of processing the standard image sequence based on the preset face detection model and the preset target tracking model to obtain a continuous face image sequence includes: Dividing every two adjacent standard image frames in the standard image sequence into a spare image combination to obtain an image combination sequence, wherein each spare image combination includes a previous image frame and a next image frame, and the next image frame of each spare image combination coincides with the previous image frame of the spare image combination adjacent to the previous image frame; Performing a replacement processing step for each backup image combination respectively to obtain a face image sequence; The step of performing a replacement process on each backup image combination includes: Acquire initial face information in a first standard image and a second standard image according to the RetinaFace face detection model, wherein the initial face information includes a first face bounding box and a first face key point, the first standard image is the previous frame image, and the second standard image is the next frame image; Performing tracking prediction in a preset image range according to a preset KCF face tracking model to obtain predicted face information corresponding to the second standard image, wherein the predicted face information includes a second face bounding box and a second face key point, and the preset image range includes a first standard image of the standard picture sequence and all images sorted before the first standard image; fusing the predicted face information of the second standard image with the initial face information of the second standard image to obtain target face information of the second standard image; The target face information of the second standard image is added to the face image sequence.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the face recognition method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the face recognition method according to any one of claims 1 to 6.

Citation Information

Cited By

  • Diagnostic support through low-resource image analysis

    FR3174823A1

  • Assisting diagnosis using image analysis with low resource consumption

    WO2026229017A1