Movatterモバイル変換


[0]ホーム

URL:


CN115359521B - Face recognition method, device, equipment and storage medium - Google Patents

Face recognition method, device, equipment and storage medium
Download PDF

Info

Publication number
CN115359521B
CN115359521BCN202210866085.6ACN202210866085ACN115359521BCN 115359521 BCN115359521 BCN 115359521BCN 202210866085 ACN202210866085 ACN 202210866085ACN 115359521 BCN115359521 BCN 115359521B
Authority
CN
China
Prior art keywords
face
target
face image
bounding box
real
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210866085.6A
Other languages
Chinese (zh)
Other versions
CN115359521A (en
Inventor
盛建达
童欣
朱自翀
戴磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co LtdfiledCriticalPing An Technology Shenzhen Co Ltd
Priority to CN202210866085.6ApriorityCriticalpatent/CN115359521B/en
Publication of CN115359521ApublicationCriticalpatent/CN115359521A/en
Application grantedgrantedCritical
Publication of CN115359521BpublicationCriticalpatent/CN115359521B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

Translated fromChinese

本发明涉及人工智能技术,揭露一种人脸识别方法,包括:通过人脸图像数据集进行人脸识别模型训练;通过人脸目标的真实边框、人脸目标的真实边框的宽度、高度以及中心点坐标和人脸目标的真实边框的身份类别构建损失函数模型;采用梯度下降法对损失函数模型进行优化训练;将待识别的人脸图像输入基于轻量级多尺度特征融合的人脸识别网络模型进行预测,得到待识别的人脸图像中的人脸目标的预测边框、与预测边框对应的身份类别、以及与身份类别对应的识别准确度。本发明还涉及区块链技术,人脸图像数据集存储于区块链中。本发明能够解决现有技术中,模型参数量大,降低了模型运行速度,使模型不便于部署于对实时性要求较高的移动端设备等问题。

The present invention relates to artificial intelligence technology, and discloses a face recognition method, including: training a face recognition model through a face image data set; constructing a loss function model through the real border of a face target, the width and height of the real border of the face target, the coordinates of the center point, and the identity category of the real border of the face target; optimizing the loss function model by using the gradient descent method; inputting the face image to be recognized into a face recognition network model based on lightweight multi-scale feature fusion for prediction, and obtaining the predicted border of the face target in the face image to be recognized, the identity category corresponding to the predicted border, and the recognition accuracy corresponding to the identity category. The present invention also relates to blockchain technology, and the face image data set is stored in the blockchain. The present invention can solve the problems in the prior art that the model parameters are large, the model running speed is reduced, and the model is not convenient to be deployed on mobile devices with high real-time requirements.

Description

Face recognition method, device, equipment and storage medium
Technical Field
The present invention relates to the field of artificial intelligence, and in particular, to a face recognition method, apparatus, device, and storage medium.
Background
Face recognition is a biological feature-based recognition technology for identity verification, and is one of the most popular research problems in the field of computer vision since the development of the 70 th century. Along with the proposal of concepts such as smart cities, man-machine interaction and the like, the research of the face recognition technology has important significance, and is widely applied to the fields such as security monitoring, mobile payment, unmanned driving and the like.
The development of the face recognition technology mainly comprises three stages, namely a first stage, a second stage, a third stage and a third stage, wherein the first stage adopts subspace, geometric features, template matching and other methods, the methods need to manually extract features and cannot realize full-automatic face recognition, the second stage adopts a combination mode of an extractor and a feature classifier of face features, the extracted features of the method are too single to meet complex face recognition scenes, and the third stage, namely the current stage, has obvious advantages in detection precision compared with the traditional algorithm along with the wide application of the deep learning technology in the image field.
In order to pursue better performance, researchers usually adopt deeper neural networks to conduct face recognition, and in this way, although the accuracy of a face recognition algorithm can be improved, the number of model parameters is increased, the running speed of a model is reduced, and the model is inconvenient to deploy in mobile terminal equipment with higher requirements on real-time performance. Therefore, based on the above-mentioned problems, a method is needed to design a mobile embedded device with limited memory and calculation amount, which makes the memory occupied by the face recognition model smaller and keeps higher recognition accuracy.
Disclosure of Invention
The invention provides a face recognition method, a device, equipment and a storage medium, which mainly aim to solve the problems that in the prior art, when a neural network with higher accuracy is adopted for face recognition, the parameter quantity of a model is large, the running speed of the model is reduced, the model is inconvenient to deploy in mobile terminal equipment with higher real-time requirements, and the like.
In order to achieve the above object, a first aspect of the present invention provides a face recognition method, including:
inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to perform face recognition model training, wherein the face image dataset comprises a face picture, a real frame of a face target marked on the face picture, a width and a height of the real frame of the face target, a center point coordinate and identity categories marked on the real frame of the face target;
In a face recognition network trained by a face recognition model, constructing a loss function model through the real frame of the face target, the width and the height of the real frame of the face target, the coordinates of the central point and the identity class of the real frame of the face target;
Optimizing training the loss function model by adopting a gradient descent method, obtaining a face recognition network model based on lightweight multi-scale feature fusion when the loss function of the loss function model reaches a preset threshold value, wherein,
The face recognition network model based on lightweight multi-scale feature fusion comprises a main network layer, a pooling layer, a feature fusion layer and a detection head layer, wherein the main network layer is used for carrying out feature extraction on three different image dimensions on a face image, the pooling layer is used for pooling third output features obtained by the main network layer, the feature fusion layer is used for carrying out feature fusion processing on first output features, second output features and pooled third output features obtained by the pooling layer respectively, and the detection head layer is used for generating a prediction result according to the three fused features obtained by the feature fusion layer;
Inputting the face image to be recognized into the face recognition network model based on lightweight multi-scale feature fusion for face recognition, and obtaining a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame and recognition accuracy corresponding to the identity class.
In a second aspect, to solve the above-mentioned problem, the present invention further provides a face recognition device, including:
The training module is used for inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to carry out face recognition model training, wherein the face image dataset comprises a face picture, a real frame of a face target marked on the face picture, a width and a height of the real frame of the face target, a central point coordinate and identity categories marked on the real frame of the face target;
The loss function construction module is used for constructing a loss function model in the face recognition network trained by the face recognition model through the real frame of the face target, the width and the height of the real frame of the face target, the center point coordinates and the identity class of the real frame of the face target;
The optimizing module is used for optimizing and training the loss function model by adopting a gradient descent method, when the loss function of the loss function model reaches a preset threshold value, a face recognition network model based on lightweight multi-scale feature fusion is obtained, wherein,
The face recognition network model based on lightweight multi-scale feature fusion comprises a main network layer, a pooling layer, a feature fusion layer and a detection head layer, wherein the main network layer is used for carrying out feature extraction on three different image dimensions on a face image, the pooling layer is used for pooling third output features obtained by the main network layer, the feature fusion layer is used for carrying out feature fusion processing on first output features, second output features and pooled third output features obtained by the pooling layer respectively, and the detection head layer is used for generating a prediction result according to the three fused features obtained by the feature fusion layer;
And the prediction module inputs the face image to be recognized into the face recognition network model based on lightweight multi-scale feature fusion to perform face recognition, so that a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame and recognition accuracy corresponding to the identity class are obtained.
In order to solve the above-mentioned problems, the present invention also provides an electronic device including:
At least one processor, and
A memory communicatively coupled to the at least one processor, wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the face recognition method as described above.
In a fourth aspect, in order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the face recognition method as described above.
According to the face recognition method, device, equipment and storage medium, the face recognition network based on lightweight multi-scale feature fusion is used for carrying out face recognition training by inputting the face image dataset into the face recognition network based on lightweight multi-scale feature fusion, the obtained face recognition network model based on lightweight multi-scale feature fusion is used for extracting image features, and the self-adaptive feature fusion structure is introduced for fusing features with different scales (different dimensions), so that the accuracy of the model can be kept under the condition of obviously reducing the size of the model, high-performance face recognition at a mobile end and embedded equipment is realized, the quantity of parameters of the face recognition network model obtained through training is less, the size of memory required by the face recognition network is reduced, the calculation quantity of the network is reduced, the feature fusion effect is enhanced, the model training time is shortened, the model accuracy is improved, and the method has universality and can be popularized to similar tasks such as pedestrian detection and expression recognition.
Drawings
Fig. 1 is a schematic flow chart of a face recognition method according to an embodiment of the present invention;
Fig. 1.1 is an overall structure diagram of a face recognition network based on lightweight multi-scale feature fusion according to an embodiment of the present invention;
FIG. 1.2 is an overall block diagram of the structure of the original YOLOv network;
fig. 2 is a schematic block diagram of a face recognition device according to an embodiment of the present invention;
Fig. 3 is a schematic diagram of an internal structure of an electronic device for implementing a face recognition method according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Wherein artificial intelligence (ARTIFICIAL INTELLIGENCE, AI) is the theory, method, technique, and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, electromechanical integration, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
The invention provides a face recognition method. Referring to fig. 1, a flow chart of a face recognition method according to an embodiment of the invention is shown. The method may be performed by an apparatus, which may be implemented in software and/or hardware.
In this embodiment, the face recognition method includes:
step S110, inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to perform face recognition model training, wherein the face image dataset comprises a face picture, a real frame of a face target marked on the face picture, the width and the height of the real frame of the face target, center point coordinates and identity categories marked on the real frame of the face target.
Specifically, the face image dataset includes a plurality of face images, each face image includes at least one face image, the source of the face image can be a face image acquired through a social network or a face image which is specially shot according to an actual purpose, each face on each face image carries out real frame marking of a face target, the width, the height and the center point coordinates of each real frame are calculated, and identity class marking is required for each real frame, wherein the identity class can be identity information of the face, such as an identity card number and a name, or other identity information which needs to be authenticated during face recognition, such as a work number code of a corresponding employee in staff attendance checking equipment.
As an optional embodiment of the present invention, the face image dataset is stored in a blockchain, and before the face image dataset is input into the face recognition network based on lightweight multi-scale feature fusion for training the face recognition model, the method further comprises:
acquiring a face image sample to obtain a face image sample set;
labeling the real frames of the face targets in the face image sample set, calculating the width, the height and the center point coordinates of the real frames of the labeled face targets, and marking the identity types of the real frames of the face targets to obtain a face image data set.
Specifically, corresponding face image samples are collected according to the actual face recognition application scene, for example, for places needing identity verification such as stations and airports, the face images and corresponding information can be collected through a system, at the moment, each image can only comprise one face, the face images of workers can be directly collected for staff attendance, and each image can have one face or a plurality of faces. The method comprises the steps of collecting a plurality of face image samples to form a face image sample set, carrying out real frame marking on each face image in the face image sample set, and carrying out identity category marking on the real frame of each marked face object by adopting picture files in different formats, for example TXT format pictures, recording face coordinates in the picture files in the format, marking the real frame of the face object through face coordinates, calculating the width, the height and the center point coordinates of the real frame, and carrying out identity category marking on the real frame of each marked face object.
As an optional embodiment of the invention, marking the real frame of the face object in the face image sample set, calculating the width, height and center point coordinates of the marked real frame of the face object, marking the identity category of the real frame of the face object, and obtaining the face image data set comprises:
Defining a face image sample set as { Datak (X, Y), K epsilon [1, K ], X epsilon [1, X ], Y epsilon [1, Y ] }, wherein Datak (X, Y) represents pixel information of an xth line and a yth column of a kth picture in the face image sample set, K represents the number of pictures in the face image sample set, X represents the number of lines of pixels of the pictures in the face image sample set, and Y represents the number of columns of the pixels of the pictures in the face image sample set;
Labeling a real frame of each face target in each picture in the defined face image sample set, wherein the real frame of the face target is defined as:
wherein, theRepresenting the upper left corner coordinates of the real border of the nth face object in the kth picture in the face image sample set,Representing the abscissa of the upper left corner coordinate point of the real frame of the nth face object in the kth picture in the face image sample set,Representing the ordinate of the upper left corner coordinate point of the real frame of the nth face target in the kth picture in the face image sample set; Representing the lower right corner coordinates of the real border of the nth face object in the kth picture in the face image sample set,Representing the abscissa of the lower right corner coordinate point of the real frame of the nth face object in the kth picture in the face image sample set,The method comprises the steps of obtaining a preset face recognition network model, representing the ordinate of a right lower corner coordinate point of a real frame of an nth face target in a kth picture in a face image sample set, wherein K represents the number of pictures in the face image sample set, and Nk represents the number of real frames of the face target in the kth picture in a face image training data set selected as the face image training data set for the preset face recognition network model training;
Respectively calculating the width, height and center point coordinates of the real frame of the face target according to a preset real frame width calculation formula, a preset real frame height calculation formula and a preset real frame center point coordinate calculation formula, marking the identity category of the real frame of the face target to obtain a face image dataset,
The preset real frame width calculation formula is as follows:
the preset real frame height calculation formula is as follows:
The preset real frame center point coordinate calculation formula is as follows:
the identity category of the real frame of the face target is defined as:
wherein, theRepresenting the width of the real frame of the nth face object in the kth image in the face image sample set,And the height of a real frame of an nth face target in an kth image in the face image sample set is represented, and t represents reality.
Specifically, by defining a face image sample set, each picture in the face image sample set and each face image on each picture can be represented by the corresponding position, the real frame of the face target is defined according to the position of the face image, the height, width and center coordinates of the face target are calculated according to the real frame, and the identity class of the real frame is defined, so that the picture information is converted into digital information capable of being operated, and the subsequent calculation is facilitated.
And step 120, constructing a loss function model in the face recognition network trained by the face recognition model through the real frame of the face target, the width and the height of the real frame of the face target, the center point coordinates and the identity class of the real frame of the face target.
Specifically, the loss function (loss function) model is used for measuring the inconsistency degree of the predicted value f (x) and the true value Y of the face recognition network obtained through training, and is a non-negative real value function, and is expressed by L (Y, f (x)), and the smaller the loss function is, the better the robustness of the network obtained through training is. The loss function is a core part of the empirical risk function and is also an important component of the structural risk function. The structural risk function of the model includes empirical risk terms and regularization terms.
In order to ensure the accuracy of the face recognition network model obtained after the face recognition network is trained, a loss function model is required to be built in the face recognition network obtained after the training, a face image data set can be divided into two parts in the process of training the model, one part is used as a face image training data set, the other part is used as a face image verification optimizing data set, the face image training data set is used for training the face recognition network, and then the face image verification optimizing data set is used for optimizing.
As an alternative embodiment of the invention, the loss function model includes a target bounding box loss model;
the calculation formula of the target bounding box loss model is as follows:
wherein, theThe Euclidean distance between the center points of the predicted frame and the real frame of the face target is represented, c represents the length of the diagonal line of the minimum rectangle of the predicted frame and the real frame which can cover the face target, and the calculation mode of c is as follows:
IOU represents the intersection ratio of the predicted border and the real border of the face object, Ch and CW represent the height and width of the smallest rectangle capable of covering the predicted border and the real border of the face object,H and hgt respectively represent the height of the predicted frame of the face target and the height of the real frame of the face target, w and wgt respectively represent the height of the predicted frame of the face target and the width of the real frame of the face target, and the calculation modes of v and alpha in the formula are as follows:
The width and the height of the predicted frame of each face target in each face picture in the face image data set are respectively defined as:
And
The central point coordinates of the predicted frame of each face target in each face image in the face image data set are defined as follows:
specifically, through the created target bounding box loss model, the accuracy degree of the predicted frame marking position of the face target of the face image to be recognized can be optimized.
As an alternative embodiment of the invention, the loss function model further comprises a target confidence loss model;
the calculation formula of the target confidence loss model is as follows:
wherein, theRepresenting identity categories within the true borders of the nth face object in the kth picture in the face image dataset,And (3) representing identity categories in a predicted frame of an nth face target in a kth picture in the face image data set, wherein lambdanoobject represents confidence penalty weights when no target exists in the predicted frame of the face target.
Specifically, the accuracy of the predicted target of the predicted frame of the face image to be recognized can be optimized through the created target confidence loss model.
As an alternative embodiment of the invention, the loss function model further comprises a target class loss model;
The calculation formula of the target class loss model is as follows:
wherein, theRepresenting the confidence of the identity class in the real border of the nth face object in the kth picture in the face image dataset,Representing the identity category confidence in the predicted frame of the nth face object in the kth picture in the face image data set;
The predicted frame of each face target in each face image in the face image dataset is defined as:
wherein, theRepresenting the upper left corner coordinates of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the abscissa of the upper left corner coordinate point of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the ordinate of the upper left corner coordinate point of the predicted frame of the nth face target in the kth picture in the face image data set; Representing the lower right corner coordinates of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the abscissa of the lower right corner coordinate point of the n-th face target prediction frame in the k-th picture in the face image data set,And Nk 'represents the ordinate of a right lower corner coordinate point of a predicted frame of an nth face target in a kth picture in the face image dataset, and Nk' represents the number of predicted frames of the face target selected as the face target in the face image training dataset for training of the preset face recognition network model.
Specifically, the accuracy of identity class prediction in the prediction frame of the face image to be recognized can be optimized through the created target class loss model.
Step S130, optimizing and training the loss function model by adopting a gradient descent method, obtaining a face recognition network model based on lightweight multi-scale feature fusion when the loss function of the loss function model reaches a preset threshold value, wherein,
The face recognition network model based on the lightweight multi-scale feature fusion comprises a main network layer, a pooling layer, a feature fusion layer and a detection head layer, wherein the main network layer is used for carrying out feature extraction on three different image dimensions on a face image, the pooling layer is used for pooling third output features obtained by the main network layer, the feature fusion layer is used for carrying out feature fusion processing on first output features, second output features and pooled third output features obtained by the pooling layer respectively, and the detection head layer is used for generating a prediction result according to the three fused features obtained by the feature fusion layer.
Specifically, the loss function of the loss function model of the face recognition network based on lightweight multi-scale feature fusion can only comprise one of a target confidence loss model, a target boundary box loss model and a target category loss model, or can also comprise two of the three loss function models, when the three loss function models are simultaneously included, the loss function of the face recognition network based on lightweight multi-scale feature fusion is loss (object) =loss (box) + loss (confidence) +loss (type), and when loss (object) reaches a preset threshold, training is completely optimized, and the face recognition network model based on lightweight multi-scale feature fusion is obtained.
The loss function model of the face recognition network based on lightweight multi-scale feature fusion is trained by adopting the face recognition network based on lightweight multi-scale feature fusion, so that the face recognition network based on lightweight multi-scale feature fusion has the advantages of less calculation parameters, smaller occupied memory, high accuracy and the like, and as shown in fig. 1.1 and 1.2, the invention can obviously realize high-performance face recognition at a mobile terminal and embedded equipment by improving the integral structure of the original YOLOv network structure, thereby obtaining the structure of the face recognition network based on lightweight multi-scale feature fusion, extracting image features by using the lightweight network, and introducing the self-adaptive feature fusion structure to fuse features of different scales.
Step S140, inputting the face image to be recognized into a face recognition network model based on lightweight multi-scale feature fusion for face recognition, and obtaining a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame and recognition accuracy corresponding to the identity class.
Specifically, the face image to be recognized is input into the face recognition network model based on lightweight multi-scale feature fusion, the face image is processed by each functional structure layer in the face recognition network model based on lightweight multi-scale feature fusion, and finally the predicted frame of the face target in the face image to be recognized, the identity class corresponding to the predicted frame and the recognition accuracy corresponding to the identity class are output.
As an optional embodiment of the invention, inputting the face image to be recognized into a face recognition network model based on lightweight multi-scale feature fusion for face recognition, and obtaining the predicted frame of the face target in the face image to be recognized, the identity class corresponding to the predicted frame and the recognition accuracy corresponding to the identity class comprise:
Three different image dimension feature extraction is carried out on a face image to be identified through a backbone network layer to obtain three different dimension features, namely a feature X1, a feature X2 and a feature X3, and convolution operation processing is carried out on the feature X1, the feature X2 and the feature X3 to obtain a first output feature Level1, a second output feature Level2 and a third output feature respectively;
Carrying out pooling treatment on the third output characteristics through a pooling layer to obtain pooled third output characteristics Level3;
performing feature fusion processing on the first output feature Level1, the second output feature Level2 and the pooled third output feature Level3 through a feature fusion layer to respectively obtain a first fusion feature ASFF, a second fusion feature ASFF and a third fusion feature ASFF3, wherein,
The first fusion feature ASFF is obtained by multiplying and then adding Level1, level2 and Level3 to the parameter alpha111 respectively, ASFF is obtained by multiplying and then adding Level1, level2, level3 to the parameter alpha222 respectively, and ASFF3 is obtained by multiplying and then adding Level1, level2, level3 to the parameter alpha333 respectively;
By detecting the head layer, a predicted frame of a face target in a face image to be recognized, an identity class corresponding to the predicted frame, and recognition accuracy corresponding to the identity class are generated according to the first fusion feature ASFF, the second fusion feature ASFF and the third fusion feature ASFF.
Specifically, when a face image to be recognized is input into a face recognition network model based on lightweight multi-scale feature fusion, feature extraction is performed on the face image according to three different size dimensions on a backbone network layer, at this time, single features of the face, such as eyes, noses, mouths and the like, are extracted, then the single features are comprehensively formed into three output features through convolution calculation, namely a first output feature Level1, a second output feature Level2 and a third output feature, as a feature layer of the third output feature is connected with a pooling layer, pooling processing is performed through the third output feature of the pooling layer, computation of the third output layer is simplified after dimension reduction is performed, a pooled third output feature Level3 is obtained, feature fusion processing is performed on the first output feature Level1, the second output feature Level2 and the pooled third output feature Level3 through the feature fusion layer, alpha111222333 is a known parameter, and finally a predicted result of the face image to be recognized is obtained according to the feature to the fused by detecting the head layer.
Fig. 2 is a functional block diagram of a face recognition device according to an embodiment of the present invention.
The face recognition device 200 of the present invention may be installed in an electronic apparatus. Depending on the implemented functionality, the face recognition device may include a training module 210, a loss function construction module 220, an optimization module 230, a prediction module 240. The module of the present invention may also be referred to as a unit, meaning a series of computer program segments capable of being executed by the processor of the electronic device and of performing fixed functions, stored in the memory of the electronic device.
In the present embodiment, the functions concerning the respective modules/units are as follows:
the training module 210 is configured to input the face image dataset into a face recognition network based on lightweight multi-scale feature fusion for face recognition model training.
The face image dataset comprises a face picture, a real frame of a face target marked on the face picture, the width and the height of the real frame of the face target, center point coordinates and identity categories marked on the real frame of the face target.
Specifically, the face image dataset includes a plurality of face images, each face image includes at least one face image, the source of the face image can be a face image acquired through a social network or a face image which is specially shot according to an actual purpose, each face on each face image carries out real frame marking of a face target, the width, the height and the center point coordinates of each real frame are calculated, and identity class marking is required for each real frame, wherein the identity class can be identity information of the face, such as an identity card number and a name, or other identity information which needs to be authenticated during face recognition, such as a work number code of a corresponding employee in staff attendance checking equipment.
As an alternative embodiment of the present invention, the face image dataset is stored in a blockchain, and the face recognition device 200 further includes a face image sample acquisition module and a labeling module (not shown). Wherein, the
The face image sample acquisition module is used for acquiring a face image sample to obtain a face image sample set;
The labeling module is used for labeling the real frames of the face targets in the face image sample set, calculating the width, the height and the center point coordinates of the real frames of the labeled face targets, and labeling the identity categories of the real frames of the face targets to obtain the face image data set.
Specifically, through a face image sample acquisition module, corresponding face image samples are acquired according to the application scene of actual face recognition, for example, for places needing identity verification such as stations and airports, the face images and corresponding information can be acquired through a public security system, at the moment, only one face image can be included in each picture, the face images of workers can be directly acquired for staff attendance, and each picture can have one face or a plurality of faces. The method comprises the steps of collecting a plurality of face image samples to form a face image sample set, marking the real frames of each face image on each face image in the face image sample set through a marking module, finishing the marking of the real frames by adopting different format image files, for example, TXT format images, recording face coordinates in the format image files, marking the real frames of the face targets through the face coordinates, calculating the width, the height and the center point coordinates of the real frames, and marking the identity category of the real frames of each marked face target.
As an alternative embodiment of the invention, the labeling module further comprises a sample set definition unit, a real border labeling unit and a computing unit (not shown in the figure). Wherein, the
The sample set definition unit is used for defining the face image sample set as { Datak (x, y), k epsilon-
Wherein, datak (X, Y) represents the pixel information of the X-th row and Y-th column of the kth image in the face image sample set, K represents the number of pictures in the face image sample set, X represents the number of rows of the pixels of the pictures in the face image sample set, and Y represents the number of columns of the pixels of the pictures in the face image sample set;
The real frame labeling unit is used for labeling the real frame of each face target in each picture in the defined face image sample set, wherein the real frame of the face target is defined as follows:
wherein, theRepresenting the upper left corner coordinates of the real border of the nth face object in the kth picture in the face image sample set,Representing the abscissa of the upper left corner coordinate point of the real frame of the nth face object in the kth picture in the face image sample set,Representing the ordinate of the upper left corner coordinate point of the real frame of the nth face target in the kth picture in the face image sample set; Representing the lower right corner coordinates of the real border of the nth face object in the kth picture in the face image sample set,Representing the abscissa of the lower right corner coordinate point of the real frame of the nth face object in the kth picture in the face image sample set,The method comprises the steps of obtaining a preset face recognition network model, representing the ordinate of a right lower corner coordinate point of a real frame of an nth face target in a kth picture in a face image sample set, wherein K represents the number of pictures in the face image sample set, and Nk represents the number of real frames of the face target in the kth picture in a face image training data set selected as the face image training data set for the preset face recognition network model training;
A calculating unit, configured to calculate the width, height and center point coordinates of the real frame of the face target according to a preset real frame width calculating formula, a preset real frame height calculating formula and a preset real frame center point coordinate calculating formula, and mark the identity class of the real frame of the face target to obtain a face image dataset,
The preset real frame width calculation formula is as follows:
the preset real frame height calculation formula is as follows:
The preset real frame center point coordinate calculation formula is as follows:
the identity category of the real frame of the face target is defined as:
wherein, theRepresenting the width of the real frame of the nth face object in the kth image in the face image sample set,And the height of a real frame of an nth face target in an kth image in the face image sample set is represented, and t represents reality.
Specifically, a face image sample set is defined through a sample set definition unit, each picture in the face image sample set and each face image on each picture can be represented by the corresponding position of the picture, the real frame of a face target is defined according to the position of the face image through a real frame labeling unit, the height, the width and the center coordinates of the face target are calculated according to the real frame through a calculation unit, the identity category of the real frame is defined, and the picture information is converted into digital information capable of being operated, so that subsequent calculation is facilitated.
The loss function construction module 220 is configured to construct a loss function model according to the real frame of the face object, the width and the height of the real frame of the face object, and the identity class of the center point coordinate and the real frame of the face object in the face recognition network trained by the face recognition model.
Specifically, the loss function (loss function) model is used for measuring the inconsistency degree of the predicted value f (x) and the true value Y of the face recognition network obtained through training, and is a non-negative real value function, and is expressed by L (Y, f (x)), and the smaller the loss function is, the better the robustness of the network obtained through training is. The loss function is a core part of the empirical risk function and is also an important component of the structural risk function. The structural risk function of the model includes empirical risk terms and regularization terms.
In order to ensure the accuracy of the face recognition network model obtained after the face recognition network is trained, a loss function model is required to be built in the face recognition network obtained after the training, a face image data set can be divided into two parts in the process of training the model, one part is used as a face image training data set, the other part is used as a face image verification optimizing data set, the face image training data set is used for training the face recognition network, and then the face image verification optimizing data set is used for optimizing.
As an alternative embodiment of the invention, the loss function model includes a target bounding box loss model;
the calculation formula of the target bounding box loss model is as follows:
wherein, theThe Euclidean distance between the center points of the predicted frame and the real frame of the face target is represented, c represents the length of the diagonal line of the minimum rectangle of the predicted frame and the real frame which can cover the face target, and the calculation mode of c is as follows:
IOU represents the intersection ratio of the predicted border and the real border of the face object, Ch and Cw represent the height and width of the smallest rectangle capable of covering the predicted border and the real border of the face object,H and hgt respectively represent the height of the predicted frame of the face target and the height of the real frame of the face target, w and wgt respectively represent the height of the predicted frame of the face target and the width of the real frame of the face target, and the calculation modes of v and alpha in the formula are as follows:
The width and the height of the predicted frame of each face target in each face picture in the face image data set are respectively defined as:
And
The central point coordinates of the predicted frame of each face target in each face image in the face image data set are defined as follows:
specifically, through the created target bounding box loss model, the accuracy degree of the predicted frame marking position of the face target of the face image to be recognized can be optimized.
As an alternative embodiment of the invention, the loss function model further comprises a target confidence loss model;
the calculation formula of the target confidence loss model is as follows:
wherein, theRepresenting identity categories within the true borders of the nth face object in the kth picture in the face image dataset,And (3) representing identity categories in a predicted frame of an nth face target in a kth picture in the face image data set, wherein lambdanoobject represents confidence penalty weights when no target exists in the predicted frame of the face target.
Specifically, the accuracy of the predicted target of the predicted frame of the face image to be recognized can be optimized through the created target confidence loss model.
As an alternative embodiment of the invention, the loss function model further comprises a target class loss model;
The calculation formula of the target class loss model is as follows:
wherein, theRepresenting the confidence of the identity class in the real border of the nth face object in the kth picture in the face image dataset,Representing the identity category confidence in the predicted frame of the nth face object in the kth picture in the face image data set;
The predicted frame of each face target in each face image in the face image dataset is defined as:
wherein, theRepresenting the upper left corner coordinates of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the abscissa of the upper left corner coordinate point of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the ordinate of the upper left corner coordinate point of the predicted frame of the nth face target in the kth picture in the face image data set; Representing the lower right corner coordinates of the predicted border of the nth face object in the kth picture in the face image dataset,Representing the abscissa of the lower right corner coordinate point of the n-th face target prediction frame in the k-th picture in the face image data set,And Nk 'represents the ordinate of a right lower corner coordinate point of a predicted frame of an nth face target in a kth picture in the face image dataset, and Nk' represents the number of predicted frames of the face target selected as the face target in the face image training dataset for training of the preset face recognition network model.
Specifically, the accuracy of identity class prediction in the prediction frame of the face image to be recognized can be optimized through the created target class loss model.
The optimizing module 230 is configured to perform optimization training on the loss function model by using a gradient descent method, and obtain a face recognition network model based on lightweight multi-scale feature fusion when the loss function of the loss function model reaches a preset threshold value, where,
The face recognition network model based on the lightweight multi-scale feature fusion comprises a main network layer, a pooling layer, a feature fusion layer and a detection head layer, wherein the main network layer is used for carrying out feature extraction on three different image dimensions on a face image, the pooling layer is used for pooling third output features obtained by the main network layer, the feature fusion layer is used for carrying out feature fusion processing on first output features, second output features and pooled third output features obtained by the pooling layer respectively, and the detection head layer is used for generating a prediction result according to the three fused features obtained by the feature fusion layer.
Specifically, the loss function of the loss function model of the face recognition network based on lightweight multi-scale feature fusion can only comprise one of a target confidence loss model, a target boundary box loss model and a target category loss model, or can also comprise two of the three loss function models, when the three loss function models are simultaneously included, the loss function of the face recognition network based on lightweight multi-scale feature fusion is loss (object) =loss (box) + loss (confidence) +loss (type), and when loss (object) reaches a preset threshold, training is completely optimized, and the face recognition network model based on lightweight multi-scale feature fusion is obtained.
The loss function model of the face recognition network based on lightweight multi-scale feature fusion is trained by adopting the face recognition network based on lightweight multi-scale feature fusion, so that the face recognition network based on lightweight multi-scale feature fusion has the advantages of less calculation parameters, smaller occupied memory, high accuracy and the like, and as shown in fig. 1.1 and 1.2, the invention can obviously realize high-performance face recognition at a mobile terminal and embedded equipment by improving the integral structure of the original YOLOv network structure, thereby obtaining the structure of the face recognition network based on lightweight multi-scale feature fusion, extracting image features by using the lightweight network, and introducing the self-adaptive feature fusion structure to fuse features of different scales.
The prediction module 240 is configured to input a face image to be recognized into a face recognition network model based on lightweight multi-scale feature fusion to perform face recognition, so as to obtain a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame, and recognition accuracy corresponding to the identity class.
Specifically, the face image to be recognized is input into the face recognition network model based on lightweight multi-scale feature fusion, the face image is processed by each functional structure layer in the face recognition network model based on lightweight multi-scale feature fusion, and finally the predicted frame of the face target in the face image to be recognized, the identity class corresponding to the predicted frame and the recognition accuracy corresponding to the identity class are output.
As an alternative embodiment of the present invention, the prediction module 240 further includes a feature extraction unit, a pooling unit, a feature fusion unit, and a prediction unit (not shown in the figure). Wherein, the
The feature extraction unit is used for extracting features of three different image dimensions of a face image to be identified through a backbone network layer to obtain three features of different dimensions, namely a feature X1, a feature X2 and a feature X3, and performing convolution operation processing on the feature X1, the feature X2 and the feature X3 to obtain a first output feature Level1, a second output feature Level2 and a third output feature respectively;
The pooling unit is used for pooling the third output characteristics through the pooling layer to obtain pooled third output characteristics Level3;
the feature fusion unit is used for carrying out feature fusion processing on the first output feature Level1, the second output feature Level2 and the pooled third output feature Level3 through the feature fusion layer to respectively obtain a first fusion feature ASFF, a second fusion feature ASFF2 and a third fusion feature ASFF3,
The first fusion feature ASFF is obtained by multiplying and then adding Level1, level2 and Level3 to the parameter alpha111 respectively, ASFF is obtained by multiplying and then adding Level1, level2, level3 to the parameter alpha222 respectively, and ASFF3 is obtained by multiplying and then adding Level1, level2, level3 to the parameter alpha333 respectively;
And generating a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame and recognition accuracy corresponding to the identity class by detecting the head layer according to the first fusion feature ASFF, the second fusion feature ASFF and the third fusion feature ASFF.
Specifically, when a face image to be recognized is input into a face recognition network model based on lightweight multi-scale feature fusion, feature extraction is performed on the face image according to three different dimension dimensions in a backbone network layer by a feature extraction unit, at this time, single features of the face, such as eyes, noses, mouths and the like, are extracted, then the single features are comprehensively formed into three output features by convolution calculation, namely a first output feature Level1, a second output feature Level2 and a third output feature, as a feature layer of the third output feature is connected with a pooling layer, pooling processing is performed on the third output feature by the pooling unit, after dimension reduction is performed, calculation of the third output layer is simplified, a pooled third output feature Level3 is obtained, then feature fusion processing is performed on the first output feature Level1, the second output feature Level2 and the pooled third output feature Level3, wherein ,α1112, β22333 is known parameter, and finally, a face image to be recognized is obtained after the feature layer is detected by a detection unit.
Fig. 3 is a schematic structural diagram of an electronic device implementing a face recognition method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a face recognition program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may also be an external storage device of the electronic device 1 in other embodiments, for example, a plug-in mobile hard disk, a smart memory card (SMART MEDIA CARD, abbreviated as SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the electronic device 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of face recognition programs, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., face recognition programs, etc.) stored in the memory 11, and calling data stored in the memory 11.
The bus may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 etc.
Fig. 3 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may further comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The face recognition program 12 stored in the memory 11 of the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
Inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to perform face recognition model training, wherein the face image dataset comprises a face picture, a real frame of a face target marked on the face picture, a width and a height of the real frame of the face target, a center point coordinate and identity categories marked on the real frame of the face target;
In a face recognition network trained by a face recognition model, constructing a loss function model through the real frame of the face target, the width and the height of the real frame of the face target, the center point coordinates and the identity class of the real frame of the face target;
Optimizing and training the loss function model by adopting a gradient descent method, obtaining a face recognition network model based on lightweight multi-scale feature fusion when the loss function of the loss function model reaches a preset threshold value, wherein,
The face recognition network model based on lightweight multi-scale feature fusion comprises a main network layer, a pooling layer, a feature fusion layer and a detection head layer, wherein the main network layer is used for carrying out feature extraction on three different image dimensions on a face image, the pooling layer is used for pooling third output features obtained by the main network layer, the feature fusion layer is used for carrying out feature fusion processing on first output features, second output features and pooled third output features obtained by the pooling layer respectively, and the detection head layer is used for generating a prediction result according to the three fused features obtained by the feature fusion layer;
And inputting the face image to be recognized into a face recognition network model based on lightweight multi-scale feature fusion to perform face recognition, so as to obtain a predicted frame of a face target in the face image to be recognized, an identity class corresponding to the predicted frame and recognition accuracy corresponding to the identity class.
Specifically, the specific implementation method of the above instructions by the processor 10 may refer to the description of the relevant steps in the corresponding embodiment of fig. 1, which is not repeated herein. It is emphasized that, to further ensure the privacy and security of the face image dataset, the face image dataset may also be stored in a blockchain node.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM).
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (10)

Translated fromChinese
1.一种人脸识别方法,应用于电子装置,其特征在于,所述方法包括:1. A face recognition method, applied to an electronic device, characterized in that the method comprises:将人脸图像数据集输入基于轻量级多尺度特征融合的人脸识别网络进行人脸识别模型训练;其中,所述人脸图像数据集中包括人脸图片、标注在所述人脸图片上的人脸目标的真实边框、人脸目标的真实边框的宽度、高度以及中心点坐标和所述人脸目标的真实边框上标记的身份类别;Inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to train a face recognition model; wherein the face image dataset includes a face picture, a real border of a face target marked on the face picture, the width, height and center point coordinates of the real border of the face target, and an identity category marked on the real border of the face target;在人脸识别模型训练后的人脸识别网络内,通过所述人脸目标的真实边框、人脸目标的真实边框的宽度、高度以及中心点坐标和所述人脸目标的真实边框的身份类别构建损失函数模型;In the face recognition network after the face recognition model is trained, a loss function model is constructed by using the real border of the face target, the width, height and center point coordinates of the real border of the face target and the identity category of the real border of the face target;采用梯度下降法对所述损失函数模型进行优化训练,当所述损失函数模型的损失函数达到预设阈值时,得到基于轻量级多尺度特征融合的人脸识别网络模型;其中,The loss function model is optimized and trained by using the gradient descent method. When the loss function of the loss function model reaches a preset threshold, a face recognition network model based on lightweight multi-scale feature fusion is obtained; wherein,所述基于轻量级多尺度特征融合的人脸识别网络模型包括:用于对人脸图像进行三种不同图像维度的特征提取的主干网络层、用于对所述主干网络层得到的第三输出特征进行池化处理的池化层、用于对所述主干网络层得到的第一输出特征、第二输出特征、以及所述池化层得到的池化后第三输出特征分别进行特征融合处理的特征融合层和用于根据所述特征融合层得到的三种融合特征生成预测结果的检测头部层;The face recognition network model based on lightweight multi-scale feature fusion includes: a backbone network layer for extracting features of three different image dimensions for a face image, a pooling layer for performing pooling processing on a third output feature obtained by the backbone network layer, a feature fusion layer for performing feature fusion processing on a first output feature, a second output feature, and a third output feature obtained by the pooling layer after pooling, respectively, and a detection head layer for generating a prediction result according to the three fused features obtained by the feature fusion layer;将待识别的人脸图像输入所述基于轻量级多尺度特征融合的人脸识别网络模型进行人脸识别,得到所述待识别的人脸图像中的人脸目标的预测边框、与所述预测边框对应的身份类别、以及与所述身份类别对应的识别准确度;Inputting the face image to be recognized into the face recognition network model based on lightweight multi-scale feature fusion to perform face recognition, and obtaining the predicted bounding box of the face target in the face image to be recognized, the identity category corresponding to the predicted bounding box, and the recognition accuracy corresponding to the identity category;其中,所述损失函数模型包括:目标边界框损失模型;Wherein, the loss function model includes: a target bounding box loss model;所述目标边界框损失模型的计算公式为:The calculation formula of the target bounding box loss model is:其中,表示人脸目标的预测边框与真实边框的中心点之间的欧几里得距离,c表示能够覆盖人脸目标的预测边框与真实边框的最小矩形的对角线长度,c的计算方式为:in, represents the Euclidean distance between the center points of the predicted bounding box of the face target and the real bounding box, c represents the diagonal length of the smallest rectangle that can cover the predicted bounding box and the real bounding box of the face target, and c is calculated as follows:IOU表示人脸目标的预测边框与真实框的交并比,Ch与Cw分别表示能够覆盖人脸目标的预测边框与真实边框的最小矩形的高和宽,h和hgt分别表示人脸目标的预测边框的高度和人脸目标的真实边框的高度,w和wgt分别表示人脸目标的预测边框的高度和人脸目标的真实边框的宽度,公式中的v与α的计算方式分别为:IOU represents the intersection-over-union ratio of the predicted bounding box of the face target and the real bounding box,Ch andCw represent the height and width of the minimum rectangle that can cover the predicted bounding box and the real bounding box of the face target, respectively. h and hgt represent the height of the predicted border of the face target and the height of the real border of the face target, respectively. w and wgt represent the height of the predicted border of the face target and the width of the real border of the face target, respectively. The calculation methods of v and α in the formula are:2.根据权利要求1所述的人脸识别方法,其特征在于,所述人脸图像数据集存储于区块链中,在所述将人脸图像数据集输入基于轻量级多尺度特征融合的人脸识别网络进行人脸识别模型训练之前还包括:2. The face recognition method according to claim 1, characterized in that the face image dataset is stored in a blockchain, and before the face image dataset is input into a face recognition network based on lightweight multi-scale feature fusion for face recognition model training, it also includes:采集人脸图像样本,得到人脸图像样本集;Collecting face image samples to obtain a face image sample set;对所述人脸图像样本集中的人脸目标的真实边框进行标注,计算出标注的人脸目标的真实边框的宽度、高度以及中心点坐标,并标记所述人脸目标的真实边框的身份类别,得到人脸图像数据集。The real bounding boxes of the face targets in the face image sample set are annotated, the width, height and center point coordinates of the real bounding boxes of the annotated face targets are calculated, and the identity category of the real bounding boxes of the face targets is marked to obtain a face image dataset.3.根据权利要求2所述的人脸识别方法,其特征在于,所述对人脸图像样本集中的人脸目标的真实边框进行标注,计算出标注的人脸目标的真实边框的宽度、高度以及中心点坐标,并标记所述人脸目标的真实边框的身份类别,得到人脸图像数据集包括:3. The face recognition method according to claim 2 is characterized in that the real bounding box of the face target in the face image sample set is marked, the width, height and center point coordinates of the real bounding box of the marked face target are calculated, and the identity category of the real bounding box of the face target is marked, and the face image data set is obtained, which includes:将所述人脸图像样本集定义为:{Datak(x,y),k∈[1,K],x∈[1,X],y∈The face image sample set is defined as: {Datak (x,y), k∈[1,K], x∈[1,X], y∈[1,Y]};其中,Datak(x,y)表示人脸图像样本集中第k幅图片的第x行第y列的像素信息,K表示人脸图像样本集的图片数量,X表示人脸图像样本集中图片的像素的行数,Y表示人脸图像样本集中图片的像素的列数;[1,Y]}; where Datak (x,y) represents the pixel information of the xth row and yth column of the kth picture in the face image sample set, K represents the number of pictures in the face image sample set, X represents the number of rows of pixels in the picture in the face image sample set, and Y represents the number of columns of pixels in the picture in the face image sample set;对定义后的人脸图像样本集中的每幅图片中的每个人脸目标的真实边框进行标注;其中,所述人脸目标的真实边框定义为:The real bounding box of each face target in each picture in the defined face image sample set is marked; wherein the real bounding box of the face target is defined as:其中,表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的左上角坐标,表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的左上角坐标点的横坐标,表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的左上角坐标点的纵坐标;表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的右下角坐标,表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的右下角坐标点的横坐标,表示人脸图像样本集中第k幅图片中第n个人脸目标的真实边框的右下角坐标点的纵坐标;K表示人脸图像样本集的图片数量;Nk表示人脸图像数据集中选做用于预设人脸识别网络模型训练的人脸图像训练数据集中第k幅图片中的人脸目标的真实边框的数量;in, Represents the upper left corner coordinate of the true bounding box of the nth face target in the kth picture in the face image sample set, Represents the horizontal coordinate of the upper left corner coordinate point of the real bounding box of the nth face target in the kth picture in the face image sample set, Represents the ordinate of the upper left corner coordinate point of the real bounding box of the nth face target in the kth picture in the face image sample set; It represents the lower right corner coordinate of the real bounding box of the nth face target in the kth picture in the face image sample set. Represents the horizontal coordinate of the lower right corner coordinate point of the real bounding box of the nth face target in the kth picture in the face image sample set, represents the ordinate of the lower right corner coordinate point of the real bounding box of the nth face target in the kth picture in the face image sample set; K represents the number of pictures in the face image sample set; Nk represents the number of real bounding boxes of face targets in the kth picture in the face image training data set selected in the face image data set for training the preset face recognition network model;根据预设真实边框宽度计算公式、预设真实边框高度计算公式和预设真实边框中心点坐标计算公式,分别计算出所述人脸目标的真实边框的宽度、高度和中心点坐标,并标记所述人脸目标的真实边框的身份类别,得到人脸图像数据集;其中,According to the preset real frame width calculation formula, the preset real frame height calculation formula and the preset real frame center point coordinate calculation formula, the width, height and center point coordinates of the real frame of the face target are calculated respectively, and the identity category of the real frame of the face target is marked to obtain a face image data set; wherein,所述预设真实边框宽度计算公式为:The preset real border width calculation formula is:所述预设真实边框高度计算公式为:The preset real frame height calculation formula is:所述预设真实边框中心点坐标计算公式为:The calculation formula for the coordinates of the center point of the preset real frame is:所述人脸目标的真实边框的身份类别定义为:The identity category of the true bounding box of the face target is defined as:其中,表示人脸图像样本集中第k幅图像中第n个人脸目标的真实边框的宽度,表示人脸图像样本集中第k幅图像中第n个人脸目标的真实边框的高度,t表示真实。in, It represents the width of the real border of the nth face target in the kth image in the face image sample set. It represents the height of the true bounding box of the nth face target in the kth image in the face image sample set, and t represents the truth.4.根据权利要求3所述的人脸识别方法,其特征在于,4. The face recognition method according to claim 3, characterized in that:所述人脸图像数据集中每幅人脸图片中每个人脸目标的预测边框的宽度、高度分别定义为:The width and height of the predicted border of each face target in each face image in the face image dataset are defined as: and所述人脸图像数据集中每幅人脸图片中每个人脸目标的预测边框的中心点坐标定义为:The coordinates of the center point of the predicted bounding box of each face target in each face image in the face image dataset are defined as:5.根据权利要求4所述的人脸识别方法,其特征在于,所述损失函数模型还包括:目标置信度损失模型;5. The face recognition method according to claim 4, characterized in that the loss function model further comprises: a target confidence loss model;所述目标置信度损失模型的计算公式为:The calculation formula of the target confidence loss model is:其中,表示人脸图像数据集中的第k幅图片中第n个人脸目标的真实边框内的身份类别,表示人脸图像数据集中的第k幅图片中第n个人脸目标的预测边框内的身份类别,λnoobject表示人脸目标的预测边框中没有目标时的置信度惩罚权重。in, Represents the identity category within the true bounding box of the nth face target in the kth picture in the face image dataset, represents the identity category within the predicted bounding box of the nth face target in the kth picture in the face image dataset, and λnoobject represents the confidence penalty weight when there is no target in the predicted bounding box of the face target.6.根据权利要求5所述的人脸识别方法,其特征在于,所述损失函数模型还包括:目标类别损失模型;6. The face recognition method according to claim 5, characterized in that the loss function model further comprises: a target category loss model;所述目标类别损失模型的计算公式为:The calculation formula of the target category loss model is:其中,表示人脸图像数据集中的第k幅图片中第n个人脸目标的真实边框内的身份类别置信度,表示人脸图像数据集中的第k幅图片中第n个人脸目标的预测边框内的身份类别置信度;in, Represents the identity category confidence within the true bounding box of the nth face target in the kth picture in the face image dataset, Represents the identity category confidence within the predicted bounding box of the nth face target in the kth picture in the face image dataset;所述人脸图像数据集中每幅人脸图像中每个人脸目标的预测边框定义为:The predicted bounding box of each face target in each face image in the face image dataset is defined as:其中,表示人脸图像数据集中第k幅图片中第n个人脸目标的预测边框的左上角坐标,表示人脸图像数据集中第k幅图片中第n个人脸目标的预测边框的左上角坐标点的横坐标,表示人脸图像数据集中第k幅图片中第n个人脸目标的预测边框的左上角坐标点的纵坐标;表示人脸图像数据集中第k幅图片中第n个人脸目标的预测边框的右下角坐标,表示人脸图像数据集中第k幅图片中第n个人脸目标预测边框的右下角坐标点的横坐标,表示人脸图像数据集中第k幅图片中第n个人脸目标的预测边框的右下角坐标点的纵坐标,Nk′表示人脸图像数据集中选做用于所述预设人脸识别网络模型训练的人脸图像训练数据集中的人脸目标的预测边框的数量。in, Represents the coordinate of the upper left corner of the predicted bounding box of the nth face target in the kth picture in the face image dataset, Represents the horizontal coordinate of the upper left corner coordinate point of the predicted bounding box of the nth face target in the kth picture in the face image dataset, Represents the ordinate of the upper left corner coordinate point of the predicted bounding box of the nth face target in the kth picture in the face image dataset; Represents the lower right corner coordinate of the predicted bounding box of the nth face target in the kth picture in the face image dataset, Represents the horizontal coordinate of the lower right corner coordinate point of the predicted bounding box of the nth face target in the kth picture in the face image dataset, represents the ordinate of the lower right corner coordinate point of the predicted bounding box of the nth face target in the kth picture in the face image dataset, and Nk ′ represents the number of predicted bounding boxes of face targets in the face image training dataset selected in the face image dataset for training the preset face recognition network model.7.根据权利要求1所述的人脸识别方法,其特征在于,所述将待识别的人脸图像输入所述基于轻量级多尺度特征融合的人脸识别网络模型进行人脸识别,得到所述待识别的人脸图像中的人脸目标的预测边框、与所述预测边框对应的身份类别、以及与所述身份类别对应的识别准确度包括:7. The face recognition method according to claim 1 is characterized in that the step of inputting the face image to be recognized into the face recognition network model based on lightweight multi-scale feature fusion for face recognition, and obtaining the predicted bounding box of the face target in the face image to be recognized, the identity category corresponding to the predicted bounding box, and the recognition accuracy corresponding to the identity category comprises:通过所述主干网络层对待识别的人脸图像进行三种不同图像维度的特征提取,得到三种不同维度的特征,分别为特征X1、特征X2和特征X3,并对所述特征X1、特征X2和特征X3分别进行卷积运算处理,分别得到第一输出特征Level1、第二输出特征Level2和第三输出特征;The backbone network layer extracts features of three different image dimensions from the face image to be recognized, and obtains features of three different dimensions, namely, feature X1, feature X2, and feature X3, and performs convolution operations on the feature X1, feature X2, and feature X3, respectively, to obtain a first output feature Level1, a second output feature Level2, and a third output feature, respectively;通过所述池化层对所述第三输出特征进行池化处理,得到池化后的第三输出特征Level3;Performing pooling processing on the third output feature through the pooling layer to obtain a pooled third output feature Level3;通过所述特征融合层对所述第一输出特征Level1、第二输出特征Level2和所述池化后的第三输出特征Level3进行特征融合处理,分别得到第一融合特征ASFF1、第二融合特征ASFF2和第三融合特征ASFF3;其中,The first output feature Level1, the second output feature Level2 and the third output feature Level3 after pooling are subjected to feature fusion processing by the feature fusion layer to obtain a first fusion feature ASFF1, a second fusion feature ASFF2 and a third fusion feature ASFF3 respectively; wherein,所述第一融合特征ASFF1由Level1,Level2,Level3与参数α1,β1,γ1分别相乘再相加得到;所述ASFF2由Level1,Level2,Level3与参数α2,β2,γ2分别相乘再相加得到;所述ASFF3由Level1,Level2,Level3与参数α3,β3,γ3分别相乘再相加得到;The first fusion feature ASFF1 is obtained by multiplying Level1, Level2, Level3 with parameters α1 , β1 , γ1 respectively and then adding them; the ASFF2 is obtained by multiplying Level1, Level2, Level3 with parameters α2 , β2 , γ2 respectively and then adding them; the ASFF3 is obtained by multiplying Level1, Level2, Level3 with parameters α3 , β3 , γ3 respectively and then adding them;通过所述检测头部层,根据所述第一融合特征ASFF1、所述第二融合特征ASFF2和所述第三融合特征ASFF3,生成所述待识别的人脸图像中的人脸目标的预测边框、与所述预测边框对应的身份类别、以及与所述身份类别对应的识别准确度。Through the detection head layer, based on the first fusion feature ASFF1, the second fusion feature ASFF2 and the third fusion feature ASFF3, the predicted bounding box of the face target in the face image to be identified, the identity category corresponding to the predicted bounding box, and the recognition accuracy corresponding to the identity category are generated.8.一种人脸识别装置,其特征在于,所述装置包括:8. A face recognition device, characterized in that the device comprises:训练模块,用于将人脸图像数据集输入基于轻量级多尺度特征融合的人脸识别网络进行人脸识别模型训练;其中,所述人脸图像数据集中包括人脸图片、标注在所述人脸图片上的人脸目标的真实边框、人脸目标的真实边框的宽度、高度以及中心点坐标和所述人脸目标的真实边框上标记的身份类别;A training module, used for inputting a face image dataset into a face recognition network based on lightweight multi-scale feature fusion to perform face recognition model training; wherein the face image dataset includes a face picture, a real frame of a face target marked on the face picture, a width, a height and a center point coordinate of the real frame of the face target, and an identity category marked on the real frame of the face target;损失函数构建模块,用于在人脸识别模型训练后的人脸识别网络内,通过所述人脸目标的真实边框、人脸目标的真实边框的宽度、高度以及中心点坐标和所述人脸目标的真实边框的身份类别构建损失函数模型;A loss function construction module is used to construct a loss function model in a face recognition network after the face recognition model is trained, using the real border of the face target, the width, height and center point coordinates of the real border of the face target and the identity category of the real border of the face target;优化模块,用于采用梯度下降法对所述损失函数模型进行优化训练,当所述损失函数模型的损失函数达到预设阈值时,得到基于轻量级多尺度特征融合的人脸识别网络模型;其中,The optimization module is used to optimize the loss function model by using the gradient descent method. When the loss function of the loss function model reaches a preset threshold, a face recognition network model based on lightweight multi-scale feature fusion is obtained; wherein,所述基于轻量级多尺度特征融合的人脸识别网络模型包括:用于对人脸图像进行三种不同图像维度的特征提取的主干网络层、用于对所述主干网络层得到的第三输出特征进行池化处理的池化层、用于对所述主干网络层得到的第一输出特征、第二输出特征、以及所述池化层得到的池化后第三输出特征分别进行特征融合处理的特征融合层和用于根据所述特征融合层得到的三种融合特征生成预测结果的检测头部层;The face recognition network model based on lightweight multi-scale feature fusion includes: a backbone network layer for extracting features of three different image dimensions for a face image, a pooling layer for performing pooling processing on a third output feature obtained by the backbone network layer, a feature fusion layer for performing feature fusion processing on a first output feature, a second output feature, and a third output feature obtained by the pooling layer after pooling, respectively, and a detection head layer for generating a prediction result according to the three fused features obtained by the feature fusion layer;预测模块,将待识别的人脸图像输入所述基于轻量级多尺度特征融合的人脸识别网络模型进行人脸识别,得到所述待识别的人脸图像中的人脸目标的预测边框、与所述预测边框对应的身份类别、以及与所述身份类别对应的识别准确;A prediction module, inputting the face image to be recognized into the face recognition network model based on lightweight multi-scale feature fusion to perform face recognition, and obtaining a predicted border of the face target in the face image to be recognized, an identity category corresponding to the predicted border, and a recognition accuracy corresponding to the identity category;其中,所述损失函数模型包括:目标边界框损失模型;所述目标边界框损失模型的计算公式为:The loss function model includes: a target bounding box loss model; the calculation formula of the target bounding box loss model is:其中,表示人脸目标的预测边框与真实边框的中心点之间的欧几里得距离,c表示能够覆盖人脸目标的预测边框与真实边框的最小矩形的对角线长度,c的计算方式为:in, represents the Euclidean distance between the center points of the predicted bounding box of the face target and the real bounding box, c represents the diagonal length of the smallest rectangle that can cover the predicted bounding box and the real bounding box of the face target, and c is calculated as follows:IOU表示人脸目标的预测边框与真实框的交并比,Ch与Cw分别表示能够覆盖人脸目标的预测边框与真实边框的最小矩形的高和宽,h和hgt分别表示人脸目标的预测边框的高度和人脸目标的真实边框的高度,w和wgt分别表示人脸目标的预测边框的高度和人脸目标的真实边框的宽度,公式中的v与α的计算方式分别为:IOU represents the intersection-over-union ratio of the predicted bounding box of the face target and the real bounding box,Ch andCw represent the height and width of the minimum rectangle that can cover the predicted bounding box and the real bounding box of the face target, respectively. h and hgt represent the height of the predicted border of the face target and the height of the real border of the face target, respectively. w and wgt represent the height of the predicted border of the face target and the width of the real border of the face target, respectively. The calculation methods of v and α in the formula are:9.一种电子设备,其特征在于,所述电子设备包括:9. 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,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任一所述的人脸识别方法的步骤。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 perform the steps of the face recognition method as described in any one of claims 1 to 7.10.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任一所述的人脸识别方法。10. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the face recognition method according to any one of claims 1 to 7 is implemented.
CN202210866085.6A2022-07-222022-07-22 Face recognition method, device, equipment and storage mediumActiveCN115359521B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210866085.6ACN115359521B (en)2022-07-222022-07-22 Face recognition method, device, equipment and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210866085.6ACN115359521B (en)2022-07-222022-07-22 Face recognition method, device, equipment and storage medium

Publications (2)

Publication NumberPublication Date
CN115359521A CN115359521A (en)2022-11-18
CN115359521Btrue CN115359521B (en)2025-06-24

Family

ID=84032354

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210866085.6AActiveCN115359521B (en)2022-07-222022-07-22 Face recognition method, device, equipment and storage medium

Country Status (1)

CountryLink
CN (1)CN115359521B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118830843B (en)*2024-06-202025-02-11重庆市罗布琳卡科技有限公司 A physical therapy instrument control system based on artificial intelligence

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111695522A (en)*2020-06-152020-09-22重庆邮电大学In-plane rotation invariant face detection method and device and storage medium
CN113378675A (en)*2021-05-312021-09-10南京理工大学Face recognition method for simultaneous detection and feature extraction

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111695522A (en)*2020-06-152020-09-22重庆邮电大学In-plane rotation invariant face detection method and device and storage medium
CN113378675A (en)*2021-05-312021-09-10南京理工大学Face recognition method for simultaneous detection and feature extraction

Also Published As

Publication numberPublication date
CN115359521A (en)2022-11-18

Similar Documents

PublicationPublication DateTitle
KR102635987B1 (en) Method, apparatus, device and storage medium for training an image semantic segmentation network
WO2022247005A1 (en)Method and apparatus for identifying target object in image, electronic device and storage medium
CN112699775A (en)Certificate identification method, device and equipment based on deep learning and storage medium
WO2021151277A1 (en)Method and apparatus for determining severity of damage on target object, electronic device, and storage medium
CN112052850A (en)License plate recognition method and device, electronic equipment and storage medium
CN112396005A (en)Biological characteristic image recognition method and device, electronic equipment and readable storage medium
CN112651342A (en)Face recognition method and device, electronic equipment and storage medium
CN111274937B (en) Fall detection method, device, electronic device, and computer-readable storage medium
CN111898538A (en)Certificate authentication method and device, electronic equipment and storage medium
CN114708461B (en) Classification method, device, equipment and storage medium based on multimodal learning model
CN113705469B (en)Face recognition method, device, electronic equipment and computer readable storage medium
CN113869218B (en)Face living body detection method and device, electronic equipment and readable storage medium
CN113705461A (en)Face definition detection method, device, equipment and storage medium
CN113627394B (en)Face extraction method and device, electronic equipment and readable storage medium
CN112749653A (en)Pedestrian detection method, device, electronic equipment and storage medium
CN115098644A (en)Image and text matching method and device, electronic equipment and storage medium
CN116778527A (en)Human body model construction method, device, equipment and storage medium
CN112528903B (en)Face image acquisition method and device, electronic equipment and medium
CN113971627B (en) A method and device for generating a license plate image
CN115359521B (en) Face recognition method, device, equipment and storage medium
CN113723280A (en)Static face-based confrontation sample detection method, device, equipment and medium
CN111652226B (en)Picture-based target identification method and device and readable storage medium
CN113850207B (en)Micro-expression classification method and device based on artificial intelligence, electronic equipment and medium
CN116797864B (en)Auxiliary cosmetic method, device, equipment and storage medium based on intelligent mirror
CN114463685B (en)Behavior recognition method, behavior recognition device, electronic equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp