Face image processing method, device and computer readable storage medium

By using the softmax function and the sample loss function inside and outside the class in face recognition technology to train the neural network, combined with the local hyperspherical center parameters, the problems of inaccurate recognition and insufficient robustness in the existing technology are solved, and high-level performance is achieved. Accuracy and robustness of face image processing methods.

CN115661909BActive Publication Date: 2024-09-17SHENZHEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211599005.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-14
Publication Date
2024-09-17
Estimated Expiration
2042-12-14

AI Technical Summary

Technical Problem

Existing face recognition technology has problems such as insufficient recognition accuracy and low robustness, especially in terms of classification accuracy and distance differentiation between samples within and outside the class.

Method used

By obtaining the face image set, use the softmax function to train the neural network model, and combine the intra-class sample aggregation function and the inter-class sample separation function to determine the loss function, train the neural network, and optimize the parameters to improve feature extraction and classification recognition. Ability to adopt local hyperspherical central parameters to enhance the robustness and accuracy of the model.

Benefits of technology

The target neural network that achieves high robustness and high recognition accuracy can classify face images more accurately, reduce the impact of illumination, posture and environment on the recognition results, and improve the overall performance of face recognition tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115661909B
    Figure CN115661909B
Patent Text Reader

Abstract

The present invention discloses a facial image processing method, device and computer-readable storage medium, wherein the method comprises: obtaining a facial image set; performing model training on a preset first neural network according to the facial image set and a softmax function to obtain a second neural network, and updating the softmax function to obtain a target softmax function; determining a first loss function according to the target softmax function, and training the second neural network according to the facial image set and the first loss function to obtain a trained target neural network. The present invention can train a target neural network with high robustness and high recognition accuracy according to the facial image set and the first loss function, and then use the target neural network to more accurately classify facial images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of face image processing, and in particular to a face image processing method, device and computer-readable storage medium. Background Art

[0002] Face recognition is a technology that extracts information and identifies biometrics based on facial features. It is a very important research direction in the field of computer vision. The introduction of deep learning algorithms such as CNN has greatly improved the accuracy of face recognition.

[0003] Generally speaking, face recognition can be divided into two sub-problems: face identification and face verification. Face identification is dedicated to determining the correspondence between a face image and its identity, which can often be regarded as a classification problem on an open set; while the task of face verification is to determine whether two face images belong to the same natural person. However, face recognition technology currently still has problems such as inaccurate recognition and low robustness.

[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0005] The main purpose of the present invention is to provide a face image processing method, device and computer-readable storage medium, aiming to solve the technical problem of low accuracy and robustness of existing face classification.

[0006] To achieve the above object, the present invention provides a face image processing method, the face image processing method comprising the following steps:

[0007] Get a set of face images;

[0008] According to the face image set and the preset softmax function, a preset first neural network is model trained to obtain a second neural network, and the softmax function is updated to obtain a target softmax function;

[0009] A first loss function is determined according to the target softmax function, and the second neural network is trained according to the face image set and the first loss function to obtain a trained target neural network.

[0010] Furthermore, the step of determining a first loss function according to the target softmax function includes:

[0011] The first loss function is determined according to a preset intra-class sample aggregation function, a preset inter-class sample separation function and the target softmax function.

[0012] Furthermore, the step of training the second neural network according to the face image set and the first loss function to obtain a trained target neural network includes:

[0013] Determine each mini-batch according to the number of samples in the face image set and the number of samples in a preset single mini-batch, and record each mini-batch as being in an untrained state;

[0014] The second neural network is trained according to each mini-batch in an untrained state to obtain the target neural network.

[0015] Furthermore, the step of training the second neural network based on each untrained mini-batch to obtain the target neural network includes:

[0016] Selecting a target mini-batch from each of the untrained mini-batches, and inputting the target mini-batch into the second neural network for training, so as to obtain a first equation corresponding to a first loss function output by the second neural network;

[0017] According to the first equation and the optimization algorithm, the parameters in the second neural network are updated to obtain an updated third neural network;

[0018] Update the state of the target mini-batch to the trained state, and determine whether there is a mini-batch in the untrained state;

[0019] If not present, the updated third neural network is used as the target neural network.

[0020] Furthermore, the step of updating the parameters in the second neural network according to the first equation and the optimization algorithm to obtain an updated third neural network includes:

[0021] Determine an auxiliary variable corresponding to each sample in the target mini-batch, determine a class center parameter in the first equation based on the auxiliary variable, and substitute the class center parameter into the first equation to obtain a second equation;

[0022] According to the second equation and the optimization algorithm, the parameters in the second neural network are updated to obtain an updated third neural network.

[0023] Furthermore, after the step of updating the state of the target mini-batch to a trained state and determining whether there is an untrained mini-batch, the following step is further included:

[0024] If it exists, the first parameter and the second parameter in the first loss function are updated to obtain the second loss parameter;

[0025] The updated third neural network is used as the second neural network, the second loss parameter is used as the first loss parameter, and the step of selecting a target mini-batch from each untrained mini-batch and inputting it into the second neural network for training is returned.

[0026] Furthermore, the steps of performing model training on a preset first neural network according to the face image set and the preset softmax function to obtain a second neural network, and updating the softmax function to obtain a target softmax function include:

[0027] Inputting the face image set into a feature extraction module in a preset first neural network to obtain a feature vector corresponding to the face image set;

[0028] Inputting the feature vector into a classification recognition module in the first neural network to obtain a third equation corresponding to the softmax function output by the first neural network;

[0029] According to the third equation and the optimization algorithm, the parameters in the first neural network are updated to obtain a trained second neural network, and the first parameter and the second parameter in the softmax function are updated to obtain a target softmax function.

[0030] Furthermore, the step of training the second neural network according to the face image set and the first loss function to obtain a trained target neural network includes:

[0031] Get the user's face image;

[0032] Inputting the user face image into the feature extraction module in the target neural network to obtain a user feature vector;

[0033] The user feature vector is input into the classification and recognition module in the target neural network to obtain the classification result of the user's face.

[0034] In addition, to achieve the above-mentioned purpose, the present invention also provides a face image processing device, which includes: a memory, a processor, and a face image processing program stored in the memory and executable on the processor, and when the face image processing program is executed by the processor, the steps of the aforementioned face image processing method are implemented.

[0035] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, on which a face image processing program is stored, and when the face image processing program is executed by a processor, the steps of the aforementioned face image processing method are implemented.

[0036] The present invention obtains a face image set, and then performs model training on a preset first neural network according to the face image set and a softmax function to obtain a second neural network, and updates the softmax function to obtain a target softmax function, and then determines a first loss function according to the target softmax function, and trains the second neural network according to the face image set and the first loss function to obtain a trained target neural network. The target neural network can be trained according to the face image set and the first loss function to obtain a target neural network with high robustness and high recognition accuracy, and then the target neural network can be used to more accurately classify face images. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a structural schematic diagram of a face image processing device in a hardware operating environment involved in an embodiment of the present invention;

[0038] Figure 2 It is a flowchart of the first embodiment of the face image processing method of the present invention;

[0039] Figure 3 A schematic diagram of a first neural network of an embodiment of face image processing of the present invention;

[0040] Figure 4 Schematic diagram of a target neural network for facial image processing according to an embodiment of the present invention.

[0041] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0042] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0043] like Figure 1 As shown, Figure 1 It is a structural schematic diagram of a face image processing device in a hardware operating environment involved in an embodiment of the present invention.

[0044] The face image processing device of the embodiment of the present invention can be a PC, or it can be a mobile terminal device with a display function, such as a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, or a portable computer.

[0045] like Figure 1 As shown, the face image processing device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0046] Optionally, the face image processing device may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the face image processing device is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used for applications that recognize the posture of the face image processing device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the face image processing device may also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.

[0047] Those skilled in the art will understand that Figure 1The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0048] like Figure 1 As shown, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a face image processing program.

[0049] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the face image processing program stored in the memory 1005.

[0050] In this embodiment, the face image processing device includes: a memory 1005, a processor 1001, and a face image processing program stored on the memory 1005 and executable on the processor 1001, wherein the processor 1001 calls the face image processing program stored in the memory 1005 and executes the steps of the face image processing method in each of the following embodiments.

[0051] The present invention also provides a method for processing a face image, referring to Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the method of the present invention.

[0052] In this embodiment, the face image processing method includes the following steps:

[0053] Step S101, obtaining a face image set;

[0054] In this embodiment, first, a face image set is obtained, where the face image set refers to a training set consisting of face images and corresponding labels, such as: .

[0055] Step S102, performing model training on a preset first neural network according to the face image set and a preset softmax function to obtain a second neural network, and updating the softmax function to obtain a target softmax function;

[0056] In this embodiment, the face image set is input into a preset first neural network for model training to obtain a second neural network, and the softmax function is updated to obtain a target softmax function, wherein the first neural network adopts a preset softmax function, specifically, as follows: Figure 4The first neural network shown in the figure is composed of a feature extraction module and a classification and recognition module. The feature extraction module can select any representation model based on deep learning, such as VGG, ResNet, GoogLeNet, MobileNet, ShuffleNet, EfficientNet, etc. Among them, the feature extraction module completes the feature extraction of the input face image and converts the high-dimensional tensor information into a low-dimensional representation vector that can be directly used for recognition and classification. At present, the deep learning algorithm based on the convolutional neural network (CNN) model is the mainstream method for facial feature extraction. The classification and recognition module will be based on the facial feature vector given by the previous module. To perform face recognition and classification. Currently, the most common method for this module in the deep learning framework is to use the softmax function, that is, for any input image , and its corresponding true category label is ,image The low-dimensional feature vector obtained after inputting the feature extraction module is ,make Indicates category The corresponding output weight vector. In this way, the softmax function can be defined as:

[0057]

[0058] From formula (1), we can see that the task of the feature extraction module is to find appropriate model parameters , so that the low-dimensional representation vector output by the corresponding feature extraction module The corresponding loss function is minimized, and the main task of the classification and recognition module is to find the appropriate parameters ( is the number of target categories) so that the loss function For example, the face image set is input into the first neural network using the softmax function for model training to obtain the second neural network and update the model parameters in the softmax function. And parameters , to obtain the target softmax function.

[0059] It should also be noted that after a large number of experiments, the experimenters have shown that directly using the softmax function to train the model can often obtain face feature vectors that are separable between classes. However, this method cannot ensure that the inter-class distance of feature vectors corresponding to different categories is greater than the intra-class distance of different samples in the same category, and the distribution of feature vectors corresponding to different samples in the same category varies greatly. These characteristics undoubtedly damage the classification and recognition ability of the model. In order to solve the above problems, the existing technology proposes a center loss function:

[0060]

[0061] in is a newly introduced model parameter, indicating The class center parameter corresponding to the category. Assume that the total number of target categories is , then the model must have The class center parameters, and Combining the above center loss function with the traditional softmax function can further improve the intra-class clustering of the feature vector output by the feature extraction module. In the previous study, a constrained center loss function was proposed, and its specific form is shown in formula (3):

[0062]

[0063] in Indicates The class center parameter corresponding to the class, represents the radius of the hypersphere where the class center parameter is located, is a balancing parameter used to adjust the softmax function And the center loss function The weight ratio in the model loss function, and Represents the set of all trainable parameters of the model in the feature extraction module, Represents the model trainable parameters of the classification recognition module. According to formula (3), it can be seen that using this constrained center loss function, all class center parameters can be constrained on the surface of a hypersphere, and the sample feature vectors of the same category are clustered around their respective class center parameters. Due to the use of the class center parameter on the hypersphere surface constraint, the intra-class clustering and inter-class separability of the samples can be regarded as divided in the angle domain. In addition, by adjusting the radius The size of can be used to incorporate the effect of Euclidean distance on category division. In previous studies, in order to solve the constrained optimization problem in equation (3), an alternating optimization strategy was designed, namely:

[0064] First, according to the following formula :

[0065]

[0066] By deducing and solving equation (4), we can get the characteristic center (About the eigenvector The expression:

[0067]

[0068] in is the indicator function, which is specifically defined as:

[0069]

[0070] Will ask for Substitute into (3) and update the deep learning model , and other related trainable parameters; repeat the iterations of steps 1 and 2 until the model is stable. Experiments show that the above model further improves the discrimination accuracy of classification tasks such as face recognition. However, the model has the following three main problems: Formula (3) can make the feature vectors in the same category aggregate with each other, but it still cannot ensure that the feature vectors of different categories are sufficiently discrete. Therefore, the algorithm may still cause the distance between the feature vectors within the class to be greater than the distance between the feature vectors between classes, which will affect the accuracy of subsequent face discrimination. Based on formula (5), the center vector of each category can be updated. In order to ensure the accuracy of formula (5), it is often necessary to use the feature vectors corresponding to all samples in the entire training set to complete the relevant calculations. When the data set is large, this method will undoubtedly bring huge memory and computing resource consumption. Moreover, this method of calculating the class center parameters based on the full amount of samples is not conducive to the combination of the algorithm with common deep learning training methods such as small batch gradient descent. In the above model, the center of each category is regarded as a single vector, which does not fully consider the impact of other external factors such as lighting, posture, angle, environment, etc. on the recognition results in the face recognition task.

[0071] Furthermore, in one embodiment, step 102 includes:

[0072] Step a, inputting the face image set into a feature extraction module in a preset first neural network to obtain a feature vector corresponding to the face image set;

[0073] Step b, inputting the feature vector into a classification recognition module in the first neural network to obtain a third equation corresponding to the softmax function output by the first neural network;

[0074] Step c: according to the third equation and the optimization algorithm, the parameters in the first neural network are updated to obtain the trained second neural network, and the first parameter and the second parameter in the softmax function are updated to obtain the target softmax function.

[0075] In this embodiment, if Figure 4 As shown, the face image is input into the feature extraction module in the first neural network to obtain the feature vector corresponding to the face image set. The feature vector is Figure 4The facial feature vector f in the image is then input into the classification and recognition module in the first neural network to obtain the third equation corresponding to the softmax function output by the first neural network, which is formula (1). Then, you can freely choose optimization algorithms such as mini-batch gradient descent, AdaGrad, RMSprop, Adam, etc. to complete model training and update corresponding parameters, and then update the parameters in the first neural network to obtain the trained second neural network, and update the first parameter and the second parameter in the softmax function to obtain the target softmax function, where the first parameter refers to the model parameter of the feature extraction module. The second parameter refers to the parameter corresponding to the classification recognition module ( is the number of target categories).

[0076] Step S103, determining a first loss function according to the target softmax function, and training the second neural network according to the face image set and the first loss function to obtain a trained target neural network.

[0077] In this embodiment, after obtaining the second neural network, the first loss function is determined according to the obtained target softmax function, and the second neural network is trained according to the face image set and the first loss function to obtain a trained target neural network. The target neural network has better robustness and higher recognition accuracy.

[0078] Furthermore, in one embodiment, step 103 includes:

[0079] Step d: determining the first loss function according to a preset intra-class sample aggregation function, a preset inter-class sample separation function and the target softmax function.

[0080] In this embodiment, the intra-class sample aggregation function, the inter-class sample separation function and the target softmax function are added to obtain the first loss function, such as Figure 4 As shown, it includes two parts: feature extraction module and new classification recognition module. Among them, the feature extraction module can choose any representation model based on deep learning, such as VGG, ResNet, GoogLeNet, MobileNet, ShuffleNet, EfficientNet, etc. A new classification recognition module, no matter which of the above feature extraction methods is used, the new classification recognition module can further improve the overall performance of the model on the basis of the original accuracy. Specifically, according to the first loss function, the first equation is obtained, where the first equation is the optimization solution target as shown below:

[0081]

[0082] in Indicates The class center parameter point corresponding to the class, represents the radius of the hypersphere where the class center parameter is located, and Both are balance parameters used to adjust the weight ratio of the softmax function, the center loss function, and the inter-class sample separation function in the loss function. Represents all trainable parameters of the model in the feature extraction module, Represents the model trainable parameters of the classification recognition module. is the indicator function, for any sample:

[0083]

[0084] in The radius used to control the generalized class center parameter, The larger the corresponding class center parameter is, the more general it is, and the stronger the compatibility of the class with external disturbances is. The smaller the value, the better the separation between classes. .

[0085] The new classification recognition module consists of three parts: class center parameter calculation, class center parameter generalization, and softmax function. The softmax function is the same as formula (1).

[0086] The goal of the generalization operation of the class center parameter is to transform the class center parameter originally given by a single position point into the class center parameter given by a local hypersphere in space. The specific meaning is: for any category, the center of the original category is the center of the sphere, Construct a hypersphere with radius ; for any sample , when its eigenvector With the original class center parameters The distance is less than When , no penalty is imposed; when the eigenvector With the original class center parameters The distance is greater than or equal to When the two are close to each other in the feature space, a penalty is imposed based on the spatial distance between them. Compared with the method of using a single point as the class center parameter, the local hypersphere class center parameter proposed in the present invention is more generalized, and it can effectively reduce the impact of other disturbances such as illumination, posture, angle, environment, etc. on the prediction results in face recognition tasks. Experiments show that this method effectively improves the accuracy of the model.

[0087] The calculation of class center parameters includes three submodules: generalized intra-class sample aggregation function, inter-class sample separation function, and hypersphere surface constraint. Among them, the generalized intra-class sample aggregation function is , which is used to aggregate the representation vector of the sample in the feature space to the hypersphere of the class center parameter to which it belongs. Parameters in It can be used to control the radius of the space hypersphere. The larger the class center parameter, the larger the radius of the hypersphere, and the smaller the interval between the corresponding hyperspheres of different classes. This generalized class sample aggregation function can not only improve the intra-class aggregation of the sample representation vector, but also reduce the impact of detail perturbations and other interferences on classification.

[0088] The sample separation function between classes is ,in Represents the total number of categories in the data set, so that for any sample, the center vector of the corresponding category is , we hope to minimize the sum of inner products between it and other category center vectors. Because the hypersphere surface constraint is used , so that if the sum of the inner products of the center of any category and the centers of other categories is minimized, the distance between the hyperspheres of each category can be separated to the greatest extent. This makes it possible to increase the separation of samples between categories while improving the aggregation of samples within the category.

[0089] Furthermore, in one embodiment, step 103 includes:

[0090] Step e, determining each mini-batch according to the number of samples in the face image set and the number of samples in a preset single mini-batch, and recording each mini-batch as an untrained state;

[0091] Step f: training the second neural network according to each untrained mini-batch to obtain the target neural network.

[0092] In this embodiment, each mini-batch is determined according to the number of samples in the face image set and the number of samples in a single mini-batch. Specifically, the number of mini-batches is the number of samples in the face image set divided by the number of samples in a single mini-batch, and each mini-batch is recorded as being in an untrained state.

[0093] Finally, the second neural network is trained according to the mini-batches of each untrained state to obtain the target neural network.

[0094] Furthermore, in one embodiment, step f includes:

[0095] Step f1, selecting a target mini-batch from each untrained mini-batch, and inputting the target mini-batch into the second neural network for training, so as to obtain a first equation corresponding to a first loss function output by the second neural network;

[0096] Step f2, updating the parameters in the second neural network according to the first equation and the optimization algorithm to obtain an updated third neural network;

[0097] Step f3, update the state of the target mini-batch to the trained state, and determine whether there is an untrained mini-batch;

[0098] Step f4: if it does not exist, then use the updated third neural network as the target neural network.

[0099] In this embodiment, a target mini-batch is selected from each untrained mini-batch and input into the second neural network for training to obtain a first equation corresponding to the first loss function output by the second neural network; specifically, the first equation is shown in formula (6). Finally, according to the first equation and the optimization algorithm, the parameters in the second neural network are updated to obtain an updated third neural network. Then, the state of the target mini-batch is updated to a trained state, and it is determined whether there is an untrained mini-batch. If not, the updated third neural network is used as the target neural network. It should also be noted that after using the updated third neural network as the target neural network, it is possible to return to step e again and repeat the training of the target neural network.

[0100] Furthermore, in one embodiment, step f2 includes:

[0101] Step f21, determining the auxiliary variables corresponding to each sample in the target mini-batch, determining the class center parameters in the first equation according to the auxiliary variables, and substituting the class center parameters into the first equation to obtain the second equation;

[0102] Step f22, updating the parameters in the second neural network according to the second equation and the optimization algorithm to obtain an updated third neural network.

[0103] It should be noted that in order to calculate and update the class center parameters, the following optimization problem needs to be solved:

[0104]

[0105] Solving problem (7) based on relevant optimization theory yields:

[0106]

[0107] in is the indicator function, which is defined as follows:

[0108]

[0109] From formula (8), we can see that when updating the class center parameter points, we need to traverse all samples, which undoubtedly brings huge memory and computational consumption. However, if we only use the small batch samples in the small batch gradient descent algorithm to update the class center parameters, the center points of each category will jump frequently, and the algorithm as a whole will be difficult to converge. This instability is caused by the sampling error of the overall sample using the small batch samples. In order to solve this problem, a new class center parameter algorithm based on small batches is proposed. Its basic idea is to use the previous (In the experiment ) epoch uses the softmax function to train the neural network. After epochs, the small batch class center parameter update operation is introduced. The core of the small batch class center parameter update operation includes two points: 1. Ignore the general class center parameter constraints during the class center parameter update phase, that is, use Alternative As an indicator function, this can increase the number of samples involved in the calculation of class center parameters and improve stability; 2. The average operation of the representation vectors of each category based on all samples Transformed into an exponentially weighted average operation based on small batch samples, that is, introducing auxiliary variables , using the current mini-batch samples (assuming a total of ) to update the corresponding auxiliary variables:

[0110]

[0111] in is the hyperparameter of exponential weighted average. In practical applications, ; Indicates the number of times the class center parameters are updated; in practical applications, After epochs, every Each model training based on a small batch of samples updates the class center parameters once, that is,

[0112]

[0113] In the second step, when updating the neural network parameters, the class center parameters of each category given by equation (10) can be Substituting into the target equation (6), equation (6) can be further rewritten as:

[0114]

[0115] At this time, for any sample, its corresponding category center is known, then in the above model only the model parameters in the feature extraction module remain and model parameters in the new classification recognition module is the parameter to be optimized. In this way, you can freely choose optimization algorithms such as mini-batch gradient descent, AdaGrad, RMSprop, Adam, etc. to complete model training and update the corresponding parameters.

[0116] In this embodiment, the auxiliary variable corresponding to each sample in the target mini-batch is determined, that is, formula (9). Then, based on the auxiliary variable, the class center parameter in the first equation is determined, that is, formula (11) can be used to obtain the class center parameter. Then, the class center parameter is substituted into the first equation to obtain the second equation, which is formula (12). Then, based on the second equation and the optimization algorithm, the parameters in the second neural network are updated to obtain the third neural network.

[0117] Furthermore, in one embodiment, after step 103, the following steps are further included:

[0118] Step g: if it exists, updating the first parameter and the second parameter in the first loss function to obtain a second loss parameter;

[0119] Step h, using the updated third neural network as the second neural network, using the second loss parameter as the first loss parameter, and returning to execute the step of selecting a target mini-batch from each untrained mini-batch and inputting it into the second neural network for training.

[0120] In this embodiment, if it exists, the first parameter and the second parameter in the first loss function are updated to obtain the second loss parameter; the updated third neural network is used as the second neural network, the second loss parameter is used as the first loss parameter, and the step of selecting a target mini-batch from each untrained mini-batch and inputting it into the second neural network for training is returned. Specifically, for example, input: a training set consisting of face images and corresponding labels ;

[0121] Setting: Step size , the number of outer loop iterations , the number of samples in a single mini-batch , network structure of feature extraction module;

[0122] Initialization: feature extraction module trainable parameter set And the classification recognition module can train parameters ;

[0123] External loop, , repeat:

[0124] like :

[0125] Use the softmax function in formula (1) to train the neural network;

[0126] like :

[0127] Inner loop, , select a mini-batch and repeat:

[0128] a. Update the auxiliary variables corresponding to each sample according to formula (9) ;

[0129] b. If , according to formula (10) and formula (11), complete a class center update.

[0130] c. Based on the current sample, train the model with equation (12) as the target equation and update the feature extraction module parameters And classification recognition module parameters .

[0131] Get the facial feature vector corresponding to each sample ;

[0132] Output: The trained face recognition model, where the trained face recognition model is the target neural network.

[0133] The face image processing method proposed in this embodiment obtains a face image set, and then performs model training on a preset first neural network according to the face image set and a softmax function to obtain a second neural network, and updates the softmax function to obtain a target softmax function, and then determines a first loss function according to the target softmax function, and trains the second neural network according to the face image set and the first loss function to obtain a trained target neural network. A target neural network with high robustness and high recognition accuracy can be trained according to the face image set and the first loss function, and then the target neural network can be used to more accurately classify face images. A target neural network with high robustness and high recognition accuracy can be trained according to the face image set and the first loss function, and then the target neural network can be used to more accurately classify face images.

[0134] Based on the first embodiment, a second embodiment of the face image processing method of the present invention is proposed. In this embodiment, step S103 includes:

[0135] Step S201, obtaining a user face image;

[0136] Step S202, inputting the user face image into a feature extraction module in the target neural network to obtain a user feature vector;

[0137] Step S203: input the user feature vector into the classification and recognition module in the target neural network to obtain the classification result of the user's face.

[0138] In this embodiment, a user face image is obtained, and the user face image is input into a feature extraction module in the target neural network to obtain a user feature vector, and the user feature vector is input into a classification recognition module in the target neural network to obtain a classification result of the user face. Specifically, Figure 4 As shown, the classification and recognition module in the target neural network is a new classification and recognition module. The target neural network can be applied to the field of face recognition and face verification, for example, to the comparison of user face information.

[0139] In this embodiment, a user face image is obtained, and then the user face image is input into the feature extraction module in the target neural network to obtain a user feature vector, and then the user feature vector is input into the classification and recognition module in the target neural network to obtain a classification result of the user face, so that the user face image can be correctly classified according to the target neural network.

[0140] In addition, an embodiment of the present invention also proposes a face image processing device, which includes: a memory, a processor, and a face image processing program stored in the memory and runnable on the processor, and when the face image processing program is executed by the processor, the steps of the face image processing method described above are implemented.

[0141] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a face image processing program is stored. When the face image processing program is executed by a processor, the steps of the face image processing method described above are implemented.

[0142] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0143] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0144] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0145] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A facial image processing method, characterized in that: The face image processing method comprises the following steps: Get a set of face images; According to the face image set and the preset softmax function, a preset first neural network is model trained to obtain a second neural network, and the softmax function is updated to obtain a target softmax function; Determine a first loss function according to a preset intra-class sample aggregation function, a preset inter-class sample separation function, a preset hypersphere surface constraint rule, and the target softmax function, wherein the first loss function is used to constrain the class center parameter on the hypersphere surface, and to make the sample feature vectors of the same class gather around the respective class center parameters, while the sample feature vectors of different classes are far away from each other; Training the second neural network according to the face image set and the first loss function to obtain a trained target neural network; Get the user's face image; Inputting the user face image into the feature extraction module in the target neural network to obtain a user feature vector; Inputting the user feature vector into the classification and recognition module in the target neural network to obtain the classification result of the user's face; The step of determining the first loss function according to the preset intra-class sample aggregation function, the preset inter-class sample separation function, the preset hypersphere surface constraint rule and the target softmax function includes: Minimize the sum of the inner products of the center of any category with the centers of other categories to separate the distances between the hyperspheres of each category; Among them, the first loss function is as follows: in, Represents the model trainable parameters of the classification recognition module, Indicates The class center parameter point corresponding to the class, Indicates The class center parameter point corresponding to the class, Represents all trainable parameters of the model in the feature extraction module, is the true category label corresponding to any input image, express The corresponding output weight vector, is the eigenvector corresponding to any sample i, represents the total number of categories in the dataset, and , is a model parameter, indicating The class center parameter corresponding to the category; Mode The specific meaning is: for any category, the center of the original category is the center of the sphere, Construct a hypersphere with radius ; for any sample , when its eigenvector With the original class center parameters The distance is less than When , no penalty is imposed; when the eigenvector With the original class center parameters The distance is greater than or equal to When, according to the eigenvector With the original class center parameters The distance between them is penalized, forcing the eigenvector With the original class center parameters Approximate each other in the feature space, is the sample separation function between classes, where represents the radius of the hypersphere where the class center parameter is located, and are equilibrium parameters, is the indicator function.

2. The facial image processing method according to claim 1, characterized in that: The step of training the second neural network according to the face image set and the first loss function to obtain a trained target neural network comprises: According to the number of samples in the face image set and the preset number of samples in a single mini-batch, each mini-batch is determined, and each mini-batch is recorded as an untrained state; The second neural network is trained according to each mini-batch in an untrained state to obtain the target neural network.

3. The facial image processing method according to claim 2, characterized in that: The step of training the second neural network according to each untrained mini-batch to obtain the target neural network comprises: Selecting a target mini-batch from each of the untrained mini-batches, and inputting the target mini-batch into the second neural network for training, so as to obtain a first equation corresponding to a first loss function output by the second neural network; According to the first equation and the optimization algorithm, the parameters in the second neural network are updated to obtain an updated third neural network; Update the state of the target mini-batch to the trained state, and determine whether there is a mini-batch in the untrained state; If not present, the updated third neural network is used as the target neural network.

4. The facial image processing method according to claim 3, characterized in that: The step of updating the parameters in the second neural network according to the first equation and the optimization algorithm to obtain an updated third neural network comprises: Determine an auxiliary variable corresponding to each sample in the target mini-batch, determine a class center parameter in the first equation based on the auxiliary variable, and substitute the class center parameter into the first equation to obtain a second equation; According to the second equation and the optimization algorithm, the parameters in the second neural network are updated to obtain an updated third neural network.

5. The facial image processing method according to claim 3, characterized in that: After the step of updating the state of the target mini-batch to a trained state and determining whether there is a mini-batch in an untrained state, the method further includes: If it exists, then update the first parameter and the second parameter in the first loss function to obtain the second loss parameter; The updated third neural network is used as the second neural network, the second loss parameter is used as the first loss parameter, and the step of selecting a target mini-batch from each untrained mini-batch and inputting it into the second neural network for training is returned.

6. The facial image processing method according to claim 1, characterized in that: The steps of performing model training on a preset first neural network according to the face image set and a preset softmax function to obtain a second neural network, and updating the softmax function to obtain a target softmax function include: Inputting the face image set into a feature extraction module in a preset first neural network to obtain a feature vector corresponding to the face image set; Inputting the feature vector into a classification recognition module in the first neural network to obtain a third equation corresponding to the softmax function output by the first neural network; According to the third equation and the optimization algorithm, the parameters in the first neural network are updated to obtain a trained second neural network, and the first parameter and the second parameter in the softmax function are updated to obtain a target softmax function.

7. A facial image processing device, characterized in that: The face image processing device includes: a memory, a processor, and a face image processing program stored in the memory and executable on the processor. When the face image processing program is executed by the processor, the steps of the face image processing method according to any one of claims 1 to 6 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a face image processing program, and when the face image processing program is executed by the processor, the steps of the face image processing method according to any one of claims 1 to 6 are implemented.